buckyos 0.7.133 → 0.7.136

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 (58) hide show
  1. package/cli/dist/cli.mjs +1 -1
  2. package/cli/dist/cli.mjs.map +1 -1
  3. package/cli/version.ts +1 -1
  4. package/dist/account.d.ts +11 -0
  5. package/dist/account.d.ts.map +1 -1
  6. package/dist/browser.cjs +1 -1
  7. package/dist/browser.cjs.map +1 -1
  8. package/dist/browser.d.ts +2 -0
  9. package/dist/browser.d.ts.map +1 -1
  10. package/dist/browser.mjs +166 -143
  11. package/dist/browser.mjs.map +1 -1
  12. package/dist/hybrid_sso.d.ts +110 -0
  13. package/dist/hybrid_sso.d.ts.map +1 -0
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.ts +2 -0
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.mjs +166 -143
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/krpc_client.d.ts +7 -1
  21. package/dist/krpc_client.d.ts.map +1 -1
  22. package/dist/msg_center_client.d.ts +13 -1
  23. package/dist/msg_center_client.d.ts.map +1 -1
  24. package/dist/ndm_client.d.ts +6 -0
  25. package/dist/ndm_client.d.ts.map +1 -1
  26. package/dist/ndm_proxy-7cf15839.js +13 -0
  27. package/dist/ndm_proxy-7cf15839.js.map +1 -0
  28. package/dist/{ndm_proxy-501cb1e8.mjs → ndm_proxy-b5c95488.mjs} +360 -170
  29. package/dist/ndm_proxy-b5c95488.mjs.map +1 -0
  30. package/dist/ndn_types-324121ae.js +2 -0
  31. package/dist/ndn_types-324121ae.js.map +1 -0
  32. package/dist/{ndn_types-d768245f.mjs → ndn_types-ac9c1e48.mjs} +64 -38
  33. package/dist/ndn_types-ac9c1e48.mjs.map +1 -0
  34. package/dist/node.cjs +1 -1
  35. package/dist/node.cjs.map +1 -1
  36. package/dist/node.d.ts +2 -0
  37. package/dist/node.d.ts.map +1 -1
  38. package/dist/node.mjs +166 -143
  39. package/dist/node.mjs.map +1 -1
  40. package/dist/provision.cjs +1 -1
  41. package/dist/provision.mjs +1 -1
  42. package/dist/runtime.d.ts +30 -1
  43. package/dist/runtime.d.ts.map +1 -1
  44. package/dist/sdk_core.d.ts +14 -1
  45. package/dist/sdk_core.d.ts.map +1 -1
  46. package/dist/{tus_client-b1c35e8c.mjs → tus_client-19baa342.mjs} +2 -2
  47. package/dist/{tus_client-b1c35e8c.mjs.map → tus_client-19baa342.mjs.map} +1 -1
  48. package/dist/{tus_client-d0798623.js → tus_client-2b915a81.js} +2 -2
  49. package/dist/{tus_client-d0798623.js.map → tus_client-2b915a81.js.map} +1 -1
  50. package/dist/verify-hub-client.d.ts +1 -0
  51. package/dist/verify-hub-client.d.ts.map +1 -1
  52. package/package.json +1 -1
  53. package/dist/ndm_proxy-501cb1e8.mjs.map +0 -1
  54. package/dist/ndm_proxy-68b8160c.js +0 -13
  55. package/dist/ndm_proxy-68b8160c.js.map +0 -1
  56. package/dist/ndn_types-44c69036.js +0 -2
  57. package/dist/ndn_types-44c69036.js.map +0 -1
  58. 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 getBrowserUserInfo, x as saveBrowserUserInfo, q as parseBuckyOSOwnerDocument, h as hashPassword, y as saveLocalAccountInfo, z as cleanLocalAccountInfo, A as canonicalize, B as signJwtEdDSA, O as ObjId, C as ChunkId, F as FileObject, E as sha256Bytes, G as DirObject, S as SimpleChunkList } from "./ndn_types-d768245f.mjs";
38
+ import { v as DID, w as getBrowserIdentityRaw, x as clearBrowserUserInfo, y as saveBrowserIdentity, z as saveBrowserUserInfo, A as getBrowserUserInfo, B as clearBrowserIdentity, q as parseBuckyOSOwnerDocument, h as hashPassword, C as saveLocalAccountInfo, E as cleanLocalAccountInfo, F as canonicalize, G as signJwtEdDSA, O as ObjId, H as ChunkId, I as FileObject, J as sha256Bytes, K as DirObject, S as SimpleChunkList } from "./ndn_types-ac9c1e48.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(`RPC call error: ${rpcResponse.error}`);
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,43 @@ class BuckyOSRuntime {
3256
3380
  }
