@tinycloud/sdk-core 3.0.0-beta.13 → 3.0.0-beta.14
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/delegations/index.cjs +22 -2
- package/dist/delegations/index.cjs.map +1 -1
- package/dist/delegations/index.d.cts +2 -2
- package/dist/delegations/index.d.ts +2 -2
- package/dist/delegations/index.js +22 -2
- package/dist/delegations/index.js.map +1 -1
- package/dist/index.cjs +22 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/dist/{recipient-types.schema-Cz5zJzED.d.cts → recipient-types.schema-lAKNQlxx.d.cts} +1 -0
- package/dist/{recipient-types.schema-Cz5zJzED.d.ts → recipient-types.schema-lAKNQlxx.d.ts} +1 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -6546,6 +6546,7 @@ var DelegationErrorSchema = import_zod4.z.object({
|
|
|
6546
6546
|
});
|
|
6547
6547
|
var DelegationErrorCodes = {
|
|
6548
6548
|
AUTH_REQUIRED: "AUTH_REQUIRED",
|
|
6549
|
+
AUTH_UNAUTHORIZED: "AUTH_UNAUTHORIZED",
|
|
6549
6550
|
AUTH_EXPIRED: "AUTH_EXPIRED",
|
|
6550
6551
|
NOT_INITIALIZED: "NOT_INITIALIZED",
|
|
6551
6552
|
NOT_FOUND: "NOT_FOUND",
|
|
@@ -10928,6 +10929,13 @@ var ShareRecipientClient = class {
|
|
|
10928
10929
|
};
|
|
10929
10930
|
|
|
10930
10931
|
// src/delegations/SharingService.ts
|
|
10932
|
+
function spaceIdsEqual(left, right) {
|
|
10933
|
+
const normalizeOwnerAddress = (space) => {
|
|
10934
|
+
const match = /^(tinycloud:pkh:eip155:\d+:)(0x[0-9a-fA-F]{40})(:.+)$/.exec(space);
|
|
10935
|
+
return match === null ? space : `${match[1]}${match[2].toLowerCase()}${match[3]}`;
|
|
10936
|
+
};
|
|
10937
|
+
return normalizeOwnerAddress(left) === normalizeOwnerAddress(right);
|
|
10938
|
+
}
|
|
10931
10939
|
function inferShortServiceFromActionUrns(actions) {
|
|
10932
10940
|
let short;
|
|
10933
10941
|
for (const action of actions) {
|
|
@@ -11250,7 +11258,7 @@ var SharingService = class {
|
|
|
11250
11258
|
for (const key of allKeys) {
|
|
11251
11259
|
const delegations = this.registry.getDelegationsForKey(key.id);
|
|
11252
11260
|
for (const delegation of delegations) {
|
|
11253
|
-
if (delegation.spaceId
|
|
11261
|
+
if (delegation.spaceId === void 0 || !spaceIdsEqual(delegation.spaceId, this.session?.spaceId ?? "")) {
|
|
11254
11262
|
continue;
|
|
11255
11263
|
}
|
|
11256
11264
|
if ((delegation.caveats?.length ?? 0) > 0) {
|
|
@@ -11378,11 +11386,23 @@ var SharingService = class {
|
|
|
11378
11386
|
const errorText = await registerRes.text();
|
|
11379
11387
|
const registrationTextActiveError = this.retiredGraphError();
|
|
11380
11388
|
if (registrationTextActiveError) return { ok: false, error: registrationTextActiveError };
|
|
11389
|
+
const message = `Failed to register delegation with server: ${registerRes.status} ${errorText}`;
|
|
11390
|
+
if (registerRes.status === 401 || registerRes.status === 403) {
|
|
11391
|
+
return {
|
|
11392
|
+
ok: false,
|
|
11393
|
+
error: createError2(
|
|
11394
|
+
DelegationErrorCodes.AUTH_UNAUTHORIZED,
|
|
11395
|
+
message,
|
|
11396
|
+
void 0,
|
|
11397
|
+
{ status: registerRes.status }
|
|
11398
|
+
)
|
|
11399
|
+
};
|
|
11400
|
+
}
|
|
11381
11401
|
return {
|
|
11382
11402
|
ok: false,
|
|
11383
11403
|
error: createError2(
|
|
11384
11404
|
DelegationErrorCodes.CREATION_FAILED,
|
|
11385
|
-
|
|
11405
|
+
message
|
|
11386
11406
|
)
|
|
11387
11407
|
};
|
|
11388
11408
|
}
|