@smartive/graphql-magic 21.0.0-next.1 → 21.0.0-next.3
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/.releaserc +19 -1
- package/CHANGELOG.md +1 -1
- package/dist/cjs/index.cjs +0 -19
- package/dist/esm/client/queries.d.ts +0 -1
- package/dist/esm/client/queries.js +1 -10
- package/dist/esm/client/queries.js.map +1 -1
- package/package.json +1 -1
- package/src/client/queries.ts +0 -22
package/.releaserc
CHANGED
|
@@ -19,7 +19,25 @@
|
|
|
19
19
|
]
|
|
20
20
|
}
|
|
21
21
|
],
|
|
22
|
-
|
|
22
|
+
[
|
|
23
|
+
"@semantic-release/release-notes-generator",
|
|
24
|
+
{
|
|
25
|
+
"preset": "angular",
|
|
26
|
+
"parserOpts": {
|
|
27
|
+
"noteKeywords": [
|
|
28
|
+
"BREAKING CHANGE",
|
|
29
|
+
"BREAKING CHANGES",
|
|
30
|
+
"BREAKING"
|
|
31
|
+
],
|
|
32
|
+
"headerPattern": "^(\\w*)(?:\\((.*)\\))?!?: (.*)$",
|
|
33
|
+
"headerCorrespondence": [
|
|
34
|
+
"type",
|
|
35
|
+
"scope",
|
|
36
|
+
"subject"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
],
|
|
23
41
|
"@semantic-release/changelog",
|
|
24
42
|
"@semantic-release/npm",
|
|
25
43
|
"@semantic-release/github"
|
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# [21.0.0-next.
|
|
1
|
+
# [21.0.0-next.3](https://github.com/smartive/graphql-magic/compare/v21.0.0-next.2...v21.0.0-next.3) (2025-09-18)
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -95,7 +95,6 @@ __export(index_exports, {
|
|
|
95
95
|
getColumn: () => getColumn,
|
|
96
96
|
getColumnName: () => getColumnName,
|
|
97
97
|
getDisplay: () => getDisplay,
|
|
98
|
-
getEntityQuery: () => getEntityQuery,
|
|
99
98
|
getEntityToMutate: () => getEntityToMutate,
|
|
100
99
|
getFindEntityQuery: () => getFindEntityQuery,
|
|
101
100
|
getFragmentSpreads: () => getFragmentSpreads,
|
|
@@ -949,23 +948,6 @@ var getMutationQuery = (model, action) => action === "create" ? `
|
|
|
949
948
|
var displayField = (model) => `
|
|
950
949
|
${model.displayField ? `display: ${model.displayField}` : ""}
|
|
951
950
|
`;
|
|
952
|
-
var getEntityQuery = (model, role, relations, fragment = "") => `query Get${model.name}Entity ($id: ID!) {
|
|
953
|
-
data: ${typeToField(model.name)}(where: { id: $id }) {
|
|
954
|
-
${displayField(model)}
|
|
955
|
-
${model.fields.filter(and(isSimpleField, isQueriableBy(role))).map(({ name: name2 }) => name2)}
|
|
956
|
-
${queryRelations(
|
|
957
|
-
model.models,
|
|
958
|
-
model.relations.filter((relation) => !relations || relations.includes(relation.name))
|
|
959
|
-
)}
|
|
960
|
-
${queryRelations(
|
|
961
|
-
model.models,
|
|
962
|
-
model.reverseRelations.filter(
|
|
963
|
-
(reverseRelation) => isToOneRelation(reverseRelation.field) && (!relations || relations.includes(reverseRelation.name))
|
|
964
|
-
)
|
|
965
|
-
)}
|
|
966
|
-
${fragment}
|
|
967
|
-
}
|
|
968
|
-
}`;
|
|
969
951
|
var getFindEntityQuery = (model, role) => `query Find${model.name}($where: ${model.name}Where!, $orderBy: [${model.name}OrderBy!]) {
|
|
970
952
|
data: ${model.pluralField}(limit: 1, where: $where, orderBy: $orderBy) {
|
|
971
953
|
${model.fields.filter(and(isSimpleField, isQueriableBy(role))).map(({ name: name2 }) => name2)}
|
|
@@ -3793,7 +3775,6 @@ var printSchemaFromModels = (models) => printSchema((0, import_graphql6.buildAST
|
|
|
3793
3775
|
getColumn,
|
|
3794
3776
|
getColumnName,
|
|
3795
3777
|
getDisplay,
|
|
3796
|
-
getEntityQuery,
|
|
3797
3778
|
getEntityToMutate,
|
|
3798
3779
|
getFindEntityQuery,
|
|
3799
3780
|
getFragmentSpreads,
|
|
@@ -11,6 +11,5 @@ export type MutationQuery = {
|
|
|
11
11
|
};
|
|
12
12
|
export declare const getMutationQuery: (model: Model, action: "create" | "update" | "delete") => string;
|
|
13
13
|
export declare const displayField: (model: EntityModel) => string;
|
|
14
|
-
export declare const getEntityQuery: (model: EntityModel, role: string, relations?: string[], fragment?: string) => string;
|
|
15
14
|
export declare const getFindEntityQuery: (model: EntityModel, role: string) => string;
|
|
16
15
|
export declare const queryRelations: (models: Models, relations: Relation[]) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { and, getActionableRelations, isQueriableBy, isRelation, isSimpleField,
|
|
1
|
+
import { and, getActionableRelations, isQueriableBy, isRelation, isSimpleField, isUpdatableBy, not, typeToField, } from '../models/utils';
|
|
2
2
|
export const getUpdateEntityQuery = (model, role, fields, additionalFields = '') => `query Update${model.name}Fields ($id: ID!) {
|
|
3
3
|
data: ${typeToField(model.name)}(where: { id: $id }) {
|
|
4
4
|
id
|
|
@@ -80,15 +80,6 @@ export const getMutationQuery = (model, action) => action === 'create'
|
|
|
80
80
|
export const displayField = (model) => `
|
|
81
81
|
${model.displayField ? `display: ${model.displayField}` : ''}
|
|
82
82
|
`;
|
|
83
|
-
export const getEntityQuery = (model, role, relations, fragment = '') => `query Get${model.name}Entity ($id: ID!) {
|
|
84
|
-
data: ${typeToField(model.name)}(where: { id: $id }) {
|
|
85
|
-
${displayField(model)}
|
|
86
|
-
${model.fields.filter(and(isSimpleField, isQueriableBy(role))).map(({ name }) => name)}
|
|
87
|
-
${queryRelations(model.models, model.relations.filter((relation) => !relations || relations.includes(relation.name)))}
|
|
88
|
-
${queryRelations(model.models, model.reverseRelations.filter((reverseRelation) => isToOneRelation(reverseRelation.field) && (!relations || relations.includes(reverseRelation.name))))}
|
|
89
|
-
${fragment}
|
|
90
|
-
}
|
|
91
|
-
}`;
|
|
92
83
|
export const getFindEntityQuery = (model, role) => `query Find${model.name}($where: ${model.name}Where!, $orderBy: [${model.name}OrderBy!]) {
|
|
93
84
|
data: ${model.pluralField}(limit: 1, where: $where, orderBy: $orderBy) {
|
|
94
85
|
${model.fields.filter(and(isSimpleField, isQueriableBy(role))).map(({ name }) => name)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/client/queries.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,GAAG,EACH,sBAAsB,EACtB,aAAa,EACb,UAAU,EACV,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/client/queries.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,GAAG,EACH,sBAAsB,EACtB,aAAa,EACb,UAAU,EACV,aAAa,EACb,aAAa,EACb,GAAG,EACH,WAAW,GACZ,MAAM,iBAAiB,CAAC;AAEzB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,KAAkB,EAClB,IAAY,EACZ,MAAiB,EACjB,gBAAgB,GAAG,EAAE,EACrB,EAAE,CAAC,eAAe,KAAK,CAAC,IAAI;UACpB,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC;;MAE3B,KAAK,CAAC,MAAM;KACX,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;KACtD,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;KACvB,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;KAC3B,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC;KACvB,IAAI,CAAC,GAAG,CAAC;MACV,sBAAsB,CAAC,KAAK,EAAE,QAAQ,CAAC;KACtC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;KAClD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CA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MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAc,EAAE,SAAqB,EAAE,EAAE,CACtE,SAAS;KACN,GAAG,CACF,CAAC,QAAQ,EAAU,EAAE,CAAC,GAAG,QAAQ,CAAC,IAAI;;YAEhC,YAAY,CAAC,QAAQ,CAAC,WAAW,CAAC;UACpC,CACL;KACA,IAAI,CAAC,IAAI,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/client/queries.ts
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
isQueriableBy,
|
|
7
7
|
isRelation,
|
|
8
8
|
isSimpleField,
|
|
9
|
-
isToOneRelation,
|
|
10
9
|
isUpdatableBy,
|
|
11
10
|
not,
|
|
12
11
|
typeToField,
|
|
@@ -118,27 +117,6 @@ export const displayField = (model: EntityModel) => `
|
|
|
118
117
|
${model.displayField ? `display: ${model.displayField}` : ''}
|
|
119
118
|
`;
|
|
120
119
|
|
|
121
|
-
export const getEntityQuery = (model: EntityModel, role: string, relations?: string[], fragment = '') => `query Get${
|
|
122
|
-
model.name
|
|
123
|
-
}Entity ($id: ID!) {
|
|
124
|
-
data: ${typeToField(model.name)}(where: { id: $id }) {
|
|
125
|
-
${displayField(model)}
|
|
126
|
-
${model.fields.filter(and(isSimpleField, isQueriableBy(role))).map(({ name }) => name)}
|
|
127
|
-
${queryRelations(
|
|
128
|
-
model.models,
|
|
129
|
-
model.relations.filter((relation) => !relations || relations.includes(relation.name)),
|
|
130
|
-
)}
|
|
131
|
-
${queryRelations(
|
|
132
|
-
model.models,
|
|
133
|
-
model.reverseRelations.filter(
|
|
134
|
-
(reverseRelation) =>
|
|
135
|
-
isToOneRelation(reverseRelation.field) && (!relations || relations.includes(reverseRelation.name)),
|
|
136
|
-
),
|
|
137
|
-
)}
|
|
138
|
-
${fragment}
|
|
139
|
-
}
|
|
140
|
-
}`;
|
|
141
|
-
|
|
142
120
|
export const getFindEntityQuery = (model: EntityModel, role: string) => `query Find${model.name}($where: ${
|
|
143
121
|
model.name
|
|
144
122
|
}Where!, $orderBy: [${model.name}OrderBy!]) {
|