@pgpmjs/core 7.17.0 → 7.17.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.
@@ -50,9 +50,11 @@ function makeSubsystemStripper(source, spec, instanceName) {
50
50
  `referenced object, or keep the subsystem.`);
51
51
  }
52
52
  // A change whose deploy consists entirely of subsystem statements (plus
53
- // transaction control) is excluded *as a change*: its verify/revert scripts
54
- // target dropped objects the classifier can't always see (bare DROPs,
55
- // catalog probes), so all three scripts are blanked together.
53
+ // transaction control) is dropped *as a change* — removed from the plan and
54
+ // deploy order rather than emitted as an empty script (empty scripts collide
55
+ // on the deploy ledger's script-hash uniqueness). Its verify/revert scripts
56
+ // target dropped objects the classifier can't always see (bare DROPs, catalog
57
+ // probes), which is exactly why the whole change is dropped, not just blanked.
56
58
  const excludedChanges = new Set();
57
59
  for (const change of source.changes) {
58
60
  if (!change.deploy)
@@ -63,7 +65,10 @@ function makeSubsystemStripper(source, spec, instanceName) {
63
65
  excludedChanges.add(change.name);
64
66
  }
65
67
  }
66
- const strip = (sql, change) => excludedChanges.has(change) ? (0, slice_1.blankScriptSql)(sql) : (0, slice_1.stripSubsystemSql)(sql, selector).sql;
68
+ // Surviving changes may still contain stray subsystem statements (a change
69
+ // that both creates a survivor and touches the excluded subsystem); strip
70
+ // those in place. Fully-excluded changes are dropped via `excludedChanges`.
71
+ const strip = (sql) => (0, slice_1.stripSubsystemSql)(sql, selector).sql;
67
72
  return { strip, excludedChanges };
68
73
  }
