@serve.zone/interfaces 19.8.0 → 20.1.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.
Files changed (44) hide show
  1. package/changelog.md +28 -0
  2. package/dist_ts/00_commitinfo_data.js +1 -1
  3. package/dist_ts/data/immutableimage.d.ts +2 -0
  4. package/dist_ts/data/immutableimage.js +1 -1
  5. package/dist_ts/data/index.d.ts +1 -0
  6. package/dist_ts/data/index.js +2 -1
  7. package/dist_ts/data/isolatedrestore.js +7 -82
  8. package/dist_ts/data/secret.d.ts +205 -0
  9. package/dist_ts/data/secret.js +469 -0
  10. package/dist_ts/data/secretbundle.d.ts +4 -0
  11. package/dist_ts/data/secretgroup.d.ts +4 -0
  12. package/dist_ts/data/service.d.ts +18 -6
  13. package/dist_ts/data/service.js +1 -1
  14. package/dist_ts/platform/index.d.ts +3 -1
  15. package/dist_ts/platform/index.js +4 -2
  16. package/dist_ts/platform/storagemigration.d.ts +346 -0
  17. package/dist_ts/platform/storagemigration.golden.d.ts +49 -0
  18. package/dist_ts/platform/storagemigration.golden.js +207 -0
  19. package/dist_ts/platform/storagemigration.js +1554 -0
  20. package/dist_ts/private/canonicaljson.d.ts +14 -0
  21. package/dist_ts/private/canonicaljson.js +154 -0
  22. package/dist_ts/requests/index.d.ts +2 -1
  23. package/dist_ts/requests/index.js +3 -2
  24. package/dist_ts/requests/secret.d.ts +198 -0
  25. package/dist_ts/requests/secret.js +2 -0
  26. package/dist_ts/runtime.d.ts +41 -0
  27. package/dist_ts/runtime.js +33 -0
  28. package/package.json +9 -2
  29. package/readme.md +162 -2
  30. package/ts/00_commitinfo_data.ts +1 -1
  31. package/ts/data/immutableimage.ts +2 -0
  32. package/ts/data/index.ts +1 -0
  33. package/ts/data/isolatedrestore.ts +12 -93
  34. package/ts/data/secret.ts +835 -0
  35. package/ts/data/secretbundle.ts +4 -0
  36. package/ts/data/secretgroup.ts +4 -0
  37. package/ts/data/service.ts +26 -6
  38. package/ts/platform/index.ts +3 -0
  39. package/ts/platform/storagemigration.golden.ts +241 -0
  40. package/ts/platform/storagemigration.ts +3082 -0
  41. package/ts/private/canonicaljson.ts +221 -0
  42. package/ts/requests/index.ts +2 -0
  43. package/ts/requests/secret.ts +256 -0
  44. package/ts/runtime.ts +80 -0
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @deprecated Compatibility-only persisted shape. Service-owned Secrets and
3
+ * explicit same-organization SecretSets replace this model.
4
+ */
1
5
  export interface ISecretBundle {
2
6
  id: string;
3
7
  data: {
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @deprecated Compatibility-only persisted shape. Migrate to ISecretMetadata
3
+ * and immutable SecretVersion records; do not create new SecretGroups.
4
+ */
1
5
  export interface ISecretGroup {
2
6
  /**
3
7
  * the insatnce id. This should be a random id, except for default
@@ -13,6 +13,10 @@ import type {
13
13
  IServicePublicPortMapping,
14
14
  IServiceTargetPort,
15
15
  } from './serviceports.js';
16
+ import type {
17
+ IServiceSecretConfiguration,
18
+ IServiceSecretDeploymentPlan,
19
+ } from './secret.js';
16
20
 
17
21
  export interface IServiceVolume {
18
22
  /** Stable Docker volume name. If omitted, Coreflow derives one from service id and mount path. */
@@ -258,14 +262,22 @@ export interface IService {
258
262
  reconciliationStatus?: IServiceReconciliationStatus;
259
263
  environment: { [key: string]: string };
260
264
  /**
261
- * the main secret bundle id, exclusive to the service
265
+ * Legacy main SecretBundle ID. New services use secretConfiguration and
266
+ * the server-managed secretDeployment manifest pointer.
267
+ *
268
+ * @deprecated Compatibility-only until the versioned SecretBundle migration completes.
262
269
  */
263
- secretBundleId: string;
270
+ secretBundleId?: string;
264
271
  /**
265
- * those secret bundle ids do not belong to the service itself
266
- * and thus live past the service lifecycle
272
+ * Legacy additional SecretBundle IDs.
273
+ *
274
+ * @deprecated Use explicit same-organization SecretSet attachments.
267
275
  */
268
276
  additionalSecretBundleIds?: string[];
277
+ /** Value-free, caller-managed SecretSet attachment configuration. */
278
+ secretConfiguration?: IServiceSecretConfiguration;
279
+ /** Server-managed immutable manifest authority pointer. */
280
+ secretDeployment?: IServiceSecretDeploymentPlan;
269
281
  /** Exact OCI/Docker argument vector appended after the image entrypoint. */
270
282
  containerArgs?: string[];
271
283
  /** Secret keys mounted as files and excluded from Env and secret.json. */
@@ -338,10 +350,18 @@ export interface IService {
338
350
  };
339
351
  }
340
352
 
341
- /** Caller-writable service data. Immutable policy and rollout fields are server-managed. */
353
+ /**
354
+ * Caller-writable service data. Immutable rollout state and SecretSet
355
+ * attachments are changed only through their dedicated fenced APIs.
356
+ */
342
357
  export type TServiceWritableData = Omit<
343
358
  IService['data'],
344
- 'organizationId' | 'immutableImageRequired' | 'imageDeployment' | 'imageRolloutStatus'
359
+ | 'organizationId'
360
+ | 'immutableImageRequired'
361
+ | 'imageDeployment'
362
+ | 'imageRolloutStatus'
363
+ | 'secretConfiguration'
364
+ | 'secretDeployment'
345
365
  >;
346
366
 
347
367
  /** Caller-writable update data. Null explicitly removes an existing argument vector. */
@@ -9,6 +9,7 @@ import * as pushnotification from './pushnotification.js';
9
9
  import * as sip from './sip.js';
10
10
  import * as sms from './sms.js';
11
11
  import * as storage from './storage.js';
12
+ import * as storagemigration from './storagemigration.js';
12
13
  import * as types from './types.js';
13
14
 
14
15
  export {
@@ -23,8 +24,10 @@ export {
23
24
  sip,
24
25
  sms,
25
26
  storage,
27
+ storagemigration,
26
28
  types,
27
29
  };
28
30
 
29
31
  export * from './storage.js';
32
+ export * from './storagemigration.js';
30
33
  export * from './types.js';
@@ -0,0 +1,241 @@
1
+ import { deepFreezeValue } from '../private/canonicaljson.js';
2
+ import type {
3
+ IObjectStorageMigrationPrepareRequest,
4
+ IUnfencedObjectStorageBindingControlSnapshot,
5
+ TActiveObjectStorageBinding,
6
+ TStagedObjectStorageBinding,
7
+ TUnfencedObjectStorageBindingControlSnapshotDigestPayload,
8
+ } from './storagemigration.js';
9
+
10
+ export interface IStorageMigrationCanonicalDigestGoldenVector<TInput> {
11
+ input: TInput;
12
+ canonicalJson: string;
13
+ sha256: string;
14
+ }
15
+
16
+ const capabilities = {
17
+ performanceTier: 'capacity',
18
+ durability: 'persistent',
19
+ topology: 'singleNode',
20
+ hardQuota: true,
21
+ snapshots: 'none',
22
+ backup: true,
23
+ encryptedInTransit: true,
24
+ } as const;
25
+
26
+ const delivery = {
27
+ type: 'environment',
28
+ keys: {
29
+ endpoint: 'APP_S3_ENDPOINT',
30
+ bucket: 'APP_S3_BUCKET',
31
+ region: 'APP_S3_REGION',
32
+ accessKeyId: 'APP_S3_ACCESS_KEY',
33
+ secretAccessKey: 'APP_S3_SECRET_KEY',
34
+ },
35
+ } as const;
36
+
37
+ const credentials = {
38
+ secretBundleId: 'service-storage',
39
+ accessKeyIdKey: 'object.accessKeyId',
40
+ secretAccessKeyKey: 'object.secretAccessKey',
41
+ };
42
+
43
+ const sourceBinding: TActiveObjectStorageBinding = {
44
+ schemaVersion: 1,
45
+ id: 'binding-object',
46
+ serviceId: 'service-app',
47
+ requestId: 'object-data',
48
+ requestDigest:
49
+ '1111111111111111111111111111111111111111111111111111111111111111',
50
+ kind: 'objectStorage',
51
+ generation: 3,
52
+ observedGeneration: 3,
53
+ status: 'ready',
54
+ policy: {
55
+ classId: 'source-object',
56
+ revision: '1',
57
+ },
58
+ capabilities,
59
+ resourceRef: 'source-resource',
60
+ accessMode: 'readWrite',
61
+ connection: {
62
+ endpoint: 'https://source.example.test',
63
+ bucket: 'source-bucket',
64
+ region: 'local',
65
+ },
66
+ credentials,
67
+ delivery,
68
+ versioning: false,
69
+ createdAt: 1_700_000_000_000,
70
+ updatedAt: 1_700_000_000_001,
71
+ };
72
+
73
+ const target = {
74
+ policy: {
75
+ classId: 'capacity-object',
76
+ revision: '4',
77
+ },
78
+ storageClass: {
79
+ kind: 'objectStorage',
80
+ purpose: 'backup',
81
+ required: {
82
+ performanceTier: 'capacity',
83
+ durability: 'persistent',
84
+ backup: true,
85
+ },
86
+ },
87
+ request: {
88
+ id: 'object-data',
89
+ kind: 'objectStorage',
90
+ storageClass: 'backupCapacity',
91
+ capacity: {
92
+ request: '500GiB',
93
+ limit: '1TiB',
94
+ },
95
+ reclaimPolicy: 'retain',
96
+ accessMode: 'readWrite',
97
+ delivery,
98
+ },
99
+ credentials,
100
+ } as const;
101
+
102
+ const preparationSnapshotPayload:
103
+ TUnfencedObjectStorageBindingControlSnapshotDigestPayload = {
104
+ schemaVersion: 1,
105
+ binding: sourceBinding,
106
+ recordRevision: 12,
107
+ capturedAt: 1_700_000_000_010,
108
+ };
109
+
110
+ const preparationSnapshot: IUnfencedObjectStorageBindingControlSnapshot = {
111
+ ...preparationSnapshotPayload,
112
+ snapshotDigest:
113
+ '35870a0c3ca7f2ee70d0ae7f83109bec23a8ce59bf8efef1c94221a496210439',
114
+ };
115
+
116
+ const prepareRequest: IObjectStorageMigrationPrepareRequest = {
117
+ schemaVersion: 1,
118
+ migrationId: 'migration-object-capacity',
119
+ sourceControlSnapshot: preparationSnapshot,
120
+ workloadGeneration: 8,
121
+ target,
122
+ };
123
+
124
+ const candidateBinding: TStagedObjectStorageBinding = {
125
+ ...sourceBinding,
126
+ requestDigest:
127
+ '2096dfa1f6db50d670cbb4d6436f38c2eec383435c99346e31d0d1a9e0b1beba',
128
+ generation: 4,
129
+ observedGeneration: 3,
130
+ status: 'provisioning',
131
+ policy: target.policy,
132
+ resourceRef: 'destination-resource',
133
+ capacity: {
134
+ requested: '500GiB',
135
+ granted: '500GiB',
136
+ limit: '1TiB',
137
+ },
138
+ connection: {
139
+ endpoint: 'https://destination.example.test',
140
+ bucket: 'destination-bucket',
141
+ region: 'local',
142
+ },
143
+ updatedAt: 1_700_000_000_020,
144
+ };
145
+
146
+ export const storageMigrationCanonicalDigestGoldenVectors = deepFreezeValue({
147
+ version: 1 as const,
148
+ targetRequest: {
149
+ input: target.request,
150
+ canonicalJson:
151
+ '{"accessMode":"readWrite","capacity":{"limit":"1TiB","request":"500GiB"},' +
152
+ '"delivery":{"keys":{"accessKeyId":"APP_S3_ACCESS_KEY","bucket":"APP_S3_BUCKET",' +
153
+ '"endpoint":"APP_S3_ENDPOINT","region":"APP_S3_REGION",' +
154
+ '"secretAccessKey":"APP_S3_SECRET_KEY"},"type":"environment"},' +
155
+ '"id":"object-data","kind":"objectStorage","reclaimPolicy":"retain",' +
156
+ '"storageClass":"backupCapacity"}',
157
+ sha256:
158
+ '2096dfa1f6db50d670cbb4d6436f38c2eec383435c99346e31d0d1a9e0b1beba',
159
+ },
160
+ preparationSnapshot: {
161
+ input: preparationSnapshotPayload,
162
+ canonicalJson:
163
+ '{"binding":{"accessMode":"readWrite","capabilities":{"backup":true,' +
164
+ '"durability":"persistent","encryptedInTransit":true,"hardQuota":true,' +
165
+ '"performanceTier":"capacity","snapshots":"none","topology":"singleNode"},' +
166
+ '"connection":{"bucket":"source-bucket","endpoint":"https://source.example.test",' +
167
+ '"region":"local"},"createdAt":1700000000000,"credentials":' +
168
+ '{"accessKeyIdKey":"object.accessKeyId","secretAccessKeyKey":"object.secretAccessKey",' +
169
+ '"secretBundleId":"service-storage"},"delivery":{"keys":' +
170
+ '{"accessKeyId":"APP_S3_ACCESS_KEY","bucket":"APP_S3_BUCKET",' +
171
+ '"endpoint":"APP_S3_ENDPOINT","region":"APP_S3_REGION",' +
172
+ '"secretAccessKey":"APP_S3_SECRET_KEY"},"type":"environment"},' +
173
+ '"generation":3,"id":"binding-object","kind":"objectStorage",' +
174
+ '"observedGeneration":3,"policy":{"classId":"source-object","revision":"1"},' +
175
+ '"requestDigest":"1111111111111111111111111111111111111111111111111111111111111111",' +
176
+ '"requestId":"object-data","resourceRef":"source-resource","schemaVersion":1,' +
177
+ '"serviceId":"service-app","status":"ready","updatedAt":1700000000001,' +
178
+ '"versioning":false},"capturedAt":1700000000010,"recordRevision":12,"schemaVersion":1}',
179
+ sha256:
180
+ '35870a0c3ca7f2ee70d0ae7f83109bec23a8ce59bf8efef1c94221a496210439',
181
+ },
182
+ prepareRequest: {
183
+ input: prepareRequest,
184
+ canonicalJson:
185
+ '{"migrationId":"migration-object-capacity","schemaVersion":1,' +
186
+ '"sourceControlSnapshot":{"binding":{"accessMode":"readWrite",' +
187
+ '"capabilities":{"backup":true,"durability":"persistent",' +
188
+ '"encryptedInTransit":true,"hardQuota":true,"performanceTier":"capacity",' +
189
+ '"snapshots":"none","topology":"singleNode"},"connection":' +
190
+ '{"bucket":"source-bucket","endpoint":"https://source.example.test","region":"local"},' +
191
+ '"createdAt":1700000000000,"credentials":{"accessKeyIdKey":"object.accessKeyId",' +
192
+ '"secretAccessKeyKey":"object.secretAccessKey","secretBundleId":"service-storage"},' +
193
+ '"delivery":{"keys":{"accessKeyId":"APP_S3_ACCESS_KEY","bucket":"APP_S3_BUCKET",' +
194
+ '"endpoint":"APP_S3_ENDPOINT","region":"APP_S3_REGION",' +
195
+ '"secretAccessKey":"APP_S3_SECRET_KEY"},"type":"environment"},' +
196
+ '"generation":3,"id":"binding-object","kind":"objectStorage",' +
197
+ '"observedGeneration":3,"policy":{"classId":"source-object","revision":"1"},' +
198
+ '"requestDigest":"1111111111111111111111111111111111111111111111111111111111111111",' +
199
+ '"requestId":"object-data","resourceRef":"source-resource","schemaVersion":1,' +
200
+ '"serviceId":"service-app","status":"ready","updatedAt":1700000000001,' +
201
+ '"versioning":false},"capturedAt":1700000000010,"recordRevision":12,' +
202
+ '"schemaVersion":1,"snapshotDigest":' +
203
+ '"35870a0c3ca7f2ee70d0ae7f83109bec23a8ce59bf8efef1c94221a496210439"},' +
204
+ '"target":{"credentials":{"accessKeyIdKey":"object.accessKeyId",' +
205
+ '"secretAccessKeyKey":"object.secretAccessKey","secretBundleId":"service-storage"},' +
206
+ '"policy":{"classId":"capacity-object","revision":"4"},"request":' +
207
+ '{"accessMode":"readWrite","capacity":{"limit":"1TiB","request":"500GiB"},' +
208
+ '"delivery":{"keys":{"accessKeyId":"APP_S3_ACCESS_KEY","bucket":"APP_S3_BUCKET",' +
209
+ '"endpoint":"APP_S3_ENDPOINT","region":"APP_S3_REGION",' +
210
+ '"secretAccessKey":"APP_S3_SECRET_KEY"},"type":"environment"},' +
211
+ '"id":"object-data","kind":"objectStorage","reclaimPolicy":"retain",' +
212
+ '"storageClass":"backupCapacity"},"storageClass":{"kind":"objectStorage",' +
213
+ '"purpose":"backup","required":{"backup":true,"durability":"persistent",' +
214
+ '"performanceTier":"capacity"}}},"workloadGeneration":8}',
215
+ sha256:
216
+ 'ecbb40ec9bfa20b9f4372eb0d00eaf79c3e84dd3132c5bde7e65ba3fec55e595',
217
+ },
218
+ candidateBinding: {
219
+ input: candidateBinding,
220
+ canonicalJson:
221
+ '{"accessMode":"readWrite","capabilities":{"backup":true,' +
222
+ '"durability":"persistent","encryptedInTransit":true,"hardQuota":true,' +
223
+ '"performanceTier":"capacity","snapshots":"none","topology":"singleNode"},' +
224
+ '"capacity":{"granted":"500GiB","limit":"1TiB","requested":"500GiB"},' +
225
+ '"connection":{"bucket":"destination-bucket",' +
226
+ '"endpoint":"https://destination.example.test","region":"local"},' +
227
+ '"createdAt":1700000000000,"credentials":{"accessKeyIdKey":"object.accessKeyId",' +
228
+ '"secretAccessKeyKey":"object.secretAccessKey","secretBundleId":"service-storage"},' +
229
+ '"delivery":{"keys":{"accessKeyId":"APP_S3_ACCESS_KEY","bucket":"APP_S3_BUCKET",' +
230
+ '"endpoint":"APP_S3_ENDPOINT","region":"APP_S3_REGION",' +
231
+ '"secretAccessKey":"APP_S3_SECRET_KEY"},"type":"environment"},' +
232
+ '"generation":4,"id":"binding-object","kind":"objectStorage",' +
233
+ '"observedGeneration":3,"policy":{"classId":"capacity-object","revision":"4"},' +
234
+ '"requestDigest":"2096dfa1f6db50d670cbb4d6436f38c2eec383435c99346e31d0d1a9e0b1beba",' +
235
+ '"requestId":"object-data","resourceRef":"destination-resource",' +
236
+ '"schemaVersion":1,"serviceId":"service-app","status":"provisioning",' +
237
+ '"updatedAt":1700000000020,"versioning":false}',
238
+ sha256:
239
+ 'b49017f41cd86626ccb05ffa5fb591994a5e20fad9856182b1a1d4c964c6177c',
240
+ },
241
+ });