@proveanything/smartlinks 1.8.3 → 1.8.4

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.
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.8.3 | Generated: 2026-03-14T10:31:32.637Z
3
+ Version: 1.8.4 | Generated: 2026-03-14T10:47:38.203Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
package/dist/http.js CHANGED
@@ -718,7 +718,7 @@ async function proxyStreamRequest(method, path, body, headers) {
718
718
  ensureProxyListener();
719
719
  const payloadBody = (typeof FormData !== 'undefined' && body instanceof FormData)
720
720
  ? serializeFormDataForProxy(body)
721
- : body;
721
+ : sanitizeForPostMessage(body);
722
722
  const id = generateProxyId();
723
723
  const streamController = createProxyStreamIterable(id);
724
724
  proxyStreamPending.set(id, streamController);
@@ -749,6 +749,53 @@ function serializeFormDataForProxy(fd) {
749
749
  });
750
750
  return { _isFormData: true, entries };
751
751
  }
752
+ function isAbortSignalLike(value) {
753
+ return !!value
754
+ && typeof value === 'object'
755
+ && 'aborted' in value
756
+ && 'addEventListener' in value
757
+ && 'removeEventListener' in value;
758
+ }
759
+ function sanitizeForPostMessage(value, seen = new WeakSet()) {
760
+ if (value == null)
761
+ return value;
762
+ const valueType = typeof value;
763
+ if (valueType === 'function' || valueType === 'symbol') {
764
+ return undefined;
765
+ }
766
+ if (valueType !== 'object') {
767
+ return value;
768
+ }
769
+ if (typeof Blob !== 'undefined' && value instanceof Blob) {
770
+ return value;
771
+ }
772
+ if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
773
+ return value;
774
+ }
775
+ if (ArrayBuffer.isView(value)) {
776
+ return value;
777
+ }
778
+ if (isAbortSignalLike(value)) {
779
+ return undefined;
780
+ }
781
+ if (seen.has(value)) {
782
+ return undefined;
783
+ }
784
+ seen.add(value);
785
+ if (Array.isArray(value)) {
786
+ return value
787
+ .map(item => sanitizeForPostMessage(item, seen))
788
+ .filter(item => item !== undefined);
789
+ }
790
+ const proto = Object.getPrototypeOf(value);
791
+ if (proto !== Object.prototype && proto !== null) {
792
+ return value;
793
+ }
794
+ const sanitizedEntries = Object.entries(value)
795
+ .map(([key, entryValue]) => [key, sanitizeForPostMessage(entryValue, seen)])
796
+ .filter(([, entryValue]) => entryValue !== undefined);
797
+ return Object.fromEntries(sanitizedEntries);
798
+ }
752
799
  function sanitizeProxyRequestOptions(options) {
753
800
  if (!options)
754
801
  return undefined;
@@ -766,7 +813,7 @@ async function proxyRequest(method, path, body, headers, options) {
766
813
  ensureProxyListener();
767
814
  const payloadBody = (typeof FormData !== 'undefined' && body instanceof FormData)
768
815
  ? serializeFormDataForProxy(body)
769
- : body;
816
+ : sanitizeForPostMessage(body);
770
817
  const id = generateProxyId();
771
818
  const msg = {
772
819
  _smartlinksProxyRequest: true,
@@ -1443,7 +1490,7 @@ export async function sendCustomProxyMessage(request, params) {
1443
1490
  _smartlinksCustomProxyRequest: true,
1444
1491
  id,
1445
1492
  request,
1446
- params,
1493
+ params: sanitizeForPostMessage(params),
1447
1494
  };
1448
1495
  logDebug('[smartlinks] proxy:custom postMessage', { id, request, params: safeBodyPreview(params) });
1449
1496
  return new Promise((resolve, reject) => {
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.8.3 | Generated: 2026-03-14T10:31:32.637Z
3
+ Version: 1.8.4 | Generated: 2026-03-14T10:47:38.203Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.8.3",
3
+ "version": "1.8.4",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",