@cedarjs/graphql-server 0.6.1-next.0 → 0.7.0
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
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { useArmor } from './useArmor';
|
|
2
|
-
export { useRedwoodAuthContext } from './useRedwoodAuthContext';
|
|
3
|
-
export { useRedwoodDirective } from './useRedwoodDirective';
|
|
4
|
-
export { useRedwoodError } from './useRedwoodError';
|
|
5
|
-
export { useRedwoodGlobalContextSetter } from './useRedwoodGlobalContextSetter';
|
|
6
|
-
export { useRedwoodLogger } from './useRedwoodLogger';
|
|
7
|
-
export { useRedwoodTrustedDocuments } from './useRedwoodTrustedDocuments';
|
|
8
|
-
export { useRedwoodPopulateContext } from './useRedwoodPopulateContext';
|
|
9
|
-
export { useRedwoodOpenTelemetry } from './useRedwoodOpenTelemetry';
|
|
1
|
+
export { useArmor } from './useArmor.js';
|
|
2
|
+
export { useRedwoodAuthContext } from './useRedwoodAuthContext.js';
|
|
3
|
+
export { useRedwoodDirective } from './useRedwoodDirective.js';
|
|
4
|
+
export { useRedwoodError } from './useRedwoodError.js';
|
|
5
|
+
export { useRedwoodGlobalContextSetter } from './useRedwoodGlobalContextSetter.js';
|
|
6
|
+
export { useRedwoodLogger } from './useRedwoodLogger.js';
|
|
7
|
+
export { useRedwoodTrustedDocuments } from './useRedwoodTrustedDocuments.js';
|
|
8
|
+
export { useRedwoodPopulateContext } from './useRedwoodPopulateContext.js';
|
|
9
|
+
export { useRedwoodOpenTelemetry } from './useRedwoodOpenTelemetry.js';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAA;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAE5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA"}
|
package/dist/plugins/index.js
CHANGED
|
@@ -1,45 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
|
|
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 plugins_exports = {};
|
|
20
|
-
__export(plugins_exports, {
|
|
21
|
-
useArmor: () => import_useArmor.useArmor,
|
|
22
|
-
useRedwoodAuthContext: () => import_useRedwoodAuthContext.useRedwoodAuthContext,
|
|
23
|
-
useRedwoodDirective: () => import_useRedwoodDirective.useRedwoodDirective,
|
|
24
|
-
useRedwoodError: () => import_useRedwoodError.useRedwoodError,
|
|
25
|
-
useRedwoodGlobalContextSetter: () => import_useRedwoodGlobalContextSetter.useRedwoodGlobalContextSetter,
|
|
26
|
-
useRedwoodLogger: () => import_useRedwoodLogger.useRedwoodLogger,
|
|
27
|
-
useRedwoodOpenTelemetry: () => import_useRedwoodOpenTelemetry.useRedwoodOpenTelemetry,
|
|
28
|
-
useRedwoodPopulateContext: () => import_useRedwoodPopulateContext.useRedwoodPopulateContext,
|
|
29
|
-
useRedwoodTrustedDocuments: () => import_useRedwoodTrustedDocuments.useRedwoodTrustedDocuments
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(plugins_exports);
|
|
32
|
-
var import_useArmor = require("./useArmor");
|
|
33
|
-
var import_useRedwoodAuthContext = require("./useRedwoodAuthContext");
|
|
34
|
-
var import_useRedwoodDirective = require("./useRedwoodDirective");
|
|
35
|
-
var import_useRedwoodError = require("./useRedwoodError");
|
|
36
|
-
var import_useRedwoodGlobalContextSetter = require("./useRedwoodGlobalContextSetter");
|
|
37
|
-
var import_useRedwoodLogger = require("./useRedwoodLogger");
|
|
38
|
-
var import_useRedwoodTrustedDocuments = require("./useRedwoodTrustedDocuments");
|
|
39
|
-
var import_useRedwoodPopulateContext = require("./useRedwoodPopulateContext");
|
|
40
|
-
var import_useRedwoodOpenTelemetry = require("./useRedwoodOpenTelemetry");
|
|
41
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
-
0 && (module.exports = {
|
|
1
|
+
import { useArmor } from "./useArmor.js";
|
|
2
|
+
import { useRedwoodAuthContext } from "./useRedwoodAuthContext.js";
|
|
3
|
+
import { useRedwoodDirective } from "./useRedwoodDirective.js";
|
|
4
|
+
import { useRedwoodError } from "./useRedwoodError.js";
|
|
5
|
+
import { useRedwoodGlobalContextSetter } from "./useRedwoodGlobalContextSetter.js";
|
|
6
|
+
import { useRedwoodLogger } from "./useRedwoodLogger.js";
|
|
7
|
+
import { useRedwoodTrustedDocuments } from "./useRedwoodTrustedDocuments.js";
|
|
8
|
+
import { useRedwoodPopulateContext } from "./useRedwoodPopulateContext.js";
|
|
9
|
+
import { useRedwoodOpenTelemetry } from "./useRedwoodOpenTelemetry.js";
|
|
10
|
+
export {
|
|
43
11
|
useArmor,
|
|
44
12
|
useRedwoodAuthContext,
|
|
45
13
|
useRedwoodDirective,
|
|
@@ -49,4 +17,4 @@ var import_useRedwoodOpenTelemetry = require("./useRedwoodOpenTelemetry");
|
|
|
49
17
|
useRedwoodOpenTelemetry,
|
|
50
18
|
useRedwoodPopulateContext,
|
|
51
19
|
useRedwoodTrustedDocuments
|
|
52
|
-
}
|
|
20
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Logger } from '@cedarjs/api/logger';
|
|
2
|
-
import type { ArmorConfig } from '../types';
|
|
3
|
-
export declare const useArmor: (logger: Logger, config?: ArmorConfig) => import("@envelop/types").Plugin<{}>;
|
|
2
|
+
import type { ArmorConfig } from '../types.js';
|
|
3
|
+
export declare const useArmor: (logger: Logger, config?: ArmorConfig) => import("@envelop/types/plugin", { with: { "resolution-mode": "require" } }).Plugin<{}>;
|
|
4
4
|
//# sourceMappingURL=useArmor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useArmor.d.ts","sourceRoot":"","sources":["../../src/plugins/useArmor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useArmor.d.ts","sourceRoot":"","sources":["../../src/plugins/useArmor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAO9C,eAAO,MAAM,QAAQ,WAAY,MAAM,WAAW,WAAW,2FAsC5D,CAAA"}
|
package/dist/plugins/useArmor.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
|
-
|
|
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 useArmor_exports = {};
|
|
20
|
-
__export(useArmor_exports, {
|
|
21
|
-
useArmor: () => useArmor
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useArmor_exports);
|
|
24
|
-
var import_graphql_armor = require("@escape.tech/graphql-armor");
|
|
1
|
+
import { EnvelopArmorPlugin } from "@escape.tech/graphql-armor";
|
|
25
2
|
const armorConfigDefaultOptions = {
|
|
26
3
|
logContext: false,
|
|
27
4
|
logErrors: true
|
|
@@ -37,7 +14,7 @@ const useArmor = (logger, config) => {
|
|
|
37
14
|
logger.error(error, `Armor rejected request: ${error.message}`);
|
|
38
15
|
}
|
|
39
16
|
};
|
|
40
|
-
return
|
|
17
|
+
return EnvelopArmorPlugin({
|
|
41
18
|
...config,
|
|
42
19
|
costLimit: {
|
|
43
20
|
...config?.costLimit,
|
|
@@ -63,7 +40,6 @@ const useArmor = (logger, config) => {
|
|
|
63
40
|
}
|
|
64
41
|
});
|
|
65
42
|
};
|
|
66
|
-
|
|
67
|
-
0 && (module.exports = {
|
|
43
|
+
export {
|
|
68
44
|
useArmor
|
|
69
|
-
}
|
|
45
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Plugin } from 'graphql-yoga';
|
|
2
2
|
import type { Decoder } from '@cedarjs/api';
|
|
3
|
-
import type { RedwoodGraphQLContext, GraphQLHandlerOptions } from '../types';
|
|
3
|
+
import type { RedwoodGraphQLContext, GraphQLHandlerOptions } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Envelop plugin for injecting the current user into the GraphQL Context,
|
|
6
6
|
* based on custom getCurrentUser function.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRedwoodAuthContext.d.ts","sourceRoot":"","sources":["../../src/plugins/useRedwoodAuthContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,OAAO,KAAK,EAAsB,OAAO,EAAE,MAAM,cAAc,CAAA;AAG/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useRedwoodAuthContext.d.ts","sourceRoot":"","sources":["../../src/plugins/useRedwoodAuthContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,OAAO,KAAK,EAAsB,OAAO,EAAE,MAAM,cAAc,CAAA;AAG/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAE/E;;;GAGG;AACH,eAAO,MAAM,qBAAqB,mBAChB,qBAAqB,CAAC,gBAAgB,CAAC,gBACzC,OAAO,GAAG,OAAO,EAAE,KAChC,MAAM,CAAC,qBAAqB,CAsC9B,CAAA"}
|
|
@@ -1,34 +1,11 @@
|
|
|
1
|
-
|
|
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 useRedwoodAuthContext_exports = {};
|
|
20
|
-
__export(useRedwoodAuthContext_exports, {
|
|
21
|
-
useRedwoodAuthContext: () => useRedwoodAuthContext
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useRedwoodAuthContext_exports);
|
|
24
|
-
var import_api = require("@cedarjs/api");
|
|
1
|
+
import { getAuthenticationContext } from "@cedarjs/api";
|
|
25
2
|
const useRedwoodAuthContext = (getCurrentUser, authDecoder) => {
|
|
26
3
|
return {
|
|
27
4
|
async onContextBuilding({ context, extendContext }) {
|
|
28
5
|
const { requestContext } = context;
|
|
29
6
|
let authContext = void 0;
|
|
30
7
|
try {
|
|
31
|
-
authContext = await
|
|
8
|
+
authContext = await getAuthenticationContext({
|
|
32
9
|
authDecoder,
|
|
33
10
|
event: context.event,
|
|
34
11
|
context: requestContext
|
|
@@ -55,7 +32,6 @@ const useRedwoodAuthContext = (getCurrentUser, authDecoder) => {
|
|
|
55
32
|
}
|
|
56
33
|
};
|
|
57
34
|
};
|
|
58
|
-
|
|
59
|
-
0 && (module.exports = {
|
|
35
|
+
export {
|
|
60
36
|
useRedwoodAuthContext
|
|
61
|
-
}
|
|
37
|
+
};
|
|
@@ -1,32 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 useRedwoodDirective_exports = {};
|
|
20
|
-
__export(useRedwoodDirective_exports, {
|
|
21
|
-
DirectiveType: () => DirectiveType,
|
|
22
|
-
getDirectiveByName: () => getDirectiveByName,
|
|
23
|
-
hasDirective: () => hasDirective,
|
|
24
|
-
isPromise: () => isPromise,
|
|
25
|
-
useRedwoodDirective: () => useRedwoodDirective
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(useRedwoodDirective_exports);
|
|
28
|
-
var import_utils = require("@graphql-tools/utils");
|
|
29
|
-
var import_graphql = require("graphql");
|
|
1
|
+
import { mapSchema, MapperKind } from "@graphql-tools/utils";
|
|
2
|
+
import { defaultFieldResolver, getDirectiveValues } from "graphql";
|
|
30
3
|
var DirectiveType = /* @__PURE__ */ ((DirectiveType2) => {
|
|
31
4
|
DirectiveType2["VALIDATOR"] = "VALIDATOR_DIRECTIVE";
|
|
32
5
|
DirectiveType2["TRANSFORMER"] = "TRANSFORMER_DIRECTIVE";
|
|
@@ -54,14 +27,14 @@ function isPromise(value) {
|
|
|
54
27
|
return typeof value?.then === "function";
|
|
55
28
|
}
|
|
56
29
|
function wrapAffectedResolvers(schema, options) {
|
|
57
|
-
return
|
|
58
|
-
[
|
|
30
|
+
return mapSchema(schema, {
|
|
31
|
+
[MapperKind.OBJECT_FIELD](fieldConfig, _, __, schema2) {
|
|
59
32
|
const directiveNode = getDirectiveByName(fieldConfig, options.name);
|
|
60
33
|
const directive = directiveNode ? schema2.getDirective(directiveNode.name.value) : null;
|
|
61
34
|
if (directiveNode && directive) {
|
|
62
|
-
const directiveArgs =
|
|
63
|
-
const originalResolve = fieldConfig.resolve ??
|
|
64
|
-
const originalSubscribe = fieldConfig.subscribe ??
|
|
35
|
+
const directiveArgs = getDirectiveValues(directive, { directives: [directiveNode] }) || {};
|
|
36
|
+
const originalResolve = fieldConfig.resolve ?? defaultFieldResolver;
|
|
37
|
+
const originalSubscribe = fieldConfig.subscribe ?? defaultFieldResolver;
|
|
65
38
|
if (_isValidator(options)) {
|
|
66
39
|
return {
|
|
67
40
|
...fieldConfig,
|
|
@@ -156,11 +129,10 @@ const _isValidator = (options) => {
|
|
|
156
129
|
const _isTransformer = (options) => {
|
|
157
130
|
return options.type === "TRANSFORMER_DIRECTIVE" /* TRANSFORMER */;
|
|
158
131
|
};
|
|
159
|
-
|
|
160
|
-
0 && (module.exports = {
|
|
132
|
+
export {
|
|
161
133
|
DirectiveType,
|
|
162
134
|
getDirectiveByName,
|
|
163
135
|
hasDirective,
|
|
164
136
|
isPromise,
|
|
165
137
|
useRedwoodDirective
|
|
166
|
-
}
|
|
138
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRedwoodError.d.ts","sourceRoot":"","sources":["../../src/plugins/useRedwoodError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAO1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAEjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useRedwoodError.d.ts","sourceRoot":"","sources":["../../src/plugins/useRedwoodError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAO1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAEjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAExD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,WAClB,MAAM,KACb,MAAM,CAAC,qBAAqB,CAyC9B,CAAA"}
|
|
@@ -1,43 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 useRedwoodError_exports = {};
|
|
20
|
-
__export(useRedwoodError_exports, {
|
|
21
|
-
useRedwoodError: () => useRedwoodError
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useRedwoodError_exports);
|
|
24
|
-
var import_graphql_yoga = require("graphql-yoga");
|
|
25
|
-
var import_api = require("@cedarjs/api");
|
|
1
|
+
import {
|
|
2
|
+
handleStreamOrSingleExecutionResult,
|
|
3
|
+
createGraphQLError
|
|
4
|
+
} from "graphql-yoga";
|
|
5
|
+
import { RedwoodError } from "@cedarjs/api";
|
|
26
6
|
const useRedwoodError = (logger) => {
|
|
27
7
|
return {
|
|
28
8
|
async onExecute() {
|
|
29
9
|
return {
|
|
30
10
|
onExecuteDone(payload) {
|
|
31
|
-
return
|
|
11
|
+
return handleStreamOrSingleExecutionResult(
|
|
32
12
|
payload,
|
|
33
13
|
({ result, setResult }) => {
|
|
34
14
|
const errors = result.errors?.map((error) => {
|
|
35
|
-
if (error.originalError && error.originalError instanceof
|
|
15
|
+
if (error.originalError && error.originalError instanceof RedwoodError) {
|
|
36
16
|
logger.debug(
|
|
37
17
|
{ custom: { name: error.originalError.name } },
|
|
38
18
|
"Converting RedwoodError to GraphQLError"
|
|
39
19
|
);
|
|
40
|
-
return
|
|
20
|
+
return createGraphQLError(error.message, {
|
|
41
21
|
extensions: error.extensions,
|
|
42
22
|
originalError: error
|
|
43
23
|
});
|
|
@@ -57,7 +37,6 @@ const useRedwoodError = (logger) => {
|
|
|
57
37
|
}
|
|
58
38
|
};
|
|
59
39
|
};
|
|
60
|
-
|
|
61
|
-
0 && (module.exports = {
|
|
40
|
+
export {
|
|
62
41
|
useRedwoodError
|
|
63
|
-
}
|
|
42
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Plugin } from 'graphql-yoga';
|
|
2
|
-
import type { RedwoodGraphQLContext } from '../types';
|
|
2
|
+
import type { RedwoodGraphQLContext } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* This Envelop plugin waits until the GraphQL context is done building and sets
|
|
5
5
|
* the CedarJS global context which can be imported with:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRedwoodGlobalContextSetter.d.ts","sourceRoot":"","sources":["../../src/plugins/useRedwoodGlobalContextSetter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAI1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useRedwoodGlobalContextSetter.d.ts","sourceRoot":"","sources":["../../src/plugins/useRedwoodGlobalContextSetter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAI1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAExD;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,QACpC,MAAM,CAAC,qBAAqB,CAM9B,CAAA"}
|
|
@@ -1,35 +1,11 @@
|
|
|
1
|
-
|
|
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 useRedwoodGlobalContextSetter_exports = {};
|
|
20
|
-
__export(useRedwoodGlobalContextSetter_exports, {
|
|
21
|
-
useRedwoodGlobalContextSetter: () => useRedwoodGlobalContextSetter
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useRedwoodGlobalContextSetter_exports);
|
|
24
|
-
var import_context = require("@cedarjs/context");
|
|
1
|
+
import { setContext } from "@cedarjs/context";
|
|
25
2
|
const useRedwoodGlobalContextSetter = () => ({
|
|
26
3
|
onContextBuilding() {
|
|
27
4
|
return ({ context }) => {
|
|
28
|
-
|
|
5
|
+
setContext(context);
|
|
29
6
|
};
|
|
30
7
|
}
|
|
31
8
|
});
|
|
32
|
-
|
|
33
|
-
0 && (module.exports = {
|
|
9
|
+
export {
|
|
34
10
|
useRedwoodGlobalContextSetter
|
|
35
|
-
}
|
|
11
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Plugin } from 'graphql-yoga';
|
|
2
2
|
import type { Logger, LevelWithSilent } from '@cedarjs/api/logger';
|
|
3
|
-
import type { RedwoodGraphQLContext } from '../types';
|
|
3
|
+
import type { RedwoodGraphQLContext } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Options for request and response information to include in the log statements
|
|
6
6
|
* output by UseRedwoodLogger around the execution event
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRedwoodLogger.d.ts","sourceRoot":"","sources":["../../src/plugins/useRedwoodLogger.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAI1C,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAGlE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useRedwoodLogger.d.ts","sourceRoot":"","sources":["../../src/plugins/useRedwoodLogger.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAI1C,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAGlE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAExD;;;;;;;;;;;;;GAaG;AACH,KAAK,oBAAoB,GAAG;IAC1B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,EAAE,eAAe,GAAG,MAAM,CAAA;IAEhC;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IAEd;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IAEvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC7B,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,oBAAoB,CAAA;CAC/B,CAAA;AA+DD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,iBACb,YAAY,KACzB,MAAM,CAAC,qBAAqB,CAsG9B,CAAA"}
|
|
@@ -1,37 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 useRedwoodLogger_exports = {};
|
|
20
|
-
__export(useRedwoodLogger_exports, {
|
|
21
|
-
useRedwoodLogger: () => useRedwoodLogger
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(useRedwoodLogger_exports);
|
|
24
|
-
var import_graphql = require("graphql");
|
|
25
|
-
var import_graphql_yoga = require("graphql-yoga");
|
|
26
|
-
var import_uuid = require("uuid");
|
|
27
|
-
var import_errors = require("../errors");
|
|
1
|
+
import { Kind } from "graphql";
|
|
2
|
+
import { handleStreamOrSingleExecutionResult } from "graphql-yoga";
|
|
3
|
+
import { v4 as uuidv4 } from "uuid";
|
|
4
|
+
import { AuthenticationError, ForbiddenError } from "../errors.js";
|
|
28
5
|
const logResult = (loggerConfig, envelopLogger, operationName) => ({ result }) => {
|
|
29
6
|
const includeTracing = loggerConfig?.options?.tracing;
|
|
30
7
|
const includeData = loggerConfig?.options?.data;
|
|
31
8
|
const options = {};
|
|
32
9
|
if (result?.errors && result?.errors.length > 0) {
|
|
33
10
|
result.errors.forEach((error) => {
|
|
34
|
-
if (error.originalError && (error.originalError instanceof
|
|
11
|
+
if (error.originalError && (error.originalError instanceof AuthenticationError || error.originalError instanceof ForbiddenError)) {
|
|
35
12
|
envelopLogger.warn(
|
|
36
13
|
error,
|
|
37
14
|
`'${error?.extensions?.code || "authentication"}' error '${error.message}' occurred in ${operationName}`
|
|
@@ -109,7 +86,7 @@ const useRedwoodLogger = (loggerConfig) => {
|
|
|
109
86
|
onExecute({ args }) {
|
|
110
87
|
const options = {};
|
|
111
88
|
const rootOperation = args.document.definitions.find(
|
|
112
|
-
(o) => o.kind ===
|
|
89
|
+
(o) => o.kind === Kind.OPERATION_DEFINITION
|
|
113
90
|
);
|
|
114
91
|
const operationName = args.operationName || rootOperation.name?.value || "Anonymous Operation";
|
|
115
92
|
if (excludeOperations?.includes(operationName)) {
|
|
@@ -122,7 +99,7 @@ const useRedwoodLogger = (loggerConfig) => {
|
|
|
122
99
|
options["query"] = args.variableValues;
|
|
123
100
|
}
|
|
124
101
|
if (includeRequestId) {
|
|
125
|
-
options["requestId"] = args.contextValue.requestContext?.awsRequestId || args.contextValue.event?.requestContext?.requestId || (
|
|
102
|
+
options["requestId"] = args.contextValue.requestContext?.awsRequestId || args.contextValue.event?.requestContext?.requestId || uuidv4();
|
|
126
103
|
}
|
|
127
104
|
if (includeUserAgent) {
|
|
128
105
|
options["userAgent"] = args.contextValue.event?.headers["user-agent"];
|
|
@@ -134,7 +111,7 @@ const useRedwoodLogger = (loggerConfig) => {
|
|
|
134
111
|
const handleResult = logResult(loggerConfig, envelopLogger, operationName);
|
|
135
112
|
return {
|
|
136
113
|
onExecuteDone: (payload) => {
|
|
137
|
-
|
|
114
|
+
handleStreamOrSingleExecutionResult(payload, ({ result }) => {
|
|
138
115
|
handleResult({ result });
|
|
139
116
|
return void 0;
|
|
140
117
|
});
|
|
@@ -143,7 +120,6 @@ const useRedwoodLogger = (loggerConfig) => {
|
|
|
143
120
|
}
|
|
144
121
|
};
|
|
145
122
|
};
|
|
146
|
-
|
|
147
|
-
0 && (module.exports = {
|
|
123
|
+
export {
|
|
148
124
|
useRedwoodLogger
|
|
149
|
-
}
|
|
125
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Plugin } from '@envelop/core';
|
|
2
2
|
import * as opentelemetry from '@opentelemetry/api';
|
|
3
|
-
import type { RedwoodOpenTelemetryConfig } from '../types';
|
|
3
|
+
import type { RedwoodOpenTelemetryConfig } from '../types.js';
|
|
4
4
|
export declare enum AttributeName {
|
|
5
5
|
EXECUTION_ERROR = "graphql.execute.error",
|
|
6
6
|
EXECUTION_RESULT = "graphql.execute.result",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRedwoodOpenTelemetry.d.ts","sourceRoot":"","sources":["../../src/plugins/useRedwoodOpenTelemetry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAuB,MAAM,eAAe,CAAA;AAKhE,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AAGnD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useRedwoodOpenTelemetry.d.ts","sourceRoot":"","sources":["../../src/plugins/useRedwoodOpenTelemetry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAuB,MAAM,eAAe,CAAA;AAKhE,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AAGnD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AAE7D,oBAAY,aAAa;IACvB,eAAe,0BAA0B;IACzC,gBAAgB,2BAA2B;IAC3C,kBAAkB,+BAA+B;IACjD,mBAAmB,+BAA+B;IAClD,kBAAkB,8BAA8B;IAChD,oBAAoB,gCAAgC;IACpD,aAAa,0BAA0B;IACvC,wBAAwB,kCAAkC;IAC1D,4BAA4B,6BAA6B;IACzD,mBAAmB,8BAA8B;CAClD;AAGD,QAAA,MAAM,iBAAiB,2BAA2B,CAAA;AAElD,KAAK,aAAa,GAAG;IACnB,CAAC,iBAAiB,CAAC,EAAE,aAAa,CAAC,IAAI,CAAA;CACxC,CAAA;AAED,eAAO,MAAM,uBAAuB,YACzB,0BAA0B,KAClC,MAAM,CAAC,aAAa,CAgHtB,CAAA"}
|
|
@@ -1,42 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var useRedwoodOpenTelemetry_exports = {};
|
|
30
|
-
__export(useRedwoodOpenTelemetry_exports, {
|
|
31
|
-
AttributeName: () => AttributeName,
|
|
32
|
-
useRedwoodOpenTelemetry: () => useRedwoodOpenTelemetry
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(useRedwoodOpenTelemetry_exports);
|
|
35
|
-
var import_core = require("@envelop/core");
|
|
36
|
-
var import_on_resolve = require("@envelop/on-resolve");
|
|
37
|
-
var import_api = require("@opentelemetry/api");
|
|
38
|
-
var opentelemetry = __toESM(require("@opentelemetry/api"));
|
|
39
|
-
var import_graphql = require("graphql");
|
|
1
|
+
import { isAsyncIterable } from "@envelop/core";
|
|
2
|
+
import { useOnResolve } from "@envelop/on-resolve";
|
|
3
|
+
import { SpanKind } from "@opentelemetry/api";
|
|
4
|
+
import * as opentelemetry from "@opentelemetry/api";
|
|
5
|
+
import { print } from "graphql";
|
|
40
6
|
var AttributeName = /* @__PURE__ */ ((AttributeName2) => {
|
|
41
7
|
AttributeName2["EXECUTION_ERROR"] = "graphql.execute.error";
|
|
42
8
|
AttributeName2["EXECUTION_RESULT"] = "graphql.execute.result";
|
|
@@ -52,14 +18,14 @@ var AttributeName = /* @__PURE__ */ ((AttributeName2) => {
|
|
|
52
18
|
})(AttributeName || {});
|
|
53
19
|
const tracingSpanSymbol = "OPEN_TELEMETRY_GRAPHQL";
|
|
54
20
|
const useRedwoodOpenTelemetry = (options) => {
|
|
55
|
-
const spanKind =
|
|
21
|
+
const spanKind = SpanKind.SERVER;
|
|
56
22
|
const spanAdditionalAttributes = {};
|
|
57
23
|
const tracer = opentelemetry.trace.getTracer("redwoodjs");
|
|
58
24
|
return {
|
|
59
25
|
onPluginInit({ addPlugin }) {
|
|
60
26
|
if (options.resolvers) {
|
|
61
27
|
addPlugin(
|
|
62
|
-
|
|
28
|
+
useOnResolve(({ info, context, args }) => {
|
|
63
29
|
if (context && typeof context === "object" && context[tracingSpanSymbol]) {
|
|
64
30
|
const ctx = opentelemetry.trace.setSpan(
|
|
65
31
|
opentelemetry.context.active(),
|
|
@@ -105,7 +71,7 @@ const useRedwoodOpenTelemetry = (options) => {
|
|
|
105
71
|
attributes: {
|
|
106
72
|
...spanAdditionalAttributes,
|
|
107
73
|
["graphql.execute.operationName" /* EXECUTION_OPERATION_NAME */]: args.operationName ?? void 0,
|
|
108
|
-
["graphql.execute.document" /* EXECUTION_OPERATION_DOCUMENT */]:
|
|
74
|
+
["graphql.execute.document" /* EXECUTION_OPERATION_DOCUMENT */]: print(args.document),
|
|
109
75
|
...options.variables ? {
|
|
110
76
|
["graphql.execute.variables" /* EXECUTION_VARIABLES */]: JSON.stringify(
|
|
111
77
|
args.variableValues ?? {}
|
|
@@ -116,7 +82,7 @@ const useRedwoodOpenTelemetry = (options) => {
|
|
|
116
82
|
(executionSpan) => {
|
|
117
83
|
const resultCbs = {
|
|
118
84
|
onExecuteDone({ result }) {
|
|
119
|
-
if (
|
|
85
|
+
if (isAsyncIterable(result)) {
|
|
120
86
|
executionSpan.end();
|
|
121
87
|
console.warn(
|
|
122
88
|
`Plugin "RedwoodOpenTelemetry" encountered an AsyncIterator which is not supported yet, so tracing data is not available for the operation.`
|
|
@@ -149,8 +115,7 @@ const useRedwoodOpenTelemetry = (options) => {
|
|
|
149
115
|
}
|
|
150
116
|
};
|
|
151
117
|
};
|
|
152
|
-
|
|
153
|
-
0 && (module.exports = {
|
|
118
|
+
export {
|
|
154
119
|
AttributeName,
|
|
155
120
|
useRedwoodOpenTelemetry
|
|
156
|
-
}
|
|
121
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Plugin } from 'graphql-yoga';
|
|
2
|
-
import type { RedwoodGraphQLContext, GraphQLHandlerOptions } from '../types';
|
|
2
|
+
import type { RedwoodGraphQLContext, GraphQLHandlerOptions } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* This Envelop plugin enriches the context on a per-request basis
|
|
5
5
|
* by populating it with the results of a custom function
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRedwoodPopulateContext.d.ts","sourceRoot":"","sources":["../../src/plugins/useRedwoodPopulateContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useRedwoodPopulateContext.d.ts","sourceRoot":"","sources":["../../src/plugins/useRedwoodPopulateContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAE/E;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,2BACZ,WAAW,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,KACpE,MAAM,CAAC,qBAAqB,CAW9B,CAAA"}
|