@pc-nexus/bridge 0.5.0-next.2 → 0.5.0-next.20

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.
@@ -147,7 +147,8 @@ class NexusRouter {
147
147
  const errorMessage = '"target" is required in router generateUrl.';
148
148
  throw new BridgeAPIError(errorMessage);
149
149
  }
150
- return await NexusBridge.call("routerGenerateUrl", { location });
150
+ const urlString = await NexusBridge.call("routerGenerateUrl", { location });
151
+ return new URL(urlString);
151
152
  }
152
153
  async reload() {
153
154
  await NexusBridge.call("routerReload", {});
@@ -166,7 +167,10 @@ class NexusView {
166
167
  if (typeof title !== "string") {
167
168
  throw new BridgeAPIError('"title" must be a string in view setWindowTitle.');
168
169
  }
169
- await NexusBridge.call("setWindowTitle", { title });
170
+ const success = await NexusBridge.call("setWindowTitle", { title });
171
+ if (!success) {
172
+ throw new BridgeAPIError("setWindowTitle API is not available within this module.");
173
+ }
170
174
  }
171
175
  async reload() {
172
176
  const success = await NexusBridge.call("viewReload");
@@ -199,6 +203,9 @@ class NexusView {
199
203
  }
200
204
  async createHistory() {
201
205
  const history = await NexusBridge.call("createHistory");
206
+ if (!history) {
207
+ throw new BridgeAPIError("createHistory API is not available within this module.");
208
+ }
202
209
  await history.listen((location, action) => {
203
210
  history.action = action;
204
211
  history.location = location;
@@ -254,12 +261,23 @@ const blobToBase64 = (blob) => {
254
261
  reader.readAsDataURL(blob);
255
262
  });
256
263
  };
264
+ const blobToArrayBuffer = (blob) => {
265
+ return new Promise((resolve, reject) => {
266
+ const reader = new FileReader();
267
+ reader.onloadend = () => {
268
+ resolve(reader.result);
269
+ };
270
+ reader.onerror = reject;
271
+ reader.readAsArrayBuffer(blob);
272
+ });
273
+ };
257
274
  const serialiseBlobsInPayload = async (payload) => {
258
275
  if (payload instanceof Blob) {
259
276
  const base64Data = await blobToBase64(payload);
260
277
  return {
261
278
  data: base64Data,
262
279
  type: payload.type,
280
+ name: payload instanceof File ? payload.name : undefined,
263
281
  __isBlobData: true,
264
282
  };
265
283
  }
@@ -393,11 +411,21 @@ class NexusI18n {
393
411
  const url = `../${this.i18nFolderName}/${locale}.json`;
394
412
  if (!this.translationsCache[locale]) {
395
413
  this.translationsCache[locale] = fetch(url)
396
- .then((response) => response.json())
414
+ .then((response) => {
415
+ if (!response.ok) {
416
+ throw new BridgeAPIError(`Failed to load translations for locale ${locale}. HTTP ${response.status}: ${response.statusText}`);
417
+ }
418
+ return response.json();
419
+ })
397
420
  .catch((error) => {
398
421
  // 请求失败要清理缓存
399
422
  delete this.translationsCache[locale];
400
- throw new BridgeAPIError(`Failed to load translations for locale ${locale}, cause: ${error}`);
423
+ if (error instanceof BridgeAPIError) {
424
+ throw error;
425
+ }
426
+ else {
427
+ throw new BridgeAPIError(`Failed to load translations for locale ${locale}, cause: ${error}`);
428
+ }
401
429
  });
402
430
  }
403
431
  return this.translationsCache[locale];
@@ -432,6 +460,17 @@ class NexusI18n {
432
460
  }
433
461
  const i18n = new NexusI18n();
434
462
 
463
+ const validateFetchOptions = (init) => {
464
+ if (!init) {
465
+ return init;
466
+ }
467
+ if ("signal" in init) {
468
+ const { signal: _signal, ...rest } = init;
469
+ console.error("Signal is not supported in @pc-nexus/bridge and was removed from fetch options.");
470
+ return rest;
471
+ }
472
+ return init;
473
+ };
435
474
  async function buildPayloadByRequestInit(init) {
436
475
  const requestBody = init === null || init === void 0 ? void 0 : init.body;
437
476
  const requestMethod = init === null || init === void 0 ? void 0 : init.method;
@@ -457,34 +496,354 @@ async function parseToResponseData(res) {
457
496
  });
458
497
  return response;
459
498
  }
460
-
461
- const validateFetchOptions = (init) => {
462
- if (!init) {
463
- return init;
499
+ async function parseFormData(formData) {
500
+ const entries = [];
501
+ for (const [name, value] of formData.entries()) {
502
+ entries.push({
503
+ name,
504
+ value: typeof value === "string" ? value : await serialiseBlobsInPayload(value),
505
+ });
464
506
  }
465
- if ("signal" in init) {
466
- const { signal: _signal, ...rest } = init;
467
- console.error("Signal is not supported in @pc-nexus/bridge and was removed from fetch options.");
468
- return rest;
507
+ return entries;
508
+ }
509
+ async function buildRemoteRequestPayload(remoteKey, options) {
510
+ const { path = "", ...requestOptions } = options;
511
+ const isMultipartFormData = requestOptions.body instanceof FormData;
512
+ const request = new Request("", {
513
+ body: requestOptions.body,
514
+ method: requestOptions.method,
515
+ headers: requestOptions.headers,
516
+ });
517
+ const headers = Object.fromEntries(request.headers.entries());
518
+ let body;
519
+ if (isMultipartFormData) {
520
+ body = await parseFormData(requestOptions.body);
469
521
  }
470
- return init;
471
- };
522
+ else if (request.method !== "GET") {
523
+ body = await request.text();
524
+ }
525
+ return {
526
+ remoteKey,
527
+ path,
528
+ isMultipartFormData,
529
+ requestInit: {
530
+ ...requestOptions,
531
+ body,
532
+ method: requestOptions.method ?? "GET",
533
+ headers,
534
+ },
535
+ };
536
+ }
537
+ async function parseRemoteResponseData(res) {
538
+ const headers = new Headers(res.headers);
539
+ const blob = res.isBinaryContent && res.body ? base64ToBlob(res.body, headers.get("content-type") ?? "") : undefined;
540
+ const responseBody = blob ? await blobToArrayBuffer(blob) : res.body;
541
+ return new Response(responseBody ?? null, {
542
+ status: res.status,
543
+ statusText: res.statusText,
544
+ headers,
545
+ });
546
+ }
547
+
472
548
  async function callRequestBridge(handlerName, payload) {
473
549
  const postPayload = await buildPayloadByRequestInit(payload);
474
550
  const { status, headers, body } = await NexusBridge.call(handlerName, postPayload);
475
551
  return parseToResponseData({ status, headers, body });
476
552
  }
477
- async function requestApi(path, options) {
478
- if (typeof path !== "string") {
479
- throw new BridgeAPIError('"path" must be a string in requestApi.');
553
+ class NexusRestApi {
554
+ async request(path, options) {
555
+ if (typeof path !== "string") {
556
+ throw new BridgeAPIError('"path" must be a string in api.request.');
557
+ }
558
+ const validatedOptions = validateFetchOptions(options);
559
+ return callRequestBridge("apiRequest", { path, ...validatedOptions });
560
+ }
561
+ }
562
+ const api = new NexusRestApi();
563
+
564
+ async function buildObjectMetadata(file) {
565
+ const size = file.size;
566
+ const arrayBuffer = await file.arrayBuffer();
567
+ let checksum;
568
+ const checksum_type = "SHA256";
569
+ // crypto.subtle 只能在安全上下文(HTTPS 或 localhost)中使用
570
+ // sha256 兼容模拟器非安全上下文
571
+ if (typeof crypto !== "undefined" && crypto.subtle) {
572
+ const hashBuffer = await crypto.subtle.digest("SHA-256", arrayBuffer);
573
+ const hashArray = new Uint8Array(hashBuffer);
574
+ checksum = btoa(String.fromCharCode(...hashArray));
575
+ }
576
+ else {
577
+ const jsHash = await sha256(arrayBuffer);
578
+ checksum = btoa(String.fromCharCode(...new Uint8Array(jsHash)));
579
+ }
580
+ return {
581
+ size,
582
+ checksum,
583
+ checksum_type,
584
+ };
585
+ }
586
+ function buildChecksumToFileMap(files, metadata) {
587
+ const map = new Map();
588
+ files.forEach((file, index) => {
589
+ map.set(metadata[index].checksum, {
590
+ file,
591
+ index,
592
+ });
593
+ });
594
+ return map;
595
+ }
596
+ function uploadFile(url, file, key) {
597
+ const formData = new FormData();
598
+ const fileName = file.name || key;
599
+ formData.append("file", file, fileName);
600
+ return fetch(url, {
601
+ method: "PUT",
602
+ body: formData,
603
+ })
604
+ .then((response) => ({
605
+ success: response.ok,
606
+ key,
607
+ status: response.status,
608
+ error: response.ok ? undefined : `Upload failed with status ${response.status}`,
609
+ }))
610
+ .catch((error) => ({
611
+ success: false,
612
+ key,
613
+ status: 503,
614
+ error: error instanceof Error ? error.message : "Upload failed",
615
+ }));
616
+ }
617
+ class NexusObjectStore {
618
+ async upload(functionKey, objects) {
619
+ if (!functionKey || functionKey.length === 0) {
620
+ throw new BridgeAPIError('"functionKey" is required in store upload.');
621
+ }
622
+ if (!Array.isArray(objects) || objects.length === 0) {
623
+ throw new BridgeAPIError('"objects" is required and cannot be empty in store upload.');
624
+ }
625
+ const files = objects.map((obj, index) => {
626
+ if (obj instanceof File || obj instanceof Blob)
627
+ return obj;
628
+ throw new BridgeAPIError(`Invalid object type at index ${index}. Only Blob/File objects are accepted.`);
629
+ });
630
+ const allObjectMetadata = await Promise.all(files.map((file) => buildObjectMetadata(file)));
631
+ const presignedURLsToObjectMetadata = await invoke(functionKey, allObjectMetadata);
632
+ if (!presignedURLsToObjectMetadata || typeof presignedURLsToObjectMetadata !== "object") {
633
+ throw new BridgeAPIError("Invalid response from functionKey");
634
+ }
635
+ const checksumMap = buildChecksumToFileMap(files, allObjectMetadata);
636
+ const uploadPromises = Object.entries(presignedURLsToObjectMetadata).map(([presignedUrl, { key, checksum }]) => {
637
+ const fileInfo = checksumMap.get(checksum);
638
+ if (!fileInfo) {
639
+ return {
640
+ promise: Promise.resolve({
641
+ success: false,
642
+ key,
643
+ error: `File not found for checksum ${checksum}`,
644
+ }),
645
+ index: -1,
646
+ };
647
+ }
648
+ const { file, index } = fileInfo;
649
+ const promise = uploadFile(presignedUrl, file, key);
650
+ return {
651
+ promise,
652
+ index,
653
+ objectType: file.type,
654
+ objectSize: file.size,
655
+ };
656
+ });
657
+ return await Promise.all(uploadPromises.map((t) => t.promise));
658
+ }
659
+ async download(functionKey, keys) {
660
+ if (!functionKey || functionKey.length === 0) {
661
+ throw new BridgeAPIError('"functionKey" is required in store download.');
662
+ }
663
+ if (!Array.isArray(keys) || keys.length === 0) {
664
+ throw new BridgeAPIError('"keys" is required and cannot be empty in store download.');
665
+ }
666
+ const downloadUrlsTokeys = await invoke(functionKey, keys);
667
+ if (!downloadUrlsTokeys || typeof downloadUrlsTokeys !== "object") {
668
+ throw new BridgeAPIError("Invalid response from functionKey");
669
+ }
670
+ const downloadPromises = Object.entries(downloadUrlsTokeys).map(async ([downloadUrl, key]) => {
671
+ try {
672
+ const response = await fetch(downloadUrl, {
673
+ method: "GET",
674
+ });
675
+ if (!response.ok) {
676
+ return {
677
+ success: false,
678
+ key: key,
679
+ status: response.status,
680
+ error: `Download failed with status ${response.status}`,
681
+ };
682
+ }
683
+ const blob = await response.blob();
684
+ const disposition = response.headers.get("Content-Disposition") ?? "";
685
+ const name = disposition.match(/filename\*=UTF-8''([^;]+)/)?.[1] ?? disposition.match(/filename="?([^"]+)"?/)?.[1] ?? "";
686
+ return {
687
+ success: true,
688
+ key: key,
689
+ blob,
690
+ name,
691
+ status: response.status,
692
+ };
693
+ }
694
+ catch (error) {
695
+ return {
696
+ success: false,
697
+ key: key,
698
+ status: 503,
699
+ error: error instanceof Error ? error.message : "Download failed",
700
+ };
701
+ }
702
+ });
703
+ return await Promise.all(downloadPromises);
704
+ }
705
+ async getMetadata(functionKey, keys) {
706
+ if (!functionKey || functionKey.length === 0) {
707
+ throw new BridgeAPIError('"functionKey" is required in store getMetadata.');
708
+ }
709
+ if (!Array.isArray(keys) || keys.length === 0) {
710
+ throw new BridgeAPIError('"keys" is required and cannot be empty in store getMetadata.');
711
+ }
712
+ const results = await Promise.all(keys.map(async (key) => {
713
+ const result = await invoke(functionKey, key);
714
+ if (!result || typeof result !== "object") {
715
+ return {
716
+ key,
717
+ error: "Invalid response from functionKey",
718
+ };
719
+ }
720
+ return result;
721
+ }));
722
+ return results;
723
+ }
724
+ async delete(functionKey, keys) {
725
+ if (!functionKey || functionKey.length === 0) {
726
+ throw new BridgeAPIError('"functionKey" is required in store delete.');
727
+ }
728
+ if (!Array.isArray(keys) || keys.length === 0) {
729
+ throw new BridgeAPIError('"keys" is required and cannot be empty in store delete.');
730
+ }
731
+ await Promise.all(keys.map(async (key) => {
732
+ await invoke(functionKey, key);
733
+ }));
734
+ }
735
+ }
736
+ const store = new NexusObjectStore();
737
+ function sha256(buffer) {
738
+ const bytes = new Uint8Array(buffer);
739
+ const len = bytes.length;
740
+ const blockSize = 64;
741
+ const hashSize = 32;
742
+ const K = new Uint32Array([
743
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be,
744
+ 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa,
745
+ 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85,
746
+ 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
747
+ 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f,
748
+ 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
749
+ ]);
750
+ let h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a;
751
+ let h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19;
752
+ const totalBits = BigInt(len) * 8n;
753
+ const paddingLen = len % blockSize < 56 ? 56 - (len % blockSize) : 120 - (len % blockSize);
754
+ const paddedLen = len + paddingLen + 8;
755
+ const padded = new Uint8Array(paddedLen);
756
+ padded.set(bytes);
757
+ padded[len] = 0x80;
758
+ const view = new DataView(padded.buffer, padded.byteOffset);
759
+ view.setUint32(paddedLen - 4, Number((totalBits >> 32n) & 0xffffffffn));
760
+ view.setUint32(paddedLen - 8, Number(totalBits & 0xffffffffn));
761
+ for (let i = 0; i < paddedLen; i += blockSize) {
762
+ const w = new Uint32Array(64);
763
+ for (let j = 0; j < 16; j++) {
764
+ w[j] = view.getUint32(i + j * 4);
765
+ }
766
+ for (let j = 16; j < 64; j++) {
767
+ const s0 = ((w[j - 15] >>> 7) | (w[j - 15] << 25)) ^ ((w[j - 15] >>> 18) | (w[j - 15] << 14)) ^ (w[j - 15] >>> 3);
768
+ const s1 = ((w[j - 2] >>> 17) | (w[j - 2] << 15)) ^ ((w[j - 2] >>> 19) | (w[j - 2] << 13)) ^ (w[j - 2] >>> 10);
769
+ w[j] = (w[j - 16] + s0 + w[j - 7] + s1) >>> 0;
770
+ }
771
+ let a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7;
772
+ for (let j = 0; j < 64; j++) {
773
+ const S1 = ((e >>> 6) | (e << 26)) ^ ((e >>> 11) | (e << 21)) ^ ((e >>> 25) | (e << 7));
774
+ const ch = (e & f) ^ (~e & g);
775
+ const temp1 = (h + S1 + ch + K[j] + w[j]) >>> 0;
776
+ const S0 = ((a >>> 2) | (a << 30)) ^ ((a >>> 13) | (a << 19)) ^ ((a >>> 22) | (a << 10));
777
+ const maj = (a & b) ^ (a & c) ^ (b & c);
778
+ const temp2 = (S0 + maj) >>> 0;
779
+ h = g;
780
+ g = f;
781
+ f = e;
782
+ e = (d + temp1) >>> 0;
783
+ d = c;
784
+ c = b;
785
+ b = a;
786
+ a = (temp1 + temp2) >>> 0;
787
+ }
788
+ h0 = (h0 + a) >>> 0;
789
+ h1 = (h1 + b) >>> 0;
790
+ h2 = (h2 + c) >>> 0;
791
+ h3 = (h3 + d) >>> 0;
792
+ h4 = (h4 + e) >>> 0;
793
+ h5 = (h5 + f) >>> 0;
794
+ h6 = (h6 + g) >>> 0;
795
+ h7 = (h7 + h) >>> 0;
796
+ }
797
+ const result = new ArrayBuffer(hashSize);
798
+ const resultView = new DataView(result);
799
+ resultView.setUint32(0, h0);
800
+ resultView.setUint32(4, h1);
801
+ resultView.setUint32(8, h2);
802
+ resultView.setUint32(12, h3);
803
+ resultView.setUint32(16, h4);
804
+ resultView.setUint32(20, h5);
805
+ resultView.setUint32(24, h6);
806
+ resultView.setUint32(28, h7);
807
+ return result;
808
+ }
809
+
810
+ class NexusRemote {
811
+ async invoke(options) {
812
+ if (!options || typeof options !== "object") {
813
+ throw new BridgeAPIError('"options" must be an object in remote invoke.');
814
+ }
815
+ if (typeof options.path !== "string" || options.path.trim().length === 0) {
816
+ throw new BridgeAPIError('"path" is required and cannot be empty in remote invoke options.');
817
+ }
818
+ const payload = await buildPayloadByRequestInit(options);
819
+ const { status, headers, body } = await NexusBridge.call("remoteInvoke", payload);
820
+ return parseToResponseData({ status, headers, body });
821
+ }
822
+ async request(remoteKey, options) {
823
+ if (typeof remoteKey !== "string" || remoteKey.trim().length === 0) {
824
+ throw new BridgeAPIError('"remoteKey" is required and cannot be empty in remote request.');
825
+ }
826
+ if (options !== undefined && (!options || typeof options !== "object")) {
827
+ throw new BridgeAPIError('"options" must be an object in remote request.');
828
+ }
829
+ const requestOptions = {
830
+ path: "",
831
+ ...validateFetchOptions(options),
832
+ };
833
+ const { path } = requestOptions;
834
+ if (options !== undefined && (typeof path !== "string" || path.trim().length === 0)) {
835
+ throw new BridgeAPIError('"path" is required and cannot be empty in remote request options.');
836
+ }
837
+ const payload = await buildRemoteRequestPayload(remoteKey, requestOptions);
838
+ const response = await NexusBridge.call("remoteRequest", payload);
839
+ return parseRemoteResponseData(response);
480
840
  }
481
- const validatedOptions = validateFetchOptions(options);
482
- return callRequestBridge("requestApi", { path, ...validatedOptions });
483
841
  }
842
+ const remote = new NexusRemote();
484
843
 
485
844
  /**
486
845
  * Generated bundle index. Do not edit.
487
846
  */
488
847
 
489
- export { dialog, events, i18n, invoke, requestApi, router, view, BridgeAPIError as ɵBridgeAPIError, NexusBridge as ɵNexusBridge };
848
+ export { api, dialog, events, i18n, invoke, remote, router, store, view, BridgeAPIError as ɵBridgeAPIError, NexusBridge as ɵNexusBridge };
490
849
  //# sourceMappingURL=pc-nexus-bridge.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"pc-nexus-bridge.mjs","sources":["../../../../web/bridge/src/window.ts","../../../../web/bridge/src/bridge.ts","../../../../web/bridge/src/error.ts","../../../../web/bridge/src/dialog.ts","../../../../web/bridge/src/invoke.ts","../../../../web/bridge/src/router.ts","../../../../web/bridge/src/view.ts","../../../../web/bridge/src/utils/blob-parser.ts","../../../../web/bridge/src/events.ts","../../../../web/bridge/src/i18n.ts","../../../../web/bridge/src/utils/request.ts","../../../../web/bridge/src/request-api.ts","../../../../web/bridge/src/pc-nexus-bridge.ts"],"sourcesContent":["export type SafeAny = any;\n\nexport function attachObjectToWindow<T>(key: string, value: T) {\n (window as SafeAny)[key] = value;\n}\n\nexport function getObjectFromWindow<T>(key: string) {\n return (window as SafeAny)[key];\n}\n","import { getObjectFromWindow } from \"./window\";\n\ninterface HostMessageEvent<T = unknown> {\n source: Window | null;\n origin: string;\n data: T;\n}\n\ninterface Cancelable {\n cancel: () => void;\n}\n\ninterface GlobalBridge {\n call<T>(name: string, payload?: object | undefined): Promise<T>;\n on<T>(name: string, handler: (event: HostMessageEvent<T>) => void): Cancelable;\n}\n\nfunction getBridge() {\n const bridge = getObjectFromWindow<GlobalBridge>(\"__pc_nexus_bridge__\");\n return bridge;\n}\n\nexport class NexusBridge {\n static getBridgeCall<T>(): (name: string, payload?: object) => Promise<T> {\n if (!getBridge()) {\n throw new Error(`\n Unable to establish a connection with the PingCode nexus bridge.\n If you are trying to run your app locally, Nexus apps only work in the context of PingCode products. Refer to https://developer.pingcode.com for how to tunnel when using a local development server.\n `);\n }\n return getBridge().call;\n }\n\n static async call<T>(name: string, payload?: any): Promise<T> {\n const result = await NexusBridge.getBridgeCall<T>()(name, payload);\n return result as T;\n }\n\n /**\n * 订阅宿主 host 发来的消息。\n * @param name 消息名称\n * @param handler 收到消息时的回调,event 包含 source、origin、data\n * @returns 返回带 cancel() 的对象,调用可取消订阅\n */\n static on<T>(name: string, handler: (event: HostMessageEvent<T>) => void): Cancelable {\n const bridge = getBridge();\n if (!bridge) {\n throw new Error(`\n Unable to establish a connection with the PingCode nexus bridge.\n If you are trying to run your app locally, Nexus apps only work in the context of PingCode products. Refer to https://developer.pingcode.com for how to tunnel when using a local development server.\n `);\n }\n return bridge.on(name, handler);\n }\n}\n","export class BridgeAPIError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"BridgeAPIError\";\n Object.setPrototypeOf(this, BridgeAPIError.prototype);\n }\n}\n\n// 自动注册:所有未 catch 的 Promise rejection 均以 \"Uncaught (in promise)\" 格式输出,无需用户配置\nif (typeof window !== \"undefined\") {\n window.addEventListener(\n \"unhandledrejection\",\n (event: PromiseRejectionEvent) => {\n const reason = event.reason;\n const error = reason instanceof Error ? reason : new Error(String(reason));\n const firstLine = `Uncaught (in promise) ${error.name}: ${error.message}`;\n const stack = error.stack?.replace(/^[^\\n]*\\n?/, \"\").trim() || \"\";\n console.error(stack ? `${firstLine}\\n${stack}` : firstLine);\n event.preventDefault();\n event.stopImmediatePropagation();\n },\n true,\n );\n}\n","import { NexusBridge } from \"./bridge\";\nimport { BridgeAPIError } from \"./error\";\nimport { DialogConfirmOptions, DialogOptions, DialogRef } from \"./models\";\n\nfunction validateOpenOptions(options: DialogOptions) {\n if (typeof options !== \"object\" || options === null) {\n throw new BridgeAPIError('\"options\" must be an object in dialog open.');\n }\n if (!options.resource) {\n throw new BridgeAPIError('\"resource\" is required in dialog open options.');\n }\n}\n\nfunction validateConfirmOptions(options: DialogConfirmOptions) {\n if (typeof options !== \"object\" || options === null) {\n throw new BridgeAPIError('\"options\" must be an object in dialog confirm.');\n }\n if (!options.content) {\n throw new BridgeAPIError('\"content\" is required in dialog confirm options.');\n }\n if (typeof options.onConfirm !== \"function\") {\n throw new BridgeAPIError('\"onConfirm\" must be a function in dialog confirm options.');\n }\n}\n\nclass NexusDialog {\n async open<T>(options: DialogOptions): Promise<DialogRef<T>> {\n validateOpenOptions(options);\n return await NexusBridge.call<DialogRef<T>>(\"openDialog\", options);\n }\n\n async confirm<T>(options: DialogConfirmOptions): Promise<void> {\n validateConfirmOptions(options);\n return await NexusBridge.call<void>(\"confirm\", options);\n }\n}\n\nexport const dialog = new NexusDialog();\n","import { NexusBridge } from \"./bridge\";\nimport { BridgeAPIError } from \"./error\";\nimport { InvokeFunctionParams } from \"./models\";\nimport { getObjectFromWindow } from \"./window\";\n\nfunction validatePayload<TPayload>(payload?: TPayload) {\n if (!payload) {\n return;\n }\n if (Object.values(payload).some((value) => typeof value === \"function\")) {\n throw new BridgeAPIError(\"Passing functions as part of the payload in invoke is not supported.\");\n }\n}\n\nexport async function invoke<TPayload = any, TResult = any>(functionKey: string, payload?: TPayload): Promise<TResult> {\n if (typeof functionKey !== \"string\") {\n throw new BridgeAPIError('\"functionKey\" must be a string in invoke.');\n }\n validatePayload(payload);\n\n const params: InvokeFunctionParams = {\n function: functionKey,\n payload: payload,\n tunnel_token: getObjectFromWindow(\"__TUNNEL_TOKEN__\"),\n } as InvokeFunctionParams;\n const result = await NexusBridge.call(\"invokeFunction\", params);\n return result as TResult;\n}\n","import { NexusBridge } from \"./bridge\";\nimport { BridgeAPIError } from \"./error\";\nimport { NavigationLocation } from \"./models\";\n\nclass NexusRouter {\n async navigate(urlOrLocation: string | NavigationLocation): Promise<void> {\n if (typeof urlOrLocation === \"string\") {\n await NexusBridge.call<void>(\"routerNavigate\", { urlOrLocation });\n } else {\n if (!urlOrLocation.target) {\n const errorMessage = '\"target\" is required in router navigate.';\n throw new BridgeAPIError(errorMessage);\n }\n await NexusBridge.call<void>(\"routerNavigate\", { urlOrLocation });\n }\n }\n\n async open(urlOrLocation: string | NavigationLocation): Promise<void> {\n if (typeof urlOrLocation === \"string\") {\n await NexusBridge.call<void>(\"routerOpen\", { urlOrLocation });\n } else {\n if (!urlOrLocation.target) {\n const errorMessage = '\"target\" is required in router open.';\n throw new BridgeAPIError(errorMessage);\n }\n await NexusBridge.call<void>(\"routerOpen\", { urlOrLocation });\n }\n }\n\n async generateUrl(location: NavigationLocation): Promise<URL> {\n if (!(location === null || location === void 0 ? void 0 : location.target)) {\n const errorMessage = '\"target\" is required in router generateUrl.';\n throw new BridgeAPIError(errorMessage);\n }\n return await NexusBridge.call<URL>(\"routerGenerateUrl\", { location });\n }\n\n async reload(): Promise<void> {\n await NexusBridge.call<void>(\"routerReload\", {});\n }\n}\n\nexport const router = new NexusRouter();\n","import { NexusBridge } from \"./bridge\";\nimport { BridgeAPIError } from \"./error\";\nimport { ExtensionData, NexusFullContext, NexusHistory } from \"./models\";\n\nclass NexusView {\n async getContext<T = ExtensionData>(): Promise<NexusFullContext<T>> {\n return await NexusBridge.call(\"getContext\");\n }\n\n async setWindowTitle(title: string): Promise<void> {\n if (!title) {\n throw new BridgeAPIError('\"title\" is required in view setWindowTitle.');\n }\n if (typeof title !== \"string\") {\n throw new BridgeAPIError('\"title\" must be a string in view setWindowTitle.');\n }\n\n await NexusBridge.call<void>(\"setWindowTitle\", { title });\n }\n\n async reload(): Promise<void> {\n const success = await NexusBridge.call<boolean>(\"viewReload\");\n if (success === false) {\n throw new BridgeAPIError(\"this resource's view is not reloadable.\");\n }\n }\n\n async close(payload?: unknown): Promise<void> {\n const success = await NexusBridge.call<boolean>(\"viewClose\", payload);\n if (!success) {\n const errorMessage = \"this resource's view is not closable.\";\n throw new BridgeAPIError(errorMessage);\n }\n }\n\n /**\n * 非弹窗场景调用无效。\n */\n async onClose(payload: () => Promise<void>): Promise<void> {\n if (typeof payload !== \"function\") {\n const errorMessage = '\"payload\" must be a function in view onClose.';\n throw new BridgeAPIError(errorMessage);\n }\n const success = await NexusBridge.call<boolean>(\"viewOnClose\", { payload });\n if (!success) {\n throw new BridgeAPIError(\"`onClose` failed because this resource's view is not closable.\");\n }\n }\n\n async isDialog(): Promise<boolean> {\n return await NexusBridge.call<boolean>(\"viewIsDialog\");\n }\n\n async createHistory(): Promise<NexusHistory> {\n const history = await NexusBridge.call<NexusHistory>(\"createHistory\");\n await history.listen((location, action) => {\n history.action = action;\n history.location = location;\n });\n return history;\n }\n\n async submit<T = any>(payload?: T): Promise<boolean> {\n const result = await NexusBridge.call<boolean>(\"viewSubmit\", payload);\n if (!result) {\n throw new BridgeAPIError(\"this resource's view is not submittable.\");\n }\n return result;\n }\n}\n\nexport const view = new NexusView();\n","const isPlainObject = (value: any) => {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n if (Object.prototype.toString.call(value) !== \"[object Object]\") {\n return false;\n }\n const proto = Object.getPrototypeOf(value);\n if (proto === null) {\n return true;\n }\n const constructor = Object.prototype.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return (\n typeof constructor === \"function\" &&\n constructor instanceof constructor &&\n Function.prototype.call(constructor) === Function.prototype.call(value)\n );\n};\n\nconst base64ToBlob = (b64string: string, mimeType: string) => {\n if (!b64string) {\n return null;\n }\n const base64String = b64string.includes(\",\") ? b64string.split(\",\")[1] : b64string;\n const byteCharacters = atob(base64String);\n const byteNumbers = new Array(byteCharacters.length);\n for (let i = 0; i < byteCharacters.length; i++) {\n byteNumbers[i] = byteCharacters.charCodeAt(i);\n }\n\n const byteArray = new Uint8Array(byteNumbers);\n return new Blob([byteArray], { type: mimeType });\n};\n\nconst blobToBase64 = (blob: Blob) => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onloadend = () => {\n resolve(reader.result);\n };\n reader.onerror = reject;\n reader.readAsDataURL(blob);\n });\n};\n\nexport const serialiseBlobsInPayload = async (payload: any): Promise<any> => {\n if (payload instanceof Blob) {\n const base64Data = await blobToBase64(payload);\n return {\n data: base64Data,\n type: payload.type,\n __isBlobData: true,\n };\n }\n if (Array.isArray(payload)) {\n return Promise.all(payload.map((item) => serialiseBlobsInPayload(item)));\n }\n if (payload && isPlainObject(payload)) {\n const entries = await Promise.all(Object.entries(payload).map(async ([key, value]) => [key, await serialiseBlobsInPayload(value)]));\n return Object.fromEntries(entries);\n }\n return payload;\n};\n\nexport const deserialiseBlobsInPayload = (payload: any): any => {\n if (payload && isPlainObject(payload) && \"__isBlobData\" in payload) {\n const typedData = payload;\n return base64ToBlob(typedData.data, typedData.type);\n }\n if (Array.isArray(payload)) {\n return payload.map((item) => deserialiseBlobsInPayload(item));\n }\n if (payload && isPlainObject(payload)) {\n const result = {};\n for (const [key, value] of Object.entries(payload)) {\n (result as any)[key] = deserialiseBlobsInPayload(value);\n }\n return result;\n }\n return payload;\n};\n\nexport const containsBlobs = (payload: any): boolean => {\n if (payload instanceof Blob) {\n return true;\n }\n if (Array.isArray(payload)) {\n return payload.some((item) => containsBlobs(item));\n }\n if (payload && isPlainObject(payload)) {\n return Object.values(payload).some((value) => containsBlobs(value));\n }\n return false;\n};\n\nexport const containsSerialisedBlobs = (payload: any): boolean => {\n if (payload && isPlainObject(payload) && \"__isBlobData\" in payload) {\n return true;\n }\n if (Array.isArray(payload)) {\n return payload.some((item) => containsSerialisedBlobs(item));\n }\n if (payload && isPlainObject(payload)) {\n return Object.values(payload).some((value) => containsSerialisedBlobs(value));\n }\n return false;\n};\n","import { NexusBridge } from \"./bridge\";\nimport { BridgeAPIError } from \"./error\";\nimport { Subscription } from \"./models\";\nimport { containsBlobs, serialiseBlobsInPayload, containsSerialisedBlobs, deserialiseBlobsInPayload } from \"./utils\";\n\nfunction validateOnPayload<T>(eventName: string, callback: (payload?: T) => any) {\n if (!eventName) {\n throw new BridgeAPIError('\"eventName\" is required in events on.');\n }\n if (typeof eventName !== \"string\") {\n throw new BridgeAPIError('\"eventName\" must be a string in events on.');\n }\n if (!callback) {\n throw new BridgeAPIError('\"callback\" is required in events on.');\n }\n if (typeof callback !== \"function\") {\n throw new BridgeAPIError('\"callback\" must be a function in events on.');\n }\n}\n\nfunction validateEmitPayload<T>(eventName: string) {\n if (!eventName) {\n throw new BridgeAPIError('\"eventName\" is required in events emit.');\n }\n if (typeof eventName !== \"string\") {\n throw new BridgeAPIError('\"eventName\" must be a string in events emit.');\n }\n}\n\nasync function on<T = any>(eventName: string, callback: (payload?: T) => any): Promise<Subscription> {\n validateOnPayload<T>(eventName, callback);\n\n const wrappedCallback = (payload: T) => {\n let newPayload = payload;\n if (containsSerialisedBlobs(payload)) {\n newPayload = deserialiseBlobsInPayload(payload);\n }\n return callback(newPayload);\n };\n return NexusBridge.call(\"on\", { eventName, callback: wrappedCallback });\n}\n\nasync function emit<T = any>(eventName: string, payload?: T): Promise<void> {\n validateEmitPayload<T>(eventName);\n\n let newPayload = payload;\n if (containsBlobs(payload)) {\n newPayload = await serialiseBlobsInPayload(payload);\n }\n return NexusBridge.call(\"emit\", { eventName, payload: newPayload });\n}\n\nexport const events = {\n on,\n emit,\n};\n","import { Translator, GetTranslationsResult, NexusSupportedLocaleCode, TranslationResourceContent, SUPPORTED_LOCALE_CODES } from \"./models\";\nimport { view } from \"./view\";\nimport { BridgeAPIError } from \"./error\";\n\nclass NexusI18n {\n private translationsCache: Partial<Record<NexusSupportedLocaleCode, Promise<TranslationResourceContent>>> = {};\n\n private i18nFolderName = \"__LOCALES__\";\n\n async getTranslations(locale?: NexusSupportedLocaleCode): Promise<GetTranslationsResult> {\n if (!locale) {\n locale = (await view.getContext()).user.locale;\n } else {\n if (!SUPPORTED_LOCALE_CODES.includes(locale)) {\n throw new BridgeAPIError(`\"locale\" must be a valid locale code, supported codes: ${SUPPORTED_LOCALE_CODES.join(\", \")}.`);\n }\n }\n const translations = await this.loadTranslations(locale!);\n return { locale: locale!, translations };\n }\n\n async createTranslator(locale?: NexusSupportedLocaleCode): Promise<Translator> {\n if (!locale) {\n locale = (await view.getContext()).user.locale;\n } else {\n if (!SUPPORTED_LOCALE_CODES.includes(locale)) {\n throw new BridgeAPIError(`\"locale\" must be a valid locale code, supported codes: ${SUPPORTED_LOCALE_CODES.join(\", \")}.`);\n }\n }\n const translations = await this.loadTranslations(locale!);\n return {\n translate: (key: string, params: Record<string, any> = {}) => this.translate(key, translations, params),\n };\n }\n\n private loadTranslations(locale: NexusSupportedLocaleCode): Promise<TranslationResourceContent> {\n const url = `../${this.i18nFolderName}/${locale}.json`;\n if (!this.translationsCache[locale]) {\n this.translationsCache[locale] = fetch(url)\n .then((response) => response.json())\n .catch((error) => {\n // 请求失败要清理缓存\n delete this.translationsCache[locale];\n throw new BridgeAPIError(`Failed to load translations for locale ${locale}, cause: ${error}`);\n });\n }\n\n return this.translationsCache[locale]!;\n }\n\n private getValue(obj: any, path: string): any {\n return path.split(\".\").reduce((o, k) => (o != null && typeof o === \"object\" ? o[k] : undefined), obj);\n }\n\n private translate(\n key: string,\n translations: TranslationResourceContent,\n params?: Record<string, any>,\n ): TranslationResourceContent | string {\n if (!key) {\n throw new BridgeAPIError('\"key\" is required in i18n translate.');\n }\n // 获取值(扁平或嵌套)\n let value: any = translations[key] ?? this.getValue(translations, key);\n\n // key 不存在 → 返回 key\n if (value == null) return key;\n\n // 如果 value 是对象 → 直接返回\n if (typeof value === \"object\") return value;\n\n // 确保 value 是字符串\n if (typeof value !== \"string\") value = String(value);\n\n // 无参数 → 直接返回\n if (!params) return value;\n\n // 参数替换\n return value.replace(/\\{\\{\\s*(.*?)\\s*\\}\\}/g, (_: string, k: string) => {\n const paramValue = this.getValue(params, k.trim());\n return paramValue != null ? String(paramValue) : `{{${k}}}`;\n });\n }\n}\n\nexport const i18n = new NexusI18n();\n","import { RequestApiResponseData } from \"../models\";\n\nexport async function buildPayloadByRequestInit<TPayload extends RequestInit = RequestInit>(init?: TPayload) {\n const requestBody = init === null || init === void 0 ? void 0 : init.body;\n const requestMethod = init === null || init === void 0 ? void 0 : init.method;\n const requestHeaders = init === null || init === void 0 ? void 0 : init.headers;\n const req = new Request(\"\", {\n body: requestBody,\n method: requestMethod,\n headers: requestHeaders,\n });\n const headers = Object.fromEntries(req.headers.entries());\n const body = req.method !== \"GET\" ? await req.text() : undefined;\n return {\n ...init,\n body: body,\n headers,\n method: requestMethod ?? \"GET\",\n };\n}\n\nexport async function parseToResponseData(res: RequestApiResponseData): Promise<Response> {\n const response = new Response(\n res.body == null ? undefined : typeof res.body === \"object\" ? JSON.stringify(res.body) : (res.body as BodyInit),\n {\n status: res.status,\n headers: new Headers(res.headers),\n },\n );\n\n return response;\n}\n","import { NexusBridge } from \"./bridge\";\nimport { BridgeAPIError } from \"./error\";\nimport { NexusRequestInit, RequestApiResponseData } from \"./models\";\nimport { buildPayloadByRequestInit, parseToResponseData } from \"./utils/request\";\n\ninterface RequestApiParams extends NexusRequestInit {\n path: string;\n}\n\nconst validateFetchOptions = (init?: NexusRequestInit) => {\n if (!init) {\n return init;\n }\n if (\"signal\" in init) {\n const { signal: _signal, ...rest } = init;\n console.error(\"Signal is not supported in @pc-nexus/bridge and was removed from fetch options.\");\n return rest;\n }\n return init;\n};\n\nasync function callRequestBridge<TPayload extends NexusRequestInit = NexusRequestInit>(\n handlerName: string,\n payload: TPayload,\n): Promise<Response> {\n const postPayload = await buildPayloadByRequestInit<TPayload>(payload);\n const { status, headers, body } = await NexusBridge.call<RequestApiResponseData>(handlerName, postPayload);\n return parseToResponseData({ status, headers, body });\n}\n\nexport async function requestApi(path: string, options?: NexusRequestInit): Promise<Response> {\n if (typeof path !== \"string\") {\n throw new BridgeAPIError('\"path\" must be a string in requestApi.');\n }\n\n const validatedOptions = validateFetchOptions(options);\n return callRequestBridge<RequestApiParams>(\"requestApi\", { path, ...validatedOptions });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAEM,SAAU,oBAAoB,CAAI,GAAW,EAAE,KAAQ,EAAA;AACxD,IAAA,MAAkB,CAAC,GAAG,CAAC,GAAG,KAAK;AACpC;AAEM,SAAU,mBAAmB,CAAI,GAAW,EAAA;AAC9C,IAAA,OAAQ,MAAkB,CAAC,GAAG,CAAC;AACnC;;ACSA,SAAS,SAAS,GAAA;AACd,IAAA,MAAM,MAAM,GAAG,mBAAmB,CAAe,qBAAqB,CAAC;AACvE,IAAA,OAAO,MAAM;AACjB;MAEa,WAAW,CAAA;AACpB,IAAA,OAAO,aAAa,GAAA;AAChB,QAAA,IAAI,CAAC,SAAS,EAAE,EAAE;YACd,MAAM,IAAI,KAAK,CAAC;;;AAGnB,QAAA,CAAA,CAAC;QACF;AACA,QAAA,OAAO,SAAS,EAAE,CAAC,IAAI;IAC3B;AAEA,IAAA,aAAa,IAAI,CAAI,IAAY,EAAE,OAAa,EAAA;AA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wC,CAAC;IACtE;AAEA,IAAA,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,OAAO,CAAC;IACtD,OAAO,iBAAiB,CAAmB,YAAY,EAAE,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,CAAC;AAC3F;;ACrCA;;AAEG;;;;"}
1
+ {"version":3,"file":"pc-nexus-bridge.mjs","sources":["../../../../web/bridge/src/window.ts","../../../../web/bridge/src/bridge.ts","../../../../web/bridge/src/error.ts","../../../../web/bridge/src/dialog.ts","../../../../web/bridge/src/invoke.ts","../../../../web/bridge/src/router.ts","../../../../web/bridge/src/view.ts","../../../../web/bridge/src/utils/blob-parser.ts","../../../../web/bridge/src/events.ts","../../../../web/bridge/src/i18n.ts","../../../../web/bridge/src/utils/request.ts","../../../../web/bridge/src/api.ts","../../../../web/bridge/src/store.ts","../../../../web/bridge/src/remote.ts","../../../../web/bridge/src/pc-nexus-bridge.ts"],"sourcesContent":["export type SafeAny = any;\n\nexport function attachObjectToWindow<T>(key: string, value: T) {\n (window as SafeAny)[key] = value;\n}\n\nexport function getObjectFromWindow<T>(key: string) {\n return (window as SafeAny)[key];\n}\n","import { getObjectFromWindow } from \"./window\";\n\ninterface HostMessageEvent<T = unknown> {\n source: Window | null;\n origin: string;\n data: T;\n}\n\ninterface Cancelable {\n cancel: () => void;\n}\n\ninterface GlobalBridge {\n call<T>(name: string, payload?: object | undefined): Promise<T>;\n on<T>(name: string, handler: (event: HostMessageEvent<T>) => void): Cancelable;\n}\n\nfunction getBridge() {\n const bridge = getObjectFromWindow<GlobalBridge>(\"__pc_nexus_bridge__\");\n return bridge;\n}\n\nexport class NexusBridge {\n static getBridgeCall<T>(): (name: string, payload?: object) => Promise<T> {\n if (!getBridge()) {\n throw new Error(`\n Unable to establish a connection with the PingCode nexus bridge.\n If you are trying to run your app locally, Nexus apps only work in the context of PingCode products. Refer to https://developer.pingcode.com for how to tunnel when using a local development server.\n `);\n }\n return getBridge().call;\n }\n\n static async call<T>(name: string, payload?: any): Promise<T> {\n const result = await NexusBridge.getBridgeCall<T>()(name, payload);\n return result as T;\n }\n\n /**\n * 订阅宿主 host 发来的消息。\n * @param name 消息名称\n * @param handler 收到消息时的回调,event 包含 source、origin、data\n * @returns 返回带 cancel() 的对象,调用可取消订阅\n */\n static on<T>(name: string, handler: (event: HostMessageEvent<T>) => void): Cancelable {\n const bridge = getBridge();\n if (!bridge) {\n throw new Error(`\n Unable to establish a connection with the PingCode nexus bridge.\n If you are trying to run your app locally, Nexus apps only work in the context of PingCode products. Refer to https://developer.pingcode.com for how to tunnel when using a local development server.\n `);\n }\n return bridge.on(name, handler);\n }\n}\n","export class BridgeAPIError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"BridgeAPIError\";\n Object.setPrototypeOf(this, BridgeAPIError.prototype);\n }\n}\n\n// 自动注册:所有未 catch 的 Promise rejection 均以 \"Uncaught (in promise)\" 格式输出,无需用户配置\nif (typeof window !== \"undefined\") {\n window.addEventListener(\n \"unhandledrejection\",\n (event: PromiseRejectionEvent) => {\n const reason = event.reason;\n const error = reason instanceof Error ? reason : new Error(String(reason));\n const firstLine = `Uncaught (in promise) ${error.name}: ${error.message}`;\n const stack = error.stack?.replace(/^[^\\n]*\\n?/, \"\").trim() || \"\";\n console.error(stack ? `${firstLine}\\n${stack}` : firstLine);\n event.preventDefault();\n event.stopImmediatePropagation();\n },\n true,\n );\n}\n","import { NexusBridge } from \"./bridge\";\nimport { BridgeAPIError } from \"./error\";\nimport { DialogConfirmOptions, DialogOptions, DialogRef } from \"./models\";\n\nfunction validateOpenOptions(options: DialogOptions) {\n if (typeof options !== \"object\" || options === null) {\n throw new BridgeAPIError('\"options\" must be an object in dialog open.');\n }\n if (!options.resource) {\n throw new BridgeAPIError('\"resource\" is required in dialog open options.');\n }\n}\n\nfunction validateConfirmOptions(options: DialogConfirmOptions) {\n if (typeof options !== \"object\" || options === null) {\n throw new BridgeAPIError('\"options\" must be an object in dialog confirm.');\n }\n if (!options.content) {\n throw new BridgeAPIError('\"content\" is required in dialog confirm options.');\n }\n if (typeof options.onConfirm !== \"function\") {\n throw new BridgeAPIError('\"onConfirm\" must be a function in dialog confirm options.');\n }\n}\n\nclass NexusDialog {\n async open<T>(options: DialogOptions): Promise<DialogRef<T>> {\n validateOpenOptions(options);\n return await NexusBridge.call<DialogRef<T>>(\"openDialog\", options);\n }\n\n async confirm<T>(options: DialogConfirmOptions): Promise<void> {\n validateConfirmOptions(options);\n return await NexusBridge.call<void>(\"confirm\", options);\n }\n}\n\nexport const dialog = new NexusDialog();\n","import { NexusBridge } from \"./bridge\";\nimport { BridgeAPIError } from \"./error\";\nimport { InvokeFunctionParams } from \"./models\";\nimport { getObjectFromWindow } from \"./window\";\n\nfunction validatePayload<TPayload>(payload?: TPayload) {\n if (!payload) {\n return;\n }\n if (Object.values(payload).some((value) => typeof value === \"function\")) {\n throw new BridgeAPIError(\"Passing functions as part of the payload in invoke is not supported.\");\n }\n}\n\nexport async function invoke<TPayload = any, TResult = any>(functionKey: string, payload?: TPayload): Promise<TResult> {\n if (typeof functionKey !== \"string\") {\n throw new BridgeAPIError('\"functionKey\" must be a string in invoke.');\n }\n validatePayload(payload);\n\n const params: InvokeFunctionParams = {\n function: functionKey,\n payload: payload,\n tunnel_token: getObjectFromWindow(\"__TUNNEL_TOKEN__\"),\n } as InvokeFunctionParams;\n const result = await NexusBridge.call(\"invokeFunction\", params);\n return result as TResult;\n}\n","import { NexusBridge } from \"./bridge\";\nimport { BridgeAPIError } from \"./error\";\nimport { NavigationLocation } from \"./models\";\n\nclass NexusRouter {\n async navigate(urlOrLocation: string | NavigationLocation): Promise<void> {\n if (typeof urlOrLocation === \"string\") {\n await NexusBridge.call<void>(\"routerNavigate\", { urlOrLocation });\n } else {\n if (!urlOrLocation.target) {\n const errorMessage = '\"target\" is required in router navigate.';\n throw new BridgeAPIError(errorMessage);\n }\n await NexusBridge.call<void>(\"routerNavigate\", { urlOrLocation });\n }\n }\n\n async open(urlOrLocation: string | NavigationLocation): Promise<void> {\n if (typeof urlOrLocation === \"string\") {\n await NexusBridge.call<void>(\"routerOpen\", { urlOrLocation });\n } else {\n if (!urlOrLocation.target) {\n const errorMessage = '\"target\" is required in router open.';\n throw new BridgeAPIError(errorMessage);\n }\n await NexusBridge.call<void>(\"routerOpen\", { urlOrLocation });\n }\n }\n\n async generateUrl(location: NavigationLocation): Promise<URL> {\n if (!(location === null || location === void 0 ? void 0 : location.target)) {\n const errorMessage = '\"target\" is required in router generateUrl.';\n throw new BridgeAPIError(errorMessage);\n }\n const urlString = await NexusBridge.call<string>(\"routerGenerateUrl\", { location });\n return new URL(urlString);\n }\n\n async reload(): Promise<void> {\n await NexusBridge.call<void>(\"routerReload\", {});\n }\n}\n\nexport const router = new NexusRouter();\n","import { NexusBridge } from \"./bridge\";\nimport { BridgeAPIError } from \"./error\";\nimport { ExtensionData, NexusFullContext, NexusHistory } from \"./models\";\n\nclass NexusView {\n async getContext<T = ExtensionData>(): Promise<NexusFullContext<T>> {\n return await NexusBridge.call(\"getContext\");\n }\n\n async setWindowTitle(title: string): Promise<void> {\n if (!title) {\n throw new BridgeAPIError('\"title\" is required in view setWindowTitle.');\n }\n if (typeof title !== \"string\") {\n throw new BridgeAPIError('\"title\" must be a string in view setWindowTitle.');\n }\n\n const success = await NexusBridge.call<boolean>(\"setWindowTitle\", { title });\n if (!success) {\n throw new BridgeAPIError(\"setWindowTitle API is not available within this module.\");\n }\n }\n\n async reload(): Promise<void> {\n const success = await NexusBridge.call<boolean>(\"viewReload\");\n if (success === false) {\n throw new BridgeAPIError(\"this resource's view is not reloadable.\");\n }\n }\n\n async close(payload?: unknown): Promise<void> {\n const success = await NexusBridge.call<boolean>(\"viewClose\", payload);\n if (!success) {\n const errorMessage = \"this resource's view is not closable.\";\n throw new BridgeAPIError(errorMessage);\n }\n }\n\n /**\n * 非弹窗场景调用无效。\n */\n async onClose(payload: () => Promise<void>): Promise<void> {\n if (typeof payload !== \"function\") {\n const errorMessage = '\"payload\" must be a function in view onClose.';\n throw new BridgeAPIError(errorMessage);\n }\n const success = await NexusBridge.call<boolean>(\"viewOnClose\", { payload });\n if (!success) {\n throw new BridgeAPIError(\"`onClose` failed because this resource's view is not closable.\");\n }\n }\n\n async isDialog(): Promise<boolean> {\n return await NexusBridge.call<boolean>(\"viewIsDialog\");\n }\n\n async createHistory(): Promise<NexusHistory> {\n const history = await NexusBridge.call<NexusHistory>(\"createHistory\");\n if (!history) {\n throw new BridgeAPIError(\"createHistory API is not available within this module.\");\n }\n await history.listen((location, action) => {\n history.action = action;\n history.location = location;\n });\n return history;\n }\n\n async submit<T = any>(payload?: T): Promise<boolean> {\n const result = await NexusBridge.call<boolean>(\"viewSubmit\", payload);\n if (!result) {\n throw new BridgeAPIError(\"this resource's view is not submittable.\");\n }\n return result;\n }\n}\n\nexport const view = new NexusView();\n","const isPlainObject = (value: any) => {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n if (Object.prototype.toString.call(value) !== \"[object Object]\") {\n return false;\n }\n const proto = Object.getPrototypeOf(value);\n if (proto === null) {\n return true;\n }\n const constructor = Object.prototype.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return (\n typeof constructor === \"function\" &&\n constructor instanceof constructor &&\n Function.prototype.call(constructor) === Function.prototype.call(value)\n );\n};\n\nexport const base64ToBlob = (b64string: string, mimeType: string) => {\n if (!b64string) {\n return null;\n }\n const base64String = b64string.includes(\",\") ? b64string.split(\",\")[1] : b64string;\n const byteCharacters = atob(base64String);\n const byteNumbers = new Array(byteCharacters.length);\n for (let i = 0; i < byteCharacters.length; i++) {\n byteNumbers[i] = byteCharacters.charCodeAt(i);\n }\n\n const byteArray = new Uint8Array(byteNumbers);\n return new Blob([byteArray], { type: mimeType });\n};\n\nexport const blobToBase64 = (blob: Blob): Promise<string> => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onloadend = () => {\n resolve(reader.result as string);\n };\n reader.onerror = reject;\n reader.readAsDataURL(blob);\n });\n};\n\nexport const blobToArrayBuffer = (blob: Blob): Promise<ArrayBuffer> => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onloadend = () => {\n resolve(reader.result as ArrayBuffer);\n };\n reader.onerror = reject;\n reader.readAsArrayBuffer(blob);\n });\n};\n\nexport const serialiseBlobsInPayload = async (payload: any): Promise<any> => {\n if (payload instanceof Blob) {\n const base64Data = await blobToBase64(payload);\n return {\n data: base64Data,\n type: payload.type,\n name: payload instanceof File ? payload.name : undefined,\n __isBlobData: true,\n };\n }\n if (Array.isArray(payload)) {\n return Promise.all(payload.map((item) => serialiseBlobsInPayload(item)));\n }\n if (payload && isPlainObject(payload)) {\n const entries = await Promise.all(Object.entries(payload).map(async ([key, value]) => [key, await serialiseBlobsInPayload(value)]));\n return Object.fromEntries(entries);\n }\n return payload;\n};\n\nexport const deserialiseBlobsInPayload = (payload: any): any => {\n if (payload && isPlainObject(payload) && \"__isBlobData\" in payload) {\n const typedData = payload;\n return base64ToBlob(typedData.data, typedData.type);\n }\n if (Array.isArray(payload)) {\n return payload.map((item) => deserialiseBlobsInPayload(item));\n }\n if (payload && isPlainObject(payload)) {\n const result = {};\n for (const [key, value] of Object.entries(payload)) {\n (result as any)[key] = deserialiseBlobsInPayload(value);\n }\n return result;\n }\n return payload;\n};\n\nexport const containsBlobs = (payload: any): boolean => {\n if (payload instanceof Blob) {\n return true;\n }\n if (Array.isArray(payload)) {\n return payload.some((item) => containsBlobs(item));\n }\n if (payload && isPlainObject(payload)) {\n return Object.values(payload).some((value) => containsBlobs(value));\n }\n return false;\n};\n\nexport const containsSerialisedBlobs = (payload: any): boolean => {\n if (payload && isPlainObject(payload) && \"__isBlobData\" in payload) {\n return true;\n }\n if (Array.isArray(payload)) {\n return payload.some((item) => containsSerialisedBlobs(item));\n }\n if (payload && isPlainObject(payload)) {\n return Object.values(payload).some((value) => containsSerialisedBlobs(value));\n }\n return false;\n};\n","import { NexusBridge } from \"./bridge\";\nimport { BridgeAPIError } from \"./error\";\nimport { Subscription } from \"./models\";\nimport { containsBlobs, serialiseBlobsInPayload, containsSerialisedBlobs, deserialiseBlobsInPayload } from \"./utils\";\n\nfunction validateOnPayload<T>(eventName: string, callback: (payload?: T) => any) {\n if (!eventName) {\n throw new BridgeAPIError('\"eventName\" is required in events on.');\n }\n if (typeof eventName !== \"string\") {\n throw new BridgeAPIError('\"eventName\" must be a string in events on.');\n }\n if (!callback) {\n throw new BridgeAPIError('\"callback\" is required in events on.');\n }\n if (typeof callback !== \"function\") {\n throw new BridgeAPIError('\"callback\" must be a function in events on.');\n }\n}\n\nfunction validateEmitPayload<T>(eventName: string) {\n if (!eventName) {\n throw new BridgeAPIError('\"eventName\" is required in events emit.');\n }\n if (typeof eventName !== \"string\") {\n throw new BridgeAPIError('\"eventName\" must be a string in events emit.');\n }\n}\n\nasync function on<T = any>(eventName: string, callback: (payload?: T) => any): Promise<Subscription> {\n validateOnPayload<T>(eventName, callback);\n\n const wrappedCallback = (payload: T) => {\n let newPayload = payload;\n if (containsSerialisedBlobs(payload)) {\n newPayload = deserialiseBlobsInPayload(payload);\n }\n return callback(newPayload);\n };\n return NexusBridge.call(\"on\", { eventName, callback: wrappedCallback });\n}\n\nasync function emit<T = any>(eventName: string, payload?: T): Promise<void> {\n validateEmitPayload<T>(eventName);\n\n let newPayload = payload;\n if (containsBlobs(payload)) {\n newPayload = await serialiseBlobsInPayload(payload);\n }\n return NexusBridge.call(\"emit\", { eventName, payload: newPayload });\n}\n\nexport const events = {\n on,\n emit,\n};\n","import { Translator, GetTranslationsResult, NexusSupportedLocaleCode, TranslationResourceContent, SUPPORTED_LOCALE_CODES } from \"./models\";\nimport { view } from \"./view\";\nimport { BridgeAPIError } from \"./error\";\n\nclass NexusI18n {\n private translationsCache: Partial<Record<NexusSupportedLocaleCode, Promise<TranslationResourceContent>>> = {};\n\n private i18nFolderName = \"__LOCALES__\";\n\n async getTranslations(locale?: NexusSupportedLocaleCode): Promise<GetTranslationsResult> {\n if (!locale) {\n locale = (await view.getContext()).user.locale;\n } else {\n if (!SUPPORTED_LOCALE_CODES.includes(locale)) {\n throw new BridgeAPIError(`\"locale\" must be a valid locale code, supported codes: ${SUPPORTED_LOCALE_CODES.join(\", \")}.`);\n }\n }\n const translations = await this.loadTranslations(locale!);\n return { locale: locale!, translations };\n }\n\n async createTranslator(locale?: NexusSupportedLocaleCode): Promise<Translator> {\n if (!locale) {\n locale = (await view.getContext()).user.locale;\n } else {\n if (!SUPPORTED_LOCALE_CODES.includes(locale)) {\n throw new BridgeAPIError(`\"locale\" must be a valid locale code, supported codes: ${SUPPORTED_LOCALE_CODES.join(\", \")}.`);\n }\n }\n const translations = await this.loadTranslations(locale!);\n return {\n translate: (key: string, params: Record<string, any> = {}) => this.translate(key, translations, params),\n };\n }\n\n private loadTranslations(locale: NexusSupportedLocaleCode): Promise<TranslationResourceContent> {\n const url = `../${this.i18nFolderName}/${locale}.json`;\n if (!this.translationsCache[locale]) {\n this.translationsCache[locale] = fetch(url)\n .then((response) => {\n if (!response.ok) {\n throw new BridgeAPIError(\n `Failed to load translations for locale ${locale}. HTTP ${response.status}: ${response.statusText}`,\n );\n }\n return response.json();\n })\n .catch((error) => {\n // 请求失败要清理缓存\n delete this.translationsCache[locale];\n if (error instanceof BridgeAPIError) {\n throw error;\n } else {\n throw new BridgeAPIError(`Failed to load translations for locale ${locale}, cause: ${error}`);\n }\n });\n }\n\n return this.translationsCache[locale]!;\n }\n\n private getValue(obj: any, path: string): any {\n return path.split(\".\").reduce((o, k) => (o != null && typeof o === \"object\" ? o[k] : undefined), obj);\n }\n\n private translate(\n key: string,\n translations: TranslationResourceContent,\n params?: Record<string, any>,\n ): TranslationResourceContent | string {\n if (!key) {\n throw new BridgeAPIError('\"key\" is required in i18n translate.');\n }\n // 获取值(扁平或嵌套)\n let value: any = translations[key] ?? this.getValue(translations, key);\n\n // key 不存在 → 返回 key\n if (value == null) return key;\n\n // 如果 value 是对象 → 直接返回\n if (typeof value === \"object\") return value;\n\n // 确保 value 是字符串\n if (typeof value !== \"string\") value = String(value);\n\n // 无参数 → 直接返回\n if (!params) return value;\n\n // 参数替换\n return value.replace(/\\{\\{\\s*(.*?)\\s*\\}\\}/g, (_: string, k: string) => {\n const paramValue = this.getValue(params, k.trim());\n return paramValue != null ? String(paramValue) : `{{${k}}}`;\n });\n }\n}\n\nexport const i18n = new NexusI18n();\n","import {\n RemoteRequestOptions,\n RemoteRequestPayload,\n RemoteRequestResponseData,\n RemoteSerializedFormDataEntry,\n NexusRequestInit,\n RequestApiResponseData,\n} from \"../models\";\nimport { base64ToBlob, blobToArrayBuffer, serialiseBlobsInPayload } from \"./blob-parser\";\n\nexport const validateFetchOptions = (init?: NexusRequestInit) => {\n if (!init) {\n return init;\n }\n if (\"signal\" in init) {\n const { signal: _signal, ...rest } = init;\n console.error(\"Signal is not supported in @pc-nexus/bridge and was removed from fetch options.\");\n return rest;\n }\n return init;\n};\n\nexport async function buildPayloadByRequestInit<TPayload extends RequestInit = RequestInit>(init?: TPayload) {\n const requestBody = init === null || init === void 0 ? void 0 : init.body;\n const requestMethod = init === null || init === void 0 ? void 0 : init.method;\n const requestHeaders = init === null || init === void 0 ? void 0 : init.headers;\n const req = new Request(\"\", {\n body: requestBody,\n method: requestMethod,\n headers: requestHeaders,\n });\n const headers = Object.fromEntries(req.headers.entries());\n const body = req.method !== \"GET\" ? await req.text() : undefined;\n return {\n ...init,\n body: body,\n headers,\n method: requestMethod ?? \"GET\",\n };\n}\n\nexport async function parseToResponseData(res: RequestApiResponseData): Promise<Response> {\n const response = new Response(\n res.body == null ? undefined : typeof res.body === \"object\" ? JSON.stringify(res.body) : (res.body as BodyInit),\n {\n status: res.status,\n headers: new Headers(res.headers),\n },\n );\n\n return response;\n}\n\nasync function parseFormData(formData: FormData): Promise<RemoteSerializedFormDataEntry[]> {\n const entries: RemoteSerializedFormDataEntry[] = [];\n for (const [name, value] of formData.entries()) {\n entries.push({\n name,\n value: typeof value === \"string\" ? value : await serialiseBlobsInPayload(value),\n });\n }\n return entries;\n}\n\nexport async function buildRemoteRequestPayload(remoteKey: string, options: RemoteRequestOptions): Promise<RemoteRequestPayload> {\n const { path = \"\", ...requestOptions } = options;\n const isMultipartFormData = requestOptions.body instanceof FormData;\n const request = new Request(\"\", {\n body: requestOptions.body,\n method: requestOptions.method,\n headers: requestOptions.headers,\n });\n const headers = Object.fromEntries(request.headers.entries());\n let body: RemoteRequestPayload[\"requestInit\"][\"body\"];\n if (isMultipartFormData) {\n body = await parseFormData(requestOptions.body as FormData);\n } else if (request.method !== \"GET\") {\n body = await request.text();\n }\n\n return {\n remoteKey,\n path,\n isMultipartFormData,\n requestInit: {\n ...requestOptions,\n body,\n method: requestOptions.method ?? \"GET\",\n headers,\n },\n };\n}\n\nexport async function parseRemoteResponseData(res: RemoteRequestResponseData): Promise<Response> {\n const headers = new Headers(res.headers);\n const blob = res.isBinaryContent && res.body ? base64ToBlob(res.body, headers.get(\"content-type\") ?? \"\") : undefined;\n const responseBody = blob ? await blobToArrayBuffer(blob) : res.body;\n\n return new Response((responseBody as BodyInit) ?? null, {\n status: res.status,\n statusText: res.statusText,\n headers,\n });\n}\n","import { NexusBridge } from \"./bridge\";\nimport { BridgeAPIError } from \"./error\";\nimport { NexusRequestInit, RequestApiResponseData } from \"./models\";\nimport { buildPayloadByRequestInit, parseToResponseData, validateFetchOptions } from \"./utils/request\";\n\ninterface RequestApiParams extends NexusRequestInit {\n path: string;\n}\n\nasync function callRequestBridge<TPayload extends NexusRequestInit = NexusRequestInit>(\n handlerName: string,\n payload: TPayload,\n): Promise<Response> {\n const postPayload = await buildPayloadByRequestInit<TPayload>(payload);\n const { status, headers, body } = await NexusBridge.call<RequestApiResponseData>(handlerName, postPayload);\n return parseToResponseData({ status, headers, body });\n}\n\nclass NexusRestApi {\n async request(path: string, options?: NexusRequestInit): Promise<Response> {\n if (typeof path !== \"string\") {\n throw new BridgeAPIError('\"path\" must be a string in api.request.');\n }\n\n const validatedOptions = validateFetchOptions(options);\n return callRequestBridge<RequestApiParams>(\"apiRequest\", { path, ...validatedOptions });\n }\n}\n\nexport const api = new NexusRestApi();\n","import { BridgeAPIError } from \"./error\";\nimport { invoke } from \"./invoke\";\nimport { UploadResult, DownloadResult, GetMetadataResult } from \"./models\";\n\ntype UploadInput = File | Blob;\n\ninterface GeneratedMetadata {\n size: number;\n checksum: string;\n checksum_type: \"SHA1\" | \"SHA256\" | \"CRC32\" | \"CRC32C\";\n}\n\ninterface FileMetadata extends GeneratedMetadata {\n key: string;\n overwrite?: boolean;\n}\n\ntype PresignedURLMapping = Record<string, FileMetadata>;\n\nasync function buildObjectMetadata(file: UploadInput): Promise<GeneratedMetadata> {\n const size = file.size;\n const arrayBuffer = await file.arrayBuffer();\n let checksum: string;\n const checksum_type = \"SHA256\";\n\n // crypto.subtle 只能在安全上下文(HTTPS 或 localhost)中使用\n // sha256 兼容模拟器非安全上下文\n if (typeof crypto !== \"undefined\" && crypto.subtle) {\n const hashBuffer = await crypto.subtle.digest(\"SHA-256\", arrayBuffer);\n const hashArray = new Uint8Array(hashBuffer);\n checksum = btoa(String.fromCharCode(...hashArray));\n } else {\n const jsHash = await sha256(arrayBuffer);\n checksum = btoa(String.fromCharCode(...new Uint8Array(jsHash)));\n }\n\n return {\n size,\n checksum,\n checksum_type,\n };\n}\n\nfunction buildChecksumToFileMap(files: UploadInput[], metadata: GeneratedMetadata[]) {\n const map = new Map<string, { file: UploadInput; index: number }>();\n\n files.forEach((file, index) => {\n map.set(metadata[index].checksum, {\n file,\n index,\n });\n });\n\n return map;\n}\n\nfunction uploadFile(url: string, file: UploadInput, key: string) {\n const formData = new FormData();\n const fileName = (file as File).name || key;\n formData.append(\"file\", file, fileName);\n\n return fetch(url, {\n method: \"PUT\",\n body: formData,\n })\n .then((response) => ({\n success: response.ok,\n key,\n status: response.status,\n error: response.ok ? undefined : `Upload failed with status ${response.status}`,\n }))\n .catch((error) => ({\n success: false,\n key,\n status: 503,\n error: error instanceof Error ? error.message : \"Upload failed\",\n }));\n}\n\nclass NexusObjectStore {\n async upload(functionKey: string, objects: UploadInput[]): Promise<UploadResult[]> {\n if (!functionKey || functionKey.length === 0) {\n throw new BridgeAPIError('\"functionKey\" is required in store upload.');\n }\n if (!Array.isArray(objects) || objects.length === 0) {\n throw new BridgeAPIError('\"objects\" is required and cannot be empty in store upload.');\n }\n\n const files = objects.map((obj, index) => {\n if (obj instanceof File || obj instanceof Blob) return obj;\n throw new BridgeAPIError(`Invalid object type at index ${index}. Only Blob/File objects are accepted.`);\n });\n\n const allObjectMetadata: GeneratedMetadata[] = await Promise.all(files.map((file) => buildObjectMetadata(file)));\n\n const presignedURLsToObjectMetadata: PresignedURLMapping = await invoke(functionKey, allObjectMetadata);\n\n if (!presignedURLsToObjectMetadata || typeof presignedURLsToObjectMetadata !== \"object\") {\n throw new BridgeAPIError(\"Invalid response from functionKey\");\n }\n\n const checksumMap: Map<string, { file: UploadInput; index: number }> = buildChecksumToFileMap(files, allObjectMetadata);\n\n const uploadPromises = Object.entries(presignedURLsToObjectMetadata).map(([presignedUrl, { key, checksum }]) => {\n const fileInfo = checksumMap.get(checksum);\n\n if (!fileInfo) {\n return {\n promise: Promise.resolve({\n success: false,\n key,\n error: `File not found for checksum ${checksum}`,\n }),\n index: -1,\n };\n }\n\n const { file, index } = fileInfo;\n\n const promise = uploadFile(presignedUrl, file, key);\n\n return {\n promise,\n index,\n objectType: file.type,\n objectSize: file.size,\n };\n });\n\n return await Promise.all(uploadPromises.map((t) => t.promise));\n }\n\n async download(functionKey: string, keys: string[]): Promise<DownloadResult[]> {\n if (!functionKey || functionKey.length === 0) {\n throw new BridgeAPIError('\"functionKey\" is required in store download.');\n }\n if (!Array.isArray(keys) || keys.length === 0) {\n throw new BridgeAPIError('\"keys\" is required and cannot be empty in store download.');\n }\n\n const downloadUrlsTokeys: Record<string, string> = await invoke(functionKey, keys);\n\n if (!downloadUrlsTokeys || typeof downloadUrlsTokeys !== \"object\") {\n throw new BridgeAPIError(\"Invalid response from functionKey\");\n }\n\n const downloadPromises = Object.entries(downloadUrlsTokeys).map(async ([downloadUrl, key]) => {\n try {\n const response = await fetch(downloadUrl, {\n method: \"GET\",\n });\n if (!response.ok) {\n return {\n success: false,\n key: key,\n status: response.status,\n error: `Download failed with status ${response.status}`,\n };\n }\n const blob = await response.blob();\n const disposition = response.headers.get(\"Content-Disposition\") ?? \"\";\n const name = disposition.match(/filename\\*=UTF-8''([^;]+)/)?.[1] ?? disposition.match(/filename=\"?([^\"]+)\"?/)?.[1] ?? \"\";\n\n return {\n success: true,\n key: key,\n blob,\n name,\n status: response.status,\n };\n } catch (error) {\n return {\n success: false,\n key: key,\n status: 503,\n error: error instanceof Error ? error.message : \"Download failed\",\n };\n }\n });\n\n return await Promise.all(downloadPromises);\n }\n\n async getMetadata(functionKey: string, keys: string[]): Promise<GetMetadataResult[]> {\n if (!functionKey || functionKey.length === 0) {\n throw new BridgeAPIError('\"functionKey\" is required in store getMetadata.');\n }\n if (!Array.isArray(keys) || keys.length === 0) {\n throw new BridgeAPIError('\"keys\" is required and cannot be empty in store getMetadata.');\n }\n const results = await Promise.all(\n keys.map(async (key) => {\n const result = await invoke(functionKey, key);\n if (!result || typeof result !== \"object\") {\n return {\n key,\n error: \"Invalid response from functionKey\",\n };\n }\n return result;\n }),\n );\n\n return results;\n }\n\n async delete(functionKey: string, keys: string[]): Promise<void> {\n if (!functionKey || functionKey.length === 0) {\n throw new BridgeAPIError('\"functionKey\" is required in store delete.');\n }\n if (!Array.isArray(keys) || keys.length === 0) {\n throw new BridgeAPIError('\"keys\" is required and cannot be empty in store delete.');\n }\n await Promise.all(\n keys.map(async (key) => {\n await invoke(functionKey, key);\n }),\n );\n }\n}\n\nexport const store = new NexusObjectStore();\n\nexport function sha256(buffer: ArrayBuffer): ArrayBuffer {\n const bytes = new Uint8Array(buffer);\n const len = bytes.length;\n const blockSize = 64;\n const hashSize = 32;\n\n const K = new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be,\n 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa,\n 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85,\n 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,\n 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f,\n 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,\n ]);\n\n let h0 = 0x6a09e667,\n h1 = 0xbb67ae85,\n h2 = 0x3c6ef372,\n h3 = 0xa54ff53a;\n let h4 = 0x510e527f,\n h5 = 0x9b05688c,\n h6 = 0x1f83d9ab,\n h7 = 0x5be0cd19;\n\n const totalBits = BigInt(len) * 8n;\n const paddingLen = len % blockSize < 56 ? 56 - (len % blockSize) : 120 - (len % blockSize);\n const paddedLen = len + paddingLen + 8;\n const padded = new Uint8Array(paddedLen);\n padded.set(bytes);\n padded[len] = 0x80;\n\n const view = new DataView(padded.buffer, padded.byteOffset);\n view.setUint32(paddedLen - 4, Number((totalBits >> 32n) & 0xffffffffn));\n view.setUint32(paddedLen - 8, Number(totalBits & 0xffffffffn));\n\n for (let i = 0; i < paddedLen; i += blockSize) {\n const w = new Uint32Array(64);\n for (let j = 0; j < 16; j++) {\n w[j] = view.getUint32(i + j * 4);\n }\n\n for (let j = 16; j < 64; j++) {\n const s0 = ((w[j - 15] >>> 7) | (w[j - 15] << 25)) ^ ((w[j - 15] >>> 18) | (w[j - 15] << 14)) ^ (w[j - 15] >>> 3);\n const s1 = ((w[j - 2] >>> 17) | (w[j - 2] << 15)) ^ ((w[j - 2] >>> 19) | (w[j - 2] << 13)) ^ (w[j - 2] >>> 10);\n w[j] = (w[j - 16] + s0 + w[j - 7] + s1) >>> 0;\n }\n\n let a = h0,\n b = h1,\n c = h2,\n d = h3,\n e = h4,\n f = h5,\n g = h6,\n h = h7;\n\n for (let j = 0; j < 64; j++) {\n const S1 = ((e >>> 6) | (e << 26)) ^ ((e >>> 11) | (e << 21)) ^ ((e >>> 25) | (e << 7));\n const ch = (e & f) ^ (~e & g);\n const temp1 = (h + S1 + ch + K[j] + w[j]) >>> 0;\n const S0 = ((a >>> 2) | (a << 30)) ^ ((a >>> 13) | (a << 19)) ^ ((a >>> 22) | (a << 10));\n const maj = (a & b) ^ (a & c) ^ (b & c);\n const temp2 = (S0 + maj) >>> 0;\n\n h = g;\n g = f;\n f = e;\n e = (d + temp1) >>> 0;\n d = c;\n c = b;\n b = a;\n a = (temp1 + temp2) >>> 0;\n }\n\n h0 = (h0 + a) >>> 0;\n h1 = (h1 + b) >>> 0;\n h2 = (h2 + c) >>> 0;\n h3 = (h3 + d) >>> 0;\n h4 = (h4 + e) >>> 0;\n h5 = (h5 + f) >>> 0;\n h6 = (h6 + g) >>> 0;\n h7 = (h7 + h) >>> 0;\n }\n\n const result = new ArrayBuffer(hashSize);\n const resultView = new DataView(result);\n resultView.setUint32(0, h0);\n resultView.setUint32(4, h1);\n resultView.setUint32(8, h2);\n resultView.setUint32(12, h3);\n resultView.setUint32(16, h4);\n resultView.setUint32(20, h5);\n resultView.setUint32(24, h6);\n resultView.setUint32(28, h7);\n return result;\n}\n","import { NexusBridge } from \"./bridge\";\nimport { BridgeAPIError } from \"./error\";\nimport { RemoteInvokeOptions, RemoteRequestOptions, RemoteRequestResponseData, RequestApiResponseData } from \"./models\";\nimport {\n buildPayloadByRequestInit,\n buildRemoteRequestPayload,\n parseRemoteResponseData,\n parseToResponseData,\n validateFetchOptions,\n} from \"./utils/request\";\n\nclass NexusRemote {\n async invoke(options: RemoteInvokeOptions): Promise<Response> {\n if (!options || typeof options !== \"object\") {\n throw new BridgeAPIError('\"options\" must be an object in remote invoke.');\n }\n if (typeof options.path !== \"string\" || options.path.trim().length === 0) {\n throw new BridgeAPIError('\"path\" is required and cannot be empty in remote invoke options.');\n }\n\n const payload = await buildPayloadByRequestInit(options);\n const { status, headers, body } = await NexusBridge.call<RequestApiResponseData>(\"remoteInvoke\", payload);\n return parseToResponseData({ status, headers, body });\n }\n\n async request(remoteKey: string, options?: RemoteRequestOptions): Promise<Response> {\n if (typeof remoteKey !== \"string\" || remoteKey.trim().length === 0) {\n throw new BridgeAPIError('\"remoteKey\" is required and cannot be empty in remote request.');\n }\n if (options !== undefined && (!options || typeof options !== \"object\")) {\n throw new BridgeAPIError('\"options\" must be an object in remote request.');\n }\n\n const requestOptions = {\n path: \"\",\n ...validateFetchOptions(options),\n };\n const { path } = requestOptions;\n if (options !== undefined && (typeof path !== \"string\" || path.trim().length === 0)) {\n throw new BridgeAPIError('\"path\" is required and cannot be empty in remote request options.');\n }\n\n const payload = await buildRemoteRequestPayload(remoteKey, requestOptions);\n const response = await NexusBridge.call<RemoteRequestResponseData>(\"remoteRequest\", payload);\n return parseRemoteResponseData(response);\n }\n}\n\nexport const remote = new NexusRemote();\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAEM,SAAU,oBAAoB,CAAI,GAAW,EAAE,KAAQ,EAAA;AACxD,IAAA,MAAkB,CAAC,GAAG,CAAC,GAAG,KAAK;AACpC;AAEM,SAAU,mBAAmB,CAAI,GAAW,EAAA;AAC9C,IAAA,OAAQ,MAAkB,CAAC,GAAG,CAAC;AACnC;;ACSA,SAAS,SAAS,GAAA;AACd,IAAA,MAAM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A,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc;QAC/B,IAAI,OAAO,KAAK,SAAS,KAAK,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE;AACjF,YAAA,MAAM,IAAI,cAAc,CAAC,mEAAmE,CAAC;QACjG;QAEA,MAAM,OAAO,GAAG,MAAM,yBAAyB,CAAC,SAAS,EAAE,cAAc,CAAC;QAC1E,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,IAAI,CAA4B,eAAe,EAAE,OAAO,CAAC;AAC5F,QAAA,OAAO,uBAAuB,CAAC,QAAQ,CAAC;IAC5C;AACH;AAEM,MAAM,MAAM,GAAG,IAAI,WAAW;;AChDrC;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@pc-nexus/bridge",
3
- "version": "0.5.0-next.2",
3
+ "version": "0.5.0-next.20",
4
4
  "peerDependencies": {},
5
+ "dependencies": {
6
+ "@pc-nexus/models": "0.5.0-next.20",
7
+ "tslib": "^2.3.0"
8
+ },
5
9
  "sideEffects": false,
6
10
  "module": "fesm2022/pc-nexus-bridge.mjs",
7
11
  "typings": "types/pc-nexus-bridge.d.ts",
@@ -14,8 +18,5 @@
14
18
  "default": "./fesm2022/pc-nexus-bridge.mjs"
15
19
  }
16
20
  },
17
- "type": "module",
18
- "dependencies": {
19
- "tslib": "^2.3.0"
20
- }
21
+ "type": "module"
21
22
  }
@@ -1,5 +1,5 @@
1
- import { DialogOptions, DialogRef, DialogConfirmOptions, NavigationLocation, ExtensionData, NexusFullContext, NexusHistory, Subscription, NexusSupportedLocaleCode, GetTranslationsResult, Translator, NexusRequestInit } from '@pc-nexus/models';
2
- export { DialogConfirmOptions, DialogOptions, DialogRef, ExtensionData, GetTranslationsResult, HistoryAction, LocationDescriptor, NavigationLocation, NavigationTarget, NexusFullContext, NexusHistory, NexusRequestInit, NexusSupportedLocaleCode, Subscription, TranslationResourceContent, Translator, UnlistenCallback, ViewportSize } from '@pc-nexus/models';
1
+ import { DialogOptions, DialogRef, DialogConfirmOptions, NavigationLocation, ExtensionData, NexusFullContext, NexusHistory, Subscription, NexusSupportedLocaleCode, GetTranslationsResult, Translator, NexusRequestInit, UploadResult, DownloadResult, GetMetadataResult, RemoteInvokeOptions, RemoteRequestOptions } from '@pc-nexus/models';
2
+ export { DialogConfirmOptions, DialogOptions, DialogRef, DownloadResult, ExtensionData, GetMetadataResult, GetTranslationsResult, HistoryAction, LocationDescriptor, NavigationLocation, NavigationTarget, NexusFullContext, NexusHistory, NexusRequestInit, NexusSupportedLocaleCode, RemoteInvokeOptions, RemoteRequestOptions, Subscription, TranslationResourceContent, Translator, UnlistenCallback, UploadResult, ViewportSize } from '@pc-nexus/models';
3
3
 
4
4
  interface HostMessageEvent<T = unknown> {
5
5
  source: Window | null;
@@ -74,6 +74,24 @@ declare class NexusI18n {
74
74
  }
75
75
  declare const i18n: NexusI18n;
76
76
 
77
- declare function requestApi(path: string, options?: NexusRequestInit): Promise<Response>;
77
+ declare class NexusRestApi {
78
+ request(path: string, options?: NexusRequestInit): Promise<Response>;
79
+ }
80
+ declare const api: NexusRestApi;
81
+
82
+ type UploadInput = File | Blob;
83
+ declare class NexusObjectStore {
84
+ upload(functionKey: string, objects: UploadInput[]): Promise<UploadResult[]>;
85
+ download(functionKey: string, keys: string[]): Promise<DownloadResult[]>;
86
+ getMetadata(functionKey: string, keys: string[]): Promise<GetMetadataResult[]>;
87
+ delete(functionKey: string, keys: string[]): Promise<void>;
88
+ }
89
+ declare const store: NexusObjectStore;
90
+
91
+ declare class NexusRemote {
92
+ invoke(options: RemoteInvokeOptions): Promise<Response>;
93
+ request(remoteKey: string, options?: RemoteRequestOptions): Promise<Response>;
94
+ }
95
+ declare const remote: NexusRemote;
78
96
 
79
- export { dialog, events, i18n, invoke, requestApi, router, view, BridgeAPIError as ɵBridgeAPIError, NexusBridge as ɵNexusBridge };
97
+ export { api, dialog, events, i18n, invoke, remote, router, store, view, BridgeAPIError as ɵBridgeAPIError, NexusBridge as ɵNexusBridge };