@common-stack/graphql-api 3.0.1-alpha.0 → 3.0.2-alpha.2

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/lib/index.js CHANGED
@@ -20,13 +20,15 @@ __webpack_require__.r(__webpack_exports__);
20
20
  /*!**********************************!*\
21
21
  !*** ./src/api/graphql/index.ts ***!
22
22
  \**********************************/
23
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
23
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
24
24
 
25
+ __webpack_require__.r(__webpack_exports__);
26
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
27
+ /* harmony export */ schema: () => (/* binding */ schema)
28
+ /* harmony export */ });
29
+ /* harmony import */ var _root_schema_graphqls__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./root-schema.graphqls */ "./src/api/graphql/root-schema.graphqls");
25
30
 
26
- Object.defineProperty(exports, "__esModule", ({ value: true }));
27
- exports.schema = void 0;
28
- const root_schema_graphqls_1 = __webpack_require__(/*! ./root-schema.graphqls */ "./src/api/graphql/root-schema.graphqls");
29
- exports.schema = [root_schema_graphqls_1.default];
31
+ const schema = [_root_schema_graphqls__WEBPACK_IMPORTED_MODULE_0__["default"]];
30
32
 
31
33
 
32
34
  /***/ }),
@@ -35,26 +37,18 @@ exports.schema = [root_schema_graphqls_1.default];
35
37
  /*!**************************!*\
36
38
  !*** ./src/api/index.ts ***!
37
39
  \**************************/
38
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
40
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
41
+
42
+ __webpack_require__.r(__webpack_exports__);
43
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
44
+ /* harmony export */ resolverFunc: () => (/* reexport safe */ _resolvers__WEBPACK_IMPORTED_MODULE_1__.resolverFunc),
45
+ /* harmony export */ resolvers: () => (/* reexport safe */ _resolvers__WEBPACK_IMPORTED_MODULE_1__.resolvers),
46
+ /* harmony export */ schema: () => (/* reexport safe */ _graphql__WEBPACK_IMPORTED_MODULE_0__.schema)
47
+ /* harmony export */ });
48
+ /* harmony import */ var _graphql__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./graphql */ "./src/api/graphql/index.ts");
49
+ /* harmony import */ var _resolvers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./resolvers */ "./src/api/resolvers.ts");
39
50
 
40
51
 
41
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
42
- if (k2 === undefined) k2 = k;
43
- var desc = Object.getOwnPropertyDescriptor(m, k);
44
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
45
- desc = { enumerable: true, get: function() { return m[k]; } };
46
- }
47
- Object.defineProperty(o, k2, desc);
48
- }) : (function(o, m, k, k2) {
49
- if (k2 === undefined) k2 = k;
50
- o[k2] = m[k];
51
- }));
52
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
53
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
54
- };
55
- Object.defineProperty(exports, "__esModule", ({ value: true }));
56
- __exportStar(__webpack_require__(/*! ./graphql */ "./src/api/graphql/index.ts"), exports);
57
- __exportStar(__webpack_require__(/*! ./resolvers */ "./src/api/resolvers.ts"), exports);
58
52
 
59
53
 
60
54
  /***/ }),
@@ -63,66 +57,38 @@ __exportStar(__webpack_require__(/*! ./resolvers */ "./src/api/resolvers.ts"), e
63
57
  /*!******************************!*\
64
58
  !*** ./src/api/resolvers.ts ***!
65
59
  \******************************/
66
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
67
-
68
-
69
- Object.defineProperty(exports, "__esModule", ({ value: true }));
70
- exports.resolverFunc = exports.resolvers = void 0;
71
- const graphql_type_json_1 = __webpack_require__(/*! graphql-type-json */ "graphql-type-json");
72
- const graphql_iso_date_1 = __webpack_require__(/*! graphql-iso-date */ "graphql-iso-date");
73
- const graphql_type_uri_1 = __webpack_require__(/*! @cdmbase/graphql-type-uri */ "@cdmbase/graphql-type-uri");
74
- const GraphQLTimestamp_1 = __webpack_require__(/*! ../scalars/GraphQLTimestamp */ "./src/scalars/GraphQLTimestamp.ts");
75
- const AnyObject_1 = __webpack_require__(/*! ../scalars/AnyObject */ "./src/scalars/AnyObject.ts");
76
- exports.resolvers = {
77
- AnyObject: AnyObject_1.GraphQLAnyObject,
78
- Date: graphql_iso_date_1.GraphQLDate,
79
- Time: graphql_iso_date_1.GraphQLTime,
80
- Timestamp: GraphQLTimestamp_1.default,
81
- URI: (0, graphql_type_uri_1.default)('URI'),
82
- URIInput: (0, graphql_type_uri_1.default)('URIInput'),
83
- DateTime: graphql_iso_date_1.GraphQLDateTime,
84
- JSON: graphql_type_json_1.default,
85
- JSONObject: graphql_type_json_1.GraphQLJSONObject,
86
- };
87
- const resolverFunc = (options) => exports.resolvers;
88
- exports.resolverFunc = resolverFunc;
60
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
89
61
 
62
+ __webpack_require__.r(__webpack_exports__);
63
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
64
+ /* harmony export */ resolverFunc: () => (/* binding */ resolverFunc),
65
+ /* harmony export */ resolvers: () => (/* binding */ resolvers)
66
+ /* harmony export */ });
67
+ /* harmony import */ var graphql_type_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphql-type-json */ "graphql-type-json");
68
+ /* harmony import */ var graphql_type_json__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphql_type_json__WEBPACK_IMPORTED_MODULE_0__);
69
+ /* harmony import */ var graphql_iso_date__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphql-iso-date */ "graphql-iso-date");
70
+ /* harmony import */ var graphql_iso_date__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(graphql_iso_date__WEBPACK_IMPORTED_MODULE_1__);
71
+ /* harmony import */ var _cdmbase_graphql_type_uri__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @cdmbase/graphql-type-uri */ "@cdmbase/graphql-type-uri");
72
+ /* harmony import */ var _cdmbase_graphql_type_uri__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_cdmbase_graphql_type_uri__WEBPACK_IMPORTED_MODULE_2__);
73
+ /* harmony import */ var _scalars_GraphQLTimestamp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../scalars/GraphQLTimestamp */ "./src/scalars/GraphQLTimestamp.ts");
74
+ /* harmony import */ var _scalars_AnyObject__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../scalars/AnyObject */ "./src/scalars/AnyObject.ts");
90
75
 
