@tinycloud/sdk-core 2.2.0-beta.10 → 2.2.0-beta.11
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 +19 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -2
- package/dist/index.d.ts +34 -2
- package/dist/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -50,6 +50,7 @@ __export(index_exports, {
|
|
|
50
50
|
DuckDbAction: () => import_sdk_services5.DuckDbAction,
|
|
51
51
|
DuckDbDatabaseHandle: () => import_sdk_services5.DuckDbDatabaseHandle,
|
|
52
52
|
DuckDbService: () => import_sdk_services5.DuckDbService,
|
|
53
|
+
EXPIRY: () => EXPIRY,
|
|
53
54
|
EnsDataSchema: () => EnsDataSchema,
|
|
54
55
|
ErrorCodes: () => import_sdk_services5.ErrorCodes,
|
|
55
56
|
HooksService: () => import_sdk_services5.HooksService,
|
|
@@ -850,6 +851,20 @@ function validateServerSpaceInfoResponse(data) {
|
|
|
850
851
|
return { ok: true, data: result.data };
|
|
851
852
|
}
|
|
852
853
|
|
|
854
|
+
// src/expiry.ts
|
|
855
|
+
var EPHEMERAL_MS = 60 * 60 * 1e3;
|
|
856
|
+
var SESSION_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
857
|
+
var SHARE_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
858
|
+
var APP_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
859
|
+
var MAX_MS = 10 * 365 * 24 * 60 * 60 * 1e3;
|
|
860
|
+
var EXPIRY = {
|
|
861
|
+
EPHEMERAL_MS,
|
|
862
|
+
SESSION_MS,
|
|
863
|
+
SHARE_MS,
|
|
864
|
+
APP_MS,
|
|
865
|
+
MAX_MS
|
|
866
|
+
};
|
|
867
|
+
|
|
853
868
|
// src/spaces/SpaceService.ts
|
|
854
869
|
var SERVICE_NAME = "space";
|
|
855
870
|
var SpaceErrorCodes = {
|
|
@@ -926,7 +941,7 @@ function transformServerDelegations(validatedData, defaultSpaceId) {
|
|
|
926
941
|
spaceId,
|
|
927
942
|
path,
|
|
928
943
|
actions,
|
|
929
|
-
expiry: info.expiry ? new Date(info.expiry) : new Date(Date.now() +
|
|
944
|
+
expiry: info.expiry ? new Date(info.expiry) : new Date(Date.now() + EXPIRY.SHARE_MS),
|
|
930
945
|
isRevoked: false,
|
|
931
946
|
createdAt: info.issued_at ? new Date(info.issued_at) : void 0,
|
|
932
947
|
parentCid: firstStringParent
|
|
@@ -2310,7 +2325,7 @@ var DelegationManager = class {
|
|
|
2310
2325
|
spaceId: this.session.spaceId,
|
|
2311
2326
|
path: params.path,
|
|
2312
2327
|
actions: params.actions,
|
|
2313
|
-
expiry: params.expiry ?? new Date(Date.now() +
|
|
2328
|
+
expiry: params.expiry ?? new Date(Date.now() + EXPIRY.SHARE_MS),
|
|
2314
2329
|
isRevoked: false,
|
|
2315
2330
|
allowSubDelegation: !(params.disableSubDelegation ?? false),
|
|
2316
2331
|
createdAt: /* @__PURE__ */ new Date()
|
|
@@ -3489,7 +3504,7 @@ function inferShortServiceFromActionUrns(actions) {
|
|
|
3489
3504
|
return short;
|
|
3490
3505
|
}
|
|
3491
3506
|
var DEFAULT_READ_ACTIONS = ["tinycloud.kv/get", "tinycloud.kv/metadata"];
|
|
3492
|
-
var DEFAULT_EXPIRY_MS =
|
|
3507
|
+
var DEFAULT_EXPIRY_MS = EXPIRY.SHARE_MS;
|
|
3493
3508
|
var BASE64_PREFIX = "tc1:";
|
|
3494
3509
|
function createError2(code, message, cause, meta) {
|
|
3495
3510
|
return {
|
|
@@ -5145,6 +5160,7 @@ function parseRecapCapabilities(parseWasm, siwe) {
|
|
|
5145
5160
|
DuckDbAction,
|
|
5146
5161
|
DuckDbDatabaseHandle,
|
|
5147
5162
|
DuckDbService,
|
|
5163
|
+
EXPIRY,
|
|
5148
5164
|
EnsDataSchema,
|
|
5149
5165
|
ErrorCodes,
|
|
5150
5166
|
HooksService,
|