69
74
  /**
@@ -113,14 +118,20 @@ async function materializeApplyModule(options) {
113
118
  assumeSchemasExist: targetSchemas
114
119
  }
115
120
  });
116
- // Excluded changes keep their source identity (an emptied tombstone) —
117
- // renaming them into the replacement provider's namespace would be a lie.
121
+ // Excluded changes are dropped from the artifact entirely (plan + deploy
122
+ // order + dependency refs); surviving changes get their stray subsystem
123
+ // statements stripped before the namespace transform.
118
124
  const transpiled = (0, bundle_1.transpileBundle)(source, {
125
+ excludeChange: stripSubsystem
126
+ ? (name) => stripSubsystem.excludedChanges.has(name)
127
+ : undefined,
128
+ // Excluded changes keep their source identity so the plan-prune (which
129
+ // matches source names) can find them; survivors route normally.
119
130
  renameChange: stripSubsystem
120
131
  ? (name) => (stripSubsystem.excludedChanges.has(name) ? name : renameChange(name))
121
132
  : renameChange,
122
133
  transformScript: stripSubsystem
123
- ? (sql, ctx) => transformScript(stripSubsystem.strip(sql, ctx.change), ctx)
134
+ ? (sql, ctx) => transformScript(stripSubsystem.strip(sql), ctx)
124
135
  : transformScript,
125
136
  renameModule: instanceName,
126
137
  provenance: {
@@ -3,7 +3,7 @@ import { tmpdir } from 'os';
3
3
  import { join, resolve } from 'path';
4
4
  import { bundleFromModule, materializeBundle, transpileBundle, verifyBundle } from '@pgpmjs/bundle';
5
5
  import { buildSchemaRouter, loadModule, makeSchemaTranspiler } from '@pgpmjs/transform';
6
- import { blankScriptSql, excludeSubsystem, stripSubsystemSql } from '@pgpmjs/slice';
6
+ import { excludeSubsystem, stripSubsystemSql } from '@pgpmjs/slice';
7
7
  import { hasApplySpec, readApplySpec } from './apply-spec';
8
8
  import { loadWorkspaceRoutingProfile, resolveEffectiveApplySpec } from './profile';
9
9
  import { isReuseSpec, materializeReuseModule, resolveSharedModuleName } from './reuse';
@@ -45,9 +45,11 @@ function makeSubsystemStripper(source, spec, instanceName) {
45
45
  `referenced object, or keep the subsystem.`);
46
46
  }
47
47
  // A change whose deploy consists entirely of subsystem statements (plus
48
- // transaction control) is excluded *as a change*: its verify/revert scripts
49
- // target dropped objects the classifier can't always see (bare DROPs,
50
- // catalog probes), so all three scripts are blanked together.
48
+ // transaction control) is dropped *as a change* — removed from the plan and
49
+ // deploy order rather than emitted as an empty script (empty scripts collide
50
+ // on the deploy ledger's script-hash uniqueness). Its verify/revert scripts
51
+ // target dropped objects the classifier can't always see (bare DROPs, catalog
52
+ // probes), which is exactly why the whole change is dropped, not just blanked.
51
53
  const excludedChanges = new Set();
52
54
  for (const change of source.changes) {
53
55
  if (!change.deploy)
@@ -58,7 +60,10 @@ function makeSubsystemStripper(source, spec, instanceName) {
58
60
  excludedChanges.add(change.name);
59
61
  }
60
62
  }
61
- const strip = (sql, change) => excludedChanges.has(change) ? blankScriptSql(sql) : stripSubsystemSql(sql, selector).sql;
63
+ // Surviving changes may still contain stray subsystem statements (a change
64
+ // that both creates a survivor and touches the excluded subsystem); strip
65
+ // those in place. Fully-excluded changes are dropped via `excludedChanges`.
66
+ const strip = (sql) => stripSubsystemSql(sql, selector).sql;
62
67
  return { strip, excludedChanges };
63
68
  }
64
69
  /**
@@ -108,14 +113,20 @@ export async function materializeApplyModule(options) {
108
113
  assumeSchemasExist: targetSchemas
109
114
  }
110
115
  });
111
- // Excluded changes keep their source identity (an emptied tombstone) —
112
- // renaming them into the replacement provider's namespace would be a lie.
116
+ // Excluded changes are dropped from the artifact entirely (plan + deploy
117
+ // order + dependency refs); surviving changes get their stray subsystem
118
+ // statements stripped before the namespace transform.
113
119
  const transpiled = transpileBundle(source, {
120
+ excludeChange: stripSubsystem
121
+ ? (name) => stripSubsystem.excludedChanges.has(name)
122
+ : undefined,
123
+ // Excluded changes keep their source identity so the plan-prune (which
124
+ // matches source names) can find them; survivors route normally.
114
125
  renameChange: stripSubsystem
115
126
  ? (name) => (stripSubsystem.excludedChanges.has(name) ? name : renameChange(name))
116
127
  : renameChange,
117
128
  transformScript: stripSubsystem
118
- ? (sql, ctx) => transformScript(stripSubsystem.strip(sql, ctx.change), ctx)
129
+ ? (sql, ctx) => transformScript(stripSubsystem.strip(sql), ctx)
119
130
  : transformScript,
120
131
  renameModule: instanceName,
121
132
  provenance: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgpmjs/core",
3
- "version": "7.17.0",
3
+ "version": "7.17.2",
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.9.4",
52
- "@pgpmjs/bundle": "^0.12.2",
53
- "@pgpmjs/env": "^2.39.1",
54
- "@pgpmjs/logger": "^2.22.0",
55
- "@pgpmjs/server-utils": "^3.23.3",
56
- "@pgpmjs/slice": "^0.11.0",
57
- "@pgpmjs/transform": "^0.12.0",
58
- "@pgpmjs/types": "^2.48.0",
59
- "csv-to-pg": "^4.8.0",
51
+ "@pgpmjs/ast": "^0.9.5",
52
+ "@pgpmjs/bundle": "^0.12.4",
53
+ "@pgpmjs/env": "^2.39.2",
54
+ "@pgpmjs/logger": "^2.22.1",
55
+ "@pgpmjs/server-utils": "^3.23.4",
56
+ "@pgpmjs/slice": "^0.11.2",
57
+ "@pgpmjs/transform": "^0.12.2",
58
+ "@pgpmjs/types": "^2.48.1",
59
+ "csv-to-pg": "^4.8.1",
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.23.3",
65
- "pg-env": "^1.26.0",
64
+ "pg-cache": "^3.23.4",
65
+ "pg-env": "^1.26.1",
66
66
  "pgsql-deparser": "^18.1.1",
67
67
  "pgsql-parser": "^18.1.1",
68
68
  "yanse": "^0.2.1"
69
69
  },
70
- "gitHead": "2832d5632d11eb22e1437df773706ac6a99175fe"
70
+ "gitHead": "a430897efa1488ec24fc636f0d5023207bba7ba7"
71
71
  }