91
- /***/ }),
92
76
 
93
- /***/ "./src/index.ts":
94
- /*!**********************!*\
95
- !*** ./src/index.ts ***!
96
- \**********************/
97
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
98
77
 
99
78
 
100
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
101
- if (k2 === undefined) k2 = k;
102
- var desc = Object.getOwnPropertyDescriptor(m, k);
103
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
104
- desc = { enumerable: true, get: function() { return m[k]; } };
105
- }
106
- Object.defineProperty(o, k2, desc);
107
- }) : (function(o, m, k, k2) {
108
- if (k2 === undefined) k2 = k;
109
- o[k2] = m[k];
110
- }));
111
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
112
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
79
+
80
+ const resolvers = {
81
+ AnyObject: _scalars_AnyObject__WEBPACK_IMPORTED_MODULE_4__.GraphQLAnyObject,
82
+ Date: graphql_iso_date__WEBPACK_IMPORTED_MODULE_1__.GraphQLDate,
83
+ Time: graphql_iso_date__WEBPACK_IMPORTED_MODULE_1__.GraphQLTime,
84
+ Timestamp: _scalars_GraphQLTimestamp__WEBPACK_IMPORTED_MODULE_3__["default"],
85
+ URI: _cdmbase_graphql_type_uri__WEBPACK_IMPORTED_MODULE_2___default()('URI'),
86
+ URIInput: _cdmbase_graphql_type_uri__WEBPACK_IMPORTED_MODULE_2___default()('URIInput'),
87
+ DateTime: graphql_iso_date__WEBPACK_IMPORTED_MODULE_1__.GraphQLDateTime,
88
+ JSON: (graphql_type_json__WEBPACK_IMPORTED_MODULE_0___default()),
89
+ JSONObject: graphql_type_json__WEBPACK_IMPORTED_MODULE_0__.GraphQLJSONObject,
113
90
  };
114
- Object.defineProperty(exports, "__esModule", ({ value: true }));
115
- exports.rootSchemaDef = exports.resolvers = void 0;
116
- const server_core_1 = __webpack_require__(/*! @common-stack/server-core */ "@common-stack/server-core");
117
- const api_1 = __webpack_require__(/*! ./api */ "./src/api/index.ts");
118
- Object.defineProperty(exports, "rootSchemaDef", ({ enumerable: true, get: function () { return api_1.schema; } }));
119
- Object.defineProperty(exports, "resolvers", ({ enumerable: true, get: function () { return api_1.resolvers; } }));
120
- __exportStar(__webpack_require__(/*! ./scalars */ "./src/scalars/index.ts"), exports);
121
- __exportStar(__webpack_require__(/*! ./utils */ "./src/utils/index.ts"), exports);
122
- exports["default"] = new server_core_1.Feature({
123
- schema: api_1.schema,
124
- createResolversFunc: api_1.resolverFunc,
125
- });
91
+ const resolverFunc = (options) => resolvers;
126
92
 
127
93
 
128
94
  /***/ }),
@@ -131,15 +97,18 @@ exports["default"] = new server_core_1.Feature({
131
97
  /*!**********************************!*\
132
98
  !*** ./src/scalars/AnyObject.ts ***!
133
99
  \**********************************/
134
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
135
-
100
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
136
101
 
137
- Object.defineProperty(exports, "__esModule", ({ value: true }));
138
- exports.GraphQLAnyObject = void 0;
102
+ __webpack_require__.r(__webpack_exports__);
103
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
104
+ /* harmony export */ GraphQLAnyObject: () => (/* binding */ GraphQLAnyObject)
105
+ /* harmony export */ });
106
+ /* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphql */ "graphql");
107
+ /* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphql__WEBPACK_IMPORTED_MODULE_0__);
139
108
  // add any scalar types
140
- const graphql_1 = __webpack_require__(/*! graphql */ "graphql");
109
+
141
110
  //https://stackoverflow.com/questions/41557536/custom-map-keys-in-graphql-response
