@cedarjs/graphql-server 0.6.0 → 0.6.1-next.51
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/cjs/cors.d.ts +10 -0
- package/dist/cjs/cors.d.ts.map +1 -0
- package/dist/cjs/cors.js +70 -0
- package/dist/cjs/createGraphQLYoga.d.ts +6 -0
- package/dist/cjs/createGraphQLYoga.d.ts.map +1 -0
- package/dist/cjs/createGraphQLYoga.js +178 -0
- package/dist/cjs/directives/makeDirectives.d.ts +8 -0
- package/dist/cjs/directives/makeDirectives.d.ts.map +1 -0
- package/dist/cjs/directives/makeDirectives.js +89 -0
- package/dist/cjs/errors.d.ts +28 -0
- package/dist/cjs/errors.d.ts.map +1 -0
- package/dist/cjs/errors.js +98 -0
- package/dist/cjs/functions/graphql.d.ts +15 -0
- package/dist/cjs/functions/graphql.d.ts.map +1 -0
- package/dist/cjs/functions/graphql.js +141 -0
- package/dist/cjs/functions/useRequireAuth.d.ts +12 -0
- package/dist/cjs/functions/useRequireAuth.d.ts.map +1 -0
- package/dist/cjs/functions/useRequireAuth.js +70 -0
- package/dist/cjs/global.api-auto-imports.d.ts +5 -0
- package/dist/cjs/global.api-auto-imports.d.ts.map +1 -0
- package/dist/cjs/global.api-auto-imports.js +1 -0
- package/dist/cjs/globalContext.d.ts +25 -0
- package/dist/cjs/globalContext.d.ts.map +1 -0
- package/dist/cjs/globalContext.js +55 -0
- package/dist/cjs/globalContextStore.d.ts +9 -0
- package/dist/cjs/globalContextStore.d.ts.map +1 -0
- package/dist/cjs/globalContextStore.js +35 -0
- package/dist/cjs/graphiql.d.ts +8 -0
- package/dist/cjs/graphiql.d.ts.map +1 -0
- package/dist/cjs/graphiql.js +45 -0
- package/dist/cjs/index.d.ts +14 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +75 -0
- package/dist/cjs/introspection.d.ts +7 -0
- package/dist/cjs/introspection.d.ts.map +1 -0
- package/dist/cjs/introspection.js +36 -0
- package/dist/cjs/makeMergedSchema.d.ts +17 -0
- package/dist/cjs/makeMergedSchema.d.ts.map +1 -0
- package/dist/cjs/makeMergedSchema.js +283 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/plugins/index.d.ts +10 -0
- package/dist/cjs/plugins/index.d.ts.map +1 -0
- package/dist/cjs/plugins/index.js +52 -0
- package/dist/cjs/plugins/useArmor.d.ts +4 -0
- package/dist/cjs/plugins/useArmor.d.ts.map +1 -0
- package/dist/cjs/plugins/useArmor.js +69 -0
- package/dist/cjs/plugins/useRedwoodAuthContext.d.ts +9 -0
- package/dist/cjs/plugins/useRedwoodAuthContext.d.ts.map +1 -0
- package/dist/cjs/plugins/useRedwoodAuthContext.js +61 -0
- package/dist/cjs/plugins/useRedwoodDirective.d.ts +83 -0
- package/dist/cjs/plugins/useRedwoodDirective.d.ts.map +1 -0
- package/dist/cjs/plugins/useRedwoodDirective.js +166 -0
- package/dist/cjs/plugins/useRedwoodError.d.ts +20 -0
- package/dist/cjs/plugins/useRedwoodError.d.ts.map +1 -0
- package/dist/cjs/plugins/useRedwoodError.js +63 -0
- package/dist/cjs/plugins/useRedwoodGlobalContextSetter.d.ts +9 -0
- package/dist/cjs/plugins/useRedwoodGlobalContextSetter.d.ts.map +1 -0
- package/dist/cjs/plugins/useRedwoodGlobalContextSetter.js +35 -0
- package/dist/cjs/plugins/useRedwoodLogger.d.ts +115 -0
- package/dist/cjs/plugins/useRedwoodLogger.d.ts.map +1 -0
- package/dist/cjs/plugins/useRedwoodLogger.js +149 -0
- package/dist/cjs/plugins/useRedwoodOpenTelemetry.d.ts +22 -0
- package/dist/cjs/plugins/useRedwoodOpenTelemetry.d.ts.map +1 -0
- package/dist/cjs/plugins/useRedwoodOpenTelemetry.js +156 -0
- package/dist/cjs/plugins/useRedwoodPopulateContext.d.ts +9 -0
- package/dist/cjs/plugins/useRedwoodPopulateContext.d.ts.map +1 -0
- package/dist/cjs/plugins/useRedwoodPopulateContext.js +35 -0
- package/dist/cjs/plugins/useRedwoodTrustedDocuments.d.ts +23 -0
- package/dist/cjs/plugins/useRedwoodTrustedDocuments.d.ts.map +1 -0
- package/dist/cjs/plugins/useRedwoodTrustedDocuments.js +80 -0
- package/dist/cjs/rootSchema.d.ts +25 -0
- package/dist/cjs/rootSchema.d.ts.map +1 -0
- package/dist/cjs/rootSchema.js +97 -0
- package/dist/cjs/subscriptions/makeSubscriptions.d.ts +18 -0
- package/dist/cjs/subscriptions/makeSubscriptions.d.ts.map +1 -0
- package/dist/cjs/subscriptions/makeSubscriptions.js +40 -0
- package/dist/cjs/types.d.ts +215 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +16 -0
- package/dist/cors.js +2 -26
- package/dist/createGraphQLYoga.d.ts +1 -1
- package/dist/createGraphQLYoga.d.ts.map +1 -1
- package/dist/createGraphQLYoga.js +45 -59
- package/dist/directives/makeDirectives.d.ts +1 -1
- package/dist/directives/makeDirectives.d.ts.map +1 -1
- package/dist/directives/makeDirectives.js +9 -36
- package/dist/errors.js +5 -36
- package/dist/functions/graphql.d.ts +1 -1
- package/dist/functions/graphql.d.ts.map +1 -1
- package/dist/functions/graphql.js +6 -30
- package/dist/functions/useRequireAuth.d.ts +1 -1
- package/dist/functions/useRequireAuth.d.ts.map +1 -1
- package/dist/functions/useRequireAuth.js +9 -33
- package/dist/global.api-auto-imports.js +0 -1
- package/dist/globalContext.js +6 -32
- package/dist/globalContextStore.d.ts +1 -1
- package/dist/globalContextStore.d.ts.map +1 -1
- package/dist/globalContextStore.js +4 -28
- package/dist/graphiql.d.ts +1 -1
- package/dist/graphiql.d.ts.map +1 -1
- package/dist/graphiql.js +2 -26
- package/dist/index.d.ts +12 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -82
- package/dist/introspection.d.ts +1 -1
- package/dist/introspection.d.ts.map +1 -1
- package/dist/introspection.js +2 -26
- package/dist/makeMergedSchema.d.ts +3 -3
- package/dist/makeMergedSchema.d.ts.map +1 -1
- package/dist/makeMergedSchema.js +19 -49
- package/dist/plugins/index.d.ts +9 -9
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +11 -43
- package/dist/plugins/useArmor.d.ts +2 -2
- package/dist/plugins/useArmor.d.ts.map +1 -1
- package/dist/plugins/useArmor.js +4 -28
- package/dist/plugins/useRedwoodAuthContext.d.ts +1 -1
- package/dist/plugins/useRedwoodAuthContext.d.ts.map +1 -1
- package/dist/plugins/useRedwoodAuthContext.js +4 -28
- package/dist/plugins/useRedwoodDirective.js +9 -37
- package/dist/plugins/useRedwoodError.d.ts +1 -1
- package/dist/plugins/useRedwoodError.d.ts.map +1 -1
- package/dist/plugins/useRedwoodError.js +10 -31
- package/dist/plugins/useRedwoodGlobalContextSetter.d.ts +1 -1
- package/dist/plugins/useRedwoodGlobalContextSetter.d.ts.map +1 -1
- package/dist/plugins/useRedwoodGlobalContextSetter.js +4 -28
- package/dist/plugins/useRedwoodLogger.d.ts +1 -1
- package/dist/plugins/useRedwoodLogger.d.ts.map +1 -1
- package/dist/plugins/useRedwoodLogger.js +10 -34
- package/dist/plugins/useRedwoodOpenTelemetry.d.ts +1 -1
- package/dist/plugins/useRedwoodOpenTelemetry.d.ts.map +1 -1
- package/dist/plugins/useRedwoodOpenTelemetry.js +11 -46
- package/dist/plugins/useRedwoodPopulateContext.d.ts +1 -1
- package/dist/plugins/useRedwoodPopulateContext.d.ts.map +1 -1
- package/dist/plugins/useRedwoodPopulateContext.js +2 -26
- package/dist/plugins/useRedwoodTrustedDocuments.d.ts +1 -1
- package/dist/plugins/useRedwoodTrustedDocuments.d.ts.map +1 -1
- package/dist/plugins/useRedwoodTrustedDocuments.js +4 -28
- package/dist/rootSchema.js +26 -54
- package/dist/subscriptions/makeSubscriptions.js +5 -29
- package/dist/types.d.ts +4 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -16
- package/package.json +27 -10
- package/dist/plugins/__fixtures__/common.d.ts +0 -9
- package/dist/plugins/__fixtures__/common.d.ts.map +0 -1
- package/dist/plugins/__fixtures__/envelop-testing.d.ts +0 -55
- package/dist/plugins/__fixtures__/envelop-testing.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRequireAuth.d.ts","sourceRoot":"","sources":["../../../src/functions/useRequireAuth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,YAAY,CAAA;AAE3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAM3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,UAAU,IAAI;IACZ,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAA;IACjC,SAAS,EAAE,CACT,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,aAAa,EACtB,GAAG,MAAM,EAAE,GAAG,KACX,GAAG,CAAA;IACR,cAAc,CAAC,EAAE,cAAc,CAAA;CAChC;AAGD,MAAM,MAAM,cAAc,GAAG,CAC3B,IAAI,EAAE,IAAI,KACP,CACH,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,aAAa,EACtB,GAAG,IAAI,EAAE,GAAG,KACT,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAA;AAE3C,eAAO,MAAM,cAAc,EAAE,cAmD5B,CAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useRequireAuth_exports = {};
|
|
20
|
+
__export(useRequireAuth_exports, {
|
|
21
|
+
useRequireAuth: () => useRequireAuth
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useRequireAuth_exports);
|
|
24
|
+
var import_api = require("@cedarjs/api");
|
|
25
|
+
var import_context = require("@cedarjs/context");
|
|
26
|
+
var import_store = require("@cedarjs/context/dist/store");
|
|
27
|
+
const useRequireAuth = ({
|
|
28
|
+
authDecoder,
|
|
29
|
+
handlerFn,
|
|
30
|
+
getCurrentUser
|
|
31
|
+
}) => {
|
|
32
|
+
return async (event, context, ...rest) => {
|
|
33
|
+
const authEnrichedFunction = async () => {
|
|
34
|
+
try {
|
|
35
|
+
const authContext = await (0, import_api.getAuthenticationContext)({
|
|
36
|
+
authDecoder,
|
|
37
|
+
event,
|
|
38
|
+
context
|
|
39
|
+
});
|
|
40
|
+
if (authContext) {
|
|
41
|
+
const currentUser = getCurrentUser ? await getCurrentUser(
|
|
42
|
+
authContext[0],
|
|
43
|
+
authContext[1],
|
|
44
|
+
authContext[2]
|
|
45
|
+
) : null;
|
|
46
|
+
import_context.context.currentUser = currentUser;
|
|
47
|
+
}
|
|
48
|
+
} catch (e) {
|
|
49
|
+
import_context.context.currentUser = null;
|
|
50
|
+
if (process.env.NODE_ENV === "development") {
|
|
51
|
+
console.warn("This warning is only printed in development mode.");
|
|
52
|
+
console.warn(
|
|
53
|
+
"Always make sure to have `requireAuth('role')` inside your own handler function."
|
|
54
|
+
);
|
|
55
|
+
console.warn("");
|
|
56
|
+
console.warn(e);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return await handlerFn(event, context, ...rest);
|
|
60
|
+
};
|
|
61
|
+
return (0, import_store.getAsyncStoreInstance)().run(
|
|
62
|
+
/* @__PURE__ */ new Map(),
|
|
63
|
+
authEnrichedFunction
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
+
0 && (module.exports = {
|
|
69
|
+
useRequireAuth
|
|
70
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global.api-auto-imports.d.ts","sourceRoot":"","sources":["../../src/global.api-auto-imports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AAEnC,OAAO,CAAC,MAAM,CAAC;IACb,MAAM,GAAG,EAAE,OAAO,IAAI,CAAA;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated This type will be available only from the `@cedarjs/context` package in a future release.
|
|
3
|
+
*/
|
|
4
|
+
export interface GlobalContext extends Record<string, unknown> {
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated This function will be available only from the `@cedarjs/context` package in a future release.
|
|
8
|
+
*/
|
|
9
|
+
export declare const createContextProxy: (target: GlobalContext) => GlobalContext;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated This value will be available only from the `@cedarjs/context` package in a future release.
|
|
12
|
+
*/
|
|
13
|
+
export declare let context: GlobalContext;
|
|
14
|
+
/**
|
|
15
|
+
* Set the contents of the global context object.
|
|
16
|
+
*
|
|
17
|
+
* This completely replaces the existing context values such as currentUser.
|
|
18
|
+
*
|
|
19
|
+
* If you wish to extend the context simply use the `context` object directly,
|
|
20
|
+
* such as `context.magicNumber = 1`, or `setContext({ ...context, magicNumber: 1 })`
|
|
21
|
+
*
|
|
22
|
+
* @deprecated This function will be available only from the `@cedarjs/context` package in a future release.
|
|
23
|
+
*/
|
|
24
|
+
export declare const setContext: (newContext: GlobalContext) => GlobalContext;
|
|
25
|
+
//# sourceMappingURL=globalContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globalContext.d.ts","sourceRoot":"","sources":["../../src/globalContext.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,MAAM,WAAW,aAAc,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAAG;AAEjE;;GAEG;AACH,eAAO,MAAM,kBAAkB,WAAY,aAAa,kBAevD,CAAA;AAED;;GAEG;AACH,eAAO,IAAI,OAAO,EAAE,aAAsC,CAAA;AAE1D;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,eAAgB,aAAa,KAAG,aAWtD,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var globalContext_exports = {};
|
|
20
|
+
__export(globalContext_exports, {
|
|
21
|
+
context: () => context,
|
|
22
|
+
createContextProxy: () => createContextProxy,
|
|
23
|
+
setContext: () => setContext
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(globalContext_exports);
|
|
26
|
+
var import_globalContextStore = require("./globalContextStore.js");
|
|
27
|
+
const createContextProxy = (target) => {
|
|
28
|
+
return new Proxy(target, {
|
|
29
|
+
get: (_target, property) => {
|
|
30
|
+
const store = (0, import_globalContextStore.getAsyncStoreInstance)().getStore();
|
|
31
|
+
const ctx = store?.get("context") || {};
|
|
32
|
+
return ctx[property];
|
|
33
|
+
},
|
|
34
|
+
set: (_target, property, newVal) => {
|
|
35
|
+
const store = (0, import_globalContextStore.getAsyncStoreInstance)().getStore();
|
|
36
|
+
const ctx = store?.get("context") || {};
|
|
37
|
+
ctx[property] = newVal;
|
|
38
|
+
store?.set("context", ctx);
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
let context = createContextProxy({});
|
|
44
|
+
const setContext = (newContext) => {
|
|
45
|
+
context = createContextProxy(newContext);
|
|
46
|
+
const store = (0, import_globalContextStore.getAsyncStoreInstance)().getStore();
|
|
47
|
+
store?.set("context", newContext);
|
|
48
|
+
return context;
|
|
49
|
+
};
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
context,
|
|
53
|
+
createContextProxy,
|
|
54
|
+
setContext
|
|
55
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'async_hooks';
|
|
2
|
+
import type { GlobalContext } from './globalContext.js';
|
|
3
|
+
/**
|
|
4
|
+
* This returns a AsyncLocalStorage instance, not the actual store
|
|
5
|
+
*
|
|
6
|
+
* @deprecated This function will be available only from the `@cedarjs/context` package in a future release.
|
|
7
|
+
*/
|
|
8
|
+
export declare const getAsyncStoreInstance: () => AsyncLocalStorage<Map<string, GlobalContext>>;
|
|
9
|
+
//# sourceMappingURL=globalContextStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globalContextStore.d.ts","sourceRoot":"","sources":["../../src/globalContextStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAIvD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,qDAKjC,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var globalContextStore_exports = {};
|
|
20
|
+
__export(globalContextStore_exports, {
|
|
21
|
+
getAsyncStoreInstance: () => getAsyncStoreInstance
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(globalContextStore_exports);
|
|
24
|
+
var import_async_hooks = require("async_hooks");
|
|
25
|
+
let CONTEXT_STORAGE;
|
|
26
|
+
const getAsyncStoreInstance = () => {
|
|
27
|
+
if (!CONTEXT_STORAGE) {
|
|
28
|
+
CONTEXT_STORAGE = new import_async_hooks.AsyncLocalStorage();
|
|
29
|
+
}
|
|
30
|
+
return CONTEXT_STORAGE;
|
|
31
|
+
};
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
getAsyncStoreInstance
|
|
35
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { GraphiQLOptions } from './types.js';
|
|
2
|
+
export declare const configureGraphiQLPlayground: ({ allowGraphiQL, generateGraphiQLHeader, }: GraphiQLOptions) => false | {
|
|
3
|
+
title: string;
|
|
4
|
+
headers: string | undefined;
|
|
5
|
+
defaultQuery: string;
|
|
6
|
+
headerEditorEnabled: boolean;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=graphiql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphiql.d.ts","sourceRoot":"","sources":["../../src/graphiql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AASjD,eAAO,MAAM,2BAA2B,+CAGrC,eAAe;;;;;CAcjB,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var graphiql_exports = {};
|
|
20
|
+
__export(graphiql_exports, {
|
|
21
|
+
configureGraphiQLPlayground: () => configureGraphiQLPlayground
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(graphiql_exports);
|
|
24
|
+
const DEFAULT_QUERY = `query Redwood {
|
|
25
|
+
redwood {
|
|
26
|
+
version
|
|
27
|
+
}
|
|
28
|
+
}`;
|
|
29
|
+
const configureGraphiQLPlayground = ({
|
|
30
|
+
allowGraphiQL,
|
|
31
|
+
generateGraphiQLHeader
|
|
32
|
+
}) => {
|
|
33
|
+
const isDevEnv = process.env.NODE_ENV === "development";
|
|
34
|
+
const disableGraphiQL = isDevEnv && (allowGraphiQL ?? true) ? false : !allowGraphiQL;
|
|
35
|
+
return !disableGraphiQL ? {
|
|
36
|
+
title: "Redwood GraphQL Playground",
|
|
37
|
+
headers: generateGraphiQLHeader?.(),
|
|
38
|
+
defaultQuery: DEFAULT_QUERY,
|
|
39
|
+
headerEditorEnabled: true
|
|
40
|
+
} : false;
|
|
41
|
+
};
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
configureGraphiQLPlayground
|
|
45
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import './global.api-auto-imports.js';
|
|
2
|
+
export * from './global.api-auto-imports.js';
|
|
3
|
+
export * from './errors.js';
|
|
4
|
+
export * from './functions/graphql.js';
|
|
5
|
+
export * from './functions/useRequireAuth.js';
|
|
6
|
+
export * from './makeMergedSchema.js';
|
|
7
|
+
export * from './createGraphQLYoga.js';
|
|
8
|
+
export * from './types.js';
|
|
9
|
+
export { createValidatorDirective, createTransformerDirective, getDirectiveName, makeDirectivesForPlugin, } from './directives/makeDirectives.js';
|
|
10
|
+
export { hasDirective, DirectiveType, useRedwoodDirective, } from './plugins/useRedwoodDirective.js';
|
|
11
|
+
export type { DirectiveParams, RedwoodDirective, ValidatorDirective, ValidatorDirectiveFunc, TransformerDirective, TransformerDirectiveFunc, ValidateArgs, TransformArgs, } from './plugins/useRedwoodDirective.js';
|
|
12
|
+
export * as rootSchema from './rootSchema.js';
|
|
13
|
+
export { context, setContext } from '@cedarjs/context';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,8BAA8B,CAAA;AAErC,cAAc,8BAA8B,CAAA;AAE5C,cAAc,aAAa,CAAA;AAC3B,cAAc,wBAAwB,CAAA;AACtC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,YAAY,CAAA;AAE1B,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,gCAAgC,CAAA;AAEvC,OAAO,EACL,YAAY,EACZ,aAAa,EACb,mBAAmB,GACpB,MAAM,kCAAkC,CAAA;AAEzC,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACxB,YAAY,EACZ,aAAa,GACd,MAAM,kCAAkC,CAAA;AAEzC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAG7C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var index_exports = {};
|
|
31
|
+
__export(index_exports, {
|
|
32
|
+
DirectiveType: () => import_useRedwoodDirective.DirectiveType,
|
|
33
|
+
context: () => import_context.context,
|
|
34
|
+
createTransformerDirective: () => import_makeDirectives.createTransformerDirective,
|
|
35
|
+
createValidatorDirective: () => import_makeDirectives.createValidatorDirective,
|
|
36
|
+
getDirectiveName: () => import_makeDirectives.getDirectiveName,
|
|
37
|
+
hasDirective: () => import_useRedwoodDirective.hasDirective,
|
|
38
|
+
makeDirectivesForPlugin: () => import_makeDirectives.makeDirectivesForPlugin,
|
|
39
|
+
rootSchema: () => rootSchema,
|
|
40
|
+
setContext: () => import_context.setContext,
|
|
41
|
+
useRedwoodDirective: () => import_useRedwoodDirective.useRedwoodDirective
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(index_exports);
|
|
44
|
+
var import_global_api_auto_imports = require("./global.api-auto-imports.js");
|
|
45
|
+
__reExport(index_exports, require("./global.api-auto-imports.js"), module.exports);
|
|
46
|
+
__reExport(index_exports, require("./errors.js"), module.exports);
|
|
47
|
+
__reExport(index_exports, require("./functions/graphql.js"), module.exports);
|
|
48
|
+
__reExport(index_exports, require("./functions/useRequireAuth.js"), module.exports);
|
|
49
|
+
__reExport(index_exports, require("./makeMergedSchema.js"), module.exports);
|
|
50
|
+
__reExport(index_exports, require("./createGraphQLYoga.js"), module.exports);
|
|
51
|
+
__reExport(index_exports, require("./types.js"), module.exports);
|
|
52
|
+
var import_makeDirectives = require("./directives/makeDirectives.js");
|
|
53
|
+
var import_useRedwoodDirective = require("./plugins/useRedwoodDirective.js");
|
|
54
|
+
var rootSchema = __toESM(require("./rootSchema.js"), 1);
|
|
55
|
+
var import_context = require("@cedarjs/context");
|
|
56
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
+
0 && (module.exports = {
|
|
58
|
+
DirectiveType,
|
|
59
|
+
context,
|
|
60
|
+
createTransformerDirective,
|
|
61
|
+
createValidatorDirective,
|
|
62
|
+
getDirectiveName,
|
|
63
|
+
hasDirective,
|
|
64
|
+
makeDirectivesForPlugin,
|
|
65
|
+
rootSchema,
|
|
66
|
+
setContext,
|
|
67
|
+
useRedwoodDirective,
|
|
68
|
+
...require("./global.api-auto-imports.js"),
|
|
69
|
+
...require("./errors.js"),
|
|
70
|
+
...require("./functions/graphql.js"),
|
|
71
|
+
...require("./functions/useRequireAuth.js"),
|
|
72
|
+
...require("./makeMergedSchema.js"),
|
|
73
|
+
...require("./createGraphQLYoga.js"),
|
|
74
|
+
...require("./types.js")
|
|
75
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GraphQLYogaOptions } from './types.js';
|
|
2
|
+
export declare const configureGraphQLIntrospection: ({ allowIntrospection, }: {
|
|
3
|
+
allowIntrospection?: GraphQLYogaOptions["allowIntrospection"];
|
|
4
|
+
}) => {
|
|
5
|
+
disableIntrospection: boolean;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=introspection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"introspection.d.ts","sourceRoot":"","sources":["../../src/introspection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpD,eAAO,MAAM,6BAA6B,4BAEvC;IACD,kBAAkB,CAAC,EAAE,kBAAkB,CAAC,oBAAoB,CAAC,CAAA;CAC9D;;CASA,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var introspection_exports = {};
|
|
20
|
+
__export(introspection_exports, {
|
|
21
|
+
configureGraphQLIntrospection: () => configureGraphQLIntrospection
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(introspection_exports);
|
|
24
|
+
const configureGraphQLIntrospection = ({
|
|
25
|
+
allowIntrospection
|
|
26
|
+
}) => {
|
|
27
|
+
const isDevEnv = process.env.NODE_ENV === "development";
|
|
28
|
+
const disableIntrospection = isDevEnv && (allowIntrospection ?? true) ? false : !allowIntrospection;
|
|
29
|
+
return {
|
|
30
|
+
disableIntrospection
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
configureGraphQLIntrospection
|
|
36
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IExecutableSchemaDefinition } from '@graphql-tools/schema';
|
|
2
|
+
import type { GraphQLSchema } from 'graphql';
|
|
3
|
+
import type { RedwoodDirective } from './plugins/useRedwoodDirective.js';
|
|
4
|
+
import type { RedwoodSubscription } from './subscriptions/makeSubscriptions.js';
|
|
5
|
+
import type { ServicesGlobImports, SdlGlobImports, RedwoodScalarConfig } from './types.js';
|
|
6
|
+
export declare const makeMergedSchema: ({ sdls, services, schemaOptions, directives, subscriptions, includeScalars, }: {
|
|
7
|
+
sdls: SdlGlobImports;
|
|
8
|
+
services: ServicesGlobImports;
|
|
9
|
+
directives: RedwoodDirective[];
|
|
10
|
+
subscriptions: RedwoodSubscription[];
|
|
11
|
+
includeScalars?: RedwoodScalarConfig;
|
|
12
|
+
/**
|
|
13
|
+
* A list of options passed to [makeExecutableSchema](https://www.graphql-tools.com/docs/generate-schema/#makeexecutableschemaoptions).
|
|
14
|
+
*/
|
|
15
|
+
schemaOptions?: Partial<IExecutableSchemaDefinition>;
|
|
16
|
+
}) => GraphQLSchema;
|
|
17
|
+
//# sourceMappingURL=makeMergedSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeMergedSchema.d.ts","sourceRoot":"","sources":["../../src/makeMergedSchema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AAUxE,OAAO,KAAK,EACV,aAAa,EAKd,MAAM,SAAS,CAAA;AAIhB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAExE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAA;AAC/E,OAAO,KAAK,EAEV,mBAAmB,EAEnB,cAAc,EACd,mBAAmB,EACpB,MAAM,YAAY,CAAA;AAsUnB,eAAO,MAAM,gBAAgB,kFAO1B;IACD,IAAI,EAAE,cAAc,CAAA;IACpB,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,UAAU,EAAE,gBAAgB,EAAE,CAAA;IAC9B,aAAa,EAAE,mBAAmB,EAAE,CAAA;IACpC,cAAc,CAAC,EAAE,mBAAmB,CAAA;IAEpC;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAA;CACrD,kBA+CA,CAAA"}
|