@pgpmjs/core 7.3.0 → 7.5.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.
- package/esm/index.js +0 -1
- package/esm/modules/modules.js +0 -1
- package/esm/rebundle/module.js +1 -1
- package/esm/rebundle/rebundle.js +1 -1
- package/esm/workspace/minimal.js +1 -1
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/modules/modules.js +0 -1
- package/package.json +12 -12
- package/rebundle/module.js +1 -1
- package/rebundle/rebundle.js +1 -1
- package/rebundle/types.d.ts +1 -1
- package/workspace/minimal.js +1 -1
- package/esm/slice/index.js +0 -3
- package/esm/slice/output.js +0 -117
- package/esm/slice/slice.js +0 -503
- package/esm/slice/types.js +0 -1
- package/slice/index.d.ts +0 -3
- package/slice/index.js +0 -19
- package/slice/output.d.ts +0 -22
- package/slice/output.js +0 -124
- package/slice/slice.d.ts +0 -59
- package/slice/slice.js +0 -519
- package/slice/types.d.ts +0 -148
- package/slice/types.js +0 -2
package/esm/index.js
CHANGED
package/esm/modules/modules.js
CHANGED
|
@@ -12,7 +12,6 @@ export const PGPM_MODULE_MAP = {
|
|
|
12
12
|
'pgpm-function-resolution': '@pgpm/function-resolution',
|
|
13
13
|
'metaschema-modules': '@pgpm/metaschema-modules',
|
|
14
14
|
'metaschema-schema': '@pgpm/metaschema-schema',
|
|
15
|
-
'services': '@pgpm/services',
|
|
16
15
|
'pgpm-inflection': '@pgpm/inflection',
|
|
17
16
|
'pgpm-jwt-claims': '@pgpm/jwt-claims',
|
|
18
17
|
'pgpm-stamps': '@pgpm/stamps',
|
package/esm/rebundle/module.js
CHANGED
|
@@ -2,7 +2,7 @@ import { copyFileSync, existsSync, mkdirSync, readdirSync, writeFileSync } from
|
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { parsePlanFile } from '@pgpmjs/ast/files/plan/parser';
|
|
4
4
|
import { mergeSqlStatements, packageModule } from '../packaging/package';
|
|
5
|
-
import { generatePlanContent } from '
|
|
5
|
+
import { generatePlanContent } from '@pgpmjs/slice';
|
|
6
6
|
import { assembleChunkSql, rebundlePlan } from './rebundle';
|
|
7
7
|
export const SCRIPT_DIRS = ['deploy', 'revert', 'verify'];
|
|
8
8
|
/**
|
package/esm/rebundle/rebundle.js
CHANGED
|
@@ -2,8 +2,8 @@ import { readFileSync } from 'fs';
|
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { getChanges } from '@pgpmjs/ast/files/plan/parser';
|
|
4
4
|
import { resolveWithPlan } from '../resolution/resolve';
|
|
5
|
-
import { buildDependencyGraph, buildPackageDependencies, computeDeployOrder, detectPackageCycle, extractPackageFromPath, } from '../slice/slice';
|
|
6
5
|
import { parsePlanFile } from '@pgpmjs/ast/files/plan/parser';
|
|
6
|
+
import { buildDependencyGraph, buildPackageDependencies, computeDeployOrder, detectPackageCycle, extractPackageFromPath, } from '@pgpmjs/slice';
|
|
7
7
|
/**
|
|
8
8
|
* Derive the boundary key for a change under the given strategy.
|
|
9
9
|
* Consecutive changes sharing a key may be merged into the same chunk.
|
package/esm/workspace/minimal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { generatePlanContent } from '
|
|
3
|
+
import { generatePlanContent } from '@pgpmjs/slice';
|
|
4
4
|
const SCRIPT_DIRS = ['deploy', 'revert', 'verify'];
|
|
5
5
|
/**
|
|
6
6
|
* The minimal set of files pgpm needs to recognize and deploy a module:
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -16,7 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.withTransaction = exports.executeQuery = exports.hashString = exports.hashFile = exports.parseAuthor = exports.PgpmInit = exports.PgpmMigrate = exports.cleanSql = void 0;
|
|
18
18
|
__exportStar(require("./core/class/pgpm"), exports);
|
|
19
|
-
__exportStar(require("./slice"), exports);
|
|
20
19
|
__exportStar(require("./rebundle"), exports);
|
|
21
20
|
__exportStar(require("./extensions/extensions"), exports);
|
|
22
21
|
__exportStar(require("./modules/modules"), exports);
|
package/modules/modules.js
CHANGED
|
@@ -15,7 +15,6 @@ exports.PGPM_MODULE_MAP = {
|
|
|
15
15
|
'pgpm-function-resolution': '@pgpm/function-resolution',
|
|
16
16
|
'metaschema-modules': '@pgpm/metaschema-modules',
|
|
17
17
|
'metaschema-schema': '@pgpm/metaschema-schema',
|
|
18
|
-
'services': '@pgpm/services',
|
|
19
18
|
'pgpm-inflection': '@pgpm/inflection',
|
|
20
19
|
'pgpm-jwt-claims': '@pgpm/jwt-claims',
|
|
21
20
|
'pgpm-stamps': '@pgpm/stamps',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgpmjs/core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.0",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "PGPM Package and Migration Tools",
|
|
6
6
|
"main": "index.js",
|
|
@@ -48,23 +48,23 @@
|
|
|
48
48
|
"makage": "^0.3.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@pgpmjs/ast": "^0.
|
|
52
|
-
"@pgpmjs/bundle": "^0.2
|
|
53
|
-
"@pgpmjs/env": "^2.
|
|
54
|
-
"@pgpmjs/logger": "^2.
|
|
55
|
-
"@pgpmjs/server-utils": "^3.
|
|
56
|
-
"@pgpmjs/
|
|
57
|
-
"
|
|
51
|
+
"@pgpmjs/ast": "^0.2.2",
|
|
52
|
+
"@pgpmjs/bundle": "^0.3.2",
|
|
53
|
+
"@pgpmjs/env": "^2.30.2",
|
|
54
|
+
"@pgpmjs/logger": "^2.15.2",
|
|
55
|
+
"@pgpmjs/server-utils": "^3.16.2",
|
|
56
|
+
"@pgpmjs/slice": "^0.2.0",
|
|
57
|
+
"@pgpmjs/types": "^2.37.2",
|
|
58
|
+
"csv-to-pg": "^4.1.2",
|
|
58
59
|
"genomic": "^5.6.2",
|
|
59
60
|
"glob": "^13.0.6",
|
|
60
|
-
"minimatch": "^10.2.5",
|
|
61
61
|
"parse-package-name": "^1.0.0",
|
|
62
62
|
"pg": "^8.21.0",
|
|
63
|
-
"pg-cache": "^3.
|
|
64
|
-
"pg-env": "^1.
|
|
63
|
+
"pg-cache": "^3.16.2",
|
|
64
|
+
"pg-env": "^1.19.2",
|
|
65
65
|
"pgsql-deparser": "^18.1.1",
|
|
66
66
|
"pgsql-parser": "^18.1.1",
|
|
67
67
|
"yanse": "^0.2.1"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "cc1b2af2c73c23b99a221e6bd8a8ba76c7ce79e6"
|
|
70
70
|
}
|
package/rebundle/module.js
CHANGED
|
@@ -7,7 +7,7 @@ const fs_1 = require("fs");
|
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const parser_1 = require("@pgpmjs/ast/files/plan/parser");
|
|
9
9
|
const package_1 = require("../packaging/package");
|
|
10
|
-
const slice_1 = require("
|
|
10
|
+
const slice_1 = require("@pgpmjs/slice");
|
|
11
11
|
const rebundle_1 = require("./rebundle");
|
|
12
12
|
exports.SCRIPT_DIRS = ['deploy', 'revert', 'verify'];
|
|
13
13
|
/**
|
package/rebundle/rebundle.js
CHANGED
|
@@ -7,8 +7,8 @@ const fs_1 = require("fs");
|
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const parser_1 = require("@pgpmjs/ast/files/plan/parser");
|
|
9
9
|
const resolve_1 = require("../resolution/resolve");
|
|
10
|
-
const slice_1 = require("../slice/slice");
|
|
11
10
|
const parser_2 = require("@pgpmjs/ast/files/plan/parser");
|
|
11
|
+
const slice_1 = require("@pgpmjs/slice");
|
|
12
12
|
/**
|
|
13
13
|
* Derive the boundary key for a change under the given strategy.
|
|
14
14
|
* Consecutive changes sharing a key may be merged into the same chunk.
|
package/rebundle/types.d.ts
CHANGED
package/workspace/minimal.js
CHANGED
|
@@ -9,7 +9,7 @@ exports.generateModuleControl = generateModuleControl;
|
|
|
9
9
|
exports.generateModuleMakefile = generateModuleMakefile;
|
|
10
10
|
const fs_1 = __importDefault(require("fs"));
|
|
11
11
|
const path_1 = __importDefault(require("path"));
|
|
12
|
-
const slice_1 = require("
|
|
12
|
+
const slice_1 = require("@pgpmjs/slice");
|
|
13
13
|
const SCRIPT_DIRS = ['deploy', 'revert', 'verify'];
|
|
14
14
|
/**
|
|
15
15
|
* The minimal set of files pgpm needs to recognize and deploy a module:
|
package/esm/slice/index.js
DELETED
package/esm/slice/output.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
/**
|
|
4
|
-
* Write sliced packages to disk
|
|
5
|
-
*/
|
|
6
|
-
export function writeSliceResult(result, options) {
|
|
7
|
-
const { outputDir, overwrite = false, copySourceFiles = false, sourceDir } = options;
|
|
8
|
-
// Create output directory
|
|
9
|
-
fs.mkdirSync(outputDir, { recursive: true });
|
|
10
|
-
// Write each package
|
|
11
|
-
for (const pkg of result.packages) {
|
|
12
|
-
writePackage(pkg, outputDir, overwrite, copySourceFiles, sourceDir);
|
|
13
|
-
}
|
|
14
|
-
// Write workspace manifest
|
|
15
|
-
const manifestPath = path.join(outputDir, 'pgpm-workspace.json');
|
|
16
|
-
const manifestContent = JSON.stringify({
|
|
17
|
-
packages: result.workspace.packages.map(p => `packages/${p}`),
|
|
18
|
-
slicing: {
|
|
19
|
-
deployOrder: result.workspace.deployOrder,
|
|
20
|
-
dependencies: result.workspace.dependencies
|
|
21
|
-
},
|
|
22
|
-
stats: result.stats
|
|
23
|
-
}, null, 2);
|
|
24
|
-
fs.writeFileSync(manifestPath, manifestContent);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Write a single package to disk
|
|
28
|
-
*/
|
|
29
|
-
function writePackage(pkg, outputDir, overwrite, copySourceFiles, sourceDir) {
|
|
30
|
-
const pkgDir = path.join(outputDir, 'packages', pkg.name);
|
|
31
|
-
// Check if package already exists
|
|
32
|
-
if (fs.existsSync(pkgDir) && !overwrite) {
|
|
33
|
-
throw new Error(`Package directory already exists: ${pkgDir}. Use --overwrite to replace.`);
|
|
34
|
-
}
|
|
35
|
-
// Create package directory structure
|
|
36
|
-
fs.mkdirSync(pkgDir, { recursive: true });
|
|
37
|
-
fs.mkdirSync(path.join(pkgDir, 'deploy'), { recursive: true });
|
|
38
|
-
fs.mkdirSync(path.join(pkgDir, 'revert'), { recursive: true });
|
|
39
|
-
fs.mkdirSync(path.join(pkgDir, 'verify'), { recursive: true });
|
|
40
|
-
// Write plan file
|
|
41
|
-
fs.writeFileSync(path.join(pkgDir, 'pgpm.plan'), pkg.planContent);
|
|
42
|
-
// Write control file
|
|
43
|
-
fs.writeFileSync(path.join(pkgDir, `${pkg.name}.control`), pkg.controlContent);
|
|
44
|
-
// Copy SQL files if requested
|
|
45
|
-
if (copySourceFiles && sourceDir) {
|
|
46
|
-
for (const change of pkg.changes) {
|
|
47
|
-
copyChangeFiles(change.name, sourceDir, pkgDir);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Copy deploy/revert/verify SQL files for a change
|
|
53
|
-
*/
|
|
54
|
-
function copyChangeFiles(changeName, sourceDir, targetDir) {
|
|
55
|
-
const types = ['deploy', 'revert', 'verify'];
|
|
56
|
-
for (const type of types) {
|
|
57
|
-
const sourceFile = path.join(sourceDir, type, `${changeName}.sql`);
|
|
58
|
-
const targetFile = path.join(targetDir, type, `${changeName}.sql`);
|
|
59
|
-
if (fs.existsSync(sourceFile)) {
|
|
60
|
-
// Create target directory if needed
|
|
61
|
-
const targetSubDir = path.dirname(targetFile);
|
|
62
|
-
fs.mkdirSync(targetSubDir, { recursive: true });
|
|
63
|
-
// Copy file
|
|
64
|
-
fs.copyFileSync(sourceFile, targetFile);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Generate a dry-run report of what would be created
|
|
70
|
-
*/
|
|
71
|
-
export function generateDryRunReport(result) {
|
|
72
|
-
const lines = [];
|
|
73
|
-
lines.push('=== PGPM Slice Dry Run Report ===\n');
|
|
74
|
-
// Statistics
|
|
75
|
-
lines.push('Statistics:');
|
|
76
|
-
lines.push(` Total changes: ${result.stats.totalChanges}`);
|
|
77
|
-
lines.push(` Packages to create: ${result.stats.packagesCreated}`);
|
|
78
|
-
lines.push(` Internal edges: ${result.stats.internalEdges}`);
|
|
79
|
-
lines.push(` Cross-package edges: ${result.stats.crossPackageEdges}`);
|
|
80
|
-
lines.push(` Cross-package ratio: ${(result.stats.crossPackageRatio * 100).toFixed(1)}%`);
|
|
81
|
-
lines.push('');
|
|
82
|
-
// Warnings
|
|
83
|
-
if (result.warnings.length > 0) {
|
|
84
|
-
lines.push('Warnings:');
|
|
85
|
-
for (const warning of result.warnings) {
|
|
86
|
-
lines.push(` [${warning.type}] ${warning.message}`);
|
|
87
|
-
if (warning.suggestedAction) {
|
|
88
|
-
lines.push(` Suggestion: ${warning.suggestedAction}`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
lines.push('');
|
|
92
|
-
}
|
|
93
|
-
// Deploy order
|
|
94
|
-
lines.push('Deploy Order:');
|
|
95
|
-
for (let i = 0; i < result.workspace.deployOrder.length; i++) {
|
|
96
|
-
const pkg = result.workspace.deployOrder[i];
|
|
97
|
-
const deps = result.workspace.dependencies[pkg] || [];
|
|
98
|
-
const depStr = deps.length > 0 ? ` (depends on: ${deps.join(', ')})` : '';
|
|
99
|
-
lines.push(` ${i + 1}. ${pkg}${depStr}`);
|
|
100
|
-
}
|
|
101
|
-
lines.push('');
|
|
102
|
-
// Package details
|
|
103
|
-
lines.push('Packages:');
|
|
104
|
-
for (const pkg of result.packages) {
|
|
105
|
-
lines.push(`\n ${pkg.name}/`);
|
|
106
|
-
lines.push(` Changes: ${pkg.changes.length}`);
|
|
107
|
-
lines.push(` Dependencies: ${pkg.packageDependencies.join(', ') || 'none'}`);
|
|
108
|
-
lines.push(' Contents:');
|
|
109
|
-
for (const change of pkg.changes.slice(0, 5)) {
|
|
110
|
-
lines.push(` - ${change.name}`);
|
|
111
|
-
}
|
|
112
|
-
if (pkg.changes.length > 5) {
|
|
113
|
-
lines.push(` ... and ${pkg.changes.length - 5} more`);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return lines.join('\n');
|
|
117
|
-
}
|