@gqlbase/plugins 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.d.ts +31 -0
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.d.ts.map +1 -0
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.js +139 -0
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.js.map +1 -0
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.utils.d.ts +18 -0
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.utils.d.ts.map +1 -0
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.utils.js +8 -0
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.utils.js.map +1 -0
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/index.d.ts +3 -0
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/index.d.ts.map +1 -0
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/index.js +2 -0
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/index.js.map +1 -0
- package/dist/appsync/AppSyncUtilsPlugin/AppSyncUtilsPlugin.d.ts +33 -0
- package/dist/appsync/AppSyncUtilsPlugin/AppSyncUtilsPlugin.d.ts.map +1 -0
- package/dist/appsync/AppSyncUtilsPlugin/AppSyncUtilsPlugin.js +91 -0
- package/dist/appsync/AppSyncUtilsPlugin/AppSyncUtilsPlugin.js.map +1 -0
- package/dist/appsync/AppSyncUtilsPlugin/AppSyncUtilsPlugin.utils.d.ts +29 -0
- package/dist/appsync/AppSyncUtilsPlugin/AppSyncUtilsPlugin.utils.d.ts.map +1 -0
- package/dist/appsync/AppSyncUtilsPlugin/AppSyncUtilsPlugin.utils.js +53 -0
- package/dist/appsync/AppSyncUtilsPlugin/AppSyncUtilsPlugin.utils.js.map +1 -0
- package/dist/appsync/AppSyncUtilsPlugin/index.d.ts +3 -0
- package/dist/appsync/AppSyncUtilsPlugin/index.d.ts.map +1 -0
- package/dist/appsync/AppSyncUtilsPlugin/index.js +3 -0
- package/dist/appsync/AppSyncUtilsPlugin/index.js.map +1 -0
- package/dist/appsync/appSyncPreset.d.ts +17 -0
- package/dist/appsync/appSyncPreset.d.ts.map +1 -0
- package/dist/appsync/appSyncPreset.js +21 -0
- package/dist/appsync/appSyncPreset.js.map +1 -0
- package/dist/appsync/index.d.ts +2 -0
- package/dist/appsync/index.d.ts.map +1 -0
- package/dist/appsync/index.js +2 -0
- package/dist/appsync/index.js.map +1 -0
- package/dist/base/InterfaceUtilsPlugin/InterfaceUtilsPlugin.d.ts +55 -0
- package/dist/base/InterfaceUtilsPlugin/InterfaceUtilsPlugin.d.ts.map +1 -0
- package/dist/base/InterfaceUtilsPlugin/InterfaceUtilsPlugin.js +100 -0
- package/dist/base/InterfaceUtilsPlugin/InterfaceUtilsPlugin.js.map +1 -0
- package/dist/base/InterfaceUtilsPlugin/InterfaceUtilsPlugin.utils.d.ts +3 -0
- package/dist/base/InterfaceUtilsPlugin/InterfaceUtilsPlugin.utils.d.ts.map +1 -0
- package/dist/base/InterfaceUtilsPlugin/InterfaceUtilsPlugin.utils.js +4 -0
- package/dist/base/InterfaceUtilsPlugin/InterfaceUtilsPlugin.utils.js.map +1 -0
- package/dist/base/InterfaceUtilsPlugin/index.d.ts +3 -0
- package/dist/base/InterfaceUtilsPlugin/index.d.ts.map +1 -0
- package/dist/base/InterfaceUtilsPlugin/index.js +3 -0
- package/dist/base/InterfaceUtilsPlugin/index.js.map +1 -0
- package/dist/base/ModelTypesGeneratorPlugin/ModelTypesGeneratorPlugin.d.ts +9 -3
- package/dist/base/ModelTypesGeneratorPlugin/ModelTypesGeneratorPlugin.d.ts.map +1 -1
- package/dist/base/ModelTypesGeneratorPlugin/ModelTypesGeneratorPlugin.js +26 -16
- package/dist/base/ModelTypesGeneratorPlugin/ModelTypesGeneratorPlugin.js.map +1 -1
- package/dist/base/ModelTypesGeneratorPlugin/ModelTypesGeneratorPlugin.utils.d.ts +19 -9
- package/dist/base/ModelTypesGeneratorPlugin/ModelTypesGeneratorPlugin.utils.d.ts.map +1 -1
- package/dist/base/ModelTypesGeneratorPlugin/ModelTypesGeneratorPlugin.utils.js +11 -11
- package/dist/base/ModelTypesGeneratorPlugin/ModelTypesGeneratorPlugin.utils.js.map +1 -1
- package/dist/base/RelationsPlugin/RelationsPlugin.d.ts +13 -8
- package/dist/base/RelationsPlugin/RelationsPlugin.d.ts.map +1 -1
- package/dist/base/RelationsPlugin/RelationsPlugin.js +30 -46
- package/dist/base/RelationsPlugin/RelationsPlugin.js.map +1 -1
- package/dist/base/RelationsPlugin/RelationsPlugin.utils.d.ts +5 -3
- package/dist/base/RelationsPlugin/RelationsPlugin.utils.d.ts.map +1 -1
- package/dist/base/RelationsPlugin/RelationsPlugin.utils.js +26 -1
- package/dist/base/RelationsPlugin/RelationsPlugin.utils.js.map +1 -1
- package/dist/base/RelationsPlugin/index.d.ts +1 -1
- package/dist/base/RelationsPlugin/index.d.ts.map +1 -1
- package/dist/base/RelationsPlugin/index.js +1 -1
- package/dist/base/RelationsPlugin/index.js.map +1 -1
- package/dist/base/RfcFeaturesPlugin/RfcFeaturesPlugin.d.ts +28 -0
- package/dist/base/RfcFeaturesPlugin/RfcFeaturesPlugin.d.ts.map +1 -0
- package/dist/base/RfcFeaturesPlugin/RfcFeaturesPlugin.js +33 -0
- package/dist/base/RfcFeaturesPlugin/RfcFeaturesPlugin.js.map +1 -0
- package/dist/base/RfcFeaturesPlugin/RfcFeaturesPlugin.utils.d.ts +14 -0
- package/dist/base/RfcFeaturesPlugin/RfcFeaturesPlugin.utils.d.ts.map +1 -0
- package/dist/base/RfcFeaturesPlugin/RfcFeaturesPlugin.utils.js +39 -0
- package/dist/base/RfcFeaturesPlugin/RfcFeaturesPlugin.utils.js.map +1 -0
- package/dist/base/RfcFeaturesPlugin/index.d.ts +3 -0
- package/dist/base/RfcFeaturesPlugin/index.d.ts.map +1 -0
- package/dist/base/RfcFeaturesPlugin/index.js +3 -0
- package/dist/base/RfcFeaturesPlugin/index.js.map +1 -0
- package/dist/base/ScalarsPlugin/ScalarsPlugin.utils.d.ts +15 -0
- package/dist/base/ScalarsPlugin/ScalarsPlugin.utils.d.ts.map +1 -0
- package/dist/base/ScalarsPlugin/ScalarsPlugin.utils.js +16 -0
- package/dist/base/ScalarsPlugin/ScalarsPlugin.utils.js.map +1 -0
- package/dist/base/ScalarsPlugin/index.d.ts +1 -0
- package/dist/base/ScalarsPlugin/index.d.ts.map +1 -1
- package/dist/base/ScalarsPlugin/index.js +1 -0
- package/dist/base/ScalarsPlugin/index.js.map +1 -1
- package/dist/base/basePreset.d.ts +2 -0
- package/dist/base/basePreset.d.ts.map +1 -1
- package/dist/base/basePreset.js +6 -0
- package/dist/base/basePreset.js.map +1 -1
- package/dist/base/index.d.ts +2 -0
- package/dist/base/index.d.ts.map +1 -1
- package/dist/base/index.js +2 -0
- package/dist/base/index.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/relay/ConnectionPlugin/ConnectionPlugin.d.ts +63 -0
- package/dist/relay/ConnectionPlugin/ConnectionPlugin.d.ts.map +1 -0
- package/dist/relay/ConnectionPlugin/ConnectionPlugin.js +156 -0
- package/dist/relay/ConnectionPlugin/ConnectionPlugin.js.map +1 -0
- package/dist/relay/ConnectionPlugin/ConnectionPlugin.utils.d.ts +4 -0
- package/dist/relay/ConnectionPlugin/ConnectionPlugin.utils.d.ts.map +1 -0
- package/dist/relay/ConnectionPlugin/ConnectionPlugin.utils.js +26 -0
- package/dist/relay/ConnectionPlugin/ConnectionPlugin.utils.js.map +1 -0
- package/dist/relay/ConnectionPlugin/index.d.ts +3 -0
- package/dist/relay/ConnectionPlugin/index.d.ts.map +1 -0
- package/dist/relay/ConnectionPlugin/index.js +3 -0
- package/dist/relay/ConnectionPlugin/index.js.map +1 -0
- package/dist/relay/{NodeInterfacePlugin.d.ts → NodeInterfacePlugin/NodeInterfacePlugin.d.ts} +30 -6
- package/dist/relay/NodeInterfacePlugin/NodeInterfacePlugin.d.ts.map +1 -0
- package/dist/relay/{NodeInterfacePlugin.js → NodeInterfacePlugin/NodeInterfacePlugin.js} +37 -27
- package/dist/relay/NodeInterfacePlugin/NodeInterfacePlugin.js.map +1 -0
- package/dist/relay/NodeInterfacePlugin/index.d.ts +2 -0
- package/dist/relay/NodeInterfacePlugin/index.d.ts.map +1 -0
- package/dist/relay/NodeInterfacePlugin/index.js +2 -0
- package/dist/relay/NodeInterfacePlugin/index.js.map +1 -0
- package/dist/relay/index.d.ts +3 -2
- package/dist/relay/index.d.ts.map +1 -1
- package/dist/relay/index.js +3 -2
- package/dist/relay/index.js.map +1 -1
- package/dist/relay/relayPreset.js +2 -2
- package/dist/relay/relayPreset.js.map +1 -1
- package/package.json +7 -3
- package/dist/relay/ConnectionPlugin.d.ts +0 -46
- package/dist/relay/ConnectionPlugin.d.ts.map +0 -1
- package/dist/relay/ConnectionPlugin.js +0 -200
- package/dist/relay/ConnectionPlugin.js.map +0 -1
- package/dist/relay/NodeInterfacePlugin.d.ts.map +0 -1
- package/dist/relay/NodeInterfacePlugin.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DefinitionNode, FieldNode, InterfaceNode, ObjectNode, UnionNode } from "@gqlbase/core/definition";
|
|
2
2
|
export interface RelationPluginOptions {
|
|
3
|
-
|
|
3
|
+
usePaginationTypes?: boolean;
|
|
4
4
|
}
|
|
5
5
|
export declare const RelationDirective: {
|
|
6
6
|
readonly HAS_ONE: "hasOne";
|
|
@@ -11,9 +11,11 @@ export interface FieldRelationship {
|
|
|
11
11
|
target: ObjectNode | InterfaceNode | UnionNode;
|
|
12
12
|
key?: string;
|
|
13
13
|
}
|
|
14
|
+
export type RelationTarget = ObjectNode | InterfaceNode | UnionNode;
|
|
14
15
|
export declare const isOneRelationship: (field: FieldNode) => boolean;
|
|
15
16
|
export declare const isManyRelationship: (field: FieldNode) => boolean;
|
|
16
17
|
export declare const isRelationField: (field: FieldNode) => boolean;
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const isValidRelationTarget: (node: DefinitionNode) => node is
|
|
18
|
+
export declare const isPaginationConnection: (node: DefinitionNode) => boolean;
|
|
19
|
+
export declare const isValidRelationTarget: (node: DefinitionNode) => node is RelationTarget;
|
|
20
|
+
export declare const parseFieldRelation: (object: ObjectNode | InterfaceNode, field: FieldNode, target: RelationTarget) => Required<FieldRelationship> | null;
|
|
19
21
|
//# sourceMappingURL=RelationsPlugin.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationsPlugin.utils.d.ts","sourceRoot":"","sources":["../../../src/base/RelationsPlugin/RelationsPlugin.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,SAAS,EACT,aAAa,EACb,UAAU,EACV,SAAS,EACV,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"RelationsPlugin.utils.d.ts","sourceRoot":"","sources":["../../../src/base/RelationsPlugin/RelationsPlugin.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,SAAS,EACT,aAAa,EACb,UAAU,EACV,SAAS,EACV,MAAM,0BAA0B,CAAC;AAGlC,MAAM,WAAW,qBAAqB;IACpC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,UAAU,GAAG,WAAW,CAAC;IAC/B,MAAM,EAAE,UAAU,GAAG,aAAa,GAAG,SAAS,CAAC;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,CAAC;AAEpE,eAAO,MAAM,iBAAiB,GAAI,OAAO,SAAS,KAAG,OAEpD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,OAAO,SAAS,KAAG,OAErD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,OAAO,SAAS,KAAG,OAElD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,MAAM,cAAc,KAAG,OAS7D,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,MAAM,cAAc,KAAG,IAAI,IAAI,cAEpE,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,UAAU,GAAG,aAAa,EAClC,OAAO,SAAS,EAChB,QAAQ,cAAc,KACrB,QAAQ,CAAC,iBAAiB,CAAC,GAAG,IA4BhC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InterfaceNode, ObjectNode, UnionNode, } from "@gqlbase/core/definition";
|
|
2
|
+
import { camelCase } from "@gqlbase/shared/format";
|
|
2
3
|
export const RelationDirective = {
|
|
3
4
|
HAS_ONE: "hasOne",
|
|
4
5
|
HAS_MANY: "hasMany",
|
|
@@ -12,7 +13,7 @@ export const isManyRelationship = (field) => {
|
|
|
12
13
|
export const isRelationField = (field) => {
|
|
13
14
|
return isOneRelationship(field) || isManyRelationship(field);
|
|
14
15
|
};
|
|
15
|
-
export const
|
|
16
|
+
export const isPaginationConnection = (node) => {
|
|
16
17
|
if (node instanceof ObjectNode) {
|
|
17
18
|
if (!node.name.endsWith("Connection"))
|
|
18
19
|
return false;
|
|
@@ -27,4 +28,28 @@ export const isConnectionNode = (node) => {
|
|
|
27
28
|
export const isValidRelationTarget = (node) => {
|
|
28
29
|
return node instanceof ObjectNode || node instanceof InterfaceNode || node instanceof UnionNode;
|
|
29
30
|
};
|
|
31
|
+
export const parseFieldRelation = (object, field, target) => {
|
|
32
|
+
if (isOneRelationship(field) && isManyRelationship(field)) {
|
|
33
|
+
throw new Error(`Multiple relationship directives detected for field: ${field.name}`);
|
|
34
|
+
}
|
|
35
|
+
if (isOneRelationship(field)) {
|
|
36
|
+
const directive = field.getDirective(RelationDirective.HAS_ONE);
|
|
37
|
+
const args = directive?.getArgumentsJSON();
|
|
38
|
+
return {
|
|
39
|
+
type: "oneToOne",
|
|
40
|
+
target: target,
|
|
41
|
+
key: args?.key ?? camelCase(field.name, "id"),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (isManyRelationship(field)) {
|
|
45
|
+
const directive = field.getDirective(RelationDirective.HAS_MANY);
|
|
46
|
+
const args = directive?.getArgumentsJSON();
|
|
47
|
+
return {
|
|
48
|
+
type: "oneToMany",
|
|
49
|
+
target: target,
|
|
50
|
+
key: args?.key ?? camelCase(object.name, "id"),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
};
|
|
30
55
|
//# sourceMappingURL=RelationsPlugin.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationsPlugin.utils.js","sourceRoot":"","sources":["../../../src/base/RelationsPlugin/RelationsPlugin.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EACb,UAAU,EACV,SAAS,GACV,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"RelationsPlugin.utils.js","sourceRoot":"","sources":["../../../src/base/RelationsPlugin/RelationsPlugin.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EACb,UAAU,EACV,SAAS,GACV,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAMnD,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,OAAO,EAAE,QAAQ;IACjB,QAAQ,EAAE,SAAS;CACX,CAAC;AAUX,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAgB,EAAW,EAAE;IAC7D,OAAO,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACvD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAgB,EAAW,EAAE;IAC9D,OAAO,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAgB,EAAW,EAAE;IAC3D,OAAO,iBAAiB,CAAC,KAAK,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,IAAoB,EAAW,EAAE;IACtE,IAAI,IAAI,YAAY,UAAU,EAAE,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;YAAE,OAAO,KAAK,CAAC;QACpD,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;QACzD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;YAAE,OAAO,KAAK,CAAC;QACzE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAoB,EAA0B,EAAE;IACpF,OAAO,IAAI,YAAY,UAAU,IAAI,IAAI,YAAY,aAAa,IAAI,IAAI,YAAY,SAAS,CAAC;AAClG,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,MAAkC,EAClC,KAAgB,EAChB,MAAsB,EACc,EAAE;IACtC,IAAI,iBAAiB,CAAC,KAAK,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,wDAAwD,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IACxF,CAAC;IAED,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,SAAS,GAAG,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAChE,MAAM,IAAI,GAAG,SAAS,EAAE,gBAAgB,EAAmB,CAAC;QAE5D,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;SAC9C,CAAC;IACJ,CAAC;IAED,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,SAAS,GAAG,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACjE,MAAM,IAAI,GAAG,SAAS,EAAE,gBAAgB,EAAmB,CAAC;QAE5D,OAAO;YACL,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC;SAC/C,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { RelationsPlugin, relationPlugin } from "./RelationsPlugin.js";
|
|
2
|
-
export {
|
|
2
|
+
export { RelationDirective, isPaginationConnection, isManyRelationship, isOneRelationship, isRelationField, isValidRelationTarget, parseFieldRelation, type RelationPluginOptions, type FieldRelationship, type RelationTarget, } from "./RelationsPlugin.utils.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/RelationsPlugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/RelationsPlugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB,MAAM,4BAA4B,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { RelationsPlugin, relationPlugin } from "./RelationsPlugin.js";
|
|
2
|
-
export { RelationDirective,
|
|
2
|
+
export { RelationDirective, isPaginationConnection, isManyRelationship, isOneRelationship, isRelationField, isValidRelationTarget, parseFieldRelation, } from "./RelationsPlugin.utils.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/base/RelationsPlugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/base/RelationsPlugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,GAInB,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ITransformerContext, TransformerPluginBase } from "@gqlbase/core";
|
|
2
|
+
/**
|
|
3
|
+
* Adds support for features that are in RFC status or draft mode.
|
|
4
|
+
*
|
|
5
|
+
* @see https://github.com/graphql/graphql-wg
|
|
6
|
+
*
|
|
7
|
+
* @definition
|
|
8
|
+
* ```graphql
|
|
9
|
+
* directive `@semanticNonNull(levels: [Int!]! = [0])` on FIELD_DEFINITION
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```graphql
|
|
14
|
+
* type User {
|
|
15
|
+
* id: ID!
|
|
16
|
+
* name: String `@semanticNonNull`
|
|
17
|
+
* tags: [String] `@semanticNonNull(levels: [0, 1])`
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* In the above example, the `name` field is decorated with the `@semanticNonNull` directive, indicating that it is semantically non-nullable. The plugin will use this information to enforce non-nullability at runtime, even if the field is not marked as non-nullable in the schema.
|
|
22
|
+
*/
|
|
23
|
+
export declare class RfcFeaturesPlugin extends TransformerPluginBase {
|
|
24
|
+
constructor(context: ITransformerContext);
|
|
25
|
+
init(): void;
|
|
26
|
+
}
|
|
27
|
+
export declare const rfcFeaturesPlugin: (options?: unknown) => import("@gqlbase/core").IPluginFactory;
|
|
28
|
+
//# sourceMappingURL=RfcFeaturesPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RfcFeaturesPlugin.d.ts","sourceRoot":"","sources":["../../../src/base/RfcFeaturesPlugin/RfcFeaturesPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAUhG;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,qBAAa,iBAAkB,SAAQ,qBAAqB;gBAC9C,OAAO,EAAE,mBAAmB;IAIjC,IAAI;CAeZ;AAED,eAAO,MAAM,iBAAiB,+DAAyC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createPluginFactory, TransformerPluginBase } from "@gqlbase/core";
|
|
2
|
+
import { DirectiveDefinitionNode, InputValueNode, ListTypeNode, NamedTypeNode, NonNullTypeNode, ValueNode, } from "@gqlbase/core/definition";
|
|
3
|
+
/**
|
|
4
|
+
* Adds support for features that are in RFC status or draft mode.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/graphql/graphql-wg
|
|
7
|
+
*
|
|
8
|
+
* @definition
|
|
9
|
+
* ```graphql
|
|
10
|
+
* directive `@semanticNonNull(levels: [Int!]! = [0])` on FIELD_DEFINITION
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```graphql
|
|
15
|
+
* type User {
|
|
16
|
+
* id: ID!
|
|
17
|
+
* name: String `@semanticNonNull`
|
|
18
|
+
* tags: [String] `@semanticNonNull(levels: [0, 1])`
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* In the above example, the `name` field is decorated with the `@semanticNonNull` directive, indicating that it is semantically non-nullable. The plugin will use this information to enforce non-nullability at runtime, even if the field is not marked as non-nullable in the schema.
|
|
23
|
+
*/
|
|
24
|
+
export class RfcFeaturesPlugin extends TransformerPluginBase {
|
|
25
|
+
constructor(context) {
|
|
26
|
+
super("RfcFeaturesPlugin", context);
|
|
27
|
+
}
|
|
28
|
+
init() {
|
|
29
|
+
this.context.base.addNode(DirectiveDefinitionNode.create("semanticNonNull", ["FIELD_DEFINITION"], InputValueNode.create("levels", NonNullTypeNode.create(ListTypeNode.create(NonNullTypeNode.create(NamedTypeNode.create("Int")))), ValueNode.list([ValueNode.int(0)]))));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export const rfcFeaturesPlugin = createPluginFactory(RfcFeaturesPlugin);
|
|
33
|
+
//# sourceMappingURL=RfcFeaturesPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RfcFeaturesPlugin.js","sourceRoot":"","sources":["../../../src/base/RfcFeaturesPlugin/RfcFeaturesPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAuB,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAChG,OAAO,EACL,uBAAuB,EACvB,cAAc,EACd,YAAY,EACZ,aAAa,EACb,eAAe,EACf,SAAS,GACV,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,OAAO,iBAAkB,SAAQ,qBAAqB;IAC1D,YAAY,OAA4B;QACtC,KAAK,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAEM,IAAI;QACT,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CACvB,uBAAuB,CAAC,MAAM,CAC5B,iBAAiB,EACjB,CAAC,kBAAkB,CAAC,EACpB,cAAc,CAAC,MAAM,CACnB,QAAQ,EACR,eAAe,CAAC,MAAM,CACpB,YAAY,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CACzE,EACD,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CACnC,CACF,CACF,CAAC;IACJ,CAAC;CACF;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FieldNode } from "@gqlbase/core/definition";
|
|
2
|
+
export declare const RfcDirective: {
|
|
3
|
+
readonly SEMANTIC_NON_NULL: "semanticNonNull";
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Determines if a field is semantically nullable based on its type and/or the presence of the `@semanticNonNull` directive.
|
|
7
|
+
*
|
|
8
|
+
* @param field Fiel node to check
|
|
9
|
+
* @param level Semantic nullability level
|
|
10
|
+
*
|
|
11
|
+
* @returns `false` if the field is non-nullable either by being a NonNullType or by having the `@semanticNonNull` directive at the specified level, `true` otherwise.
|
|
12
|
+
*/
|
|
13
|
+
export declare const isSemanticNullable: (field: FieldNode, level?: number) => boolean;
|
|
14
|
+
//# sourceMappingURL=RfcFeaturesPlugin.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RfcFeaturesPlugin.utils.d.ts","sourceRoot":"","sources":["../../../src/base/RfcFeaturesPlugin/RfcFeaturesPlugin.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA2C,MAAM,0BAA0B,CAAC;AAE9F,eAAO,MAAM,YAAY;;CAEf,CAAC;AAgBX;;;;;;;GAOG;AAEH,eAAO,MAAM,kBAAkB,GAAI,OAAO,SAAS,EAAE,cAAS,YAe7D,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ListTypeNode, NonNullTypeNode } from "@gqlbase/core/definition";
|
|
2
|
+
export const RfcDirective = {
|
|
3
|
+
SEMANTIC_NON_NULL: "semanticNonNull",
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Unwraps a type to the given depth level.
|
|
7
|
+
* Only `ListTypeNode` counts as a level — `NonNullTypeNode` is
|
|
8
|
+
* a modifier at the same depth and is skipped transparently.
|
|
9
|
+
*/
|
|
10
|
+
const getTypeAtLevel = (type, level) => {
|
|
11
|
+
if (level <= 0)
|
|
12
|
+
return type;
|
|
13
|
+
if (type instanceof NonNullTypeNode)
|
|
14
|
+
return getTypeAtLevel(type.type, level);
|
|
15
|
+
if (type instanceof ListTypeNode)
|
|
16
|
+
return getTypeAtLevel(type.type, level - 1);
|
|
17
|
+
return type;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Determines if a field is semantically nullable based on its type and/or the presence of the `@semanticNonNull` directive.
|
|
21
|
+
*
|
|
22
|
+
* @param field Fiel node to check
|
|
23
|
+
* @param level Semantic nullability level
|
|
24
|
+
*
|
|
25
|
+
* @returns `false` if the field is non-nullable either by being a NonNullType or by having the `@semanticNonNull` directive at the specified level, `true` otherwise.
|
|
26
|
+
*/
|
|
27
|
+
export const isSemanticNullable = (field, level = 0) => {
|
|
28
|
+
const typeAtLevel = getTypeAtLevel(field.type, level);
|
|
29
|
+
if (typeAtLevel instanceof NonNullTypeNode) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
if (field.hasDirective(RfcDirective.SEMANTIC_NON_NULL)) {
|
|
33
|
+
const directive = field.getDirective(RfcDirective.SEMANTIC_NON_NULL);
|
|
34
|
+
const { levels = [0] } = directive?.getArgumentsJSON() ?? {};
|
|
35
|
+
return !levels?.includes(level);
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=RfcFeaturesPlugin.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RfcFeaturesPlugin.utils.js","sourceRoot":"","sources":["../../../src/base/RfcFeaturesPlugin/RfcFeaturesPlugin.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,YAAY,EAAE,eAAe,EAAY,MAAM,0BAA0B,CAAC;AAE9F,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,iBAAiB,EAAE,iBAAiB;CAC5B,CAAC;AAEX;;;;GAIG;AACH,MAAM,cAAc,GAAG,CAAC,IAAc,EAAE,KAAa,EAAY,EAAE;IACjE,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAE5B,IAAI,IAAI,YAAY,eAAe;QAAE,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC7E,IAAI,IAAI,YAAY,YAAY;QAAE,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IAE9E,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAgB,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE;IAChE,MAAM,WAAW,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAEtD,IAAI,WAAW,YAAY,eAAe,EAAE,CAAC;QAC3C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,KAAK,CAAC,YAAY,CAAC,YAAY,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACvD,MAAM,SAAS,GAAG,KAAK,CAAC,YAAY,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;QACrE,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,gBAAgB,EAAwB,IAAI,EAAE,CAAC;QAEnF,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/RfcFeaturesPlugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/base/RfcFeaturesPlugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const BaseScalar: {
|
|
2
|
+
readonly DATE: "Date";
|
|
3
|
+
readonly DATE_TIME: "DateTime";
|
|
4
|
+
readonly TIME: "Time";
|
|
5
|
+
readonly TIMESTAMP: "Timestamp";
|
|
6
|
+
readonly UUID: "UUID";
|
|
7
|
+
readonly URL: "URL";
|
|
8
|
+
readonly EMAIL_ADDRESS: "EmailAddress";
|
|
9
|
+
readonly PHONE_NUMBER: "PhoneNumber";
|
|
10
|
+
readonly IP_ADDRESS: "IPAddress";
|
|
11
|
+
readonly JSON: "JSON";
|
|
12
|
+
};
|
|
13
|
+
export type BaseScalarName = (typeof BaseScalar)[keyof typeof BaseScalar];
|
|
14
|
+
export declare const isBaseScalar: (typeName: string) => typeName is BaseScalarName;
|
|
15
|
+
//# sourceMappingURL=ScalarsPlugin.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScalarsPlugin.utils.d.ts","sourceRoot":"","sources":["../../../src/base/ScalarsPlugin/ScalarsPlugin.utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;;CAWb,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAE1E,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM,KAAG,QAAQ,IAAI,cAE3D,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const BaseScalar = {
|
|
2
|
+
DATE: "Date",
|
|
3
|
+
DATE_TIME: "DateTime",
|
|
4
|
+
TIME: "Time",
|
|
5
|
+
TIMESTAMP: "Timestamp",
|
|
6
|
+
UUID: "UUID",
|
|
7
|
+
URL: "URL",
|
|
8
|
+
EMAIL_ADDRESS: "EmailAddress",
|
|
9
|
+
PHONE_NUMBER: "PhoneNumber",
|
|
10
|
+
IP_ADDRESS: "IPAddress",
|
|
11
|
+
JSON: "JSON",
|
|
12
|
+
};
|
|
13
|
+
export const isBaseScalar = (typeName) => {
|
|
14
|
+
return Object.values(BaseScalar).includes(typeName);
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=ScalarsPlugin.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScalarsPlugin.utils.js","sourceRoot":"","sources":["../../../src/base/ScalarsPlugin/ScalarsPlugin.utils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,UAAU;IACrB,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,WAAW;IACtB,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,aAAa,EAAE,cAAc;IAC7B,YAAY,EAAE,aAAa;IAC3B,UAAU,EAAE,WAAW;IACvB,IAAI,EAAE,MAAM;CACJ,CAAC;AAIX,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,QAAgB,EAA8B,EAAE;IAC3E,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,QAA0B,CAAC,CAAC;AACxE,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/ScalarsPlugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/ScalarsPlugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/base/ScalarsPlugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/base/ScalarsPlugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAuB,MAAM,0BAA0B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basePreset.d.ts","sourceRoot":"","sources":["../../src/base/basePreset.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"basePreset.d.ts","sourceRoot":"","sources":["../../src/base/basePreset.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;GAcG;AAEH,wBAAgB,UAAU,6CAWzB"}
|
package/dist/base/basePreset.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { utilsPlugin } from "./UtilitiesPlugin/index.js";
|
|
2
|
+
import { interfaceUtilsPlugin } from "./InterfaceUtilsPlugin/index.js";
|
|
2
3
|
import { scalarsPlugin } from "./ScalarsPlugin/index.js";
|
|
3
4
|
import { modelPlugin } from "./ModelPlugin/index.js";
|
|
4
5
|
import { relationPlugin } from "./RelationsPlugin/index.js";
|
|
6
|
+
import { rfcFeaturesPlugin } from "./RfcFeaturesPlugin/index.js";
|
|
5
7
|
import { schemaGeneratorPlugin } from "./SchemaGeneratorPlugin.js";
|
|
6
8
|
import { modelTypesGeneratorPlugin } from "./ModelTypesGeneratorPlugin/index.js";
|
|
7
9
|
/**
|
|
@@ -9,9 +11,11 @@ import { modelTypesGeneratorPlugin } from "./ModelTypesGeneratorPlugin/index.js"
|
|
|
9
11
|
*
|
|
10
12
|
* Inludes:
|
|
11
13
|
* - `UtilitiesPlugin`
|
|
14
|
+
* - `InterfaceUtilsPlugin`
|
|
12
15
|
* - `ScalarsPlugin`
|
|
13
16
|
* - `ModelPlugin`
|
|
14
17
|
* - `RelationsPlugin`
|
|
18
|
+
* - `RfcFeaturesPlugin`
|
|
15
19
|
* - `SchemaGeneratorPlugin`
|
|
16
20
|
* - `ModelTypesGeneratorPlugin`
|
|
17
21
|
*
|
|
@@ -20,9 +24,11 @@ import { modelTypesGeneratorPlugin } from "./ModelTypesGeneratorPlugin/index.js"
|
|
|
20
24
|
export function basePreset() {
|
|
21
25
|
return [
|
|
22
26
|
utilsPlugin(),
|
|
27
|
+
interfaceUtilsPlugin(),
|
|
23
28
|
scalarsPlugin(),
|
|
24
29
|
modelPlugin(),
|
|
25
30
|
relationPlugin(),
|
|
31
|
+
rfcFeaturesPlugin(),
|
|
26
32
|
schemaGeneratorPlugin(),
|
|
27
33
|
modelTypesGeneratorPlugin(),
|
|
28
34
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basePreset.js","sourceRoot":"","sources":["../../src/base/basePreset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEjF
|
|
1
|
+
{"version":3,"file":"basePreset.js","sourceRoot":"","sources":["../../src/base/basePreset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEjF;;;;;;;;;;;;;;GAcG;AAEH,MAAM,UAAU,UAAU;IACxB,OAAO;QACL,WAAW,EAAE;QACb,oBAAoB,EAAE;QACtB,aAAa,EAAE;QACf,WAAW,EAAE;QACb,cAAc,EAAE;QAChB,iBAAiB,EAAE;QACnB,qBAAqB,EAAE;QACvB,yBAAyB,EAAE;KAC5B,CAAC;AACJ,CAAC"}
|
package/dist/base/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { ModelPlugin, type ModelPluginOptions, ModelDirective, ModelOperation, modelPlugin, isModel, } from "./ModelPlugin/index.js";
|
|
2
2
|
export { RelationsPlugin, relationPlugin, RelationDirective, isRelationField, isOneRelationship, isManyRelationship, type FieldRelationship, type RelationPluginOptions, } from "./RelationsPlugin/index.js";
|
|
3
3
|
export { UtilitiesPlugin, UtilityDirective, utilsPlugin, isReadOnly, isClientOnly, isCreateOnly, isFilterOnly, isServerOnly, isUpdateOnly, isWriteOnly, } from "./UtilitiesPlugin/index.js";
|
|
4
|
+
export { RfcFeaturesPlugin, RfcDirective, rfcFeaturesPlugin, isSemanticNullable, } from "./RfcFeaturesPlugin/index.js";
|
|
5
|
+
export { ScalarsPlugin, BaseScalar, scalarsPlugin, isBaseScalar, type BaseScalarName, } from "./ScalarsPlugin/index.js";
|
|
4
6
|
export { SchemaGeneratorPlugin, schemaGeneratorPlugin } from "./SchemaGeneratorPlugin.js";
|
|
5
7
|
export { ModelTypesGeneratorPlugin, modelTypesGeneratorPlugin, } from "./ModelTypesGeneratorPlugin/index.js";
|
|
6
8
|
export { basePreset } from "./basePreset.js";
|
package/dist/base/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,kBAAkB,EACvB,cAAc,EACd,cAAc,EACd,WAAW,EACX,OAAO,GACR,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,GACZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,EACL,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,kBAAkB,EACvB,cAAc,EACd,cAAc,EACd,WAAW,EACX,OAAO,GACR,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,GACZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,aAAa,EACb,UAAU,EACV,aAAa,EACb,YAAY,EACZ,KAAK,cAAc,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,EACL,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/base/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { ModelPlugin, ModelDirective, ModelOperation, modelPlugin, isModel, } from "./ModelPlugin/index.js";
|
|
2
2
|
export { RelationsPlugin, relationPlugin, RelationDirective, isRelationField, isOneRelationship, isManyRelationship, } from "./RelationsPlugin/index.js";
|
|
3
3
|
export { UtilitiesPlugin, UtilityDirective, utilsPlugin, isReadOnly, isClientOnly, isCreateOnly, isFilterOnly, isServerOnly, isUpdateOnly, isWriteOnly, } from "./UtilitiesPlugin/index.js";
|
|
4
|
+
export { RfcFeaturesPlugin, RfcDirective, rfcFeaturesPlugin, isSemanticNullable, } from "./RfcFeaturesPlugin/index.js";
|
|
5
|
+
export { ScalarsPlugin, BaseScalar, scalarsPlugin, isBaseScalar, } from "./ScalarsPlugin/index.js";
|
|
4
6
|
export { SchemaGeneratorPlugin, schemaGeneratorPlugin } from "./SchemaGeneratorPlugin.js";
|
|
5
7
|
export { ModelTypesGeneratorPlugin, modelTypesGeneratorPlugin, } from "./ModelTypesGeneratorPlugin/index.js";
|
|
6
8
|
export { basePreset } from "./basePreset.js";
|
package/dist/base/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEX,cAAc,EACd,cAAc,EACd,WAAW,EACX,OAAO,GACR,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,GAGnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,GACZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,EACL,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEX,cAAc,EACd,cAAc,EACd,WAAW,EACX,OAAO,GACR,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,GAGnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,GACZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,aAAa,EACb,UAAU,EACV,aAAa,EACb,YAAY,GAEb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,EACL,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ITransformerContext } from "@gqlbase/core/context";
|
|
2
|
+
import { TransformerPluginBase } from "@gqlbase/core/plugins";
|
|
3
|
+
import { DefinitionNode, InterfaceNode, ObjectNode } from "@gqlbase/core/definition";
|
|
4
|
+
/**
|
|
5
|
+
* Transforms many relationships into Relay compaticale connections, and adds the necessary fields and arguments to support cursor based pagination.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```graphql
|
|
9
|
+
* # Before
|
|
10
|
+
* type User {
|
|
11
|
+
* id: ID!
|
|
12
|
+
* name: String!
|
|
13
|
+
* posts: Post `@hasMany`
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* type Post {
|
|
17
|
+
* id: ID!
|
|
18
|
+
* title: String!
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* # After
|
|
22
|
+
* type User {
|
|
23
|
+
* id: ID!
|
|
24
|
+
* name: String!
|
|
25
|
+
* posts: PostConnection
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* type Post {
|
|
29
|
+
* id: ID!
|
|
30
|
+
* title: String!
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* type PostConnection {
|
|
34
|
+
* edges: [PostEdge]
|
|
35
|
+
* pageInfo: PageInfo!
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* type PostEdge {
|
|
39
|
+
* cursor: String
|
|
40
|
+
* node: Post
|
|
41
|
+
* }
|
|
42
|
+
*
|
|
43
|
+
* type PageInfo {
|
|
44
|
+
* hasNextPage: Boolean!
|
|
45
|
+
* hasPreviousPage: Boolean!
|
|
46
|
+
* startCursor: String
|
|
47
|
+
* endCursor: String
|
|
48
|
+
* }
|
|
49
|
+
*
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare class ConnectionPlugin extends TransformerPluginBase {
|
|
53
|
+
constructor(context: ITransformerContext);
|
|
54
|
+
private _getConnectionTarget;
|
|
55
|
+
private _getFieldConnection;
|
|
56
|
+
private _setConnectionArguments;
|
|
57
|
+
private _createConnection;
|
|
58
|
+
before(): void;
|
|
59
|
+
match(definition: DefinitionNode): boolean;
|
|
60
|
+
execute(definition: ObjectNode | InterfaceNode): void;
|
|
61
|
+
}
|
|
62
|
+
export declare const connectionPlugin: (options?: unknown) => import("@gqlbase/core/plugins").IPluginFactory;
|
|
63
|
+
//# sourceMappingURL=ConnectionPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectionPlugin.d.ts","sourceRoot":"","sources":["../../../src/relay/ConnectionPlugin/ConnectionPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAuB,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EACL,cAAc,EAEd,aAAa,EACb,UAAU,EAQX,MAAM,0BAA0B,CAAC;AAalC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,qBAAa,gBAAiB,SAAQ,qBAAqB;gBAC7C,OAAO,EAAE,mBAAmB;IAIxC,OAAO,CAAC,oBAAoB;IAoB5B,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,uBAAuB;IAU/B,OAAO,CAAC,iBAAiB;IAqDlB,MAAM,IAAI,IAAI;IAad,KAAK,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO;IAY1C,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,aAAa;CAatD;AAED,eAAO,MAAM,gBAAgB,uEAAwC,CAAC"}
|