@pgpmjs/export 0.2.1 → 0.2.2
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/esm/export-utils.js +1 -1
- package/esm/graphql-naming.js +2 -2
- package/export-utils.js +2 -2
- package/graphql-naming.js +1 -1
- package/package.json +5 -6
package/esm/export-utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mkdirSync, rmSync } from 'fs';
|
|
2
2
|
import { sync as glob } from 'glob';
|
|
3
|
-
import { toSnakeCase } from '
|
|
3
|
+
import { toSnakeCase } from 'inflekt';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import { PgpmPackage, getMissingInstallableModules, parseAuthor } from '@pgpmjs/core';
|
|
6
6
|
// =============================================================================
|
package/esm/graphql-naming.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* db_migrate.sql_actions -> sqlActions
|
|
14
14
|
* column database_id -> databaseId
|
|
15
15
|
*/
|
|
16
|
-
import { toCamelCase, toPascalCase, distinctPluralize, singularizeLast
|
|
16
|
+
import { toCamelCase, toPascalCase, toSnakeCase, distinctPluralize, singularizeLast } 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:
|
|
@@ -32,7 +32,7 @@ export const getGraphQLQueryName = (pgTableName) => {
|
|
|
32
32
|
export const graphqlRowToPostgresRow = (row) => {
|
|
33
33
|
const result = {};
|
|
34
34
|
for (const [key, value] of Object.entries(row)) {
|
|
35
|
-
result[
|
|
35
|
+
result[toSnakeCase(key)] = value;
|
|
36
36
|
}
|
|
37
37
|
return result;
|
|
38
38
|
};
|
package/export-utils.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.normalizeOutdir = exports.preparePackage = exports.makeReplacer = exports.installMissingModules = exports.detectMissingModules = exports.META_TABLE_CONFIG = exports.META_TABLE_ORDER = exports.META_COMMON_FOOTER = exports.META_COMMON_HEADER = exports.SERVICE_REQUIRED_EXTENSIONS = exports.DB_REQUIRED_EXTENSIONS = void 0;
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const glob_1 = require("glob");
|
|
9
|
-
const
|
|
9
|
+
const inflekt_1 = require("inflekt");
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const core_1 = require("@pgpmjs/core");
|
|
12
12
|
// =============================================================================
|
|
@@ -1082,7 +1082,7 @@ const makeReplacer = ({ schemas, name, schemaPrefix }) => {
|
|
|
1082
1082
|
const prefix = schemaPrefix || name;
|
|
1083
1083
|
const schemaReplacers = schemas.map((schema) => [
|
|
1084
1084
|
schema.schema_name,
|
|
1085
|
-
(0,
|
|
1085
|
+
(0, inflekt_1.toSnakeCase)(`${prefix}_${schema.name}`)
|
|
1086
1086
|
]);
|
|
1087
1087
|
const replace = [...schemaReplacers, replacements].map(([from, to]) => [new RegExp(from, 'g'), to]);
|
|
1088
1088
|
const replacer = (str, n = 0) => {
|
package/graphql-naming.js
CHANGED
|
@@ -36,7 +36,7 @@ exports.getGraphQLQueryName = getGraphQLQueryName;
|
|
|
36
36
|
const graphqlRowToPostgresRow = (row) => {
|
|
37
37
|
const result = {};
|
|
38
38
|
for (const [key, value] of Object.entries(row)) {
|
|
39
|
-
result[(0, inflekt_1.
|
|
39
|
+
result[(0, inflekt_1.toSnakeCase)(key)] = value;
|
|
40
40
|
}
|
|
41
41
|
return result;
|
|
42
42
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgpmjs/export",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
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,19 @@
|
|
|
41
41
|
"@pgsql/types": "^17.6.2",
|
|
42
42
|
"@types/pg": "^8.18.0",
|
|
43
43
|
"makage": "^0.1.12",
|
|
44
|
-
"pgsql-test": "^4.7.
|
|
44
|
+
"pgsql-test": "^4.7.2"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@pgpmjs/core": "^6.10.
|
|
47
|
+
"@pgpmjs/core": "^6.10.2",
|
|
48
48
|
"@pgpmjs/migrate-client": "^0.3.1",
|
|
49
49
|
"@pgpmjs/types": "^2.20.1",
|
|
50
50
|
"csv-to-pg": "^3.11.1",
|
|
51
51
|
"glob": "^13.0.6",
|
|
52
|
-
"inflekt": "^0.
|
|
52
|
+
"inflekt": "^0.6.0",
|
|
53
53
|
"inquirerer": "^4.7.0",
|
|
54
|
-
"komoji": "^0.8.1",
|
|
55
54
|
"pg": "^8.20.0",
|
|
56
55
|
"pg-cache": "^3.4.1",
|
|
57
56
|
"pg-env": "^1.8.1"
|
|
58
57
|
},
|
|
59
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "93deca687ce109bf90d2a0a73ea6b05b22724160"
|
|
60
59
|
}
|