142
- exports.GraphQLAnyObject = new graphql_1.GraphQLScalarType({
111
+ const GraphQLAnyObject = new graphql__WEBPACK_IMPORTED_MODULE_0__.GraphQLScalarType({
143
112
  name: 'AnyObject',
144
113
  description: 'Any JSON object. This type bypasses type checking.',
145
114
  serialize: value => {
@@ -149,8 +118,8 @@ exports.GraphQLAnyObject = new graphql_1.GraphQLScalarType({
149
118
  return value;
150
119
  },
151
120
  parseLiteral: ast => {
152
- if (ast.kind !== graphql_1.Kind.OBJECT) {
153
- throw new graphql_1.GraphQLError("Query error: Can only parse object but got a: " + ast.kind, [ast]);
121
+ if (ast.kind !== graphql__WEBPACK_IMPORTED_MODULE_0__.Kind.OBJECT) {
122
+ throw new graphql__WEBPACK_IMPORTED_MODULE_0__.GraphQLError("Query error: Can only parse object but got a: " + ast.kind, [ast]);
154
123
  }
155
124
  return ast.fields;
156
125
  }
@@ -163,12 +132,18 @@ exports.GraphQLAnyObject = new graphql_1.GraphQLScalarType({
163
132
  /*!*****************************************!*\
164
133
  !*** ./src/scalars/GraphQLTimestamp.ts ***!
165
134
  \*****************************************/
166
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
135
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
136
+
137
+ __webpack_require__.r(__webpack_exports__);
138
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
139
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
140
+ /* harmony export */ });
141
+ /* harmony import */ var graphql_language__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphql/language */ "graphql/language");
142
+ /* harmony import */ var graphql_language__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphql_language__WEBPACK_IMPORTED_MODULE_0__);
143
+ /* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphql */ "graphql");
144
+ /* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(graphql__WEBPACK_IMPORTED_MODULE_1__);
167
145
 
168
146
 
169
- Object.defineProperty(exports, "__esModule", ({ value: true }));
170
- const language_1 = __webpack_require__(/*! graphql/language */ "graphql/language");
171
- const graphql_1 = __webpack_require__(/*! graphql */ "graphql");
172
147
  // source from https://gist.github.com/langpavel/b30f3d507a47713b0c6e89016e4e9eb7
173
148
  function serializeDate(value) {
174
149
  if (value instanceof Date) {
@@ -194,16 +169,16 @@ function parseDate(value) {
194
169
  }
195
170
  }
196
171
  function parseDateFromLiteral(ast) {
197
- if (ast.kind === language_1.Kind.INT) {
172
+ if (ast.kind === graphql_language__WEBPACK_IMPORTED_MODULE_0__.Kind.INT) {
198
173
  const num = parseInt(ast.value, 10);
199
174
  return new Date(num);
200
175
  }
201
- else if (ast.kind === language_1.Kind.STRING) {
176
+ else if (ast.kind === graphql_language__WEBPACK_IMPORTED_MODULE_0__.Kind.STRING) {
202
177
  return parseDate(ast.value);
203
178
  }
204
179
  return null;
205
180
  }
206
- const TimestampType = new graphql_1.GraphQLScalarType({
181
+ const TimestampType = new graphql__WEBPACK_IMPORTED_MODULE_1__.GraphQLScalarType({
207
182
  name: 'Timestamp',
208
183
  description: 'The javascript `Date` as integer. Type represents date and time ' +
209
184
  'as number of milliseconds from start of UNIX epoch.',
@@ -211,7 +186,7 @@ const TimestampType = new graphql_1.GraphQLScalarType({
211
186
  parseValue: parseDate,
212
187
  parseLiteral: parseDateFromLiteral,
213
188
  });
214
- exports["default"] = TimestampType;
189
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TimestampType);
215
190
 
216
191
 
217
192
  /***/ }),
@@ -220,25 +195,14 @@ exports["default"] = TimestampType;
220
195
  /*!******************************!*\
221
196
  !*** ./src/scalars/index.ts ***!
222
197
  \******************************/
223
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
198
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
224
199
 
200
+ __webpack_require__.r(__webpack_exports__);
201
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
202
+ /* harmony export */ GraphQLAnyObject: () => (/* reexport safe */ _AnyObject__WEBPACK_IMPORTED_MODULE_0__.GraphQLAnyObject)
203
+ /* harmony export */ });
204
+ /* harmony import */ var _AnyObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AnyObject */ "./src/scalars/AnyObject.ts");
225
205
 
226
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
227
- if (k2 === undefined) k2 = k;
228
- var desc = Object.getOwnPropertyDescriptor(m, k);
229
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
230
- desc = { enumerable: true, get: function() { return m[k]; } };
231
- }
232
- Object.defineProperty(o, k2, desc);
233
- }) : (function(o, m, k, k2) {
234
- if (k2 === undefined) k2 = k;
235
- o[k2] = m[k];
236
- }));
237
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
238
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
239
- };
240
- Object.defineProperty(exports, "__esModule", ({ value: true }));
241
- __exportStar(__webpack_require__(/*! ./AnyObject */ "./src/scalars/AnyObject.ts"), exports);
242
206
 
243
207
 
244
208
  /***/ }),
