@common-stack/graphql-api 0.6.1-alpha.0 → 0.6.1-alpha.4

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.
@@ -0,0 +1 @@
1
+ export declare const schema: string[];
@@ -0,0 +1,2 @@
1
+ export * from './graphql';
2
+ export * from './resolvers';
@@ -0,0 +1,22 @@
1
+ export declare const resolvers: {
2
+ AnyObject: import("graphql").GraphQLScalarType;
3
+ Date: any;
4
+ Time: any;
5
+ Timestamp: import("graphql").GraphQLScalarType;
6
+ URI: any;
7
+ URIInput: any;
8
+ DateTime: any;
9
+ JSON: import("graphql").GraphQLScalarType;
10
+ JSONObject: import("graphql").GraphQLScalarType;
11
+ };
12
+ export declare const resolverFunc: (options: any) => {
13
+ AnyObject: import("graphql").GraphQLScalarType;
14
+ Date: any;
15
+ Time: any;
16
+ Timestamp: import("graphql").GraphQLScalarType;
17
+ URI: any;
18
+ URIInput: any;
19
+ DateTime: any;
20
+ JSON: import("graphql").GraphQLScalarType;
21
+ JSONObject: import("graphql").GraphQLScalarType;
22
+ };
package/lib/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
- import rootSchemaDef from './api/root-schema.graphqls';
2
- export * from './api/resolver';
3
- export { rootSchemaDef };
1
+ import { Feature } from '@common-stack/server-core';
2
+ import { schema, resolvers } from './api';
3
+ export { resolvers };
4
+ export { schema as rootSchemaDef };
4
5
  export * from './scalars';
5
6
  export * from './utils';
7
+ declare const _default: Feature<import("@common-stack/server-core").ConfigurationScope>;
8
+ export default _default;
package/lib/index.js CHANGED
@@ -2,43 +2,90 @@
2
2
  /******/ "use strict";
3
3
  /******/ var __webpack_modules__ = ({
4
4
 
5
- /***/ "./src/api/root-schema.graphqls":
6
- /*!**************************************!*\
7
- !*** ./src/api/root-schema.graphqls ***!
8
- \**************************************/
5
+ /***/ "./src/api/graphql/root-schema.graphqls":
6
+ /*!**********************************************!*\
7
+ !*** ./src/api/graphql/root-schema.graphqls ***!
8
+ \**********************************************/
9
9
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10
10
 
11
11
  __webpack_require__.r(__webpack_exports__);
12
12
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13
13
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
14
14
  /* harmony export */ });
15
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("scalar AnyObject\nscalar Date\nscalar Time\nscalar DateTime\nscalar URI\nscalar URIInput\nscalar Observable\n\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 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");
15
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("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");
16
16
 
17
17
  /***/ }),
18
18
 
19
- /***/ "./src/api/resolver.ts":
20
- /*!*****************************!*\
21
- !*** ./src/api/resolver.ts ***!
22
- \*****************************/
19
+ /***/ "./src/api/graphql/index.ts":
20
+ /*!**********************************!*\
21
+ !*** ./src/api/graphql/index.ts ***!
22
+ \**********************************/
23
23
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
24
24
 
25
25
 
26
26
  Object.defineProperty(exports, "__esModule", ({ value: true }));
27
- exports.resolvers = void 0;
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];
30
+
31
+
32
+ /***/ }),
33
+
34
+ /***/ "./src/api/index.ts":
35
+ /*!**************************!*\
36
+ !*** ./src/api/index.ts ***!
37
+ \**************************/
38
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
39
+
40
+
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
+
59
+
60
+ /***/ }),
61
+
62
+ /***/ "./src/api/resolvers.ts":
63
+ /*!******************************!*\
64
+ !*** ./src/api/resolvers.ts ***!
65
+ \******************************/
66
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
67
+
68
+
69
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
70
+ exports.resolverFunc = exports.resolvers = void 0;
28
71
  const graphql_type_json_1 = __webpack_require__(/*! graphql-type-json */ "graphql-type-json");
