@cedarjs/api 6.0.0-canary.2813 → 6.0.0-canary.2815
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/auth/index.d.ts +9 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +7 -0
- package/dist/index.js +3 -3
- package/dist/runtime.d.ts +0 -26
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +1 -9
- package/package.json +2 -2
package/dist/auth/index.d.ts
CHANGED
|
@@ -46,6 +46,15 @@ export type AuthContextPayload = [
|
|
|
46
46
|
context?: LambdaContext;
|
|
47
47
|
}
|
|
48
48
|
];
|
|
49
|
+
/**
|
|
50
|
+
* Whether a project has auth configured.
|
|
51
|
+
*
|
|
52
|
+
* An empty decoder array counts as no auth: there's nothing to decode with, so
|
|
53
|
+
* auth state can never be resolved. Anything deciding whether auth is set up
|
|
54
|
+
* has to agree with `buildCedarContext` on this, or they'll disagree about
|
|
55
|
+
* whether a request should have had auth state resolved.
|
|
56
|
+
*/
|
|
57
|
+
export declare function hasAuthDecoder(authDecoder: Decoder | Decoder[] | undefined): authDecoder is Decoder | Decoder[];
|
|
49
58
|
export type Decoder = (token: string, type: string, req: {
|
|
50
59
|
/** The Lambda-style request event */
|
|
51
60
|
event: APIGatewayProxyEvent | Request;
|
package/dist/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAE7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,YAAY,CAAA;AAMhF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,YAAY,EAAE,OAAO,EAAE,CAAA;AAGvB,eAAO,MAAM,oBAAoB,kBAAkB,CAAA;AAEnD,eAAO,MAAM,qBAAqB,GACh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Aa,CAAA;KACxB;CACF,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,OAAO,GAAG,OAAO,EAAE,GAAG,SAAS,GAC3C,WAAW,IAAI,OAAO,GAAG,OAAO,EAAE,CAMpC;AAED,MAAM,MAAM,OAAO,GAAG,CACpB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE;IACH,qCAAqC;IACrC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAA;IACrC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,aAAa,CAAA;CACxB,KACE,OAAO,CAAC,OAAO,CAAC,CAAA;AAErB;;;IAGI;AACJ,eAAO,MAAM,wBAAwB,GAAU,kCAI5C;IACD,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAA;IACjC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAA;IACrC,OAAO,CAAC,EAAE,aAAa,CAAA;CACxB,KAAG,OAAO,CAAC,SAAS,GAAG,kBAAkB,CA0EzC,CAAA"}
|
package/dist/auth/index.js
CHANGED
|
@@ -40,6 +40,12 @@ const parseAuthorizationHeader = (event) => {
|
|
|
40
40
|
}
|
|
41
41
|
return { schema, token };
|
|
42
42
|
};
|
|
43
|
+
function hasAuthDecoder(authDecoder) {
|
|
44
|
+
if (Array.isArray(authDecoder)) {
|
|
45
|
+
return authDecoder.length > 0;
|
|
46
|
+
}
|
|
47
|
+
return !!authDecoder;
|
|
48
|
+
}
|
|
43
49
|
const getAuthenticationContext = async ({
|
|
44
50
|
authDecoder,
|
|
45
51
|
event,
|
|
@@ -98,6 +104,7 @@ export {
|
|
|
98
104
|
AUTH_PROVIDER_HEADER,
|
|
99
105
|
getAuthProviderHeader,
|
|
100
106
|
getAuthenticationContext,
|
|
107
|
+
hasAuthDecoder,
|
|
101
108
|
parseAuthorizationCookie,
|
|
102
109
|
parseAuthorizationHeader
|
|
103
110
|
};
|
package/dist/index.js
CHANGED
|
@@ -7,9 +7,9 @@ export * from "./transforms.js";
|
|
|
7
7
|
export * from "./cors.js";
|
|
8
8
|
export * from "./event.js";
|
|
9
9
|
const prismaVersion = "7.8.0";
|
|
10
|
-
const redwoodVersion = "6.0.0-canary.
|
|
11
|
-
const cedarjsVersion = "6.0.0-canary.
|
|
12
|
-
const cedarVersion = "6.0.0-canary.
|
|
10
|
+
const redwoodVersion = "6.0.0-canary.2815";
|
|
11
|
+
const cedarjsVersion = "6.0.0-canary.2815";
|
|
12
|
+
const cedarVersion = "6.0.0-canary.2815";
|
|
13
13
|
export {
|
|
14
14
|
cedarVersion,
|
|
15
15
|
cedarjsVersion,
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,31 +1,5 @@
|
|
|
1
1
|
import type { APIGatewayProxyEvent, APIGatewayProxyResult, Context as LambdaContext } from 'aws-lambda';
|
|
2
2
|
import { getAuthenticationContext } from './auth/index.js';
|
|
3
|
-
import type { Decoder } from './auth/index.js';
|
|
4
|
-
/**
|
|
5
|
-
* A decoder that decodes nothing.
|
|
6
|
-
*
|
|
7
|
-
* Resolving `serverAuthState` has to happen before the GraphQL server reads
|
|
8
|
-
* the request body:
|
|
9
|
-
*
|
|
10
|
-
* 1. Resolving it materialises the request body — `getAuthenticationContext`
|
|
11
|
-
* builds a Lambda-style event via `requestToBaseEvent`, which does
|
|
12
|
-
* `request.clone().text()`
|
|
13
|
-
* 2. `clone()` only works while the body is untouched
|
|
14
|
-
* 3. So once the GraphQL server has read the body, resolving throws
|
|
15
|
-
* `TypeError: unusable`
|
|
16
|
-
*
|
|
17
|
-
* `buildCedarContext` only resolves auth state when it's given a decoder, so
|
|
18
|
-
* GraphQL call sites pass this one for projects that have no auth set up, to
|
|
19
|
-
* keep the resolve eager. Resolving with it produces the same payload as
|
|
20
|
-
* resolving with no decoders at all.
|
|
21
|
-
*
|
|
22
|
-
* (When it isn't resolved eagerly, `useRedwoodAuthContext` resolves it during
|
|
23
|
-
* context building instead — too late. That's how this surfaces.)
|
|
24
|
-
*
|
|
25
|
-
* TODO: Remove this once the request body is captured at the entry point rather
|
|
26
|
-
* than read lazily from the auth path, which drops the ordering constraint.
|
|
27
|
-
*/
|
|
28
|
-
export declare const noopAuthDecoder: Decoder;
|
|
29
3
|
export interface CedarRequestContext {
|
|
30
4
|
params: Record<string, string>;
|
|
31
5
|
query: URLSearchParams;
|
package/dist/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,qBAAqB,EACrB,OAAO,IAAI,aAAa,EACzB,MAAM,YAAY,CAAA;AAInB,OAAO,EAAE,wBAAwB,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,qBAAqB,EACrB,OAAO,IAAI,aAAa,EACzB,MAAM,YAAY,CAAA;AAInB,OAAO,EAAE,wBAAwB,EAAkB,MAAM,iBAAiB,CAAA;AAG1E,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,KAAK,EAAE,eAAe,CAAA;IACtB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC,eAAe,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAA;CACvE;AAED,MAAM,MAAM,YAAY,GAAG,CACzB,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,mBAAmB,KACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAA;AAEjC,MAAM,MAAM,eAAe,GAAG,CAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,mBAAmB,EACxB,IAAI,EAAE,MAAM,OAAO,CA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AAG,MAAM,CAEtE;AAED,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,aAAa,EAC5B,OAAO,GAAE,wBAA6B,GACrC,YAAY,CAQd;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,mBAAmB,GACvB,OAAO,CAAC,oBAAoB,CAAC,CAoB/B;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,mBAAmB,GAAG,QAAQ,CAsD5E"}
|
package/dist/runtime.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as cookie from "cookie";
|
|
2
2
|
import { parse } from "picoquery";
|
|
3
|
-
import { getAuthenticationContext } from "./auth/index.js";
|
|
3
|
+
import { getAuthenticationContext, hasAuthDecoder } from "./auth/index.js";
|
|
4
4
|
import { requestToBaseEvent } from "./transforms.js";
|
|
5
|
-
const noopAuthDecoder = async () => null;
|
|
6
5
|
const DEFAULT_LAMBDA_CONTEXT = {
|
|
7
6
|
callbackWaitsForEmptyEventLoop: false,
|
|
8
7
|
functionName: "cedar",
|
|
@@ -25,12 +24,6 @@ const DEFAULT_LAMBDA_CONTEXT = {
|
|
|
25
24
|
return void 0;
|
|
26
25
|
}
|
|
27
26
|
};
|
|
28
|
-
function hasAuthDecoder(authDecoder) {
|
|
29
|
-
if (Array.isArray(authDecoder)) {
|
|
30
|
-
return authDecoder.length > 0;
|
|
31
|
-
}
|
|
32
|
-
return !!authDecoder;
|
|
33
|
-
}
|
|
34
27
|
async function buildCedarContext(request, options = {}) {
|
|
35
28
|
const url = new URL(request.url);
|
|
36
29
|
const query = url.searchParams;
|
|
@@ -139,7 +132,6 @@ export {
|
|
|
139
132
|
composeCedarMiddleware,
|
|
140
133
|
createRouteManifest,
|
|
141
134
|
legacyResultToResponse,
|
|
142
|
-
noopAuthDecoder,
|
|
143
135
|
requestToLegacyEvent,
|
|
144
136
|
routeManifestToJSON,
|
|
145
137
|
wrapLegacyHandler
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/api",
|
|
3
|
-
"version": "6.0.0-canary.
|
|
3
|
+
"version": "6.0.0-canary.2815",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"title-case": "3.0.3"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
|
-
"@cedarjs/framework-tools": "6.0.0-canary.
|
|
87
|
+
"@cedarjs/framework-tools": "6.0.0-canary.2815",
|
|
88
88
|
"@types/aws-lambda": "8.10.162",
|
|
89
89
|
"@types/jsonwebtoken": "9.0.10",
|
|
90
90
|
"@types/memjs": "1",
|