@makerx/graphql-core 1.5.0 → 2.1.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/README.md +3 -18
- package/logging.d.ts +67 -9
- package/logging.d.ts.map +1 -1
- package/logging.js +26 -15
- package/logging.js.map +1 -1
- package/package.json +1 -1
- package/subscriptions/server.d.ts +3 -2
- package/subscriptions/server.d.ts.map +1 -1
- package/subscriptions/server.js +5 -5
- package/subscriptions/server.js.map +1 -1
- package/testing.d.ts +2 -2
- package/testing.d.ts.map +1 -1
- package/testing.js +6 -5
- package/testing.js.map +1 -1
package/README.md
CHANGED
|
@@ -119,26 +119,11 @@ const graphqlServer = createServer({
|
|
|
119
119
|
|
|
120
120
|
### logGraphQLOperation
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
Logs a GraphQL operation in a consistent format with the option of including any additional data. Top level and result level log data with null or undefined values will be omitted for berevity.
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
- `query`: the formatted graphql query or mutation, or 'IntrospectionQuery'
|
|
126
|
-
- `variables`: the graphql request variables
|
|
127
|
-
- `duration`: the duration of request processing
|
|
128
|
-
- `errors`: the graphql response errors, if any
|
|
124
|
+
Refer to the `GraphQLLogOperationInfo` type for the definition of input.
|
|
129
125
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
- null or undefined values will be omitted
|
|
133
|
-
- introspection queries will not be logged outside of production
|
|
134
|
-
|
|
135
|
-
This function can be used across implementations, e.g. in a [GraphQL Envelop plugin](https://www.envelop.dev/docs/plugins) or [ApolloServer plugin](https://www.apollographql.com/docs/apollo-server/integrations/plugins/).
|
|
136
|
-
|
|
137
|
-
### logGraphQLExecutionArgs
|
|
138
|
-
|
|
139
|
-
The `logGraphQLExecutionArgs` will log `operationName`, `query` and `variables` params from the GraphQL `ExecutionArgs`.
|
|
140
|
-
|
|
141
|
-
This can be used when logging from execution callbacks, e.g. graphql-ws Server [onOperation](https://the-guild.dev/graphql/ws/docs/interfaces/server.ServerOptions#onoperation) and [onNext](https://the-guild.dev/graphql/ws/docs/interfaces/server.ServerOptions#onnext).
|
|
126
|
+
This function can be used across implementations, e.g. in a [GraphQL Envelop plugin](https://www.envelop.dev/docs/plugins) or [ApolloServer plugin](https://github.com/MakerXStudio/graphql-apollo-server/blob/main/src/plugins/graphql-operation-logging-plugin.ts).
|
|
142
127
|
|
|
143
128
|
## GraphQL subscriptions
|
|
144
129
|
|
package/logging.d.ts
CHANGED
|
@@ -1,21 +1,79 @@
|
|
|
1
1
|
import { Logger } from '@makerx/node-common';
|
|
2
|
-
import { ExecutionArgs, GraphQLFormattedError } from 'graphql';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { ExecutionArgs, GraphQLFormattedError, OperationTypeNode } from 'graphql';
|
|
3
|
+
import { ExecutionResult } from 'graphql-ws';
|
|
4
|
+
type LogFunction = Logger['info'];
|
|
5
|
+
export type LoggerLogFunctions<T extends Logger> = {
|
|
6
|
+
[Property in keyof T]: LogFunction;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Info for logging a GraphQL operation in a consistent format with the option of including any additional data.
|
|
10
|
+
*/
|
|
11
|
+
export interface GraphQLLogOperationInfo<TLogger extends Logger = Logger> extends Record<string, unknown> {
|
|
12
|
+
/**
|
|
13
|
+
* The message to log, defaults to 'GraphQL operation'.
|
|
14
|
+
*/
|
|
15
|
+
message?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The timestamp when the operation started, if supplied, the duration will be logged.
|
|
18
|
+
*/
|
|
19
|
+
started?: number;
|
|
20
|
+
/**
|
|
21
|
+
* The type of GraphQL operation.
|
|
22
|
+
*/
|
|
23
|
+
type?: OperationTypeNode | null;
|
|
24
|
+
/**
|
|
25
|
+
* The name of the GraphQL operation.
|
|
26
|
+
*/
|
|
5
27
|
operationName?: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* The formatted GraphQL query.
|
|
30
|
+
*/
|
|
6
31
|
query?: string | null;
|
|
32
|
+
/**
|
|
33
|
+
* The GraphQL variables.
|
|
34
|
+
*/
|
|
7
35
|
variables?: Record<string, unknown> | null;
|
|
8
|
-
|
|
36
|
+
/**
|
|
37
|
+
* The result of the GraphQL operation.
|
|
38
|
+
* Generally, we don't log the data or extensions, just errors.
|
|
39
|
+
*/
|
|
40
|
+
result?: {
|
|
9
41
|
data?: Record<string, unknown> | null;
|
|
10
42
|
errors?: readonly GraphQLFormattedError[] | null;
|
|
43
|
+
extensions?: Record<string, unknown> | null;
|
|
44
|
+
hasNext?: boolean;
|
|
11
45
|
};
|
|
12
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Whether the operation is an introspection query.
|
|
48
|
+
*/
|
|
49
|
+
isIntrospectionQuery?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the operation is part of an incremental response.
|
|
52
|
+
*/
|
|
53
|
+
isIncrementalResponse?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the operation is a subsequent payload of an incremental response.
|
|
56
|
+
*/
|
|
57
|
+
isSubsequentPayload?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* The logger to use.
|
|
60
|
+
*/
|
|
61
|
+
logger: TLogger;
|
|
62
|
+
/**
|
|
63
|
+
* The logger function to use, defaults to 'info'.
|
|
64
|
+
*/
|
|
65
|
+
logLevel?: keyof LoggerLogFunctions<TLogger>;
|
|
13
66
|
}
|
|
14
|
-
export declare const logGraphQLOperation: ({ started, operationName, query, variables, result: { errors }, logger }: GraphQLLogOperationInfo) => void;
|
|
15
67
|
/**
|
|
16
|
-
* Logs
|
|
17
|
-
*
|
|
68
|
+
* Logs a GraphQL operation in a consistent format with the option of including any additional data.
|
|
69
|
+
* Top level and result entries with null or undefined values will be omitted.
|
|
18
70
|
*/
|
|
19
|
-
export declare const
|
|
71
|
+
export declare const logGraphQLOperation: <TLogger extends Logger = Logger>({ message, started, type, operationName, query, variables, result, logger, logLevel, ...rest }: GraphQLLogOperationInfo<TLogger>) => void;
|
|
72
|
+
export declare const logSubscriptionOperation: <TLogger extends Logger = Logger>({ args, result, message, logLevel, }: {
|
|
73
|
+
args: ExecutionArgs;
|
|
74
|
+
result?: ExecutionResult<Record<string, unknown>, Record<string, unknown>> | undefined;
|
|
75
|
+
message?: string | undefined;
|
|
76
|
+
logLevel?: keyof TLogger | undefined;
|
|
77
|
+
}) => void;
|
|
20
78
|
export {};
|
|
21
79
|
//# sourceMappingURL=logging.d.ts.map
|
package/logging.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAS,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,iBAAiB,EAAS,MAAM,SAAS,CAAA;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAK5C,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;AACjC,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,IAAI;KAChD,QAAQ,IAAI,MAAM,CAAC,GAAG,WAAW;CACnC,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvG;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAC/B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAC1C;;;OAGG;IACH,MAAM,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;QACrC,MAAM,CAAC,EAAE,SAAS,qBAAqB,EAAE,GAAG,IAAI,CAAA;QAChD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;QAC3C,OAAO,CAAC,EAAE,OAAO,CAAA;KAClB,CAAA;IACD;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;OAEG;IACH,MAAM,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,kBAAkB,CAAC,OAAO,CAAC,CAAA;CAC7C;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,6KA8B/B,CAAA;AAED,eAAO,MAAM,wBAAwB;UAM7B,aAAa;;;;UAqBpB,CAAA"}
|
package/logging.js
CHANGED
|
@@ -3,36 +3,47 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.logSubscriptionOperation = exports.logGraphQLOperation = void 0;
|
|
7
7
|
const node_common_1 = require("@makerx/node-common");
|
|
8
8
|
const graphql_1 = require("graphql");
|
|
9
9
|
const lodash_omitby_1 = __importDefault(require("lodash.omitby"));
|
|
10
10
|
const utils_1 = require("./utils");
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Logs a GraphQL operation in a consistent format with the option of including any additional data.
|
|
13
|
+
* Top level and result entries with null or undefined values will be omitted.
|
|
14
|
+
*/
|
|
15
|
+
const logGraphQLOperation = ({ message = 'GraphQL operation', started, type, operationName, query, variables, result, logger, logLevel = 'info', ...rest }) => {
|
|
12
16
|
const isIntrospection = query && (0, utils_1.isIntrospectionQuery)(query);
|
|
13
17
|
if (node_common_1.isLocalDev && isIntrospection)
|
|
14
18
|
return;
|
|
15
|
-
logger
|
|
19
|
+
logger[logLevel](message, (0, lodash_omitby_1.default)({
|
|
20
|
+
type,
|
|
16
21
|
operationName,
|
|
17
|
-
query
|
|
22
|
+
query,
|
|
18
23
|
variables: variables && Object.keys(variables).length > 0 ? variables : undefined,
|
|
19
|
-
duration: Date.now() - started,
|
|
20
|
-
|
|
24
|
+
duration: started ? Date.now() - started : undefined,
|
|
25
|
+
result: result ? (0, lodash_omitby_1.default)(result, utils_1.isNil) : undefined,
|
|
26
|
+
isIntrospectionQuery: isIntrospection || undefined,
|
|
27
|
+
...(0, lodash_omitby_1.default)(rest, utils_1.isNil),
|
|
21
28
|
}, utils_1.isNil));
|
|
22
29
|
};
|
|
23
30
|
exports.logGraphQLOperation = logGraphQLOperation;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const logGraphQLExecutionArgs = (args, message, logger) => {
|
|
31
|
+
const logSubscriptionOperation = ({ args, result, message, logLevel, }) => {
|
|
32
|
+
const logger = args.contextValue.logger;
|
|
33
|
+
if (!logger)
|
|
34
|
+
return;
|
|
29
35
|
const { operationName, variableValues, document } = args;
|
|
30
|
-
const
|
|
31
|
-
|
|
36
|
+
const { data, ...resultWithoutData } = result ?? {};
|
|
37
|
+
(0, exports.logGraphQLOperation)({
|
|
38
|
+
message,
|
|
39
|
+
type: graphql_1.OperationTypeNode.SUBSCRIPTION,
|
|
32
40
|
operationName,
|
|
33
41
|
query: (0, graphql_1.print)(document),
|
|
34
42
|
variables: variableValues,
|
|
35
|
-
|
|
43
|
+
result: resultWithoutData,
|
|
44
|
+
logger,
|
|
45
|
+
logLevel,
|
|
46
|
+
});
|
|
36
47
|
};
|
|
37
|
-
exports.
|
|
48
|
+
exports.logSubscriptionOperation = logSubscriptionOperation;
|
|
38
49
|
//# sourceMappingURL=logging.js.map
|
package/logging.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":";;;;;;AAAA,qDAAwD;AACxD,
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":";;;;;;AAAA,qDAAwD;AACxD,qCAAwF;AAExF,kEAAkC;AAElC,mCAAqD;AAmErD;;;GAGG;AACI,MAAM,mBAAmB,GAAG,CAAkC,EACnE,OAAO,GAAG,mBAAmB,EAC7B,OAAO,EACP,IAAI,EACJ,aAAa,EACb,KAAK,EACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,QAAQ,GAAG,MAAM,EACjB,GAAG,IAAI,EAC0B,EAAE,EAAE;IACrC,MAAM,eAAe,GAAG,KAAK,IAAI,IAAA,4BAAoB,EAAC,KAAK,CAAC,CAAA;IAC5D,IAAI,wBAAU,IAAI,eAAe;QAAE,OAAM;IACzC,MAAM,CAAC,QAAwB,CAAC,CAC9B,OAAO,EACP,IAAA,uBAAM,EACJ;QACE,IAAI;QACJ,aAAa;QACb,KAAK;QACL,SAAS,EAAE,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;QACjF,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,SAAS;QACpD,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,IAAA,uBAAM,EAAC,MAAM,EAAE,aAAK,CAAC,CAAC,CAAC,CAAC,SAAS;QAClD,oBAAoB,EAAE,eAAe,IAAI,SAAS;QAClD,GAAG,IAAA,uBAAM,EAAC,IAAI,EAAE,aAAK,CAAC;KACvB,EACD,aAAK,CACN,CACF,CAAA;AACH,CAAC,CAAA;AA9BY,QAAA,mBAAmB,uBA8B/B;AAEM,MAAM,wBAAwB,GAAG,CAAkC,EACxE,IAAI,EACJ,MAAM,EACN,OAAO,EACP,QAAQ,GAMT,EAAE,EAAE;IACH,MAAM,MAAM,GAAI,IAAI,CAAC,YAA+B,CAAC,MAAiB,CAAA;IACtE,IAAI,CAAC,MAAM;QAAE,OAAM;IAEnB,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAA;IACxD,MAAM,EAAE,IAAI,EAAE,GAAG,iBAAiB,EAAE,GAAG,MAAM,IAAI,EAAE,CAAA;IAEnD,IAAA,2BAAmB,EAAC;QAClB,OAAO;QACP,IAAI,EAAE,2BAAiB,CAAC,YAAY;QACpC,aAAa;QACb,KAAK,EAAE,IAAA,eAAK,EAAC,QAAQ,CAAC;QACtB,SAAS,EAAE,cAAc;QACzB,MAAM,EAAE,iBAAiB;QACzB,MAAM;QACN,QAAQ;KACT,CAAC,CAAA;AACJ,CAAC,CAAA;AA3BY,QAAA,wBAAwB,4BA2BpC"}
|
package/package.json
CHANGED
|
@@ -4,11 +4,12 @@ import { GraphQLSchema } from 'graphql';
|
|
|
4
4
|
import type { Server } from 'http';
|
|
5
5
|
import { JwtPayload } from '../context';
|
|
6
6
|
import { CreateSubscriptionContext } from './context';
|
|
7
|
-
export declare function useSubscriptionsServer({ schema, httpServer, createSubscriptionContext, logger, path, verifyToken, requireAuth, jwtClaimsToLog, }: {
|
|
7
|
+
export declare function useSubscriptionsServer<TLogger extends Logger = Logger>({ schema, httpServer, createSubscriptionContext, logger, operationLogLevel, path, verifyToken, requireAuth, jwtClaimsToLog, }: {
|
|
8
8
|
schema: GraphQLSchema;
|
|
9
9
|
httpServer: Server;
|
|
10
10
|
createSubscriptionContext: CreateSubscriptionContext;
|
|
11
|
-
logger:
|
|
11
|
+
logger: TLogger;
|
|
12
|
+
operationLogLevel?: keyof TLogger;
|
|
12
13
|
path?: string;
|
|
13
14
|
verifyToken?: (host: string, token: string) => Promise<JwtPayload>;
|
|
14
15
|
requireAuth?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/subscriptions/server.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/subscriptions/server.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAGvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAGlC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAA;AAGrD,wBAAgB,sBAAsB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAAE,EACtE,MAAM,EACN,UAAU,EACV,yBAAyB,EACzB,MAAM,EACN,iBAA0B,EAC1B,IAAiB,EACjB,WAAW,EACX,WAAW,EACX,cAA+B,GAChC,EAAE;IACD,MAAM,EAAE,aAAa,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,yBAAyB,EAAE,yBAAyB,CAAA;IACpD,MAAM,EAAE,OAAO,CAAA;IACf,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAA;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAA;IAClE,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAC1B,mCA+EA"}
|
package/subscriptions/server.js
CHANGED
|
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.useSubscriptionsServer = void 0;
|
|
7
|
+
const graphql_ws_1 = require("graphql-ws");
|
|
7
8
|
const ws_1 = require("graphql-ws/lib/use/ws");
|
|
8
9
|
const lodash_pick_1 = __importDefault(require("lodash.pick"));
|
|
9
10
|
const ws_2 = require("ws");
|
|
10
11
|
const logging_1 = require("../logging");
|
|
11
12
|
const utils_1 = require("./utils");
|
|
12
|
-
|
|
13
|
-
function useSubscriptionsServer({ schema, httpServer, createSubscriptionContext, logger, path = '/graphql', verifyToken, requireAuth, jwtClaimsToLog = ['oid', 'iss'], }) {
|
|
13
|
+
function useSubscriptionsServer({ schema, httpServer, createSubscriptionContext, logger, operationLogLevel = 'info', path = '/graphql', verifyToken, requireAuth, jwtClaimsToLog = ['oid', 'iss'], }) {
|
|
14
14
|
if (requireAuth && !verifyToken)
|
|
15
15
|
throw new Error('verifyToken must be supplied when requireAuth is true');
|
|
16
16
|
const wsServer = new ws_2.WebSocketServer({
|
|
@@ -80,10 +80,10 @@ function useSubscriptionsServer({ schema, httpServer, createSubscriptionContext,
|
|
|
80
80
|
});
|
|
81
81
|
},
|
|
82
82
|
onOperation(_ctx, _message, args) {
|
|
83
|
-
(0, logging_1.
|
|
83
|
+
(0, logging_1.logSubscriptionOperation)({ args, logLevel: operationLogLevel });
|
|
84
84
|
},
|
|
85
|
-
onNext(_ctx, _message, args,
|
|
86
|
-
(0, logging_1.
|
|
85
|
+
onNext(_ctx, _message, args, { data, ...result }) {
|
|
86
|
+
(0, logging_1.logSubscriptionOperation)({ args, logLevel: operationLogLevel, result });
|
|
87
87
|
},
|
|
88
88
|
}, wsServer);
|
|
89
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/subscriptions/server.ts"],"names":[],"mappings":";;;;;;AAEA,8CAAiD;AAEjD,8DAA8B;AAC9B,2BAAoC;AAEpC,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/subscriptions/server.ts"],"names":[],"mappings":";;;;;;AAEA,2CAAsC;AACtC,8CAAiD;AAEjD,8DAA8B;AAC9B,2BAAoC;AAEpC,wCAAqD;AAErD,mCAAmE;AAEnE,SAAgB,sBAAsB,CAAkC,EACtE,MAAM,EACN,UAAU,EACV,yBAAyB,EACzB,MAAM,EACN,iBAAiB,GAAG,MAAM,EAC1B,IAAI,GAAG,UAAU,EACjB,WAAW,EACX,WAAW,EACX,cAAc,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,GAWhC;IACC,IAAI,WAAW,IAAI,CAAC,WAAW;QAAE,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;IAEzG,MAAM,QAAQ,GAAG,IAAI,oBAAe,CAAC;QACnC,MAAM,EAAE,UAAU;QAClB,IAAI;KACL,CAAC,CAAA;IAEF,OAAO,IAAA,cAAS,EACd;QACE,MAAM;QACN,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM;YAC3B,MAAM,CAAC,KAAK,CAAC,oCAAoC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;QACzE,CAAC;QACD,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;YACvB,MAAM,qBAAqB,GAAG,qCAAqC,CAAA;YACnE,IAAI,CAAC,WAAW,EAAE;gBAChB,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAA;gBAClC,OAAO,IAAI,CAAA;aACZ;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6 +2,6 @@ import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
|
|
|
2
2
|
import { ClientCredentialsConfig } from '@makerx/node-common';
|
|
3
3
|
import { ApolloClientOptions } from '@apollo/client/core/ApolloClient';
|
|
4
4
|
export * from '@apollo/client/core';
|
|
5
|
-
export declare const createTestClient: (url: string, accessToken?: string, options?: Partial<ApolloClientOptions<NormalizedCacheObject>>) => ApolloClient<NormalizedCacheObject>;
|
|
6
|
-
export declare const createTestClientWithClientCredentials: (url: string, clientCredentialsConfig: ClientCredentialsConfig, options?: Partial<ApolloClientOptions<NormalizedCacheObject>>) => ApolloClient<NormalizedCacheObject>;
|
|
5
|
+
export declare const createTestClient: (fetch: WindowOrWorkerGlobalScope['fetch'], url: string, accessToken?: string, options?: Partial<ApolloClientOptions<NormalizedCacheObject>>) => ApolloClient<NormalizedCacheObject>;
|
|
6
|
+
export declare const createTestClientWithClientCredentials: (fetch: WindowOrWorkerGlobalScope['fetch'], url: string, clientCredentialsConfig: ClientCredentialsConfig, options?: Partial<ApolloClientOptions<NormalizedCacheObject>>) => ApolloClient<NormalizedCacheObject>;
|
|
7
7
|
//# sourceMappingURL=testing.d.ts.map
|
package/testing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuC,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAE9G,OAAO,EAAuB,uBAAuB,EAA6B,MAAM,qBAAqB,CAAA;AAC7G,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AAEtE,cAAc,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuC,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAE9G,OAAO,EAAuB,uBAAuB,EAA6B,MAAM,qBAAqB,CAAA;AAC7G,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AAEtE,cAAc,qBAAqB,CAAA;AAuCnC,eAAO,MAAM,gBAAgB,UACpB,yBAAyB,CAAC,OAAO,CAAC,OACpC,MAAM,gBACG,MAAM,YACV,QAAQ,oBAAoB,qBAAqB,CAAC,CAAC,KAC5D,aAAa,qBAAqB,CAUjC,CAAA;AAEJ,eAAO,MAAM,qCAAqC,UACzC,yBAAyB,CAAC,OAAO,CAAC,OACpC,MAAM,2BACc,uBAAuB,YACtC,QAAQ,oBAAoB,qBAAqB,CAAC,CAAC,KAC5D,aAAa,qBAAqB,CAUjC,CAAA"}
|
package/testing.js
CHANGED
|
@@ -48,11 +48,12 @@ const clientCredentialsLink = (clientCredentialsConfig) => {
|
|
|
48
48
|
};
|
|
49
49
|
});
|
|
50
50
|
};
|
|
51
|
-
const httpLink = (url) => (0, core_1.createHttpLink)({
|
|
51
|
+
const httpLink = (url, fetch) => (0, core_1.createHttpLink)({
|
|
52
52
|
uri: url,
|
|
53
|
+
fetch,
|
|
53
54
|
});
|
|
54
|
-
const createTestClient = (url, accessToken, options) => new core_1.ApolloClient({
|
|
55
|
-
link: (0, core_1.from)([bearerTokenLink(accessToken), httpLink(url)]),
|
|
55
|
+
const createTestClient = (fetch, url, accessToken, options) => new core_1.ApolloClient({
|
|
56
|
+
link: (0, core_1.from)([bearerTokenLink(accessToken), httpLink(url, fetch)]),
|
|
56
57
|
cache: new core_1.InMemoryCache(),
|
|
57
58
|
defaultOptions: {
|
|
58
59
|
query: {
|
|
@@ -62,8 +63,8 @@ const createTestClient = (url, accessToken, options) => new core_1.ApolloClient(
|
|
|
62
63
|
...options,
|
|
63
64
|
});
|
|
64
65
|
exports.createTestClient = createTestClient;
|
|
65
|
-
const createTestClientWithClientCredentials = (url, clientCredentialsConfig, options) => new core_1.ApolloClient({
|
|
66
|
-
link: (0, core_1.from)([clientCredentialsLink(clientCredentialsConfig), httpLink(url)]),
|
|
66
|
+
const createTestClientWithClientCredentials = (fetch, url, clientCredentialsConfig, options) => new core_1.ApolloClient({
|
|
67
|
+
link: (0, core_1.from)([clientCredentialsLink(clientCredentialsConfig), httpLink(url, fetch)]),
|
|
67
68
|
cache: new core_1.InMemoryCache(),
|
|
68
69
|
defaultOptions: {
|
|
69
70
|
query: {
|
package/testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,8CAA8G;AAC9G,yDAAwD;AACxD,qDAA6G;AAG7G,sDAAmC;AAEnC,MAAM,eAAe,GAAG,CAAC,WAAoB,EAAE,EAAE,CAC/C,IAAA,oBAAU,EAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAC5B,IAAI,WAAW;QACb,OAAO;YACL,OAAO,EAAE;gBACP,GAAG,OAAO;gBACV,aAAa,EAAE,UAAU,WAAW,EAAE;aACvC;SACF,CAAA;IACH,OAAO;QACL,OAAO;KACR,CAAA;AACH,CAAC,CAAC,CAAA;AAEJ,MAAM,qBAAqB,GAAG,CAAC,uBAAgD,EAAE,EAAE;IACjF,IAAI,OAAiD,CAAA;IACrD,OAAO,IAAA,oBAAU,EAAC,KAAK,IAAI,EAAE;QAC3B,IAAI,CAAC,OAAO;YAAE,OAAO,GAAG,IAAA,uCAAyB,EAAC,uBAAuB,CAAC,CAAA;QAC1E,IAAI,aAAa,GAAG,MAAM,OAAO,CAAA;QACjC,IAAI,aAAa,CAAC,SAAS,EAAE;YAC3B,OAAO,GAAG,IAAA,uCAAyB,EAAC,uBAAuB,CAAC,CAAA;YAC5D,aAAa,GAAG,MAAM,OAAO,CAAA;SAC9B;QACD,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,aAAa,CAAC,YAAY,EAAE;aACtD;SACF,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,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