29
72
  const graphql_iso_date_1 = __webpack_require__(/*! graphql-iso-date */ "graphql-iso-date");
30
73
  const graphql_type_uri_1 = __webpack_require__(/*! @cdmbase/graphql-type-uri */ "@cdmbase/graphql-type-uri");
31
- const anyobject_1 = __webpack_require__(/*! ../scalars/anyobject */ "./src/scalars/anyobject.ts");
74
+ const GraphQLTimestamp_1 = __webpack_require__(/*! ../scalars/GraphQLTimestamp */ "./src/scalars/GraphQLTimestamp.ts");
75
+ const AnyObject_1 = __webpack_require__(/*! ../scalars/AnyObject */ "./src/scalars/AnyObject.ts");
32
76
  exports.resolvers = {
33
- AnyObject: anyobject_1.GraphQLAnyObject,
77
+ AnyObject: AnyObject_1.GraphQLAnyObject,
34
78
  Date: graphql_iso_date_1.GraphQLDate,
35
79
  Time: graphql_iso_date_1.GraphQLTime,
80
+ Timestamp: GraphQLTimestamp_1.default,
36
81
  URI: (0, graphql_type_uri_1.default)('URI'),
37
82
  URIInput: (0, graphql_type_uri_1.default)('URIInput'),
38
83
  DateTime: graphql_iso_date_1.GraphQLDateTime,
39
84
  JSON: graphql_type_json_1.default,
40
85
  JSONObject: graphql_type_json_1.GraphQLJSONObject,
41
86
  };
87
+ const resolverFunc = (options) => exports.resolvers;
88
+ exports.resolverFunc = resolverFunc;
42
89
 
43
90
 
44
91
  /***/ }),
@@ -65,19 +112,24 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
65
112
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
66
113
  };
67
114
  Object.defineProperty(exports, "__esModule", ({ value: true }));
68
- exports.rootSchemaDef = void 0;
69
- const root_schema_graphqls_1 = __webpack_require__(/*! ./api/root-schema.graphqls */ "./src/api/root-schema.graphqls");
70
- exports.rootSchemaDef = root_schema_graphqls_1.default;
71
- __exportStar(__webpack_require__(/*! ./api/resolver */ "./src/api/resolver.ts"), exports);
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; } }));
72
120
  __exportStar(__webpack_require__(/*! ./scalars */ "./src/scalars/index.ts"), exports);
73
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
+ });
74
126
 
75
127
 
76
128
  /***/ }),
77
129
 
78
- /***/ "./src/scalars/anyobject.ts":
130
+ /***/ "./src/scalars/AnyObject.ts":
79
131
  /*!**********************************!*\
80
- !*** ./src/scalars/anyobject.ts ***!
132
+ !*** ./src/scalars/AnyObject.ts ***!
81
133
  \**********************************/
82
134
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
83
135
 
@@ -105,6 +157,63 @@ exports.GraphQLAnyObject = new graphql_1.GraphQLScalarType({
105
157
  });
106
158
 
107
159
 
