Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
"version:bump": "node scripts/bump-version.mjs"
},
"devDependencies": {
"@peac/contracts": "workspace:^",
"@peac/mappings-tap": "workspace:^",
"@types/node": "^22.19.11",
"@eslint/js": "^10.0.1",
"ajv": "^8.18.0",
Expand Down
33 changes: 33 additions & 0 deletions packages/worker-shared/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "@peac/worker-shared",
"version": "0.10.13",
"private": true,
"description": "Shared runtime-neutral TAP verification logic for edge worker surfaces",
"type": "module",
"main": "./src/index.ts",
"types": "./src/index.ts",
"exports": {
".": {
"types": "./src/index.ts",
"import": "./src/index.ts",
"default": "./src/index.ts"
}
},
"repository": {
"type": "git",
"url": "https://github.com/peacprotocol/peac.git",
"directory": "packages/worker-shared"
},
"author": "PEAC Protocol Contributors",
"license": "Apache-2.0",
"scripts": {
"build": "tsc --noEmit",
"typecheck": "tsc --noEmit",
"clean": "node -e \"/* no-op: source-exports package has no build artifacts */\""
},
"dependencies": {
"@peac/contracts": "workspace:*",
"@peac/mappings-tap": "workspace:*"
},
"sideEffects": false
}
8 changes: 8 additions & 0 deletions packages/worker-shared/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"composite": false,
"noEmit": true
},
"include": ["src"]
}
24 changes: 18 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 0 additions & 30 deletions surfaces/_shared/contracts/error-contract.ts

This file was deleted.

22 changes: 0 additions & 22 deletions surfaces/_shared/contracts/index.ts

This file was deleted.