@@ -247,40 +211,47 @@ __exportStar(__webpack_require__(/*! ./AnyObject */ "./src/scalars/AnyObject.ts"
247
211
  /*!******************************************************!*\
248
212
  !*** ./src/utils/cache-paginated-queries.factory.ts ***!
249
213
  \******************************************************/
250
- /***/ ((__unused_webpack_module, exports) => {
251
-
214
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
252
215
 
253
- Object.defineProperty(exports, "__esModule", ({ value: true }));
254
- exports.cachePaginatedQueriesFactory = exports.DEFAULT_LIMIT = exports.DEFAULT_SKIP = void 0;
255
- exports.DEFAULT_SKIP = 0;
256
- exports.DEFAULT_LIMIT = 10;
216
+ __webpack_require__.r(__webpack_exports__);
217
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
218
+ /* harmony export */ DEFAULT_LIMIT: () => (/* binding */ DEFAULT_LIMIT),
219
+ /* harmony export */ DEFAULT_SKIP: () => (/* binding */ DEFAULT_SKIP),
220
+ /* harmony export */ cachePaginatedQueriesFactory: () => (/* binding */ cachePaginatedQueriesFactory)
221
+ /* harmony export */ });
222
+ const DEFAULT_SKIP = 0;
223
+ const DEFAULT_LIMIT = 10;
257
224
  const cachePaginatedQueriesFactory = (queries) => {
258
225
  return queries.reduce((acc, query) => {
259
226
  const queryName = typeof query === 'string' ? query : query.name;
260
227
  const keyArgs = typeof query === 'string' ? ['criteria', 'sort'] : query.keyArgs;
261
228
  const skipKey = typeof query === 'string' ? 'skip' : query.skipKey;
262
229
  const limitKey = typeof query === 'string' ? 'limit' : query.limitKey;
263
- return Object.assign(Object.assign({}, acc), { [queryName]: {
230
+ return {
231
+ ...acc,
232
+ [queryName]: {
264
233
  keyArgs,
265
234
  merge(existing, incoming, { args }) {
266
- const skip = args.get(skipKey, exports.DEFAULT_SKIP);
267
- const merged = (existing === null || existing === void 0 ? void 0 : existing.data.length) > 0 ? existing.data.slice(0) : [];
268
- incoming === null || incoming === void 0 ? void 0 : incoming.data.forEach((curr, index) => {
235
+ const skip = args.get(skipKey, DEFAULT_SKIP);
236
+ const merged = existing?.data.length > 0 ? existing.data.slice(0) : [];
237
+ incoming?.data.forEach((curr, index) => {
269
238
  merged[skip + index] = curr;
270
239
  });
271
- return Object.assign(Object.assign({}, incoming), { data: merged });
240
+ return { ...incoming, data: merged };
272
241
  },
273
242
  read(existing, { args }) {
274
- var _a;
275
- const skip = args.get(skipKey, exports.DEFAULT_SKIP);
276
- const limit = args.get(limitKey, exports.DEFAULT_LIMIT);
277
- const data = (existing === null || existing === void 0 ? void 0 : existing.data) && ((_a = existing === null || existing === void 0 ? void 0 : existing.data) === null || _a === void 0 ? void 0 : _a.slice(skip, skip + limit));
278
- return Object.assign(Object.assign({}, existing), { data });
243
+ const skip = args.get(skipKey, DEFAULT_SKIP);
244
+ const limit = args.get(limitKey, DEFAULT_LIMIT);
245
+ const data = existing?.data && existing?.data?.slice(skip, skip + limit);
246
+ return {
247
+ ...existing,
248
+ data,
249
+ };
279
250
  },
280
- } });
251
+ }
252
+ };
281
253
  }, {});
282
254
  };
283
- exports.cachePaginatedQueriesFactory = cachePaginatedQueriesFactory;
284
255
 
285
256
 
286
257
  /***/ }),
@@ -289,13 +260,14 @@ exports.cachePaginatedQueriesFactory = cachePaginatedQueriesFactory;
289
260
  /*!****************************!*\
290
261
  !*** ./src/utils/index.ts ***!
291
262
  \****************************/
292
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
263
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
293
264
 
265
+ __webpack_require__.r(__webpack_exports__);
266
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
267
+ /* harmony export */ cachePaginatedQueriesFactory: () => (/* reexport safe */ _cache_paginated_queries_factory__WEBPACK_IMPORTED_MODULE_0__.cachePaginatedQueriesFactory)
268
+ /* harmony export */ });
269
+ /* harmony import */ var _cache_paginated_queries_factory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cache-paginated-queries.factory */ "./src/utils/cache-paginated-queries.factory.ts");
294
270
 
295
- Object.defineProperty(exports, "__esModule", ({ value: true }));
296
- exports.cachePaginatedQueriesFactory = void 0;
297
- var cache_paginated_queries_factory_1 = __webpack_require__(/*! ./cache-paginated-queries.factory */ "./src/utils/cache-paginated-queries.factory.ts");
298
- Object.defineProperty(exports, "cachePaginatedQueriesFactory", ({ enumerable: true, get: function () { return cache_paginated_queries_factory_1.cachePaginatedQueriesFactory; } }));
299
271
 
300
272
 
301
273
  /***/ }),
@@ -380,13 +352,25 @@ module.exports = require("graphql/language");
380
352
  /******/ };
381
353
  /******/
382
354
  /******/ // Execute the module function
383
- /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
355
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
384
356
  /******/
385
357
  /******/ // Return the exports of the module
386
358
  /******/ return module.exports;
387
359
  /******/ }
388
360
  /******/
389
361
  /************************************************************************/
362
+ /******/ /* webpack/runtime/compat get default export */
363
+ /******/ (() => {
364
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
365
+ /******/ __webpack_require__.n = (module) => {
366
+ /******/ var getter = module && module.__esModule ?
367
+ /******/ () => (module['default']) :
368
+ /******/ () => (module);
369
+ /******/ __webpack_require__.d(getter, { a: getter });
370
+ /******/ return getter;
371
+ /******/ };
372
+ /******/ })();
373
+ /******/
390
374
  /******/ /* webpack/runtime/define property getters */
391
375
  /******/ (() => {
392
376
  /******/ // define getter functions for harmony exports
@@ -416,13 +400,39 @@ module.exports = require("graphql/language");
416
400
  /******/ })();
417
401
  /******/
418
402
  /************************************************************************/