160
+ /***/ }),
161
+
162
+ /***/ "./src/scalars/GraphQLTimestamp.ts":
163
+ /*!*****************************************!*\
164
+ !*** ./src/scalars/GraphQLTimestamp.ts ***!
165
+ \*****************************************/
166
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
167
+
168
+
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
+ // source from https://gist.github.com/langpavel/b30f3d507a47713b0c6e89016e4e9eb7
173
+ function serializeDate(value) {
174
+ if (value instanceof Date) {
175
+ return value.getTime();
176
+ }
177
+ else if (typeof value === 'number') {
178
+ return Math.trunc(value);
179
+ }
180
+ else if (typeof value === 'string') {
181
+ return Date.parse(value);
182
+ }
183
+ return null;
184
+ }
185
+ function parseDate(value) {
186
+ if (value === null) {
187
+ return null;
188
+ }
189
+ try {
190
+ return new Date(value);
191
+ }
192
+ catch (err) {
193
+ return null;
194
+ }
195
+ }
196
+ function parseDateFromLiteral(ast) {
197
+ if (ast.kind === language_1.Kind.INT) {
198
+ const num = parseInt(ast.value, 10);
199
+ return new Date(num);
200
+ }
201
+ else if (ast.kind === language_1.Kind.STRING) {
202
+ return parseDate(ast.value);
203
+ }
204
+ return null;
205
+ }
206
+ const TimestampType = new graphql_1.GraphQLScalarType({
207
+ name: 'Timestamp',
208
+ description: 'The javascript `Date` as integer. Type represents date and time ' +
209
+ 'as number of milliseconds from start of UNIX epoch.',
210
+ serialize: serializeDate,
211
+ parseValue: parseDate,
212
+ parseLiteral: parseDateFromLiteral,
213
+ });
214
+ exports["default"] = TimestampType;
215
+
216
+
108
217
  /***/ }),
109
218
 
110
219
  /***/ "./src/scalars/index.ts":
@@ -129,7 +238,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
129
238
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
130
239
  };
131
240
  Object.defineProperty(exports, "__esModule", ({ value: true }));
132
- __exportStar(__webpack_require__(/*! ./anyobject */ "./src/scalars/anyobject.ts"), exports);
241
+ __exportStar(__webpack_require__(/*! ./AnyObject */ "./src/scalars/AnyObject.ts"), exports);
133
242
 
134
243
 
135
244
  /***/ }),
