@japikey/cloudflare 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/router.d.ts +9 -6
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +1 -1
- package/package.json +5 -3
package/dist/router.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { DatabaseDriver } from '@japikey/japikey';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Request as WorkerRequest, ExportedHandlerFetchHandler, IncomingRequestCfProperties } from '@cloudflare/workers-types';
|
|
3
3
|
export type CreateApiKeyData = {
|
|
4
4
|
expiresAt: Date;
|
|
5
5
|
claims: Record<string, unknown>;
|
|
6
6
|
databaseMetadata: Record<string, unknown>;
|
|
7
7
|
};
|
|
8
8
|
export type ApiKeyRouterOptions<Env> = {
|
|
9
|
-
getUserId: (request:
|
|
10
|
-
parseCreateApiKeyRequest: (request:
|
|
9
|
+
getUserId: (request: WorkerRequest<unknown, IncomingRequestCfProperties>, env: Env) => Promise<string>;
|
|
10
|
+
parseCreateApiKeyRequest: (request: WorkerRequest<unknown, IncomingRequestCfProperties>, env: Env) => Promise<CreateApiKeyData>;
|
|
11
11
|
issuer: URL;
|
|
12
12
|
aud: string;
|
|
13
13
|
db: DatabaseDriver;
|
|
@@ -18,7 +18,10 @@ export type JwksRouterOptions = {
|
|
|
18
18
|
db: DatabaseDriver;
|
|
19
19
|
maxAgeSeconds?: number;
|
|
20
20
|
};
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
export type SimpleHandler<Env> = {
|
|
22
|
+
fetch: ExportedHandlerFetchHandler<Env>;
|
|
23
|
+
};
|
|
24
|
+
export declare function createJWKSRouter<Env>(options: JwksRouterOptions): SimpleHandler<Env>;
|
|
25
|
+
export declare function isJWKSPath<C>(request: WorkerRequest<unknown, IncomingRequestCfProperties>, baseIssuer: URL): boolean;
|
|
26
|
+
export declare function createApiKeyRouter<Env>(options: ApiKeyRouterOptions<Env>): SimpleHandler<Env>;
|
|
24
27
|
//# sourceMappingURL=router.d.ts.map
|
package/dist/router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,kBAAkB,CAAC;AAGtE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,kBAAkB,CAAC;AAGtE,OAAO,KAAK,EACV,OAAO,IAAI,aAAa,EAExB,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,2BAA2B,CAAC;AAGnC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,IAAI,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAAC,GAAG,IAAI;IACrC,SAAS,EAAE,CACT,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,2BAA2B,CAAC,EAC5D,GAAG,EAAE,GAAG,KACL,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB,wBAAwB,EAAE,CACxB,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,2BAA2B,CAAC,EAC5D,GAAG,EAAE,GAAG,KACL,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC/B,MAAM,EAAE,GAAG,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,cAAc,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,GAAG,CAAC;IAChB,EAAE,EAAE,cAAc,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,aAAa,CAAC,GAAG,IAAI;IAC/B,KAAK,EAAE,2BAA2B,CAAC,GAAG,CAAC,CAAC;CACzC,CAAC;AA2EF,wBAAgB,gBAAgB,CAAC,GAAG,EAClC,OAAO,EAAE,iBAAiB,GACzB,aAAa,CAAC,GAAG,CAAC,CASpB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAC1B,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,2BAA2B,CAAC,EAC5D,UAAU,EAAE,GAAG,GACd,OAAO,CAOT;AA6HD,wBAAgB,kBAAkB,CAAC,GAAG,EACpC,OAAO,EAAE,mBAAmB,CAAC,GAAG,CAAC,GAChC,aAAa,CAAC,GAAG,CAAC,CAqCpB"}
|
package/dist/router.js
CHANGED
|
@@ -65,7 +65,7 @@ function getWellKnownKid(request, baseIssuer) {
|
|
|
65
65
|
}
|
|
66
66
|
export function createJWKSRouter(options) {
|
|
67
67
|
return {
|
|
68
|
-
fetch: wrapError(async function fetch(request
|
|
68
|
+
fetch: wrapError(async function fetch(request) {
|
|
69
69
|
const kid = getWellKnownKid(request, options.baseIssuer);
|
|
70
70
|
return handleJWKSRequest(kid, options);
|
|
71
71
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@japikey/cloudflare",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Cloudflare worker-based endpoints for japikey",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.5.0"
|
|
@@ -44,11 +44,10 @@
|
|
|
44
44
|
"format:check": "prettier --check src/**/*.ts"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@japikey/japikey": "0.3.
|
|
47
|
+
"@japikey/japikey": "0.3.1",
|
|
48
48
|
"path-to-regexp": "^8.2.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@cloudflare/workers-types": "^4.20250806.0",
|
|
52
51
|
"@types/node": "^24.1.0",
|
|
53
52
|
"@typescript-eslint/eslint-plugin": "^8.38.0",
|
|
54
53
|
"@typescript-eslint/parser": "^8.38.0",
|
|
@@ -60,5 +59,8 @@
|
|
|
60
59
|
"prettier": "^3.6.2",
|
|
61
60
|
"rimraf": "^6.0.1",
|
|
62
61
|
"vitest": "^3.2.4"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"@cloudflare/workers-types": "^4.20250810.0"
|
|
63
65
|
}
|
|
64
66
|
}
|