@pgpmjs/core 7.11.1 → 7.14.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/apply/apply-spec.d.ts +14 -0
- package/apply/apply-spec.js +90 -0
- package/apply/index.d.ts +3 -0
- package/apply/index.js +19 -0
- package/apply/materialize.d.ts +40 -0
- package/apply/materialize.js +121 -0
- package/apply/types.d.ts +83 -0
- package/apply/types.js +17 -0
- package/core/class/pgpm.d.ts +20 -0
- package/core/class/pgpm.js +78 -16
- package/esm/apply/apply-spec.js +85 -0
- package/esm/apply/index.js +3 -0
- package/esm/apply/materialize.js +116 -0
- package/esm/apply/types.js +14 -0
- package/esm/core/class/pgpm.js +78 -16
- package/esm/index.js +1 -0
- package/esm/projects/deploy.js +13 -3
- package/esm/projects/revert.js +10 -3
- package/esm/projects/verify.js +10 -3
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +13 -12
- package/projects/deploy.js +13 -3
- package/projects/revert.js +10 -3
- package/projects/verify.js +10 -3
package/projects/revert.js
CHANGED
|
@@ -39,8 +39,11 @@ 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
|
+
const apply_spec_1 = require("../apply/apply-spec");
|
|
42
44
|
const pgpm_1 = require("../core/class/pgpm");
|
|
43
45
|
const client_1 = require("../migrate/client");
|
|
46
|
+
const deps_1 = require("../resolution/deps");
|
|
44
47
|
const log = new logger_1.Logger('revert');
|
|
45
48
|
const revertProject = async (opts, name, database, pkg, options) => {
|
|
46
49
|
log.info(`🔍 Gathering modules from ${pkg.workspacePath}...`);
|
|
@@ -50,9 +53,12 @@ const revertProject = async (opts, name, database, pkg, options) => {
|
|
|
50
53
|
throw types_1.errors.MODULE_NOT_FOUND({ name });
|
|
51
54
|
}
|
|
52
55
|
const modulePath = path.resolve(pkg.workspacePath, modules[name].path);
|
|
53
|
-
const moduleProject = new pgpm_1.PgpmPackage(modulePath, { extensionsDir: pkg.extensionsDir });
|
|
54
56
|
log.info(`📦 Resolving dependencies for ${name}...`);
|
|
55
|
-
|
|
57
|
+
// Proxy (apply-spec) modules have no pgpm.plan, so resolve straight off the
|
|
58
|
+
// workspace module map instead of instantiating a module-rooted package.
|
|
59
|
+
const extensions = (0, apply_spec_1.hasApplySpec)(modulePath)
|
|
60
|
+
? (0, deps_1.resolveExtensionDependencies)(name, modules)
|
|
61
|
+
: new pgpm_1.PgpmPackage(modulePath, { extensionsDir: pkg.extensionsDir }).getModuleExtensions();
|
|
56
62
|
const pgPool = (0, pg_cache_1.getPgPool)({
|
|
57
63
|
...opts.pg,
|
|
58
64
|
database
|
|
@@ -78,7 +84,8 @@ const revertProject = async (opts, name, database, pkg, options) => {
|
|
|
78
84
|
}
|
|
79
85
|
}
|
|
80
86
|
else {
|
|
81
|
-
const
|
|
87
|
+
const sourcePath = (0, path_1.resolve)(pkg.workspacePath, modules[extension].path);
|
|
88
|
+
const modulePath = await (0, materialize_1.resolveEffectiveModulePath)(extension, sourcePath, modules, pkg.workspacePath);
|
|
82
89
|
log.info(`📂 Reverting local module: ${extension}`);
|
|
83
90
|
log.debug(`→ Path: ${modulePath}`);
|
|
84
91
|
// Use new migration system
|
package/projects/verify.js
CHANGED
|
@@ -39,8 +39,11 @@ 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
|
+
const apply_spec_1 = require("../apply/apply-spec");
|
|
42
44
|
const pgpm_1 = require("../core/class/pgpm");
|
|
43
45
|
const client_1 = require("../migrate/client");
|
|
46
|
+
const deps_1 = require("../resolution/deps");
|
|
44
47
|
const log = new logger_1.Logger('verify');
|
|
45
48
|
const verifyProject = async (opts, name, database, pkg, options) => {
|
|
46
49
|
log.info(`🔍 Gathering modules from ${pkg.workspacePath}...`);
|
|
@@ -50,9 +53,12 @@ const verifyProject = async (opts, name, database, pkg, options) => {
|
|
|
50
53
|
throw types_1.errors.MODULE_NOT_FOUND({ name });
|
|
51
54
|
}
|
|
52
55
|
const modulePath = path.resolve(pkg.workspacePath, modules[name].path);
|
|
53
|
-
const moduleProject = new pgpm_1.PgpmPackage(modulePath, { extensionsDir: pkg.extensionsDir });
|
|
54
56
|
log.info(`📦 Resolving dependencies for ${name}...`);
|
|
55
|
-
|
|
57
|
+
// Proxy (apply-spec) modules have no pgpm.plan, so resolve straight off the
|
|
58
|
+
// workspace module map instead of instantiating a module-rooted package.
|
|
59
|
+
const extensions = (0, apply_spec_1.hasApplySpec)(modulePath)
|
|
60
|
+
? (0, deps_1.resolveExtensionDependencies)(name, modules)
|
|
61
|
+
: new pgpm_1.PgpmPackage(modulePath, { extensionsDir: pkg.extensionsDir }).getModuleExtensions();
|
|
56
62
|
const pgPool = (0, pg_cache_1.getPgPool)({
|
|
57
63
|
...opts.pg,
|
|
58
64
|
database
|
|
@@ -67,7 +73,8 @@ const verifyProject = async (opts, name, database, pkg, options) => {
|
|
|
67
73
|
await pgPool.query(query, [extension]);
|
|
68
74
|
}
|
|
69
75
|
else {
|
|
70
|
-
const
|
|
76
|
+
const sourcePath = (0, path_1.resolve)(pkg.workspacePath, modules[extension].path);
|
|
77
|
+
const modulePath = await (0, materialize_1.resolveEffectiveModulePath)(extension, sourcePath, modules, pkg.workspacePath);
|
|
71
78
|
log.info(`📂 Verifying local module: ${extension}`);
|
|
72
79
|
log.debug(`→ Path: ${modulePath}`);
|
|
73
80
|
log.debug(`→ Command: constructive migrate verify db:pg:${database}`);
|