@memberjunction/cli 6.1.5 → 6.1.7
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/dist/commands/migrate/index.d.ts +24 -6
- package/dist/commands/migrate/index.d.ts.map +1 -1
- package/dist/commands/migrate/index.js +78 -20
- package/dist/commands/migrate/index.js.map +1 -1
- package/dist/lib/db-version.d.ts +34 -7
- package/dist/lib/db-version.d.ts.map +1 -1
- package/dist/lib/db-version.js +43 -15
- package/dist/lib/db-version.js.map +1 -1
- package/dist/lib/migration-fetch.d.ts +14 -11
- package/dist/lib/migration-fetch.d.ts.map +1 -1
- package/dist/lib/migration-fetch.js +33 -23
- package/dist/lib/migration-fetch.js.map +1 -1
- package/dist/lib/out-of-order.d.ts +56 -0
- package/dist/lib/out-of-order.d.ts.map +1 -0
- package/dist/lib/out-of-order.js +37 -0
- package/dist/lib/out-of-order.js.map +1 -0
- package/oclif.manifest.json +505 -505
- package/package.json +22 -22
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module lib/out-of-order
|
|
3
|
+
*
|
|
4
|
+
* Decides whether `mj migrate` lets Skyway apply versioned migrations older than the
|
|
5
|
+
* database's highest applied version.
|
|
6
|
+
*
|
|
7
|
+
* Release lines make this a normal upgrade case: a fix backported to a patch line ships
|
|
8
|
+
* byte-identical (same timestamp) on both lines, so a database upgraded from that line
|
|
9
|
+
* has applied files that are newer than migrations it has never run. With `outOfOrder`
|
|
10
|
+
* off, Skyway marks those older files IGNORED and refuses the whole run.
|
|
11
|
+
*
|
|
12
|
+
* Policy:
|
|
13
|
+
* - `outOfOrder` set explicitly in the config file: honoured as written.
|
|
14
|
+
* - Not set, and the run targets the core schema: enabled for this run when Skyway
|
|
15
|
+
* reports pending files older than the highest applied version; each one is logged.
|
|
16
|
+
* - Not set, any other schema (Open Apps): left off, as before.
|
|
17
|
+
*
|
|
18
|
+
* Files at or below a baseline row in history are never affected: Skyway reports them
|
|
19
|
+
* as ABOVE_BASELINE before it considers `outOfOrder`.
|
|
20
|
+
*/
|
|
21
|
+
import type { MigrationStatus } from '@memberjunction/skyway-core';
|
|
22
|
+
/** Inputs to {@link DecideOutOfOrder}. */
|
|
23
|
+
export interface OutOfOrderInputs {
|
|
24
|
+
/** The `outOfOrder` value written in the config file, or undefined when it is not set. */
|
|
25
|
+
ExplicitSetting: boolean | undefined;
|
|
26
|
+
/** True when the run targets the core schema (`coreSchema`, normally `__mj`). */
|
|
27
|
+
IsCoreSchema: boolean;
|
|
28
|
+
/** Pending versioned migrations older than the highest applied version (see {@link FindOutOfOrderPending}). */
|
|
29
|
+
OutOfOrderPending: readonly MigrationStatus[];
|
|
30
|
+
}
|
|
31
|
+
/** Result of {@link DecideOutOfOrder}. */
|
|
32
|
+
export interface OutOfOrderDecision {
|
|
33
|
+
/** Value to hand Skyway as `Migrations.OutOfOrder` for this run. */
|
|
34
|
+
OutOfOrder: boolean;
|
|
35
|
+
/** True when the CLI turned `outOfOrder` on for this run (it was not set in config). */
|
|
36
|
+
EnabledAutomatically: boolean;
|
|
37
|
+
/** True when out-of-order files exist but the config explicitly sets `outOfOrder: false`. */
|
|
38
|
+
BlockedByExplicitSetting: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Reads `outOfOrder` from the raw (pre-Zod) config. The CLI's built-in defaults do not
|
|
42
|
+
* include the key and the schema default is applied only at parse time, so the key is
|
|
43
|
+
* present in the raw config only when the user's config file sets it.
|
|
44
|
+
*/
|
|
45
|
+
export declare function ReadExplicitOutOfOrder(rawConfig: Record<string, unknown> | undefined): boolean | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Pure: picks the versioned migrations Skyway would refuse as out of order. Skyway marks a
|
|
48
|
+
* versioned file IGNORED only when it is unapplied, above any baseline floor, below the
|
|
49
|
+
* highest applied version, and `outOfOrder` is off — exactly the files this run would skip.
|
|
50
|
+
*/
|
|
51
|
+
export declare function FindOutOfOrderPending(statusReport: readonly MigrationStatus[]): MigrationStatus[];
|
|
52
|
+
/** Pure: applies the policy described in the module header. */
|
|
53
|
+
export declare function DecideOutOfOrder(inputs: OutOfOrderInputs): OutOfOrderDecision;
|
|
54
|
+
/** True when the probe for out-of-order files is worth running (it costs one history read). */
|
|
55
|
+
export declare function ShouldProbeOutOfOrder(explicitSetting: boolean | undefined, isCoreSchema: boolean): boolean;
|
|
56
|
+
//# sourceMappingURL=out-of-order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"out-of-order.d.ts","sourceRoot":"","sources":["../../src/lib/out-of-order.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,0CAA0C;AAC1C,MAAM,WAAW,gBAAgB;IAC/B,0FAA0F;IAC1F,eAAe,EAAE,OAAO,GAAG,SAAS,CAAC;IACrC,iFAAiF;IACjF,YAAY,EAAE,OAAO,CAAC;IACtB,+GAA+G;IAC/G,iBAAiB,EAAE,SAAS,eAAe,EAAE,CAAC;CAC/C;AAED,0CAA0C;AAC1C,MAAM,WAAW,kBAAkB;IACjC,oEAAoE;IACpE,UAAU,EAAE,OAAO,CAAC;IACpB,wFAAwF;IACxF,oBAAoB,EAAE,OAAO,CAAC;IAC9B,6FAA6F;IAC7F,wBAAwB,EAAE,OAAO,CAAC;CACnC;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAG1G;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,SAAS,eAAe,EAAE,GAAG,eAAe,EAAE,CAEjG;AAED,+DAA+D;AAC/D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,kBAAkB,CAW7E;AAED,+FAA+F;AAC/F,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,OAAO,GAAG,SAAS,EAAE,YAAY,EAAE,OAAO,GAAG,OAAO,CAI1G"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads `outOfOrder` from the raw (pre-Zod) config. The CLI's built-in defaults do not
|
|
3
|
+
* include the key and the schema default is applied only at parse time, so the key is
|
|
4
|
+
* present in the raw config only when the user's config file sets it.
|
|
5
|
+
*/
|
|
6
|
+
export function ReadExplicitOutOfOrder(rawConfig) {
|
|
7
|
+
const value = rawConfig?.outOfOrder;
|
|
8
|
+
return typeof value === 'boolean' ? value : undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Pure: picks the versioned migrations Skyway would refuse as out of order. Skyway marks a
|
|
12
|
+
* versioned file IGNORED only when it is unapplied, above any baseline floor, below the
|
|
13
|
+
* highest applied version, and `outOfOrder` is off — exactly the files this run would skip.
|
|
14
|
+
*/
|
|
15
|
+
export function FindOutOfOrderPending(statusReport) {
|
|
16
|
+
return statusReport.filter((s) => s.Type === 'versioned' && s.State === 'IGNORED');
|
|
17
|
+
}
|
|
18
|
+
/** Pure: applies the policy described in the module header. */
|
|
19
|
+
export function DecideOutOfOrder(inputs) {
|
|
20
|
+
const hasOutOfOrder = inputs.OutOfOrderPending.length > 0;
|
|
21
|
+
if (inputs.ExplicitSetting !== undefined) {
|
|
22
|
+
return {
|
|
23
|
+
OutOfOrder: inputs.ExplicitSetting,
|
|
24
|
+
EnabledAutomatically: false,
|
|
25
|
+
BlockedByExplicitSetting: !inputs.ExplicitSetting && hasOutOfOrder,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const enable = inputs.IsCoreSchema && hasOutOfOrder;
|
|
29
|
+
return { OutOfOrder: enable, EnabledAutomatically: enable, BlockedByExplicitSetting: false };
|
|
30
|
+
}
|
|
31
|
+
/** True when the probe for out-of-order files is worth running (it costs one history read). */
|
|
32
|
+
export function ShouldProbeOutOfOrder(explicitSetting, isCoreSchema) {
|
|
33
|
+
// An explicit `true` needs no probe, and a non-core run never auto-enables. An explicit
|
|
34
|
+
// `false` on the core schema is probed only to explain the refusal Skyway will report.
|
|
35
|
+
return explicitSetting !== true && isCoreSchema;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=out-of-order.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"out-of-order.js","sourceRoot":"","sources":["../../src/lib/out-of-order.ts"],"names":[],"mappings":"AA0CA;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAA8C;IACnF,MAAM,KAAK,GAAG,SAAS,EAAE,UAAU,CAAC;IACpC,OAAO,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,YAAwC;IAC5E,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,IAAI,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;AACrF,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,gBAAgB,CAAC,MAAwB;IACvD,MAAM,aAAa,GAAG,MAAM,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1D,IAAI,MAAM,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;QACzC,OAAO;YACL,UAAU,EAAE,MAAM,CAAC,eAAe;YAClC,oBAAoB,EAAE,KAAK;YAC3B,wBAAwB,EAAE,CAAC,MAAM,CAAC,eAAe,IAAI,aAAa;SACnE,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,IAAI,aAAa,CAAC;IACpD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,wBAAwB,EAAE,KAAK,EAAE,CAAC;AAC/F,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,qBAAqB,CAAC,eAAoC,EAAE,YAAqB;IAC/F,wFAAwF;IACxF,uFAAuF;IACvF,OAAO,eAAe,KAAK,IAAI,IAAI,YAAY,CAAC;AAClD,CAAC"}
|