419
- /******/
420
- /******/ // startup
421
- /******/ // Load entry module and return exports
422
- /******/ // This entry module is referenced by other modules so it can't be inlined
423
- /******/ var __webpack_exports__ = __webpack_require__("./src/index.ts");
424
- /******/ module.exports = __webpack_exports__;
425
- /******/
403
+ var __webpack_exports__ = {};
404
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
405
+ (() => {
406
+ /*!**********************!*\
407
+ !*** ./src/index.ts ***!
408
+ \**********************/
409
+ __webpack_require__.r(__webpack_exports__);
410
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
411
+ /* harmony export */ GraphQLAnyObject: () => (/* reexport safe */ _scalars__WEBPACK_IMPORTED_MODULE_2__.GraphQLAnyObject),
412
+ /* harmony export */ cachePaginatedQueriesFactory: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_3__.cachePaginatedQueriesFactory),
413
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
414
+ /* harmony export */ resolvers: () => (/* reexport safe */ _api__WEBPACK_IMPORTED_MODULE_1__.resolvers),
415
+ /* harmony export */ rootSchemaDef: () => (/* reexport safe */ _api__WEBPACK_IMPORTED_MODULE_1__.schema)
416
+ /* harmony export */ });
417
+ /* harmony import */ var _common_stack_server_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @common-stack/server-core */ "@common-stack/server-core");
418
+ /* harmony import */ var _common_stack_server_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_common_stack_server_core__WEBPACK_IMPORTED_MODULE_0__);
419
+ /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./api */ "./src/api/index.ts");
420
+ /* harmony import */ var _scalars__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./scalars */ "./src/scalars/index.ts");
421
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./src/utils/index.ts");
422
+
423
+
424
+
425
+
426
+
427
+
428
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (new _common_stack_server_core__WEBPACK_IMPORTED_MODULE_0__.Feature({
429
+ schema: _api__WEBPACK_IMPORTED_MODULE_1__.schema,
430
+ createResolversFunc: _api__WEBPACK_IMPORTED_MODULE_1__.resolverFunc,
431
+ }));
432
+
433
+ })();
434
+
435
+ module.exports = __webpack_exports__;
426
436
  /******/ })()
427
437
  ;
