@common-stack/graphql-api 8.0.2-alpha.1 → 8.2.1-alpha.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/LICENSE +34 -21
- package/lib/api/graphql/cache-control.graphql.js +1 -0
- package/lib/api/graphql/cache-control.graphql.js.map +1 -0
- package/lib/api/graphql/common-schema.graphql.js +2 -0
- package/lib/api/graphql/common-schema.graphql.js.map +1 -0
- package/lib/api/graphql/index.js +2 -2
- package/lib/api/graphql/index.js.map +1 -1
- package/lib/api/resolvers.d.ts +12 -0
- package/lib/api/resolvers.js +12 -1
- package/lib/api/resolvers.js.map +1 -1
- package/lib/index.d.ts +0 -3
- package/lib/index.js +1 -4
- package/lib/index.js.map +1 -1
- package/lib/module.d.ts +3 -0
- package/lib/module.js +5 -0
- package/lib/module.js.map +1 -0
- package/lib/scalars/AnyObject.js.map +1 -1
- package/lib/scalars/GraphQLTimestamp.js.map +1 -1
- package/lib/utils/cache-paginated-queries.factory.js.map +1 -1
- package/package.json +3 -3
- package/root-schema.graphqls +137 -0
- package/lib/api/graphql/root-schema.graphqls.js +0 -2
- package/lib/api/graphql/root-schema.graphqls.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2017 CDMBase LLC.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
IMPLIED,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
PROPRIETARY LICENSE
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017-2025 CDMBase LLC. All Rights Reserved.
|
|
4
|
+
|
|
5
|
+
This software and associated documentation files (the "Software") are the
|
|
6
|
+
proprietary and confidential information of CDMBase LLC ("Confidential Information").
|
|
7
|
+
|
|
8
|
+
NOTICE: All information contained herein is, and remains the property of
|
|
9
|
+
CDMBase LLC. The intellectual and technical concepts contained herein are
|
|
10
|
+
proprietary to CDMBase LLC and may be covered by U.S. and Foreign Patents,
|
|
11
|
+
patents in process, and are protected by trade secret or copyright law.
|
|
12
|
+
|
|
13
|
+
Dissemination of this information or reproduction of this material is strictly
|
|
14
|
+
forbidden unless prior written permission is obtained from CDMBase LLC.
|
|
15
|
+
|
|
16
|
+
NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL
|
|
17
|
+
PROPERTY RIGHTS ARE GRANTED BY THIS DOCUMENT.
|
|
18
|
+
|
|
19
|
+
RESTRICTIONS:
|
|
20
|
+
1. You may NOT use, copy, modify, merge, publish, distribute, sublicense,
|
|
21
|
+
and/or sell copies of the Software without explicit written permission
|
|
22
|
+
from CDMBase LLC.
|
|
23
|
+
2. You may NOT reverse engineer, decompile, or disassemble the Software.
|
|
24
|
+
3. You may NOT remove or alter any proprietary notices or labels on the Software.
|
|
25
|
+
4. The Software is licensed, not sold.
|
|
26
|
+
|
|
27
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
30
|
+
CDMBASE LLC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
31
|
+
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
32
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
33
|
+
|
|
34
|
+
For licensing inquiries, please contact: legal@cdmbase.com
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var cacheControleDirective = "directive @invalidateCache(queries:[String!]!) on MUTATION | FIELD_DEFINITION\n\nenum CacheControlScope {\n PUBLIC\n PRIVATE\n}\n\ndirective @cacheControl(\n maxAge: Int\n scope: CacheControlScope\n inheritMaxAge: Boolean\n) on FIELD_DEFINITION | OBJECT | INTERFACE | UNION";export{cacheControleDirective as default};//# sourceMappingURL=cache-control.graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-control.graphql.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var commonSchema = "scalar AnyObject\nscalar Date\nscalar Time\nscalar DateTime\nscalar Timestamp\nscalar URI\nscalar URIInput\nscalar Observable\n\nscalar JSON\nscalar JSONObject\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\ntype Mutation {\n dummy: Int\n}\n\ntype Subscription {\n dummy: Int\n}\n\ntype AdminIdeSettings {\n dummy: Int\n}\n\nenum ContributionSchemaId {\n dummy\n}\n\nenum ContributionExtensionName {\n dummy\n}\n\n\"\"\" All Moleculer Topic names are extended from this.\"\"\"\nenum MoleculerServiceName {\n dummy\n}\n\nenum MailTemplateId {\n dummy\n}\n\nenum MoleculerCronServiceName {\n dummy\n}\n\n\"\"\"\n Used for Settings passed in the ContainerModule\n\"\"\"\ninterface IResourceUtilizationSettings {\n subTopic: String\n adminApiNamespace: String\n}\n\n\"\"\"\nTo calculate geometry over an Eath-like sphere.\nList the `longitude` first and then `latitude`\n - Validate longitude values are between `-180` and `180`\n - Validate latitude values are between `-90` and `90`\n\"\"\"\ntype GeoLocation {\n coordinates: [Float]\n}\n\"\"\"\nInput geometry of the location.\nList the `longitude` first and then `latitude`\n - Validate longitude values are between `-180` and `180`\n - Validate latitude values are between `-90` and `90`\n\"\"\"\ninput GeoLocationInput {\n type: String = \"Point\"\n coordinates: [Float]\n}\n\nschema {\n query: Query\n mutation: Mutation\n subscription: Subscription\n}\n";
|
|
2
|
+
export{commonSchema as default};//# sourceMappingURL=common-schema.graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-schema.graphql.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/lib/api/graphql/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
const schema = [
|
|
1
|
+
import commonSchema from'./common-schema.graphql.js';import cacheControleDirective from'./cache-control.graphql.js';// @ts-ignore
|
|
2
|
+
const schema = [commonSchema, cacheControleDirective];export{schema};//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/api/graphql/index.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/api/graphql/index.ts"],"sourcesContent":["// @ts-ignore\nimport commonSchema from './common-schema.graphql';\n// @ts-ignore\nimport cacheControleDirective from './cache-control.graphql';\n\nexport const schema = [commonSchema, cacheControleDirective];\n"],"names":[],"mappings":"oHAAA;MAKa,MAAM,GAAG,CAAC,YAAY,EAAE,sBAAsB"}
|
package/lib/api/resolvers.d.ts
CHANGED
|
@@ -9,6 +9,12 @@ export declare const resolvers: {
|
|
|
9
9
|
JSON: import("graphql").GraphQLScalarType<unknown, unknown>;
|
|
10
10
|
JSONObject: import("graphql").GraphQLScalarType<unknown, unknown>;
|
|
11
11
|
};
|
|
12
|
+
export declare const directiveResolvers: {
|
|
13
|
+
invalidateCache(next: any, source: any, { queries }: {
|
|
14
|
+
queries: any;
|
|
15
|
+
}, context: any): any;
|
|
16
|
+
cacheControl(next: any, source: any, args: any, context: any): any;
|
|
17
|
+
};
|
|
12
18
|
export declare const resolverFunc: (options: any) => {
|
|
13
19
|
AnyObject: import("graphql").GraphQLScalarType<unknown, unknown>;
|
|
14
20
|
Date: import("graphql").GraphQLScalarType<Date, string>;
|
|
@@ -20,3 +26,9 @@ export declare const resolverFunc: (options: any) => {
|
|
|
20
26
|
JSON: import("graphql").GraphQLScalarType<unknown, unknown>;
|
|
21
27
|
JSONObject: import("graphql").GraphQLScalarType<unknown, unknown>;
|
|
22
28
|
};
|
|
29
|
+
export declare const directiveResolverFunc: (options: any) => {
|
|
30
|
+
invalidateCache(next: any, source: any, { queries }: {
|
|
31
|
+
queries: any;
|
|
32
|
+
}, context: any): any;
|
|
33
|
+
cacheControl(next: any, source: any, args: any, context: any): any;
|
|
34
|
+
};
|
package/lib/api/resolvers.js
CHANGED
|
@@ -9,4 +9,15 @@ import GraphQLJSON,{GraphQLJSONObject}from'graphql-type-json';import {GraphQLDat
|
|
|
9
9
|
JSON: GraphQLJSON,
|
|
10
10
|
JSONObject: GraphQLJSONObject,
|
|
11
11
|
};
|
|
12
|
-
const
|
|
12
|
+
const directiveResolvers = {
|
|
13
|
+
invalidateCache(next, source, { queries }, context) {
|
|
14
|
+
context.queriesToInvalidate = queries;
|
|
15
|
+
return next();
|
|
16
|
+
},
|
|
17
|
+
cacheControl(next, source, args, context) {
|
|
18
|
+
context.overallCachePolicy = args;
|
|
19
|
+
return next();
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
const resolverFunc = (options) => resolvers;
|
|
23
|
+
const directiveResolverFunc = (options) => directiveResolvers;export{directiveResolverFunc,directiveResolvers,resolverFunc,resolvers};//# sourceMappingURL=resolvers.js.map
|
package/lib/api/resolvers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers.js","sources":["../../src/api/resolvers.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"resolvers.js","sources":["../../src/api/resolvers.ts"],"sourcesContent":["import GraphQLJSON, { GraphQLJSONObject } from 'graphql-type-json';\nimport { GraphQLDate, GraphQLTime, GraphQLDateTime } from 'graphql-scalars';\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 directiveResolvers = {\n invalidateCache(next, source, { queries }, context) {\n context.queriesToInvalidate = queries;\n return next();\n },\n cacheControl(next, source, args, context) {\n context.overallCachePolicy = args;\n return next();\n },\n};\n\nexport const resolverFunc = (options) => resolvers;\n\nexport const directiveResolverFunc = (options) => directiveResolvers;\n"],"names":["GraphqlTimestamp"],"mappings":"uSAMa,MAAA,SAAS,GAAG;AACrB,IAAA,SAAS,EAAE,gBAAgB;AAC3B,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,SAAS,EAAEA,aAAgB;AAC3B,IAAA,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC;AACtB,IAAA,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC;AAChC,IAAA,QAAQ,EAAE,eAAe;AACzB,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,UAAU,EAAE,iBAAiB;EAC/B;AAEW,MAAA,kBAAkB,GAAG;IAC9B,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,EAAA;AAC9C,QAAA,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC;QACtC,OAAO,IAAI,EAAE,CAAC;KACjB;AACD,IAAA,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAA;AACpC,QAAA,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAClC,OAAO,IAAI,EAAE,CAAC;KACjB;EACH;AAEW,MAAA,YAAY,GAAG,CAAC,OAAO,KAAK,UAAU;AAEtC,MAAA,qBAAqB,GAAG,CAAC,OAAO,KAAK"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { Feature } from '@common-stack/server-core';
|
|
2
1
|
import { schema, resolvers } from './api';
|
|
3
2
|
export { resolvers };
|
|
4
3
|
export { schema as rootSchemaDef };
|
|
5
4
|
export * from './scalars';
|
|
6
5
|
export * from './utils';
|
|
7
|
-
declare const _default: Feature<import("@common-stack/server-core").ConfigurationScope, any>;
|
|
8
|
-
export default _default;
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
|
|
2
|
-
schema,
|
|
3
|
-
createResolversFunc: resolverFunc,
|
|
4
|
-
});export{index as default,schema as rootSchemaDef};//# sourceMappingURL=index.js.map
|
|
1
|
+
export{schema as rootSchemaDef}from'./api/graphql/index.js';export{resolvers}from'./api/resolvers.js';export{GraphQLAnyObject}from'./scalars/AnyObject.js';export{cachePaginatedQueriesFactory}from'./utils/cache-paginated-queries.factory.js';//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/lib/module.d.ts
ADDED
package/lib/module.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import {Feature}from'@common-stack/server-core';import {schema}from'./api/graphql/index.js';import {resolverFunc,directiveResolverFunc}from'./api/resolvers.js';var module = new Feature({
|
|
2
|
+
schema,
|
|
3
|
+
createResolversFunc: resolverFunc,
|
|
4
|
+
createDirectivesFunc: directiveResolverFunc,
|
|
5
|
+
});export{module as default};//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../src/module.ts"],"sourcesContent":["import { Feature } from '@common-stack/server-core';\nimport { schema, resolverFunc, directiveResolverFunc } from './api';\n\nexport default new Feature({\n schema,\n createResolversFunc: resolverFunc,\n createDirectivesFunc: directiveResolverFunc,\n});\n"],"names":[],"mappings":"gKAGA,aAAe,IAAI,OAAO,CAAC;IACvB,MAAM;AACN,IAAA,mBAAmB,EAAE,YAAY;AACjC,IAAA,oBAAoB,EAAE,qBAAqB;AAC9C,CAAA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnyObject.js","sources":["../../src/scalars/AnyObject.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"AnyObject.js","sources":["../../src/scalars/AnyObject.ts"],"sourcesContent":["// 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) => value,\n parseValue: (value) => value,\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"],"names":[],"mappings":"0DAAA;AAGA;AACa,MAAA,gBAAgB,GAAG,IAAI,iBAAiB,CAAC;AAClD,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,WAAW,EAAE,oDAAoD;AACjE,IAAA,SAAS,EAAE,CAAC,KAAK,KAAK,KAAK;AAC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MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACpC,QAAA,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;KACxB;IACD,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,EAAE;AAC1B,QAAA,OAAO,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KAC/B;AACD,IAAA,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,MAAM,aAAa,GAAG,IAAI,iBAAiB,CAAC;AACxC,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,WAAW,EACP,kEAAkE;QAClE,qDAAqD;AACzD,IAAA,SAAS,EAAE,aAAa;AACxB,IAAA,UAAU,EAAE,SAAS;AACrB,IAAA,YAAY,EAAE,oBAAoB;AACrC,CAAA"}
|
|
1
|
+
{"version":3,"file":"GraphQLTimestamp.js","sources":["../../src/scalars/GraphQLTimestamp.ts"],"sourcesContent":["import { Kind } from 'graphql/language/index.js';\nimport { GraphQLScalarType } from 'graphql';\n\n// source from https://gist.github.com/langpavel/b30f3d507a47713b0c6e89016e4e9eb7\nfunction serializeDate(value) {\n if (value instanceof Date) {\n return value.getTime();\n }\n if (typeof value === 'number') {\n return Math.trunc(value);\n }\n 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 }\n 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 Timestamp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AS,EAAE,aAAa;AACxB,IAAA,UAAU,EAAE,SAAS;AACrB,IAAA,YAAY,EAAE,oBAAoB;AACrC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-paginated-queries.factory.js","sources":["../../src/utils/cache-paginated-queries.factory.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"cache-paginated-queries.factory.js","sources":["../../src/utils/cache-paginated-queries.factory.ts"],"sourcesContent":["import { TypePolicies } from '@apollo/client';\n\ninterface QueryOptionsInterface {\n name: string;\n keyArgs?: (string[] | string)[];\n skipKey?: string;\n limitKey?: string;\n}\n\nexport const DEFAULT_SKIP = 0;\nexport const DEFAULT_LIMIT = 10;\n\nexport const cachePaginatedQueriesFactory = (queries: (string | QueryOptionsInterface)[]): TypePolicies =>\n 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"],"names":[],"mappings":"AASO,MAAM,YAAY,GAAG,EAAE;AACvB,MAAM,aAAa,GAAG,GAAG;AAEnB,MAAA,4BAA4B,GAAG,CAAC,OAA2C,KACpF,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,KAAI;AAC1B,IAAA,MAAM,SAAS,GAAG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I,GAAG,QAAQ,EAAE,IAAI,IAAI,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,KAAK,CAAC,CAAC;gBACzE,OAAO;AACH,oBAAA,GAAG,QAAQ;oBACX,IAAI;iBACP,CAAC;aACL;AACJ,SAAA;KACJ,CAAC;AACN,CAAC,EAAE,EAAE"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common-stack/graphql-api",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.1-alpha.0",
|
|
4
4
|
"description": "graphql api for higher packages to depend on",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "lib/index.js",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"typescript": {
|
|
38
38
|
"definition": "lib/index.d.ts"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "b46db06f987271c3a2e050f081e266d3a01b285b"
|
|
41
41
|
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
scalar AnyObject
|
|
2
|
+
scalar Date
|
|
3
|
+
scalar Time
|
|
4
|
+
scalar DateTime
|
|
5
|
+
scalar Timestamp
|
|
6
|
+
scalar URI
|
|
7
|
+
scalar URIInput
|
|
8
|
+
scalar Observable
|
|
9
|
+
|
|
10
|
+
scalar JSON
|
|
11
|
+
scalar JSONObject
|
|
12
|
+
|
|
13
|
+
"""
|
|
14
|
+
An object with an ID.
|
|
15
|
+
"""
|
|
16
|
+
interface Node {
|
|
17
|
+
"""
|
|
18
|
+
The ID of the node.
|
|
19
|
+
"""
|
|
20
|
+
id: ID!
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# Pagination information. See https://facebook.github.io/relay/graphql/connections.htm#sec-undefined.PageInfo.
|
|
24
|
+
type PageInfo {
|
|
25
|
+
# Whether there is a next page of nodes in the connection.
|
|
26
|
+
hasNextPage: Boolean!
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
"""
|
|
30
|
+
Represents a null return value.
|
|
31
|
+
"""
|
|
32
|
+
type EmptyResponse {
|
|
33
|
+
# A dummy null value.
|
|
34
|
+
alwaysNil: String
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
type FieldError {
|
|
38
|
+
field: String!
|
|
39
|
+
message: String!
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
input Sort {
|
|
43
|
+
key: String!
|
|
44
|
+
value: SortEnum!
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
enum SortEnum {
|
|
48
|
+
ASC
|
|
49
|
+
DESC
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
type Query {
|
|
53
|
+
"""
|
|
54
|
+
Looks up a node by ID.
|
|
55
|
+
"""
|
|
56
|
+
node(id: ID!): Node
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
type Mutation {
|
|
60
|
+
dummy: Int
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
type Subscription {
|
|
64
|
+
dummy: Int
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
type AdminIdeSettings {
|
|
68
|
+
dummy: Int
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
enum ContributionSchemaId {
|
|
72
|
+
dummy
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
enum ContributionExtensionName {
|
|
76
|
+
dummy
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
""" All Moleculer Topic names are extended from this."""
|
|
80
|
+
enum MoleculerServiceName {
|
|
81
|
+
dummy
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
enum MailTemplateId {
|
|
85
|
+
dummy
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
enum MoleculerCronServiceName {
|
|
89
|
+
dummy
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
"""
|
|
93
|
+
Used for Settings passed in the ContainerModule
|
|
94
|
+
"""
|
|
95
|
+
interface IResourceUtilizationSettings {
|
|
96
|
+
subTopic: String
|
|
97
|
+
adminApiNamespace: String
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
"""
|
|
101
|
+
To calculate geometry over an Eath-like sphere.
|
|
102
|
+
List the `longitude` first and then `latitude`
|
|
103
|
+
- Validate longitude values are between `-180` and `180`
|
|
104
|
+
- Validate latitude values are between `-90` and `90`
|
|
105
|
+
"""
|
|
106
|
+
type GeoLocation {
|
|
107
|
+
coordinates: [Float]
|
|
108
|
+
}
|
|
109
|
+
"""
|
|
110
|
+
Input geometry of the location.
|
|
111
|
+
List the `longitude` first and then `latitude`
|
|
112
|
+
- Validate longitude values are between `-180` and `180`
|
|
113
|
+
- Validate latitude values are between `-90` and `90`
|
|
114
|
+
"""
|
|
115
|
+
input GeoLocationInput {
|
|
116
|
+
type: String = "Point"
|
|
117
|
+
coordinates: [Float]
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
schema {
|
|
121
|
+
query: Query
|
|
122
|
+
mutation: Mutation
|
|
123
|
+
subscription: Subscription
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
directive @invalidateCache(queries:[String!]!) on MUTATION | FIELD_DEFINITION
|
|
127
|
+
|
|
128
|
+
enum CacheControlScope {
|
|
129
|
+
PUBLIC
|
|
130
|
+
PRIVATE
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
directive @cacheControl(
|
|
134
|
+
maxAge: Int
|
|
135
|
+
scope: CacheControlScope
|
|
136
|
+
inheritMaxAge: Boolean
|
|
137
|
+
) on FIELD_DEFINITION | OBJECT | INTERFACE | UNION
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var rootSchema = "scalar AnyObject\nscalar Date\nscalar Time\nscalar DateTime\nscalar Timestamp\nscalar URI\nscalar URIInput\nscalar Observable\nscalar JSON\nscalar JSONObject\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";
|
|
2
|
-
export{rootSchema as default};//# sourceMappingURL=root-schema.graphqls.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"root-schema.graphqls.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|