@constructive-io/graphql-query 3.12.3 → 3.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Back-ported from Dashboard's `packages/data/src/query-generator.ts`.
9
9
  */
10
- import { toCamelCase, toScreamingSnake, pluralize } from 'inflekt';
10
+ import { toCamelCase, toConstantCase, pluralize } from 'inflekt';
11
11
  // ---------------------------------------------------------------------------
12
12
  // Internal helpers
13
13
  // ---------------------------------------------------------------------------
@@ -137,7 +137,7 @@ export function toPatchFieldName(tableName, table) {
137
137
  * "id" -> "ID_ASC"
138
138
  */
139
139
  export function toOrderByEnumValue(fieldName, direction) {
140
- const screaming = toScreamingSnake(fieldName);
140
+ const screaming = toConstantCase(fieldName);
141
141
  return `${screaming}_${direction.toUpperCase()}`;
142
142
  }
143
143
  /**
@@ -1,5 +1,5 @@
1
1
  import { print as gqlPrint } from 'graphql';
2
- import { toCamelCase, toPascalCase, pluralize, underscore } from 'inflekt';
2
+ import { toCamelCase, toPascalCase, toSnakeCase, pluralize } 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';
@@ -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(toCamelCase(['get', underscore(this._key), 'query'].join('_')));
126
+ this.queryName(toCamelCase(['get', toSnakeCase(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(toCamelCase(['get', underscore(this._key), 'query', 'all'].join('_')));
141
+ this.queryName(toCamelCase(['get', toSnakeCase(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(toCamelCase(['get', underscore(this._key), 'count', 'query'].join('_')));
155
+ this.queryName(toCamelCase(['get', toSnakeCase(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(toCamelCase(['get', underscore(this._key), 'query'].join('_')));
167
+ this.queryName(toCamelCase(['get', toSnakeCase(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(toCamelCase([underscore(this._key), 'mutation'].join('_')));
183
+ this.queryName(toCamelCase([toSnakeCase(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(toCamelCase([underscore(this._key), 'mutation'].join('_')));
198
+ this.queryName(toCamelCase([toSnakeCase(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(toCamelCase([underscore(this._key), 'mutation'].join('_')));
212
+ this.queryName(toCamelCase([toSnakeCase(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 toCamelCase(pluralize(underscore(model)));
374
+ return toCamelCase(pluralize(toSnakeCase(model)));
375
375
  }
@@ -152,7 +152,7 @@ function toPatchFieldName(tableName, table) {
152
152
  * "id" -> "ID_ASC"
153
153
  */
154
154
  function toOrderByEnumValue(fieldName, direction) {
155
- const screaming = (0, inflekt_1.toScreamingSnake)(fieldName);
155
+ const screaming = (0, inflekt_1.toConstantCase)(fieldName);
156
156
  return `${screaming}_${direction.toUpperCase()}`;
157
157
  }
158
158
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/graphql-query",
3
- "version": "3.12.3",
3
+ "version": "3.12.4",
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.17.0",
37
+ "graphile-settings": "^4.17.1",
38
38
  "graphql": "16.13.0",
39
39
  "inflection": "^3.0.0",
40
- "inflekt": "^0.5.1",
40
+ "inflekt": "^0.6.0",
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": "1685145fa37391db10d757911b8a6fd00b8c87e7"
54
+ "gitHead": "93deca687ce109bf90d2a0a73ea6b05b22724160"
55
55
  }
package/query-builder.js CHANGED
@@ -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.toCamelCase)(['get', (0, inflekt_1.underscore)(this._key), 'query'].join('_')));
162
+ this.queryName((0, inflekt_1.toCamelCase)(['get', (0, inflekt_1.toSnakeCase)(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.toCamelCase)(['get', (0, inflekt_1.underscore)(this._key), 'query', 'all'].join('_')));
177
+ this.queryName((0, inflekt_1.toCamelCase)(['get', (0, inflekt_1.toSnakeCase)(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.toCamelCase)(['get', (0, inflekt_1.underscore)(this._key), 'count', 'query'].join('_')));
191
+ this.queryName((0, inflekt_1.toCamelCase)(['get', (0, inflekt_1.toSnakeCase)(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.toCamelCase)(['get', (0, inflekt_1.underscore)(this._key), 'query'].join('_')));
203
+ this.queryName((0, inflekt_1.toCamelCase)(['get', (0, inflekt_1.toSnakeCase)(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.toCamelCase)([(0, inflekt_1.underscore)(this._key), 'mutation'].join('_')));
219
+ this.queryName((0, inflekt_1.toCamelCase)([(0, inflekt_1.toSnakeCase)(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.toCamelCase)([(0, inflekt_1.underscore)(this._key), 'mutation'].join('_')));
234
+ this.queryName((0, inflekt_1.toCamelCase)([(0, inflekt_1.toSnakeCase)(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.toCamelCase)([(0, inflekt_1.underscore)(this._key), 'mutation'].join('_')));
248
+ this.queryName((0, inflekt_1.toCamelCase)([(0, inflekt_1.toSnakeCase)(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.toCamelCase)((0, inflekt_1.pluralize)((0, inflekt_1.underscore)(model)));
411
+ return (0, inflekt_1.toCamelCase)((0, inflekt_1.pluralize)((0, inflekt_1.toSnakeCase)(model)));
412
412
  }