buckyos 0.7.133 → 0.7.135
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/cli/dist/cli.mjs +1 -1
- package/cli/dist/cli.mjs.map +1 -1
- package/cli/version.ts +1 -1
- package/dist/account.d.ts +11 -0
- package/dist/account.d.ts.map +1 -1
- package/dist/browser.cjs +1 -1
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +2 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.mjs +166 -143
- package/dist/browser.mjs.map +1 -1
- package/dist/hybrid_sso.d.ts +110 -0
- package/dist/hybrid_sso.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +166 -143
- package/dist/index.mjs.map +1 -1
- package/dist/krpc_client.d.ts +7 -1
- package/dist/krpc_client.d.ts.map +1 -1
- package/dist/msg_center_client.d.ts +13 -1
- package/dist/msg_center_client.d.ts.map +1 -1
- package/dist/ndm_client.d.ts +6 -0
- package/dist/ndm_client.d.ts.map +1 -1
- package/dist/{ndm_proxy-501cb1e8.mjs → ndm_proxy-92a2d7c7.mjs} +348 -170
- package/dist/ndm_proxy-92a2d7c7.mjs.map +1 -0
- package/dist/ndm_proxy-c04f209f.js +13 -0
- package/dist/ndm_proxy-c04f209f.js.map +1 -0
- package/dist/{ndn_types-d768245f.mjs → ndn_types-395be6e1.mjs} +60 -38
- package/dist/ndn_types-395be6e1.mjs.map +1 -0
- package/dist/ndn_types-60e131a5.js +2 -0
- package/dist/ndn_types-60e131a5.js.map +1 -0
- package/dist/node.cjs +1 -1
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.ts +2 -0
- package/dist/node.d.ts.map +1 -1
- package/dist/node.mjs +166 -143
- package/dist/node.mjs.map +1 -1
- package/dist/provision.cjs +1 -1
- package/dist/provision.mjs +1 -1
- package/dist/runtime.d.ts +30 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/sdk_core.d.ts +14 -1
- package/dist/sdk_core.d.ts.map +1 -1
- package/dist/{tus_client-d0798623.js → tus_client-8a6a1011.js} +2 -2
- package/dist/{tus_client-d0798623.js.map → tus_client-8a6a1011.js.map} +1 -1
- package/dist/{tus_client-b1c35e8c.mjs → tus_client-cf69daf4.mjs} +2 -2
- package/dist/{tus_client-b1c35e8c.mjs.map → tus_client-cf69daf4.mjs.map} +1 -1
- package/dist/verify-hub-client.d.ts +1 -0
- package/dist/verify-hub-client.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/ndm_proxy-501cb1e8.mjs.map +0 -1
- package/dist/ndm_proxy-68b8160c.js +0 -13
- package/dist/ndm_proxy-68b8160c.js.map +0 -1
- package/dist/ndn_types-44c69036.js +0 -2
- package/dist/ndn_types-44c69036.js.map +0 -1
- package/dist/ndn_types-d768245f.mjs.map +0 -1
|
@@ -35,11 +35,13 @@ var __privateMethod = (obj, member, method) => {
|
|
|
35
35
|
return method;
|
|
36
36
|
};
|
|
37
37
|
var _listener, _listeners, _cancelled, _allowInsecure, _gzip, _headers, _method, _timeout, _url, _body, _bodyType, _creds, _preflight, _process, _retry, _signal, _throttle, _getUrlFunc, _send, send_fn, _statusCode, _statusMessage, _headers2, _body2, _request, _error, _names, _data, _dataLength, _writeData, writeData_fn, _data2, _offset, _bytesRead, _parent, _maxInflation, _incrementBytesRead, incrementBytesRead_fn, _peekBytes, peekBytes_fn, _r, _s, _v, _networkV, _privateKey, _options, _type, _to, _data3, _nonce, _gasLimit, _gasPrice, _maxPriorityFeePerGas, _maxFeePerGas, _value, _chainId, _sig, _accessList, _maxFeePerBlobGas, _blobVersionedHashes, _kzg, _blobs, _auths, _blobWrapperVersion, _getSerialized, getSerialized_fn, _types, _fullTypes, _encoderCache, _getEncoder, getEncoder_fn, _offset2, _tokens, _subTokenString, subTokenString_fn, _walkAsync, walkAsync_fn, _getCoder, getCoder_fn, _errors, _events, _functions, _abiCoder, _getFunction, getFunction_fn, _getEvent, getEvent_fn, _transactions, _logs, _startBlock, _iface, _iface2, _filter, _a, _supports2544, _resolver, _fetch, fetch_fn, _getResolver, getResolver_fn, _url2, _processFunc, _name, _chainId2, _plugins, _provider, _poller, _interval, _blockNumber, _poll, poll_fn, _provider2, _poll2, _running, _tag, _lastBlock, _filter2, _hash, _provider3, _filter3, _poller2, _running2, _blockNumber2, _poll3, poll_fn2, _subs, _plugins2, _pausedState, _destroyed, _networkPromise, _anyNetwork, _performCache, _lastBlockNumber, _nextTimer, _timers, _disableCcipRead, _requestRate, _requestTimes, _options2, _getDelay, getDelay_fn, _perform, perform_fn, _call, call_fn, _checkNetwork, checkNetwork_fn, _getAccountValue, getAccountValue_fn, _getBlock, getBlock_fn, _hasSub, hasSub_fn, _getSub, getSub_fn, _throwUnsupported, throwUnsupported_fn, _provider4, _filterIdPromise, _poller3, _running3, _network, _hault, _poll4, poll_fn3, _teardown, teardown_fn, _event, _options3, _nextId, _payloads, _drainTimer, _notReady, _network2, _pendingDetectNetwork, _scheduleDrain, scheduleDrain_fn, _pollingInterval, _connect, _signingKey, _data4, _checksum, _words, _loadWords, loadWords_fn, _account, account_fn, _fromSeed, fromSeed_fn, _fromAccount, fromAccount_fn;
|
|
38
|
-
import { v as DID, w as
|
|
38
|
+
import { v as DID, w as getBrowserIdentityRaw, x as clearBrowserUserInfo, y as saveBrowserIdentity, z as saveBrowserUserInfo, A as getBrowserUserInfo, q as parseBuckyOSOwnerDocument, h as hashPassword, B as saveLocalAccountInfo, C as cleanLocalAccountInfo, E as canonicalize, F as signJwtEdDSA, O as ObjId, G as ChunkId, H as FileObject, I as sha256Bytes, J as DirObject, S as SimpleChunkList } from "./ndn_types-395be6e1.mjs";
|
|
39
39
|
class RPCError extends Error {
|
|
40
|
-
constructor(message) {
|
|
40
|
+
constructor(message, code, data) {
|
|
41
41
|
super(message);
|
|
42
42
|
this.name = "RPCError";
|
|
43
|
+
this.code = code;
|
|
44
|
+
this.data = data;
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
const defaultFetcher$1 = async (input, init2) => {
|
|
@@ -174,7 +176,11 @@ class kRPCClient {
|
|
|
174
176
|
const rpcResponse = await response.json();
|
|
175
177
|
this.parseResponseSys(rpcResponse.sys, currentSeq);
|
|
176
178
|
if ("error" in rpcResponse && rpcResponse.error) {
|
|
177
|
-
throw new RPCError(
|
|
179
|
+
throw new RPCError(
|
|
180
|
+
`RPC call error: ${rpcResponse.error}`,
|
|
181
|
+
typeof rpcResponse.code === "string" ? rpcResponse.code : void 0,
|
|
182
|
+
rpcResponse.data
|
|
183
|
+
);
|
|
178
184
|
}
|
|
179
185
|
if (!("result" in rpcResponse) || rpcResponse.result === void 0) {
|
|
180
186
|
throw new RPCError("RPC response missing result");
|
|
@@ -213,6 +219,110 @@ class AuthClient {
|
|
|
213
219
|
this.navigate(authURL);
|
|
214
220
|
}
|
|
215
221
|
}
|
|
222
|
+
const DENY_REASONS = [
|
|
223
|
+
"session_kind_not_allowed",
|
|
224
|
+
"session_ceiling_exceeded",
|
|
225
|
+
"resource_grant_missing",
|
|
226
|
+
"entry_unavailable",
|
|
227
|
+
"zone_method_disabled",
|
|
228
|
+
"account_state",
|
|
229
|
+
"credential_state",
|
|
230
|
+
"source_revoked",
|
|
231
|
+
"authorization_unavailable"
|
|
232
|
+
];
|
|
233
|
+
const ACCESS_DENIED_ERROR_CODE = "access_denied";
|
|
234
|
+
function isRecord(value) {
|
|
235
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
236
|
+
}
|
|
237
|
+
function parseAccessDenial(value) {
|
|
238
|
+
if (!isRecord(value) || typeof value.reason !== "string")
|
|
239
|
+
return null;
|
|
240
|
+
if (!DENY_REASONS.includes(value.reason))
|
|
241
|
+
return null;
|
|
242
|
+
const adjust = isRecord(value.adjust) && typeof value.adjust.party === "string" ? value.adjust : null;
|
|
243
|
+
if (!adjust)
|
|
244
|
+
return null;
|
|
245
|
+
return value;
|
|
246
|
+
}
|
|
247
|
+
function accessDenialOf(error) {
|
|
248
|
+
if (!(error instanceof RPCError) || error.code !== ACCESS_DENIED_ERROR_CODE)
|
|
249
|
+
return null;
|
|
250
|
+
return parseAccessDenial(error.data);
|
|
251
|
+
}
|
|
252
|
+
const ANONYMOUS_IDENTITY = { kind: "anonymous" };
|
|
253
|
+
function parseCurrentIdentity(value) {
|
|
254
|
+
if (!isRecord(value))
|
|
255
|
+
return null;
|
|
256
|
+
if (value.kind === "anonymous")
|
|
257
|
+
return ANONYMOUS_IDENTITY;
|
|
258
|
+
const str = (key) => typeof value[key] === "string" ? value[key] : null;
|
|
259
|
+
if (value.kind === "account") {
|
|
260
|
+
const userId = str("user_id");
|
|
261
|
+
const did = str("did");
|
|
262
|
+
const userType = str("user_type");
|
|
263
|
+
if (!userId || !did || !userType || typeof value.restricted !== "boolean")
|
|
264
|
+
return null;
|
|
265
|
+
return value;
|
|
266
|
+
}
|
|
267
|
+
if (value.kind === "external") {
|
|
268
|
+
if (!str("did") || typeof value.restricted !== "boolean")
|
|
269
|
+
return null;
|
|
270
|
+
return value;
|
|
271
|
+
}
|
|
272
|
+
return null;
|
|
273
|
+
}
|
|
274
|
+
function identityKey(identity) {
|
|
275
|
+
switch (identity.kind) {
|
|
276
|
+
case "account":
|
|
277
|
+
return `${identity.zone_host}|account|${identity.user_id}`;
|
|
278
|
+
case "external":
|
|
279
|
+
return `${identity.zone_host}|external|${identity.did}`;
|
|
280
|
+
default:
|
|
281
|
+
return "anonymous";
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
function identityAllows(identity, scope) {
|
|
285
|
+
if (identity.kind === "anonymous")
|
|
286
|
+
return false;
|
|
287
|
+
return !identity.restricted || (identity.scopes ?? []).includes(scope);
|
|
288
|
+
}
|
|
289
|
+
const DEFAULT_JUMP_BASE_URL = "https://jump.buckyos.org";
|
|
290
|
+
const JUMP_ACTION_PATHS = {
|
|
291
|
+
app_installer: "/sysdlg/app_installer"
|
|
292
|
+
};
|
|
293
|
+
function normalizeZoneHostname(input) {
|
|
294
|
+
const value = input.trim().toLowerCase().replace(/\.$/, "");
|
|
295
|
+
if (!value || value.length > 253)
|
|
296
|
+
return null;
|
|
297
|
+
if (/[^a-z0-9.-]/.test(value))
|
|
298
|
+
return null;
|
|
299
|
+
const labels = value.split(".");
|
|
300
|
+
if (labels.length < 2)
|
|
301
|
+
return null;
|
|
302
|
+
for (const label of labels) {
|
|
303
|
+
if (!label || label.length > 63 || label.startsWith("-") || label.endsWith("-"))
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
return value;
|
|
307
|
+
}
|
|
308
|
+
function zoneActionUrl(hostname, action) {
|
|
309
|
+
const host = normalizeZoneHostname(hostname);
|
|
310
|
+
const path = JUMP_ACTION_PATHS[action];
|
|
311
|
+
if (!host || !path)
|
|
312
|
+
return null;
|
|
313
|
+
return `https://${host}${path}`;
|
|
314
|
+
}
|
|
315
|
+
function buildJumpUrl(action, params, jumpBase = DEFAULT_JUMP_BASE_URL) {
|
|
316
|
+
const path = JUMP_ACTION_PATHS[action];
|
|
317
|
+
if (!path)
|
|
318
|
+
throw new Error(`unregistered jump action: ${action}`);
|
|
319
|
+
const base = new URL(jumpBase || DEFAULT_JUMP_BASE_URL);
|
|
320
|
+
if (base.protocol !== "https:" && base.hostname !== "localhost") {
|
|
321
|
+
throw new Error("jump base must be https");
|
|
322
|
+
}
|
|
323
|
+
const fragment = new URLSearchParams(params).toString();
|
|
324
|
+
return `${base.origin}${path}${fragment ? `#${fragment}` : ""}`;
|
|
325
|
+
}
|
|
216
326
|
function serializeAuthTarget(target) {
|
|
217
327
|
if (!target || typeof target !== "object") {
|
|
218
328
|
throw new RPCError("verify-hub auth target is required");
|
|
@@ -1779,8 +1889,13 @@ function contactTagApp(tag) {
|
|
|
1779
1889
|
const match = /^([a-z][a-z0-9_-]*)\.([a-z0-9_.-]+)$/.exec(tag);
|
|
1780
1890
|
return match ? match[1] : null;
|
|
1781
1891
|
}
|
|
1892
|
+
const USER_TYPE_GROUP_REF_PREFIX = "type:";
|
|
1893
|
+
const USER_GROUP_REF_PREFIX = "group:";
|
|
1894
|
+
function isUserGroupRefTag(tag) {
|
|
1895
|
+
return tag.startsWith(USER_TYPE_GROUP_REF_PREFIX) || tag.startsWith(USER_GROUP_REF_PREFIX);
|
|
1896
|
+
}
|
|
1782
1897
|
function contactTagKind(tag) {
|
|
1783
|
-
if (tag === CONTACT_TAG_ZONE_USER || tag === CONTACT_TAG_ZONE_AGENT)
|
|
1898
|
+
if (tag === CONTACT_TAG_ZONE_USER || tag === CONTACT_TAG_ZONE_AGENT || isUserGroupRefTag(tag))
|
|
1784
1899
|
return "system";
|
|
1785
1900
|
return contactTagApp(tag) ? "app" : "user";
|
|
1786
1901
|
}
|
|
@@ -2659,6 +2774,15 @@ var RuntimeType = /* @__PURE__ */ ((RuntimeType2) => {
|
|
|
2659
2774
|
RuntimeType2["Unknown"] = "Unknown";
|
|
2660
2775
|
return RuntimeType2;
|
|
2661
2776
|
})(RuntimeType || {});
|
|
2777
|
+
const ZONE_USER_TYPES = ["admin", "user", "limited", "root"];
|
|
2778
|
+
function parseZoneUserType(value) {
|
|
2779
|
+
const normalized = typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
2780
|
+
return ZONE_USER_TYPES.includes(normalized) ? normalized : null;
|
|
2781
|
+
}
|
|
2782
|
+
const EXTERNAL_PRINCIPAL_CLAIM = "external";
|
|
2783
|
+
function isExternalPrincipal(claims) {
|
|
2784
|
+
return (claims == null ? void 0 : claims.principal_kind) === "user" && claims[EXTERNAL_PRINCIPAL_CLAIM] === true;
|
|
2785
|
+
}
|
|
2662
2786
|
const DEFAULT_CONFIG = {
|
|
2663
2787
|
zoneHost: "",
|
|
2664
2788
|
appId: "",
|
|
@@ -3256,22 +3380,36 @@ class BuckyOSRuntime {
|
|
|
3256
3380
|
}
|
|
3257
3381
|
return this.refreshBrowserSessionToken();
|
|
3258
3382
|
}
|
|
3259
|
-
|
|
3260
|
-
if (!
|
|
3261
|
-
return
|
|
3383
|
+
storeBrowserIdentity(identity) {
|
|
3384
|
+
if (!hasBrowserStorage()) {
|
|
3385
|
+
return;
|
|
3262
3386
|
}
|
|
3263
|
-
const
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
const userName = typeof parsed.user_name === "string" ? parsed.user_name.trim() : typeof parsed.show_name === "string" ? parsed.show_name.trim() : "";
|
|
3267
|
-
if (!userId || !userType) {
|
|
3268
|
-
return null;
|
|
3387
|
+
const previous = parseCurrentIdentity(getBrowserIdentityRaw());
|
|
3388
|
+
if (previous && identityKey(previous) !== identityKey(identity)) {
|
|
3389
|
+
clearBrowserUserInfo();
|
|
3269
3390
|
}
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3391
|
+
saveBrowserIdentity(identity);
|
|
3392
|
+
if (identity.kind === "account") {
|
|
3393
|
+
saveBrowserUserInfo({
|
|
3394
|
+
user_name: identity.show_name || identity.user_id,
|
|
3395
|
+
user_id: identity.user_id,
|
|
3396
|
+
user_type: identity.user_type
|
|
3397
|
+
});
|
|
3398
|
+
} else {
|
|
3399
|
+
clearBrowserUserInfo();
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
/**
|
|
3403
|
+
* Whom the browser session speaks for; `anonymous` without a session.
|
|
3404
|
+
* Account, External and anonymous visitors are told apart here, never by
|
|
3405
|
+
* guessing from a cached user record.
|
|
3406
|
+
*/
|
|
3407
|
+
async getCurrentIdentity() {
|
|
3408
|
+
const sessionToken = await this.ensureSessionTokenReady();
|
|
3409
|
+
if (!sessionToken || !hasBrowserStorage()) {
|
|
3410
|
+
return ANONYMOUS_IDENTITY;
|
|
3411
|
+
}
|
|
3412
|
+
return parseCurrentIdentity(getBrowserIdentityRaw()) ?? ANONYMOUS_IDENTITY;
|
|
3275
3413
|
}
|
|
3276
3414
|
async refreshBrowserSession() {
|
|
3277
3415
|
const sessionToken = await this.refreshBrowserSessionToken();
|
|
@@ -3320,7 +3458,6 @@ class BuckyOSRuntime {
|
|
|
3320
3458
|
if (!hasFetchRuntime()) {
|
|
3321
3459
|
return this.sessionToken;
|
|
3322
3460
|
}
|
|
3323
|
-
const cachedUserInfo = hasBrowserStorage() ? getBrowserUserInfo() : null;
|
|
3324
3461
|
try {
|
|
3325
3462
|
const response = await fetch("/sso_refresh", {
|
|
3326
3463
|
method: "POST",
|
|
@@ -3335,10 +3472,10 @@ class BuckyOSRuntime {
|
|
|
3335
3472
|
}
|
|
3336
3473
|
const payload = await response.json();
|
|
3337
3474
|
const sessionToken = trimToNull$2(
|
|
3338
|
-
typeof payload.
|
|
3475
|
+
typeof payload.session_token === "string" ? payload.session_token : null
|
|
3339
3476
|
);
|
|
3340
|
-
const
|
|
3341
|
-
if (!sessionToken || !
|
|
3477
|
+
const identity = parseCurrentIdentity(payload.identity);
|
|
3478
|
+
if (!sessionToken || !identity || identity.kind === "anonymous") {
|
|
3342
3479
|
if (authStateRevision === this.authStateRevision) {
|
|
3343
3480
|
this.sessionToken = null;
|
|
3344
3481
|
}
|
|
@@ -3349,7 +3486,7 @@ class BuckyOSRuntime {
|
|
|
3349
3486
|
}
|
|
3350
3487
|
this.sessionToken = sessionToken;
|
|
3351
3488
|
this.refreshToken = null;
|
|
3352
|
-
|
|
3489
|
+
this.storeBrowserIdentity(identity);
|
|
3353
3490
|
this.validateSessionToken();
|
|
3354
3491
|
return this.sessionToken;
|
|
3355
3492
|
} catch (error) {
|
|
@@ -4713,6 +4850,22 @@ class BuckyOSSDK {
|
|
|
4713
4850
|
async subscribeKEvent(patterns, callback, options = {}) {
|
|
4714
4851
|
return this.getKEventClient().subscribe(patterns, callback, options);
|
|
4715
4852
|
}
|
|
4853
|
+
/**
|
|
4854
|
+
* Whom the current session speaks for: an account of this Zone, an External
|
|
4855
|
+
* DID (no account here) or an anonymous visitor. `getAccountInfo` stays
|
|
4856
|
+
* account-only and returns `null` for External sessions.
|
|
4857
|
+
*/
|
|
4858
|
+
async getCurrentIdentity() {
|
|
4859
|
+
if (this.currentRuntime == null) {
|
|
4860
|
+
console.error("BuckyOS WebSDK is not initialized,call initBuckyOS first");
|
|
4861
|
+
return ANONYMOUS_IDENTITY;
|
|
4862
|
+
}
|
|
4863
|
+
const runtimeType = this.currentRuntime.getConfig().runtimeType;
|
|
4864
|
+
if (runtimeType !== RuntimeType.Browser && runtimeType !== RuntimeType.AppRuntime) {
|
|
4865
|
+
return ANONYMOUS_IDENTITY;
|
|
4866
|
+
}
|
|
4867
|
+
return this.currentRuntime.getCurrentIdentity();
|
|
4868
|
+
}
|
|
4716
4869
|
async getAccountInfo() {
|
|
4717
4870
|
if (this.currentRuntime == null) {
|
|
4718
4871
|
console.error("BuckyOS WebSDK is not initialized,call initBuckyOS first");
|
|
@@ -5151,6 +5304,7 @@ function createSDKModule(target) {
|
|
|
5151
5304
|
getAppSetting: sdk.getAppSetting.bind(sdk),
|
|
5152
5305
|
setAppSetting: sdk.setAppSetting.bind(sdk),
|
|
5153
5306
|
getCurrentWalletUser: sdk.getCurrentWalletUser.bind(sdk),
|
|
5307
|
+
getCurrentIdentity: sdk.getCurrentIdentity.bind(sdk),
|
|
5154
5308
|
resolve_did: sdk.resolve_did.bind(sdk),
|
|
5155
5309
|
walletSignWithActiveDid: sdk.walletSignWithActiveDid.bind(sdk),
|
|
5156
5310
|
openExternalUrl: sdk.openExternalUrl.bind(sdk),
|
|
@@ -27983,13 +28137,13 @@ async function getUploadProgress(sessionId) {
|
|
|
27983
28137
|
}
|
|
27984
28138
|
return result;
|
|
27985
28139
|
}
|
|
27986
|
-
async function uploadChunkViaTus(endpoint, file, chunkInfo, chunkIndex, appId, fileHash, onProgress, signal) {
|
|
28140
|
+
async function uploadChunkViaTus(endpoint, file, chunkInfo, chunkIndex, appId, fileHash, sessionToken, onProgress, signal) {
|
|
27987
28141
|
const slice = file.slice(chunkInfo.offset, chunkInfo.offset + chunkInfo.length);
|
|
27988
28142
|
const chunkData = new Uint8Array(await slice.arrayBuffer());
|
|
27989
28143
|
const logicalPath = `${appId}/${chunkInfo.chunkId}`;
|
|
27990
28144
|
let tusModule;
|
|
27991
28145
|
try {
|
|
27992
|
-
tusModule = await import("./tus_client-
|
|
28146
|
+
tusModule = await import("./tus_client-cf69daf4.mjs");
|
|
27993
28147
|
} catch (error) {
|
|
27994
28148
|
const message = error instanceof Error ? error.message : String(error);
|
|
27995
28149
|
throw new NdmError("UPLOAD_FAILED", `Failed to load tus-js-client: ${message}`);
|
|
@@ -28002,6 +28156,7 @@ async function uploadChunkViaTus(endpoint, file, chunkInfo, chunkIndex, appId, f
|
|
|
28002
28156
|
const blob = new Blob([chunkData]);
|
|
28003
28157
|
const upload = new tusModule.Upload(blob, {
|
|
28004
28158
|
endpoint: `${endpoint}/ndm/v1/uploads`,
|
|
28159
|
+
headers: sessionToken ? { Authorization: `Bearer ${sessionToken}` } : {},
|
|
28005
28160
|
chunkSize: chunkData.length,
|
|
28006
28161
|
retryDelays: [0, 1e3, 3e3, 5e3],
|
|
28007
28162
|
storeFingerprintForResuming: false,
|
|
@@ -28060,11 +28215,12 @@ async function startUpload(sessionId, options) {
|
|
|
28060
28215
|
} else {
|
|
28061
28216
|
endpoint = typeof window !== "undefined" ? window.location.origin : "";
|
|
28062
28217
|
}
|
|
28063
|
-
|
|
28218
|
+
const sessionToken = (options == null ? void 0 : options.sessionToken) !== void 0 ? async () => options.sessionToken ?? null : async () => getActiveSessionToken().catch(() => null);
|
|
28219
|
+
doUpload(session, endpoint, concurrency, sessionToken).catch(() => {
|
|
28064
28220
|
});
|
|
28065
28221
|
return getImportSessionStatus(sessionId);
|
|
28066
28222
|
}
|
|
28067
|
-
async function doUpload(session, endpoint, concurrency) {
|
|
28223
|
+
async function doUpload(session, endpoint, concurrency, sessionToken) {
|
|
28068
28224
|
const states = Array.from(session.objectStates.values()).filter((s) => s.state !== "completed");
|
|
28069
28225
|
let running = 0;
|
|
28070
28226
|
let idx = 0;
|
|
@@ -28082,7 +28238,7 @@ async function doUpload(session, endpoint, concurrency) {
|
|
|
28082
28238
|
while (running < concurrency && idx < states.length) {
|
|
28083
28239
|
const state = states[idx++];
|
|
28084
28240
|
running++;
|
|
28085
|
-
uploadSingleObject(session, endpoint, state).then(() => {
|
|
28241
|
+
uploadSingleObject(session, endpoint, state, sessionToken).then(() => {
|
|
28086
28242
|
running--;
|
|
28087
28243
|
next();
|
|
28088
28244
|
}).catch(() => {
|
|
@@ -28098,7 +28254,7 @@ async function doUpload(session, endpoint, concurrency) {
|
|
|
28098
28254
|
next();
|
|
28099
28255
|
});
|
|
28100
28256
|
}
|
|
28101
|
-
async function uploadSingleObject(session, endpoint, state) {
|
|
28257
|
+
async function uploadSingleObject(session, endpoint, state, sessionToken) {
|
|
28102
28258
|
var _a2;
|
|
28103
28259
|
state.state = "uploading";
|
|
28104
28260
|
for (const [chunkIndex, chunk] of state.chunks.entries()) {
|
|
@@ -28111,6 +28267,7 @@ async function uploadSingleObject(session, endpoint, state) {
|
|
|
28111
28267
|
chunkIndex,
|
|
28112
28268
|
"default",
|
|
28113
28269
|
state.objectId,
|
|
28270
|
+
await sessionToken(),
|
|
28114
28271
|
(uploaded) => {
|
|
28115
28272
|
const prevChunkBytes = state.chunks.filter((c) => c !== chunk && c.uploaded).reduce((sum, c) => sum + c.length, 0);
|
|
28116
28273
|
state.uploadedBytes = prevChunkBytes + uploaded;
|
|
@@ -28710,143 +28867,164 @@ const ndm_proxy = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
28710
28867
|
unpinOwner
|
|
28711
28868
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
28712
28869
|
export {
|
|
28713
|
-
|
|
28714
|
-
|
|
28870
|
+
CONTACT_TAG_HOMESTATION_FOLLOWING as $,
|
|
28871
|
+
NOTIFY_ACTION_DISMISS as A,
|
|
28715
28872
|
BS_SERVICE_VERIFY_HUB as B,
|
|
28716
|
-
|
|
28717
|
-
|
|
28718
|
-
|
|
28719
|
-
|
|
28720
|
-
|
|
28721
|
-
|
|
28722
|
-
|
|
28723
|
-
|
|
28724
|
-
|
|
28725
|
-
|
|
28873
|
+
NOTIFY_LINK_PATH as C,
|
|
28874
|
+
isNotifyClosed as D,
|
|
28875
|
+
EXTERNAL_PRINCIPAL_CLAIM as E,
|
|
28876
|
+
notifyCategorySessionId as F,
|
|
28877
|
+
notifyCategoryFromSessionId as G,
|
|
28878
|
+
inputPrompt as H,
|
|
28879
|
+
promptOptions as I,
|
|
28880
|
+
notifyAnswerToTaskResult as J,
|
|
28881
|
+
validateNotifyAnswer as K,
|
|
28882
|
+
notifyUrl as L,
|
|
28726
28883
|
MsgQueueClient as M,
|
|
28727
28884
|
NOTIFY_INTENT as N,
|
|
28728
|
-
|
|
28729
|
-
|
|
28730
|
-
|
|
28885
|
+
msgMachineData as O,
|
|
28886
|
+
notifyMessageData as P,
|
|
28887
|
+
commitNotifyAnswer as Q,
|
|
28731
28888
|
RuntimeType as R,
|
|
28732
28889
|
SystemConfigClient as S,
|
|
28733
|
-
|
|
28734
|
-
|
|
28890
|
+
answerNotify as T,
|
|
28891
|
+
waitNotify as U,
|
|
28735
28892
|
VerifyHubClient as V,
|
|
28736
28893
|
WEB3_BRIDGE_HOST as W,
|
|
28737
|
-
|
|
28738
|
-
|
|
28739
|
-
|
|
28740
|
-
|
|
28894
|
+
FRIEND_INTENT as X,
|
|
28895
|
+
CONTACT_TAG_ZONE_USER as Y,
|
|
28896
|
+
ZONE_USER_TYPES as Z,
|
|
28897
|
+
CONTACT_TAG_ZONE_AGENT as _,
|
|
28741
28898
|
ndm_proxy as a,
|
|
28742
|
-
|
|
28743
|
-
|
|
28744
|
-
|
|
28745
|
-
|
|
28746
|
-
|
|
28747
|
-
|
|
28748
|
-
|
|
28749
|
-
|
|
28750
|
-
|
|
28751
|
-
|
|
28752
|
-
|
|
28753
|
-
|
|
28754
|
-
|
|
28755
|
-
|
|
28756
|
-
|
|
28757
|
-
|
|
28758
|
-
|
|
28759
|
-
|
|
28760
|
-
|
|
28761
|
-
|
|
28762
|
-
|
|
28763
|
-
|
|
28764
|
-
|
|
28765
|
-
|
|
28766
|
-
|
|
28767
|
-
|
|
28768
|
-
|
|
28769
|
-
|
|
28770
|
-
|
|
28771
|
-
|
|
28772
|
-
|
|
28773
|
-
|
|
28774
|
-
|
|
28775
|
-
|
|
28776
|
-
|
|
28777
|
-
|
|
28778
|
-
|
|
28779
|
-
|
|
28780
|
-
|
|
28781
|
-
|
|
28782
|
-
|
|
28783
|
-
|
|
28784
|
-
|
|
28785
|
-
|
|
28786
|
-
|
|
28787
|
-
|
|
28788
|
-
|
|
28789
|
-
|
|
28790
|
-
|
|
28791
|
-
|
|
28792
|
-
|
|
28793
|
-
|
|
28794
|
-
|
|
28795
|
-
|
|
28796
|
-
|
|
28797
|
-
|
|
28798
|
-
|
|
28799
|
-
|
|
28800
|
-
|
|
28801
|
-
|
|
28802
|
-
|
|
28803
|
-
|
|
28804
|
-
|
|
28805
|
-
|
|
28899
|
+
TaskExecutorKind as a$,
|
|
28900
|
+
CONTACT_CHANGED_EVENT_BOX as a0,
|
|
28901
|
+
WELL_KNOWN_CONTACT_TAGS as a1,
|
|
28902
|
+
USER_TYPE_GROUP_REF_PREFIX as a2,
|
|
28903
|
+
USER_GROUP_REF_PREFIX as a3,
|
|
28904
|
+
contactTagApp as a4,
|
|
28905
|
+
contactTagKind as a5,
|
|
28906
|
+
isUserGroupRefTag as a6,
|
|
28907
|
+
DENY_REASONS as a7,
|
|
28908
|
+
ACCESS_DENIED_ERROR_CODE as a8,
|
|
28909
|
+
parseAccessDenial as a9,
|
|
28910
|
+
AGENT_DELEGATE_TASK_SCHEMA_ID as aA,
|
|
28911
|
+
HUMAN_INPUT_TASK_SCHEMA_ID as aB,
|
|
28912
|
+
OPENDAN_ASYNC_TOOL_TASK_SCHEMA_ID as aC,
|
|
28913
|
+
OPENDAN_COMMAND_TASK_SCHEMA_ID as aD,
|
|
28914
|
+
TOOL_EXEC_BASH_TASK_SCHEMA_ID as aE,
|
|
28915
|
+
AICC_COMPUTE_TASK_SCHEMA_ID as aF,
|
|
28916
|
+
APP_INSTALL_TASK_SCHEMA_ID as aG,
|
|
28917
|
+
APP_UNINSTALL_TASK_SCHEMA_ID as aH,
|
|
28918
|
+
APP_START_TASK_SCHEMA_ID as aI,
|
|
28919
|
+
APP_UPDATE_TASK_SCHEMA_ID as aJ,
|
|
28920
|
+
APP_UPDATE_BATCH_TASK_SCHEMA_ID as aK,
|
|
28921
|
+
TASK_ERR_NOT_FOUND as aL,
|
|
28922
|
+
TASK_ERR_PERMISSION_DENIED as aM,
|
|
28923
|
+
TASK_ERR_REVISION_CONFLICT as aN,
|
|
28924
|
+
TASK_ERR_STALE_RUNNER_EPOCH as aO,
|
|
28925
|
+
TASK_ERR_INVALID_PHASE as aP,
|
|
28926
|
+
TASK_ERR_CONTROL_NOT_AVAILABLE as aQ,
|
|
28927
|
+
TASK_ERR_CONTROL_ALREADY_PENDING as aR,
|
|
28928
|
+
TASK_ERR_ALREADY_COMPLETED as aS,
|
|
28929
|
+
TASK_ERR_INPUT_SCHEMA_MISMATCH as aT,
|
|
28930
|
+
TASK_ERR_RESULT_SCHEMA_MISMATCH as aU,
|
|
28931
|
+
TASK_ERR_IDEMPOTENCY_CONFLICT as aV,
|
|
28932
|
+
TASK_ERR_SCHEMA_NOT_FOUND as aW,
|
|
28933
|
+
TASK_MGR_ERROR_CODES as aX,
|
|
28934
|
+
taskMgrTaskEventPath as aY,
|
|
28935
|
+
taskMgrTreeEventPath as aZ,
|
|
28936
|
+
taskMgrErrorCode as a_,
|
|
28937
|
+
accessDenialOf as aa,
|
|
28938
|
+
ANONYMOUS_IDENTITY as ab,
|
|
28939
|
+
parseCurrentIdentity as ac,
|
|
28940
|
+
identityKey as ad,
|
|
28941
|
+
identityAllows as ae,
|
|
28942
|
+
DEFAULT_JUMP_BASE_URL as af,
|
|
28943
|
+
JUMP_ACTION_PATHS as ag,
|
|
28944
|
+
normalizeZoneHostname as ah,
|
|
28945
|
+
zoneActionUrl as ai,
|
|
28946
|
+
buildJumpUrl as aj,
|
|
28947
|
+
TASK_MANAGER_SERVICE_UNIQUE_ID as ak,
|
|
28948
|
+
TASK_MANAGER_SERVICE_NAME as al,
|
|
28949
|
+
TASK_MANAGER_SERVICE_PORT as am,
|
|
28950
|
+
TASK_POLICY_PRESET_COLLABORATIVE_TREE_V1 as an,
|
|
28951
|
+
RAW_TASK_SCHEMA_ID as ao,
|
|
28952
|
+
HUMAN_APPROVAL_SCHEMA_ID as ap,
|
|
28953
|
+
DOWNLOAD_TASK_SCHEMA_ID as aq,
|
|
28954
|
+
SCHEDULER_DISPATCH_THUNK_TASK_SCHEMA_ID as ar,
|
|
28955
|
+
WORKFLOW_RUN_TREE_TASK_SCHEMA_ID as as,
|
|
28956
|
+
WORKFLOW_STEP_TASK_SCHEMA_ID as at,
|
|
28957
|
+
WORKFLOW_MAP_SHARD_TASK_SCHEMA_ID as au,
|
|
28958
|
+
WORKFLOW_THUNK_TASK_SCHEMA_ID as av,
|
|
28959
|
+
WORKFLOW_SCHEDULE_TASK_SCHEMA_ID as aw,
|
|
28960
|
+
WORKFLOW_SEND_MESSAGE_TASK_SCHEMA_ID as ax,
|
|
28961
|
+
WORKFLOW_EXECUTE_RPC_TASK_SCHEMA_ID as ay,
|
|
28962
|
+
WORKFLOW_RUN_TARGET_TASK_SCHEMA_ID as az,
|
|
28806
28963
|
bns_client as b,
|
|
28807
|
-
|
|
28808
|
-
|
|
28809
|
-
|
|
28810
|
-
|
|
28811
|
-
|
|
28812
|
-
|
|
28813
|
-
|
|
28814
|
-
|
|
28815
|
-
|
|
28816
|
-
|
|
28817
|
-
|
|
28818
|
-
|
|
28819
|
-
|
|
28820
|
-
|
|
28821
|
-
|
|
28822
|
-
|
|
28823
|
-
|
|
28824
|
-
|
|
28825
|
-
|
|
28826
|
-
|
|
28827
|
-
|
|
28828
|
-
|
|
28829
|
-
|
|
28830
|
-
|
|
28831
|
-
|
|
28832
|
-
|
|
28833
|
-
|
|
28834
|
-
|
|
28835
|
-
|
|
28836
|
-
|
|
28837
|
-
|
|
28838
|
-
|
|
28839
|
-
|
|
28840
|
-
|
|
28841
|
-
|
|
28842
|
-
|
|
28843
|
-
|
|
28844
|
-
|
|
28845
|
-
|
|
28846
|
-
|
|
28847
|
-
|
|
28848
|
-
|
|
28849
|
-
|
|
28964
|
+
BnsTxExecutor as b$,
|
|
28965
|
+
TaskPhase as b0,
|
|
28966
|
+
isTerminalTaskPhase as b1,
|
|
28967
|
+
TaskWaitReasonKind as b2,
|
|
28968
|
+
TaskOutcome as b3,
|
|
28969
|
+
TaskControlAction as b4,
|
|
28970
|
+
baselineTaskControlProfile as b5,
|
|
28971
|
+
DEFAULT_CHILD_CONTROL_POLICY as b6,
|
|
28972
|
+
TaskAction as b7,
|
|
28973
|
+
TaskGrantScope as b8,
|
|
28974
|
+
TaskDataScope as b9,
|
|
28975
|
+
aiccTextMessage as bA,
|
|
28976
|
+
aiccMessageTextContent as bB,
|
|
28977
|
+
aiccMessageFirstText as bC,
|
|
28978
|
+
validateAiccMessage as bD,
|
|
28979
|
+
AiccClient as bE,
|
|
28980
|
+
decisionRequirements as bF,
|
|
28981
|
+
validateDecisionRequest as bG,
|
|
28982
|
+
validateDecisionAnswers as bH,
|
|
28983
|
+
KEventReader as bI,
|
|
28984
|
+
KEventClient as bJ,
|
|
28985
|
+
appIdFromDid as bK,
|
|
28986
|
+
parseAppId as bL,
|
|
28987
|
+
appDidFromId as bM,
|
|
28988
|
+
createAppInstanceId as bN,
|
|
28989
|
+
parseAppInstanceId as bO,
|
|
28990
|
+
BNS_EVM_DEFAULT_GAS_LIMIT as bP,
|
|
28991
|
+
BNS_EVM_DEFAULT_MAX_FEE_PER_GAS as bQ,
|
|
28992
|
+
BNS_EVM_DEFAULT_MAX_PRIORITY_FEE_PER_GAS as bR,
|
|
28993
|
+
BNS_MAX_INLINE_DOCUMENT_BYTES as bS,
|
|
28994
|
+
BNS_DNS_TXT_DEFAULT_TTL as bT,
|
|
28995
|
+
BNS_DNS_TXT_DOC_TYPE as bU,
|
|
28996
|
+
BNS_PUBLISH_DOCUMENT_ABI as bV,
|
|
28997
|
+
BnsEvmTxError as bW,
|
|
28998
|
+
BnsEvmTxBuilder as bX,
|
|
28999
|
+
decodeBnsPublishDocumentCalldata as bY,
|
|
29000
|
+
BnsTxExecutorError as bZ,
|
|
29001
|
+
walletUserHasSnAccount as b_,
|
|
29002
|
+
StorageDomain as ba,
|
|
29003
|
+
TaskEventType as bb,
|
|
29004
|
+
TaskManagerClient as bc,
|
|
29005
|
+
WORKFLOW_SERVICE_NAME as bd,
|
|
29006
|
+
WorkflowStepType as be,
|
|
29007
|
+
WorkflowOutputMode as bf,
|
|
29008
|
+
WorkflowJoinMode as bg,
|
|
29009
|
+
WorkflowRetryFallback as bh,
|
|
29010
|
+
WorkflowDefinitionStatus as bi,
|
|
29011
|
+
WorkflowRunStatus as bj,
|
|
29012
|
+
WorkflowNodeRunState as bk,
|
|
29013
|
+
WorkflowHumanActionKind as bl,
|
|
29014
|
+
WorkflowScheduledTaskStatus as bm,
|
|
29015
|
+
WorkflowScheduledTaskMisfirePolicy as bn,
|
|
29016
|
+
WorkflowScheduledTaskFireStatus as bo,
|
|
29017
|
+
WorkflowClient as bp,
|
|
29018
|
+
AICC_SERVICE_UNIQUE_ID as bq,
|
|
29019
|
+
AICC_SERVICE_SERVICE_NAME as br,
|
|
29020
|
+
AICC_SERVICE_SERVICE_PORT as bs,
|
|
29021
|
+
AICC_AI_METHODS as bt,
|
|
29022
|
+
AICC_CORE_METHODS as bu,
|
|
29023
|
+
AICC_MANAGEMENT_METHODS as bv,
|
|
29024
|
+
AICC_METHODS as bw,
|
|
29025
|
+
AICC_FEATURES as bx,
|
|
29026
|
+
AICC_EXECUTION_MODES as by,
|
|
29027
|
+
isAiccAiMethod as bz,
|
|
28850
29028
|
createSDKModule as c,
|
|
28851
29029
|
BS_SERVICE_TASK_MANAGER as d,
|
|
28852
29030
|
getActiveRuntimeType as e,
|
|
@@ -28855,21 +29033,21 @@ export {
|
|
|
28855
29033
|
getActiveSessionToken as h,
|
|
28856
29034
|
BuckyOSSDK as i,
|
|
28857
29035
|
RepoClient as j,
|
|
28858
|
-
|
|
28859
|
-
|
|
28860
|
-
|
|
29036
|
+
parseZoneUserType as k,
|
|
29037
|
+
isExternalPrincipal as l,
|
|
29038
|
+
RPCError as m,
|
|
28861
29039
|
ndm_client as n,
|
|
28862
|
-
|
|
29040
|
+
MsgCenterClient as o,
|
|
28863
29041
|
parseSessionTokenClaims as p,
|
|
28864
|
-
|
|
29042
|
+
mailboxAddress as q,
|
|
28865
29043
|
resolveDidFromHost as r,
|
|
28866
29044
|
sn_client as s,
|
|
28867
|
-
|
|
28868
|
-
|
|
28869
|
-
|
|
28870
|
-
|
|
28871
|
-
|
|
28872
|
-
|
|
28873
|
-
|
|
29045
|
+
mailboxResource as t,
|
|
29046
|
+
NOTIFY_DELIVERED_INTENT as u,
|
|
29047
|
+
NOTIFY_DATA_VERSION as v,
|
|
29048
|
+
NOTIFY_SESSION_PREFIX as w,
|
|
29049
|
+
NOTIFY_CHOICE_CONTROL_ID as x,
|
|
29050
|
+
NOTIFY_TEXT_CONTROL_ID as y,
|
|
29051
|
+
NOTIFY_ACTION_ANSWER as z
|
|
28874
29052
|
};
|
|
28875
|
-
//# sourceMappingURL=ndm_proxy-
|
|
29053
|
+
//# sourceMappingURL=ndm_proxy-92a2d7c7.mjs.map
|