428
438
  //# sourceMappingURL=index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;;;;;;AC3CD,uJAAiF;AAAxE,4KAA4B;;;;;;;;;;;ACArC;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;UENA;UACA;UACA;UACA","sources":["webpack://@common-stack/graphql-api/./src/api/graphql/root-schema.graphqls","webpack://@common-stack/graphql-api/./src/api/graphql/index.ts","webpack://@common-stack/graphql-api/./src/api/index.ts","webpack://@common-stack/graphql-api/./src/api/resolvers.ts","webpack://@common-stack/graphql-api/./src/index.ts","webpack://@common-stack/graphql-api/./src/scalars/AnyObject.ts","webpack://@common-stack/graphql-api/./src/scalars/GraphQLTimestamp.ts","webpack://@common-stack/graphql-api/./src/scalars/index.ts","webpack://@common-stack/graphql-api/./src/utils/cache-paginated-queries.factory.ts","webpack://@common-stack/graphql-api/./src/utils/index.ts","webpack://@common-stack/graphql-api/external commonjs \"@cdmbase/graphql-type-uri\"","webpack://@common-stack/graphql-api/external commonjs \"@common-stack/server-core\"","webpack://@common-stack/graphql-api/external commonjs \"graphql\"","webpack://@common-stack/graphql-api/external commonjs \"graphql-iso-date\"","webpack://@common-stack/graphql-api/external commonjs \"graphql-type-json\"","webpack://@common-stack/graphql-api/external commonjs \"graphql/language\"","webpack://@common-stack/graphql-api/webpack/bootstrap","webpack://@common-stack/graphql-api/webpack/runtime/define property getters","webpack://@common-stack/graphql-api/webpack/runtime/hasOwnProperty shorthand","webpack://@common-stack/graphql-api/webpack/runtime/make namespace object","webpack://@common-stack/graphql-api/webpack/before-startup","webpack://@common-stack/graphql-api/webpack/startup","webpack://@common-stack/graphql-api/webpack/after-startup"],"sourcesContent":["export default \"scalar AnyObject\\nscalar Date\\nscalar Time\\nscalar DateTime\\nscalar Timestamp\\nscalar URI\\nscalar URIInput\\nscalar Observable\\nscalar JSON\\nscalar JSONObject\\n\\ndirective @cacheControl(maxAge: Int, scope: CacheControlScope) on FIELD_DEFINITION | OBJECT | INTERFACE\\nenum CacheControlScope {\\n PUBLIC\\n PRIVATE\\n}\\n\\n\\n\\\"\\\"\\\"\\n An object with an ID.\\n\\\"\\\"\\\"\\ninterface Node {\\n \\\"\\\"\\\"\\n The ID of the node.\\n \\\"\\\"\\\"\\n id: ID!\\n}\\n\\n# Pagination information. See https://facebook.github.io/relay/graphql/connections.htm#sec-undefined.PageInfo.\\ntype PageInfo {\\n # Whether there is a next page of nodes in the connection.\\n hasNextPage: Boolean!\\n}\\n\\n\\\"\\\"\\\"\\n Represents a null return value.\\n\\\"\\\"\\\"\\ntype EmptyResponse {\\n # A dummy null value.\\n alwaysNil: String\\n}\\n\\ntype FieldError {\\n field: String!\\n message: String!\\n}\\n\\ninput Sort{\\n key: String!,\\n value: SortEnum!,\\n}\\n\\nenum SortEnum{\\n ASC,\\n DESC\\n}\\n\\ntype Query {\\n \\\"\\\"\\\"\\n Looks up a node by ID.\\n \\\"\\\"\\\"\\n node(id: ID!): Node\\n\\n}\\n\\ntype Mutation {\\n dummy: Int\\n}\\n\\ntype Subscription {\\n dummy: Int\\n}\\n\\n\\ntype AdminIdeSettings {\\n dummy: Int\\n}\\n\\n\\\"\\\"\\\" All Moleculer Topic names are extended from this.\\\"\\\"\\\"\\nenum MoleculerServiceName {\\n dummy\\n}\\n\\n#interface Node {\\n# id: ID!\\n#}\\n\\n\\nschema {\\n query: Query\\n mutation: Mutation\\n subscription: Subscription\\n}\\n\\n\";","import rootSchema from './root-schema.graphqls';\n\nexport const schema = [rootSchema];\n","export * from './graphql';\nexport * from './resolvers';\n","import GraphQLJSON, { GraphQLJSONObject } from 'graphql-type-json';\nimport { GraphQLDate, GraphQLTime, GraphQLDateTime } from 'graphql-iso-date';\nimport GraphQLURI from '@cdmbase/graphql-type-uri';\nimport GraphqlTimestamp from '../scalars/GraphQLTimestamp';\nimport { GraphQLAnyObject } from '../scalars/AnyObject';\n\nexport const resolvers = {\n AnyObject: GraphQLAnyObject,\n Date: GraphQLDate,\n Time: GraphQLTime,\n Timestamp: GraphqlTimestamp,\n URI: GraphQLURI('URI'),\n URIInput: GraphQLURI('URIInput'),\n DateTime: GraphQLDateTime,\n JSON: GraphQLJSON,\n JSONObject: GraphQLJSONObject,\n};\n\nexport const resolverFunc = (options) => resolvers;","import { Feature } from '@common-stack/server-core';\nimport { schema, resolvers, resolverFunc } from './api';\n\nexport { resolvers };\nexport { schema as rootSchemaDef };\nexport * from './scalars';\nexport * from './utils';\n\n\nexport default new Feature({\n schema,\n createResolversFunc: resolverFunc,\n})","// add any scalar types\nimport { GraphQLError, GraphQLScalarType, Kind } from 'graphql';\n\n//https://stackoverflow.com/questions/41557536/custom-map-keys-in-graphql-response\nexport const GraphQLAnyObject = new GraphQLScalarType({\n name: 'AnyObject',\n description: 'Any JSON object. This type bypasses type checking.',\n serialize: value => {\n return value;\n },\n parseValue: value => {\n return value;\n },\n parseLiteral: ast => {\n if (ast.kind !== Kind.OBJECT) {\n throw new GraphQLError(\"Query error: Can only parse object but got a: \" + ast.kind, [ast]);\n }\n return ast.fields;\n }\n});\n\n","import { Kind } from 'graphql/language';\nimport { GraphQLScalarType } from 'graphql';\n\n\n// source from https://gist.github.com/langpavel/b30f3d507a47713b0c6e89016e4e9eb7\nfunction serializeDate(value) {\n if (value instanceof Date) {\n return value.getTime();\n } else if (typeof value === 'number') {\n return Math.trunc(value);\n } else if (typeof value === 'string') {\n return Date.parse(value);\n }\n return null;\n}\n\nfunction parseDate(value) {\n if (value === null) {\n return null;\n }\n\n try {\n return new Date(value);\n } catch (err) {\n return null;\n }\n}\n\nfunction parseDateFromLiteral(ast) {\n if (ast.kind === Kind.INT) {\n const num = parseInt(ast.value, 10);\n return new Date(num);\n } else if (ast.kind === Kind.STRING) {\n return parseDate(ast.value);\n }\n return null;\n}\n\nconst TimestampType = new GraphQLScalarType({\n name: 'Timestamp',\n description:\n 'The javascript `Date` as integer. Type represents date and time ' +\n 'as number of milliseconds from start of UNIX epoch.',\n serialize: serializeDate,\n parseValue: parseDate,\n parseLiteral: parseDateFromLiteral,\n});\n\nexport default TimestampType;","export * from './AnyObject';\n","import { TypePolicies } from '@apollo/client';\n\ninterface QueryOptionsInterface {\n name: string,\n keyArgs?: (string[] | string)[]\n skipKey?: string,\n limitKey?: string,\n}\n\n\nexport const DEFAULT_SKIP = 0;\nexport const DEFAULT_LIMIT = 10;\n\nexport const cachePaginatedQueriesFactory = (queries: (string | QueryOptionsInterface)[]): TypePolicies => {\n return queries.reduce((acc, query) => {\n const queryName = typeof query === 'string' ? query : query.name;\n const keyArgs = typeof query === 'string' ? ['criteria', 'sort'] : query.keyArgs;\n const skipKey = typeof query === 'string' ? 'skip' : query.skipKey;\n const limitKey = typeof query === 'string' ? 'limit' : query.limitKey;\n return {\n ...acc,\n [queryName]: {\n keyArgs,\n merge(existing, incoming, { args }) {\n const skip = args.get(skipKey, DEFAULT_SKIP);\n const merged = existing?.data.length > 0 ? existing.data.slice(0) : [];\n incoming?.data.forEach((curr, index) => {\n merged[skip + index] = curr;\n },)\n return { ...incoming, data: merged };\n },\n read(existing, { args }) {\n const skip = args.get(skipKey, DEFAULT_SKIP);\n const limit = args.get(limitKey, DEFAULT_LIMIT);\n const data = existing?.data && existing?.data?.slice(skip, skip + limit);\n return {\n ...existing,\n data,\n }\n },\n }\n }\n }, {})\n}\n","export { cachePaginatedQueriesFactory } from './cache-paginated-queries.factory';\n","module.exports = require(\"@cdmbase/graphql-type-uri\");","module.exports = require(\"@common-stack/server-core\");","module.exports = require(\"graphql\");","module.exports = require(\"graphql-iso-date\");","module.exports = require(\"graphql-type-json\");","module.exports = require(\"graphql/language\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/index.ts\");\n",""],"names":[],"sourceRoot":""}
