@serve.zone/interfaces 22.0.0 → 23.0.1

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 (78) hide show
  1. package/changelog.md +19 -0
  2. package/dist_ts/00_commitinfo_data.js +1 -1
  3. package/dist_ts/appstore/types.d.ts +31 -16
  4. package/dist_ts/appstore/types.js +208 -11
  5. package/dist_ts/data/coremail.runtime.d.ts +3 -2
  6. package/dist_ts/data/coremail.runtime.js +10 -5
  7. package/dist_ts/data/deploymentoperation.js +6 -20
  8. package/dist_ts/data/deploymentpreflight.d.ts +2 -6
  9. package/dist_ts/data/deploymentpreflight.js +1 -1
  10. package/dist_ts/data/hostedapp.d.ts +40 -14
  11. package/dist_ts/data/hostedapp.js +90 -1
  12. package/dist_ts/data/immutableimage.d.ts +30 -1
  13. package/dist_ts/data/immutableimage.js +103 -1
  14. package/dist_ts/data/index.d.ts +0 -2
  15. package/dist_ts/data/index.js +1 -3
  16. package/dist_ts/data/secret.d.ts +186 -13
  17. package/dist_ts/data/secret.js +543 -45
  18. package/dist_ts/data/service.d.ts +0 -39
  19. package/dist_ts/data/service.js +1 -77
  20. package/dist_ts/data/settings.d.ts +62 -43
  21. package/dist_ts/data/settings.js +34 -2
  22. package/dist_ts/platform/storage.d.ts +13 -14
  23. package/dist_ts/platform/storage.js +1 -1
  24. package/dist_ts/platform/storagemigration.d.ts +8 -8
  25. package/dist_ts/platform/storagemigration.golden.d.ts +2 -2
  26. package/dist_ts/platform/storagemigration.golden.js +19 -88
  27. package/dist_ts/platform/storagemigration.js +46 -58
  28. package/dist_ts/platform/types.d.ts +5 -19
  29. package/dist_ts/plugins.d.ts +2 -1
  30. package/dist_ts/plugins.js +3 -2
  31. package/dist_ts/requests/hostedapp.d.ts +12 -9
  32. package/dist_ts/requests/hostedapp.js +38 -1
  33. package/dist_ts/requests/index.d.ts +1 -3
  34. package/dist_ts/requests/index.js +2 -4
  35. package/dist_ts/requests/platform.d.ts +0 -1
  36. package/dist_ts/requests/secret.d.ts +23 -17
  37. package/dist_ts/requests/secret.js +161 -2
  38. package/dist_ts/requests/service.d.ts +0 -13
  39. package/dist_ts/requests/settings.d.ts +3 -3
  40. package/dist_ts/runtime.d.ts +78 -26
  41. package/dist_ts/runtime.js +219 -19
  42. package/package.json +2 -1
  43. package/readme.md +110 -29
  44. package/ts/00_commitinfo_data.ts +1 -1
  45. package/ts/appstore/types.ts +251 -25
  46. package/ts/data/coremail.runtime.ts +18 -4
  47. package/ts/data/deploymentoperation.ts +7 -31
  48. package/ts/data/deploymentpreflight.ts +2 -5
  49. package/ts/data/hostedapp.ts +144 -18
  50. package/ts/data/immutableimage.ts +150 -1
  51. package/ts/data/index.ts +0 -2
  52. package/ts/data/secret.ts +775 -53
  53. package/ts/data/service.ts +0 -118
  54. package/ts/data/settings.ts +70 -80
  55. package/ts/platform/storage.ts +15 -16
  56. package/ts/platform/storagemigration.golden.ts +18 -95
  57. package/ts/platform/storagemigration.ts +57 -87
  58. package/ts/platform/types.ts +6 -19
  59. package/ts/plugins.ts +2 -0
  60. package/ts/requests/hostedapp.ts +50 -9
  61. package/ts/requests/index.ts +0 -4
  62. package/ts/requests/platform.ts +0 -1
  63. package/ts/requests/secret.ts +204 -9
  64. package/ts/requests/service.ts +0 -16
  65. package/ts/requests/settings.ts +3 -3
  66. package/ts/runtime.ts +314 -41
  67. package/dist_ts/data/secretbundle.d.ts +0 -57
  68. package/dist_ts/data/secretbundle.js +0 -2
  69. package/dist_ts/data/secretgroup.d.ts +0 -52
  70. package/dist_ts/data/secretgroup.js +0 -2
  71. package/dist_ts/requests/secretbundle.d.ts +0 -75
  72. package/dist_ts/requests/secretbundle.js +0 -4
  73. package/dist_ts/requests/secretgroup.d.ts +0 -52
  74. package/dist_ts/requests/secretgroup.js +0 -4
  75. package/ts/data/secretbundle.ts +0 -65
  76. package/ts/data/secretgroup.ts +0 -58
  77. package/ts/requests/secretbundle.ts +0 -103
  78. package/ts/requests/secretgroup.ts +0 -74