@@ -138,12 +247,11 @@ __exportStar(__webpack_require__(/*! ./anyobject */ "./src/scalars/anyobject.ts"
138
247
  /*!******************************************************!*\
139
248
  !*** ./src/utils/cache-paginated-queries.factory.ts ***!
140
249
  \******************************************************/
141
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
250
+ /***/ ((__unused_webpack_module, exports) => {
142
251
 
143
252
 
144
253
  Object.defineProperty(exports, "__esModule", ({ value: true }));
145
254
  exports.cachePaginatedQueriesFactory = exports.DEFAULT_LIMIT = exports.DEFAULT_SKIP = void 0;
146
- const lodash_1 = __webpack_require__(/*! lodash */ "lodash");
147
255
  exports.DEFAULT_SKIP = 0;
148
256
  exports.DEFAULT_LIMIT = 10;
149
257
  const cachePaginatedQueriesFactory = (queries) => {
@@ -155,7 +263,7 @@ const cachePaginatedQueriesFactory = (queries) => {
155
263
  return Object.assign(Object.assign({}, acc), { [queryName]: {
156
264
  keyArgs,
157
265
  merge(existing, incoming, { args }) {
158
- const skip = (0, lodash_1.get)(args, skipKey) || exports.DEFAULT_SKIP;
266
+ const skip = args.get(skipKey, exports.DEFAULT_SKIP);
159
267
  const merged = (existing === null || existing === void 0 ? void 0 : existing.data.length) > 0 ? existing.data.slice(0) : [];
160
268
  incoming === null || incoming === void 0 ? void 0 : incoming.data.forEach((curr, index) => {
161
269
  merged[skip + index] = curr;
@@ -164,8 +272,8 @@ const cachePaginatedQueriesFactory = (queries) => {
164
272
  },
165
273
  read(existing, { args }) {
166
274
  var _a;
167
- const skip = (0, lodash_1.get)(args, skipKey) || exports.DEFAULT_SKIP;
168
- const limit = (0, lodash_1.get)(args, limitKey) || exports.DEFAULT_LIMIT;
275
+ const skip = args.get(skipKey, exports.DEFAULT_SKIP);
276
+ const limit = args.get(limitKey, exports.DEFAULT_LIMIT);
169
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));
170
278
  return Object.assign(Object.assign({}, existing), { data });
171
279
  },
@@ -202,6 +310,16 @@ module.exports = require("@cdmbase/graphql-type-uri");
202
310
 
203
311
  /***/ }),
204
312
 
313
+ /***/ "@common-stack/server-core":
314
+ /*!********************************************!*\
315
+ !*** external "@common-stack/server-core" ***!
316
+ \********************************************/
317
+ /***/ ((module) => {
318
+
319
+ module.exports = require("@common-stack/server-core");
320
+
321
+ /***/ }),
322
+
205
323
  /***/ "graphql":
206
324
  /*!**************************!*\
207
325
  !*** external "graphql" ***!
@@ -232,13 +350,13 @@ module.exports = require("graphql-type-json");
232
350
 
233
351
  /***/ }),
234
352
 
235
- /***/ "lodash":
236
- /*!*************************!*\
237
- !*** external "lodash" ***!
238
- \*************************/
353
+ /***/ "graphql/language":
354
+ /*!***********************************!*\
355
+ !*** external "graphql/language" ***!
356
+ \***********************************/
239
357
  /***/ ((module) => {
240
358
 
241
- module.exports = require("lodash");
359
+ module.exports = require("graphql/language");
242
360
 
243
361
  /***/ })
244
362
 
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;AAAA,iEAAe,mRAAmR,wBAAwB,4DAA4D,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;;;;;;;;;;;;;ACAn5C,8FAAmE;AACnE,2FAA6E;AAC7E,6GAAmD;AACnD,kGAAwD;AAE3C,iBAAS,GAAG;IACrB,SAAS,EAAE,4BAAgB;IAC3B,IAAI,EAAE,8BAAW;IACjB,IAAI,EAAE,8BAAW;IACjB,GAAG,EAAE,8BAAU,EAAC,KAAK,CAAC;IACtB,QAAQ,EAAE,8BAAU,EAAC,UAAU,CAAC;IAChC,QAAQ,EAAE,kCAAe;IACzB,IAAI,EAAE,2BAAW;IACjB,UAAU,EAAE,qCAAiB;CAChC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACdF,uHAAuD;AAG9C,wBAHF,8BAAa,CAGE;AADtB,0FAA+B;AAE/B,sFAA0B;AAC1B,kFAAwB;;;;;;;;;;;;;;ACLxB,uBAAuB;AACvB,gEAAgE;AAEhE,kFAAkF;AACrE,wBAAgB,GAAG,IAAI,2BAAiB,CAAC;IACpD,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,oDAAoD;IACjE,SAAS,EAAE,KAAK,CAAC,EAAE;QACjB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,UAAU,EAAE,KAAK,CAAC,EAAE;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,YAAY,EAAE,GAAG,CAAC,EAAE;QA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A;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/root-schema.graphqls","webpack://@common-stack/graphql-api/./src/api/resolver.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/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 \"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 \"lodash\"","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 URI\\nscalar URIInput\\nscalar Observable\\n\\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 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 GraphQLJSON, { GraphQLJSONObject } from 'graphql-type-json';\nimport { GraphQLDate, GraphQLTime, GraphQLDateTime } from 'graphql-iso-date';\nimport GraphQLURI from '@cdmbase/graphql-type-uri';\nimport { GraphQLAnyObject } from '../scalars/anyobject';\n\nexport const resolvers = {\n AnyObject: GraphQLAnyObject,\n Date: GraphQLDate,\n Time: GraphQLTime,\n URI: GraphQLURI('URI'),\n URIInput: GraphQLURI('URIInput'),\n DateTime: GraphQLDateTime,\n JSON: GraphQLJSON,\n JSONObject: GraphQLJSONObject,\n};\n","import rootSchemaDef from './api/root-schema.graphqls';\n\nexport * from './api/resolver';\nexport { rootSchemaDef };\nexport * from './scalars';\nexport * from './utils';\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","export * from './anyobject';\n","import { get } from 'lodash';\nimport { 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 = get(args, 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 = get(args, skipKey) || DEFAULT_SKIP;\n const limit = get(args, 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(\"graphql\");","module.exports = require(\"graphql-iso-date\");","module.exports = require(\"graphql-type-json\");","module.exports = require(\"lodash\");","// 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;;;;;;;;;;;;;ACAr6C,2HAAgD;AAEnC,cAAM,GAAG,CAAC,8BAAU,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;ACFnC,0FAA0B;AAC1B,wFAA4B;;;;;;;;;;;;;;ACD5B,8FAAmE;AACnE,2FAA6E;AA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,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;wBACnC,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC;oBAChC,CAAC,CAAE;oBACH,uCAAY,QAAQ,KAAE,IAAI,EAAE,MAAM,IAAG;gBACzC,CAAC;gBACD,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE;;oBACnB,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAC;oBAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,qBAAa,CAAC,CAAC;oBAChD,MAAM,IAAI,GAAG,SAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,MAAI,cAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,KAAK,CAAC,EAAC;oBACzE,uCACO,QAAQ,KACX,IAAI,IACP;gBACL,CAAC;aACJ,IACJ;IACL,CAAC,EAAE,EAAE,CAAC;AACV,CAAC;AA9BY,oCAA4B,gCA8BxC;;;;;;;;;;;;;;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":""}
@@ -0,0 +1,3 @@
1
+ import { GraphQLScalarType } from 'graphql';
2
+ declare const TimestampType: GraphQLScalarType;
3
+ export default TimestampType;
@@ -1 +1 @@
1
- export * from './anyobject';
1
+ export * from './AnyObject';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common-stack/graphql-api",
3
- "version": "0.6.1-alpha.0",
3
+ "version": "0.6.1-alpha.4",
4
4
  "description": "graphql api for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -18,25 +18,6 @@
18
18
  "test:watch": "npm test -- --watch",
19
19
  "watch": "yarn build:lib:watch"
20
20
  },
21
- "jest": {
22
- "moduleFileExtensions": [
23
- "ts",
24
- "tsx",
25
- "js",
26
- "json"
27
- ],
28
- "modulePaths": [
29
- "node_modules"
30
- ],
31
- "roots": [
32
- "src"
33
- ],
34
- "testEnvironment": "node",
35
- "testRegex": "/__tests__/.*test*\\.(ts|tsx|js)$",
36
- "transform": {
37
- "\\.(ts|tsx)$": "<rootDir>/../../node_modules/ts-jest/preprocessor.js"
38
- }
39
- },
40
21
  "dependencies": {
41
22
  "@cdmbase/graphql-type-uri": "^2.0.0",
42
23
  "@vscode-alt/monaco-editor": "^0.21.2",
@@ -45,12 +26,13 @@
45
26
  },
46
27
  "peerDependencies": {
47
28
  "@cdm-logger/core": ">=7.0.12",
29
+ "@common-stack/server-core": "*",
48
30
  "lodash": "^4.17.21"
49
31
  },
50
32
  "publishConfig": {
51
33
  "access": "public"
52
34
  },
53
- "gitHead": "32445493b66c73ec547b5fd27acfa84ae4718897",
35
+ "gitHead": "8f1002595ef0da183fc26d37a4a185b9c94cfc76",
54
36
  "typescript": {
55
37
  "definition": "lib/index.d.ts"
56
38
  }
@@ -1,10 +0,0 @@
1
- export declare const resolvers: {
2
- AnyObject: import("graphql").GraphQLScalarType;
3
- Date: any;
4
- Time: any;
5
- URI: any;
6
- URIInput: any;
7
- DateTime: any;
8
- JSON: import("graphql").GraphQLScalarType;
9
- JSONObject: import("graphql").GraphQLScalarType;
10
- };
File without changes