1
+ {"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;AAAA,iEAAe,mSAAmS,wBAAwB,8DAA8D,iEAAiE,mIAAmI,8FAA8F,0EAA0E,qDAAqD,qBAAqB,yCAAyC,eAAe,6CAA6C,kBAAkB,uBAAuB,gBAAgB,mFAAmF,mBAAmB,mBAAmB,uBAAuB,mBAAmB,6BAA6B,mBAAmB,+FAA+F,cAAc,qBAAqB,oBAAoB,cAAc,6EAA6E,KAAK;;;;;;;;;;;;;;;ACAr3C;AAEzC,MAAM,MAAM,GAAG,CAAC,6DAAU,CAAC,CAAC;;;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IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;oBAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;oBAChD,MAAM,IAAI,GAAG,QAAQ,EAAE,IAAI,IAAI,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,KAAK,CAAC,CAAC;oBACzE,OAAO;wBACH,GAAG,QAAQ;wBACX,IAAI;qBACP;gBACL,CAAC;aACJ;SACJ;IACL,CAAC,EAAE,EAAE,CAAC;AACV,CAAC;;;;;;;;;;;;;;;;AC3CgF;;;;;;;;;;;ACAjF;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;;;;;;;;ACNoD;AACI;AAEnC;AACc;AACT;AACF;AAGxB,iEAAe,IAAI,8DAAO,CAAC;IACvB,MAAM;IACN,mBAAmB,EAAE,8CAAY;CACpC,CAAC","sources":["webpack://@common-stack/graphql-api/./src/api/graphql/root-schema.graphqls","webpack://@common-stack/graphql-api/./src/api/graphql/index.ts","webpack://@common-stack/graphql-api/./src/api/index.ts","webpack://@common-stack/graphql-api/./src/api/resolvers.ts","webpack://@common-stack/graphql-api/./src/scalars/AnyObject.ts","webpack://@common-stack/graphql-api/./src/scalars/GraphQLTimestamp.ts","webpack://@common-stack/graphql-api/./src/scalars/index.ts","webpack://@common-stack/graphql-api/./src/utils/cache-paginated-queries.factory.ts","webpack://@common-stack/graphql-api/./src/utils/index.ts","webpack://@common-stack/graphql-api/external commonjs \"@cdmbase/graphql-type-uri\"","webpack://@common-stack/graphql-api/external commonjs \"@common-stack/server-core\"","webpack://@common-stack/graphql-api/external commonjs \"graphql\"","webpack://@common-stack/graphql-api/external commonjs \"graphql-iso-date\"","webpack://@common-stack/graphql-api/external commonjs \"graphql-type-json\"","webpack://@common-stack/graphql-api/external commonjs \"graphql/language\"","webpack://@common-stack/graphql-api/webpack/bootstrap","webpack://@common-stack/graphql-api/webpack/runtime/compat get default export","webpack://@common-stack/graphql-api/webpack/runtime/define property getters","webpack://@common-stack/graphql-api/webpack/runtime/hasOwnProperty shorthand","webpack://@common-stack/graphql-api/webpack/runtime/make namespace object","webpack://@common-stack/graphql-api/./src/index.ts"],"sourcesContent":["export default \"scalar AnyObject\\nscalar Date\\nscalar Time\\nscalar DateTime\\nscalar Timestamp\\nscalar URI\\nscalar URIInput\\nscalar Observable\\nscalar JSON\\nscalar JSONObject\\n\\ndirective @cacheControl(maxAge: Int, scope: CacheControlScope) on FIELD_DEFINITION | OBJECT | INTERFACE\\nenum CacheControlScope {\\n PUBLIC\\n PRIVATE\\n}\\n\\n\\n\\\"\\\"\\\"\\n An object with an ID.\\n\\\"\\\"\\\"\\ninterface Node {\\n \\\"\\\"\\\"\\n The ID of the node.\\n \\\"\\\"\\\"\\n id: ID!\\n}\\n\\n# Pagination information. See https://facebook.github.io/relay/graphql/connections.htm#sec-undefined.PageInfo.\\ntype PageInfo {\\n # Whether there is a next page of nodes in the connection.\\n hasNextPage: Boolean!\\n}\\n\\n\\\"\\\"\\\"\\n Represents a null return value.\\n\\\"\\\"\\\"\\ntype EmptyResponse {\\n # A dummy null value.\\n alwaysNil: String\\n}\\n\\ntype FieldError {\\n field: String!\\n message: String!\\n}\\n\\ninput Sort{\\n key: String!,\\n value: SortEnum!,\\n}\\n\\nenum SortEnum{\\n ASC,\\n DESC\\n}\\n\\ntype Query {\\n \\\"\\\"\\\"\\n Looks up a node by ID.\\n \\\"\\\"\\\"\\n node(id: ID!): Node\\n\\n}\\n\\ntype Mutation {\\n dummy: Int\\n}\\n\\ntype Subscription {\\n dummy: Int\\n}\\n\\n\\ntype AdminIdeSettings {\\n dummy: Int\\n}\\n\\n\\\"\\\"\\\" All Moleculer Topic names are extended from this.\\\"\\\"\\\"\\nenum MoleculerServiceName {\\n dummy\\n}\\n\\n#interface Node {\\n# id: ID!\\n#}\\n\\n\\nschema {\\n query: Query\\n mutation: Mutation\\n subscription: Subscription\\n}\\n\\n\";","import rootSchema from './root-schema.graphqls';\n\nexport const schema = [rootSchema];\n","export * from './graphql';\nexport * from './resolvers';\n","import GraphQLJSON, { GraphQLJSONObject } from 'graphql-type-json';\nimport { GraphQLDate, GraphQLTime, GraphQLDateTime } from 'graphql-iso-date';\nimport GraphQLURI from '@cdmbase/graphql-type-uri';\nimport GraphqlTimestamp from '../scalars/GraphQLTimestamp';\nimport { GraphQLAnyObject } from '../scalars/AnyObject';\n\nexport const resolvers = {\n AnyObject: GraphQLAnyObject,\n Date: GraphQLDate,\n Time: GraphQLTime,\n Timestamp: GraphqlTimestamp,\n URI: GraphQLURI('URI'),\n URIInput: GraphQLURI('URIInput'),\n DateTime: GraphQLDateTime,\n JSON: GraphQLJSON,\n JSONObject: GraphQLJSONObject,\n};\n\nexport const resolverFunc = (options) => resolvers;","// add any scalar types\nimport { GraphQLError, GraphQLScalarType, Kind } from 'graphql';\n\n//https://stackoverflow.com/questions/41557536/custom-map-keys-in-graphql-response\nexport const GraphQLAnyObject = new GraphQLScalarType({\n name: 'AnyObject',\n description: 'Any JSON object. This type bypasses type checking.',\n serialize: value => {\n return value;\n },\n parseValue: value => {\n return value;\n },\n parseLiteral: ast => {\n if (ast.kind !== Kind.OBJECT) {\n throw new GraphQLError(\"Query error: Can only parse object but got a: \" + ast.kind, [ast]);\n }\n return ast.fields;\n }\n});\n\n","import { Kind } from 'graphql/language';\nimport { GraphQLScalarType } from 'graphql';\n\n\n// source from https://gist.github.com/langpavel/b30f3d507a47713b0c6e89016e4e9eb7\nfunction serializeDate(value) {\n if (value instanceof Date) {\n return value.getTime();\n } else if (typeof value === 'number') {\n return Math.trunc(value);\n } else if (typeof value === 'string') {\n return Date.parse(value);\n }\n return null;\n}\n\nfunction parseDate(value) {\n if (value === null) {\n return null;\n }\n\n try {\n return new Date(value);\n } catch (err) {\n return null;\n }\n}\n\nfunction parseDateFromLiteral(ast) {\n if (ast.kind === Kind.INT) {\n const num = parseInt(ast.value, 10);\n return new Date(num);\n } else if (ast.kind === Kind.STRING) {\n return parseDate(ast.value);\n }\n return null;\n}\n\nconst TimestampType = new GraphQLScalarType({\n name: 'Timestamp',\n description:\n 'The javascript `Date` as integer. Type represents date and time ' +\n 'as number of milliseconds from start of UNIX epoch.',\n serialize: serializeDate,\n parseValue: parseDate,\n parseLiteral: parseDateFromLiteral,\n});\n\nexport default TimestampType;","export * from './AnyObject';\n","import { TypePolicies } from '@apollo/client';\n\ninterface QueryOptionsInterface {\n name: string,\n keyArgs?: (string[] | string)[]\n skipKey?: string,\n limitKey?: string,\n}\n\n\nexport const DEFAULT_SKIP = 0;\nexport const DEFAULT_LIMIT = 10;\n\nexport const cachePaginatedQueriesFactory = (queries: (string | QueryOptionsInterface)[]): TypePolicies => {\n return queries.reduce((acc, query) => {\n const queryName = typeof query === 'string' ? query : query.name;\n const keyArgs = typeof query === 'string' ? ['criteria', 'sort'] : query.keyArgs;\n const skipKey = typeof query === 'string' ? 'skip' : query.skipKey;\n const limitKey = typeof query === 'string' ? 'limit' : query.limitKey;\n return {\n ...acc,\n [queryName]: {\n keyArgs,\n merge(existing, incoming, { args }) {\n const skip = args.get(skipKey, DEFAULT_SKIP);\n const merged = existing?.data.length > 0 ? existing.data.slice(0) : [];\n incoming?.data.forEach((curr, index) => {\n merged[skip + index] = curr;\n },)\n return { ...incoming, data: merged };\n },\n read(existing, { args }) {\n const skip = args.get(skipKey, DEFAULT_SKIP);\n const limit = args.get(limitKey, DEFAULT_LIMIT);\n const data = existing?.data && existing?.data?.slice(skip, skip + limit);\n return {\n ...existing,\n data,\n }\n },\n }\n }\n }, {})\n}\n","export { cachePaginatedQueriesFactory } from './cache-paginated-queries.factory';\n","module.exports = require(\"@cdmbase/graphql-type-uri\");","module.exports = require(\"@common-stack/server-core\");","module.exports = require(\"graphql\");","module.exports = require(\"graphql-iso-date\");","module.exports = require(\"graphql-type-json\");","module.exports = require(\"graphql/language\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { Feature } from '@common-stack/server-core';\nimport { schema, resolvers, resolverFunc } from './api';\n\nexport { resolvers };\nexport { schema as rootSchemaDef };\nexport * from './scalars';\nexport * from './utils';\n\n\nexport default new Feature({\n schema,\n createResolversFunc: resolverFunc,\n})"],"names":[],"sourceRoot":""}
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@common-stack/graphql-api",
3
- "version": "3.0.1-alpha.0",
3
+ "version": "3.0.2-alpha.2",
4
4
  "description": "graphql api for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
7
7
  "main": "lib/index.js",
8
+ "module": "lib/index.js",
8
9
  "typings": "lib/index.d.ts",
9
10
  "scripts": {
10
11
  "build": "yarn build:clean && yarn build:lib",
@@ -32,7 +33,7 @@
32
33
  "publishConfig": {
33
34
  "access": "public"
34
35
  },
35
- "gitHead": "2c5be38e54fcffe218106da86a39bf5c253e504d",
36
+ "gitHead": "c093e43584e807c9dc823e6d78deaaa51b739d9f",
36
37
  "typescript": {
37
38
  "definition": "lib/index.d.ts"
38
39
  }