3 changes: 2 additions & 1 deletion surfaces/workers/akamai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"@peac/contracts": "workspace:^",
"@peac/http-signatures": "workspace:*",
"@peac/jwks-cache": "workspace:*",
"@peac/mappings-tap": "workspace:*"
"@peac/mappings-tap": "workspace:*",
"@peac/worker-shared": "workspace:*"
},
"devDependencies": {
"typescript": "^5.3.0",
Expand Down
4 changes: 2 additions & 2 deletions surfaces/workers/akamai/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import type { WorkerConfig, EWRequest } from './types.js';
import { parseConfigFromEnv } from '../../_shared/core/index.js';
import { parseConfigFromEnv } from '@peac/worker-shared';

/**
* Parse config from Akamai Property Manager variables.
Expand Down Expand Up @@ -44,4 +44,4 @@ export function parseConfigFromRecord(env: Record<string, string | undefined>):
}

// Re-export config utilities from shared core
export { matchesBypassPath, isIssuerAllowed } from '../../_shared/core/index.js';
export { matchesBypassPath, isIssuerAllowed } from '@peac/worker-shared';
2 changes: 1 addition & 1 deletion surfaces/workers/akamai/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import type { ProblemDetails, EWRequestHandler } from './types.js';
import { ErrorCodes, createProblemDetails } from '../../_shared/core/index.js';
import { ErrorCodes, createProblemDetails } from '@peac/worker-shared';

// Re-export error codes from shared core
export { ErrorCodes };
Expand Down
6 changes: 1 addition & 5 deletions surfaces/workers/akamai/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ import {
ErrorCodes,
createErrorResponse,
} from './errors.js';
import {
handleVerification,
type HandlerResult,
type RequestLike,
} from '../../_shared/core/index.js';
import { handleVerification, type HandlerResult, type RequestLike } from '@peac/worker-shared';

// Re-export types and utilities
export type {
Expand Down
2 changes: 1 addition & 1 deletion surfaces/workers/akamai/src/replay-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import type { ReplayStore, ReplayContext, EdgeKVConfig } from './types.js';
import { hashReplayKey } from '../../_shared/core/index.js';
import { hashReplayKey } from '@peac/worker-shared';

// Re-export hash function for testing
export { hashReplayKey };
Expand Down
2 changes: 1 addition & 1 deletion surfaces/workers/akamai/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type {
ReplayStore,
VerificationResult,
ProblemDetails,
} from '../../_shared/core/index.js';
} from '@peac/worker-shared';

/**
* Akamai EdgeWorkers environment configuration.
Expand Down
3 changes: 2 additions & 1 deletion surfaces/workers/cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"@peac/contracts": "workspace:^",
"@peac/http-signatures": "workspace:*",
"@peac/jwks-cache": "workspace:*",
"@peac/mappings-tap": "workspace:*"
"@peac/mappings-tap": "workspace:*",
"@peac/worker-shared": "workspace:*"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20260214.0",
Expand Down
8 changes: 2 additions & 6 deletions surfaces/workers/cloudflare/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@
*/

import type { Env } from './types.js';
import type { WorkerConfig } from '../../_shared/core/index.js';
import {
parseConfigFromEnv,
matchesBypassPath,
isIssuerAllowed,
} from '../../_shared/core/index.js';
import type { WorkerConfig } from '@peac/worker-shared';
import { parseConfigFromEnv, matchesBypassPath, isIssuerAllowed } from '@peac/worker-shared';

// Re-export shared utilities
export { matchesBypassPath, isIssuerAllowed };
Expand Down
2 changes: 1 addition & 1 deletion surfaces/workers/cloudflare/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import type { ProblemDetails } from './types.js';
import { ErrorCodes, createProblemDetails } from '../../_shared/core/index.js';
import { ErrorCodes, createProblemDetails } from '@peac/worker-shared';

// Re-export error codes from shared core
export { ErrorCodes };
Expand Down
6 changes: 1 addition & 5 deletions surfaces/workers/cloudflare/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ import type { Env, WorkerConfig } from './types.js';
import { parseConfig } from './config.js';
import { createReplayStore } from './replay-store.js';
import { createErrorResponse, createChallengeResponse, ErrorCodes } from './errors.js';
import {
handleVerification,
type HandlerResult,
type RequestLike,
} from '../../_shared/core/index.js';
import { handleVerification, type HandlerResult, type RequestLike } from '@peac/worker-shared';

// Re-export types and utilities
export type {
Expand Down
2 changes: 1 addition & 1 deletion surfaces/workers/cloudflare/src/replay-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import type { ReplayStore, ReplayContext } from './types.js';
import type { Env } from './types.js';
import { hashReplayKey } from '../../_shared/core/index.js';
import { hashReplayKey } from '@peac/worker-shared';

// Re-export hash function for testing
export { hashReplayKey };
Expand Down
2 changes: 1 addition & 1 deletion surfaces/workers/cloudflare/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type {
ReplayStore,
VerificationResult,
ProblemDetails,
} from '../../_shared/core/index.js';
} from '@peac/worker-shared';

/**
* Cloudflare Worker environment bindings.
Expand Down
3 changes: 2 additions & 1 deletion surfaces/workers/fastly/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"@peac/contracts": "workspace:^",
"@peac/http-signatures": "workspace:*",
"@peac/jwks-cache": "workspace:*",
"@peac/mappings-tap": "workspace:*"
"@peac/mappings-tap": "workspace:*",
"@peac/worker-shared": "workspace:*"
},
"devDependencies": {
"@fastly/js-compute": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions surfaces/workers/fastly/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import type { WorkerConfig } from './types.js';
import { parseConfigFromEnv } from '../../_shared/core/index.js';
import { parseConfigFromEnv } from '@peac/worker-shared';

/**
* Parse config from Fastly Edge Dictionary.
Expand Down Expand Up @@ -80,4 +80,4 @@ function getDictionary(name: string): Map<string, string> | null {
}

// Re-export config utilities from shared core
export { matchesBypassPath, isIssuerAllowed } from '../../_shared/core/index.js';
export { matchesBypassPath, isIssuerAllowed } from '@peac/worker-shared';
2 changes: 1 addition & 1 deletion surfaces/workers/fastly/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import type { ProblemDetails } from './types.js';
import { ErrorCodes, createProblemDetails } from '../../_shared/core/index.js';
import { ErrorCodes, createProblemDetails } from '@peac/worker-shared';

// Re-export error codes from shared core
export { ErrorCodes };
Expand Down
6 changes: 1 addition & 5 deletions surfaces/workers/fastly/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ import type { WorkerConfig, FastlyBackendConfig } from './types.js';
import { parseConfig } from './config.js';
import { createReplayStore } from './replay-store.js';
import { createErrorResponse, createChallengeResponse, ErrorCodes } from './errors.js';
import {
handleVerification,
type HandlerResult,
type RequestLike,
} from '../../_shared/core/index.js';
import { handleVerification, type HandlerResult, type RequestLike } from '@peac/worker-shared';

// Re-export types and utilities
export type {
Expand Down
2 changes: 1 addition & 1 deletion surfaces/workers/fastly/src/replay-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import type { ReplayStore, ReplayContext } from './types.js';
import { hashReplayKey } from '../../_shared/core/index.js';
import { hashReplayKey } from '@peac/worker-shared';

// Re-export hash function for testing
export { hashReplayKey };
Expand Down
2 changes: 1 addition & 1 deletion surfaces/workers/fastly/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type {
ReplayStore,
VerificationResult,
ProblemDetails,
} from '../../_shared/core/index.js';
} from '@peac/worker-shared';

/**
* Fastly Compute environment configuration.
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
"@peac/mappings-mcp": ["./packages/mappings/mcp/src"],
"@peac/mappings-ucp": ["./packages/mappings/ucp/src"],
"@peac/mappings-aipref": ["./packages/mappings/aipref/src"],
"@peac/mcp-server": ["./packages/mcp-server/src"]
"@peac/mcp-server": ["./packages/mcp-server/src"],
"@peac/worker-shared": ["./packages/worker-shared/src"]
}
},
"exclude": ["node_modules", "dist", "build", "lib", "coverage"]
Expand Down
Loading