3257
3381
  return this.refreshBrowserSessionToken();
3258
3382
  }
3259
- normalizeBrowserUserInfo(raw) {
3260
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
3261
- return null;
3383
+ storeBrowserIdentity(identity) {
3384
+ if (!hasBrowserStorage()) {
3385
+ return;
3262
3386
  }
3263
- const parsed = raw;
3264
- const userId = typeof parsed.user_id === "string" ? parsed.user_id.trim() : "";
3265
- const userType = typeof parsed.user_type === "string" ? parsed.user_type.trim() : "";
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();
3390
+ }
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();
3269
3400
  }
3270
- return {
3271
- user_name: userName || userId,
3272
- user_id: userId,
3273
- user_type: userType
3274
- };
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
+ var _a2;
3409
+ const sessionToken = await this.ensureSessionTokenReady();
3410
+ if (!sessionToken || !hasBrowserStorage()) {
3411
+ return ANONYMOUS_IDENTITY;
3412
+ }
3413
+ const identity = parseCurrentIdentity(getBrowserIdentityRaw());
3414
+ const subject = (_a2 = parseSessionTokenClaims(sessionToken)) == null ? void 0 : _a2.sub;
3415
+ const identitySubject = (identity == null ? void 0 : identity.kind) === "account" ? identity.user_id : (identity == null ? void 0 : identity.kind) === "external" ? identity.did : null;
3416
+ if (!identity || !subject || identitySubject !== subject) {
3417
+ return ANONYMOUS_IDENTITY;
3418
+ }
3419
+ return identity;
3275
3420
  }
