graphile-settings 4.15.0 → 4.16.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.
@@ -1,4 +1,4 @@
1
- import { singularize, singularizeLast, pluralizeLast, distinctPluralize, fixCapitalisedPlural, camelize, } from 'inflekt';
1
+ import { singularize, singularizeLast, pluralizeLast, distinctPluralize, fixCapitalisedPlural, toCamelCase, } from 'inflekt';
2
2
  /**
3
3
  * Custom inflector plugin for Constructive using the inflekt library.
4
4
  *
@@ -43,7 +43,7 @@ function getBaseName(attributeName) {
43
43
  */
44
44
  function baseNameMatches(baseName, otherName) {
45
45
  const singularizedName = singularize(otherName);
46
- return camelize(baseName, true) === camelize(singularizedName, true);
46
+ return toCamelCase(baseName) === toCamelCase(singularizedName);
47
47
  }
48
48
  /**
49
49
  * Get the opposite name for a relation base name
@@ -173,14 +173,14 @@ export const InflektPlugin = {
173
173
  */
174
174
  allRowsConnection(_previous, _options, resource) {
175
175
  const resourceName = this._singularizedResourceName(resource);
176
- return camelize(distinctPluralize(resourceName), true);
176
+ return toCamelCase(distinctPluralize(resourceName));
177
177
  },
178
178
  /**
179
179
  * Simplify root query list fields
180
180
  */
181
181
  allRowsList(_previous, _options, resource) {
182
182
  const resourceName = this._singularizedResourceName(resource);
183
- return camelize(distinctPluralize(resourceName), true) + 'List';
183
+ return toCamelCase(distinctPluralize(resourceName)) + 'List';
184
184
  },
