Skip to content

Commit

Permalink
update quisi.do worker (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
quisido authored Oct 11, 2024
1 parent 703915a commit a457e02
Show file tree
Hide file tree
Showing 490 changed files with 9,239 additions and 4,328 deletions.
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
All rights reserved.
File renamed without changes
Binary file added assets/favicon98.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo320x132.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import configs from '@quisido/eslint-config';
/** @type {readonly import('eslint').Linter.FlatConfig[]} */
export default [
...configs,

{
ignores: ['packages/**'],
},
Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"homepage": "https://quisi.do/",
"packageManager": "[email protected]",
"private": true,
"repository": "github:quisido/quisi.do",
"type": "module",
"bugs": {
"email": "[email protected]",
Expand All @@ -19,6 +18,10 @@
"publishConfig": {
"access": "restricted"
},
"repository": {
"type": "git",
"url": "git+https://github.com/quisido/quisi.do.git"
},
"scripts": {
"attw": "attw --exclude-entrypoints .",
"authn": "yarn packages/authn run dev",
Expand All @@ -41,8 +44,10 @@
"postlighthouse": "yarn packages/next run postlighthouse",
"prepack": "yarn workspaces foreach --all --exclude \"@quisi/do\" --interlaced --jobs unlimited --parallel --topological-dev --verbose run prepack",
"prepack:limited": "yarn workspaces foreach --all --exclude \"@quisi/do\" --topological-dev run prepack",
"prepublish": "concurrently --kill-others-on-fail --names eslint,prepublish,test,vitest \"yarn run eslint\" \"yarn run prepublish:workspaces\" \"yarn run test\" \"yarn run vitest:run\"",
"prepublish": "concurrently --kill-others-on-fail --names eslint,prepublish,publint,test,vitest \"yarn run eslint\" \"yarn run prepublish:workspaces\" \"yarn run publint\" \"yarn run test\" \"yarn run vitest:run\"",
"prepublish:workspaces": "yarn workspaces foreach --all --exclude \"@quisi/do\" --verbose run prepublish",
"publint": "publint",
"publint:workspaces": "yarn workspaces foreach --all --exclude \"@quisi/do\" --verbose run publint",
"publish": "yarn workspaces foreach --all --jobs unlimited --no-private --parallel --topological-dev --verbose npm publish --tolerate-republish",
"reinit": "yarn packages/authn run local:reinit",
"serve": "yarn packages/next run serve",
Expand Down Expand Up @@ -85,6 +90,7 @@
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.3",
"prettier": "^3.3.2",
"publint": "^0.2.10",
"typescript": "~5.4.5",
"typescript-eslint": "^7.14.1",
"vitest": "^1.6.0"
Expand Down
16 changes: 13 additions & 3 deletions packages/authn-shared/package.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
{
"name": "@quisido/authn-shared",
"version": "1.1.0",
"version": "1.1.2",
"author": "quisi.do <[email protected]>",
"description": "isomorphic authentication modules",
"homepage": "https://github.com/quisido/quisi.do/tree/main/packages/authn-shared#readme",
"license": "MIT",
"main": "./dist/index.js",
"repository": "github:quisido/quisi.do",
"module": "./dist/index.js",
"type": "module",
"types": "./dist/index.d.ts",
"bugs": {
"email": "[email protected]",
"url": "https://github.com/quisido/quisi.do/issues"
},
"exports": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"funding": {
"type": "individual",
"url": "https://github.com/sponsors/quisido"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/quisido/quisi.do.git"
},
"scripts": {
"attw": "attw --quiet",
"clean": "rm -rf coverage dist && rm -f tsconfig.prepack.tsbuildinfo tsc-output.cpuprofile",
"eslint": "eslint . --cache --color --exit-on-fatal-error --max-warnings 0",
"eslint:fix": "eslint . --cache --color --exit-on-fatal-error --fix --max-warnings 0",
"prepack": "yarn run tsc",
"prepublish": "concurrently --kill-others-on-fail --names attw,eslint,vitest \"yarn run attw\" \"yarn run eslint\" \"yarn run vitest:run\"",
"prepublish": "concurrently --kill-others-on-fail --names attw,eslint,publint,vitest \"yarn run attw\" \"yarn run eslint\" \"yarn run publint\" \"yarn run vitest:run\"",
"publint": "publint",
"tsc": "tsc --generateCpuProfile tsc-output.cpuprofile --project tsconfig.prepack.json",
"vitest": "vitest",
"vitest:run": "vitest run",
Expand All @@ -53,6 +62,7 @@
"eslint-plugin-prettier": "^5.1.3",
"fmrs": "workspace:^",
"prettier": "^3.3.2",
"publint": "^0.2.10",
"tslib": "^2.6.3",
"typescript": "~5.4.5",
"vite": "^5.3.2",
Expand Down
54 changes: 27 additions & 27 deletions packages/authn-shared/src/error-code.ts
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
export enum ErrorCode {
// OAuth
InvalidStateReturnPath = 11,
InvalidStateSessionId = 51,
MissingCookies = 12,
MissingSessionIDCookie = 13,
MissingSessionIdCookie = 13,
MissingState = 4,
MissingStateReturnPath = 9,
MissingStateSessionID = 10,
MissingStateSessionId = 10,
NonJsonState = 5,
NonObjectState = 8,
NonStringStateReturnPath = 11,

// Patreon
InvalidPatreonOAuthClientID = 17,
InvalidPatreonOAuthClientId = 17,
InvalidPatreonOAuthClientSecret = 19,
InvalidPatreonOAuthHost = 21,
InvalidPatreonOAuthRedirectUri = 23,
MissingPatreonOAuthClientID = 16,
MissingPatreonOAuthClientId = 16,
MissingPatreonOAuthClientSecret = 18,
MissingPatreonOAuthRedirectUri = 22,

// Patreon access token
InvalidPatreonClientID = 28,
ForbiddenPatreonIdentityResponse = 39,
InvalidInvalidPatreonAccessTokenRequestDescription = 31,
InvalidPatreonAccessToken = 37,
InvalidPatreonAccessTokenError = 26,
InvalidPatreonAccessTokenErrorBody = 24,
InvalidPatreonAccessTokenRequest = 32,
InvalidPatreonClientId = 28,
InvalidPatreonGrantCode = 29,
InvalidPatreonTokenRequest = 32,
MissingInvalidPatreonRequestDescription = 30,
MissingPatreonAccessToken = 36,
MissingPatreonRequestCode = 15,
MissingPatreonTokenErrorBody = 25,
MissingPatreonTokenErrorCode = 27,
NonJsonPatreonTokenErrorBody = 24,
NonJsonPatreonTokenResponse = 34,
NonObjectPatreonTokenError = 26,
NonObjectPatreonTokenResponse = 35,
NonStringInvalidPatreonRequestDescription = 31,
NonStringPatreonAccessToken = 37,
UnknownPatreonTokenError = 33,

// Patreon identity
InvalidPatreonIdentity = 41,
InvalidPatreonIdentityData = 43,
InvalidPatreonIdentityId = 45,
InvalidPatreonIdentityResponse = 38,
InvalidPatreonOAuthToken = 35,
InvalidPatreonOAuthTokenResponse = 34,
MissingInvalidPatreonAccessTokenRequestDescription = 30,
MissingPatreonAccessToken = 36,
MissingPatreonAccessTokenErrorBody = 25,
MissingPatreonAccessTokenErrorCode = 27,
MissingPatreonIdentityData = 42,
MissingPatreonIdentityId = 44,
NonJsonPatreonIdentityResponse = 38,
NonObjectPatreonIdentityResponse = 41,
NonOkPatreonIdentityResponseStatus = 40,
NonStringPatreonIdentityId = 45,
PatreonIdentityForbidden = 39,
MissingPatreonOAuthHost = 52,
MissingPatreonRequestCode = 15,
UnknownPatreonAccessTokenErrorCode = 33,
UnknownPatreonIdentityError = 40,

// quisi.do
CSRF = 14,
InvalidAuthnUserIdsNamespace = 20,
InvalidCause = 3,
InvalidDatabase = 47,
InvalidIsolateEnvironment = 6,
InvalidOAuthUserId = 48,
InvalidUsageDataset = 50,
InvalidUserId = 48,
MissingAuthnUserIdsNamespace = 49,
MissingDatabase = 46,
MissingIsolateEnvironment = 7,
Expand Down
2 changes: 2 additions & 0 deletions packages/authn-shared/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export { ErrorCode } from './error-code.js';
export { default as isErrorCode } from './is-error-code.js';
export { WhoAmIResponseCode } from './whoami-response-code.js';

export const WHOAMI_THROTTLE_DURATION = 1000;
1 change: 1 addition & 0 deletions packages/authn/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
All rights reserved.
34 changes: 31 additions & 3 deletions packages/authn/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ export default [
},
},

{
files: ['src/features/authn-user-id.ts'],
rules: {
'func-style': 'off',
},
},

{
files: ['src/features/get-console.ts'],
rules: {
Expand All @@ -42,16 +49,32 @@ export default [
},

{
files: ['src/features/patreon/get-patreon-token-response.ts'],
files: [
'src/routes/patreon/get-patreon-token-response.ts',
'src/routes/patreon/handle-invalid-patreon-access-token-request-description.ts',
],

rules: {
camelcase: 'off',
},
},

{
files: ['src/features/telemetry-queue.ts'],
files: [
'src/routes/patreon/handle-invalid-invalid-patreon-access-token-request-description.ts',
'src/routes/patreon/handle-invalid-patreon-access-token-request-description.ts',
'src/routes/patreon/handle-missing-invalid-patreon-access-token-request-description.ts',
],

rules: {
'no-undefined': 'off',
},
},

{
files: ['src/test/authn-test.ts'],
rules: {
'no-console': 'off',
'max-lines-per-function': 'off',
},
},

Expand All @@ -78,7 +101,12 @@ export default [

{
rules: {
camelcase: 'off',
'max-statements': 'off',
'no-undefined': 'off',

// Consider passing parameters as a single object instead.
'max-params': 'off',
},
},
];
10 changes: 7 additions & 3 deletions packages/authn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,32 @@
"local:reinit": "yarn run local:drop && yarn run local:init",
"login": "wrangler login",
"prepack": "exit 0",
"prepublish": "concurrently --kill-others-on-fail --names eslint,tsc,vitest \"yarn run eslint\" \"yarn run tsc\" \"yarn run vitest:run\"",
"prepublish": "concurrently --kill-others-on-fail --names eslint,publint,tsc,vitest \"yarn run eslint\" \"yarn run publint\" \"yarn run tsc\" \"yarn run vitest:run\"",
"production:deploy": "wrangler deploy src/index.ts --env production --outdir dist",
"production:deploy:dry-run": "wrangler deploy src/index.ts --dry-run --env production --outdir dist",
"production:init": "yarn run production:init:emails && yarn run production:init:oauth && yarn run production:init:users",
"production:init:emails": "wrangler d1 execute authn --env production --file=./sql/emails.sql --remote",
"production:init:oauth": "wrangler d1 execute authn --env production --file=./sql/oauth.sql --remote",
"production:init:users": "wrangler d1 execute authn --env production --file=./sql/users.sql --remote",
"publint": "publint",
"staging:deploy": "wrangler deploy src/index.ts --env staging --outdir dist --remote",
"staging:deploy:dry-run": "wrangler deploy src/index.ts --dry-run --env staging --outdir dist --remote",
"staging:init": "yarn run staging:init:emails && yarn run staging:init:oauth && yarn run staging:init:users",
"staging:init:emails": "wrangler d1 execute authn-staging --env staging --file=./sql/emails.sql --remote",
"staging:init:oauth": "wrangler d1 execute authn-staging --env staging --file=./sql/oauth.sql --remote",
"staging:init:users": "wrangler d1 execute authn-staging --env staging --file=./sql/users.sql --remote",
"tsc": "tsc --skipLibCheck",
"tsc:no-emit": "tsc --noEmit --skipLibCheck",
"vitest": "vitest",
"vitest:run": "vitest run",
"vitest:watch": "vitest watch",
"whoami": "wrangler whoami"
},
"dependencies": {
"@quisido/authn-shared": "workspace:^",
"@quisido/workers-shared": "workspace:^",
"@quisido/proposal-async-context": "workspace:^",
"@quisido/worker": "workspace:^",
"cloudflare-utils": "workspace:^",
"cookie": "^0.6.0",
"fmrs": "workspace:^",
"form-urlencoded": "^6.1.5",
"tslib": "^2.6.3"
Expand All @@ -60,7 +62,9 @@
"babel-plugin-replace-import-extension": "^1.1.4",
"cjs-ts": "workspace:^",
"concurrently": "^8.2.2",
"cookie": "^0.6.0",
"eslint": "^9.5.0",
"publint": "^0.2.10",
"typescript": "~5.4.5",
"vite": "^5.3.2",
"vitest": "^1.6.0",
Expand Down
12 changes: 0 additions & 12 deletions packages/authn/src/constants/authn-user-id-map.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/authn/src/constants/default-cookie-domain.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const DEFAULT_COOKIE_DOMAIN = 'quisi.do';
1 change: 0 additions & 1 deletion packages/authn/src/constants/default-return-href.ts

This file was deleted.

5 changes: 2 additions & 3 deletions packages/authn/src/constants/environment-name.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
enum EnvironmentName {
export enum EnvironmentName {
Development = 'development',
Production = 'production',
Staging = 'staging',
Test = 'test',
Unknown = 'unknown',
}

export default EnvironmentName;
4 changes: 1 addition & 3 deletions packages/authn/src/constants/gender.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
enum Gender {
export enum Gender {
Female = 1,
Male = 2,
Neutral = 0,
}

export default Gender;
Loading

0 comments on commit a457e02

Please sign in to comment.