@antelopejs/interface-dms-saas 0.10.1-next.284.g0c8c5cd → 0.10.1-next.289.g1c3f8ca
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/plan-changes.d.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { RegisteringProxy } from "@antelopejs/interface-core";
|
|
2
2
|
import type { Plan } from "./db/tables/plans.table";
|
|
3
3
|
export interface PlanChangeIncompatibility {
|
|
4
|
+
severity?: "blocking";
|
|
4
5
|
code: string;
|
|
5
6
|
message: string;
|
|
6
7
|
resource?: string;
|
|
7
8
|
}
|
|
9
|
+
export interface PlanChangeNotice {
|
|
10
|
+
severity: "notice";
|
|
11
|
+
code: string;
|
|
12
|
+
message: string;
|
|
13
|
+
resource?: string;
|
|
14
|
+
}
|
|
15
|
+
export type PlanChangeFinding = PlanChangeIncompatibility | PlanChangeNotice;
|
|
8
16
|
export interface PlanChangeValidationRequest {
|
|
9
17
|
tenantId: string;
|
|
10
18
|
currentPlan: Plan | null;
|
|
@@ -15,7 +23,7 @@ export interface PlanChangeValidationRequest {
|
|
|
15
23
|
}
|
|
16
24
|
export interface PlanChangePolicy {
|
|
17
25
|
name: string;
|
|
18
|
-
validatePlanChange(request: PlanChangeValidationRequest): Promise<
|
|
26
|
+
validatePlanChange(request: PlanChangeValidationRequest): Promise<PlanChangeFinding[]>;
|
|
19
27
|
}
|
|
20
28
|
export interface TenantPlanConstraints {
|
|
21
29
|
currentPlan: Plan | null;
|
package/dist/plan-changes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-changes.js","sourceRoot":"","sources":["../src/plan-changes.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"plan-changes.js","sourceRoot":"","sources":["../src/plan-changes.ts"],"names":[],"mappings":";;;AA4GA,4DAIC;AAGD,gEAEC;AArHD,+DAGoC;AAkEvB,QAAA,wBAAwB,GACnC,IAAA,kCAAiB,GAAwD,CAAC;AAQ/D,QAAA,kBAAkB,GAC7B,IAAA,kCAAiB,GAAyC,CAAC;AAgBhD,QAAA,uBAAuB,GAClC,IAAA,kCAAiB,GAEd,CAAC;AAGN,IAAiB,QAAQ,CAIxB;AAJD,WAAiB,QAAQ;IACV,iCAAwB,GAAG,IAAI,iCAAgB,EAEzD,CAAC;AACN,CAAC,EAJgB,QAAQ,wBAAR,QAAQ,QAIxB;AAGD,SAAgB,wBAAwB,CAAC,MAAwB;IAC/D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,QAAQ,CAAC,wBAAwB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAClE,CAAC;AAGD,SAAgB,0BAA0B,CAAC,IAAY;IACrD,QAAQ,CAAC,wBAAwB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -98,7 +98,7 @@ These names are exported from `/plan-changes`. A module that owns tenant invento
|
|
|
98
98
|
|
|
99
99
|
```ts [Contract]
|
|
100
100
|
import type {
|
|
101
|
-
|
|
101
|
+
PlanChangeFinding,
|
|
102
102
|
PlanChangeValidationRequest,
|
|
103
103
|
} from "@antelopejs/interface-dms-saas/plan-changes";
|
|
104
104
|
|
|
@@ -106,11 +106,13 @@ interface PlanChangePolicy {
|
|
|
106
106
|
name: string;
|
|
107
107
|
validatePlanChange(
|
|
108
108
|
request: PlanChangeValidationRequest,
|
|
109
|
-
): Promise<
|
|
109
|
+
): Promise<PlanChangeFinding[]>;
|
|
110
110
|
}
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
`PlanChangeValidationRequest` has `tenantId: string`, `currentPlan: Plan | null`, `targetPlan: Plan`, `operationId: string`, `phase: "preview" | "schedule" | "effective"` and `effectiveAt: Date | null`. `
|
|
113
|
+
`PlanChangeValidationRequest` has `tenantId: string`, `currentPlan: Plan | null`, `targetPlan: Plan`, `operationId: string`, `phase: "preview" | "schedule" | "effective"` and `effectiveAt: Date | null`. `PlanChangeFinding` is `PlanChangeIncompatibility | PlanChangeNotice`. Both have `code: string`, `message: string` and an optional `resource: string`. They differ by `severity`: a notice has `"notice"`, an incompatibility has `"blocking"` or no `severity`.
|
|
114
|
+
|
|
115
|
+
Only a notice leaves the change allowed. Every other entry refuses it, an entry with a `severity` the interface does not define included. The owner reads the notices in the plan-change confirmation, such as "2 databases will restart", and can still confirm. SaaS shows them from the `preview` phase only and ignores the notices a policy returns for `schedule` and `effective`. It never stores a notice: `TenantPlanConstraints.incompatibilities` holds only `PlanChangeIncompatibility` entries.
|
|
114
116
|
|
|
115
117
|
`RegisterPlanChangePolicy(policy: PlanChangePolicy): void` registers the sole policy, and throws when `name` is blank. `UnregisterPlanChangePolicy(name: string): void` removes it, but does not lift the restrictions on changes already persisted. Registering a policy opts deferred changes into the guarded paid-to-Free flow. Guarded paid-to-paid changes are not supported. `validatePlanChange` runs for the `preview`, `schedule` and `effective` phases. The effective call runs after DMS tenant admission is paused and earlier membership writers have drained. The callback does not mutate inventory or call Stripe. When the runtime's `requiredPlanChangePolicy` option names a policy that is not registered, plan changes fail closed. A second policy competing with the first also fails closed.
|
|
116
118
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/interface-dms-saas",
|
|
3
|
-
"version": "0.10.1-next.
|
|
3
|
+
"version": "0.10.1-next.289.g1c3f8ca",
|
|
4
4
|
"description": "AntelopeJS interface for the DMS SaaS module: billing, plans, registration, workspace pages and lifecycle extension points.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"@antelopejs/interface-database-decorators": ">=0.5.2 <0.6.0"
|
|
81
81
|
},
|
|
82
82
|
"antelopeJs": {},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "1c3f8ca7ee3fc6755e3a0f9a270003e11a3924cd",
|
|
84
84
|
"scripts": {
|
|
85
85
|
"build": "rimraf dist && tsc",
|
|
86
86
|
"typecheck": "tsc --noEmit",
|