185
185
  /**
186
186
  * Simplify single relation field names (userByAuthorId -> author)
@@ -199,14 +199,14 @@ export const InflektPlugin = {
199
199
  const attributeName = relation.localAttributes[0];
200
200
  const baseName = getBaseName(attributeName);
201
201
  if (baseName) {
202
- return camelize(baseName, true);
202
+ return toCamelCase(baseName);
203
203
  }
204
204
  }
205
205
  // Fall back to the remote resource name
206
206
  const foreignPk = relation.remoteResource.uniques.find((u) => u.isPrimary);
207
207
  if (foreignPk &&
208
208
  arraysMatch(foreignPk.attributes, relation.remoteAttributes)) {
209
- return camelize(this._singularizedCodecName(relation.remoteResource.codec), true);
209
+ return toCamelCase(this._singularizedCodecName(relation.remoteResource.codec));
210
210
  }
211
211
  return previous(details);
212
212
  },
@@ -232,10 +232,10 @@ export const InflektPlugin = {
232
232
  if (baseName) {
233
233
  const oppositeBaseName = getOppositeBaseName(baseName);
234
234
  if (oppositeBaseName) {
235
- return camelize(`${oppositeBaseName}_${this._singularizedCodecName(relation.remoteResource.codec)}`, true);
235
+ return toCamelCase(`${oppositeBaseName}_${this._singularizedCodecName(relation.remoteResource.codec)}`);
236
236
  }
237
237
  if (baseNameMatches(baseName, codec.name)) {
238
- return camelize(this._singularizedCodecName(relation.remoteResource.codec), true);
238
+ return toCamelCase(this._singularizedCodecName(relation.remoteResource.codec));
239
239
  }
240
240
  }
241
241
  }
@@ -261,17 +261,17 @@ export const InflektPlugin = {
261
261
  if (baseName) {
262
262
  const oppositeBaseName = getOppositeBaseName(baseName);
263
263
  if (oppositeBaseName) {
264
- return camelize(`${oppositeBaseName}_${distinctPluralize(this._singularizedCodecName(relation.remoteResource.codec))}`, true);
264
+ return toCamelCase(`${oppositeBaseName}_${distinctPluralize(this._singularizedCodecName(relation.remoteResource.codec))}`);
265
265
  }
266
266
  if (baseNameMatches(baseName, codec.name)) {
267
- return camelize(distinctPluralize(this._singularizedCodecName(relation.remoteResource.codec)), true);
267
+ return toCamelCase(distinctPluralize(this._singularizedCodecName(relation.remoteResource.codec)));
268
268
  }
269
269
  }
270
270
  }
271
271
  // Fall back to pluralized remote resource name
272
272
  const pk = relation.remoteResource.uniques.find((u) => u.isPrimary);
273
273
  if (pk && arraysMatch(pk.attributes, relation.remoteAttributes)) {
274
- return camelize(distinctPluralize(this._singularizedCodecName(relation.remoteResource.codec)), true);
274
+ return toCamelCase(distinctPluralize(this._singularizedCodecName(relation.remoteResource.codec)));
275
275
  }
276
276
  return previous(details);
277
277
  },
@@ -296,7 +296,7 @@ export const InflektPlugin = {
296
296
  if (typeof baseOverride === 'string') {
297
297
  return baseOverride;
298
298
  }
299
- const simpleName = camelize(distinctPluralize(this._singularizedCodecName(rightTable.codec)), true);
299
+ const simpleName = toCamelCase(distinctPluralize(this._singularizedCodecName(rightTable.codec)));
300
300
  const leftRelations = leftTable.getRelations();
301
301
  let hasDirectRelation = false;
302
302
  let manyToManyCount = 0;
@@ -331,7 +331,7 @@ export const InflektPlugin = {
331
331
  return unique.extensions?.tags?.fieldName;
332
332
  }
333
333
  if (unique.isPrimary) {
334
- return camelize(this._singularizedCodecName(resource.codec), true);
334
+ return toCamelCase(this._singularizedCodecName(resource.codec));
335
335
  }
336
336
  return previous(details);
337
337
  },
@@ -344,7 +344,7 @@ export const InflektPlugin = {
344
344
  return unique.extensions.tags.updateFieldName;
345
345
  }
346
346
  if (unique.isPrimary) {
347
- return camelize(`update_${this._singularizedCodecName(resource.codec)}`, true);
347
+ return toCamelCase(`update_${this._singularizedCodecName(resource.codec)}`);
348
348
  }
349
349
  return previous(details);
350
350
  },
@@ -357,7 +357,7 @@ export const InflektPlugin = {
357
357
  return unique.extensions.tags.deleteFieldName;
358
358
  }
359
359
  if (unique.isPrimary) {
360
- return camelize(`delete_${this._singularizedCodecName(resource.codec)}`, true);
360
+ return toCamelCase(`delete_${this._singularizedCodecName(resource.codec)}`);
361
361
  }
362
362
  return previous(details);
363
363
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphile-settings",
3
- "version": "4.15.0",
3
+ "version": "4.16.0",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "graphile settings",
6
6
  "main": "index.js",
@@ -29,15 +29,15 @@
29
29
  "test:watch": "jest --watch"
30
30
  },
31
31
  "dependencies": {
32
- "@constructive-io/graphql-env": "^3.4.4",
33
- "@constructive-io/graphql-types": "^3.3.4",
34
- "@constructive-io/s3-streamer": "^2.16.4",
35
- "@constructive-io/upload-names": "^2.9.3",
32
+ "@constructive-io/graphql-env": "^3.5.0",
33
+ "@constructive-io/graphql-types": "^3.4.0",
34
+ "@constructive-io/s3-streamer": "^2.17.0",
35
+ "@constructive-io/upload-names": "^2.10.0",
36
36
  "@dataplan/json": "1.0.0-rc.6",
37
37
  "@dataplan/pg": "1.0.0-rc.8",
38
38
  "@graphile-contrib/pg-many-to-many": "2.0.0-rc.2",
39
- "@pgpmjs/logger": "^2.4.3",
40
- "@pgpmjs/types": "^2.19.3",
39
+ "@pgpmjs/logger": "^2.5.0",
40
+ "@pgpmjs/types": "^2.20.0",
41
41
  "@pgsql/quotes": "^17.1.0",
42
42
  "cors": "^2.8.6",
43
43
  "express": "^5.2.1",
@@ -46,17 +46,17 @@
46
46
  "graphile-build": "5.0.0-rc.6",
47
47
  "graphile-build-pg": "5.0.0-rc.8",
48
48
  "graphile-config": "1.0.0-rc.6",
49
- "graphile-connection-filter": "^1.2.3",
50
- "graphile-postgis": "^2.8.3",
51
- "graphile-search": "^1.4.3",
52
- "graphile-sql-expression-validator": "^2.5.0",
53
- "graphile-upload-plugin": "^2.4.4",
49
+ "graphile-connection-filter": "^1.3.0",
50
+ "graphile-postgis": "^2.9.0",
51
+ "graphile-search": "^1.5.0",
52
+ "graphile-sql-expression-validator": "^2.6.0",
53
+ "graphile-upload-plugin": "^2.5.0",
54
54
  "graphile-utils": "5.0.0-rc.8",
55
55
  "graphql": "16.13.0",
56
- "inflekt": "^0.5.0",
56
+ "inflekt": "^0.5.1",
57
57
  "lru-cache": "^11.2.7",
58
58
  "pg": "^8.20.0",
59
- "pg-query-context": "^2.8.3",
59
+ "pg-query-context": "^2.9.0",
60
60
  "pg-sql2": "5.0.0-rc.5",
61
61
  "postgraphile": "5.0.0-rc.10",
62
62
  "request-ip": "^3.3.0",
@@ -67,10 +67,10 @@
67
67
  "@types/express": "^5.0.6",
68
68
  "@types/pg": "^8.18.0",
69
69
  "@types/request-ip": "^0.0.41",
70
- "graphile-test": "^4.6.3",
70
+ "graphile-test": "^4.7.0",
71
71
  "makage": "^0.1.10",
72
72
  "nodemon": "^3.1.14",
73
- "pgsql-test": "^4.6.3",
73
+ "pgsql-test": "^4.7.0",
74
74
  "ts-node": "^10.9.2"
75
75
  },
76
76
  "keywords": [
@@ -80,5 +80,5 @@
80
80
  "constructive",
81
81
  "graphql"
82
82
  ],
83
- "gitHead": "2660dbd64e96cdb785ace8b28fbf9275cb3812aa"
83
+ "gitHead": "b8ed57a447cd71b93094edf362e72b94801e5f3a"
84
84
  }
@@ -46,7 +46,7 @@ function getBaseName(attributeName) {
46
46
  */
