Skip to content

Commit

Permalink
Merge branch 'main' into feat/braze-waf
Browse files Browse the repository at this point in the history
  • Loading branch information
bassrock authored Aug 29, 2024
2 parents 42767d7 + 5689758 commit 45e9786
Show file tree
Hide file tree
Showing 36 changed files with 1,952 additions and 440 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/parser-graphql-wrapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
with:
federated-graph-name: pocket-admin-api
graph-name: parser
schema-file-path: servers/parser-graphql-wrapper/schema.graphql
schema-file-path: servers/parser-graphql-wrapper/schema-admin.graphql
prod-graph-url: https://parser-graphql-wrapper.readitlater.com
dev-graph-url: https://parser-graphql-wrapper.getpocket.dev
secrets:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@pocket-tools/eslint-config": "workspace:*",
"syncpack": "^12.4.0",
"tsconfig": "workspace:*",
"turbo": "^2.0.14"
"turbo": "^2.1.0"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions packages/apollo-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"@apollo/cache-control-types": "1.0.3",
"@apollo/server": "4.10.4",
"@apollo/server-plugin-response-cache": "4.1.3",
"@apollo/subgraph": "2.8.4",
"@apollo/subgraph": "2.9.0",
"@apollo/utils.keyvadapter": "3.1.0",
"@apollo/utils.keyvaluecache": "3.1.0",
"@pocket-tools/ts-logger": "workspace:*",
Expand Down Expand Up @@ -107,7 +107,7 @@
},
"peerDependencies": {
"@apollo/server": "4.10.4",
"@apollo/subgraph": "2.8.4",
"@apollo/subgraph": "2.9.0",
"@apollo/utils.keyvadapter": "3.1.0",
"@apollo/utils.keyvaluecache": "3.1.0",
"express": "4.19.2",
Expand Down
8 changes: 8 additions & 0 deletions packages/image-utils/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
src
.github
.idea
.prettier*
.eslintrc.js
.tsconfig.js
*.spec.ts
*.integration.ts
3 changes: 3 additions & 0 deletions packages/image-utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Image Utils

We use this repository as a place to keep code we use across our backend services that implement anything to do with image urls
3 changes: 3 additions & 0 deletions packages/image-utils/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import packages from '@pocket-tools/eslint-config/packages';
import tseslint from 'typescript-eslint';
export default tseslint.config(...packages);
7 changes: 7 additions & 0 deletions packages/image-utils/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/?(*.)+(jest|spec).[jt]s?(x)'],
testPathIgnorePatterns: ['/dist/'],
setupFilesAfterEnv: ['jest-extended/all'],
};
91 changes: 91 additions & 0 deletions packages/image-utils/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"name": "@pocket-tools/image-utils",
"version": "0.0.0-development",
"description": "Utilities for working with image urls",
"keywords": [
"image"
],
"repository": {
"type": "git",
"url": "git+https://github.com/Pocket/pocket-monorepo.git"
},
"license": "Apache-2.0",
"author": "",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist",
"package.json"
],
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts",
"dev": "pnpm run build --watch",
"format": "eslint --fix",
"lint": "eslint --fix-dry-run",
"semantic-release": "semantic-release",
"test": "jest",
"test:watch": "pnpm run test -- --watch"
},
"release": {
"branches": [
"main"
],
"extends": "semantic-release-monorepo",
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES",
"BREAKING"
]
}
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES",
"BREAKING"
]
},
"writerOpts": {
"commitsSort": [
"subject",
"scope"
]
}
}
],
"@semantic-release/npm",
"@semantic-release/github"
]
},
"dependencies": {
"parse-url": "9.2.0"
},
"devDependencies": {
"@jest/globals": "29.7.0",
"@pocket-tools/eslint-config": "workspace:*",
"@types/jest": "29.5.12",
"@types/node": "^20.16",
"jest": "29.7.0",
"jest-extended": "4.0.2",
"semantic-release": "24.1.0",
"semantic-release-monorepo": "8.0.2",
"ts-jest": "29.2.4",
"ts-node": "10.9.2",
"tsconfig": "workspace:*",
"tsup": "8.2.4",
"typescript": "5.5.4"
},
"peerDependencies": {}
}
1 change: 1 addition & 0 deletions packages/image-utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './utils';
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { NotFoundError } from '@pocket-tools/apollo-utils';
import { getOriginalUrlIfPocketImageCached } from './utils';

describe('getOriginalUrlIfPocketImageCached', () => {
Expand Down Expand Up @@ -29,8 +28,6 @@ describe('getOriginalUrlIfPocketImageCached', () => {
const url = 'https://pocket-image-cache.com/direct?resize=2000w';
expect(() => {
getOriginalUrlIfPocketImageCached(url);
}).toThrowError(
new NotFoundError('Pocket image cache url is missing a source url'),
);
}).toThrow(new Error('Source URL Missing'));
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { NotFoundError } from '@pocket-tools/apollo-utils';
import parseUrl from 'parse-url';

//Functions on this page taken from Web Client.
Expand All @@ -19,7 +18,7 @@ export const getOriginalUrlIfPocketImageCached = (url: string): string => {
if (isEncoded) {
const urlToUse = extractImageCacheUrl(url);
if (!urlToUse) {
throw new NotFoundError('Pocket image cache url is missing a source url');
throw new Error('Source URL Missing');
}
return decodeURIComponent(urlToUse);
}
Expand Down
9 changes: 9 additions & 0 deletions packages/image-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "tsconfig/library.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src"
},
"exclude": ["node_modules", "dist"],
"include": ["src/**/*.ts", "src/config"]
}
Loading

0 comments on commit 45e9786

Please sign in to comment.