@@ -11,12 +11,11 @@ import {
11
11
  import type {
12
12
  IResolvedObjectStorageBinding,
13
13
  IResolvedStoragePolicyRef,
14
- IStorageObjectCredentialsRef,
15
14
  IStorageGrantedCapabilities,
16
15
  } from './storage.js';
17
16
 
18
17
  export const storageMigrationContractLimits = Object.freeze({
19
- version: 1 as const,
18
+ version: 2 as const,
20
19
  maximumControlJsonBytes: 256 * 1024,
21
20
  maximumConfiguredStringBytes: 2048,
22
21
  maximumIssueMessageBytes: 4096,
@@ -50,7 +49,7 @@ export interface IStorageBindingMigrationOwner {
50
49
  }
51
50
 
52
51
  export interface IUnfencedObjectStorageBindingControlSnapshot {
53
- schemaVersion: 1;
52
+ schemaVersion: 2;
54
53
  binding: TActiveObjectStorageBinding;
55
54
  recordRevision: number;
56
55
  snapshotDigest: string;
@@ -59,7 +58,7 @@ export interface IUnfencedObjectStorageBindingControlSnapshot {
59
58
  }
60
59
 
61
60
  export interface IFencedObjectStorageBindingControlSnapshot {
62
- schemaVersion: 1;
61
+ schemaVersion: 2;
63
62
  binding: TActiveObjectStorageBinding;
64
63
  recordRevision: number;
65
64
  snapshotDigest: string;
@@ -81,11 +80,11 @@ export interface IObjectStorageMigrationTarget {
81
80
  policy: IResolvedStoragePolicyRef;
82
81
  storageClass: IAppStoreStorageClass & { kind: 'objectStorage' };
83
82
  request: IAppStoreObjectStorageRequest;
84
- credentials: IStorageObjectCredentialsRef;
83
+ credentialManagementScope: IResolvedObjectStorageBinding['credentialManagementScope'];
85
84
  }
86
85
 
87
86
  export interface IObjectStorageMigrationPrepareRequest {
88
- schemaVersion: 1;
87
+ schemaVersion: 2;
89
88
  migrationId: string;
90
89
  sourceControlSnapshot: IUnfencedObjectStorageBindingControlSnapshot;
91
90
  workloadGeneration: number;
@@ -128,7 +127,7 @@ extends IStorageMigrationIssueBase {
128
127
  }
129
128
 
130
129
  export interface IStorageMigrationMutationFence {
131
- schemaVersion: 1;
130
+ schemaVersion: 2;
132
131
  migrationId: string;
133
132
  migrationDigest: string;
134
133
  expectedMigrationRevision: number;
@@ -194,7 +193,7 @@ export interface IObjectStorageMigrationCleanupRequest
194
193
  extends IStorageMigrationMutationFence {}
195
194
 
196
195
  export interface IStorageMigrationStatusBase {
197
- schemaVersion: 1;
196
+ schemaVersion: 2;
198
197
  migrationId: string;
199
198
  migrationDigest: string;
200
199
  migrationRevision: number;
@@ -894,7 +893,7 @@ const normalizeDelivery = (
894
893
  fieldNameArg: string,
895
894
  ): IResolvedObjectStorageBinding['delivery'] => {
896
895
  const value = readRecord(valueArg, fieldNameArg);
897
- if (value.type === 'environment') {
896
+ if (value.type === 'launcher-environment') {
898
897
  assertExactKeys(value, ['type', 'keys'], fieldNameArg);
899
898
  const keys = readRecord(value.keys, `${fieldNameArg}.keys`);
900
899
  assertKeys(
@@ -933,10 +932,10 @@ const normalizeDelivery = (
933
932
  ) {
934
933
  return fail(`${fieldNameArg}.keys values must be distinct`);
935
934
  }
936
- return { type: 'environment', keys: normalizedKeys };
935
+ return { type: 'launcher-environment', keys: normalizedKeys };
937
936
  }
938
- if (value.type === 'secretFile') {
939
- assertExactKeys(value, ['type', 'targetPath', 'format'], fieldNameArg);
937
+ if (value.type === 'file') {
938
+ assertExactKeys(value, ['type', 'targetPath', 'format', 'uid', 'gid', 'mode'], fieldNameArg);
940
939
  const targetPath = readString(
941
940
  value.targetPath,
942
941
  `${fieldNameArg}.targetPath`,
@@ -957,56 +956,28 @@ const normalizeDelivery = (
957
956
  return fail(`${fieldNameArg}.format is unsupported`);
958
957
  }
959
958
  return {
960
- type: 'secretFile',
959
+ type: 'file',
961
960
  targetPath,
962
961
  format: 'servezone-object-storage-v1',
962
+ uid: readSafeInteger(value.uid, `${fieldNameArg}.uid`, 0, 2_147_483_647),
963
+ gid: readSafeInteger(value.gid, `${fieldNameArg}.gid`, 0, 2_147_483_647),
964
+ mode: value.mode === 0o400 || value.mode === 0o440
965
+ ? value.mode
966
+ : fail(`${fieldNameArg}.mode must be 0400 or 0440`),
963
967
  };
964
968
  }
965
969
  return fail(`${fieldNameArg}.type is unsupported`);
966
970
  };
967
971
 
968
- const normalizeCredentials = (
972
+ const normalizeCredentialManagementScope = (
969
973
  valueArg: unknown,
970
974
  fieldNameArg: string,
971
- ): IStorageObjectCredentialsRef => {
972
- const value = readRecord(valueArg, fieldNameArg);
973
- assertKeys(
974
- value,
975
- ['secretBundleId', 'accessKeyIdKey', 'secretAccessKeyKey'],
976
- ['sessionTokenKey'],
977
- fieldNameArg,
978
- );
979
- const result: IStorageObjectCredentialsRef = {
980
- secretBundleId: readIdentifier(
981
- value.secretBundleId,
982
- `${fieldNameArg}.secretBundleId`,
983
- ),
984
- accessKeyIdKey: readIdentifier(
985
- value.accessKeyIdKey,
986
- `${fieldNameArg}.accessKeyIdKey`,
987
- ),
988
- secretAccessKeyKey: readIdentifier(
989
- value.secretAccessKeyKey,
990
- `${fieldNameArg}.secretAccessKeyKey`,
991
- ),
992
- ...(Object.hasOwn(value, 'sessionTokenKey')
993
- ? {
994
- sessionTokenKey: readIdentifier(
995
- value.sessionTokenKey,
996
- `${fieldNameArg}.sessionTokenKey`,
997
- ),
998
- }
999
- : {}),
1000
- };
1001
- const keyNames = [
1002
- result.accessKeyIdKey,
1003
- result.secretAccessKeyKey,
1004
- ...(result.sessionTokenKey ? [result.sessionTokenKey] : []),
1005
- ];
1006
- if (new Set(keyNames).size !== keyNames.length) {
1007
- return fail(`${fieldNameArg} credential key references must be distinct`);
975
+ ): IResolvedObjectStorageBinding['credentialManagementScope'] => {
976
+ const value = readString(valueArg, fieldNameArg);
977
+ if (!/^platform:[A-Za-z0-9][A-Za-z0-9._-]{0,199}$/.test(value)) {
978
+ return fail(`${fieldNameArg} must be a canonical platform management scope`);
1008
979
  }
1009
- return result;
980
+ return value as IResolvedObjectStorageBinding['credentialManagementScope'];
1010
981
  };
1011
982
 
1012
983
  const normalizeObjectStorageProtection = (
@@ -1193,15 +1164,15 @@ const normalizeObjectStorageBinding = (
1193
1164
  'resourceRef',
1194
1165
  'accessMode',
1195
1166
  'connection',
1196
- 'credentials',
1167
+ 'credentialManagementScope',
1197
1168
  'delivery',
1198
1169
  'versioning',
1199
1170
  ],
1200
1171
  ['capacity', 'createdAt', 'updatedAt', 'retentionDays'],
1201
1172
  fieldNameArg,
1202
1173
  );
1203
- if (value.schemaVersion !== 1) {
1204
- return fail(`${fieldNameArg}.schemaVersion must be 1`);
1174
+ if (value.schemaVersion !== 2) {
1175
+ return fail(`${fieldNameArg}.schemaVersion must be 2`);
1205
1176
  }
1206
1177
  if (value.kind !== 'objectStorage') {
1207
1178
  return fail(`${fieldNameArg}.kind must be objectStorage`);
@@ -1235,7 +1206,7 @@ const normalizeObjectStorageBinding = (
1235
1206
  return fail(`${fieldNameArg}.updatedAt must not precede createdAt`);
1236
1207
  }
1237
1208
  return {
1238
- schemaVersion: 1,
1209
+ schemaVersion: 2,
1239
1210
  id: readIdentifier(value.id, `${fieldNameArg}.id`),
1240
1211
  serviceId: readIdentifier(value.serviceId, `${fieldNameArg}.serviceId`),
1241
1212
  requestId: readIdentifier(value.requestId, `${fieldNameArg}.requestId`),
@@ -1273,9 +1244,9 @@ const normalizeObjectStorageBinding = (
1273
1244
  value.connection,
1274
1245
  `${fieldNameArg}.connection`,
1275
1246
  ),
1276
- credentials: normalizeCredentials(
1277
- value.credentials,
1278
- `${fieldNameArg}.credentials`,
1247
+ credentialManagementScope: normalizeCredentialManagementScope(
1248
+ value.credentialManagementScope,
1249
+ `${fieldNameArg}.credentialManagementScope`,
1279
1250
  ),
1280
1251
  delivery: normalizeDelivery(value.delivery, `${fieldNameArg}.delivery`),
1281
1252
  versioning: readBoolean(value.versioning, `${fieldNameArg}.versioning`),
@@ -1301,7 +1272,7 @@ const normalizeTarget = (
1301
1272
  const value = readRecord(valueArg, fieldNameArg);
1302
1273
  assertExactKeys(
1303
1274
  value,
1304
- ['policy', 'storageClass', 'request', 'credentials'],
1275
+ ['policy', 'storageClass', 'request', 'credentialManagementScope'],
1305
1276
  fieldNameArg,
1306
1277
  );
1307
1278
  return {
@@ -1314,9 +1285,9 @@ const normalizeTarget = (
1314
1285
  value.request,
1315
1286
  `${fieldNameArg}.request`,
1316
1287
  ),
1317
- credentials: normalizeCredentials(
1318
- value.credentials,
1319
- `${fieldNameArg}.credentials`,
1288
+ credentialManagementScope: normalizeCredentialManagementScope(
1289
+ value.credentialManagementScope,
1290
+ `${fieldNameArg}.credentialManagementScope`,
1320
1291
  ),
1321
1292
  };
1322
1293
  };
@@ -1364,11 +1335,11 @@ const normalizeUnfencedSnapshotShape = (
1364
1335
  ],
1365
1336
  fieldNameArg,
1366
1337
  );
1367
- if (value.schemaVersion !== 1) {
1368
- return fail(`${fieldNameArg}.schemaVersion must be 1`);
1338
+ if (value.schemaVersion !== 2) {
1339
+ return fail(`${fieldNameArg}.schemaVersion must be 2`);
1369
1340
  }
1370
1341
  return {
1371
- schemaVersion: 1,
1342
+ schemaVersion: 2,
1372
1343
  binding: normalizeObjectStorageBinding(
1373
1344
  value.binding,
1374
1345
  'ready',
@@ -1408,11 +1379,11 @@ const normalizeFencedSnapshotShape = (
1408
1379
  ],
1409
1380
  fieldNameArg,
1410
1381
  );
1411
- if (value.schemaVersion !== 1) {
1412
- return fail(`${fieldNameArg}.schemaVersion must be 1`);
1382
+ if (value.schemaVersion !== 2) {
1383
+ return fail(`${fieldNameArg}.schemaVersion must be 2`);
1413
1384
  }
1414
1385
  return {
1415
- schemaVersion: 1,
1386
+ schemaVersion: 2,
1416
1387
  binding: normalizeObjectStorageBinding(
1417
1388
  value.binding,
1418
1389
  'ready',
@@ -1442,7 +1413,7 @@ const normalizeFencedSnapshotShape = (
1442
1413
  const createUnfencedSnapshotDigestPayload = (
1443
1414
  snapshotArg: IUnfencedObjectStorageBindingControlSnapshot,
1444
1415
  ): TUnfencedObjectStorageBindingControlSnapshotDigestPayload => ({
1445
- schemaVersion: 1,
1416
+ schemaVersion: 2,
1446
1417
  binding: snapshotArg.binding,
1447
1418
  recordRevision: snapshotArg.recordRevision,
1448
1419
  capturedAt: snapshotArg.capturedAt,
@@ -1451,7 +1422,7 @@ const createUnfencedSnapshotDigestPayload = (
1451
1422
  const createFencedSnapshotDigestPayload = (
1452
1423
  snapshotArg: IFencedObjectStorageBindingControlSnapshot,
1453
1424
  ): TFencedObjectStorageBindingControlSnapshotDigestPayload => ({
1454
- schemaVersion: 1,
1425
+ schemaVersion: 2,
1455
1426
  binding: snapshotArg.binding,
1456
1427
  recordRevision: snapshotArg.recordRevision,
1457
1428
  capturedAt: snapshotArg.capturedAt,
@@ -1676,11 +1647,11 @@ const normalizePrepareRequestShape = (
1676
1647
  ],
1677
1648
  'object-storage migration prepare request',
1678
1649
  );
1679
- if (value.schemaVersion !== 1) {
1680
- return fail('object-storage migration prepare request.schemaVersion must be 1');
1650
+ if (value.schemaVersion !== 2) {
1651
+ return fail('object-storage migration prepare request.schemaVersion must be 2');
1681
1652
  }
1682
1653
  return {
1683
- schemaVersion: 1,
1654
+ schemaVersion: 2,
1684
1655
  migrationId: readIdentifier(
1685
1656
  value.migrationId,
1686
1657
  'object-storage migration prepare request.migrationId',
@@ -1874,11 +1845,11 @@ const normalizeMutationFence = (
1874
1845
  valueArg: Record<string, unknown>,
1875
1846
  fieldNameArg: string,
1876
1847
  ): IStorageMigrationMutationFence => {
1877
- if (valueArg.schemaVersion !== 1) {
1878
- return fail(`${fieldNameArg}.schemaVersion must be 1`);
1848
+ if (valueArg.schemaVersion !== 2) {
1849
+ return fail(`${fieldNameArg}.schemaVersion must be 2`);
1879
1850
  }
1880
1851
  return {
1881
- schemaVersion: 1,
1852
+ schemaVersion: 2,
1882
1853
  migrationId: readIdentifier(
1883
1854
  valueArg.migrationId,
1884
1855
  `${fieldNameArg}.migrationId`,
@@ -1981,7 +1952,7 @@ const normalizeQuiesceRequestShape = (
1981
1952
  const createPersistedStagingDigestPayload = (
1982
1953
  requestArg: IObjectStorageMigrationConsumerQuiesceRequest,
1983
1954
  ): TObjectStorageMigrationPersistedStagingDigestPayload => ({
1984
- schemaVersion: 1,
1955
+ schemaVersion: 2,
1985
1956
  migrationId: requestArg.migrationId,
1986
1957
  migrationDigest: requestArg.migrationDigest,
1987
1958
  expectedMigrationRevision: requestArg.expectedMigrationRevision,
@@ -2097,7 +2068,7 @@ const normalizeActivationRequestShape = (
2097
2068
  const createPersistedActivationDigestPayload = (
2098
2069
  requestArg: IObjectStorageMigrationConsumerActivationRequest,
2099
2070
  ): TObjectStorageMigrationPersistedActivationDigestPayload => ({
2100
- schemaVersion: 1,
2071
+ schemaVersion: 2,
2101
2072
  migrationId: requestArg.migrationId,
2102
2073
  migrationDigest: requestArg.migrationDigest,
2103
2074
  expectedMigrationRevision: requestArg.expectedMigrationRevision,
@@ -2368,8 +2339,7 @@ const assertCandidateIdentity = async (
2368
2339
  }
2369
2340
  if (
2370
2341
  canonicalize(candidateArg.policy) !== canonicalize(targetArg.policy) ||
2371
- canonicalize(candidateArg.credentials) !==
2372
- canonicalize(targetArg.credentials) ||
2342
+ candidateArg.credentialManagementScope !== targetArg.credentialManagementScope ||
2373
2343
  canonicalize(candidateArg.delivery) !==
2374
2344
  canonicalize(targetArg.request.delivery)
2375
2345
  ) {
@@ -2425,7 +2395,7 @@ const assertActiveMatchesCandidate = (
2425
2395
  candidateArg: TStagedObjectStorageBinding,
2426
2396
  fieldNameArg: string,
2427
2397
  ): void => {
2428
- const immutableKeys: readonly (keyof IResolvedObjectStorageBinding)[] = [
2398
+ const immutableKeys: readonly (keyof TActiveObjectStorageBinding)[] = [
2429
2399
  'schemaVersion',
2430
2400
  'id',
2431
2401
  'serviceId',
@@ -2439,7 +2409,7 @@ const assertActiveMatchesCandidate = (
2439
2409
  'capacity',
2440
2410
  'accessMode',
2441
2411
  'connection',
2442
- 'credentials',
2412
+ 'credentialManagementScope',
2443
2413
  'delivery',
2444
2414
  'versioning',
2445
2415
  'retentionDays',
@@ -2624,8 +2594,8 @@ export const normalizeObjectStorageMigrationStatus = async (
2624
2594
  phaseOptional,
2625
2595
  fieldName,
2626
2596
  );
2627
- if (value.schemaVersion !== 1) {
2628
- return fail(`${fieldName}.schemaVersion must be 1`);
2597
+ if (value.schemaVersion !== 2) {
2598
+ return fail(`${fieldName}.schemaVersion must be 2`);
2629
2599
  }
2630
2600
 
2631
2601
  const migrationId = readIdentifier(value.migrationId, `${fieldName}.migrationId`);
@@ -2663,7 +2633,7 @@ export const normalizeObjectStorageMigrationStatus = async (
2663
2633
  }
2664
2634
  await assertTargetIdentity(target, sourceBinding, `${fieldName}.target`);
2665
2635
  const recomputedMigrationDigest = await createObjectStorageMigrationSha256({
2666
- schemaVersion: 1,
2636
+ schemaVersion: 2,
2667
2637
  migrationId,
2668
2638
  sourceControlSnapshot: source.preparationSnapshot,
2669
2639
  workloadGeneration,
@@ -2870,7 +2840,7 @@ export const normalizeObjectStorageMigrationStatus = async (
2870
2840
  }
2871
2841
 
2872
2842
  const normalized = {
2873
- schemaVersion: 1 as const,
2843
+ schemaVersion: 2 as const,
2874
2844
  migrationId,
2875
2845
  migrationDigest,
2876
2846
  migrationRevision,
@@ -1,3 +1,5 @@
1
+ import type { TSecretManagementScope } from '../data/secret.js';
2
+
1
3
  export type TPlatformCapability =
2
4
  | 'email'
3
5
  | 'sms'
@@ -24,14 +26,6 @@ export type TPlatformEndpointProtocol =
24
26
  | 'mongodb'
25
27
  | 'sip';
26
28
 
27
- export type TPlatformConfigValue =
28
- | string
29
- | number
30
- | boolean
31
- | null
32
- | TPlatformConfigValue[]
33
- | { [key: string]: TPlatformConfigValue };
34
-
35
29
  export interface IPlatformCapability {
36
30
  id: TPlatformCapability;
37
31
  title: string;
@@ -46,15 +40,8 @@ export interface IPlatformProviderConfig {
46
40
  providerType: string;
47
41
  name: string;
48
42
  enabled: boolean;
49
- config?: { [key: string]: TPlatformConfigValue };
50
- secretBundleId?: string;
51
- }
52
-
53
- export interface IPlatformCredentialRef {
54
- secretBundleId?: string;
55
- secretGroupIds?: string[];
56
- dockerSecretName?: string;
57
- env?: { [key: string]: string };
43
+ /** Value-free owner scope; provider-specific operational config stays adapter-internal. */
44
+ credentialManagementScope?: Extract<TSecretManagementScope, `platform:${string}`>;
58
45
  }
59
46
 
60
47
  export interface IPlatformServiceEndpoint {
@@ -74,9 +61,9 @@ export interface IPlatformBinding {
74
61
  desiredState: TPlatformDesiredState;
75
62
  status: TPlatformBindingStatus;
76
63
  providerConfigId?: string;
77
- config?: { [key: string]: TPlatformConfigValue };
78
64
  endpoints?: IPlatformServiceEndpoint[];
79
- credentials?: IPlatformCredentialRef[];
65
+ /** Value-free reconciliation scope for service-owned credentials. */
66
+ credentialManagementScope?: Extract<TSecretManagementScope, `platform:${string}`>;
80
67
  createdAt?: number;
81
68
  updatedAt?: number;
82
69
  }
package/ts/plugins.ts CHANGED
@@ -6,9 +6,11 @@ export {
6
6
  }
7
7
 
8
8
  // @push.rocks scope
9
+ import * as smartcrypto from '@push.rocks/smartcrypto';
9
10
  import * as smartlogInterfaces from '@push.rocks/smartlog-interfaces';
10
11
 
11
12
  export {
13
+ smartcrypto,
12
14
  smartlogInterfaces,
13
15
  }
14
16
 
@@ -1,11 +1,10 @@
1
1
  import * as plugins from '../plugins.js';
2
- import type { IIdentity } from '../data/user.js';
2
+ import type { IIdentity, IIdentityCredential } from '../data/user.js';
3
3
  import type {
4
4
  IHostedAppBootstrapAction,
5
5
  IHostedAppBootstrapActionRequest,
6
6
  IHostedAppLifecycleReport,
7
7
  IHostedAppLifecycleState,
8
- IHostedAppRuntimeIdentity,
9
8
  IHostedAppUpgradeState,
10
9
  } from '../data/hostedapp.js';
11
10
 
@@ -15,7 +14,7 @@ export interface IReq_HostedApp_ReportLifecycleState extends plugins.typedreques
15
14
  > {
16
15
  method: 'hostedAppReportLifecycleState';
17
16
  request: {
18
- identity: IHostedAppRuntimeIdentity;
17
+ identity: IIdentityCredential;
19
18
  report: IHostedAppLifecycleReport;
20
19
  };
21
20
  response: {
@@ -29,7 +28,7 @@ export interface IReq_HostedApp_GetLifecycleState extends plugins.typedrequestIn
29
28
  > {
30
29
  method: 'hostedAppGetLifecycleState';
31
30
  request: {
32
- identity: IHostedAppRuntimeIdentity;
31
+ identity: IIdentityCredential;
33
32
  };
34
33
  response: {
35
34
  state: IHostedAppLifecycleState;
@@ -42,7 +41,7 @@ export interface IReq_HostedApp_RequestBootstrapAction extends plugins.typedrequ
42
41
  > {
43
42
  method: 'hostedAppRequestBootstrapAction';
44
43
  request: {
45
- identity: IHostedAppRuntimeIdentity;
44
+ identity: IIdentityCredential;
46
45
  action: IHostedAppBootstrapActionRequest;
47
46
  };
48
47
  response: {
@@ -57,8 +56,10 @@ export interface IReq_HostedApp_CompleteBootstrapAction extends plugins.typedreq
57
56
  > {
58
57
  method: 'hostedAppCompleteBootstrapAction';
59
58
  request: {
60
- identity: IHostedAppRuntimeIdentity;
61
- actionId?: string;
59
+ identity: IIdentityCredential;
60
+ actionId: string;
61
+ expectedActionRevision: number;
62
+ expectedActionStatus: 'ready';
62
63
  message?: string;
63
64
  };
64
65
  response: {
@@ -66,13 +67,53 @@ export interface IReq_HostedApp_CompleteBootstrapAction extends plugins.typedreq
66
67
  };
67
68
  }
68
69
 
70
+ export const validateHostedAppCompleteBootstrapActionRequest = (
71
+ requestArg: unknown,
72
+ ): string[] => {
73
+ if (!requestArg || typeof requestArg !== 'object' || Array.isArray(requestArg)) {
74
+ return ['hosted app bootstrap completion must be an object'];
75
+ }
76
+ const request = requestArg as Record<string, unknown>;
77
+ const errors: string[] = [];
78
+ const allowedKeys = new Set([
79
+ 'identity',
80
+ 'actionId',
81
+ 'expectedActionRevision',
82
+ 'expectedActionStatus',
83
+ 'message',
84
+ ]);
85
+ if (Object.keys(request).some((keyArg) => !allowedKeys.has(keyArg))) {
86
+ errors.push('hosted app bootstrap completion contains fields outside its schema');
87
+ }
88
+ if (!request.identity || typeof request.identity !== 'object'
89
+ || typeof (request.identity as Record<string, unknown>).jwt !== 'string') {
90
+ errors.push('hosted app bootstrap completion requires a JWT identity');
91
+ }
92
+ if (typeof request.actionId !== 'string'
93
+ || !/^[A-Za-z0-9][A-Za-z0-9:._-]{0,199}$/.test(request.actionId)) {
94
+ errors.push('hosted app bootstrap completion actionId must be canonical');
95
+ }
96
+ if (!Number.isSafeInteger(request.expectedActionRevision)
97
+ || (request.expectedActionRevision as number) < 1) {
98
+ errors.push('hosted app bootstrap completion revision must be positive');
99
+ }
100
+ if (request.expectedActionStatus !== 'ready') {
101
+ errors.push('hosted app bootstrap completion must fence ready status');
102
+ }
103
+ if (request.message !== undefined
104
+ && (typeof request.message !== 'string' || request.message.length > 4000)) {
105
+ errors.push('hosted app bootstrap completion message must be bounded');
106
+ }
107
+ return errors;
108
+ };
109
+
69
110
  export interface IReq_HostedApp_StartManagedUpgrade extends plugins.typedrequestInterfaces.implementsTR<
70
111
  plugins.typedrequestInterfaces.ITypedRequest,
71
112
  IReq_HostedApp_StartManagedUpgrade
72
113
  > {
73
114
  method: 'hostedAppStartManagedUpgrade';
74
115
  request: {
75
- identity: IHostedAppRuntimeIdentity;
116
+ identity: IIdentityCredential;
76
117
  targetVersion?: string;
77
118
  };
78
119
  response: {
@@ -87,7 +128,7 @@ export interface IReq_HostedApp_GetManagedUpgradeStatus extends plugins.typedreq
87
128
  > {
88
129
  method: 'hostedAppGetManagedUpgradeStatus';
89
130
  request: {
90
- identity: IHostedAppRuntimeIdentity;
131
+ identity: IIdentityCredential;
91
132
  };
92
133
  response: {
93
134
  upgradeState: IHostedAppUpgradeState;
@@ -27,8 +27,6 @@ import * as nodeRequests from './node.js';
27
27
  import * as platformRequests from './platform.js';
28
28
  import * as routingRequests from './routing.js';
29
29
  import * as secretRequests from './secret.js';
30
- import * as secretBundleRequests from './secretbundle.js';
31
- import * as secretGroupRequests from './secretgroup.js';
32
30
  import * as serverRequests from './server.js';
33
31
  import * as serviceRequests from './service.js';
34
32
  import * as settingsRequests from './settings.js';
@@ -65,8 +63,6 @@ export {
65
63
  platformRequests as platform,
66
64
  routingRequests as routing,
67
65
  secretRequests as secret,
68
- secretBundleRequests as secretbundle,
69
- secretGroupRequests as secretgroup,
70
66
  serverRequests as server,
71
67
  serviceRequests as service,
72
68
  settingsRequests as settings,
@@ -124,7 +124,6 @@ extends plugins.typedrequestInterfaces.implementsTR<
124
124
  bindingId: string;
125
125
  status: TPlatformBindingStatus;
126
126
  endpoints?: IPlatformBinding['endpoints'];
127
- credentials?: IPlatformBinding['credentials'];
128
127
  errorText?: string;
129
128
  };
130
129
  response: {