@pgpmjs/core 7.21.1 → 7.21.3
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/apply/index.d.ts +1 -1
- package/apply/index.js +1 -1
- package/apply/reuse.js +3 -3
- package/bundle/apply-envelope.js +1 -1
- package/bundle/apply.d.ts +1 -1
- package/bundle/apply.js +1 -1
- package/bundle/artifact.js +2 -2
- package/bundle/deploy-bundled.js +1 -1
- package/core/class/pgpm.d.ts +2 -2
- package/core/class/pgpm.js +12 -10
- package/core/template-scaffold.d.ts +1 -1
- package/core/template-scaffold.js +1 -1
- package/esm/apply/index.js +1 -1
- package/esm/apply/reuse.js +3 -3
- package/esm/bundle/apply-envelope.js +1 -1
- package/esm/bundle/apply.js +1 -1
- package/esm/bundle/artifact.js +2 -2
- package/esm/bundle/deploy-bundled.js +2 -2
- package/esm/core/class/pgpm.js +12 -10
- package/esm/core/template-scaffold.js +1 -1
- package/esm/index.js +11 -11
- package/esm/init/client.js +1 -1
- package/esm/migrate/clean.js +1 -1
- package/esm/migrate/client.js +2 -1
- package/esm/packaging/check.js +1 -1
- package/esm/packaging/package.js +24 -7
- package/esm/packaging/sync-versions.js +1 -1
- package/esm/packaging/transform.js +2 -2
- package/esm/projects/deploy.js +1 -1
- package/esm/projects/revert.js +1 -1
- package/esm/projects/verify.js +1 -1
- package/esm/rebundle/index.js +2 -2
- package/esm/rebundle/module.js +2 -2
- package/esm/rebundle/rebundle.js +3 -3
- package/esm/rebundle/workspace.js +1 -1
- package/esm/refactor/rename.js +2 -2
- package/esm/resolution/deps.js +3 -3
- package/esm/resolution/resolve.js +2 -2
- package/esm/workspace/minimal.js +1 -1
- package/esm/workspace/utils.js +3 -3
- package/index.d.ts +11 -11
- package/index.js +16 -16
- package/migrate/clean.js +1 -1
- package/migrate/client.js +2 -1
- package/package.json +14 -14
- package/packaging/check.js +1 -1
- package/packaging/package.d.ts +7 -0
- package/packaging/package.js +26 -8
- package/packaging/sync-versions.js +1 -1
- package/packaging/transform.js +2 -2
- package/projects/deploy.js +1 -1
- package/projects/revert.js +1 -1
- package/projects/verify.js +1 -1
- package/rebundle/index.d.ts +2 -2
- package/rebundle/index.js +2 -2
- package/rebundle/module.js +2 -2
- package/rebundle/rebundle.js +3 -3
- package/rebundle/workspace.js +1 -1
- package/refactor/rename.js +2 -2
- package/resolution/deps.js +3 -3
- package/resolution/resolve.js +2 -2
- package/workspace/minimal.js +1 -1
- package/workspace/utils.js +3 -3
package/apply/index.d.ts
CHANGED
package/apply/index.js
CHANGED
|
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./apply-spec"), exports);
|
|
17
18
|
__exportStar(require("./materialize"), exports);
|
|
18
19
|
__exportStar(require("./profile"), exports);
|
|
19
|
-
__exportStar(require("./apply-spec"), exports);
|
|
20
20
|
__exportStar(require("./reuse"), exports);
|
|
21
21
|
__exportStar(require("./types"), exports);
|
package/apply/reuse.js
CHANGED
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isReuseSpec = isReuseSpec;
|
|
4
4
|
exports.resolveSharedModuleName = resolveSharedModuleName;
|
|
5
5
|
exports.materializeReuseModule = materializeReuseModule;
|
|
6
|
-
const fs_1 = require("fs");
|
|
7
|
-
const os_1 = require("os");
|
|
8
|
-
const path_1 = require("path");
|
|
9
6
|
const ast_1 = require("@pgpmjs/ast");
|
|
10
7
|
const bundle_1 = require("@pgpmjs/bundle");
|
|
11
8
|
const slice_1 = require("@pgpmjs/slice");
|
|
12
9
|
const transform_1 = require("@pgpmjs/transform");
|
|
10
|
+
const fs_1 = require("fs");
|
|
11
|
+
const os_1 = require("os");
|
|
12
|
+
const path_1 = require("path");
|
|
13
13
|
/** Whether an apply spec is a reuse (shared/per-tenant split) spec. */
|
|
14
14
|
function isReuseSpec(spec) {
|
|
15
15
|
return spec.reuse !== undefined;
|
package/bundle/apply-envelope.js
CHANGED
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.EnvelopeApplyError = void 0;
|
|
4
4
|
exports.previewEnvelopeApply = previewEnvelopeApply;
|
|
5
5
|
exports.applyEnvelope = applyEnvelope;
|
|
6
|
-
const pg_cache_1 = require("pg-cache");
|
|
7
6
|
const bundle_1 = require("@pgpmjs/bundle");
|
|
7
|
+
const pg_cache_1 = require("pg-cache");
|
|
8
8
|
const apply_1 = require("./apply");
|
|
9
9
|
/**
|
|
10
10
|
* Analyze an envelope apply without executing it: verify the envelope's
|
package/bundle/apply.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PgConfig } from 'pg-env';
|
|
2
1
|
import { PgpmScriptKind } from '@pgpmjs/ast/module/types';
|
|
3
2
|
import { BundleIssue, MigrationBundle } from '@pgpmjs/bundle';
|
|
3
|
+
import { PgConfig } from 'pg-env';
|
|
4
4
|
import { PgpmMigrateOptions } from '../migrate/client';
|
|
5
5
|
import { DeployResult, VerifyResult } from '../migrate/types';
|
|
6
6
|
/** A script whose SQL references something outside the allowed namespace. */
|
package/bundle/apply.js
CHANGED
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BundleApplyError = void 0;
|
|
4
4
|
exports.previewBundleApply = previewBundleApply;
|
|
5
5
|
exports.applyBundle = applyBundle;
|
|
6
|
+
const bundle_1 = require("@pgpmjs/bundle");
|
|
6
7
|
const fs_1 = require("fs");
|
|
7
8
|
const os_1 = require("os");
|
|
8
9
|
const path_1 = require("path");
|
|
9
|
-
const bundle_1 = require("@pgpmjs/bundle");
|
|
10
10
|
const client_1 = require("../migrate/client");
|
|
11
11
|
/**
|
|
12
12
|
* Analyze a bundle apply without executing it: verify artifact integrity, run
|
package/bundle/artifact.js
CHANGED
|
@@ -6,11 +6,11 @@ exports.buildExecutableBundle = buildExecutableBundle;
|
|
|
6
6
|
exports.writeBundleArtifact = writeBundleArtifact;
|
|
7
7
|
exports.bundleMatchesModule = bundleMatchesModule;
|
|
8
8
|
exports.readBundleArtifact = readBundleArtifact;
|
|
9
|
-
const fs_1 = require("fs");
|
|
10
|
-
const path_1 = require("path");
|
|
11
9
|
const ast_1 = require("@pgpmjs/ast");
|
|
12
10
|
const files_1 = require("@pgpmjs/ast/files");
|
|
13
11
|
const bundle_1 = require("@pgpmjs/bundle");
|
|
12
|
+
const fs_1 = require("fs");
|
|
13
|
+
const path_1 = require("path");
|
|
14
14
|
const clean_1 = require("../migrate/clean");
|
|
15
15
|
/**
|
|
16
16
|
* Artifact file name for a module's stored bundle: it lives beside the packaged
|
package/bundle/deploy-bundled.js
CHANGED
|
@@ -4,8 +4,8 @@ exports.BundledDeployConflictError = void 0;
|
|
|
4
4
|
exports.ledgerHashForChange = ledgerHashForChange;
|
|
5
5
|
exports.deployModuleFast = deployModuleFast;
|
|
6
6
|
exports.isBundledDeployResult = isBundledDeployResult;
|
|
7
|
-
const logger_1 = require("@pgpmjs/logger");
|
|
8
7
|
const bundle_1 = require("@pgpmjs/bundle");
|
|
8
|
+
const logger_1 = require("@pgpmjs/logger");
|
|
9
9
|
const pg_cache_1 = require("pg-cache");
|
|
10
10
|
const client_1 = require("../migrate/client");
|
|
11
11
|
const artifact_1 = require("./artifact");
|
package/core/class/pgpm.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PgpmOptions, PgpmWorkspaceConfig } from '@pgpmjs/types';
|
|
2
|
-
import { PgConfig } from 'pg-env';
|
|
3
1
|
import { ExtensionInfo } from '@pgpmjs/ast/files';
|
|
4
2
|
import { PackageAnalysisResult, RenameOptions } from '@pgpmjs/ast/files/types';
|
|
3
|
+
import { PgpmOptions, PgpmWorkspaceConfig } from '@pgpmjs/types';
|
|
4
|
+
import { PgConfig } from 'pg-env';
|
|
5
5
|
import { ModuleMap } from '../../modules/modules';
|
|
6
6
|
import { SyncVersionsOptions, SyncVersionsResult } from '../../packaging/sync-versions';
|
|
7
7
|
/**
|
package/core/class/pgpm.js
CHANGED
|
@@ -37,6 +37,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.PgpmPackage = exports.PackageContext = void 0;
|
|
40
|
+
const files_1 = require("@pgpmjs/ast/files");
|
|
41
|
+
const files_2 = require("@pgpmjs/ast/files");
|
|
42
|
+
const writer_1 = require("@pgpmjs/ast/files/extension/writer");
|
|
43
|
+
const generator_1 = require("@pgpmjs/ast/files/plan/generator");
|
|
44
|
+
const parser_1 = require("@pgpmjs/ast/files/plan/parser");
|
|
45
|
+
const validators_1 = require("@pgpmjs/ast/files/plan/validators");
|
|
40
46
|
const env_1 = require("@pgpmjs/env");
|
|
41
47
|
const logger_1 = require("@pgpmjs/logger");
|
|
42
48
|
const types_1 = require("@pgpmjs/types");
|
|
@@ -48,22 +54,16 @@ const parse_package_name_1 = require("parse-package-name");
|
|
|
48
54
|
const path_1 = __importStar(require("path"));
|
|
49
55
|
const pg_cache_1 = require("pg-cache");
|
|
50
56
|
const yanse_1 = __importDefault(require("yanse"));
|
|
51
|
-
const materialize_1 = require("../../apply/materialize");
|
|
52
57
|
const apply_spec_1 = require("../../apply/apply-spec");
|
|
58
|
+
const materialize_1 = require("../../apply/materialize");
|
|
53
59
|
const reuse_1 = require("../../apply/reuse");
|
|
54
60
|
const types_2 = require("../../apply/types");
|
|
61
|
+
const deploy_bundled_1 = require("../../bundle/deploy-bundled");
|
|
55
62
|
const extensions_1 = require("../../extensions/extensions");
|
|
56
|
-
const
|
|
57
|
-
const files_2 = require("@pgpmjs/ast/files");
|
|
58
|
-
const writer_1 = require("@pgpmjs/ast/files/extension/writer");
|
|
59
|
-
const generator_1 = require("@pgpmjs/ast/files/plan/generator");
|
|
60
|
-
const parser_1 = require("@pgpmjs/ast/files/plan/parser");
|
|
61
|
-
const validators_1 = require("@pgpmjs/ast/files/plan/validators");
|
|
63
|
+
const resolve_install_1 = require("../../extensions/resolve-install");
|
|
62
64
|
const client_1 = require("../../migrate/client");
|
|
63
65
|
const modules_1 = require("../../modules/modules");
|
|
64
|
-
const deploy_bundled_1 = require("../../bundle/deploy-bundled");
|
|
65
66
|
const sync_versions_1 = require("../../packaging/sync-versions");
|
|
66
|
-
const resolve_install_1 = require("../../extensions/resolve-install");
|
|
67
67
|
const deps_1 = require("../../resolution/deps");
|
|
68
68
|
const fs_2 = require("../../utils/fs");
|
|
69
69
|
const glob_1 = require("../../utils/glob");
|
|
@@ -625,7 +625,9 @@ class PgpmPackage {
|
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
|
-
catch {
|
|
628
|
+
catch {
|
|
629
|
+
// ignore
|
|
630
|
+
}
|
|
629
631
|
}
|
|
630
632
|
if (!hasTagDependency && !deps[firstKey].includes(depToken)) {
|
|
631
633
|
deps[firstKey].push(depToken);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BoilerplateConfig as GenomicBoilerplateConfig } from 'genomic';
|
|
2
2
|
export type { BoilerplateSkill } from 'genomic';
|
|
3
|
+
export type { SkillInstallFailure, SkillInstallOptions, SkillInstallResult } from 'genomic';
|
|
3
4
|
export { SkillInstaller } from 'genomic';
|
|
4
|
-
export type { SkillInstallOptions, SkillInstallResult, SkillInstallFailure } from 'genomic';
|
|
5
5
|
import type { Inquirerer, Question } from 'inquirerer';
|
|
6
6
|
/**
|
|
7
7
|
* Supported workspace types for template requirements.
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.DEFAULT_TEMPLATE_TOOL_NAME = exports.DEFAULT_TEMPLATE_TTL_MS = exports.DEFAULT_TEMPLATE_REPO = exports.TEMPLATE_REPOS = exports.SkillInstaller = void 0;
|
|
7
7
|
exports.inspectTemplate = inspectTemplate;
|
|
8
8
|
exports.scaffoldTemplate = scaffoldTemplate;
|
|
9
|
+
const genomic_1 = require("genomic");
|
|
9
10
|
const os_1 = __importDefault(require("os"));
|
|
10
11
|
const path_1 = __importDefault(require("path"));
|
|
11
|
-
const genomic_1 = require("genomic");
|
|
12
12
|
var genomic_2 = require("genomic");
|
|
13
13
|
Object.defineProperty(exports, "SkillInstaller", { enumerable: true, get: function () { return genomic_2.SkillInstaller; } });
|
|
14
14
|
/**
|
package/esm/apply/index.js
CHANGED
package/esm/apply/reuse.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { mkdtempSync } from 'fs';
|
|
2
|
-
import { tmpdir } from 'os';
|
|
3
|
-
import { join } from 'path';
|
|
4
1
|
import { hashString } from '@pgpmjs/ast';
|
|
5
2
|
import { bundleFromModule, materializeBundle, splitBundle, transpileBundle, verifyBundle } from '@pgpmjs/bundle';
|
|
6
3
|
import { partitionModule } from '@pgpmjs/slice';
|
|
7
4
|
import { loadModule, makeSchemaTranspiler } from '@pgpmjs/transform';
|
|
5
|
+
import { mkdtempSync } from 'fs';
|
|
6
|
+
import { tmpdir } from 'os';
|
|
7
|
+
import { join } from 'path';
|
|
8
8
|
/** Whether an apply spec is a reuse (shared/per-tenant split) spec. */
|
|
9
9
|
export function isReuseSpec(spec) {
|
|
10
10
|
return spec.reuse !== undefined;
|
package/esm/bundle/apply.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { materializeBundle, verifyBundle } from '@pgpmjs/bundle';
|
|
1
2
|
import { mkdtempSync, rmSync } from 'fs';
|
|
2
3
|
import { tmpdir } from 'os';
|
|
3
4
|
import { join } from 'path';
|
|
4
|
-
import { materializeBundle, verifyBundle } from '@pgpmjs/bundle';
|
|
5
5
|
import { PgpmMigrate } from '../migrate/client';
|
|
6
6
|
/**
|
|
7
7
|
* Analyze a bundle apply without executing it: verify artifact integrity, run
|
package/esm/bundle/artifact.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { existsSync, readdirSync, readFileSync } from 'fs';
|
|
2
|
-
import { join } from 'path';
|
|
3
1
|
import { hashString } from '@pgpmjs/ast';
|
|
4
2
|
import { getExtensionName, parseControlContent } from '@pgpmjs/ast/files';
|
|
5
3
|
import { BUNDLE_ARCHIVE_EXTENSION, bundleFromModule, readBundleArchiveFile, withExecutableSql, writeBundleArchiveFile } from '@pgpmjs/bundle';
|
|
4
|
+
import { existsSync, readdirSync, readFileSync } from 'fs';
|
|
5
|
+
import { join } from 'path';
|
|
6
6
|
import { cleanSql } from '../migrate/clean';
|
|
7
7
|
/**
|
|
8
8
|
* Artifact file name for a module's stored bundle: it lives beside the packaged
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Logger } from '@pgpmjs/logger';
|
|
2
1
|
import { verifyBundle } from '@pgpmjs/bundle';
|
|
2
|
+
import { Logger } from '@pgpmjs/logger';
|
|
3
3
|
import { getPgPool } from 'pg-cache';
|
|
4
4
|
import { PgpmMigrate } from '../migrate/client';
|
|
5
|
-
import {
|
|
5
|
+
import { buildExecutableBundle, bundleMatchesModule, readBundleArtifact } from './artifact';
|
|
6
6
|
const log = new Logger('deploy-fast');
|
|
7
7
|
/** Thrown when the ledger already holds a change with different content. */
|
|
8
8
|
export class BundledDeployConflictError extends Error {
|
package/esm/core/class/pgpm.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { generatePlan, writePlan, writePlanFile } from '@pgpmjs/ast/files';
|
|
2
|
+
import { getExtensionInfo, getExtensionName, getInstalledExtensions, parseControlFile, writeExtensions } from '@pgpmjs/ast/files';
|
|
3
|
+
import { generateControlFileContent, writeExtensionMakefile } from '@pgpmjs/ast/files/extension/writer';
|
|
4
|
+
import { getNow as getPlanTimestamp } from '@pgpmjs/ast/files/plan/generator';
|
|
5
|
+
import { parsePlanFile } from '@pgpmjs/ast/files/plan/parser';
|
|
6
|
+
import { isValidChangeName, isValidTagName, parseReference } from '@pgpmjs/ast/files/plan/validators';
|
|
1
7
|
import { getExtensionsDir, loadConfigSyncFromDir, resolvePgpmPath, walkUp } from '@pgpmjs/env';
|
|
2
8
|
import { Logger } from '@pgpmjs/logger';
|
|
3
9
|
import { DEFAULT_EXTENSIONS_DIR, errors } from '@pgpmjs/types';
|
|
@@ -9,22 +15,16 @@ import { parse } from 'parse-package-name';
|
|
|
9
15
|
import path, { dirname, resolve } from 'path';
|
|
10
16
|
import { getPgPool } from 'pg-cache';
|
|
11
17
|
import yanse from 'yanse';
|
|
12
|
-
import { resolveEffectiveModulePath } from '../../apply/materialize';
|
|
13
18
|
import { hasApplySpec, readApplySpec } from '../../apply/apply-spec';
|
|
19
|
+
import { resolveEffectiveModulePath } from '../../apply/materialize';
|
|
14
20
|
import { isReuseSpec, resolveSharedModuleName } from '../../apply/reuse';
|
|
15
21
|
import { APPLY_SPEC_FILE } from '../../apply/types';
|
|
22
|
+
import { deployModuleFast, isBundledDeployResult } from '../../bundle/deploy-bundled';
|
|
16
23
|
import { getAvailableExtensions } from '../../extensions/extensions';
|
|
17
|
-
import {
|
|
18
|
-
import { getExtensionInfo, getExtensionName, getInstalledExtensions, parseControlFile, writeExtensions } from '@pgpmjs/ast/files';
|
|
19
|
-
import { generateControlFileContent, writeExtensionMakefile } from '@pgpmjs/ast/files/extension/writer';
|
|
20
|
-
import { getNow as getPlanTimestamp } from '@pgpmjs/ast/files/plan/generator';
|
|
21
|
-
import { parsePlanFile } from '@pgpmjs/ast/files/plan/parser';
|
|
22
|
-
import { isValidChangeName, isValidTagName, parseReference } from '@pgpmjs/ast/files/plan/validators';
|
|
24
|
+
import { findExtensionInstall, roleMapFromRoles } from '../../extensions/resolve-install';
|
|
23
25
|
import { PgpmMigrate } from '../../migrate/client';
|
|
24
26
|
import { getExtensionsAndModules, getExtensionsAndModulesChanges, latestChange, latestChangeAndVersion } from '../../modules/modules';
|
|
25
|
-
import { deployModuleFast, isBundledDeployResult } from '../../bundle/deploy-bundled';
|
|
26
27
|
import { syncModuleVersions } from '../../packaging/sync-versions';
|
|
27
|
-
import { findExtensionInstall, roleMapFromRoles } from '../../extensions/resolve-install';
|
|
28
28
|
import { resolveDependencies, resolveExtensionDependencies } from '../../resolution/deps';
|
|
29
29
|
import { movePath } from '../../utils/fs';
|
|
30
30
|
import { globPaths, globPattern, toPosixPath } from '../../utils/glob';
|
|
@@ -586,7 +586,9 @@ export class PgpmPackage {
|
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
588
|
}
|
|
589
|
-
catch {
|
|
589
|
+
catch {
|
|
590
|
+
// ignore
|
|
591
|
+
}
|
|
590
592
|
}
|
|
591
593
|
if (!hasTagDependency && !deps[firstKey].includes(depToken)) {
|
|
592
594
|
deps[firstKey].push(depToken);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { TemplateScaffolder } from 'genomic';
|
|
1
2
|
import os from 'os';
|
|
2
3
|
import path from 'path';
|
|
3
|
-
import { TemplateScaffolder } from 'genomic';
|
|
4
4
|
export { SkillInstaller } from 'genomic';
|
|
5
5
|
/**
|
|
6
6
|
* Registry of known boilerplate template repos, keyed by flavor. Add new
|
package/esm/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
+
export * from './core/boilerplate-scanner';
|
|
2
|
+
export * from './core/boilerplate-types';
|
|
1
3
|
export * from './core/class/pgpm';
|
|
2
|
-
export * from './
|
|
4
|
+
export * from './core/template-scaffold';
|
|
3
5
|
export * from './extensions';
|
|
4
6
|
export * from './modules/modules';
|
|
5
7
|
export * from './packaging/check';
|
|
6
8
|
export * from './packaging/package';
|
|
7
9
|
export * from './packaging/sync-versions';
|
|
8
10
|
export * from './packaging/transform';
|
|
11
|
+
export * from './rebundle';
|
|
9
12
|
export * from './resolution/deps';
|
|
10
13
|
export * from './resolution/resolve';
|
|
14
|
+
export * from './workspace/minimal';
|
|
11
15
|
export * from './workspace/paths';
|
|
12
16
|
export * from './workspace/utils';
|
|
13
|
-
export * from './workspace/minimal';
|
|
14
|
-
export * from './core/template-scaffold';
|
|
15
|
-
export * from './core/boilerplate-types';
|
|
16
|
-
export * from './core/boilerplate-scanner';
|
|
17
17
|
// Re-export the module AST layer (moved to the @pgpmjs/ast leaf package)
|
|
18
|
-
export * from '@pgpmjs/ast/files';
|
|
19
|
-
export * from '@pgpmjs/ast/module';
|
|
20
18
|
export * from './apply';
|
|
21
19
|
export * from './bundle';
|
|
22
|
-
export
|
|
20
|
+
export { PgpmInit } from './init/client';
|
|
23
21
|
export { cleanSql } from './migrate/clean';
|
|
24
22
|
export { PgpmMigrate } from './migrate/client';
|
|
25
|
-
export { PgpmInit } from './init/client';
|
|
26
|
-
export * from './roles';
|
|
27
|
-
export { parseAuthor } from '@pgpmjs/ast';
|
|
28
23
|
export { hashFile, hashString } from './migrate/utils/hash';
|
|
29
24
|
export { executeQuery, withTransaction } from './migrate/utils/transaction';
|
|
25
|
+
export * from './refactor';
|
|
26
|
+
export * from './roles';
|
|
27
|
+
export { parseAuthor } from '@pgpmjs/ast';
|
|
28
|
+
export * from '@pgpmjs/ast/files';
|
|
29
|
+
export * from '@pgpmjs/ast/module';
|
package/esm/init/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Logger } from '@pgpmjs/logger';
|
|
2
2
|
import { getPgPool } from 'pg-cache';
|
|
3
|
-
import { generateCreateBaseRolesSQL, generateCreateClientRoleSQL,
|
|
3
|
+
import { generateCreateBaseRolesSQL, generateCreateClientRoleSQL, generateCreateTestUsersSQL, generateCreateUserSQL, generateRemoveUserSQL } from '../roles';
|
|
4
4
|
const log = new Logger('init');
|
|
5
5
|
export class PgpmInit {
|
|
6
6
|
pool;
|
package/esm/migrate/clean.js
CHANGED
|
@@ -2,7 +2,7 @@ import { deparse, parse } from 'pgsql-parser';
|
|
|
2
2
|
const filterStatements = (stmts) => {
|
|
3
3
|
const filteredStmts = stmts.filter(node => {
|
|
4
4
|
const stmt = node.stmt;
|
|
5
|
-
return stmt && !
|
|
5
|
+
return stmt && !Object.prototype.hasOwnProperty.call(stmt, 'TransactionStmt');
|
|
6
6
|
});
|
|
7
7
|
const hasFiltered = filteredStmts.length !== stmts.length;
|
|
8
8
|
return { filteredStmts, hasFiltered };
|
package/esm/migrate/client.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { parsePlanFile, parsePlanFileSimple, readScript } from '@pgpmjs/ast/files';
|
|
1
2
|
import { Logger } from '@pgpmjs/logger';
|
|
2
3
|
import { errors, extractPgErrorFields, formatPgError, formatPgErrorFields } from '@pgpmjs/types';
|
|
3
4
|
import { readFileSync } from 'fs';
|
|
4
5
|
import { dirname, join } from 'path';
|
|
5
6
|
import { getPgPool } from 'pg-cache';
|
|
6
|
-
import { parsePlanFile, parsePlanFileSimple, readScript } from '@pgpmjs/ast/files';
|
|
7
7
|
import { resolveDependencies } from '../resolution/deps';
|
|
8
8
|
import { resolveTagToChangeName } from '../resolution/resolve';
|
|
9
9
|
import { cleanSql } from './clean';
|
|
@@ -362,6 +362,7 @@ export class PgpmMigrate {
|
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
finally {
|
|
365
|
+
// no cleanup
|
|
365
366
|
}
|
|
366
367
|
if (failed.length > 0) {
|
|
367
368
|
throw errors.OPERATION_FAILED({ operation: 'Verification', reason: `${failed.length} change(s): ${failed.join(', ')}` });
|
package/esm/packaging/check.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { verifyBundle } from '@pgpmjs/bundle';
|
|
1
2
|
import { execSync } from 'child_process';
|
|
2
3
|
import { isAbsolute, relative, resolve as resolvePath } from 'path';
|
|
3
|
-
import { verifyBundle } from '@pgpmjs/bundle';
|
|
4
4
|
import { bundleMatchesModule, readBundleArtifact, resolveBundleArtifactPath, } from '../bundle/artifact';
|
|
5
5
|
import { PgpmPackage } from '../core/class/pgpm';
|
|
6
6
|
/**
|
package/esm/packaging/package.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { getExtensionName } from '@pgpmjs/ast/files';
|
|
1
2
|
import { Logger } from '@pgpmjs/logger';
|
|
2
3
|
import { mkdirSync, readFileSync, rmSync, writeFileSync } from 'fs';
|
|
3
4
|
import { relative } from 'path';
|
|
4
5
|
import { deparse } from 'pgsql-deparser';
|
|
5
6
|
import { parse } from 'pgsql-parser';
|
|
6
|
-
import { getExtensionName } from '@pgpmjs/ast/files';
|
|
7
7
|
import { writeBundleArtifact } from '../bundle/artifact';
|
|
8
8
|
import { resolve, resolveWithPlan } from '../resolution/resolve';
|
|
9
9
|
import { transformProps } from './transform';
|
|
@@ -16,13 +16,30 @@ export const cleanTree = (tree) => {
|
|
|
16
16
|
location: noop,
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Same as cleanTree, but also drops the byte-offset fields PG17+ added for list
|
|
21
|
+
* expressions (`ARRAY[...]`, `x IN (...)`). They are positional metadata, not
|
|
22
|
+
* semantics, so they must not count as a round-trip difference. Kept separate
|
|
23
|
+
* from cleanTree so migration hashes (hashSqlFile) stay stable.
|
|
24
|
+
*/
|
|
25
|
+
export const cleanTreeForDiff = (tree) => {
|
|
26
|
+
return transformProps(tree, {
|
|
27
|
+
stmt_len: noop,
|
|
28
|
+
stmt_location: noop,
|
|
29
|
+
location: noop,
|
|
30
|
+
list_start: noop,
|
|
31
|
+
list_end: noop,
|
|
32
|
+
rexpr_list_start: noop,
|
|
33
|
+
rexpr_list_end: noop,
|
|
34
|
+
});
|
|
35
|
+
};
|
|
19
36
|
const filterStatements = (stmts, stripTransactions) => {
|
|
20
37
|
if (!stripTransactions)
|
|
21
38
|
return stmts;
|
|
22
39
|
return stmts.filter(node => {
|
|
23
40
|
const stmt = node.stmt;
|
|
24
|
-
return !
|
|
25
|
-
!
|
|
41
|
+
return (!Object.prototype.hasOwnProperty.call(stmt, 'TransactionStmt') &&
|
|
42
|
+
!Object.prototype.hasOwnProperty.call(stmt, 'CreateExtensionStmt'));
|
|
26
43
|
});
|
|
27
44
|
};
|
|
28
45
|
/**
|
|
@@ -49,11 +66,11 @@ export const mergeSqlStatements = async (sql, { stripTransactions = false, echoE
|
|
|
49
66
|
const results = {
|
|
50
67
|
sql: `${topLine}${finalSql}`,
|
|
51
68
|
};
|
|
52
|
-
const diff = JSON.stringify(
|
|
69
|
+
const diff = JSON.stringify(cleanTreeForDiff(tree1)) !== JSON.stringify(cleanTreeForDiff(tree2));
|
|
53
70
|
if (diff) {
|
|
54
71
|
results.diff = true;
|
|
55
|
-
results.tree1 = JSON.stringify(
|
|
56
|
-
results.tree2 = JSON.stringify(
|
|
72
|
+
results.tree1 = JSON.stringify(cleanTreeForDiff(tree1), null, 2);
|
|
73
|
+
results.tree2 = JSON.stringify(cleanTreeForDiff(tree2), null, 2);
|
|
57
74
|
}
|
|
58
75
|
return results;
|
|
59
76
|
};
|
|
@@ -97,7 +114,7 @@ export const writePackage = async ({ version, extension = true, usePlan = true,
|
|
|
97
114
|
rmSync(outPath, { recursive: true, force: true });
|
|
98
115
|
mkdirSync(outPath, { recursive: true });
|
|
99
116
|
if (extension) {
|
|
100
|
-
writeFileSync(controlPath, control.replace(/default_version = '[0-9
|
|
117
|
+
writeFileSync(controlPath, control.replace(/default_version = '[0-9.]+'/, `default_version = '${version}'`));
|
|
101
118
|
pkg.version = version;
|
|
102
119
|
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
103
120
|
const regex = new RegExp(`${extname}--[0-9.]+.sql`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { getExtensionInfo, parseControlContent } from '@pgpmjs/ast/files';
|
|
1
2
|
import { Logger } from '@pgpmjs/logger';
|
|
2
3
|
import { existsSync, readFileSync } from 'fs';
|
|
3
4
|
import { join } from 'path';
|
|
4
|
-
import { getExtensionInfo, parseControlContent } from '@pgpmjs/ast/files';
|
|
5
5
|
import { writePackage } from './package';
|
|
6
6
|
const log = new Logger('sync-versions');
|
|
7
7
|
/**
|
|
@@ -31,7 +31,7 @@ export const transformProps = (obj, props) => {
|
|
|
31
31
|
copy = {};
|
|
32
32
|
for (const attr in obj) {
|
|
33
33
|
if (Object.prototype.hasOwnProperty.call(obj, attr)) {
|
|
34
|
-
if (
|
|
34
|
+
if (Object.prototype.hasOwnProperty.call(props, attr)) {
|
|
35
35
|
const propRule = props[attr];
|
|
36
36
|
if (typeof propRule === 'function') {
|
|
37
37
|
// Apply function transformation
|
|
@@ -39,7 +39,7 @@ export const transformProps = (obj, props) => {
|
|
|
39
39
|
}
|
|
40
40
|
else if (typeof propRule === 'object' && propRule !== null) {
|
|
41
41
|
// Apply value-based transformation
|
|
42
|
-
if (
|
|
42
|
+
if (Object.prototype.hasOwnProperty.call(propRule, obj[attr])) {
|
|
43
43
|
copy[attr] = propRule[obj[attr]];
|
|
44
44
|
}
|
|
45
45
|
else {
|
package/esm/projects/deploy.js
CHANGED
|
@@ -4,8 +4,8 @@ import { errors } from '@pgpmjs/types';
|
|
|
4
4
|
import { resolve } from 'path';
|
|
5
5
|
import * as path from 'path';
|
|
6
6
|
import { getPgPool } from 'pg-cache';
|
|
7
|
-
import { resolveEffectiveModulePath } from '../apply/materialize';
|
|
8
7
|
import { hasApplySpec } from '../apply/apply-spec';
|
|
8
|
+
import { resolveEffectiveModulePath } from '../apply/materialize';
|
|
9
9
|
import { deployModuleFast, isBundledDeployResult } from '../bundle/deploy-bundled';
|
|
10
10
|
import { PgpmPackage } from '../core/class/pgpm';
|
|
11
11
|
import { findExtensionInstall, roleMapFromRoles } from '../extensions';
|
package/esm/projects/revert.js
CHANGED
|
@@ -3,8 +3,8 @@ import { errors } from '@pgpmjs/types';
|
|
|
3
3
|
import { resolve } from 'path';
|
|
4
4
|
import * as path from 'path';
|
|
5
5
|
import { getPgPool } from 'pg-cache';
|
|
6
|
-
import { resolveEffectiveModulePath } from '../apply/materialize';
|
|
7
6
|
import { hasApplySpec } from '../apply/apply-spec';
|
|
7
|
+
import { resolveEffectiveModulePath } from '../apply/materialize';
|
|
8
8
|
import { PgpmPackage } from '../core/class/pgpm';
|
|
9
9
|
import { PgpmMigrate } from '../migrate/client';
|
|
10
10
|
import { resolveExtensionDependencies } from '../resolution/deps';
|
package/esm/projects/verify.js
CHANGED
|
@@ -3,8 +3,8 @@ import { errors } from '@pgpmjs/types';
|
|
|
3
3
|
import { resolve } from 'path';
|
|
4
4
|
import * as path from 'path';
|
|
5
5
|
import { getPgPool } from 'pg-cache';
|
|
6
|
-
import { resolveEffectiveModulePath } from '../apply/materialize';
|
|
7
6
|
import { hasApplySpec } from '../apply/apply-spec';
|
|
7
|
+
import { resolveEffectiveModulePath } from '../apply/materialize';
|
|
8
8
|
import { PgpmPackage } from '../core/class/pgpm';
|
|
9
9
|
import { PgpmMigrate } from '../migrate/client';
|
|
10
10
|
import { resolveExtensionDependencies } from '../resolution/deps';
|
package/esm/rebundle/index.js
CHANGED
package/esm/rebundle/module.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { parsePlanFile } from '@pgpmjs/ast/files/plan/parser';
|
|
2
|
+
import { generatePlanContent } from '@pgpmjs/slice';
|
|
1
3
|
import { copyFileSync, existsSync, mkdirSync, readdirSync, writeFileSync } from 'fs';
|
|
2
4
|
import { join } from 'path';
|
|
3
|
-
import { parsePlanFile } from '@pgpmjs/ast/files/plan/parser';
|
|
4
5
|
import { mergeSqlStatements, packageModule } from '../packaging/package';
|
|
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
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { readFileSync } from 'fs';
|
|
2
|
-
import { join } from 'path';
|
|
3
1
|
import { getChanges } from '@pgpmjs/ast/files/plan/parser';
|
|
4
|
-
import { resolveWithPlan } from '../resolution/resolve';
|
|
5
2
|
import { parsePlanFile } from '@pgpmjs/ast/files/plan/parser';
|
|
6
3
|
import { buildDependencyGraph, buildPackageDependencies, computeDeployOrder, detectPackageCycle, extractPackageFromPath, } from '@pgpmjs/slice';
|
|
4
|
+
import { readFileSync } from 'fs';
|
|
5
|
+
import { join } from 'path';
|
|
6
|
+
import { resolveWithPlan } from '../resolution/resolve';
|
|
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.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { parsePlanFile } from '@pgpmjs/ast/files/plan/parser';
|
|
1
2
|
import { existsSync, readdirSync, readFileSync } from 'fs';
|
|
2
3
|
import { basename, join } from 'path';
|
|
3
4
|
import { DEFAULT_TEMPLATE_REPO, scaffoldTemplate } from '../core/template-scaffold';
|
|
4
|
-
import { parsePlanFile } from '@pgpmjs/ast/files/plan/parser';
|
|
5
5
|
import { mergeSqlStatements } from '../packaging/package';
|
|
6
6
|
import { resolveWithPlan } from '../resolution/resolve';
|
|
7
7
|
import { writeMinimalModule, writeMinimalWorkspace } from '../workspace/minimal';
|
package/esm/refactor/rename.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmdirSync, statSync, writeFileSync } from 'fs';
|
|
2
|
-
import { dirname, join, relative, sep } from 'path';
|
|
3
1
|
import { parsePlanFileSimple } from '@pgpmjs/ast/files/plan/parser';
|
|
4
2
|
import { parsePgpmHeader, renameInHeader, writePgpmScript } from '@pgpmjs/ast/files/sql/header';
|
|
5
3
|
import { renameInPlanContent } from '@pgpmjs/ast/plan-rename';
|
|
4
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmdirSync, statSync, writeFileSync } from 'fs';
|
|
5
|
+
import { dirname, join, relative, sep } from 'path';
|
|
6
6
|
// Re-exported from @pgpmjs/ast so existing `@pgpmjs/core` consumers keep importing it here.
|
|
7
7
|
export { renameInPlanContent };
|
|
8
8
|
const SCRIPT_DIRS = ['deploy', 'revert', 'verify'];
|
package/esm/resolution/deps.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { parsePlanFile } from '@pgpmjs/ast/files/plan/parser';
|
|
2
|
+
import { scanDeployScript } from '@pgpmjs/ast/files/sql/header';
|
|
3
|
+
import { errors } from '@pgpmjs/types';
|
|
1
4
|
import { readFileSync } from 'fs';
|
|
2
5
|
import { sync as glob } from 'glob';
|
|
3
6
|
import { join, relative } from 'path';
|
|
4
7
|
import { PgpmPackage } from '../core/class/pgpm';
|
|
5
8
|
import { globPattern, toPosixPath } from '../utils/glob';
|
|
6
|
-
import { parsePlanFile } from '@pgpmjs/ast/files/plan/parser';
|
|
7
|
-
import { scanDeployScript } from '@pgpmjs/ast/files/sql/header';
|
|
8
|
-
import { errors } from '@pgpmjs/types';
|
|
9
9
|
/**
|
|
10
10
|
* Core dependency resolution algorithm that handles circular dependency detection
|
|
11
11
|
* and topological sorting of dependencies. This unified implementation eliminates
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { readFileSync } from 'fs';
|
|
2
1
|
import { getChanges, getExtensionName } from '@pgpmjs/ast/files';
|
|
3
2
|
import { parsePlanFile } from '@pgpmjs/ast/files/plan/parser';
|
|
4
|
-
import { resolveDependencies } from './deps';
|
|
5
3
|
import { errors } from '@pgpmjs/types';
|
|
4
|
+
import { readFileSync } from 'fs';
|
|
5
|
+
import { resolveDependencies } from './deps';
|
|
6
6
|
/**
|
|
7
7
|
* Resolves SQL scripts for deployment or reversion.
|
|
8
8
|
*
|
package/esm/workspace/minimal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { generatePlanContent } from '@pgpmjs/slice';
|
|
1
2
|
import fs from 'fs';
|
|
2
3
|
import path from 'path';
|
|
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/esm/workspace/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { errors } from '@pgpmjs/types';
|
|
1
2
|
import { existsSync } from 'fs';
|
|
2
3
|
import { dirname, resolve } from 'path';
|
|
3
|
-
import { errors } from '@pgpmjs/types';
|
|
4
4
|
/**
|
|
5
5
|
* Recursively walks up directories to find a specific file (sync version).
|
|
6
6
|
* @param startDir - Starting directory.
|
|
@@ -26,6 +26,6 @@ export const sluggify = (text) => {
|
|
|
26
26
|
return text.toString().toLowerCase().trim()
|
|
27
27
|
.replace(/\s+/g, '-') // Replace spaces with -
|
|
28
28
|
.replace(/&/g, '-and-') // Replace & with 'and'
|
|
29
|
-
.replace(/[^\w
|
|
30
|
-
.replace(
|
|
29
|
+
.replace(/[^\w-]+/g, '') // Remove all non-word chars
|
|
30
|
+
.replace(/--+/g, '-'); // Replace multiple - with single -
|
|
31
31
|
};
|
package/index.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
+
export * from './core/boilerplate-scanner';
|
|
2
|
+
export * from './core/boilerplate-types';
|
|
1
3
|
export * from './core/class/pgpm';
|
|
2
|
-
export * from './
|
|
4
|
+
export * from './core/template-scaffold';
|
|
3
5
|
export * from './extensions';
|
|
4
6
|
export * from './modules/modules';
|
|
5
7
|
export * from './packaging/check';
|
|
6
8
|
export * from './packaging/package';
|
|
7
9
|
export * from './packaging/sync-versions';
|
|
8
10
|
export * from './packaging/transform';
|
|
11
|
+
export * from './rebundle';
|
|
9
12
|
export * from './resolution/deps';
|
|
10
13
|
export * from './resolution/resolve';
|
|
14
|
+
export * from './workspace/minimal';
|
|
11
15
|
export * from './workspace/paths';
|
|
12
16
|
export * from './workspace/utils';
|
|
13
|
-
export * from './workspace/minimal';
|
|
14
|
-
export * from './core/template-scaffold';
|
|
15
|
-
export * from './core/boilerplate-types';
|
|
16
|
-
export * from './core/boilerplate-scanner';
|
|
17
|
-
export * from '@pgpmjs/ast/files';
|
|
18
|
-
export * from '@pgpmjs/ast/module';
|
|
19
17
|
export * from './apply';
|
|
20
18
|
export * from './bundle';
|
|
21
|
-
export
|
|
19
|
+
export { PgpmInit } from './init/client';
|
|
22
20
|
export { cleanSql } from './migrate/clean';
|
|
23
21
|
export { PgpmMigrate } from './migrate/client';
|
|
24
|
-
export { PgpmInit } from './init/client';
|
|
25
|
-
export * from './roles';
|
|
26
|
-
export { parseAuthor } from '@pgpmjs/ast';
|
|
27
22
|
export { DeployOptions, DeployResult, MigrateChange, MigratePlanFile, RevertOptions, RevertResult, StatusResult, VerifyOptions, VerifyResult } from './migrate/types';
|
|
28
23
|
export { hashFile, hashString } from './migrate/utils/hash';
|
|
29
24
|
export { executeQuery, TransactionContext, TransactionOptions, withTransaction } from './migrate/utils/transaction';
|
|
25
|
+
export * from './refactor';
|
|
26
|
+
export * from './roles';
|
|
27
|
+
export { parseAuthor } from '@pgpmjs/ast';
|
|
28
|
+
export * from '@pgpmjs/ast/files';
|
|
29
|
+
export * from '@pgpmjs/ast/module';
|
package/index.js
CHANGED
|
@@ -14,41 +14,41 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.parseAuthor = exports.withTransaction = exports.executeQuery = exports.hashString = exports.hashFile = exports.PgpmMigrate = exports.cleanSql = exports.PgpmInit = void 0;
|
|
18
|
+
__exportStar(require("./core/boilerplate-scanner"), exports);
|
|
19
|
+
__exportStar(require("./core/boilerplate-types"), exports);
|
|
18
20
|
__exportStar(require("./core/class/pgpm"), exports);
|
|
19
|
-
__exportStar(require("./
|
|
21
|
+
__exportStar(require("./core/template-scaffold"), exports);
|
|
20
22
|
__exportStar(require("./extensions"), exports);
|
|
21
23
|
__exportStar(require("./modules/modules"), exports);
|
|
22
24
|
__exportStar(require("./packaging/check"), exports);
|
|
23
25
|
__exportStar(require("./packaging/package"), exports);
|
|
24
26
|
__exportStar(require("./packaging/sync-versions"), exports);
|
|
25
27
|
__exportStar(require("./packaging/transform"), exports);
|
|
28
|
+
__exportStar(require("./rebundle"), exports);
|
|
26
29
|
__exportStar(require("./resolution/deps"), exports);
|
|
27
30
|
__exportStar(require("./resolution/resolve"), exports);
|
|
31
|
+
__exportStar(require("./workspace/minimal"), exports);
|
|
28
32
|
__exportStar(require("./workspace/paths"), exports);
|
|
29
33
|
__exportStar(require("./workspace/utils"), exports);
|
|
30
|
-
__exportStar(require("./workspace/minimal"), exports);
|
|
31
|
-
__exportStar(require("./core/template-scaffold"), exports);
|
|
32
|
-
__exportStar(require("./core/boilerplate-types"), exports);
|
|
33
|
-
__exportStar(require("./core/boilerplate-scanner"), exports);
|
|
34
34
|
// Re-export the module AST layer (moved to the @pgpmjs/ast leaf package)
|
|
35
|
-
__exportStar(require("@pgpmjs/ast/files"), exports);
|
|
36
|
-
__exportStar(require("@pgpmjs/ast/module"), exports);
|
|
37
35
|
__exportStar(require("./apply"), exports);
|
|
38
36
|
__exportStar(require("./bundle"), exports);
|
|
39
|
-
|
|
37
|
+
var client_1 = require("./init/client");
|
|
38
|
+
Object.defineProperty(exports, "PgpmInit", { enumerable: true, get: function () { return client_1.PgpmInit; } });
|
|
40
39
|
var clean_1 = require("./migrate/clean");
|
|
41
40
|
Object.defineProperty(exports, "cleanSql", { enumerable: true, get: function () { return clean_1.cleanSql; } });
|
|
42
|
-
var
|
|
43
|
-
Object.defineProperty(exports, "PgpmMigrate", { enumerable: true, get: function () { return
|
|
44
|
-
var client_2 = require("./init/client");
|
|
45
|
-
Object.defineProperty(exports, "PgpmInit", { enumerable: true, get: function () { return client_2.PgpmInit; } });
|
|
46
|
-
__exportStar(require("./roles"), exports);
|
|
47
|
-
var ast_1 = require("@pgpmjs/ast");
|
|
48
|
-
Object.defineProperty(exports, "parseAuthor", { enumerable: true, get: function () { return ast_1.parseAuthor; } });
|
|
41
|
+
var client_2 = require("./migrate/client");
|
|
42
|
+
Object.defineProperty(exports, "PgpmMigrate", { enumerable: true, get: function () { return client_2.PgpmMigrate; } });
|
|
49
43
|
var hash_1 = require("./migrate/utils/hash");
|
|
50
44
|
Object.defineProperty(exports, "hashFile", { enumerable: true, get: function () { return hash_1.hashFile; } });
|
|
51
45
|
Object.defineProperty(exports, "hashString", { enumerable: true, get: function () { return hash_1.hashString; } });
|
|
52
46
|
var transaction_1 = require("./migrate/utils/transaction");
|
|
53
47
|
Object.defineProperty(exports, "executeQuery", { enumerable: true, get: function () { return transaction_1.executeQuery; } });
|
|
54
48
|
Object.defineProperty(exports, "withTransaction", { enumerable: true, get: function () { return transaction_1.withTransaction; } });
|
|
49
|
+
__exportStar(require("./refactor"), exports);
|
|
50
|
+
__exportStar(require("./roles"), exports);
|
|
51
|
+
var ast_1 = require("@pgpmjs/ast");
|
|
52
|
+
Object.defineProperty(exports, "parseAuthor", { enumerable: true, get: function () { return ast_1.parseAuthor; } });
|
|
53
|
+
__exportStar(require("@pgpmjs/ast/files"), exports);
|
|
54
|
+
__exportStar(require("@pgpmjs/ast/module"), exports);
|
package/migrate/clean.js
CHANGED
|
@@ -5,7 +5,7 @@ const pgsql_parser_1 = require("pgsql-parser");
|
|
|
5
5
|
const filterStatements = (stmts) => {
|
|
6
6
|
const filteredStmts = stmts.filter(node => {
|
|
7
7
|
const stmt = node.stmt;
|
|
8
|
-
return stmt && !
|
|
8
|
+
return stmt && !Object.prototype.hasOwnProperty.call(stmt, 'TransactionStmt');
|
|
9
9
|
});
|
|
10
10
|
const hasFiltered = filteredStmts.length !== stmts.length;
|
|
11
11
|
return { filteredStmts, hasFiltered };
|
package/migrate/client.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PgpmMigrate = void 0;
|
|
4
|
+
const files_1 = require("@pgpmjs/ast/files");
|
|
4
5
|
const logger_1 = require("@pgpmjs/logger");
|
|
5
6
|
const types_1 = require("@pgpmjs/types");
|
|
6
7
|
const fs_1 = require("fs");
|
|
7
8
|
const path_1 = require("path");
|
|
8
9
|
const pg_cache_1 = require("pg-cache");
|
|
9
|
-
const files_1 = require("@pgpmjs/ast/files");
|
|
10
10
|
const deps_1 = require("../resolution/deps");
|
|
11
11
|
const resolve_1 = require("../resolution/resolve");
|
|
12
12
|
const clean_1 = require("./clean");
|
|
@@ -365,6 +365,7 @@ class PgpmMigrate {
|
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
367
|
finally {
|
|
368
|
+
// no cleanup
|
|
368
369
|
}
|
|
369
370
|
if (failed.length > 0) {
|
|
370
371
|
throw types_1.errors.OPERATION_FAILED({ operation: 'Verification', reason: `${failed.length} change(s): ${failed.join(', ')}` });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgpmjs/core",
|
|
3
|
-
"version": "7.21.
|
|
3
|
+
"version": "7.21.3",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "PGPM Package and Migration Tools",
|
|
6
6
|
"main": "index.js",
|
|
@@ -48,24 +48,24 @@
|
|
|
48
48
|
"makage": "^0.3.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@pgpmjs/ast": "^0.10.
|
|
52
|
-
"@pgpmjs/bundle": "^0.13.
|
|
53
|
-
"@pgpmjs/env": "^2.40.
|
|
54
|
-
"@pgpmjs/logger": "^2.23.
|
|
55
|
-
"@pgpmjs/server-utils": "^3.24.
|
|
56
|
-
"@pgpmjs/slice": "^0.13.
|
|
57
|
-
"@pgpmjs/transform": "^0.
|
|
58
|
-
"@pgpmjs/types": "^2.49.
|
|
59
|
-
"csv-to-pg": "^4.9.
|
|
51
|
+
"@pgpmjs/ast": "^0.10.3",
|
|
52
|
+
"@pgpmjs/bundle": "^0.13.3",
|
|
53
|
+
"@pgpmjs/env": "^2.40.3",
|
|
54
|
+
"@pgpmjs/logger": "^2.23.3",
|
|
55
|
+
"@pgpmjs/server-utils": "^3.24.3",
|
|
56
|
+
"@pgpmjs/slice": "^0.13.8",
|
|
57
|
+
"@pgpmjs/transform": "^0.19.0",
|
|
58
|
+
"@pgpmjs/types": "^2.49.3",
|
|
59
|
+
"csv-to-pg": "^4.9.4",
|
|
60
60
|
"genomic": "^5.6.2",
|
|
61
61
|
"glob": "^13.0.6",
|
|
62
62
|
"parse-package-name": "^1.0.0",
|
|
63
63
|
"pg": "^8.21.0",
|
|
64
|
-
"pg-cache": "^3.24.
|
|
64
|
+
"pg-cache": "^3.24.3",
|
|
65
65
|
"pg-env": "^1.27.2",
|
|
66
|
-
"pgsql-deparser": "^18.
|
|
67
|
-
"pgsql-parser": "^18.1
|
|
66
|
+
"pgsql-deparser": "^18.3.1",
|
|
67
|
+
"pgsql-parser": "^18.2.1",
|
|
68
68
|
"yanse": "^0.2.1"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "c20b6be96b39bf71c0e2df0f4b51e05deacd006b"
|
|
71
71
|
}
|
package/packaging/check.js
CHANGED
|
@@ -7,9 +7,9 @@ exports.enumerateModules = enumerateModules;
|
|
|
7
7
|
exports.mapFilesToModules = mapFilesToModules;
|
|
8
8
|
exports.addDependents = addDependents;
|
|
9
9
|
exports.checkPackages = checkPackages;
|
|
10
|
+
const bundle_1 = require("@pgpmjs/bundle");
|
|
10
11
|
const child_process_1 = require("child_process");
|
|
11
12
|
const path_1 = require("path");
|
|
12
|
-
const bundle_1 = require("@pgpmjs/bundle");
|
|
13
13
|
const artifact_1 = require("../bundle/artifact");
|
|
14
14
|
const pgpm_1 = require("../core/class/pgpm");
|
|
15
15
|
/**
|
package/packaging/package.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
export declare const cleanTree: (tree: any) => any;
|
|
2
|
+
/**
|
|
3
|
+
* Same as cleanTree, but also drops the byte-offset fields PG17+ added for list
|
|
4
|
+
* expressions (`ARRAY[...]`, `x IN (...)`). They are positional metadata, not
|
|
5
|
+
* semantics, so they must not count as a round-trip difference. Kept separate
|
|
6
|
+
* from cleanTree so migration hashes (hashSqlFile) stay stable.
|
|
7
|
+
*/
|
|
8
|
+
export declare const cleanTreeForDiff: (tree: any) => any;
|
|
2
9
|
interface PackageModuleOptions {
|
|
3
10
|
usePlan?: boolean;
|
|
4
11
|
extension?: boolean;
|
package/packaging/package.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.writePackage = exports.packageModule = exports.mergeSqlStatements = exports.cleanTree = void 0;
|
|
3
|
+
exports.writePackage = exports.packageModule = exports.mergeSqlStatements = exports.cleanTreeForDiff = exports.cleanTree = void 0;
|
|
4
|
+
const files_1 = require("@pgpmjs/ast/files");
|
|
4
5
|
const logger_1 = require("@pgpmjs/logger");
|
|
5
6
|
const fs_1 = require("fs");
|
|
6
7
|
const path_1 = require("path");
|
|
7
8
|
const pgsql_deparser_1 = require("pgsql-deparser");
|
|
8
9
|
const pgsql_parser_1 = require("pgsql-parser");
|
|
9
|
-
const files_1 = require("@pgpmjs/ast/files");
|
|
10
10
|
const artifact_1 = require("../bundle/artifact");
|
|
11
11
|
const resolve_1 = require("../resolution/resolve");
|
|
12
12
|
const transform_1 = require("./transform");
|
|
@@ -20,13 +20,31 @@ const cleanTree = (tree) => {
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
exports.cleanTree = cleanTree;
|
|
23
|
+
/**
|
|
24
|
+
* Same as cleanTree, but also drops the byte-offset fields PG17+ added for list
|
|
25
|
+
* expressions (`ARRAY[...]`, `x IN (...)`). They are positional metadata, not
|
|
26
|
+
* semantics, so they must not count as a round-trip difference. Kept separate
|
|
27
|
+
* from cleanTree so migration hashes (hashSqlFile) stay stable.
|
|
28
|
+
*/
|
|
29
|
+
const cleanTreeForDiff = (tree) => {
|
|
30
|
+
return (0, transform_1.transformProps)(tree, {
|
|
31
|
+
stmt_len: noop,
|
|
32
|
+
stmt_location: noop,
|
|
33
|
+
location: noop,
|
|
34
|
+
list_start: noop,
|
|
35
|
+
list_end: noop,
|
|
36
|
+
rexpr_list_start: noop,
|
|
37
|
+
rexpr_list_end: noop,
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
exports.cleanTreeForDiff = cleanTreeForDiff;
|
|
23
41
|
const filterStatements = (stmts, stripTransactions) => {
|
|
24
42
|
if (!stripTransactions)
|
|
25
43
|
return stmts;
|
|
26
44
|
return stmts.filter(node => {
|
|
27
45
|
const stmt = node.stmt;
|
|
28
|
-
return !
|
|
29
|
-
!
|
|
46
|
+
return (!Object.prototype.hasOwnProperty.call(stmt, 'TransactionStmt') &&
|
|
47
|
+
!Object.prototype.hasOwnProperty.call(stmt, 'CreateExtensionStmt'));
|
|
30
48
|
});
|
|
31
49
|
};
|
|
32
50
|
/**
|
|
@@ -53,11 +71,11 @@ const mergeSqlStatements = async (sql, { stripTransactions = false, echoExtensio
|
|
|
53
71
|
const results = {
|
|
54
72
|
sql: `${topLine}${finalSql}`,
|
|
55
73
|
};
|
|
56
|
-
const diff = JSON.stringify((0, exports.
|
|
74
|
+
const diff = JSON.stringify((0, exports.cleanTreeForDiff)(tree1)) !== JSON.stringify((0, exports.cleanTreeForDiff)(tree2));
|
|
57
75
|
if (diff) {
|
|
58
76
|
results.diff = true;
|
|
59
|
-
results.tree1 = JSON.stringify((0, exports.
|
|
60
|
-
results.tree2 = JSON.stringify((0, exports.
|
|
77
|
+
results.tree1 = JSON.stringify((0, exports.cleanTreeForDiff)(tree1), null, 2);
|
|
78
|
+
results.tree2 = JSON.stringify((0, exports.cleanTreeForDiff)(tree2), null, 2);
|
|
61
79
|
}
|
|
62
80
|
return results;
|
|
63
81
|
};
|
|
@@ -103,7 +121,7 @@ const writePackage = async ({ version, extension = true, usePlan = true, package
|
|
|
103
121
|
(0, fs_1.rmSync)(outPath, { recursive: true, force: true });
|
|
104
122
|
(0, fs_1.mkdirSync)(outPath, { recursive: true });
|
|
105
123
|
if (extension) {
|
|
106
|
-
(0, fs_1.writeFileSync)(controlPath, control.replace(/default_version = '[0-9
|
|
124
|
+
(0, fs_1.writeFileSync)(controlPath, control.replace(/default_version = '[0-9.]+'/, `default_version = '${version}'`));
|
|
107
125
|
pkg.version = version;
|
|
108
126
|
(0, fs_1.writeFileSync)(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
109
127
|
const regex = new RegExp(`${extname}--[0-9.]+.sql`);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.syncModuleVersions = exports.getModuleVersionStatus = void 0;
|
|
4
|
+
const files_1 = require("@pgpmjs/ast/files");
|
|
4
5
|
const logger_1 = require("@pgpmjs/logger");
|
|
5
6
|
const fs_1 = require("fs");
|
|
6
7
|
const path_1 = require("path");
|
|
7
|
-
const files_1 = require("@pgpmjs/ast/files");
|
|
8
8
|
const package_1 = require("./package");
|
|
9
9
|
const log = new logger_1.Logger('sync-versions');
|
|
10
10
|
/**
|
package/packaging/transform.js
CHANGED
|
@@ -34,7 +34,7 @@ const transformProps = (obj, props) => {
|
|
|
34
34
|
copy = {};
|
|
35
35
|
for (const attr in obj) {
|
|
36
36
|
if (Object.prototype.hasOwnProperty.call(obj, attr)) {
|
|
37
|
-
if (
|
|
37
|
+
if (Object.prototype.hasOwnProperty.call(props, attr)) {
|
|
38
38
|
const propRule = props[attr];
|
|
39
39
|
if (typeof propRule === 'function') {
|
|
40
40
|
// Apply function transformation
|
|
@@ -42,7 +42,7 @@ const transformProps = (obj, props) => {
|
|
|
42
42
|
}
|
|
43
43
|
else if (typeof propRule === 'object' && propRule !== null) {
|
|
44
44
|
// Apply value-based transformation
|
|
45
|
-
if (
|
|
45
|
+
if (Object.prototype.hasOwnProperty.call(propRule, obj[attr])) {
|
|
46
46
|
copy[attr] = propRule[obj[attr]];
|
|
47
47
|
}
|
|
48
48
|
else {
|
package/projects/deploy.js
CHANGED
|
@@ -40,8 +40,8 @@ const types_1 = require("@pgpmjs/types");
|
|
|
40
40
|
const path_1 = require("path");
|
|
41
41
|
const path = __importStar(require("path"));
|
|
42
42
|
const pg_cache_1 = require("pg-cache");
|
|
43
|
-
const materialize_1 = require("../apply/materialize");
|
|
44
43
|
const apply_spec_1 = require("../apply/apply-spec");
|
|
44
|
+
const materialize_1 = require("../apply/materialize");
|
|
45
45
|
const deploy_bundled_1 = require("../bundle/deploy-bundled");
|
|
46
46
|
const pgpm_1 = require("../core/class/pgpm");
|
|
47
47
|
const extensions_1 = require("../extensions");
|
package/projects/revert.js
CHANGED
|
@@ -39,8 +39,8 @@ const types_1 = require("@pgpmjs/types");
|
|
|
39
39
|
const path_1 = require("path");
|
|
40
40
|
const path = __importStar(require("path"));
|
|
41
41
|
const pg_cache_1 = require("pg-cache");
|
|
42
|
-
const materialize_1 = require("../apply/materialize");
|
|
43
42
|
const apply_spec_1 = require("../apply/apply-spec");
|
|
43
|
+
const materialize_1 = require("../apply/materialize");
|
|
44
44
|
const pgpm_1 = require("../core/class/pgpm");
|
|
45
45
|
const client_1 = require("../migrate/client");
|
|
46
46
|
const deps_1 = require("../resolution/deps");
|
package/projects/verify.js
CHANGED
|
@@ -39,8 +39,8 @@ const types_1 = require("@pgpmjs/types");
|
|
|
39
39
|
const path_1 = require("path");
|
|
40
40
|
const path = __importStar(require("path"));
|
|
41
41
|
const pg_cache_1 = require("pg-cache");
|
|
42
|
-
const materialize_1 = require("../apply/materialize");
|
|
43
42
|
const apply_spec_1 = require("../apply/apply-spec");
|
|
43
|
+
const materialize_1 = require("../apply/materialize");
|
|
44
44
|
const pgpm_1 = require("../core/class/pgpm");
|
|
45
45
|
const client_1 = require("../migrate/client");
|
|
46
46
|
const deps_1 = require("../resolution/deps");
|
package/rebundle/index.d.ts
CHANGED
package/rebundle/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./types"), exports);
|
|
18
|
-
__exportStar(require("./rebundle"), exports);
|
|
19
17
|
__exportStar(require("./module"), exports);
|
|
18
|
+
__exportStar(require("./rebundle"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
20
20
|
__exportStar(require("./workspace"), exports);
|
package/rebundle/module.js
CHANGED
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SCRIPT_DIRS = void 0;
|
|
4
4
|
exports.mergeChunkScript = mergeChunkScript;
|
|
5
5
|
exports.rebundleModule = rebundleModule;
|
|
6
|
+
const parser_1 = require("@pgpmjs/ast/files/plan/parser");
|
|
7
|
+
const slice_1 = require("@pgpmjs/slice");
|
|
6
8
|
const fs_1 = require("fs");
|
|
7
9
|
const path_1 = require("path");
|
|
8
|
-
const parser_1 = require("@pgpmjs/ast/files/plan/parser");
|
|
9
10
|
const package_1 = require("../packaging/package");
|
|
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
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.rebundlePlan = rebundlePlan;
|
|
4
4
|
exports.assembleChunkSql = assembleChunkSql;
|
|
5
5
|
exports.verifyRebundleInvariant = verifyRebundleInvariant;
|
|
6
|
-
const fs_1 = require("fs");
|
|
7
|
-
const path_1 = require("path");
|
|
8
6
|
const parser_1 = require("@pgpmjs/ast/files/plan/parser");
|
|
9
|
-
const resolve_1 = require("../resolution/resolve");
|
|
10
7
|
const parser_2 = require("@pgpmjs/ast/files/plan/parser");
|
|
11
8
|
const slice_1 = require("@pgpmjs/slice");
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const path_1 = require("path");
|
|
11
|
+
const resolve_1 = require("../resolution/resolve");
|
|
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/workspace.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rebundleWorkspace = rebundleWorkspace;
|
|
4
|
+
const parser_1 = require("@pgpmjs/ast/files/plan/parser");
|
|
4
5
|
const fs_1 = require("fs");
|
|
5
6
|
const path_1 = require("path");
|
|
6
7
|
const template_scaffold_1 = require("../core/template-scaffold");
|
|
7
|
-
const parser_1 = require("@pgpmjs/ast/files/plan/parser");
|
|
8
8
|
const package_1 = require("../packaging/package");
|
|
9
9
|
const resolve_1 = require("../resolution/resolve");
|
|
10
10
|
const minimal_1 = require("../workspace/minimal");
|
package/refactor/rename.js
CHANGED
|
@@ -4,12 +4,12 @@ exports.renameInPlanContent = void 0;
|
|
|
4
4
|
exports.validateRenames = validateRenames;
|
|
5
5
|
exports.renameChanges = renameChanges;
|
|
6
6
|
exports.deriveRenamesFromSchemaMapping = deriveRenamesFromSchemaMapping;
|
|
7
|
-
const fs_1 = require("fs");
|
|
8
|
-
const path_1 = require("path");
|
|
9
7
|
const parser_1 = require("@pgpmjs/ast/files/plan/parser");
|
|
10
8
|
const header_1 = require("@pgpmjs/ast/files/sql/header");
|
|
11
9
|
const plan_rename_1 = require("@pgpmjs/ast/plan-rename");
|
|
12
10
|
Object.defineProperty(exports, "renameInPlanContent", { enumerable: true, get: function () { return plan_rename_1.renameInPlanContent; } });
|
|
11
|
+
const fs_1 = require("fs");
|
|
12
|
+
const path_1 = require("path");
|
|
13
13
|
const SCRIPT_DIRS = ['deploy', 'revert', 'verify'];
|
|
14
14
|
function escapeRe(str) {
|
|
15
15
|
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
package/resolution/deps.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveDependencies = exports.resolveExtensionDependencies = void 0;
|
|
4
|
+
const parser_1 = require("@pgpmjs/ast/files/plan/parser");
|
|
5
|
+
const header_1 = require("@pgpmjs/ast/files/sql/header");
|
|
6
|
+
const types_1 = require("@pgpmjs/types");
|
|
4
7
|
const fs_1 = require("fs");
|
|
5
8
|
const glob_1 = require("glob");
|
|
6
9
|
const path_1 = require("path");
|
|
7
10
|
const pgpm_1 = require("../core/class/pgpm");
|
|
8
11
|
const glob_2 = require("../utils/glob");
|
|
9
|
-
const parser_1 = require("@pgpmjs/ast/files/plan/parser");
|
|
10
|
-
const header_1 = require("@pgpmjs/ast/files/sql/header");
|
|
11
|
-
const types_1 = require("@pgpmjs/types");
|
|
12
12
|
/**
|
|
13
13
|
* Core dependency resolution algorithm that handles circular dependency detection
|
|
14
14
|
* and topological sorting of dependencies. This unified implementation eliminates
|
package/resolution/resolve.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveTagToChangeName = exports.resolveWithPlan = exports.resolve = void 0;
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
4
|
const files_1 = require("@pgpmjs/ast/files");
|
|
6
5
|
const parser_1 = require("@pgpmjs/ast/files/plan/parser");
|
|
7
|
-
const deps_1 = require("./deps");
|
|
8
6
|
const types_1 = require("@pgpmjs/types");
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const deps_1 = require("./deps");
|
|
9
9
|
/**
|
|
10
10
|
* Resolves SQL scripts for deployment or reversion.
|
|
11
11
|
*
|
package/workspace/minimal.js
CHANGED
|
@@ -7,9 +7,9 @@ exports.writeMinimalModule = writeMinimalModule;
|
|
|
7
7
|
exports.writeMinimalWorkspace = writeMinimalWorkspace;
|
|
8
8
|
exports.generateModuleControl = generateModuleControl;
|
|
9
9
|
exports.generateModuleMakefile = generateModuleMakefile;
|
|
10
|
+
const slice_1 = require("@pgpmjs/slice");
|
|
10
11
|
const fs_1 = __importDefault(require("fs"));
|
|
11
12
|
const path_1 = __importDefault(require("path"));
|
|
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/workspace/utils.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sluggify = exports.walkUp = void 0;
|
|
4
|
+
const types_1 = require("@pgpmjs/types");
|
|
4
5
|
const fs_1 = require("fs");
|
|
5
6
|
const path_1 = require("path");
|
|
6
|
-
const types_1 = require("@pgpmjs/types");
|
|
7
7
|
/**
|
|
8
8
|
* Recursively walks up directories to find a specific file (sync version).
|
|
9
9
|
* @param startDir - Starting directory.
|
|
@@ -30,7 +30,7 @@ const sluggify = (text) => {
|
|
|
30
30
|
return text.toString().toLowerCase().trim()
|
|
31
31
|
.replace(/\s+/g, '-') // Replace spaces with -
|
|
32
32
|
.replace(/&/g, '-and-') // Replace & with 'and'
|
|
33
|
-
.replace(/[^\w
|
|
34
|
-
.replace(
|
|
33
|
+
.replace(/[^\w-]+/g, '') // Remove all non-word chars
|
|
34
|
+
.replace(/--+/g, '-'); // Replace multiple - with single -
|
|
35
35
|
};
|
|
36
36
|
exports.sluggify = sluggify;
|