@constructive-io/graphql-query 3.10.4 → 3.11.1
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/ast.js +3 -3
- package/esm/ast.js +4 -4
- package/esm/generators/field-selector.js +7 -4
- package/esm/generators/naming-helpers.js +4 -6
- package/esm/generators/select.js +4 -2
- package/esm/query-builder.js +12 -12
- package/generators/field-selector.js +7 -4
- package/generators/naming-helpers.js +3 -5
- package/generators/select.js +4 -2
- package/package.json +4 -4
- package/query-builder.js +11 -11
package/ast.js
CHANGED
|
@@ -321,7 +321,7 @@ const createOne = ({ mutationName, operationName, mutation, selection, }) => {
|
|
|
321
321
|
if (!mutation.properties?.input?.properties) {
|
|
322
322
|
throw new Error(`No input field for mutation: ${mutationName}`);
|
|
323
323
|
}
|
|
324
|
-
const modelName = (0, inflekt_1.
|
|
324
|
+
const modelName = (0, inflekt_1.toCamelCase)((0, inflekt_1.singularize)(mutation.model));
|
|
325
325
|
const inputProperties = mutation.properties.input
|
|
326
326
|
.properties;
|
|
327
327
|
const modelProperties = inputProperties[modelName];
|
|
@@ -367,7 +367,7 @@ const patchOne = ({ mutationName, operationName, mutation, selection, }) => {
|
|
|
367
367
|
if (!mutation.properties?.input?.properties) {
|
|
368
368
|
throw new Error(`No input field for mutation: ${mutationName}`);
|
|
369
369
|
}
|
|
370
|
-
const modelName = (0, inflekt_1.
|
|
370
|
+
const modelName = (0, inflekt_1.toCamelCase)((0, inflekt_1.singularize)(mutation.model));
|
|
371
371
|
const inputProperties = mutation.properties.input
|
|
372
372
|
.properties;
|
|
373
373
|
const patchProperties = inputProperties['patch'];
|
|
@@ -420,7 +420,7 @@ const deleteOne = ({ mutationName, operationName, mutation, }) => {
|
|
|
420
420
|
if (!mutation.properties?.input?.properties) {
|
|
421
421
|
throw new Error(`No input field for mutation: ${mutationName}`);
|
|
422
422
|
}
|
|
423
|
-
const modelName = (0, inflekt_1.
|
|
423
|
+
const modelName = (0, inflekt_1.toCamelCase)((0, inflekt_1.singularize)(mutation.model));
|
|
424
424
|
const inputProperties = mutation.properties.input
|
|
425
425
|
.properties;
|
|
426
426
|
const deleteAttrs = objectToArray(inputProperties);
|
package/esm/ast.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as t from 'gql-ast';
|
|
2
2
|
import { OperationTypeNode } from 'graphql';
|
|
3
|
-
import {
|
|
3
|
+
import { toCamelCase, singularize } from 'inflekt';
|
|
4
4
|
import { getCustomAst } from './custom-ast';
|
|
5
5
|
const NON_MUTABLE_PROPS = ['createdAt', 'createdBy', 'updatedAt', 'updatedBy'];
|
|
6
6
|
const objectToArray = (obj) => Object.keys(obj).map((k) => ({
|
|
@@ -280,7 +280,7 @@ export const createOne = ({ mutationName, operationName, mutation, selection, })
|
|
|
280
280
|
if (!mutation.properties?.input?.properties) {
|
|
281
281
|
throw new Error(`No input field for mutation: ${mutationName}`);
|
|
282
282
|
}
|
|
283
|
-
const modelName =
|
|
283
|
+
const modelName = toCamelCase(singularize(mutation.model));
|
|
284
284
|
const inputProperties = mutation.properties.input
|
|
285
285
|
.properties;
|
|
286
286
|
const modelProperties = inputProperties[modelName];
|
|
@@ -325,7 +325,7 @@ export const patchOne = ({ mutationName, operationName, mutation, selection, })
|
|
|
325
325
|
if (!mutation.properties?.input?.properties) {
|
|
326
326
|
throw new Error(`No input field for mutation: ${mutationName}`);
|
|
327
327
|
}
|
|
328
|
-
const modelName =
|
|
328
|
+
const modelName = toCamelCase(singularize(mutation.model));
|
|
329
329
|
const inputProperties = mutation.properties.input
|
|
330
330
|
.properties;
|
|
331
331
|
const patchProperties = inputProperties['patch'];
|
|
@@ -377,7 +377,7 @@ export const deleteOne = ({ mutationName, operationName, mutation, }) => {
|
|
|
377
377
|
if (!mutation.properties?.input?.properties) {
|
|
378
378
|
throw new Error(`No input field for mutation: ${mutationName}`);
|
|
379
379
|
}
|
|
380
|
-
const modelName =
|
|
380
|
+
const modelName = toCamelCase(singularize(mutation.model));
|
|
381
381
|
const inputProperties = mutation.properties.input
|
|
382
382
|
.properties;
|
|
383
383
|
const deleteAttrs = objectToArray(inputProperties);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fuzzyFindByName } from 'inflekt';
|
|
1
2
|
const relationalFieldSetCache = new WeakMap();
|
|
2
3
|
function getRelationalFieldSet(table) {
|
|
3
4
|
const cached = relationalFieldSetCache.get(table);
|
|
@@ -218,11 +219,13 @@ function getRelatedTableScalarFields(relationField, table, allTables) {
|
|
|
218
219
|
// No related table found - return empty selection
|
|
219
220
|
return {};
|
|
220
221
|
}
|
|
221
|
-
// Find the related table in allTables
|
|
222
|
-
|
|
222
|
+
// Find the related table in allTables using shared fuzzy matching from inflekt.
|
|
223
|
+
// Handles PascalCase table names vs snake_case/camelCase/plural codec names.
|
|
224
|
+
const relatedTable = fuzzyFindByName(allTables, referencedTableName, (t) => t.name);
|
|
223
225
|
if (!relatedTable) {
|
|
224
|
-
// Related table not found in schema
|
|
225
|
-
|
|
226
|
+
// Related table not found in schema — return fallback { __typename: true }
|
|
227
|
+
// so the query remains valid (nodes need at least one subfield).
|
|
228
|
+
return { __typename: true };
|
|
226
229
|
}
|
|
227
230
|
// Get ALL scalar fields from the related table (non-relational fields)
|
|
228
231
|
// This is completely dynamic based on the actual schema
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Back-ported from Dashboard's `packages/data/src/query-generator.ts`.
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
10
|
+
import { toCamelCase, toScreamingSnake, pluralize } from 'inflekt';
|
|
11
11
|
// ---------------------------------------------------------------------------
|
|
12
12
|
// Internal helpers
|
|
13
13
|
// ---------------------------------------------------------------------------
|
|
@@ -33,7 +33,7 @@ export function normalizeInflectionValue(value) {
|
|
|
33
33
|
* Example: "ActionGoal" -> "actionGoals", "User" -> "users", "Person" -> "people"
|
|
34
34
|
*/
|
|
35
35
|
export function toCamelCasePlural(tableName, table) {
|
|
36
|
-
const singular =
|
|
36
|
+
const singular = toCamelCase(tableName);
|
|
37
37
|
const inflectedPlural = pluralize(singular);
|
|
38
38
|
const serverPluralCandidates = [
|
|
39
39
|
table?.query?.all,
|
|
@@ -60,7 +60,7 @@ export function toCamelCasePlural(tableName, table) {
|
|
|
60
60
|
* Prefers server-provided names when available.
|
|
61
61
|
*/
|
|
62
62
|
export function toCamelCaseSingular(tableName, table) {
|
|
63
|
-
const localSingular =
|
|
63
|
+
const localSingular = toCamelCase(tableName);
|
|
64
64
|
for (const candidateRaw of [
|
|
65
65
|
table?.query?.one,
|
|
66
66
|
table?.inflection?.tableFieldName,
|
|
@@ -137,9 +137,7 @@ export function toPatchFieldName(tableName, table) {
|
|
|
137
137
|
* "id" -> "ID_ASC"
|
|
138
138
|
*/
|
|
139
139
|
export function toOrderByEnumValue(fieldName, direction) {
|
|
140
|
-
const screaming = fieldName
|
|
141
|
-
.replace(/([a-z0-9])([A-Z])/g, '$1_$2')
|
|
142
|
-
.toUpperCase();
|
|
140
|
+
const screaming = toScreamingSnake(fieldName);
|
|
143
141
|
return `${screaming}_${direction.toUpperCase()}`;
|
|
144
142
|
}
|
|
145
143
|
/**
|
package/esm/generators/select.js
CHANGED
|
@@ -8,6 +8,7 @@ import { TypedDocumentString } from '../client/typed-document';
|
|
|
8
8
|
import { getCustomAstForCleanField, requiresSubfieldSelection, } from '../custom-ast';
|
|
9
9
|
import { QueryBuilder } from '../query-builder';
|
|
10
10
|
import { convertToSelectionOptions, isRelationalField } from './field-selector';
|
|
11
|
+
import { fuzzyFindByName } from 'inflekt';
|
|
11
12
|
import { normalizeInflectionValue, toCamelCasePlural, toCamelCaseSingular, toCreateInputTypeName, toCreateMutationName, toDeleteInputTypeName, toDeleteMutationName, toFilterTypeName, toOrderByTypeName, toPatchFieldName, toUpdateInputTypeName, toUpdateMutationName, } from './naming-helpers';
|
|
12
13
|
// Re-export naming helpers for backwards compatibility
|
|
13
14
|
export { toCamelCasePlural, toOrderByTypeName } from './naming-helpers';
|
|
@@ -567,8 +568,9 @@ function findRelatedTable(relationField, table, allTables) {
|
|
|
567
568
|
if (!referencedTableName) {
|
|
568
569
|
return null;
|
|
569
570
|
}
|
|
570
|
-
// Find the related table
|
|
571
|
-
|
|
571
|
+
// Find the related table using shared fuzzy matching from inflekt.
|
|
572
|
+
// Handles PascalCase table names vs snake_case/camelCase/plural codec names.
|
|
573
|
+
return fuzzyFindByName(allTables, referencedTableName, (tbl) => tbl.name) ?? null;
|
|
572
574
|
}
|
|
573
575
|
/**
|
|
574
576
|
* Generate FindOne query AST directly from Table
|
package/esm/query-builder.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { print as gqlPrint } from 'graphql';
|
|
2
|
-
import {
|
|
2
|
+
import { toCamelCase, toPascalCase, pluralize, underscore } from 'inflekt';
|
|
3
3
|
import { createOne, deleteOne, getAll, getCount, getMany, getOne, patchOne, } from './ast';
|
|
4
4
|
import { validateMetaObject } from './meta-object';
|
|
5
5
|
export * as MetaObject from './meta-object';
|
|
@@ -88,13 +88,13 @@ export class QueryBuilder {
|
|
|
88
88
|
const getInputName = (mutationType) => {
|
|
89
89
|
switch (mutationType) {
|
|
90
90
|
case 'delete': {
|
|
91
|
-
return `Delete${
|
|
91
|
+
return `Delete${toPascalCase(this._model)}Input`;
|
|
92
92
|
}
|
|
93
93
|
case 'create': {
|
|
94
|
-
return `Create${
|
|
94
|
+
return `Create${toPascalCase(this._model)}Input`;
|
|
95
95
|
}
|
|
96
96
|
case 'patch': {
|
|
97
|
-
return `Update${
|
|
97
|
+
return `Update${toPascalCase(this._model)}Input`;
|
|
98
98
|
}
|
|
99
99
|
default:
|
|
100
100
|
throw new Error('Unhandled mutation type' + mutationType);
|
|
@@ -123,7 +123,7 @@ export class QueryBuilder {
|
|
|
123
123
|
getMany({ select } = {}) {
|
|
124
124
|
this._op = 'getMany';
|
|
125
125
|
this._key = this._findQuery();
|
|
126
|
-
this.queryName(
|
|
126
|
+
this.queryName(toCamelCase(['get', underscore(this._key), 'query'].join('_')));
|
|
127
127
|
const defn = this._introspection[this._key];
|
|
128
128
|
this.select(select);
|
|
129
129
|
this._ast = getMany({
|
|
@@ -138,7 +138,7 @@ export class QueryBuilder {
|
|
|
138
138
|
all({ select } = {}) {
|
|
139
139
|
this._op = 'getMany';
|
|
140
140
|
this._key = this._findQuery();
|
|
141
|
-
this.queryName(
|
|
141
|
+
this.queryName(toCamelCase(['get', underscore(this._key), 'query', 'all'].join('_')));
|
|
142
142
|
const defn = this._introspection[this._key];
|
|
143
143
|
this.select(select);
|
|
144
144
|
this._ast = getAll({
|
|
@@ -152,7 +152,7 @@ export class QueryBuilder {
|
|
|
152
152
|
count() {
|
|
153
153
|
this._op = 'getMany';
|
|
154
154
|
this._key = this._findQuery();
|
|
155
|
-
this.queryName(
|
|
155
|
+
this.queryName(toCamelCase(['get', underscore(this._key), 'count', 'query'].join('_')));
|
|
156
156
|
const defn = this._introspection[this._key];
|
|
157
157
|
this._ast = getCount({
|
|
158
158
|
queryName: this._queryName,
|
|
@@ -164,7 +164,7 @@ export class QueryBuilder {
|
|
|
164
164
|
getOne({ select } = {}) {
|
|
165
165
|
this._op = 'getOne';
|
|
166
166
|
this._key = this._findQuery();
|
|
167
|
-
this.queryName(
|
|
167
|
+
this.queryName(toCamelCase(['get', underscore(this._key), 'query'].join('_')));
|
|
168
168
|
const defn = this._introspection[this._key];
|
|
169
169
|
this.select(select);
|
|
170
170
|
this._ast = getOne({
|
|
@@ -180,7 +180,7 @@ export class QueryBuilder {
|
|
|
180
180
|
this._op = 'mutation';
|
|
181
181
|
this._mutation = 'create';
|
|
182
182
|
this._key = this._findMutation();
|
|
183
|
-
this.queryName(
|
|
183
|
+
this.queryName(toCamelCase([underscore(this._key), 'mutation'].join('_')));
|
|
184
184
|
const defn = this._introspection[this._key];
|
|
185
185
|
this.select(select);
|
|
186
186
|
this._ast = createOne({
|
|
@@ -195,7 +195,7 @@ export class QueryBuilder {
|
|
|
195
195
|
this._op = 'mutation';
|
|
196
196
|
this._mutation = 'delete';
|
|
197
197
|
this._key = this._findMutation();
|
|
198
|
-
this.queryName(
|
|
198
|
+
this.queryName(toCamelCase([underscore(this._key), 'mutation'].join('_')));
|
|
199
199
|
const defn = this._introspection[this._key];
|
|
200
200
|
this.select(select);
|
|
201
201
|
this._ast = deleteOne({
|
|
@@ -209,7 +209,7 @@ export class QueryBuilder {
|
|
|
209
209
|
this._op = 'mutation';
|
|
210
210
|
this._mutation = 'patch';
|
|
211
211
|
this._key = this._findMutation();
|
|
212
|
-
this.queryName(
|
|
212
|
+
this.queryName(toCamelCase([underscore(this._key), 'mutation'].join('_')));
|
|
213
213
|
const defn = this._introspection[this._key];
|
|
214
214
|
this.select(select);
|
|
215
215
|
this._ast = patchOne({
|
|
@@ -371,5 +371,5 @@ function isRelationalField(fieldName, modelMeta) {
|
|
|
371
371
|
// Get getMany op name from model
|
|
372
372
|
// ie. UserSetting => userSettings
|
|
373
373
|
function modelNameToGetMany(model) {
|
|
374
|
-
return
|
|
374
|
+
return toCamelCase(pluralize(underscore(model)));
|
|
375
375
|
}
|
|
@@ -4,6 +4,7 @@ exports.convertToSelectionOptions = convertToSelectionOptions;
|
|
|
4
4
|
exports.isRelationalField = isRelationalField;
|
|
5
5
|
exports.getAvailableRelations = getAvailableRelations;
|
|
6
6
|
exports.validateFieldSelection = validateFieldSelection;
|
|
7
|
+
const inflekt_1 = require("inflekt");
|
|
7
8
|
const relationalFieldSetCache = new WeakMap();
|
|
8
9
|
function getRelationalFieldSet(table) {
|
|
9
10
|
const cached = relationalFieldSetCache.get(table);
|
|
@@ -224,11 +225,13 @@ function getRelatedTableScalarFields(relationField, table, allTables) {
|
|
|
224
225
|
// No related table found - return empty selection
|
|
225
226
|
return {};
|
|
226
227
|
}
|
|
227
|
-
// Find the related table in allTables
|
|
228
|
-
|
|
228
|
+
// Find the related table in allTables using shared fuzzy matching from inflekt.
|
|
229
|
+
// Handles PascalCase table names vs snake_case/camelCase/plural codec names.
|
|
230
|
+
const relatedTable = (0, inflekt_1.fuzzyFindByName)(allTables, referencedTableName, (t) => t.name);
|
|
229
231
|
if (!relatedTable) {
|
|
230
|
-
// Related table not found in schema
|
|
231
|
-
|
|
232
|
+
// Related table not found in schema — return fallback { __typename: true }
|
|
233
|
+
// so the query remains valid (nodes need at least one subfield).
|
|
234
|
+
return { __typename: true };
|
|
232
235
|
}
|
|
233
236
|
// Get ALL scalar fields from the related table (non-relational fields)
|
|
234
237
|
// This is completely dynamic based on the actual schema
|
|
@@ -48,7 +48,7 @@ function normalizeInflectionValue(value) {
|
|
|
48
48
|
* Example: "ActionGoal" -> "actionGoals", "User" -> "users", "Person" -> "people"
|
|
49
49
|
*/
|
|
50
50
|
function toCamelCasePlural(tableName, table) {
|
|
51
|
-
const singular = (0, inflekt_1.
|
|
51
|
+
const singular = (0, inflekt_1.toCamelCase)(tableName);
|
|
52
52
|
const inflectedPlural = (0, inflekt_1.pluralize)(singular);
|
|
53
53
|
const serverPluralCandidates = [
|
|
54
54
|
table?.query?.all,
|
|
@@ -75,7 +75,7 @@ function toCamelCasePlural(tableName, table) {
|
|
|
75
75
|
* Prefers server-provided names when available.
|
|
76
76
|
*/
|
|
77
77
|
function toCamelCaseSingular(tableName, table) {
|
|
78
|
-
const localSingular = (0, inflekt_1.
|
|
78
|
+
const localSingular = (0, inflekt_1.toCamelCase)(tableName);
|
|
79
79
|
for (const candidateRaw of [
|
|
80
80
|
table?.query?.one,
|
|
81
81
|
table?.inflection?.tableFieldName,
|
|
@@ -152,9 +152,7 @@ function toPatchFieldName(tableName, table) {
|
|
|
152
152
|
* "id" -> "ID_ASC"
|
|
153
153
|
*/
|
|
154
154
|
function toOrderByEnumValue(fieldName, direction) {
|
|
155
|
-
const screaming = fieldName
|
|
156
|
-
.replace(/([a-z0-9])([A-Z])/g, '$1_$2')
|
|
157
|
-
.toUpperCase();
|
|
155
|
+
const screaming = (0, inflekt_1.toScreamingSnake)(fieldName);
|
|
158
156
|
return `${screaming}_${direction.toUpperCase()}`;
|
|
159
157
|
}
|
|
160
158
|
/**
|
package/generators/select.js
CHANGED
|
@@ -50,6 +50,7 @@ const typed_document_1 = require("../client/typed-document");
|
|
|
50
50
|
const custom_ast_1 = require("../custom-ast");
|
|
51
51
|
const query_builder_1 = require("../query-builder");
|
|
52
52
|
const field_selector_1 = require("./field-selector");
|
|
53
|
+
const inflekt_1 = require("inflekt");
|
|
53
54
|
const naming_helpers_1 = require("./naming-helpers");
|
|
54
55
|
// Re-export naming helpers for backwards compatibility
|
|
55
56
|
var naming_helpers_2 = require("./naming-helpers");
|
|
@@ -611,8 +612,9 @@ function findRelatedTable(relationField, table, allTables) {
|
|
|
611
612
|
if (!referencedTableName) {
|
|
612
613
|
return null;
|
|
613
614
|
}
|
|
614
|
-
// Find the related table
|
|
615
|
-
|
|
615
|
+
// Find the related table using shared fuzzy matching from inflekt.
|
|
616
|
+
// Handles PascalCase table names vs snake_case/camelCase/plural codec names.
|
|
617
|
+
return (0, inflekt_1.fuzzyFindByName)(allTables, referencedTableName, (tbl) => tbl.name) ?? null;
|
|
616
618
|
}
|
|
617
619
|
/**
|
|
618
620
|
* Generate FindOne query AST directly from Table
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/graphql-query",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.1",
|
|
4
4
|
"description": "Constructive GraphQL Query",
|
|
5
5
|
"author": "Constructive <developers@constructive.io>",
|
|
6
6
|
"main": "index.js",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"grafast": "1.0.0-rc.9",
|
|
35
35
|
"graphile-build-pg": "5.0.0-rc.8",
|
|
36
36
|
"graphile-config": "1.0.0-rc.6",
|
|
37
|
-
"graphile-settings": "^4.
|
|
37
|
+
"graphile-settings": "^4.15.1",
|
|
38
38
|
"graphql": "16.13.0",
|
|
39
39
|
"inflection": "^3.0.0",
|
|
40
|
-
"inflekt": "^0.
|
|
40
|
+
"inflekt": "^0.5.1",
|
|
41
41
|
"lru-cache": "^11.2.7",
|
|
42
42
|
"postgraphile": "5.0.0-rc.10"
|
|
43
43
|
},
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"makage": "^0.1.10"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "8366738765a5615ad279eec5b462a291020fef94"
|
|
55
55
|
}
|
package/query-builder.js
CHANGED
|
@@ -124,13 +124,13 @@ class QueryBuilder {
|
|
|
124
124
|
const getInputName = (mutationType) => {
|
|
125
125
|
switch (mutationType) {
|
|
126
126
|
case 'delete': {
|
|
127
|
-
return `Delete${(0, inflekt_1.
|
|
127
|
+
return `Delete${(0, inflekt_1.toPascalCase)(this._model)}Input`;
|
|
128
128
|
}
|
|
129
129
|
case 'create': {
|
|
130
|
-
return `Create${(0, inflekt_1.
|
|
130
|
+
return `Create${(0, inflekt_1.toPascalCase)(this._model)}Input`;
|
|
131
131
|
}
|
|
132
132
|
case 'patch': {
|
|
133
|
-
return `Update${(0, inflekt_1.
|
|
133
|
+
return `Update${(0, inflekt_1.toPascalCase)(this._model)}Input`;
|
|
134
134
|
}
|
|
135
135
|
default:
|
|
136
136
|
throw new Error('Unhandled mutation type' + mutationType);
|
|
@@ -159,7 +159,7 @@ class QueryBuilder {
|
|
|
159
159
|
getMany({ select } = {}) {
|
|
160
160
|
this._op = 'getMany';
|
|
161
161
|
this._key = this._findQuery();
|
|
162
|
-
this.queryName((0, inflekt_1.
|
|
162
|
+
this.queryName((0, inflekt_1.toCamelCase)(['get', (0, inflekt_1.underscore)(this._key), 'query'].join('_')));
|
|
163
163
|
const defn = this._introspection[this._key];
|
|
164
164
|
this.select(select);
|
|
165
165
|
this._ast = (0, ast_1.getMany)({
|
|
@@ -174,7 +174,7 @@ class QueryBuilder {
|
|
|
174
174
|
all({ select } = {}) {
|
|
175
175
|
this._op = 'getMany';
|
|
176
176
|
this._key = this._findQuery();
|
|
177
|
-
this.queryName((0, inflekt_1.
|
|
177
|
+
this.queryName((0, inflekt_1.toCamelCase)(['get', (0, inflekt_1.underscore)(this._key), 'query', 'all'].join('_')));
|
|
178
178
|
const defn = this._introspection[this._key];
|
|
179
179
|
this.select(select);
|
|
180
180
|
this._ast = (0, ast_1.getAll)({
|
|
@@ -188,7 +188,7 @@ class QueryBuilder {
|
|
|
188
188
|
count() {
|
|
189
189
|
this._op = 'getMany';
|
|
190
190
|
this._key = this._findQuery();
|
|
191
|
-
this.queryName((0, inflekt_1.
|
|
191
|
+
this.queryName((0, inflekt_1.toCamelCase)(['get', (0, inflekt_1.underscore)(this._key), 'count', 'query'].join('_')));
|
|
192
192
|
const defn = this._introspection[this._key];
|
|
193
193
|
this._ast = (0, ast_1.getCount)({
|
|
194
194
|
queryName: this._queryName,
|
|
@@ -200,7 +200,7 @@ class QueryBuilder {
|
|
|
200
200
|
getOne({ select } = {}) {
|
|
201
201
|
this._op = 'getOne';
|
|
202
202
|
this._key = this._findQuery();
|
|
203
|
-
this.queryName((0, inflekt_1.
|
|
203
|
+
this.queryName((0, inflekt_1.toCamelCase)(['get', (0, inflekt_1.underscore)(this._key), 'query'].join('_')));
|
|
204
204
|
const defn = this._introspection[this._key];
|
|
205
205
|
this.select(select);
|
|
206
206
|
this._ast = (0, ast_1.getOne)({
|
|
@@ -216,7 +216,7 @@ class QueryBuilder {
|
|
|
216
216
|
this._op = 'mutation';
|
|
217
217
|
this._mutation = 'create';
|
|
218
218
|
this._key = this._findMutation();
|
|
219
|
-
this.queryName((0, inflekt_1.
|
|
219
|
+
this.queryName((0, inflekt_1.toCamelCase)([(0, inflekt_1.underscore)(this._key), 'mutation'].join('_')));
|
|
220
220
|
const defn = this._introspection[this._key];
|
|
221
221
|
this.select(select);
|
|
222
222
|
this._ast = (0, ast_1.createOne)({
|
|
@@ -231,7 +231,7 @@ class QueryBuilder {
|
|
|
231
231
|
this._op = 'mutation';
|
|
232
232
|
this._mutation = 'delete';
|
|
233
233
|
this._key = this._findMutation();
|
|
234
|
-
this.queryName((0, inflekt_1.
|
|
234
|
+
this.queryName((0, inflekt_1.toCamelCase)([(0, inflekt_1.underscore)(this._key), 'mutation'].join('_')));
|
|
235
235
|
const defn = this._introspection[this._key];
|
|
236
236
|
this.select(select);
|
|
237
237
|
this._ast = (0, ast_1.deleteOne)({
|
|
@@ -245,7 +245,7 @@ class QueryBuilder {
|
|
|
245
245
|
this._op = 'mutation';
|
|
246
246
|
this._mutation = 'patch';
|
|
247
247
|
this._key = this._findMutation();
|
|
248
|
-
this.queryName((0, inflekt_1.
|
|
248
|
+
this.queryName((0, inflekt_1.toCamelCase)([(0, inflekt_1.underscore)(this._key), 'mutation'].join('_')));
|
|
249
249
|
const defn = this._introspection[this._key];
|
|
250
250
|
this.select(select);
|
|
251
251
|
this._ast = (0, ast_1.patchOne)({
|
|
@@ -408,5 +408,5 @@ function isRelationalField(fieldName, modelMeta) {
|
|
|
408
408
|
// Get getMany op name from model
|
|
409
409
|
// ie. UserSetting => userSettings
|
|
410
410
|
function modelNameToGetMany(model) {
|
|
411
|
-
return (0, inflekt_1.
|
|
411
|
+
return (0, inflekt_1.toCamelCase)((0, inflekt_1.pluralize)((0, inflekt_1.underscore)(model)));
|
|
412
412
|
}
|