47
47
  function baseNameMatches(baseName, otherName) {
48
48
  const singularizedName = (0, inflekt_1.singularize)(otherName);
49
- return (0, inflekt_1.camelize)(baseName, true) === (0, inflekt_1.camelize)(singularizedName, true);
49
+ return (0, inflekt_1.toCamelCase)(baseName) === (0, inflekt_1.toCamelCase)(singularizedName);
50
50
  }
51
51
  /**
52
52
  * Get the opposite name for a relation base name
@@ -176,14 +176,14 @@ exports.InflektPlugin = {
176
176
  */
177
177
  allRowsConnection(_previous, _options, resource) {
178
178
  const resourceName = this._singularizedResourceName(resource);
179
- return (0, inflekt_1.camelize)((0, inflekt_1.distinctPluralize)(resourceName), true);
179
+ return (0, inflekt_1.toCamelCase)((0, inflekt_1.distinctPluralize)(resourceName));
180
180
  },
181
181
  /**
182
182
  * Simplify root query list fields
183
183
  */
184
184
  allRowsList(_previous, _options, resource) {
185
185
  const resourceName = this._singularizedResourceName(resource);
186
- return (0, inflekt_1.camelize)((0, inflekt_1.distinctPluralize)(resourceName), true) + 'List';
186
+ return (0, inflekt_1.toCamelCase)((0, inflekt_1.distinctPluralize)(resourceName)) + 'List';
187
187
  },
