@uns-kit/core 3.0.33 → 3.0.34
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/MIGRATIONS.md +25 -0
- package/dist/runtime/process-group-authorization.d.ts +72 -0
- package/dist/runtime/process-group-authorization.d.ts.map +1 -1
- package/dist/runtime/process-group-authorization.js +31 -0
- package/dist/runtime/process-group-authorization.js.map +1 -1
- package/dist/runtime/process-group-contract.d.ts +1 -0
- package/dist/runtime/process-group-contract.d.ts.map +1 -1
- package/dist/runtime/process-group-contract.js +2 -1
- package/dist/runtime/process-group-contract.js.map +1 -1
- package/dist/runtime/process-group-direct-contract.d.ts +181 -0
- package/dist/runtime/process-group-direct-contract.d.ts.map +1 -0
- package/dist/runtime/process-group-direct-contract.js +151 -0
- package/dist/runtime/process-group-direct-contract.js.map +1 -0
- package/dist/runtime/process-group-direct-review.d.ts +203 -0
- package/dist/runtime/process-group-direct-review.d.ts.map +1 -0
- package/dist/runtime/process-group-direct-review.js +263 -0
- package/dist/runtime/process-group-direct-review.js.map +1 -0
- package/dist/runtime/process-group-direct-runtime.d.ts +18 -0
- package/dist/runtime/process-group-direct-runtime.d.ts.map +1 -0
- package/dist/runtime/process-group-direct-runtime.js +154 -0
- package/dist/runtime/process-group-direct-runtime.js.map +1 -0
- package/dist/runtime/process-group-snapshot.mjs +44 -0
- package/dist/uns-mqtt/mqtt-proxy.d.ts +1 -0
- package/dist/uns-mqtt/mqtt-proxy.d.ts.map +1 -1
- package/dist/uns-mqtt/mqtt-proxy.js +5 -0
- package/dist/uns-mqtt/mqtt-proxy.js.map +1 -1
- package/dist/uns-mqtt/uns-mqtt-proxy.d.ts +6 -0
- package/dist/uns-mqtt/uns-mqtt-proxy.d.ts.map +1 -1
- package/dist/uns-mqtt/uns-mqtt-proxy.js +14 -0
- package/dist/uns-mqtt/uns-mqtt-proxy.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const processGroupDirectDescriptorSchema: z.ZodObject<{
|
|
3
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
4
|
+
namespace: z.ZodString;
|
|
5
|
+
publisherPath: z.ZodArray<z.ZodString>;
|
|
6
|
+
journalPath: z.ZodArray<z.ZodString>;
|
|
7
|
+
runtimeRolePath: z.ZodArray<z.ZodString>;
|
|
8
|
+
directRole: z.ZodString;
|
|
9
|
+
resources: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
10
|
+
kind: z.ZodLiteral<"file">;
|
|
11
|
+
manifestPath: z.ZodArray<z.ZodString>;
|
|
12
|
+
manifests: z.ZodArray<z.ZodObject<{
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
file: z.ZodString;
|
|
15
|
+
}, z.core.$strict>>;
|
|
16
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
17
|
+
kind: z.ZodLiteral<"configuration">;
|
|
18
|
+
groupPath: z.ZodArray<z.ZodString>;
|
|
19
|
+
}, z.core.$strict>], "kind">>;
|
|
20
|
+
match: z.ZodOptional<z.ZodObject<{
|
|
21
|
+
path: z.ZodArray<z.ZodString>;
|
|
22
|
+
value: z.ZodString;
|
|
23
|
+
}, z.core.$strict>>;
|
|
24
|
+
}, z.core.$strict>;
|
|
25
|
+
export type ProcessGroupDirectDescriptor = z.infer<typeof processGroupDirectDescriptorSchema>;
|
|
26
|
+
export declare const processGroupDirectInputSchema: z.ZodObject<{
|
|
27
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
28
|
+
source: z.ZodObject<{
|
|
29
|
+
publisher: z.ZodObject<{
|
|
30
|
+
controller: z.ZodString;
|
|
31
|
+
rttNode: z.ZodString;
|
|
32
|
+
version: z.ZodString;
|
|
33
|
+
instanceId: z.ZodString;
|
|
34
|
+
}, z.core.$strict>;
|
|
35
|
+
receiver: z.ZodObject<{
|
|
36
|
+
controller: z.ZodString;
|
|
37
|
+
rttNode: z.ZodString;
|
|
38
|
+
version: z.ZodString;
|
|
39
|
+
instanceId: z.ZodString;
|
|
40
|
+
}, z.core.$strict>;
|
|
41
|
+
}, z.core.$strict>;
|
|
42
|
+
target: z.ZodObject<{
|
|
43
|
+
controller: z.ZodString;
|
|
44
|
+
rttNode: z.ZodString;
|
|
45
|
+
version: z.ZodString;
|
|
46
|
+
instanceId: z.ZodString;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
}, z.core.$strict>;
|
|
49
|
+
export type ProcessGroupDirectInput = z.infer<typeof processGroupDirectInputSchema>;
|
|
50
|
+
export declare const processGroupDirectRequestSchema: z.ZodObject<{
|
|
51
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
52
|
+
controllerName: z.ZodString;
|
|
53
|
+
id: z.ZodString;
|
|
54
|
+
action: z.ZodEnum<{
|
|
55
|
+
get: "get";
|
|
56
|
+
preview: "preview";
|
|
57
|
+
prepare: "prepare";
|
|
58
|
+
execute: "execute";
|
|
59
|
+
rollback: "rollback";
|
|
60
|
+
"close-recovery": "close-recovery";
|
|
61
|
+
}>;
|
|
62
|
+
input: z.ZodOptional<z.ZodObject<{
|
|
63
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
64
|
+
source: z.ZodObject<{
|
|
65
|
+
publisher: z.ZodObject<{
|
|
66
|
+
controller: z.ZodString;
|
|
67
|
+
rttNode: z.ZodString;
|
|
68
|
+
version: z.ZodString;
|
|
69
|
+
instanceId: z.ZodString;
|
|
70
|
+
}, z.core.$strict>;
|
|
71
|
+
receiver: z.ZodObject<{
|
|
72
|
+
controller: z.ZodString;
|
|
73
|
+
rttNode: z.ZodString;
|
|
74
|
+
version: z.ZodString;
|
|
75
|
+
instanceId: z.ZodString;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
}, z.core.$strict>;
|
|
78
|
+
target: z.ZodObject<{
|
|
79
|
+
controller: z.ZodString;
|
|
80
|
+
rttNode: z.ZodString;
|
|
81
|
+
version: z.ZodString;
|
|
82
|
+
instanceId: z.ZodString;
|
|
83
|
+
}, z.core.$strict>;
|
|
84
|
+
}, z.core.$strict>>;
|
|
85
|
+
expectedFingerprint: z.ZodOptional<z.ZodString>;
|
|
86
|
+
expectedRevision: z.ZodOptional<z.ZodNumber>;
|
|
87
|
+
}, z.core.$strict>;
|
|
88
|
+
export type ProcessGroupDirectRequest = z.infer<typeof processGroupDirectRequestSchema>;
|
|
89
|
+
export declare const retiredJournalReferenceSchema: z.ZodObject<{
|
|
90
|
+
directory: z.ZodString;
|
|
91
|
+
journalId: z.ZodString;
|
|
92
|
+
journalContractSha256: z.ZodString;
|
|
93
|
+
generationId: z.ZodString;
|
|
94
|
+
groupSha256: z.ZodOptional<z.ZodString>;
|
|
95
|
+
contractVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
|
|
96
|
+
maxRecords: z.ZodNumber;
|
|
97
|
+
maxBytes: z.ZodNumber;
|
|
98
|
+
minFreeBytes: z.ZodNumber;
|
|
99
|
+
profiles: z.ZodArray<z.ZodObject<{
|
|
100
|
+
processName: z.ZodString;
|
|
101
|
+
mappingSha256: z.ZodString;
|
|
102
|
+
dataGroup: z.ZodString;
|
|
103
|
+
}, z.core.$strict>>;
|
|
104
|
+
}, z.core.$strict>;
|
|
105
|
+
export type RetiredJournalReference = z.infer<typeof retiredJournalReferenceSchema>;
|
|
106
|
+
export declare const processGroupRetirementPolicySchema: z.ZodObject<{
|
|
107
|
+
schemaVersion: z.ZodLiteral<5>;
|
|
108
|
+
kind: z.ZodLiteral<"uns-process-group-direct-retirement">;
|
|
109
|
+
protocolVersion: z.ZodLiteral<1>;
|
|
110
|
+
operationId: z.ZodString;
|
|
111
|
+
packageName: z.ZodString;
|
|
112
|
+
namespace: z.ZodString;
|
|
113
|
+
groupId: z.ZodString;
|
|
114
|
+
controllerName: z.ZodString;
|
|
115
|
+
stateRoot: z.ZodString;
|
|
116
|
+
recovery: z.ZodEnum<{
|
|
117
|
+
closed: "closed";
|
|
118
|
+
open: "open";
|
|
119
|
+
}>;
|
|
120
|
+
journal: z.ZodObject<{
|
|
121
|
+
directory: z.ZodString;
|
|
122
|
+
journalId: z.ZodString;
|
|
123
|
+
journalContractSha256: z.ZodString;
|
|
124
|
+
generationId: z.ZodString;
|
|
125
|
+
groupSha256: z.ZodOptional<z.ZodString>;
|
|
126
|
+
contractVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
|
|
127
|
+
maxRecords: z.ZodNumber;
|
|
128
|
+
maxBytes: z.ZodNumber;
|
|
129
|
+
minFreeBytes: z.ZodNumber;
|
|
130
|
+
profiles: z.ZodArray<z.ZodObject<{
|
|
131
|
+
processName: z.ZodString;
|
|
132
|
+
mappingSha256: z.ZodString;
|
|
133
|
+
dataGroup: z.ZodString;
|
|
134
|
+
}, z.core.$strict>>;
|
|
135
|
+
}, z.core.$strict>;
|
|
136
|
+
sourcePolicyJson: z.ZodString;
|
|
137
|
+
sourcePolicySha256: z.ZodString;
|
|
138
|
+
source: z.ZodObject<{
|
|
139
|
+
publisher: z.ZodObject<{
|
|
140
|
+
placement: z.ZodObject<{
|
|
141
|
+
controller: z.ZodString;
|
|
142
|
+
rttNode: z.ZodString;
|
|
143
|
+
version: z.ZodString;
|
|
144
|
+
instanceId: z.ZodString;
|
|
145
|
+
}, z.core.$strict>;
|
|
146
|
+
processName: z.ZodString;
|
|
147
|
+
configurationSha256: z.ZodString;
|
|
148
|
+
artifactSha256: z.ZodString;
|
|
149
|
+
policyConfigurationSha256: z.ZodString;
|
|
150
|
+
}, z.core.$strict>;
|
|
151
|
+
receiver: z.ZodObject<{
|
|
152
|
+
placement: z.ZodObject<{
|
|
153
|
+
controller: z.ZodString;
|
|
154
|
+
rttNode: z.ZodString;
|
|
155
|
+
version: z.ZodString;
|
|
156
|
+
instanceId: z.ZodString;
|
|
157
|
+
}, z.core.$strict>;
|
|
158
|
+
processName: z.ZodString;
|
|
159
|
+
configurationSha256: z.ZodString;
|
|
160
|
+
artifactSha256: z.ZodString;
|
|
161
|
+
policyConfigurationSha256: z.ZodString;
|
|
162
|
+
}, z.core.$strict>;
|
|
163
|
+
}, z.core.$strict>;
|
|
164
|
+
target: z.ZodObject<{
|
|
165
|
+
placement: z.ZodObject<{
|
|
166
|
+
controller: z.ZodString;
|
|
167
|
+
rttNode: z.ZodString;
|
|
168
|
+
version: z.ZodString;
|
|
169
|
+
instanceId: z.ZodString;
|
|
170
|
+
}, z.core.$strict>;
|
|
171
|
+
processName: z.ZodString;
|
|
172
|
+
configurationSha256: z.ZodString;
|
|
173
|
+
artifactSha256: z.ZodString;
|
|
174
|
+
packageRoot: z.ZodString;
|
|
175
|
+
descriptorSha256: z.ZodString;
|
|
176
|
+
resourceSha256: z.ZodString;
|
|
177
|
+
channelsSha256: z.ZodString;
|
|
178
|
+
}, z.core.$strict>;
|
|
179
|
+
}, z.core.$strict>;
|
|
180
|
+
export type ProcessGroupRetirementPolicy = z.infer<typeof processGroupRetirementPolicySchema>;
|
|
181
|
+
//# sourceMappingURL=process-group-direct-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-group-direct-contract.d.ts","sourceRoot":"","sources":["../../src/runtime/process-group-direct-contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8BxB,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;kBA2B3C,CAAC;AACL,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAC9F,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;kBActC,CAAC;AACL,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACpF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAkBxC,CAAC;AACL,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;kBA4BtC,CAAC;AACL,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAOpF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA+B3C,CAAC;AACL,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { processGroupConfigurationSelectorSchema as selector } from "./process-group-contract.js";
|
|
4
|
+
import { groupPlacementSchema, placementKey } from "./process-group-control-contract.js";
|
|
5
|
+
const identity = z.string().regex(/^[a-z][a-z0-9-]{0,99}$/);
|
|
6
|
+
const digest = z.string().regex(/^[a-f0-9]{64}$/);
|
|
7
|
+
const absolute = z
|
|
8
|
+
.string()
|
|
9
|
+
.min(1)
|
|
10
|
+
.max(512)
|
|
11
|
+
.refine((v) => path.isAbsolute(v) && path.resolve(v) === v);
|
|
12
|
+
const relative = z
|
|
13
|
+
.string()
|
|
14
|
+
.min(1)
|
|
15
|
+
.max(512)
|
|
16
|
+
.refine((v) => !path.isAbsolute(v) && path.normalize(v) === v && !v.split(/[\\/]/).some((p) => p === ".." || p === ".") && !v.includes("\0"));
|
|
17
|
+
/** Package data, never launch authority. Selectors are reusable across applications. */
|
|
18
|
+
const resource = z.discriminatedUnion("kind", [
|
|
19
|
+
z.strictObject({
|
|
20
|
+
kind: z.literal("file"),
|
|
21
|
+
manifestPath: selector,
|
|
22
|
+
manifests: z
|
|
23
|
+
.array(z.strictObject({ id: identity, file: relative }))
|
|
24
|
+
.min(1)
|
|
25
|
+
.max(64),
|
|
26
|
+
}),
|
|
27
|
+
z.strictObject({ kind: z.literal("configuration"), groupPath: selector }),
|
|
28
|
+
]);
|
|
29
|
+
export const processGroupDirectDescriptorSchema = z
|
|
30
|
+
.strictObject({
|
|
31
|
+
protocolVersion: z.literal(1),
|
|
32
|
+
namespace: identity,
|
|
33
|
+
publisherPath: selector,
|
|
34
|
+
journalPath: selector,
|
|
35
|
+
runtimeRolePath: selector,
|
|
36
|
+
directRole: identity,
|
|
37
|
+
resources: z.array(resource).min(1).max(2),
|
|
38
|
+
match: z.strictObject({ path: selector, value: z.string().min(1).max(100) }).optional(),
|
|
39
|
+
})
|
|
40
|
+
.superRefine((v, c) => {
|
|
41
|
+
if (new Set(v.resources.map((r) => r.kind)).size !== v.resources.length)
|
|
42
|
+
c.addIssue({ code: "custom", message: "Distinct direct resource kinds required" });
|
|
43
|
+
for (const r of v.resources) {
|
|
44
|
+
const resourcePath = r.kind === "file" ? r.manifestPath : r.groupPath;
|
|
45
|
+
if (resourcePath.length <= v.publisherPath.length || !v.publisherPath.every((key, i) => resourcePath[i] === key))
|
|
46
|
+
c.addIssue({ code: "custom", message: "Direct resource selector must be a publisher leaf" });
|
|
47
|
+
if (r.kind === "file" &&
|
|
48
|
+
(new Set(r.manifests.map((m) => m.id)).size !== r.manifests.length || new Set(r.manifests.map((m) => m.file)).size !== r.manifests.length))
|
|
49
|
+
c.addIssue({ code: "custom", message: "Distinct direct manifest resources required" });
|
|
50
|
+
}
|
|
51
|
+
const paths = [v.publisherPath, v.journalPath, v.runtimeRolePath].map((p) => p.join("."));
|
|
52
|
+
if (new Set(paths).size !== paths.length || paths.some((p, i) => paths.some((q, j) => i !== j && q.startsWith(p + "."))))
|
|
53
|
+
c.addIssue({ code: "custom", message: "Distinct lifecycle selectors required" });
|
|
54
|
+
});
|
|
55
|
+
export const processGroupDirectInputSchema = z
|
|
56
|
+
.strictObject({
|
|
57
|
+
protocolVersion: z.literal(1),
|
|
58
|
+
source: z.strictObject({ publisher: groupPlacementSchema, receiver: groupPlacementSchema }),
|
|
59
|
+
target: groupPlacementSchema,
|
|
60
|
+
})
|
|
61
|
+
.superRefine((v, c) => {
|
|
62
|
+
const all = [v.source.publisher, v.source.receiver, v.target];
|
|
63
|
+
if (new Set(all.map(placementKey)).size !== 3 ||
|
|
64
|
+
all.some((p) => p.controller !== all[0].controller || p.rttNode !== all[0].rttNode) ||
|
|
65
|
+
v.source.publisher.version !== v.source.receiver.version)
|
|
66
|
+
c.addIssue({ code: "custom", message: "Three distinct placements with one owning controller/package and one source-pair version required" });
|
|
67
|
+
});
|
|
68
|
+
export const processGroupDirectRequestSchema = z
|
|
69
|
+
.strictObject({
|
|
70
|
+
protocolVersion: z.literal(1),
|
|
71
|
+
controllerName: groupPlacementSchema.shape.controller,
|
|
72
|
+
id: z.string().uuid(),
|
|
73
|
+
action: z.enum(["preview", "prepare", "get", "execute", "rollback", "close-recovery"]),
|
|
74
|
+
input: processGroupDirectInputSchema.optional(),
|
|
75
|
+
expectedFingerprint: digest.optional(),
|
|
76
|
+
expectedRevision: z.number().int().positive().optional(),
|
|
77
|
+
})
|
|
78
|
+
.superRefine((v, c) => {
|
|
79
|
+
if ((["preview", "prepare"].includes(v.action) && !v.input) ||
|
|
80
|
+
(["prepare", "execute", "rollback", "close-recovery"].includes(v.action) && !v.expectedFingerprint) ||
|
|
81
|
+
(["execute", "rollback", "close-recovery"].includes(v.action) && !v.expectedRevision) ||
|
|
82
|
+
(v.input && v.input.target.controller !== v.controllerName))
|
|
83
|
+
c.addIssue({ code: "custom", message: "Exact transition identity, owning member and reviewed revision required" });
|
|
84
|
+
});
|
|
85
|
+
export const retiredJournalReferenceSchema = z
|
|
86
|
+
.strictObject({
|
|
87
|
+
directory: absolute,
|
|
88
|
+
journalId: z.string().uuid(),
|
|
89
|
+
journalContractSha256: digest,
|
|
90
|
+
generationId: identity,
|
|
91
|
+
groupSha256: digest.optional(),
|
|
92
|
+
contractVersion: z.union([z.literal(1), z.literal(2)]),
|
|
93
|
+
maxRecords: z.number().int().min(1).max(100000),
|
|
94
|
+
maxBytes: z
|
|
95
|
+
.number()
|
|
96
|
+
.int()
|
|
97
|
+
.min(1024)
|
|
98
|
+
.max(256 * 1024 * 1024),
|
|
99
|
+
minFreeBytes: z
|
|
100
|
+
.number()
|
|
101
|
+
.int()
|
|
102
|
+
.min(0)
|
|
103
|
+
.max(1024 * 1024 * 1024),
|
|
104
|
+
profiles: z
|
|
105
|
+
.array(z.strictObject({ processName: identity, mappingSha256: digest, dataGroup: identity }))
|
|
106
|
+
.min(2)
|
|
107
|
+
.max(16),
|
|
108
|
+
})
|
|
109
|
+
.superRefine((v, c) => {
|
|
110
|
+
if (v.contractVersion === 2 && !v.groupSha256)
|
|
111
|
+
c.addIssue({ code: "custom", message: "Configuration generation identity required" });
|
|
112
|
+
if (new Set(v.profiles.map((p) => p.processName)).size !== v.profiles.length)
|
|
113
|
+
c.addIssue({ code: "custom", message: "Distinct retained profiles required" });
|
|
114
|
+
});
|
|
115
|
+
const member = z.strictObject({
|
|
116
|
+
placement: groupPlacementSchema,
|
|
117
|
+
processName: identity,
|
|
118
|
+
configurationSha256: digest,
|
|
119
|
+
artifactSha256: digest,
|
|
120
|
+
});
|
|
121
|
+
export const processGroupRetirementPolicySchema = z
|
|
122
|
+
.strictObject({
|
|
123
|
+
schemaVersion: z.literal(5),
|
|
124
|
+
kind: z.literal("uns-process-group-direct-retirement"),
|
|
125
|
+
protocolVersion: z.literal(1),
|
|
126
|
+
operationId: z.string().uuid(),
|
|
127
|
+
packageName: z.string().min(1).max(214),
|
|
128
|
+
namespace: identity,
|
|
129
|
+
groupId: identity,
|
|
130
|
+
controllerName: groupPlacementSchema.shape.controller,
|
|
131
|
+
stateRoot: absolute,
|
|
132
|
+
recovery: z.enum(["open", "closed"]),
|
|
133
|
+
journal: retiredJournalReferenceSchema,
|
|
134
|
+
sourcePolicyJson: z.string().min(1).max(32768),
|
|
135
|
+
sourcePolicySha256: digest,
|
|
136
|
+
source: z.strictObject({
|
|
137
|
+
publisher: member.extend({ policyConfigurationSha256: digest }),
|
|
138
|
+
receiver: member.extend({ policyConfigurationSha256: digest }),
|
|
139
|
+
}),
|
|
140
|
+
target: member.extend({ packageRoot: absolute, descriptorSha256: digest, resourceSha256: digest, channelsSha256: digest }),
|
|
141
|
+
})
|
|
142
|
+
.superRefine((v, c) => {
|
|
143
|
+
if (v.target.processName !== v.source.publisher.processName ||
|
|
144
|
+
v.source.receiver.processName === v.target.processName ||
|
|
145
|
+
v.source.publisher.placement.controller !== v.controllerName ||
|
|
146
|
+
v.source.receiver.placement.controller !== v.controllerName ||
|
|
147
|
+
v.target.placement.controller !== v.controllerName ||
|
|
148
|
+
v.journal.profiles.some((p) => [v.target.processName, v.source.receiver.processName].includes(p.processName)))
|
|
149
|
+
c.addIssue({ code: "custom", message: "Exact paired and direct ownership identities required" });
|
|
150
|
+
});
|
|
151
|
+
//# sourceMappingURL=process-group-direct-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-group-direct-contract.js","sourceRoot":"","sources":["../../src/runtime/process-group-direct-contract.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,uCAAuC,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAClG,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAEzF,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAC5D,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AAClD,MAAM,QAAQ,GAAG,CAAC;KACf,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,MAAM,CAAC,CAAC,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AAW,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC;CAC3H,CAAC;KACD,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;IACpB,IACE,CAAC,CAAC,MAAM,CAAC,WAAW,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW;QACvD,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,KAAK,CAAC,CAAC,MAAM,CAAC,WAAW;QACtD,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,UAAU,KAAK,CAAC,CAAC,cAAc;QAC5D,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,KAAK,CAAC,CAAC,cAAc;QAC3D,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,KAAK,CAAC,CAAC,cAAc;QAClD,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QAE7G,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,uDAAuD,EAAE,CAAC,CAAC;AACrG,CAAC,CAAC,CAAC","sourcesContent":["import path from \"node:path\";\nimport { z } from \"zod\";\n\nimport { processGroupConfigurationSelectorSchema as selector } from \"./process-group-contract.js\";\nimport { groupPlacementSchema, placementKey } from \"./process-group-control-contract.js\";\n\nconst identity = z.string().regex(/^[a-z][a-z0-9-]{0,99}$/);\nconst digest = z.string().regex(/^[a-f0-9]{64}$/);\nconst absolute = z\n .string()\n .min(1)\n .max(512)\n .refine((v) => path.isAbsolute(v) && path.resolve(v) === v);\nconst relative = z\n .string()\n .min(1)\n .max(512)\n .refine((v) => !path.isAbsolute(v) && path.normalize(v) === v && !v.split(/[\\\\/]/).some((p) => p === \"..\" || p === \".\") && !v.includes(\"\\0\"));\n\n/** Package data, never launch authority. Selectors are reusable across applications. */\nconst resource = z.discriminatedUnion(\"kind\", [\n z.strictObject({\n kind: z.literal(\"file\"),\n manifestPath: selector,\n manifests: z\n .array(z.strictObject({ id: identity, file: relative }))\n .min(1)\n .max(64),\n }),\n z.strictObject({ kind: z.literal(\"configuration\"), groupPath: selector }),\n]);\nexport const processGroupDirectDescriptorSchema = z\n .strictObject({\n protocolVersion: z.literal(1),\n namespace: identity,\n publisherPath: selector,\n journalPath: selector,\n runtimeRolePath: selector,\n directRole: identity,\n resources: z.array(resource).min(1).max(2),\n match: z.strictObject({ path: selector, value: z.string().min(1).max(100) }).optional(),\n })\n .superRefine((v, c) => {\n if (new Set(v.resources.map((r) => r.kind)).size !== v.resources.length)\n c.addIssue({ code: \"custom\", message: \"Distinct direct resource kinds required\" });\n for (const r of v.resources) {\n const resourcePath = r.kind === \"file\" ? r.manifestPath : r.groupPath;\n if (resourcePath.length <= v.publisherPath.length || !v.publisherPath.every((key, i) => resourcePath[i] === key))\n c.addIssue({ code: \"custom\", message: \"Direct resource selector must be a publisher leaf\" });\n if (\n r.kind === \"file\" &&\n (new Set(r.manifests.map((m) => m.id)).size !== r.manifests.length || new Set(r.manifests.map((m) => m.file)).size !== r.manifests.length)\n )\n c.addIssue({ code: \"custom\", message: \"Distinct direct manifest resources required\" });\n }\n const paths = [v.publisherPath, v.journalPath, v.runtimeRolePath].map((p) => p.join(\".\"));\n if (new Set(paths).size !== paths.length || paths.some((p, i) => paths.some((q, j) => i !== j && q.startsWith(p + \".\"))))\n c.addIssue({ code: \"custom\", message: \"Distinct lifecycle selectors required\" });\n });\nexport type ProcessGroupDirectDescriptor = z.infer<typeof processGroupDirectDescriptorSchema>;\nexport const processGroupDirectInputSchema = z\n .strictObject({\n protocolVersion: z.literal(1),\n source: z.strictObject({ publisher: groupPlacementSchema, receiver: groupPlacementSchema }),\n target: groupPlacementSchema,\n })\n .superRefine((v, c) => {\n const all = [v.source.publisher, v.source.receiver, v.target];\n if (\n new Set(all.map(placementKey)).size !== 3 ||\n all.some((p) => p.controller !== all[0]!.controller || p.rttNode !== all[0]!.rttNode) ||\n v.source.publisher.version !== v.source.receiver.version\n )\n c.addIssue({ code: \"custom\", message: \"Three distinct placements with one owning controller/package and one source-pair version required\" });\n });\nexport type ProcessGroupDirectInput = z.infer<typeof processGroupDirectInputSchema>;\nexport const processGroupDirectRequestSchema = z\n .strictObject({\n protocolVersion: z.literal(1),\n controllerName: groupPlacementSchema.shape.controller,\n id: z.string().uuid(),\n action: z.enum([\"preview\", \"prepare\", \"get\", \"execute\", \"rollback\", \"close-recovery\"]),\n input: processGroupDirectInputSchema.optional(),\n expectedFingerprint: digest.optional(),\n expectedRevision: z.number().int().positive().optional(),\n })\n .superRefine((v, c) => {\n if (\n ([\"preview\", \"prepare\"].includes(v.action) && !v.input) ||\n ([\"prepare\", \"execute\", \"rollback\", \"close-recovery\"].includes(v.action) && !v.expectedFingerprint) ||\n ([\"execute\", \"rollback\", \"close-recovery\"].includes(v.action) && !v.expectedRevision) ||\n (v.input && v.input.target.controller !== v.controllerName)\n )\n c.addIssue({ code: \"custom\", message: \"Exact transition identity, owning member and reviewed revision required\" });\n });\nexport type ProcessGroupDirectRequest = z.infer<typeof processGroupDirectRequestSchema>;\nexport const retiredJournalReferenceSchema = z\n .strictObject({\n directory: absolute,\n journalId: z.string().uuid(),\n journalContractSha256: digest,\n generationId: identity,\n groupSha256: digest.optional(),\n contractVersion: z.union([z.literal(1), z.literal(2)]),\n maxRecords: z.number().int().min(1).max(100000),\n maxBytes: z\n .number()\n .int()\n .min(1024)\n .max(256 * 1024 * 1024),\n minFreeBytes: z\n .number()\n .int()\n .min(0)\n .max(1024 * 1024 * 1024),\n profiles: z\n .array(z.strictObject({ processName: identity, mappingSha256: digest, dataGroup: identity }))\n .min(2)\n .max(16),\n })\n .superRefine((v, c) => {\n if (v.contractVersion === 2 && !v.groupSha256) c.addIssue({ code: \"custom\", message: \"Configuration generation identity required\" });\n if (new Set(v.profiles.map((p) => p.processName)).size !== v.profiles.length)\n c.addIssue({ code: \"custom\", message: \"Distinct retained profiles required\" });\n });\nexport type RetiredJournalReference = z.infer<typeof retiredJournalReferenceSchema>;\nconst member = z.strictObject({\n placement: groupPlacementSchema,\n processName: identity,\n configurationSha256: digest,\n artifactSha256: digest,\n});\nexport const processGroupRetirementPolicySchema = z\n .strictObject({\n schemaVersion: z.literal(5),\n kind: z.literal(\"uns-process-group-direct-retirement\"),\n protocolVersion: z.literal(1),\n operationId: z.string().uuid(),\n packageName: z.string().min(1).max(214),\n namespace: identity,\n groupId: identity,\n controllerName: groupPlacementSchema.shape.controller,\n stateRoot: absolute,\n recovery: z.enum([\"open\", \"closed\"]),\n journal: retiredJournalReferenceSchema,\n sourcePolicyJson: z.string().min(1).max(32768),\n sourcePolicySha256: digest,\n source: z.strictObject({\n publisher: member.extend({ policyConfigurationSha256: digest }),\n receiver: member.extend({ policyConfigurationSha256: digest }),\n }),\n target: member.extend({ packageRoot: absolute, descriptorSha256: digest, resourceSha256: digest, channelsSha256: digest }),\n })\n .superRefine((v, c) => {\n if (\n v.target.processName !== v.source.publisher.processName ||\n v.source.receiver.processName === v.target.processName ||\n v.source.publisher.placement.controller !== v.controllerName ||\n v.source.receiver.placement.controller !== v.controllerName ||\n v.target.placement.controller !== v.controllerName ||\n v.journal.profiles.some((p) => [v.target.processName, v.source.receiver.processName].includes(p.processName))\n )\n c.addIssue({ code: \"custom\", message: \"Exact paired and direct ownership identities required\" });\n });\nexport type ProcessGroupRetirementPolicy = z.infer<typeof processGroupRetirementPolicySchema>;\n"]}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { type ProcessGroupDirectDescriptor } from "./process-group-direct-contract.js";
|
|
2
|
+
import type { GenerationJournalReference } from "./process-group-generation.js";
|
|
3
|
+
import type { UpgradeConfiguration } from "./process-group-upgrade.js";
|
|
4
|
+
type Config = UpgradeConfiguration;
|
|
5
|
+
export type DirectTransitionConfigurations = {
|
|
6
|
+
source: {
|
|
7
|
+
publisher: Config;
|
|
8
|
+
receiver: Config;
|
|
9
|
+
};
|
|
10
|
+
target: Config;
|
|
11
|
+
};
|
|
12
|
+
export declare function processGroupDirectDescriptor(packageRoot: string): ProcessGroupDirectDescriptor | undefined;
|
|
13
|
+
export declare function describeDirectProcessGroup(c: Config): {
|
|
14
|
+
descriptor: {
|
|
15
|
+
protocolVersion: 1;
|
|
16
|
+
namespace: string;
|
|
17
|
+
publisherPath: string[];
|
|
18
|
+
journalPath: string[];
|
|
19
|
+
runtimeRolePath: string[];
|
|
20
|
+
directRole: string;
|
|
21
|
+
resources: ({
|
|
22
|
+
kind: "file";
|
|
23
|
+
manifestPath: string[];
|
|
24
|
+
manifests: {
|
|
25
|
+
id: string;
|
|
26
|
+
file: string;
|
|
27
|
+
}[];
|
|
28
|
+
} | {
|
|
29
|
+
kind: "configuration";
|
|
30
|
+
groupPath: string[];
|
|
31
|
+
})[];
|
|
32
|
+
match?: {
|
|
33
|
+
path: string[];
|
|
34
|
+
value: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
resource: {
|
|
38
|
+
kind: "configuration";
|
|
39
|
+
groupPath: string[];
|
|
40
|
+
};
|
|
41
|
+
groupId: string;
|
|
42
|
+
processName: string;
|
|
43
|
+
resourceSha256: string;
|
|
44
|
+
profiles: {
|
|
45
|
+
processName: string;
|
|
46
|
+
mappingSha256: string;
|
|
47
|
+
dataGroup: string;
|
|
48
|
+
}[];
|
|
49
|
+
snapshot: import("./configuration-group-contract.js").ConfigurationGroupSnapshot;
|
|
50
|
+
manifest?: undefined;
|
|
51
|
+
manifestPath?: undefined;
|
|
52
|
+
manifestFile?: undefined;
|
|
53
|
+
} | {
|
|
54
|
+
descriptor: {
|
|
55
|
+
protocolVersion: 1;
|
|
56
|
+
namespace: string;
|
|
57
|
+
publisherPath: string[];
|
|
58
|
+
journalPath: string[];
|
|
59
|
+
runtimeRolePath: string[];
|
|
60
|
+
directRole: string;
|
|
61
|
+
resources: ({
|
|
62
|
+
kind: "file";
|
|
63
|
+
manifestPath: string[];
|
|
64
|
+
manifests: {
|
|
65
|
+
id: string;
|
|
66
|
+
file: string;
|
|
67
|
+
}[];
|
|
68
|
+
} | {
|
|
69
|
+
kind: "configuration";
|
|
70
|
+
groupPath: string[];
|
|
71
|
+
})[];
|
|
72
|
+
match?: {
|
|
73
|
+
path: string[];
|
|
74
|
+
value: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
resource: {
|
|
78
|
+
kind: "file";
|
|
79
|
+
manifestPath: string[];
|
|
80
|
+
manifests: {
|
|
81
|
+
id: string;
|
|
82
|
+
file: string;
|
|
83
|
+
}[];
|
|
84
|
+
};
|
|
85
|
+
groupId: string;
|
|
86
|
+
processName: string;
|
|
87
|
+
resourceSha256: string;
|
|
88
|
+
profiles: {
|
|
89
|
+
processName: string;
|
|
90
|
+
mappingSha256: string;
|
|
91
|
+
dataGroup: string;
|
|
92
|
+
}[];
|
|
93
|
+
manifest: {
|
|
94
|
+
schemaVersion: 1;
|
|
95
|
+
id: string;
|
|
96
|
+
inputTopic: string;
|
|
97
|
+
processName: string;
|
|
98
|
+
profiles: {
|
|
99
|
+
id: string;
|
|
100
|
+
processName: string;
|
|
101
|
+
mappingFile: string;
|
|
102
|
+
mappingSha256: string;
|
|
103
|
+
dataGroup: string;
|
|
104
|
+
}[];
|
|
105
|
+
};
|
|
106
|
+
manifestPath: string;
|
|
107
|
+
manifestFile: string;
|
|
108
|
+
snapshot?: undefined;
|
|
109
|
+
};
|
|
110
|
+
/** Data-only installed-resource review. Does not stop, initialize, rewrite or grant launch authority. */
|
|
111
|
+
export declare function reviewInstalledProcessGroupDirectTransition(operationId: string, rawInput: unknown, configs: DirectTransitionConfigurations, stateRoot: string, excludedUnsFields?: readonly string[]): {
|
|
112
|
+
review: {
|
|
113
|
+
protocolVersion: 1;
|
|
114
|
+
kind: "paired-to-direct";
|
|
115
|
+
input: {
|
|
116
|
+
protocolVersion: 1;
|
|
117
|
+
source: {
|
|
118
|
+
publisher: {
|
|
119
|
+
controller: string;
|
|
120
|
+
rttNode: string;
|
|
121
|
+
version: string;
|
|
122
|
+
instanceId: string;
|
|
123
|
+
};
|
|
124
|
+
receiver: {
|
|
125
|
+
controller: string;
|
|
126
|
+
rttNode: string;
|
|
127
|
+
version: string;
|
|
128
|
+
instanceId: string;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
target: {
|
|
132
|
+
controller: string;
|
|
133
|
+
rttNode: string;
|
|
134
|
+
version: string;
|
|
135
|
+
instanceId: string;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
operationId: string;
|
|
139
|
+
policyFile: string;
|
|
140
|
+
sourcePolicySha256: string;
|
|
141
|
+
targetPolicySha256: string;
|
|
142
|
+
journal: GenerationJournalReference;
|
|
143
|
+
source: {
|
|
144
|
+
publisher: {
|
|
145
|
+
placement: {
|
|
146
|
+
controller: string;
|
|
147
|
+
rttNode: string;
|
|
148
|
+
version: string;
|
|
149
|
+
instanceId: string;
|
|
150
|
+
};
|
|
151
|
+
processName: string;
|
|
152
|
+
configurationSha256: string;
|
|
153
|
+
artifactSha256: string;
|
|
154
|
+
policyConfigurationSha256: string;
|
|
155
|
+
};
|
|
156
|
+
receiver: {
|
|
157
|
+
placement: {
|
|
158
|
+
controller: string;
|
|
159
|
+
rttNode: string;
|
|
160
|
+
version: string;
|
|
161
|
+
instanceId: string;
|
|
162
|
+
};
|
|
163
|
+
processName: string;
|
|
164
|
+
configurationSha256: string;
|
|
165
|
+
artifactSha256: string;
|
|
166
|
+
policyConfigurationSha256: string;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
target: {
|
|
170
|
+
placement: {
|
|
171
|
+
controller: string;
|
|
172
|
+
rttNode: string;
|
|
173
|
+
version: string;
|
|
174
|
+
instanceId: string;
|
|
175
|
+
};
|
|
176
|
+
processName: string;
|
|
177
|
+
configurationSha256: string;
|
|
178
|
+
artifactSha256: string;
|
|
179
|
+
packageRoot: string;
|
|
180
|
+
descriptorSha256: string;
|
|
181
|
+
resourceSha256: string;
|
|
182
|
+
channelsSha256: string;
|
|
183
|
+
};
|
|
184
|
+
namespace: string;
|
|
185
|
+
groupId: string;
|
|
186
|
+
delivery: {
|
|
187
|
+
inputPausePossible: boolean;
|
|
188
|
+
exactlyOnceOutput: boolean;
|
|
189
|
+
brokerReplayNotTransferred: boolean;
|
|
190
|
+
};
|
|
191
|
+
usage: {
|
|
192
|
+
records: number;
|
|
193
|
+
bytes: number;
|
|
194
|
+
admitted: number;
|
|
195
|
+
completed: number;
|
|
196
|
+
lastSequence: number;
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
sourcePolicy: Buffer<ArrayBufferLike>;
|
|
200
|
+
targetPolicy: Buffer<ArrayBuffer>;
|
|
201
|
+
};
|
|
202
|
+
export {};
|
|
203
|
+
//# sourceMappingURL=process-group-direct-review.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-group-direct-review.d.ts","sourceRoot":"","sources":["../../src/runtime/process-group-direct-review.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,KAAK,4BAA4B,EAMlC,MAAM,oCAAoC,CAAC;AAE5C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAShF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,KAAK,MAAM,GAAG,oBAAoB,CAAC;AACnC,MAAM,MAAM,8BAA8B,GAAG;IAAE,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAMjH,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,MAAM,GAAG,4BAA4B,GAAG,SAAS,CAK1G;AACD,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsDnD;AA6BD,yGAAyG;AACzG,wBAAgB,2CAA2C,CACzD,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,8BAA8B,EACvC,SAAS,EAAE,MAAM,EACjB,iBAAiB,GAAE,SAAS,MAAM,EAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8J1C"}
|