3276
3421
  async refreshBrowserSession() {
3277
3422
  const sessionToken = await this.refreshBrowserSessionToken();
@@ -3320,7 +3465,6 @@ class BuckyOSRuntime {
3320
3465
  if (!hasFetchRuntime()) {
3321
3466
  return this.sessionToken;
3322
3467
  }
3323
- const cachedUserInfo = hasBrowserStorage() ? getBrowserUserInfo() : null;
3324
3468
  try {
3325
3469
  const response = await fetch("/sso_refresh", {
3326
3470
  method: "POST",
@@ -3330,15 +3474,19 @@ class BuckyOSRuntime {
3330
3474
  if (!response.ok) {
3331
3475
  if (authStateRevision === this.authStateRevision) {
3332
3476
  this.sessionToken = null;
3477
+ if (response.status === 401 && hasBrowserStorage()) {
3478
+ clearBrowserIdentity();
3479
+ clearBrowserUserInfo();
3480
+ }
3333
3481
  }
3334
3482
  return null;
3335
3483
  }
3336
3484
  const payload = await response.json();
3337
3485
  const sessionToken = trimToNull$2(
3338
- typeof payload.access_token === "string" ? payload.access_token : typeof payload.session_token === "string" ? payload.session_token : null
3486
+ typeof payload.session_token === "string" ? payload.session_token : null
3339
3487
  );
3340
- const userInfo = this.normalizeBrowserUserInfo(payload.user_info) ?? cachedUserInfo;
3341
- if (!sessionToken || !userInfo) {
3488
+ const identity = parseCurrentIdentity(payload.identity);
3489
+ if (!sessionToken || !identity || identity.kind === "anonymous") {
3342
3490
  if (authStateRevision === this.authStateRevision) {
3343
3491
  this.sessionToken = null;
3344
3492
  }
@@ -3349,7 +3497,7 @@ class BuckyOSRuntime {
3349
3497
  }
3350
3498
  this.sessionToken = sessionToken;
3351
3499
  this.refreshToken = null;
3352
- saveBrowserUserInfo(userInfo);
3500
+ this.storeBrowserIdentity(identity);
3353
3501
  this.validateSessionToken();
3354
3502
  return this.sessionToken;
3355
3503
  } catch (error) {
@@ -4713,6 +4861,22 @@ class BuckyOSSDK {
4713
4861
  async subscribeKEvent(patterns, callback, options = {}) {
4714
4862
  return this.getKEventClient().subscribe(patterns, callback, options);
4715
4863
  }
4864
+ /**
4865
+ * Whom the current session speaks for: an account of this Zone, an External
4866
+ * DID (no account here) or an anonymous visitor. `getAccountInfo` stays
4867
+ * account-only and returns `null` for External sessions.
4868
+ */
4869
+ async getCurrentIdentity() {
4870
+ if (this.currentRuntime == null) {
4871
+ console.error("BuckyOS WebSDK is not initialized,call initBuckyOS first");
4872
+ return ANONYMOUS_IDENTITY;
4873
+ }
4874
+ const runtimeType = this.currentRuntime.getConfig().runtimeType;
4875
+ if (runtimeType !== RuntimeType.Browser && runtimeType !== RuntimeType.AppRuntime) {
4876
+ return ANONYMOUS_IDENTITY;
4877
+ }
4878
+ return this.currentRuntime.getCurrentIdentity();
4879
+ }
4716
4880
  async getAccountInfo() {
4717
4881
  if (this.currentRuntime == null) {
4718
4882
  console.error("BuckyOS WebSDK is not initialized,call initBuckyOS first");
@@ -4778,6 +4942,7 @@ class BuckyOSSDK {
4778
4942
  };
4779
4943
  if (isBrowserStorageAvailable()) {
4780
4944
  saveLocalAccountInfo(appId, accountInfo);
4945
+ clearBrowserIdentity();
4781
4946
  saveBrowserUserInfo({
4782
4947
  user_name: accountInfo.user_name,
4783
4948
  user_id: accountInfo.user_id,
@@ -5151,6 +5316,7 @@ function createSDKModule(target) {
5151
5316
  getAppSetting: sdk.getAppSetting.bind(sdk),
5152
5317
  setAppSetting: sdk.setAppSetting.bind(sdk),
5153
5318
  getCurrentWalletUser: sdk.getCurrentWalletUser.bind(sdk),
5319
+ getCurrentIdentity: sdk.getCurrentIdentity.bind(sdk),
5154
5320
  resolve_did: sdk.resolve_did.bind(sdk),
5155
5321
  walletSignWithActiveDid: sdk.walletSignWithActiveDid.bind(sdk),
5156
5322
  openExternalUrl: sdk.openExternalUrl.bind(sdk),
@@ -27983,13 +28149,13 @@ async function getUploadProgress(sessionId) {
27983
28149
  }
27984
28150
  return result;
27985
28151
  }
27986
- async function uploadChunkViaTus(endpoint, file, chunkInfo, chunkIndex, appId, fileHash, onProgress, signal) {
28152
+ async function uploadChunkViaTus(endpoint, file, chunkInfo, chunkIndex, appId, fileHash, sessionToken, onProgress, signal) {
27987
28153
  const slice = file.slice(chunkInfo.offset, chunkInfo.offset + chunkInfo.length);
27988
28154
  const chunkData = new Uint8Array(await slice.arrayBuffer());
27989
28155
  const logicalPath = `${appId}/${chunkInfo.chunkId}`;
27990
28156
  let tusModule;
27991
28157
  try {
27992
- tusModule = await import("./tus_client-b1c35e8c.mjs");
28158
+ tusModule = await import("./tus_client-19baa342.mjs");
27993
28159
  } catch (error) {
27994
28160
  const message = error instanceof Error ? error.message : String(error);
27995
28161
  throw new NdmError("UPLOAD_FAILED", `Failed to load tus-js-client: ${message}`);
@@ -28002,6 +28168,7 @@ async function uploadChunkViaTus(endpoint, file, chunkInfo, chunkIndex, appId, f
28002
28168
  const blob = new Blob([chunkData]);
28003
28169
  const upload = new tusModule.Upload(blob, {
28004
28170
  endpoint: `${endpoint}/ndm/v1/uploads`,
28171
+ headers: sessionToken ? { Authorization: `Bearer ${sessionToken}` } : {},
28005
28172
  chunkSize: chunkData.length,
28006
28173
  retryDelays: [0, 1e3, 3e3, 5e3],
28007
28174
  storeFingerprintForResuming: false,
@@ -28060,11 +28227,12 @@ async function startUpload(sessionId, options) {
28060
28227
  } else {
28061
28228
  endpoint = typeof window !== "undefined" ? window.location.origin : "";
28062
28229
  }
28063
- doUpload(session, endpoint, concurrency).catch(() => {
28230
+ const sessionToken = (options == null ? void 0 : options.sessionToken) !== void 0 ? async () => options.sessionToken ?? null : async () => getActiveSessionToken().catch(() => null);
28231
+ doUpload(session, endpoint, concurrency, sessionToken).catch(() => {
28064
28232
  });
28065
28233
  return getImportSessionStatus(sessionId);
28066
28234
  }
28067
- async function doUpload(session, endpoint, concurrency) {
28235
+ async function doUpload(session, endpoint, concurrency, sessionToken) {
28068
28236
  const states = Array.from(session.objectStates.values()).filter((s) => s.state !== "completed");
28069
28237
  let running = 0;
28070
28238
  let idx = 0;
@@ -28082,7 +28250,7 @@ async function doUpload(session, endpoint, concurrency) {
28082
28250
  while (running < concurrency && idx < states.length) {
28083
28251
  const state = states[idx++];
28084
28252
  running++;
28085
- uploadSingleObject(session, endpoint, state).then(() => {
28253
+ uploadSingleObject(session, endpoint, state, sessionToken).then(() => {
28086
28254
  running--;
28087
28255
  next();
28088
28256
  }).catch(() => {
@@ -28098,7 +28266,7 @@ async function doUpload(session, endpoint, concurrency) {
28098
28266
  next();
28099
28267
  });
28100
28268
  }
28101
- async function uploadSingleObject(session, endpoint, state) {
28269
+ async function uploadSingleObject(session, endpoint, state, sessionToken) {
28102
28270
  var _a2;
28103
28271
  state.state = "uploading";
28104
28272
  for (const [chunkIndex, chunk] of state.chunks.entries()) {
@@ -28111,6 +28279,7 @@ async function uploadSingleObject(session, endpoint, state) {
28111
28279
  chunkIndex,
28112
28280
  "default",
28113
28281
  state.objectId,
28282
+ await sessionToken(),
28114
28283
  (uploaded) => {
28115
28284
  const prevChunkBytes = state.chunks.filter((c) => c !== chunk && c.uploaded).reduce((sum, c) => sum + c.length, 0);
28116
28285
  state.uploadedBytes = prevChunkBytes + uploaded;
@@ -28710,143 +28879,164 @@ const ndm_proxy = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
28710
28879
  unpinOwner
28711
28880
  }, Symbol.toStringTag, { value: "Module" }));
28712
28881
  export {
28713
- TASK_MANAGER_SERVICE_UNIQUE_ID as $,
28714
- notifyCategorySessionId as A,
28882
+ CONTACT_TAG_HOMESTATION_FOLLOWING as $,
28883
+ NOTIFY_ACTION_DISMISS as A,
28715
28884
  BS_SERVICE_VERIFY_HUB as B,
28716
- notifyCategoryFromSessionId as C,
28717
- inputPrompt as D,
28718
- promptOptions as E,
28719
- notifyAnswerToTaskResult as F,
28720
- validateNotifyAnswer as G,
28721
- notifyUrl as H,
28722
- msgMachineData as I,
28723
- notifyMessageData as J,
28724
- commitNotifyAnswer as K,
28725
- answerNotify as L,
28885
+ NOTIFY_LINK_PATH as C,
28886
+ isNotifyClosed as D,
28887
+ EXTERNAL_PRINCIPAL_CLAIM as E,
28888
+ notifyCategorySessionId as F,
28889
+ notifyCategoryFromSessionId as G,
28890
+ inputPrompt as H,
28891
+ promptOptions as I,
28892
+ notifyAnswerToTaskResult as J,
28893
+ validateNotifyAnswer as K,
28894
+ notifyUrl as L,
28726
28895
  MsgQueueClient as M,
28727
28896
  NOTIFY_INTENT as N,
28728
- waitNotify as O,
28729
- FRIEND_INTENT as P,
28730
- CONTACT_TAG_ZONE_USER as Q,
28897
+ msgMachineData as O,
28898
+ notifyMessageData as P,
28899
+ commitNotifyAnswer as Q,
28731
28900
  RuntimeType as R,
28732
28901
  SystemConfigClient as S,
28733
- CONTACT_TAG_ZONE_AGENT as T,
28734
- CONTACT_TAG_HOMESTATION_FOLLOWING as U,
28902
+ answerNotify as T,
28903
+ waitNotify as U,
28735
28904
  VerifyHubClient as V,
28736
28905
  WEB3_BRIDGE_HOST as W,
28737
- CONTACT_CHANGED_EVENT_BOX as X,
28738
- WELL_KNOWN_CONTACT_TAGS as Y,
28739
- contactTagApp as Z,
28740
- contactTagKind as _,
28906
+ FRIEND_INTENT as X,
28907
+ CONTACT_TAG_ZONE_USER as Y,
28908
+ ZONE_USER_TYPES as Z,
28909
+ CONTACT_TAG_ZONE_AGENT as _,
28741
28910
  ndm_proxy as a,
28742
- WorkflowNodeRunState as a$,
28743
- TASK_MANAGER_SERVICE_NAME as a0,
28744
- TASK_MANAGER_SERVICE_PORT as a1,
28745
- TASK_POLICY_PRESET_COLLABORATIVE_TREE_V1 as a2,
28746
- RAW_TASK_SCHEMA_ID as a3,
28747
- HUMAN_APPROVAL_SCHEMA_ID as a4,
28748
- DOWNLOAD_TASK_SCHEMA_ID as a5,
28749
- SCHEDULER_DISPATCH_THUNK_TASK_SCHEMA_ID as a6,
28750
- WORKFLOW_RUN_TREE_TASK_SCHEMA_ID as a7,
28751
- WORKFLOW_STEP_TASK_SCHEMA_ID as a8,
28752
- WORKFLOW_MAP_SHARD_TASK_SCHEMA_ID as a9,
28753
- TASK_ERR_IDEMPOTENCY_CONFLICT as aA,
28754
- TASK_ERR_SCHEMA_NOT_FOUND as aB,
28755
- TASK_MGR_ERROR_CODES as aC,
28756
- taskMgrTaskEventPath as aD,
28757
- taskMgrTreeEventPath as aE,
28758
- taskMgrErrorCode as aF,
28759
- TaskExecutorKind as aG,
28760
- TaskPhase as aH,
28761
- isTerminalTaskPhase as aI,
28762
- TaskWaitReasonKind as aJ,
28763
- TaskOutcome as aK,
28764
- TaskControlAction as aL,
28765
- baselineTaskControlProfile as aM,
28766
- DEFAULT_CHILD_CONTROL_POLICY as aN,
28767
- TaskAction as aO,
28768
- TaskGrantScope as aP,
28769
- TaskDataScope as aQ,
28770
- StorageDomain as aR,
28771
- TaskEventType as aS,
28772
- TaskManagerClient as aT,
28773
- WORKFLOW_SERVICE_NAME as aU,
28774
- WorkflowStepType as aV,
28775
- WorkflowOutputMode as aW,
28776
- WorkflowJoinMode as aX,
28777
- WorkflowRetryFallback as aY,
28778
- WorkflowDefinitionStatus as aZ,
28779
- WorkflowRunStatus as a_,
28780
- WORKFLOW_THUNK_TASK_SCHEMA_ID as aa,
28781
- WORKFLOW_SCHEDULE_TASK_SCHEMA_ID as ab,
28782
- WORKFLOW_SEND_MESSAGE_TASK_SCHEMA_ID as ac,
28783
- WORKFLOW_EXECUTE_RPC_TASK_SCHEMA_ID as ad,
28784
- WORKFLOW_RUN_TARGET_TASK_SCHEMA_ID as ae,
28785
- AGENT_DELEGATE_TASK_SCHEMA_ID as af,
28786
- HUMAN_INPUT_TASK_SCHEMA_ID as ag,
28787
- OPENDAN_ASYNC_TOOL_TASK_SCHEMA_ID as ah,
28788
- OPENDAN_COMMAND_TASK_SCHEMA_ID as ai,
28789
- TOOL_EXEC_BASH_TASK_SCHEMA_ID as aj,
28790
- AICC_COMPUTE_TASK_SCHEMA_ID as ak,
28791
- APP_INSTALL_TASK_SCHEMA_ID as al,
28792
- APP_UNINSTALL_TASK_SCHEMA_ID as am,
28793
- APP_START_TASK_SCHEMA_ID as an,
28794
- APP_UPDATE_TASK_SCHEMA_ID as ao,
28795
- APP_UPDATE_BATCH_TASK_SCHEMA_ID as ap,
28796
- TASK_ERR_NOT_FOUND as aq,
28797
- TASK_ERR_PERMISSION_DENIED as ar,
28798
- TASK_ERR_REVISION_CONFLICT as as,
28799
- TASK_ERR_STALE_RUNNER_EPOCH as at,
28800
- TASK_ERR_INVALID_PHASE as au,
28801
- TASK_ERR_CONTROL_NOT_AVAILABLE as av,
28802
- TASK_ERR_CONTROL_ALREADY_PENDING as aw,
28803
- TASK_ERR_ALREADY_COMPLETED as ax,
28804
- TASK_ERR_INPUT_SCHEMA_MISMATCH as ay,
28805
- TASK_ERR_RESULT_SCHEMA_MISMATCH as az,
28911
+ TaskExecutorKind as a$,
28912
+ CONTACT_CHANGED_EVENT_BOX as a0,
28913
+ WELL_KNOWN_CONTACT_TAGS as a1,
28914
+ USER_TYPE_GROUP_REF_PREFIX as a2,
28915
+ USER_GROUP_REF_PREFIX as a3,
28916
+ contactTagApp as a4,
28917
+ contactTagKind as a5,
28918
+ isUserGroupRefTag as a6,
28919
+ DENY_REASONS as a7,
28920
+ ACCESS_DENIED_ERROR_CODE as a8,
28921
+ parseAccessDenial as a9,
28922
+ AGENT_DELEGATE_TASK_SCHEMA_ID as aA,
28923
+ HUMAN_INPUT_TASK_SCHEMA_ID as aB,
28924
+ OPENDAN_ASYNC_TOOL_TASK_SCHEMA_ID as aC,
28925
+ OPENDAN_COMMAND_TASK_SCHEMA_ID as aD,
28926
+ TOOL_EXEC_BASH_TASK_SCHEMA_ID as aE,
28927
+ AICC_COMPUTE_TASK_SCHEMA_ID as aF,
28928
+ APP_INSTALL_TASK_SCHEMA_ID as aG,
28929
+ APP_UNINSTALL_TASK_SCHEMA_ID as aH,
28930
+ APP_START_TASK_SCHEMA_ID as aI,
28931
+ APP_UPDATE_TASK_SCHEMA_ID as aJ,
28932
+ APP_UPDATE_BATCH_TASK_SCHEMA_ID as aK,
28933
+ TASK_ERR_NOT_FOUND as aL,
28934
+ TASK_ERR_PERMISSION_DENIED as aM,
28935
+ TASK_ERR_REVISION_CONFLICT as aN,
28936
+ TASK_ERR_STALE_RUNNER_EPOCH as aO,
28937
+ TASK_ERR_INVALID_PHASE as aP,
28938
+ TASK_ERR_CONTROL_NOT_AVAILABLE as aQ,
28939
+ TASK_ERR_CONTROL_ALREADY_PENDING as aR,
28940
+ TASK_ERR_ALREADY_COMPLETED as aS,
28941
+ TASK_ERR_INPUT_SCHEMA_MISMATCH as aT,
28942
+ TASK_ERR_RESULT_SCHEMA_MISMATCH as aU,
28943
+ TASK_ERR_IDEMPOTENCY_CONFLICT as aV,
28944
+ TASK_ERR_SCHEMA_NOT_FOUND as aW,
28945
+ TASK_MGR_ERROR_CODES as aX,
28946
+ taskMgrTaskEventPath as aY,
28947
+ taskMgrTreeEventPath as aZ,
28948
+ taskMgrErrorCode as a_,
28949
+ accessDenialOf as aa,
28950
+ ANONYMOUS_IDENTITY as ab,
28951
+ parseCurrentIdentity as ac,
28952
+ identityKey as ad,
28953
+ identityAllows as ae,
28954
+ DEFAULT_JUMP_BASE_URL as af,
28955
+ JUMP_ACTION_PATHS as ag,
28956
+ normalizeZoneHostname as ah,
28957
+ zoneActionUrl as ai,
28958
+ buildJumpUrl as aj,
28959
+ TASK_MANAGER_SERVICE_UNIQUE_ID as ak,
28960
+ TASK_MANAGER_SERVICE_NAME as al,
28961
+ TASK_MANAGER_SERVICE_PORT as am,
28962
+ TASK_POLICY_PRESET_COLLABORATIVE_TREE_V1 as an,
28963
+ RAW_TASK_SCHEMA_ID as ao,
28964
+ HUMAN_APPROVAL_SCHEMA_ID as ap,
28965
+ DOWNLOAD_TASK_SCHEMA_ID as aq,
28966
+ SCHEDULER_DISPATCH_THUNK_TASK_SCHEMA_ID as ar,
28967
+ WORKFLOW_RUN_TREE_TASK_SCHEMA_ID as as,
28968
+ WORKFLOW_STEP_TASK_SCHEMA_ID as at,
28969
+ WORKFLOW_MAP_SHARD_TASK_SCHEMA_ID as au,
28970
+ WORKFLOW_THUNK_TASK_SCHEMA_ID as av,
28971
+ WORKFLOW_SCHEDULE_TASK_SCHEMA_ID as aw,
28972
+ WORKFLOW_SEND_MESSAGE_TASK_SCHEMA_ID as ax,
28973
+ WORKFLOW_EXECUTE_RPC_TASK_SCHEMA_ID as ay,
28974
+ WORKFLOW_RUN_TARGET_TASK_SCHEMA_ID as az,
28806
28975
  bns_client as b,
28807
- WorkflowHumanActionKind as b0,
28808
- WorkflowScheduledTaskStatus as b1,
28809
- WorkflowScheduledTaskMisfirePolicy as b2,
28810
- WorkflowScheduledTaskFireStatus as b3,
28811
- WorkflowClient as b4,
28812
- AICC_SERVICE_UNIQUE_ID as b5,
28813
- AICC_SERVICE_SERVICE_NAME as b6,
28814
- AICC_SERVICE_SERVICE_PORT as b7,
28815
- AICC_AI_METHODS as b8,
28816
- AICC_CORE_METHODS as b9,
28817
- BNS_PUBLISH_DOCUMENT_ABI as bA,
28818
- BnsEvmTxError as bB,
28819
- BnsEvmTxBuilder as bC,
28820
- decodeBnsPublishDocumentCalldata as bD,
28821
- BnsTxExecutorError as bE,
28822
- walletUserHasSnAccount as bF,
28823
- BnsTxExecutor as bG,
28824
- AICC_MANAGEMENT_METHODS as ba,
28825
- AICC_METHODS as bb,
28826
- AICC_FEATURES as bc,
28827
- AICC_EXECUTION_MODES as bd,
28828
- isAiccAiMethod as be,
28829
- aiccTextMessage as bf,
28830
- aiccMessageTextContent as bg,
28831
- aiccMessageFirstText as bh,
28832
- validateAiccMessage as bi,
28833
- AiccClient as bj,
28834
- decisionRequirements as bk,
28835
- validateDecisionRequest as bl,
28836
- validateDecisionAnswers as bm,
28837
- KEventReader as bn,
28838
- KEventClient as bo,
28839
- appIdFromDid as bp,
28840
- parseAppId as bq,
28841
- appDidFromId as br,
28842
- createAppInstanceId as bs,
28843
- parseAppInstanceId as bt,
28844
- BNS_EVM_DEFAULT_GAS_LIMIT as bu,
28845
- BNS_EVM_DEFAULT_MAX_FEE_PER_GAS as bv,
28846
- BNS_EVM_DEFAULT_MAX_PRIORITY_FEE_PER_GAS as bw,
28847
- BNS_MAX_INLINE_DOCUMENT_BYTES as bx,
28848
- BNS_DNS_TXT_DEFAULT_TTL as by,
28849
- BNS_DNS_TXT_DOC_TYPE as bz,
28976
+ BnsTxExecutor as b$,
28977
+ TaskPhase as b0,
28978
+ isTerminalTaskPhase as b1,
28979
+ TaskWaitReasonKind as b2,
28980
+ TaskOutcome as b3,
28981
+ TaskControlAction as b4,
28982
+ baselineTaskControlProfile as b5,
28983
+ DEFAULT_CHILD_CONTROL_POLICY as b6,
28984
+ TaskAction as b7,
28985
+ TaskGrantScope as b8,
28986
+ TaskDataScope as b9,
28987
+ aiccTextMessage as bA,
28988
+ aiccMessageTextContent as bB,
28989
+ aiccMessageFirstText as bC,
28990
+ validateAiccMessage as bD,
28991
+ AiccClient as bE,
28992
+ decisionRequirements as bF,
28993
+ validateDecisionRequest as bG,
28994
+ validateDecisionAnswers as bH,
28995
+ KEventReader as bI,
28996
+ KEventClient as bJ,
28997
+ appIdFromDid as bK,
28998
+ parseAppId as bL,
28999
+ appDidFromId as bM,
29000
+ createAppInstanceId as bN,
29001
+ parseAppInstanceId as bO,
29002
+ BNS_EVM_DEFAULT_GAS_LIMIT as bP,
29003
+ BNS_EVM_DEFAULT_MAX_FEE_PER_GAS as bQ,
29004
+ BNS_EVM_DEFAULT_MAX_PRIORITY_FEE_PER_GAS as bR,
29005
+ BNS_MAX_INLINE_DOCUMENT_BYTES as bS,
29006
+ BNS_DNS_TXT_DEFAULT_TTL as bT,
29007
+ BNS_DNS_TXT_DOC_TYPE as bU,
29008
+ BNS_PUBLISH_DOCUMENT_ABI as bV,
29009
+ BnsEvmTxError as bW,
29010
+ BnsEvmTxBuilder as bX,
29011
+ decodeBnsPublishDocumentCalldata as bY,
29012
+ BnsTxExecutorError as bZ,
29013
+ walletUserHasSnAccount as b_,
29014
+ StorageDomain as ba,
29015
+ TaskEventType as bb,
29016
+ TaskManagerClient as bc,
29017
+ WORKFLOW_SERVICE_NAME as bd,
29018
+ WorkflowStepType as be,
29019
+ WorkflowOutputMode as bf,
29020
+ WorkflowJoinMode as bg,
29021
+ WorkflowRetryFallback as bh,
29022
+ WorkflowDefinitionStatus as bi,
29023
+ WorkflowRunStatus as bj,
29024
+ WorkflowNodeRunState as bk,
29025
+ WorkflowHumanActionKind as bl,
29026
+ WorkflowScheduledTaskStatus as bm,
29027
+ WorkflowScheduledTaskMisfirePolicy as bn,
29028
+ WorkflowScheduledTaskFireStatus as bo,
29029
+ WorkflowClient as bp,
29030
+ AICC_SERVICE_UNIQUE_ID as bq,
29031
+ AICC_SERVICE_SERVICE_NAME as br,
29032
+ AICC_SERVICE_SERVICE_PORT as bs,
29033
+ AICC_AI_METHODS as bt,
29034
+ AICC_CORE_METHODS as bu,
29035
+ AICC_MANAGEMENT_METHODS as bv,
29036
+ AICC_METHODS as bw,
29037
+ AICC_FEATURES as bx,
29038
+ AICC_EXECUTION_MODES as by,
29039
+ isAiccAiMethod as bz,
28850
29040
  createSDKModule as c,
28851
29041
  BS_SERVICE_TASK_MANAGER as d,
28852
29042
  getActiveRuntimeType as e,
@@ -28855,21 +29045,21 @@ export {
28855
29045
  getActiveSessionToken as h,
28856
29046
  BuckyOSSDK as i,
28857
29047
  RepoClient as j,
28858
- MsgCenterClient as k,
28859
- mailboxResource as l,
28860
- mailboxAddress as m,
29048
+ parseZoneUserType as k,
29049
+ isExternalPrincipal as l,
29050
+ RPCError as m,
28861
29051
  ndm_client as n,
28862
- NOTIFY_DELIVERED_INTENT as o,
29052
+ MsgCenterClient as o,
28863
29053
  parseSessionTokenClaims as p,
28864
- NOTIFY_DATA_VERSION as q,
29054
+ mailboxAddress as q,
28865
29055
  resolveDidFromHost as r,
28866
29056
  sn_client as s,
28867
- NOTIFY_SESSION_PREFIX as t,
28868
- NOTIFY_CHOICE_CONTROL_ID as u,
28869
- NOTIFY_TEXT_CONTROL_ID as v,
28870
- NOTIFY_ACTION_ANSWER as w,
28871
- NOTIFY_ACTION_DISMISS as x,
28872
- NOTIFY_LINK_PATH as y,
28873
- isNotifyClosed as z
29057
+ mailboxResource as t,
29058
+ NOTIFY_DELIVERED_INTENT as u,
29059
+ NOTIFY_DATA_VERSION as v,
29060
+ NOTIFY_SESSION_PREFIX as w,
29061
+ NOTIFY_CHOICE_CONTROL_ID as x,
29062
+ NOTIFY_TEXT_CONTROL_ID as y,
29063
+ NOTIFY_ACTION_ANSWER as z
28874
29064
  };
28875
- //# sourceMappingURL=ndm_proxy-501cb1e8.mjs.map
29065
+ //# sourceMappingURL=ndm_proxy-b5c95488.mjs.map