188
188
  /**
189
189
  * Simplify single relation field names (userByAuthorId -> author)
@@ -202,14 +202,14 @@ exports.InflektPlugin = {
202
202
  const attributeName = relation.localAttributes[0];
203
203
  const baseName = getBaseName(attributeName);
204
204
  if (baseName) {
205
- return (0, inflekt_1.camelize)(baseName, true);
205
+ return (0, inflekt_1.toCamelCase)(baseName);
206
206
  }
207
207
  }
208
208
  // Fall back to the remote resource name
209
209
  const foreignPk = relation.remoteResource.uniques.find((u) => u.isPrimary);
210
210
  if (foreignPk &&
211
211
  arraysMatch(foreignPk.attributes, relation.remoteAttributes)) {
212
- return (0, inflekt_1.camelize)(this._singularizedCodecName(relation.remoteResource.codec), true);
212
+ return (0, inflekt_1.toCamelCase)(this._singularizedCodecName(relation.remoteResource.codec));
213
213
  }
214
214
  return previous(details);
215
215
  },
@@ -235,10 +235,10 @@ exports.InflektPlugin = {
235
235
  if (baseName) {
236
236
  const oppositeBaseName = getOppositeBaseName(baseName);
237
237
  if (oppositeBaseName) {
238
- return (0, inflekt_1.camelize)(`${oppositeBaseName}_${this._singularizedCodecName(relation.remoteResource.codec)}`, true);
238
+ return (0, inflekt_1.toCamelCase)(`${oppositeBaseName}_${this._singularizedCodecName(relation.remoteResource.codec)}`);
239
239
  }
240
240
  if (baseNameMatches(baseName, codec.name)) {
241
- return (0, inflekt_1.camelize)(this._singularizedCodecName(relation.remoteResource.codec), true);
241
+ return (0, inflekt_1.toCamelCase)(this._singularizedCodecName(relation.remoteResource.codec));
242
242
  }
243
243
  }
244
244
  }
@@ -264,17 +264,17 @@ exports.InflektPlugin = {
264
264
  if (baseName) {
265
265
  const oppositeBaseName = getOppositeBaseName(baseName);
266
266
  if (oppositeBaseName) {
267
- return (0, inflekt_1.camelize)(`${oppositeBaseName}_${(0, inflekt_1.distinctPluralize)(this._singularizedCodecName(relation.remoteResource.codec))}`, true);
267
+ return (0, inflekt_1.toCamelCase)(`${oppositeBaseName}_${(0, inflekt_1.distinctPluralize)(this._singularizedCodecName(relation.remoteResource.codec))}`);
268
268
  }
269
269
  if (baseNameMatches(baseName, codec.name)) {
270
- return (0, inflekt_1.camelize)((0, inflekt_1.distinctPluralize)(this._singularizedCodecName(relation.remoteResource.codec)), true);
270
+ return (0, inflekt_1.toCamelCase)((0, inflekt_1.distinctPluralize)(this._singularizedCodecName(relation.remoteResource.codec)));
271
271
  }
272
272
  }
273
273
  }
274
274
  // Fall back to pluralized remote resource name
275
275
  const pk = relation.remoteResource.uniques.find((u) => u.isPrimary);
276
276
  if (pk && arraysMatch(pk.attributes, relation.remoteAttributes)) {
277
- return (0, inflekt_1.camelize)((0, inflekt_1.distinctPluralize)(this._singularizedCodecName(relation.remoteResource.codec)), true);
277
+ return (0, inflekt_1.toCamelCase)((0, inflekt_1.distinctPluralize)(this._singularizedCodecName(relation.remoteResource.codec)));
278
278
  }
279
279
  return previous(details);
280
280
  },
@@ -299,7 +299,7 @@ exports.InflektPlugin = {
299
299
  if (typeof baseOverride === 'string') {
300
300
  return baseOverride;
301
301
  }
302
- const simpleName = (0, inflekt_1.camelize)((0, inflekt_1.distinctPluralize)(this._singularizedCodecName(rightTable.codec)), true);
302
+ const simpleName = (0, inflekt_1.toCamelCase)((0, inflekt_1.distinctPluralize)(this._singularizedCodecName(rightTable.codec)));
303
303
  const leftRelations = leftTable.getRelations();
304
304
  let hasDirectRelation = false;
305
305
  let manyToManyCount = 0;
@@ -334,7 +334,7 @@ exports.InflektPlugin = {
334
334
  return unique.extensions?.tags?.fieldName;
335
335
  }
336
336
  if (unique.isPrimary) {
337
- return (0, inflekt_1.camelize)(this._singularizedCodecName(resource.codec), true);
337
+ return (0, inflekt_1.toCamelCase)(this._singularizedCodecName(resource.codec));
338
338
  }
339
339
  return previous(details);
340
340
  },
@@ -347,7 +347,7 @@ exports.InflektPlugin = {
347
347
  return unique.extensions.tags.updateFieldName;
348
348
  }
349
349
  if (unique.isPrimary) {
350
- return (0, inflekt_1.camelize)(`update_${this._singularizedCodecName(resource.codec)}`, true);
350
+ return (0, inflekt_1.toCamelCase)(`update_${this._singularizedCodecName(resource.codec)}`);
351
351
  }
352
352
  return previous(details);
353
353
  },
@@ -360,7 +360,7 @@ exports.InflektPlugin = {
360
360
  return unique.extensions.tags.deleteFieldName;
361
361
  }
362
362
  if (unique.isPrimary) {
363
- return (0, inflekt_1.camelize)(`delete_${this._singularizedCodecName(resource.codec)}`, true);
363
+ return (0, inflekt_1.toCamelCase)(`delete_${this._singularizedCodecName(resource.codec)}`);
364
364
  }
365
365
  return previous(details);
366
366
  },