@tinycloud/sdk-core 2.4.0 → 2.5.0-beta.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.
- package/dist/index.cjs +38 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -470,6 +470,15 @@ var import_sdk_services3 = require("@tinycloud/sdk-services");
|
|
|
470
470
|
var import_sdk_services2 = require("@tinycloud/sdk-services");
|
|
471
471
|
|
|
472
472
|
// src/spaces/Space.ts
|
|
473
|
+
function unavailableSecretsService() {
|
|
474
|
+
return new Proxy({}, {
|
|
475
|
+
get: () => {
|
|
476
|
+
throw new Error(
|
|
477
|
+
"Secrets service factory not configured. Provide createSecrets in SpaceConfig."
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
}
|
|
473
482
|
var Space = class {
|
|
474
483
|
/**
|
|
475
484
|
* Create a new Space instance.
|
|
@@ -481,6 +490,7 @@ var Space = class {
|
|
|
481
490
|
this._name = config.name;
|
|
482
491
|
this._kv = config.createKV(config.id);
|
|
483
492
|
this._vault = config.createVault(config.id);
|
|
493
|
+
this._secrets = config.createSecrets?.(config.id) ?? unavailableSecretsService();
|
|
484
494
|
this._delegations = config.createDelegations(config.id);
|
|
485
495
|
this._sharing = config.createSharing(config.id);
|
|
486
496
|
this._getInfo = config.getInfo;
|
|
@@ -509,6 +519,12 @@ var Space = class {
|
|
|
509
519
|
get vault() {
|
|
510
520
|
return this._vault;
|
|
511
521
|
}
|
|
522
|
+
/**
|
|
523
|
+
* Secrets operations scoped to this space.
|
|
524
|
+
*/
|
|
525
|
+
get secrets() {
|
|
526
|
+
return this._secrets;
|
|
527
|
+
}
|
|
512
528
|
/**
|
|
513
529
|
* Delegation operations scoped to this space.
|
|
514
530
|
*/
|
|
@@ -894,6 +910,8 @@ var SpaceConfigSchema = import_zod4.z.object({
|
|
|
894
910
|
createKV: import_zod4.z.function(),
|
|
895
911
|
/** Factory function to create a space-scoped Data Vault service */
|
|
896
912
|
createVault: import_zod4.z.function(),
|
|
913
|
+
/** Optional factory function to create a space-scoped secrets service */
|
|
914
|
+
createSecrets: import_zod4.z.function().optional(),
|
|
897
915
|
/** Factory function to create space-scoped delegations */
|
|
898
916
|
createDelegations: import_zod4.z.function(),
|
|
899
917
|
/** Factory function to create space-scoped sharing */
|
|
@@ -916,6 +934,8 @@ var SpaceServiceConfigSchema = import_zod4.z.object({
|
|
|
916
934
|
createKVService: import_zod4.z.function().optional(),
|
|
917
935
|
/** Factory function to create a space-scoped Data Vault service */
|
|
918
936
|
createVaultService: import_zod4.z.function().optional(),
|
|
937
|
+
/** Factory function to create a space-scoped secrets service */
|
|
938
|
+
createSecretsService: import_zod4.z.function().optional(),
|
|
919
939
|
/** User's PKH DID (derived from address or provided explicitly) */
|
|
920
940
|
userDid: import_zod4.z.string().optional(),
|
|
921
941
|
/** Optional SharingService for v2 sharing links (client-side) */
|
|
@@ -1188,6 +1208,7 @@ var SpaceService = class {
|
|
|
1188
1208
|
this.capabilityRegistry = config.capabilityRegistry;
|
|
1189
1209
|
this.createKVServiceFn = config.createKVService;
|
|
1190
1210
|
this.createVaultServiceFn = config.createVaultService;
|
|
1211
|
+
this.createSecretsServiceFn = config.createSecretsService;
|
|
1191
1212
|
this._userDid = config.userDid;
|
|
1192
1213
|
this.sharingService = config.sharingService;
|
|
1193
1214
|
this.createDelegationFn = config.createDelegation;
|
|
@@ -1204,6 +1225,7 @@ var SpaceService = class {
|
|
|
1204
1225
|
if (config.capabilityRegistry) this.capabilityRegistry = config.capabilityRegistry;
|
|
1205
1226
|
if (config.createKVService) this.createKVServiceFn = config.createKVService;
|
|
1206
1227
|
if (config.createVaultService) this.createVaultServiceFn = config.createVaultService;
|
|
1228
|
+
if (config.createSecretsService) this.createSecretsServiceFn = config.createSecretsService;
|
|
1207
1229
|
if (config.userDid !== void 0) this._userDid = config.userDid;
|
|
1208
1230
|
if (config.sharingService) this.sharingService = config.sharingService;
|
|
1209
1231
|
if (config.createDelegation) this.createDelegationFn = config.createDelegation;
|
|
@@ -1497,6 +1519,7 @@ var SpaceService = class {
|
|
|
1497
1519
|
name,
|
|
1498
1520
|
createKV: this.createSpaceScopedKV.bind(this),
|
|
1499
1521
|
createVault: this.createSpaceScopedVault.bind(this),
|
|
1522
|
+
createSecrets: this.createSpaceScopedSecrets.bind(this),
|
|
1500
1523
|
createDelegations: this.createSpaceScopedDelegations.bind(this),
|
|
1501
1524
|
createSharing: this.createSpaceScopedSharing.bind(this),
|
|
1502
1525
|
getInfo: this.getSpaceInfo.bind(this)
|
|
@@ -1641,6 +1664,21 @@ var SpaceService = class {
|
|
|
1641
1664
|
}
|
|
1642
1665
|
});
|
|
1643
1666
|
}
|
|
1667
|
+
/**
|
|
1668
|
+
* Create a space-scoped secrets service.
|
|
1669
|
+
*/
|
|
1670
|
+
createSpaceScopedSecrets(spaceId) {
|
|
1671
|
+
if (this.createSecretsServiceFn) {
|
|
1672
|
+
return this.createSecretsServiceFn(spaceId);
|
|
1673
|
+
}
|
|
1674
|
+
return new Proxy({}, {
|
|
1675
|
+
get: () => {
|
|
1676
|
+
throw new Error(
|
|
1677
|
+
"Secrets service factory not configured. Provide createSecretsService in SpaceServiceConfig."
|
|
1678
|
+
);
|
|
1679
|
+
}
|
|
1680
|
+
});
|
|
1681
|
+
}
|
|
1644
1682
|
/**
|
|
1645
1683
|
* Create space-scoped delegation operations.
|
|
1646
1684
|
*/
|