@serve.zone/interfaces 10.1.0 → 11.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.
@@ -1,7 +1,7 @@
1
1
  import * as plugins from '../plugins.js';
2
2
  import type { IArchivePruneResult, IArchiveRetentionPolicy, IBackupArchiveManifest, IBackupArchiveObject, IBackupRecord, IBackupReplicationResult, IIsolatedRestoreNodeState, IIsolatedRestoreRecord, TBackupSnapshot, TIsolatedRestoreResourceMapping } from '../data/backup.js';
3
3
  import type { IService } from '../data/service.js';
4
- import type { IIdentity } from '../data/user.js';
4
+ import type { IIdentity, IIdentityCredential } from '../data/user.js';
5
5
  export interface IReq_Any_Cloudly_CreateServiceBackup extends plugins.typedrequestInterfaces.implementsTR<plugins.typedrequestInterfaces.ITypedRequest, IReq_Any_Cloudly_CreateServiceBackup> {
6
6
  method: 'createServiceBackup';
7
7
  request: {
@@ -154,7 +154,8 @@ export interface IReq_Cloudly_Coreflow_PruneNodeArchive extends plugins.typedreq
154
154
  export interface IReq_Any_Cloudly_CreateIsolatedRestore extends plugins.typedrequestInterfaces.implementsTR<plugins.typedrequestInterfaces.ITypedRequest, IReq_Any_Cloudly_CreateIsolatedRestore> {
155
155
  method: 'createIsolatedRestore';
156
156
  request: {
157
- identity: IIdentity;
157
+ /** Cloudly verifies this credential and derives all actor claims server-side. */
158
+ identity: IIdentityCredential;
158
159
  sourceBackupId: string;
159
160
  targetNodeName: string;
160
161
  purpose: string;
@@ -186,7 +187,8 @@ export interface IReq_Any_Cloudly_CreateIsolatedRestore extends plugins.typedreq
186
187
  export interface IReq_Any_Cloudly_GetIsolatedRestores extends plugins.typedrequestInterfaces.implementsTR<plugins.typedrequestInterfaces.ITypedRequest, IReq_Any_Cloudly_GetIsolatedRestores> {
187
188
  method: 'getIsolatedRestores';
188
189
  request: {
189
- identity: IIdentity;
190
+ /** Cloudly verifies this credential and derives all actor claims server-side. */
191
+ identity: IIdentityCredential;
190
192
  sourceBackupId?: string;
191
193
  sourceServiceId?: string;
192
194
  clusterId?: string;
@@ -208,7 +210,8 @@ export interface IReq_Any_Cloudly_GetIsolatedRestores extends plugins.typedreque
208
210
  export interface IReq_Any_Cloudly_GetIsolatedRestoreById extends plugins.typedrequestInterfaces.implementsTR<plugins.typedrequestInterfaces.ITypedRequest, IReq_Any_Cloudly_GetIsolatedRestoreById> {
209
211
  method: 'getIsolatedRestoreById';
210
212
  request: {
211
- identity: IIdentity;
213
+ /** Cloudly verifies this credential and derives all actor claims server-side. */
214
+ identity: IIdentityCredential;
212
215
  restoreId: string;
213
216
  };
214
217
  response: {
@@ -285,7 +288,8 @@ export interface IReq_Cloudly_Coreflow_CleanupIsolatedRestore extends plugins.ty
285
288
  export interface IReq_Any_Cloudly_CleanupIsolatedRestore extends plugins.typedrequestInterfaces.implementsTR<plugins.typedrequestInterfaces.ITypedRequest, IReq_Any_Cloudly_CleanupIsolatedRestore> {
286
289
  method: 'cleanupIsolatedRestore';
287
290
  request: {
288
- identity: IIdentity;
291
+ /** Cloudly verifies this credential and derives all actor claims server-side. */
292
+ identity: IIdentityCredential;
289
293
  restoreId: string;
290
294
  reason: string;
291
295
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serve.zone/interfaces",
3
- "version": "10.1.0",
3
+ "version": "11.1.0",
4
4
  "private": false,
5
5
  "description": "Shared TypeScript interfaces and TypedRequest contracts for the serve.zone ecosystem.",
6
6
  "exports": {
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@serve.zone/interfaces',
6
- version: '10.1.0',
6
+ version: '11.1.0',
7
7
  description: 'Shared TypeScript interfaces and TypedRequest contracts for the serve.zone ecosystem.'
8
8
  }
package/ts/data/index.ts CHANGED
@@ -11,6 +11,8 @@ export * from './externalregistry.js';
11
11
  export * from './gateway.js';
12
12
  export * from './hostedapp.js';
13
13
  export * from './image.js';
14
+ export * from './isolatedrestore.js';
15
+ export * from './isolatedrestore.golden.js';
14
16
  export * from './mail.js';
15
17
  export * from './registry.js';
16
18
  export * from './secretbundle.js';
@@ -0,0 +1,157 @@
1
+ import type {
2
+ IBackupArchiveManifest,
3
+ TIsolatedRestoreResourceMapping,
4
+ } from './backup.js';
5
+ import type { IIsolatedRestoreGrantClaims } from './isolatedrestore.js';
6
+
7
+ export interface IIsolatedRestoreCanonicalDigestGoldenVector<TInput> {
8
+ input: TInput;
9
+ canonicalJson: string;
10
+ sha256: string;
11
+ }
12
+
13
+ const deepFreezeVector = <T>(valueArg: T): T => {
14
+ if (!valueArg || typeof valueArg !== 'object' || Object.isFrozen(valueArg)) {
15
+ return valueArg;
16
+ }
17
+ for (const key of Reflect.ownKeys(valueArg as object)) {
18
+ const descriptor = Object.getOwnPropertyDescriptor(valueArg as object, key);
19
+ if (descriptor && Object.hasOwn(descriptor, 'value')) {
20
+ deepFreezeVector(descriptor.value);
21
+ }
22
+ }
23
+ return Object.freeze(valueArg);
24
+ };
25
+
26
+ /**
27
+ * Portable fixed values for signer, relay, and verifier suites. The inputs
28
+ * deliberately cover an astral scalar, composed and decomposed accents, a
29
+ * quote, and a backslash. Consumers compare both JSON and SHA-256 verbatim.
30
+ */
31
+ export const isolatedRestoreCanonicalDigestGoldenVectors: {
32
+ version: 1;
33
+ resourceMappings: IIsolatedRestoreCanonicalDigestGoldenVector<
34
+ TIsolatedRestoreResourceMapping[]
35
+ >;
36
+ archiveManifest: IIsolatedRestoreCanonicalDigestGoldenVector<
37
+ IBackupArchiveManifest
38
+ >;
39
+ grantClaims: IIsolatedRestoreCanonicalDigestGoldenVector<
40
+ IIsolatedRestoreGrantClaims
41
+ >;
42
+ } = deepFreezeVector({
43
+ version: 1,
44
+ resourceMappings: {
45
+ input: [
46
+ {
47
+ id: 'mapping-volume',
48
+ type: 'volume',
49
+ source: {
50
+ snapshotId: 'snapshot-volume',
51
+ volumeName: 'source-volume',
52
+ mountPath: '/srv/šŸ˜€/Ć©/"quoted"',
53
+ },
54
+ target: {
55
+ volumeName: 'scratch-volume',
56
+ mountPath: '/srv/šŸ˜€/é/"quoted"',
57
+ },
58
+ },
59
+ {
60
+ id: 'mapping-database',
61
+ type: 'database',
62
+ source: {
63
+ snapshotId: 'snapshot-database',
64
+ resourceName: 'source-database-resource',
65
+ databaseName: 'source_database',
66
+ },
67
+ target: {
68
+ resourceName: 'scratch-database-resource',
69
+ databaseName: 'scratch_database',
70
+ },
71
+ },
72
+ {
73
+ id: 'mapping-objectstorage',
74
+ type: 'objectstorage',
75
+ source: {
76
+ snapshotId: 'snapshot-objectstorage',
77
+ resourceName: 'source-objectstorage-resource',
78
+ bucketName: 'source-bucket',
79
+ },
80
+ target: {
81
+ resourceName: 'scratch-objectstorage-resource',
82
+ bucketName: 'scratch-bucket',
83
+ },
84
+ },
85
+ ] as TIsolatedRestoreResourceMapping[],
86
+ canonicalJson:
87
+ '[{"id":"mapping-volume","source":{"mountPath":"/srv/šŸ˜€/Ć©/\\"quoted\\"","snapshotId":"snapshot-volume","volumeName":"source-volume"},"target":{"mountPath":"/srv/šŸ˜€/é/\\"quoted\\"","volumeName":"scratch-volume"},"type":"volume"},' +
88
+ '{"id":"mapping-database","source":{"databaseName":"source_database","resourceName":"source-database-resource","snapshotId":"snapshot-database"},"target":{"databaseName":"scratch_database","resourceName":"scratch-database-resource"},"type":"database"},' +
89
+ '{"id":"mapping-objectstorage","source":{"bucketName":"source-bucket","resourceName":"source-objectstorage-resource","snapshotId":"snapshot-objectstorage"},"target":{"bucketName":"scratch-bucket","resourceName":"scratch-objectstorage-resource"},"type":"objectstorage"}]',
90
+ sha256: '3c084580fc258dcb5dc25b80d7331eb1d9072a124f640df3ce26eba4917afe70',
91
+ },
92
+ archiveManifest: {
93
+ input: {
94
+ version: 1,
95
+ backupId: 'backup-0001',
96
+ createdAt: 1700000000123,
97
+ objects: [
98
+ {
99
+ path: 'config.json',
100
+ size: 2,
101
+ sha256: '0000000000000000000000000000000000000000000000000000000000000000',
102
+ },
103
+ {
104
+ path: 'snapshots/snapshot-volume.json',
105
+ size: 3,
106
+ sha256: 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
107
+ },
108
+ {
109
+ path: 'snapshots/snapshot-database.json',
110
+ size: 5,
111
+ sha256: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
112
+ },
113
+ {
114
+ path: 'snapshots/snapshot-objectstorage.json',
115
+ size: 7,
116
+ sha256: 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',
117
+ },
118
+ ],
119
+ totalSize: 17,
120
+ },
121
+ canonicalJson:
122
+ '{"backupId":"backup-0001","createdAt":1700000000123,"objects":[{"path":"config.json","sha256":"0000000000000000000000000000000000000000000000000000000000000000","size":2},' +
123
+ '{"path":"snapshots/snapshot-volume.json","sha256":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","size":3},' +
124
+ '{"path":"snapshots/snapshot-database.json","sha256":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","size":5},' +
125
+ '{"path":"snapshots/snapshot-objectstorage.json","sha256":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","size":7}],"totalSize":17,"version":1}',
126
+ sha256: 'cd688de1a4b7e0f0b185c660a2c0c199ea4009832c5614a49e8a4dec411f3bd4',
127
+ },
128
+ grantClaims: {
129
+ input: {
130
+ grantVersion: 1,
131
+ iss: 'urn:foss:restore:šŸ˜€:Ć©:é:"quoted":\\backslash',
132
+ aud: 'corestore.restore',
133
+ sub: 'cloudly-control',
134
+ jti: 'grant-0001',
135
+ authorizationId: 'authorization-0001',
136
+ tenantId: 'tenant-0001',
137
+ clusterId: 'cluster-eu-1',
138
+ targetNodeName: 'node-1',
139
+ restoreId: 'restore-0001',
140
+ sourceBackupId: 'backup-0001',
141
+ sourceServiceId: 'service-source',
142
+ scratchNamespaceId: 'scratch-0001',
143
+ stagingArchiveId: 'archive-0001',
144
+ operation: 'prepare',
145
+ resourceMappingsSha256: '3c084580fc258dcb5dc25b80d7331eb1d9072a124f640df3ce26eba4917afe70',
146
+ archiveManifestSha256: 'cd688de1a4b7e0f0b185c660a2c0c199ea4009832c5614a49e8a4dec411f3bd4',
147
+ iat: 2_000_000_000,
148
+ nbf: 2_000_000_000,
149
+ exp: 2_000_000_120,
150
+ },
151
+ canonicalJson:
152
+ '{"archiveManifestSha256":"cd688de1a4b7e0f0b185c660a2c0c199ea4009832c5614a49e8a4dec411f3bd4","aud":"corestore.restore","authorizationId":"authorization-0001","clusterId":"cluster-eu-1","exp":2000000120,"grantVersion":1,"iat":2000000000,' +
153
+ '"iss":"urn:foss:restore:šŸ˜€:Ć©:é:\\"quoted\\":\\\\backslash","jti":"grant-0001","nbf":2000000000,"operation":"prepare","resourceMappingsSha256":"3c084580fc258dcb5dc25b80d7331eb1d9072a124f640df3ce26eba4917afe70",' +
154
+ '"restoreId":"restore-0001","scratchNamespaceId":"scratch-0001","sourceBackupId":"backup-0001","sourceServiceId":"service-source","stagingArchiveId":"archive-0001","sub":"cloudly-control","targetNodeName":"node-1","tenantId":"tenant-0001"}',
155
+ sha256: '6fcc94b4c6498b9fa45ec41de197999bbb38b9f8437a9c41f9c9478bdf3af8bf',
156
+ },
157
+ });