@pgpmjs/export 0.1.3 → 0.2.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.
@@ -13,16 +13,16 @@
13
13
  * db_migrate.sql_actions -> sqlActions
14
14
  * column database_id -> databaseId
15
15
  */
16
- import { camelize, distinctPluralize, singularizeLast, underscore } from 'inflekt';
16
+ import { toCamelCase, toPascalCase, distinctPluralize, singularizeLast, underscore } from 'inflekt';
17
17
  /**
18
18
  * Get the GraphQL query field name for a given Postgres table name.
19
19
  * Mirrors the PostGraphile InflektPlugin's allRowsConnection inflector:
20
- * camelize(distinctPluralize(singularizeLast(camelize(pgTableName))), true)
20
+ * toCamelCase(distinctPluralize(singularizeLast(toPascalCase(pgTableName))))
21
21
  */
22
22
  export const getGraphQLQueryName = (pgTableName) => {
23
- const pascal = camelize(pgTableName);
23
+ const pascal = toPascalCase(pgTableName);
24
24
  const singularized = singularizeLast(pascal);
25
- return camelize(distinctPluralize(singularized), true);
25
+ return toCamelCase(distinctPluralize(singularized));
26
26
  };
27
27
  /**
28
28
  * Convert a row of GraphQL camelCase keys back to Postgres snake_case keys.
@@ -66,7 +66,7 @@ export const intervalToPostgres = (interval) => {
66
66
  */
67
67
  export const buildFieldsFragment = (pgFieldNames, fieldTypes) => {
68
68
  return pgFieldNames.map(name => {
69
- const camel = camelize(name, true);
69
+ const camel = toCamelCase(name);
70
70
  const fieldType = fieldTypes?.[name];
71
71
  if (fieldType === 'interval') {
72
72
  return `${camel} { seconds minutes hours days months years }`;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Get the GraphQL query field name for a given Postgres table name.
3
3
  * Mirrors the PostGraphile InflektPlugin's allRowsConnection inflector:
4
- * camelize(distinctPluralize(singularizeLast(camelize(pgTableName))), true)
4
+ * toCamelCase(distinctPluralize(singularizeLast(toPascalCase(pgTableName))))
5
5
  */
6
6
  export declare const getGraphQLQueryName: (pgTableName: string) => string;
7
7
  /**
package/graphql-naming.js CHANGED
@@ -20,12 +20,12 @@ const inflekt_1 = require("inflekt");
20
20
  /**
21
21
  * Get the GraphQL query field name for a given Postgres table name.
22
22
  * Mirrors the PostGraphile InflektPlugin's allRowsConnection inflector:
23
- * camelize(distinctPluralize(singularizeLast(camelize(pgTableName))), true)
23
+ * toCamelCase(distinctPluralize(singularizeLast(toPascalCase(pgTableName))))
24
24
  */
25
25
  const getGraphQLQueryName = (pgTableName) => {
26
- const pascal = (0, inflekt_1.camelize)(pgTableName);
26
+ const pascal = (0, inflekt_1.toPascalCase)(pgTableName);
27
27
  const singularized = (0, inflekt_1.singularizeLast)(pascal);
28
- return (0, inflekt_1.camelize)((0, inflekt_1.distinctPluralize)(singularized), true);
28
+ return (0, inflekt_1.toCamelCase)((0, inflekt_1.distinctPluralize)(singularized));
29
29
  };
30
30
  exports.getGraphQLQueryName = getGraphQLQueryName;
31
31
  /**
@@ -72,7 +72,7 @@ exports.intervalToPostgres = intervalToPostgres;
72
72
  */
73
73
  const buildFieldsFragment = (pgFieldNames, fieldTypes) => {
74
74
  return pgFieldNames.map(name => {
75
- const camel = (0, inflekt_1.camelize)(name, true);
75
+ const camel = (0, inflekt_1.toCamelCase)(name);
76
76
  const fieldType = fieldTypes?.[name];
77
77
  if (fieldType === 'interval') {
78
78
  return `${camel} { seconds minutes hours days months years }`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgpmjs/export",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "PGPM export tools for SQL and GraphQL database migration extraction",
6
6
  "main": "index.js",
@@ -41,20 +41,20 @@
41
41
  "@pgsql/types": "^17.6.2",
42
42
  "@types/pg": "^8.18.0",
43
43
  "makage": "^0.1.12",
44
- "pgsql-test": "^4.6.3"
44
+ "pgsql-test": "^4.7.0"
45
45
  },
46
46
  "dependencies": {
47
- "@pgpmjs/core": "^6.9.3",
48
- "@pgpmjs/migrate-client": "^0.2.2",
49
- "@pgpmjs/types": "^2.19.3",
50
- "csv-to-pg": "^3.10.6",
47
+ "@pgpmjs/core": "^6.10.0",
48
+ "@pgpmjs/migrate-client": "^0.3.0",
49
+ "@pgpmjs/types": "^2.20.0",
50
+ "csv-to-pg": "^3.11.0",
51
51
  "glob": "^13.0.6",
52
- "inflekt": "^0.3.3",
52
+ "inflekt": "^0.5.1",
53
53
  "inquirerer": "^4.7.0",
54
54
  "komoji": "^0.8.1",
55
55
  "pg": "^8.20.0",
56
- "pg-cache": "^3.3.4",
57
- "pg-env": "^1.7.3"
56
+ "pg-cache": "^3.4.0",
57
+ "pg-env": "^1.8.0"
58
58
  },
59
- "gitHead": "5454e81276a585118ddf1a512faad6be06dfa2b3"
59
+ "gitHead": "b8ed57a447cd71b93094edf362e72b94801e5f3a"
60
60
  }