@cerefox/memory 1.0.0-rc.4 → 1.0.1-beta.1

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.
@@ -7184,7 +7184,7 @@ var exports_meta = {};
7184
7184
  __export(exports_meta, {
7185
7185
  PKG_VERSION: () => PKG_VERSION
7186
7186
  });
7187
- var PKG_VERSION = "1.0.0-rc.4";
7187
+ var PKG_VERSION = "1.0.1-beta.1";
7188
7188
  var init_meta = () => {};
7189
7189
 
7190
7190
  // ../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.js
@@ -7792,7 +7792,7 @@ var require_tslib = __commonJS((exports, module) => {
7792
7792
  });
7793
7793
  });
7794
7794
 
7795
- // ../../node_modules/.bun/@supabase+functions-js@2.110.2/node_modules/@supabase/functions-js/dist/main/helper.js
7795
+ // ../../node_modules/.bun/@supabase+functions-js@2.110.7/node_modules/@supabase/functions-js/dist/main/helper.js
7796
7796
  var require_helper = __commonJS((exports) => {
7797
7797
  Object.defineProperty(exports, "__esModule", { value: true });
7798
7798
  exports.resolveFetch = undefined;
@@ -7805,7 +7805,7 @@ var require_helper = __commonJS((exports) => {
7805
7805
  exports.resolveFetch = resolveFetch;
7806
7806
  });
7807
7807
 
7808
- // ../../node_modules/.bun/@supabase+functions-js@2.110.2/node_modules/@supabase/functions-js/dist/main/types.js
7808
+ // ../../node_modules/.bun/@supabase+functions-js@2.110.7/node_modules/@supabase/functions-js/dist/main/types.js
7809
7809
  var require_types = __commonJS((exports) => {
7810
7810
  Object.defineProperty(exports, "__esModule", { value: true });
7811
7811
  exports.FunctionRegion = exports.FunctionsHttpError = exports.FunctionsRelayError = exports.FunctionsFetchError = exports.FunctionsError = undefined;
@@ -7866,7 +7866,7 @@ var require_types = __commonJS((exports) => {
7866
7866
  })(FunctionRegion || (exports.FunctionRegion = FunctionRegion = {}));
7867
7867
  });
7868
7868
 
7869
- // ../../node_modules/.bun/@supabase+functions-js@2.110.2/node_modules/@supabase/functions-js/dist/main/FunctionsClient.js
7869
+ // ../../node_modules/.bun/@supabase+functions-js@2.110.7/node_modules/@supabase/functions-js/dist/main/FunctionsClient.js
7870
7870
  var require_FunctionsClient = __commonJS((exports) => {
7871
7871
  Object.defineProperty(exports, "__esModule", { value: true });
7872
7872
  exports.FunctionsClient = undefined;
@@ -7980,7 +7980,7 @@ var require_FunctionsClient = __commonJS((exports) => {
7980
7980
  exports.FunctionsClient = FunctionsClient;
7981
7981
  });
7982
7982
 
7983
- // ../../node_modules/.bun/@supabase+functions-js@2.110.2/node_modules/@supabase/functions-js/dist/main/index.js
7983
+ // ../../node_modules/.bun/@supabase+functions-js@2.110.7/node_modules/@supabase/functions-js/dist/main/index.js
7984
7984
  var require_main = __commonJS((exports) => {
7985
7985
  Object.defineProperty(exports, "__esModule", { value: true });
7986
7986
  exports.FunctionRegion = exports.FunctionsRelayError = exports.FunctionsHttpError = exports.FunctionsFetchError = exports.FunctionsError = exports.FunctionsClient = undefined;
@@ -8006,7 +8006,7 @@ var require_main = __commonJS((exports) => {
8006
8006
  } });
8007
8007
  });
8008
8008
 
8009
- // ../../node_modules/.bun/@supabase+postgrest-js@2.110.2/node_modules/@supabase/postgrest-js/dist/index.mjs
8009
+ // ../../node_modules/.bun/@supabase+postgrest-js@2.110.7/node_modules/@supabase/postgrest-js/dist/index.mjs
8010
8010
  function sleep(ms, signal) {
8011
8011
  return new Promise((resolve) => {
8012
8012
  if (signal === null || signal === undefined ? undefined : signal.aborted) {
@@ -8817,7 +8817,7 @@ var init_dist = __esm(() => {
8817
8817
  };
8818
8818
  });
8819
8819
 
8820
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.js
8820
+ // ../../node_modules/.bun/@supabase+realtime-js@2.110.7/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.js
8821
8821
  var require_websocket_factory = __commonJS((exports) => {
8822
8822
  Object.defineProperty(exports, "__esModule", { value: true });
8823
8823
  exports.WebSocketFactory = undefined;
@@ -8894,14 +8894,14 @@ Suggested solution: ${env.workaround}`;
8894
8894
  exports.default = WebSocketFactory;
8895
8895
  });
8896
8896
 
8897
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/lib/version.js
8897
+ // ../../node_modules/.bun/@supabase+realtime-js@2.110.7/node_modules/@supabase/realtime-js/dist/main/lib/version.js
8898
8898
  var require_version = __commonJS((exports) => {
8899
8899
  Object.defineProperty(exports, "__esModule", { value: true });
8900
8900
  exports.version = undefined;
8901
- exports.version = "2.110.2";
8901
+ exports.version = "2.110.7";
8902
8902
  });
8903
8903
 
8904
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/lib/constants.js
8904
+ // ../../node_modules/.bun/@supabase+realtime-js@2.110.7/node_modules/@supabase/realtime-js/dist/main/lib/constants.js
8905
8905
  var require_constants = __commonJS((exports) => {
8906
8906
  Object.defineProperty(exports, "__esModule", { value: true });
8907
8907
  exports.CONNECTION_STATE = exports.TRANSPORTS = exports.CHANNEL_EVENTS = exports.CHANNEL_STATES = exports.SOCKET_STATES = exports.MAX_PUSH_BUFFER_SIZE = exports.WS_CLOSE_NORMAL = exports.DEFAULT_TIMEOUT = exports.VERSION = exports.DEFAULT_VSN = exports.VSN_2_0_0 = exports.VSN_1_0_0 = exports.DEFAULT_VERSION = undefined;
@@ -8946,7 +8946,7 @@ var require_constants = __commonJS((exports) => {
8946
8946
  };
8947
8947
  });
8948
8948
 
8949
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/lib/serializer.js
8949
+ // ../../node_modules/.bun/@supabase+realtime-js@2.110.7/node_modules/@supabase/realtime-js/dist/main/lib/serializer.js
8950
8950
  var require_serializer = __commonJS((exports) => {
8951
8951
  Object.defineProperty(exports, "__esModule", { value: true });
8952
8952
 
@@ -8990,12 +8990,13 @@ var require_serializer = __commonJS((exports) => {
8990
8990
  }
8991
8991
  _encodeUserBroadcastPush(message, encodingType, encodedPayload) {
8992
8992
  var _a, _b;
8993
- const topic = message.topic;
8994
- const ref = (_a = message.ref) !== null && _a !== undefined ? _a : "";
8995
- const joinRef = (_b = message.join_ref) !== null && _b !== undefined ? _b : "";
8996
- const userEvent = message.payload.event;
8993
+ const encoder = new TextEncoder;
8994
+ const topic = encoder.encode(message.topic);
8995
+ const ref = encoder.encode((_a = message.ref) !== null && _a !== undefined ? _a : "");
8996
+ const joinRef = encoder.encode((_b = message.join_ref) !== null && _b !== undefined ? _b : "");
8997
+ const userEvent = encoder.encode(message.payload.event);
8997
8998
  const rest = this.allowedMetadataKeys ? this._pick(message.payload, this.allowedMetadataKeys) : {};
8998
- const metadata = Object.keys(rest).length === 0 ? "" : JSON.stringify(rest);
8999
+ const metadata = encoder.encode(Object.keys(rest).length === 0 ? "" : JSON.stringify(rest));
8999
9000
  if (joinRef.length > 255) {
9000
9001
  throw new Error(`joinRef length ${joinRef.length} exceeds maximum of 255`);
9001
9002
  }
@@ -9013,7 +9014,8 @@ var require_serializer = __commonJS((exports) => {
9013
9014
  }
9014
9015
  const metaLength = this.USER_BROADCAST_PUSH_META_LENGTH + joinRef.length + ref.length + topic.length + userEvent.length + metadata.length;
9015
9016
  const header = new ArrayBuffer(this.HEADER_LENGTH + metaLength);
9016
- let view = new DataView(header);
9017
+ const view = new DataView(header);
9018
+ const bytes = new Uint8Array(header);
9017
9019
  let offset = 0;
9018
9020
  view.setUint8(offset++, this.KINDS.userBroadcastPush);
9019
9021
  view.setUint8(offset++, joinRef.length);
@@ -9022,11 +9024,16 @@ var require_serializer = __commonJS((exports) => {
9022
9024
  view.setUint8(offset++, userEvent.length);
9023
9025
  view.setUint8(offset++, metadata.length);
9024
9026
  view.setUint8(offset++, encodingType);
9025
- Array.from(joinRef, (char) => view.setUint8(offset++, char.charCodeAt(0)));
9026
- Array.from(ref, (char) => view.setUint8(offset++, char.charCodeAt(0)));
9027
- Array.from(topic, (char) => view.setUint8(offset++, char.charCodeAt(0)));
9028
- Array.from(userEvent, (char) => view.setUint8(offset++, char.charCodeAt(0)));
9029
- Array.from(metadata, (char) => view.setUint8(offset++, char.charCodeAt(0)));
9027
+ bytes.set(joinRef, offset);
9028
+ offset += joinRef.length;
9029
+ bytes.set(ref, offset);
9030
+ offset += ref.length;
9031
+ bytes.set(topic, offset);
9032
+ offset += topic.length;
9033
+ bytes.set(userEvent, offset);
9034
+ offset += userEvent.length;
9035
+ bytes.set(metadata, offset);
9036
+ offset += metadata.length;
9030
9037
  var combined = new Uint8Array(header.byteLength + encodedPayload.byteLength);
9031
9038
  combined.set(new Uint8Array(header), 0);
9032
9039
  combined.set(new Uint8Array(encodedPayload), header.byteLength);
@@ -9091,7 +9098,7 @@ var require_serializer = __commonJS((exports) => {
9091
9098
  exports.default = Serializer;
9092
9099
  });
9093
9100
 
9094
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/lib/transformers.js
9101
+ // ../../node_modules/.bun/@supabase+realtime-js@2.110.7/node_modules/@supabase/realtime-js/dist/main/lib/transformers.js
9095
9102
  var require_transformers = __commonJS((exports) => {
9096
9103
  Object.defineProperty(exports, "__esModule", { value: true });
9097
9104
  exports.httpEndpointURL = exports.toTimestampString = exports.toArray = exports.toJson = exports.toNumber = exports.toBoolean = exports.convertCell = exports.convertColumn = exports.convertChangeData = exports.PostgresTypes = undefined;
@@ -9260,7 +9267,7 @@ var require_transformers = __commonJS((exports) => {
9260
9267
  exports.httpEndpointURL = httpEndpointURL;
9261
9268
  });
9262
9269
 
9263
- // ../../node_modules/.bun/@supabase+phoenix@0.4.4/node_modules/@supabase/phoenix/priv/static/phoenix.cjs.js
9270
+ // ../../node_modules/.bun/@supabase+phoenix@0.4.5/node_modules/@supabase/phoenix/priv/static/phoenix.cjs.js
9264
9271
  var require_phoenix_cjs = __commonJS((exports, module) => {
9265
9272
  var __defProp2 = Object.defineProperty;
9266
9273
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -9306,6 +9313,7 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
9306
9313
  var DEFAULT_VSN = "2.0.0";
9307
9314
  var DEFAULT_TIMEOUT = 1e4;
9308
9315
  var WS_CLOSE_NORMAL = 1000;
9316
+ var MAX_LONGPOLL_BATCH_SIZE = 100;
9309
9317
  var SOCKET_STATES = { connecting: 0, open: 1, closing: 2, closed: 3 };
9310
9318
  var CHANNEL_STATES = {
9311
9319
  closed: "closed",
@@ -9848,17 +9856,23 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
9848
9856
  }, 0);
9849
9857
  }
9850
9858
  }
9851
- batchSend(messages) {
9859
+ batchSend(messages, offset = 0) {
9852
9860
  this.awaitingBatchAck = true;
9853
- this.ajax("POST", { "Content-Type": "application/x-ndjson" }, messages.join(`
9861
+ const next = offset + MAX_LONGPOLL_BATCH_SIZE;
9862
+ const batch = messages.slice(offset, next);
9863
+ this.ajax("POST", { "Content-Type": "application/x-ndjson" }, batch.join(`
9854
9864
  `), () => this.onerror("timeout"), (resp) => {
9855
- this.awaitingBatchAck = false;
9856
9865
  if (!resp || resp.status !== 200) {
9866
+ this.awaitingBatchAck = false;
9857
9867
  this.onerror(resp && resp.status);
9858
9868
  this.closeAndRetry(1011, "internal server error", false);
9869
+ } else if (next < messages.length) {
9870
+ this.batchSend(messages, next);
9859
9871
  } else if (this.batchBuffer.length > 0) {
9860
9872
  this.batchSend(this.batchBuffer);
9861
9873
  this.batchBuffer = [];
9874
+ } else {
9875
+ this.awaitingBatchAck = false;
9862
9876
  }
9863
9877
  });
9864
9878
  }
@@ -9895,7 +9909,7 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
9895
9909
  var Presence = class _Presence {
9896
9910
  constructor(channel, opts = {}) {
9897
9911
  let events = opts.events || { state: "presence_state", diff: "presence_diff" };
9898
- this.state = {};
9912
+ this.state = /* @__PURE__ */ Object.create(null);
9899
9913
  this.pendingDiffs = [];
9900
9914
  this.channel = channel;
9901
9915
  this.joinRef = null;
@@ -9940,9 +9954,10 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
9940
9954
  return !this.joinRef || this.joinRef !== this.channel.joinRef();
9941
9955
  }
9942
9956
  static syncState(currentState, newState, onJoin, onLeave) {
9943
- let state = this.clone(currentState);
9944
- let joins = {};
9945
- let leaves = {};
9957
+ let state = this.toNullProtoObj(this.clone(currentState));
9958
+ newState = this.toNullProtoObj(newState);
9959
+ let joins = /* @__PURE__ */ Object.create(null);
9960
+ let leaves = /* @__PURE__ */ Object.create(null);
9946
9961
  this.map(state, (key, presence) => {
9947
9962
  if (!newState[key]) {
9948
9963
  leaves[key] = presence;
@@ -9970,6 +9985,7 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
9970
9985
  return this.syncDiff(state, { joins, leaves }, onJoin, onLeave);
9971
9986
  }
9972
9987
  static syncDiff(state, diff, onJoin, onLeave) {
9988
+ state = this.toNullProtoObj(state);
9973
9989
  let { joins, leaves } = this.clone(diff);
9974
9990
  if (!onJoin) {
9975
9991
  onJoin = function() {};
@@ -10016,6 +10032,16 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
10016
10032
  static map(obj2, func) {
10017
10033
  return Object.getOwnPropertyNames(obj2).map((key) => func(key, obj2[key]));
10018
10034
  }
10035
+ static toNullProtoObj(obj2) {
10036
+ if (Object.getPrototypeOf(obj2) === null) {
10037
+ return obj2;
10038
+ }
10039
+ let cleaned = /* @__PURE__ */ Object.create(null);
10040
+ Object.getOwnPropertyNames(obj2).forEach((key) => {
10041
+ cleaned[key] = obj2[key];
10042
+ });
10043
+ return cleaned;
10044
+ }
10019
10045
  static clone(obj2) {
10020
10046
  return JSON.parse(JSON.stringify(obj2));
10021
10047
  }
@@ -10042,24 +10068,43 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
10042
10068
  },
10043
10069
  binaryEncode(message) {
10044
10070
  let { join_ref, ref, event, topic, payload } = message;
10045
- let metaLength = this.META_LENGTH + join_ref.length + ref.length + topic.length + event.length;
10071
+ let encoder = new TextEncoder;
10072
+ let joinRefBytes = encoder.encode(join_ref);
10073
+ let refBytes = encoder.encode(ref);
10074
+ let topicBytes = encoder.encode(topic);
10075
+ let eventBytes = encoder.encode(event);
10076
+ this.assertFieldSize(joinRefBytes.byteLength, "join_ref");
10077
+ this.assertFieldSize(refBytes.byteLength, "ref");
10078
+ this.assertFieldSize(topicBytes.byteLength, "topic");
10079
+ this.assertFieldSize(eventBytes.byteLength, "event");
10080
+ let metaLength = this.META_LENGTH + joinRefBytes.byteLength + refBytes.byteLength + topicBytes.byteLength + eventBytes.byteLength;
10046
10081
  let header = new ArrayBuffer(this.HEADER_LENGTH + metaLength);
10082
+ let headerBytes = new Uint8Array(header);
10047
10083
  let view = new DataView(header);
10048
10084
  let offset = 0;
10049
10085
  view.setUint8(offset++, this.KINDS.push);
10050
- view.setUint8(offset++, join_ref.length);
10051
- view.setUint8(offset++, ref.length);
10052
- view.setUint8(offset++, topic.length);
10053
- view.setUint8(offset++, event.length);
10054
- Array.from(join_ref, (char) => view.setUint8(offset++, char.charCodeAt(0)));
10055
- Array.from(ref, (char) => view.setUint8(offset++, char.charCodeAt(0)));
10056
- Array.from(topic, (char) => view.setUint8(offset++, char.charCodeAt(0)));
10057
- Array.from(event, (char) => view.setUint8(offset++, char.charCodeAt(0)));
10086
+ view.setUint8(offset++, joinRefBytes.byteLength);
10087
+ view.setUint8(offset++, refBytes.byteLength);
10088
+ view.setUint8(offset++, topicBytes.byteLength);
10089
+ view.setUint8(offset++, eventBytes.byteLength);
10090
+ headerBytes.set(joinRefBytes, offset);
10091
+ offset += joinRefBytes.byteLength;
10092
+ headerBytes.set(refBytes, offset);
10093
+ offset += refBytes.byteLength;
10094
+ headerBytes.set(topicBytes, offset);
10095
+ offset += topicBytes.byteLength;
10096
+ headerBytes.set(eventBytes, offset);
10097
+ offset += eventBytes.byteLength;
10058
10098
  var combined = new Uint8Array(header.byteLength + payload.byteLength);
10059
- combined.set(new Uint8Array(header), 0);
10099
+ combined.set(headerBytes, 0);
10060
10100
  combined.set(new Uint8Array(payload), header.byteLength);
10061
10101
  return combined.buffer;
10062
10102
  },
10103
+ assertFieldSize(size, name) {
10104
+ if (size > 255) {
10105
+ throw new Error(`unable to convert ${name} to binary: must be less than or equal to 255 bytes, but is ${size} bytes`);
10106
+ }
10107
+ },
10063
10108
  binaryDecode(buffer) {
10064
10109
  let view = new DataView(buffer);
10065
10110
  let kind = view.getUint8(0);
@@ -10220,7 +10265,7 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
10220
10265
  this.connect();
10221
10266
  });
10222
10267
  }, this.reconnectAfterMs);
10223
- this.authToken = opts.authToken;
10268
+ this.authToken = opts.authToken && closure(opts.authToken);
10224
10269
  }
10225
10270
  getLongPollTransport() {
10226
10271
  return LongPoll;
@@ -10331,7 +10376,7 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
10331
10376
  this.closeWasClean = false;
10332
10377
  let protocols = undefined;
10333
10378
  if (this.authToken) {
10334
- protocols = ["phoenix", `${AUTH_TOKEN_PREFIX}${btoa(this.authToken).replace(/=/g, "")}`];
10379
+ protocols = ["phoenix", `${AUTH_TOKEN_PREFIX}${btoa(this.authToken()).replace(/=/g, "")}`];
10335
10380
  }
10336
10381
  this.conn = new this.transport(this.endPointURL(), protocols);
10337
10382
  this.conn.binaryType = this.binaryType;
@@ -10638,7 +10683,7 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
10638
10683
  };
10639
10684
  });
10640
10685
 
10641
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.js
10686
+ // ../../node_modules/.bun/@supabase+realtime-js@2.110.7/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.js
10642
10687
  var require_presenceAdapter = __commonJS((exports) => {
10643
10688
  Object.defineProperty(exports, "__esModule", { value: true });
10644
10689
  var phoenix_1 = require_phoenix_cjs();
@@ -10711,7 +10756,7 @@ var require_presenceAdapter = __commonJS((exports) => {
10711
10756
  }
10712
10757
  });
10713
10758
 
10714
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.js
10759
+ // ../../node_modules/.bun/@supabase+realtime-js@2.110.7/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.js
10715
10760
  var require_RealtimePresence = __commonJS((exports) => {
10716
10761
  Object.defineProperty(exports, "__esModule", { value: true });
10717
10762
  exports.REALTIME_PRESENCE_LISTEN_EVENTS = undefined;
@@ -10736,7 +10781,7 @@ var require_RealtimePresence = __commonJS((exports) => {
10736
10781
  exports.default = RealtimePresence;
10737
10782
  });
10738
10783
 
10739
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.js
10784
+ // ../../node_modules/.bun/@supabase+realtime-js@2.110.7/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.js
10740
10785
  var require_normalizeChannelError = __commonJS((exports) => {
10741
10786
  Object.defineProperty(exports, "__esModule", { value: true });
10742
10787
  exports.normalizeChannelError = normalizeChannelError;
@@ -10759,7 +10804,7 @@ var require_normalizeChannelError = __commonJS((exports) => {
10759
10804
  }
10760
10805
  });
10761
10806
 
10762
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.js
10807
+ // ../../node_modules/.bun/@supabase+realtime-js@2.110.7/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.js
10763
10808
  var require_channelAdapter = __commonJS((exports) => {
10764
10809
  Object.defineProperty(exports, "__esModule", { value: true });
10765
10810
  var constants_1 = require_constants();
@@ -10861,7 +10906,7 @@ var require_channelAdapter = __commonJS((exports) => {
10861
10906
  }
10862
10907
  });
10863
10908
 
10864
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/RealtimePostgresFilterBuilder.js
10909
+ // ../../node_modules/.bun/@supabase+realtime-js@2.110.7/node_modules/@supabase/realtime-js/dist/main/RealtimePostgresFilterBuilder.js
10865
10910
  var require_RealtimePostgresFilterBuilder = __commonJS((exports) => {
10866
10911
  Object.defineProperty(exports, "__esModule", { value: true });
10867
10912
  exports.postgresChangesFilter = exports.RealtimePostgresFilterBuilder = undefined;
@@ -10951,7 +10996,7 @@ var require_RealtimePostgresFilterBuilder = __commonJS((exports) => {
10951
10996
  exports.postgresChangesFilter = postgresChangesFilter;
10952
10997
  });
10953
10998
 
10954
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.js
10999
+ // ../../node_modules/.bun/@supabase+realtime-js@2.110.7/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.js
10955
11000
  var require_RealtimeChannel = __commonJS((exports) => {
10956
11001
  Object.defineProperty(exports, "__esModule", { value: true });
10957
11002
  exports.REALTIME_CHANNEL_STATES = exports.REALTIME_SUBSCRIBE_STATES = exports.REALTIME_LISTEN_TYPES = exports.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT = exports.postgresChangesFilter = exports.RealtimePostgresFilterBuilder = undefined;
@@ -11111,7 +11156,7 @@ var require_RealtimeChannel = __commonJS((exports) => {
11111
11156
  type: "presence",
11112
11157
  event: "track",
11113
11158
  payload
11114
- }, opts.timeout || this.timeout);
11159
+ }, opts);
11115
11160
  }
11116
11161
  async untrack(opts = {}) {
11117
11162
  return await this.send({
@@ -11341,7 +11386,7 @@ var require_RealtimeChannel = __commonJS((exports) => {
11341
11386
  exports.default = RealtimeChannel;
11342
11387
  });
11343
11388
 
11344
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.js
11389
+ // ../../node_modules/.bun/@supabase+realtime-js@2.110.7/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.js
11345
11390
  var require_socketAdapter = __commonJS((exports) => {
11346
11391
  Object.defineProperty(exports, "__esModule", { value: true });
11347
11392
  var phoenix_1 = require_phoenix_cjs();
@@ -11454,7 +11499,7 @@ var require_socketAdapter = __commonJS((exports) => {
11454
11499
  exports.default = SocketAdapter;
11455
11500
  });
11456
11501
 
11457
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.js
11502
+ // ../../node_modules/.bun/@supabase+realtime-js@2.110.7/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.js
11458
11503
  var require_RealtimeClient = __commonJS((exports) => {
11459
11504
  Object.defineProperty(exports, "__esModule", { value: true });
11460
11505
  var tslib_1 = require_tslib();
@@ -11907,7 +11952,7 @@ var require_RealtimeClient = __commonJS((exports) => {
11907
11952
  exports.default = RealtimeClient;
11908
11953
  });
11909
11954
 
11910
- // ../../node_modules/.bun/@supabase+realtime-js@2.110.2/node_modules/@supabase/realtime-js/dist/main/index.js
11955
+ // ../../node_modules/.bun/@supabase+realtime-js@2.110.7/node_modules/@supabase/realtime-js/dist/main/index.js
11911
11956
  var require_main2 = __commonJS((exports) => {
11912
11957
  Object.defineProperty(exports, "__esModule", { value: true });
11913
11958
  exports.WebSocketFactory = exports.REALTIME_CHANNEL_STATES = exports.REALTIME_SUBSCRIBE_STATES = exports.REALTIME_PRESENCE_LISTEN_EVENTS = exports.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT = exports.REALTIME_LISTEN_TYPES = exports.postgresChangesFilter = exports.RealtimePostgresFilterBuilder = exports.RealtimeClient = exports.RealtimeChannel = exports.RealtimePresence = undefined;
@@ -12243,7 +12288,7 @@ var init_dist2 = __esm(() => {
12243
12288
  };
12244
12289
  });
12245
12290
 
12246
- // ../../node_modules/.bun/@supabase+storage-js@2.110.2/node_modules/@supabase/storage-js/dist/index.mjs
12291
+ // ../../node_modules/.bun/@supabase+storage-js@2.110.7/node_modules/@supabase/storage-js/dist/index.mjs
12247
12292
  function _typeof2(o) {
12248
12293
  "@babel/helpers - typeof";
12249
12294
  return _typeof2 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o$1) {
@@ -12551,7 +12596,7 @@ var StorageError, StorageApiError, StorageUnknownError, resolveFetch = (customFe
12551
12596
  throw error;
12552
12597
  }
12553
12598
  }
12554
- }, DEFAULT_SEARCH_OPTIONS, DEFAULT_FILE_OPTIONS, StorageFileApi, version = "2.110.2", DEFAULT_HEADERS, StorageBucketApi, StorageAnalyticsClient, VectorIndexApi, VectorDataApi, VectorBucketApi, StorageVectorsClient, VectorBucketScope, VectorIndexScope, StorageClient;
12599
+ }, DEFAULT_SEARCH_OPTIONS, DEFAULT_FILE_OPTIONS, StorageFileApi, version = "2.110.7", DEFAULT_HEADERS, StorageBucketApi, StorageAnalyticsClient, VectorIndexApi, VectorDataApi, VectorBucketApi, StorageVectorsClient, VectorBucketScope, VectorIndexScope, StorageClient;
12555
12600
  var init_dist3 = __esm(() => {
12556
12601
  init_dist2();
12557
12602
  StorageError = class extends Error {
@@ -13284,14 +13329,14 @@ var init_dist3 = __esm(() => {
13284
13329
  };
13285
13330
  });
13286
13331
 
13287
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/version.js
13332
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/lib/version.js
13288
13333
  var require_version2 = __commonJS((exports) => {
13289
13334
  Object.defineProperty(exports, "__esModule", { value: true });
13290
13335
  exports.version = undefined;
13291
- exports.version = "2.110.2";
13336
+ exports.version = "2.110.7";
13292
13337
  });
13293
13338
 
13294
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/constants.js
13339
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/lib/constants.js
13295
13340
  var require_constants2 = __commonJS((exports) => {
13296
13341
  Object.defineProperty(exports, "__esModule", { value: true });
13297
13342
  exports.JWKS_TTL = exports.BASE64URL_REGEX = exports.API_VERSIONS = exports.API_VERSION_HEADER_NAME = exports.NETWORK_FAILURE = exports.DEFAULT_HEADERS = exports.AUDIENCE = exports.STORAGE_KEY = exports.GOTRUE_URL = exports.REFRESH_FAILURE_COOLDOWN_MS = exports.EXPIRY_MARGIN_MS = exports.AUTO_REFRESH_TICK_THRESHOLD = exports.AUTO_REFRESH_TICK_DURATION_MS = undefined;
@@ -13319,7 +13364,7 @@ var require_constants2 = __commonJS((exports) => {
13319
13364
  exports.JWKS_TTL = 10 * 60 * 1000;
13320
13365
  });
13321
13366
 
13322
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/errors.js
13367
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/lib/errors.js
13323
13368
  var require_errors = __commonJS((exports) => {
13324
13369
  Object.defineProperty(exports, "__esModule", { value: true });
13325
13370
  exports.AuthInvalidJwtError = exports.AuthWeakPasswordError = exports.AuthRefreshDiscardedError = exports.AuthRetryableFetchError = exports.AuthPKCECodeVerifierMissingError = exports.AuthPKCEGrantCodeExchangeError = exports.AuthImplicitGrantRedirectError = exports.AuthInvalidCredentialsError = exports.AuthInvalidTokenResponseError = exports.AuthSessionMissingError = exports.CustomAuthError = exports.AuthUnknownError = exports.AuthApiError = exports.AuthError = undefined;
@@ -13488,7 +13533,7 @@ var require_errors = __commonJS((exports) => {
13488
13533
  exports.AuthInvalidJwtError = AuthInvalidJwtError;
13489
13534
  });
13490
13535
 
13491
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/base64url.js
13536
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/lib/base64url.js
13492
13537
  var require_base64url = __commonJS((exports) => {
13493
13538
  Object.defineProperty(exports, "__esModule", { value: true });
13494
13539
  exports.byteToBase64URL = byteToBase64URL;
@@ -13676,7 +13721,7 @@ var require_base64url = __commonJS((exports) => {
13676
13721
  }
13677
13722
  });
13678
13723
 
13679
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/helpers.js
13724
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/lib/helpers.js
13680
13725
  var require_helpers = __commonJS((exports) => {
13681
13726
  Object.defineProperty(exports, "__esModule", { value: true });
13682
13727
  exports.Deferred = exports.removeItemAsync = exports.getItemAsync = exports.setItemAsync = exports.looksLikeFetchResponse = exports.resolveFetch = exports.supportsLocalStorage = exports.isBrowser = undefined;
@@ -13991,7 +14036,7 @@ var require_helpers = __commonJS((exports) => {
13991
14036
  }
13992
14037
  });
13993
14038
 
13994
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/fetch.js
14039
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/lib/fetch.js
13995
14040
  var require_fetch = __commonJS((exports) => {
13996
14041
  Object.defineProperty(exports, "__esModule", { value: true });
13997
14042
  exports.handleError = handleError2;
@@ -14173,14 +14218,14 @@ var require_fetch = __commonJS((exports) => {
14173
14218
  }
14174
14219
  });
14175
14220
 
14176
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/types.js
14221
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/lib/types.js
14177
14222
  var require_types2 = __commonJS((exports) => {
14178
14223
  Object.defineProperty(exports, "__esModule", { value: true });
14179
14224
  exports.SIGN_OUT_SCOPES = undefined;
14180
14225
  exports.SIGN_OUT_SCOPES = ["global", "local", "others"];
14181
14226
  });
14182
14227
 
14183
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.js
14228
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.js
14184
14229
  var require_GoTrueAdminApi = __commonJS((exports) => {
14185
14230
  Object.defineProperty(exports, "__esModule", { value: true });
14186
14231
  var tslib_1 = require_tslib();
@@ -14627,7 +14672,7 @@ var require_GoTrueAdminApi = __commonJS((exports) => {
14627
14672
  exports.default = GoTrueAdminApi;
14628
14673
  });
14629
14674
 
14630
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/local-storage.js
14675
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/lib/local-storage.js
14631
14676
  var require_local_storage = __commonJS((exports) => {
14632
14677
  Object.defineProperty(exports, "__esModule", { value: true });
14633
14678
  exports.memoryLocalStorageAdapter = memoryLocalStorageAdapter;
@@ -14646,7 +14691,7 @@ var require_local_storage = __commonJS((exports) => {
14646
14691
  }
14647
14692
  });
14648
14693
 
14649
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/locks.js
14694
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/lib/locks.js
14650
14695
  var require_locks = __commonJS((exports) => {
14651
14696
  Object.defineProperty(exports, "__esModule", { value: true });
14652
14697
  exports.ProcessLockAcquireTimeoutError = exports.NavigatorLockAcquireTimeoutError = exports.LockAcquireTimeoutError = exports.internals = undefined;
@@ -14820,7 +14865,7 @@ var require_locks = __commonJS((exports) => {
14820
14865
  }
14821
14866
  });
14822
14867
 
14823
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/polyfills.js
14868
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/lib/polyfills.js
14824
14869
  var require_polyfills = __commonJS((exports) => {
14825
14870
  Object.defineProperty(exports, "__esModule", { value: true });
14826
14871
  exports.polyfillGlobalThis = polyfillGlobalThis;
@@ -14844,7 +14889,7 @@ var require_polyfills = __commonJS((exports) => {
14844
14889
  }
14845
14890
  });
14846
14891
 
14847
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.js
14892
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.js
14848
14893
  var require_ethereum = __commonJS((exports) => {
14849
14894
  Object.defineProperty(exports, "__esModule", { value: true });
14850
14895
  exports.getAddress = getAddress;
@@ -14921,7 +14966,7 @@ ${suffix}`;
14921
14966
  }
14922
14967
  });
14923
14968
 
14924
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.js
14969
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.js
14925
14970
  var require_webauthn_errors = __commonJS((exports) => {
14926
14971
  Object.defineProperty(exports, "__esModule", { value: true });
14927
14972
  exports.WebAuthnUnknownError = exports.WebAuthnError = undefined;
@@ -15108,7 +15153,7 @@ var require_webauthn_errors = __commonJS((exports) => {
15108
15153
  }
15109
15154
  });
15110
15155
 
15111
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/lib/webauthn.js
15156
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/lib/webauthn.js
15112
15157
  var require_webauthn = __commonJS((exports) => {
15113
15158
  Object.defineProperty(exports, "__esModule", { value: true });
15114
15159
  exports.WebAuthnApi = exports.DEFAULT_REQUEST_OPTIONS = exports.DEFAULT_CREATION_OPTIONS = exports.webAuthnAbortService = exports.WebAuthnAbortService = exports.identifyAuthenticationError = exports.identifyRegistrationError = exports.isWebAuthnError = exports.WebAuthnError = undefined;
@@ -15562,7 +15607,7 @@ var require_webauthn = __commonJS((exports) => {
15562
15607
  exports.WebAuthnApi = WebAuthnApi;
15563
15608
  });
15564
15609
 
15565
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/GoTrueClient.js
15610
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/GoTrueClient.js
15566
15611
  var require_GoTrueClient = __commonJS((exports) => {
15567
15612
  Object.defineProperty(exports, "__esModule", { value: true });
15568
15613
  var tslib_1 = require_tslib();
@@ -17321,7 +17366,6 @@ var require_GoTrueClient = __commonJS((exports) => {
17321
17366
  async _saveSession(session) {
17322
17367
  this._debug("#_saveSession()", session);
17323
17368
  this.suppressGetSessionWarning = true;
17324
- await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
17325
17369
  const sessionToProcess = Object.assign({}, session);
17326
17370
  const userIsProxy = sessionToProcess.user && sessionToProcess.user.__isUserNotAvailableProxy === true;
17327
17371
  if (this.userStorage) {
@@ -18258,7 +18302,7 @@ var require_GoTrueClient = __commonJS((exports) => {
18258
18302
  exports.default = GoTrueClient;
18259
18303
  });
18260
18304
 
18261
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.js
18305
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.js
18262
18306
  var require_AuthAdminApi = __commonJS((exports) => {
18263
18307
  Object.defineProperty(exports, "__esModule", { value: true });
18264
18308
  var tslib_1 = require_tslib();
@@ -18267,7 +18311,7 @@ var require_AuthAdminApi = __commonJS((exports) => {
18267
18311
  exports.default = AuthAdminApi;
18268
18312
  });
18269
18313
 
18270
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/AuthClient.js
18314
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/AuthClient.js
18271
18315
  var require_AuthClient = __commonJS((exports) => {
18272
18316
  Object.defineProperty(exports, "__esModule", { value: true });
18273
18317
  var tslib_1 = require_tslib();
@@ -18276,7 +18320,7 @@ var require_AuthClient = __commonJS((exports) => {
18276
18320
  exports.default = AuthClient;
18277
18321
  });
18278
18322
 
18279
- // ../../node_modules/.bun/@supabase+auth-js@2.110.2/node_modules/@supabase/auth-js/dist/main/index.js
18323
+ // ../../node_modules/.bun/@supabase+auth-js@2.110.7/node_modules/@supabase/auth-js/dist/main/index.js
18280
18324
  var require_main3 = __commonJS((exports) => {
18281
18325
  Object.defineProperty(exports, "__esModule", { value: true });
18282
18326
  exports.processLock = exports.lockInternals = exports.NavigatorLockAcquireTimeoutError = exports.navigatorLock = exports.AuthClient = exports.AuthAdminApi = exports.GoTrueClient = exports.GoTrueAdminApi = undefined;
@@ -18306,7 +18350,7 @@ var require_main3 = __commonJS((exports) => {
18306
18350
  } });
18307
18351
  });
18308
18352
 
18309
- // ../../node_modules/.bun/@supabase+supabase-js@2.110.2/node_modules/@supabase/supabase-js/dist/index.mjs
18353
+ // ../../node_modules/.bun/@supabase+supabase-js@2.110.7/node_modules/@supabase/supabase-js/dist/index.mjs
18310
18354
  var exports_dist = {};
18311
18355
  __export(exports_dist, {
18312
18356
  createClient: () => createClient,
@@ -18567,26 +18611,38 @@ function shouldShowDeprecationWarning() {
18567
18611
  return false;
18568
18612
  return parseInt(versionMatch[1], 10) <= 20;
18569
18613
  }
18570
- var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.110.2", JS_ENV = "", JS_RUNTIME_VERSION, _Deno$version, _process$version, _runtimeMeta, DEFAULT_HEADERS2, DEFAULT_GLOBAL_OPTIONS, DEFAULT_DB_OPTIONS, DEFAULT_AUTH_OPTIONS, DEFAULT_REALTIME_OPTIONS, DEFAULT_TRACE_PROPAGATION_OPTIONS, otelModulePromise = null, OTEL_PKG = "@opentelemetry/api", resolveFetch2 = (customFetch) => {
18614
+ var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.110.7", JS_ENV = "", JS_RUNTIME_VERSION, _Deno$version, _process$version, _runtimeMeta, DEFAULT_HEADERS2, DEFAULT_GLOBAL_OPTIONS, DEFAULT_DB_OPTIONS, DEFAULT_AUTH_OPTIONS, DEFAULT_REALTIME_OPTIONS, DEFAULT_TRACE_PROPAGATION_OPTIONS, otelModulePromise = null, OTEL_PKG = "@opentelemetry/api", resolveFetch2 = (customFetch) => {
18571
18615
  if (customFetch)
18572
18616
  return (...args) => customFetch(...args);
18573
18617
  return (...args) => fetch(...args);
18574
18618
  }, resolveHeadersConstructor = () => {
18575
18619
  return Headers;
18576
- }, fetchWithAuth = (supabaseKey, supabaseUrl, getAccessToken, customFetch, tracePropagationOptions) => {
18620
+ }, isNewApiKey = (key) => key.startsWith("sb_publishable_") || key.startsWith("sb_secret_"), TEMP_KEY_PREFIX = "sb_temp_", warnedKeySubtypes, checkApiKeyFormat = (key) => {
18621
+ var _key$match$, _key$match;
18622
+ if (!key.startsWith("sb_") || isNewApiKey(key) || key.startsWith(TEMP_KEY_PREFIX))
18623
+ return;
18624
+ const subtype = (_key$match$ = (_key$match = key.match(/^sb_[a-zA-Z0-9]+_/)) === null || _key$match === undefined ? undefined : _key$match[0]) !== null && _key$match$ !== undefined ? _key$match$ : "unknown";
18625
+ if (warnedKeySubtypes.has(subtype))
18626
+ return;
18627
+ warnedKeySubtypes.add(subtype);
18628
+ console.warn("@supabase/supabase-js: Unrecognized Supabase API key format. The client will proceed and send this key as-is; if you see authentication errors you may need to upgrade @supabase/supabase-js to a version that recognizes this key type.");
18629
+ }, fetchWithAuth = (supabaseKey, supabaseUrl, getAccessToken, customFetch, tracePropagationOptions, options) => {
18577
18630
  const fetch$1 = resolveFetch2(customFetch);
18578
18631
  const HeadersConstructor = resolveHeadersConstructor();
18579
18632
  const traceEnabled = (tracePropagationOptions === null || tracePropagationOptions === undefined ? undefined : tracePropagationOptions.enabled) === true;
18580
18633
  const respectSampling = (tracePropagationOptions === null || tracePropagationOptions === undefined ? undefined : tracePropagationOptions.respectSamplingDecision) !== false;
18581
18634
  const traceTargets = traceEnabled ? getDefaultPropagationTargets(supabaseUrl) : null;
18635
+ const allowKeyAsBearer = !((options === null || options === undefined ? undefined : options.omitApiKeyAsBearer) && isNewApiKey(supabaseKey));
18582
18636
  return async (input, init) => {
18583
- var _await$getAccessToken;
18584
- const accessToken = (_await$getAccessToken = await getAccessToken()) !== null && _await$getAccessToken !== undefined ? _await$getAccessToken : supabaseKey;
18637
+ const realToken = await getAccessToken();
18585
18638
  let headers = new HeadersConstructor(init === null || init === undefined ? undefined : init.headers);
18586
18639
  if (!headers.has("apikey"))
18587
18640
  headers.set("apikey", supabaseKey);
18588
- if (!headers.has("Authorization"))
18589
- headers.set("Authorization", `Bearer ${accessToken}`);
18641
+ if (!headers.has("Authorization")) {
18642
+ const bearer = realToken !== null && realToken !== undefined ? realToken : allowKeyAsBearer ? supabaseKey : null;
18643
+ if (bearer)
18644
+ headers.set("Authorization", `Bearer ${bearer}`);
18645
+ }
18590
18646
  if (traceTargets) {
18591
18647
  const traceHeaders = await getTraceHeaders(input, traceTargets, respectSampling);
18592
18648
  if (traceHeaders) {
@@ -18608,6 +18664,7 @@ var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.110.2
18608
18664
  const baseUrl = validateSupabaseUrl(supabaseUrl);
18609
18665
  if (!supabaseKey)
18610
18666
  throw new Error("supabaseKey is required.");
18667
+ checkApiKeyFormat(supabaseKey);
18611
18668
  this.realtimeUrl = new URL("realtime/v1", baseUrl);
18612
18669
  this.realtimeUrl.protocol = this.realtimeUrl.protocol.replace("http", "ws");
18613
18670
  this.authUrl = new URL("auth/v1", baseUrl);
@@ -18634,7 +18691,8 @@ var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.110.2
18634
18691
  throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(prop)} is not possible`);
18635
18692
  } });
18636
18693
  }
18637
- this.fetch = fetchWithAuth(supabaseKey, supabaseUrl, this._getAccessToken.bind(this), settings.global.fetch, settings.tracePropagation);
18694
+ this.fetch = fetchWithAuth(supabaseKey, supabaseUrl, this._getSessionToken.bind(this), settings.global.fetch, settings.tracePropagation);
18695
+ this.functionsFetch = fetchWithAuth(supabaseKey, supabaseUrl, this._getSessionToken.bind(this), settings.global.fetch, settings.tracePropagation, { omitApiKeyAsBearer: true });
18638
18696
  this.realtime = this._initRealtimeClient(_objectSpread23({
18639
18697
  headers: this.headers,
18640
18698
  accessToken: this._getAccessToken.bind(this),
@@ -18656,7 +18714,7 @@ var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.110.2
18656
18714
  get functions() {
18657
18715
  return new import_functions_js.FunctionsClient(this.functionsUrl.href, {
18658
18716
  headers: this.headers,
18659
- customFetch: this.fetch
18717
+ customFetch: this.functionsFetch
18660
18718
  });
18661
18719
  }
18662
18720
  from(relation) {
@@ -18684,13 +18742,18 @@ var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.110.2
18684
18742
  removeAllChannels() {
18685
18743
  return this.realtime.removeAllChannels();
18686
18744
  }
18687
- async _getAccessToken() {
18745
+ async _getSessionToken() {
18688
18746
  var _this = this;
18689
18747
  var _data$session$access_, _data$session;
18690
18748
  if (_this.accessToken)
18691
18749
  return await _this.accessToken();
18692
18750
  const { data } = await _this.auth.getSession();
18693
- return (_data$session$access_ = (_data$session = data.session) === null || _data$session === undefined ? undefined : _data$session.access_token) !== null && _data$session$access_ !== undefined ? _data$session$access_ : _this.supabaseKey;
18751
+ return (_data$session$access_ = (_data$session = data.session) === null || _data$session === undefined ? undefined : _data$session.access_token) !== null && _data$session$access_ !== undefined ? _data$session$access_ : null;
18752
+ }
18753
+ async _getAccessToken() {
18754
+ var _this2 = this;
18755
+ var _await$this$_getSessi;
18756
+ return (_await$this$_getSessi = await _this2._getSessionToken()) !== null && _await$this$_getSessi !== undefined ? _await$this$_getSessi : _this2.supabaseKey;
18694
18757
  }
18695
18758
  _initSupabaseAuthClient({ autoRefreshToken, persistSession, detectSessionInUrl, storage, userStorage, storageKey, flowType, lock, debug, throwOnError, experimental, lockAcquireTimeout, skipAutoInitialize }, headers, fetch$1) {
18696
18759
  const authHeaders = {
@@ -18726,7 +18789,7 @@ var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.110.2
18726
18789
  });
18727
18790
  }
18728
18791
  _handleTokenChanged(event, source, token) {
18729
- if ((event === "TOKEN_REFRESHED" || event === "SIGNED_IN") && this.changedAccessToken !== token) {
18792
+ if ((event === "TOKEN_REFRESHED" || event === "SIGNED_IN" || event === "INITIAL_SESSION") && this.changedAccessToken !== token) {
18730
18793
  this.changedAccessToken = token;
18731
18794
  this.realtime.setAuth(token);
18732
18795
  } else if (event === "SIGNED_OUT") {
@@ -18756,7 +18819,8 @@ var init_dist4 = __esm(() => {
18756
18819
  JS_ENV = "react-native";
18757
18820
  else {
18758
18821
  JS_ENV = "node";
18759
- JS_RUNTIME_VERSION = typeof process !== "undefined" ? (_process$version = process.version) === null || _process$version === undefined ? undefined : _process$version.replace(/^v/, "") : undefined;
18822
+ const _process = globalThis["process"];
18823
+ JS_RUNTIME_VERSION = _process === null || _process === undefined || (_process$version = _process["version"]) === null || _process$version === undefined ? undefined : _process$version.replace(/^v/, "");
18760
18824
  }
18761
18825
  _runtimeMeta = [`runtime=${JS_ENV}`];
18762
18826
  if (JS_RUNTIME_VERSION)
@@ -18775,6 +18839,7 @@ var init_dist4 = __esm(() => {
18775
18839
  enabled: false,
18776
18840
  respectSamplingDecision: true
18777
18841
  };
18842
+ warnedKeySubtypes = /* @__PURE__ */ new Set;
18778
18843
  SupabaseAuthClient = class extends import_auth_js.AuthClient {
18779
18844
  constructor(options) {
18780
18845
  super(options);
@@ -71057,6 +71122,9 @@ async function action10(documentId, options) {
71057
71122
  }
71058
71123
  const author = resolveAuthor(options.author);
71059
71124
  const authorType = resolveAuthorType(options.authorType);
71125
+ if (author === "unknown") {
71126
+ warn("No --author / CEREFOX_AUTHOR_NAME set — audit log will record this write as 'unknown'.");
71127
+ }
71060
71128
  await client.raw.rpc("cerefox_create_audit_entry", {
71061
71129
  p_document_id: documentId,
71062
71130
  p_operation: "update-metadata",
@@ -71251,6 +71319,9 @@ async function setArchived(versionId, archived, options) {
71251
71319
  throw notFound(`Version ${versionId} not found.`);
71252
71320
  const author = resolveAuthor(options.author);
71253
71321
  const authorType = resolveAuthorType(options.authorType);
71322
+ if (author === "unknown") {
71323
+ warn("No --author / CEREFOX_AUTHOR_NAME set — audit log will record this write as 'unknown'.");
71324
+ }
71254
71325
  const op = archived ? "archive" : "unarchive";
71255
71326
  await client.raw.rpc("cerefox_create_audit_entry", {
71256
71327
  p_document_id: data.document_id,
@@ -75179,9 +75250,9 @@ async function checkEdgeFunctionsCompat() {
75179
75250
  case "above-min-but-old":
75180
75251
  return {
75181
75252
  name: "edge functions",
75182
- status: "warn",
75183
- detail: `Deployed EF v${deployed} works but is older than the bundled Edge Functions (v${EF_VERSION}).`,
75184
- hint: "Update the Edge Functions (see remediation below)."
75253
+ status: "skipped",
75254
+ detail: `Deployed Edge Functions (v${deployed}) are older than the ones bundled with this client (v${EF_VERSION}). Compatible — nothing is broken — but redeploying ` + `picks up the latest server-side fixes.`,
75255
+ hint: "Redeploy with: cerefox server deploy --functions-only"
75185
75256
  };
75186
75257
  default:
75187
75258
  return {
@@ -76013,8 +76084,9 @@ async function readContent(path, paste) {
76013
76084
  }
76014
76085
  async function action18(path, options) {
76015
76086
  const { content, titleFromPath } = await readContent(path, Boolean(options.paste));
76016
- const title = options.title ?? titleFromPath;
76017
- if (!title || title.trim() === "") {
76087
+ const updatingById = Boolean(options.documentId);
76088
+ let title = options.title ?? (updatingById ? null : titleFromPath);
76089
+ if (title !== null && (!title || title.trim() === "")) {
76018
76090
  throw userError(options.paste ? "--title is required with --paste." : "Cannot derive a title from the file path; pass --title explicitly.");
76019
76091
  }
76020
76092
  const author = resolveAuthor(options.author);
@@ -76039,6 +76111,14 @@ async function action18(path, options) {
76039
76111
  const supabase = createClient(settings.supabaseUrl, settings.supabaseKey, {
76040
76112
  auth: { persistSession: false }
76041
76113
  });
76114
+ if (title === null) {
76115
+ const { data, error: error2 } = await supabase.from("cerefox_documents").select("title").eq("id", options.documentId).maybeSingle();
76116
+ if (error2 || !data?.title) {
76117
+ throw userError(`Could not resolve document ${options.documentId} to keep its title` + `${error2 ? ` (${error2.message})` : ""}.`, "Pass --title explicitly, or check the --document-id.");
76118
+ }
76119
+ title = data.title;
76120
+ println(c.dim(` (keeping existing title: ${JSON.stringify(title)})`));
76121
+ }
76042
76122
  const pipeline = new IngestionPipeline({
76043
76123
  supabase,
76044
76124
  openAiApiKey: settings.openaiApiKey
@@ -77354,13 +77434,13 @@ async function action30(options) {
77354
77434
  println("");
77355
77435
  println(c.green(`✓ Upgraded to ${target}.`));
77356
77436
  println("");
77357
- println(c.dim("Refreshing bundled-docs ingest…"));
77358
- try {
77359
- const { runSyncSelfDocs: runSyncSelfDocs2 } = await Promise.resolve().then(() => (init_sync_self_docs(), exports_sync_self_docs));
77360
- await runSyncSelfDocs2({});
77361
- } catch (err) {
77362
- println(cErr.yellow("⚠ ") + `Could not refresh self-docs: ${err instanceof Error ? err.message : String(err)}`);
77363
- println(c.dim(" Run `cerefox sync-self-docs` manually after a successful `cerefox init`."));
77437
+ println(c.dim("Refreshing bundled-docs ingest (using the new version)…"));
77438
+ const sync = spawnSync5(process.execPath, [process.argv[1], "guides", "ingest"], {
77439
+ stdio: "inherit"
77440
+ });
77441
+ if (sync.status !== 0) {
77442
+ println(cErr.yellow("⚠ ") + "Could not refresh self-docs (see output above).");
77443
+ println(c.dim(" Run `cerefox guides ingest` manually after a successful `cerefox init`."));
77364
77444
  }
77365
77445
  }
77366
77446
  function registerSelfUpdate(program2) {
@@ -77598,15 +77678,15 @@ init_sync_self_docs();
77598
77678
  // src/cli/commands/web.ts
77599
77679
  init_cli_core();
77600
77680
 
77601
- // ../../node_modules/.bun/@hono+node-server@2.0.8+68404363cdc13251/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
77681
+ // ../../node_modules/.bun/@hono+node-server@2.0.10+03fc3fa7f287427f/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
77602
77682
  var X_ALREADY_SENT = "x-hono-already-sent";
77603
77683
 
77604
- // ../../node_modules/.bun/@hono+node-server@2.0.8+68404363cdc13251/node_modules/@hono/node-server/dist/index.mjs
77684
+ // ../../node_modules/.bun/@hono+node-server@2.0.10+03fc3fa7f287427f/node_modules/@hono/node-server/dist/index.mjs
77605
77685
  import { STATUS_CODES, createServer } from "node:http";
77606
77686
  import { Http2ServerRequest, constants } from "node:http2";
77607
77687
  import { Readable } from "node:stream";
77608
77688
 
77609
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/helper/websocket/index.js
77689
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/helper/websocket/index.js
77610
77690
  var WSContext = class {
77611
77691
  #init;
77612
77692
  constructor(init) {
@@ -77654,7 +77734,7 @@ var defineWebSocketHelper = (handler11) => {
77654
77734
  };
77655
77735
  };
77656
77736
 
77657
- // ../../node_modules/.bun/@hono+node-server@2.0.8+68404363cdc13251/node_modules/@hono/node-server/dist/index.mjs
77737
+ // ../../node_modules/.bun/@hono+node-server@2.0.10+03fc3fa7f287427f/node_modules/@hono/node-server/dist/index.mjs
77658
77738
  var RequestError = class extends Error {
77659
77739
  constructor(message, options) {
77660
77740
  super(message, options);
@@ -77711,6 +77791,62 @@ var newHeadersFromIncoming = (incoming) => {
77711
77791
  return new Headers(headerRecord);
77712
77792
  };
77713
77793
  var wrapBodyStream = Symbol("wrapBodyStream");
77794
+ var byteExactEncodings = new Set([
77795
+ "latin1",
77796
+ "binary",
77797
+ "hex",
77798
+ "base64",
77799
+ "base64url"
77800
+ ]);
77801
+ var isByteExactEncoding = (encoding) => encoding === null || byteExactEncodings.has(encoding);
77802
+ var bodyBufferedBeforeDisconnectKey = Symbol("bodyBufferedBeforeDisconnect");
77803
+ var bodyBufferedLengthBeforeDisconnectKey = Symbol("bodyBufferedLengthBeforeDisconnect");
77804
+ var toBufferChunk = (chunk, encoding) => Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, encoding ?? "utf8");
77805
+ var isRecoverableDisconnectedIncoming = (incoming) => !(incoming instanceof Http2ServerRequest) && !!incoming.complete && !!incoming.readableAborted && typeof incoming.read === "function" && isByteExactEncoding(incoming.readableEncoding);
77806
+ var recordBodyBufferedBeforeDisconnect = (incoming) => {
77807
+ if (incoming.readableDidRead || !isRecoverableDisconnectedIncoming(incoming))
77808
+ return;
77809
+ const incomingWithRecovery = incoming;
77810
+ incomingWithRecovery[bodyBufferedLengthBeforeDisconnectKey] ??= incoming.readableLength;
77811
+ };
77812
+ var readBodyBufferedBeforeDisconnect = (incoming, chunks) => {
77813
+ if (incoming.readableDidRead && !chunks || !isRecoverableDisconnectedIncoming(incoming))
77814
+ return;
77815
+ const incomingWithRecovery = incoming;
77816
+ if (incomingWithRecovery[bodyBufferedBeforeDisconnectKey] !== undefined)
77817
+ return incomingWithRecovery[bodyBufferedBeforeDisconnectKey];
77818
+ let result;
77819
+ const errored = incoming.errored;
77820
+ if (errored && errored.code !== "ECONNRESET")
77821
+ result = errored;
77822
+ else if (incomingWithRecovery[bodyBufferedLengthBeforeDisconnectKey] !== undefined && incoming.readableLength !== incomingWithRecovery[bodyBufferedLengthBeforeDisconnectKey])
77823
+ result = newBodyUnusableError();
77824
+ else {
77825
+ const bodyChunks = chunks ?? [];
77826
+ const chunk = incoming.read();
77827
+ if (chunk !== null)
77828
+ bodyChunks.push(toBufferChunk(chunk, incoming.readableEncoding));
77829
+ const buffer2 = bodyChunks.length === 1 ? bodyChunks[0] : Buffer.concat(bodyChunks);
77830
+ result = buffer2;
77831
+ const contentLength = incoming.headers["content-length"];
77832
+ if (typeof contentLength === "string" && /^\d+$/.test(contentLength)) {
77833
+ const expectedLength = Number(contentLength);
77834
+ if (Number.isSafeInteger(expectedLength) && buffer2.length !== expectedLength)
77835
+ result = newBodyUnusableError();
77836
+ }
77837
+ }
77838
+ incomingWithRecovery[bodyBufferedBeforeDisconnectKey] = result;
77839
+ return result;
77840
+ };
77841
+ var enqueueBufferedBody = (controller, buffered) => {
77842
+ if (buffered instanceof Error) {
77843
+ controller.error(buffered);
77844
+ return;
77845
+ }
77846
+ if (buffered.length > 0)
77847
+ controller.enqueue(buffered);
77848
+ controller.close();
77849
+ };
77714
77850
  var newRequestFromIncoming = (method, url, headers, incoming, abortController) => {
77715
77851
  const init = {
77716
77852
  method,
@@ -77735,6 +77871,13 @@ var newRequestFromIncoming = (method, url, headers, incoming, abortController) =
77735
77871
  let reader;
77736
77872
  init.body = new ReadableStream({ async pull(controller) {
77737
77873
  try {
77874
+ if (!reader) {
77875
+ const buffered = readBodyBufferedBeforeDisconnect(incoming);
77876
+ if (buffered !== undefined) {
77877
+ enqueueBufferedBody(controller, buffered);
77878
+ return;
77879
+ }
77880
+ }
77738
77881
  reader ||= Readable.toWeb(incoming).getReader();
77739
77882
  const { done, value } = await reader.read();
77740
77883
  if (done)
@@ -77745,8 +77888,15 @@ var newRequestFromIncoming = (method, url, headers, incoming, abortController) =
77745
77888
  controller.error(error3);
77746
77889
  }
77747
77890
  } });
77748
- } else
77749
- init.body = Readable.toWeb(incoming);
77891
+ } else {
77892
+ const buffered = readBodyBufferedBeforeDisconnect(incoming);
77893
+ if (buffered !== undefined)
77894
+ init.body = new ReadableStream({ start(controller) {
77895
+ enqueueBufferedBody(controller, buffered);
77896
+ } });
77897
+ else
77898
+ init.body = Readable.toWeb(incoming);
77899
+ }
77750
77900
  return new Request$1(url, init);
77751
77901
  };
77752
77902
  var getRequestCache = Symbol("getRequestCache");
@@ -77847,14 +77997,29 @@ var readRawBodyIfAvailable = (request) => {
77847
77997
  if ("rawBody" in incoming && incoming.rawBody instanceof Buffer)
77848
77998
  return incoming.rawBody;
77849
77999
  };
78000
+ var normalizeAbortError = (request, incoming) => {
78001
+ if (incoming.errored)
78002
+ return incoming.errored;
78003
+ const reason = request[abortReasonKey];
78004
+ if (reason !== undefined)
78005
+ return reason instanceof Error ? reason : new Error(String(reason));
78006
+ return /* @__PURE__ */ new Error("Client connection prematurely closed.");
78007
+ };
77850
78008
  var readBodyDirect = (request) => {
77851
78009
  if (request[bodyBufferKey])
77852
78010
  return Promise.resolve(request[bodyBufferKey]);
77853
78011
  if (request[bodyReadPromiseKey])
77854
78012
  return request[bodyReadPromiseKey];
77855
78013
  const incoming = request[incomingKey];
77856
- if (Readable.isDisturbed(incoming))
78014
+ if (incoming.readableDidRead)
77857
78015
  return rejectBodyUnusable();
78016
+ const buffered = readBodyBufferedBeforeDisconnect(incoming);
78017
+ if (buffered !== undefined) {
78018
+ if (buffered instanceof Error)
78019
+ return Promise.reject(buffered);
78020
+ request[bodyBufferKey] = buffered;
78021
+ return Promise.resolve(buffered);
78022
+ }
77858
78023
  const promise2 = new Promise((resolve5, reject) => {
77859
78024
  const chunks = [];
77860
78025
  let settled = false;
@@ -77865,8 +78030,25 @@ var readBodyDirect = (request) => {
77865
78030
  cleanup();
77866
78031
  callback();
77867
78032
  };
78033
+ const recoverCompleteBodyAfterDisconnect = (error3) => {
78034
+ const streamError = incoming.errored ?? error3;
78035
+ if (!isRecoverableDisconnectedIncoming(incoming) || streamError && streamError.code !== "ECONNRESET")
78036
+ return false;
78037
+ finish(() => {
78038
+ const recovered = readBodyBufferedBeforeDisconnect(incoming, chunks);
78039
+ if (recovered instanceof Error)
78040
+ reject(recovered);
78041
+ else if (recovered === undefined)
78042
+ reject(error3 ?? normalizeAbortError(request, incoming));
78043
+ else {
78044
+ request[bodyBufferKey] = recovered;
78045
+ resolve5(recovered);
78046
+ }
78047
+ });
78048
+ return true;
78049
+ };
77868
78050
  const onData = (chunk) => {
77869
- chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
78051
+ chunks.push(toBufferChunk(chunk, incoming.readableEncoding));
77870
78052
  };
77871
78053
  const onEnd = () => {
77872
78054
  finish(() => {
@@ -77876,6 +78058,8 @@ var readBodyDirect = (request) => {
77876
78058
  });
77877
78059
  };
77878
78060
  const onError = (error3) => {
78061
+ if (recoverCompleteBodyAfterDisconnect(error3))
78062
+ return;
77879
78063
  finish(() => {
77880
78064
  reject(error3);
77881
78065
  });
@@ -77885,17 +78069,10 @@ var readBodyDirect = (request) => {
77885
78069
  onEnd();
77886
78070
  return;
77887
78071
  }
78072
+ if (recoverCompleteBodyAfterDisconnect())
78073
+ return;
77888
78074
  finish(() => {
77889
- if (incoming.errored) {
77890
- reject(incoming.errored);
77891
- return;
77892
- }
77893
- const reason = request[abortReasonKey];
77894
- if (reason !== undefined) {
77895
- reject(reason instanceof Error ? reason : new Error(String(reason)));
77896
- return;
77897
- }
77898
- reject(/* @__PURE__ */ new Error("Client connection prematurely closed."));
78075
+ reject(normalizeAbortError(request, incoming));
77899
78076
  });
77900
78077
  };
77901
78078
  const cleanup = () => {
@@ -78328,10 +78505,13 @@ var drainIncoming = (incoming) => {
78328
78505
  incoming.resume();
78329
78506
  };
78330
78507
  var makeCloseHandler = (req, incoming, outgoing, needsBodyCleanup) => () => {
78331
- if (incoming.errored)
78508
+ if (incoming.errored) {
78509
+ recordBodyBufferedBeforeDisconnect(incoming);
78332
78510
  req[abortRequest](incoming.errored.toString());
78333
- else if (!outgoing.writableFinished)
78511
+ } else if (!outgoing.writableFinished) {
78512
+ recordBodyBufferedBeforeDisconnect(incoming);
78334
78513
  req[abortRequest]("Client connection prematurely closed.");
78514
+ }
78335
78515
  if (needsBodyCleanup && !incoming.readableEnded)
78336
78516
  setTimeout(() => {
78337
78517
  if (!incoming.readableEnded)
@@ -78580,6 +78760,28 @@ var CloseEvent2 = globalThis.CloseEvent ?? class extends Event {
78580
78760
  return this.#eventInitDict.reason ?? "";
78581
78761
  }
78582
78762
  };
78763
+ var ErrorEvent = globalThis.ErrorEvent ?? class extends Event {
78764
+ #eventInitDict;
78765
+ constructor(type, eventInitDict = {}) {
78766
+ super(type, eventInitDict);
78767
+ this.#eventInitDict = eventInitDict;
78768
+ }
78769
+ get message() {
78770
+ return this.#eventInitDict.message ?? "";
78771
+ }
78772
+ get filename() {
78773
+ return this.#eventInitDict.filename ?? "";
78774
+ }
78775
+ get lineno() {
78776
+ return this.#eventInitDict.lineno ?? 0;
78777
+ }
78778
+ get colno() {
78779
+ return this.#eventInitDict.colno ?? 0;
78780
+ }
78781
+ get error() {
78782
+ return this.#eventInitDict.error ?? null;
78783
+ }
78784
+ };
78583
78785
  var generateConnectionSymbol = () => Symbol("connection");
78584
78786
  var CONNECTION_SYMBOL_KEY = Symbol("CONNECTION_SYMBOL_KEY");
78585
78787
  var WAIT_FOR_WEBSOCKET_SYMBOL = Symbol("WAIT_FOR_WEBSOCKET_SYMBOL");
@@ -78637,10 +78839,18 @@ var setupWebSocket = (options) => {
78637
78839
  waiterMap.delete(request);
78638
78840
  }
78639
78841
  });
78842
+ const rejectWaiter = (request) => {
78843
+ const waiter = waiterMap.get(request);
78844
+ if (waiter) {
78845
+ waiterMap.delete(request);
78846
+ waiter.reject(/* @__PURE__ */ new Error("WebSocket handshake aborted"));
78847
+ }
78848
+ };
78640
78849
  const waitForWebSocket = (request, connectionSymbol) => {
78641
- return new Promise((resolve5) => {
78850
+ return new Promise((resolve5, reject) => {
78642
78851
  waiterMap.set(request, {
78643
78852
  resolve: resolve5,
78853
+ reject,
78644
78854
  connectionSymbol
78645
78855
  });
78646
78856
  });
@@ -78669,7 +78879,7 @@ var setupWebSocket = (options) => {
78669
78879
  }
78670
78880
  const waiter = waiterMap.get(request);
78671
78881
  if (!waiter || waiter.connectionSymbol !== env4[CONNECTION_SYMBOL_KEY]) {
78672
- waiterMap.delete(request);
78882
+ rejectWaiter(request);
78673
78883
  if (server.listenerCount("upgrade") === 1)
78674
78884
  rejectUpgradeRequest(socket, status, responseHeaders);
78675
78885
  return;
@@ -78677,9 +78887,12 @@ var setupWebSocket = (options) => {
78677
78887
  const addResponseHeaders = (headers) => {
78678
78888
  appendResponseHeaders(headers, responseHeaders);
78679
78889
  };
78890
+ const reclaimWaiterOnClose = () => rejectWaiter(request);
78891
+ socket.once("close", reclaimWaiterOnClose);
78680
78892
  wss.on("headers", addResponseHeaders);
78681
78893
  try {
78682
78894
  wss.handleUpgrade(request, socket, head2, (ws) => {
78895
+ socket.off("close", reclaimWaiterOnClose);
78683
78896
  wss.emit("connection", ws, request);
78684
78897
  });
78685
78898
  } finally {
@@ -78700,7 +78913,12 @@ var upgradeWebSocket = defineWebSocketHelper(async (c2, events, options) => {
78700
78913
  const connectionSymbol = generateConnectionSymbol();
78701
78914
  env4[CONNECTION_SYMBOL_KEY] = connectionSymbol;
78702
78915
  (async () => {
78703
- const ws = await waitForWebSocket(env4.incoming, connectionSymbol);
78916
+ let ws;
78917
+ try {
78918
+ ws = await waitForWebSocket(env4.incoming, connectionSymbol);
78919
+ } catch {
78920
+ return;
78921
+ }
78704
78922
  const messagesReceivedInStarting = [];
78705
78923
  const bufferMessage = (data, isBinary) => {
78706
78924
  messagesReceivedInStarting.push([data, isBinary]);
@@ -78789,7 +79007,7 @@ var serve = (options, listeningListener) => {
78789
79007
  return server;
78790
79008
  };
78791
79009
 
78792
- // ../../node_modules/.bun/@hono+node-server@2.0.8+68404363cdc13251/node_modules/@hono/node-server/dist/utils/stream.mjs
79010
+ // ../../node_modules/.bun/@hono+node-server@2.0.10+03fc3fa7f287427f/node_modules/@hono/node-server/dist/utils/stream.mjs
78793
79011
  import { Readable as Readable2 } from "node:stream";
78794
79012
  import { versions as versions2 } from "node:process";
78795
79013
  var pr54206Applied = () => {
@@ -78855,7 +79073,7 @@ var createStreamBody = (stream, useNativeReadableToWeb = useReadableToWeb) => {
78855
79073
  });
78856
79074
  };
78857
79075
 
78858
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/utils/mime.js
79076
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/utils/mime.js
78859
79077
  var getMimeType = (filename, mimes = baseMimes) => {
78860
79078
  const regexp = /\.([a-zA-Z0-9]+?)$/;
78861
79079
  const match = filename.match(regexp);
@@ -78924,7 +79142,7 @@ var _baseMimes = {
78924
79142
  };
78925
79143
  var baseMimes = _baseMimes;
78926
79144
 
78927
- // ../../node_modules/.bun/@hono+node-server@2.0.8+68404363cdc13251/node_modules/@hono/node-server/dist/serve-static.mjs
79145
+ // ../../node_modules/.bun/@hono+node-server@2.0.10+03fc3fa7f287427f/node_modules/@hono/node-server/dist/serve-static.mjs
78928
79146
  import { createReadStream, existsSync as existsSync15, statSync as statSync5 } from "node:fs";
78929
79147
  import { join as join13 } from "node:path";
78930
79148
  var COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i;
@@ -78941,6 +79159,47 @@ var getStats = (path) => {
78941
79159
  } catch {}
78942
79160
  return stats;
78943
79161
  };
79162
+ var BYTE_RANGE_PATTERN = /^(?:bytes=)?(?!-$)(\d*)-(\d*)$/;
79163
+ var parseByteRange = (range) => {
79164
+ const match = range.match(BYTE_RANGE_PATTERN);
79165
+ if (!match)
79166
+ return;
79167
+ const [, start, end] = match;
79168
+ if (start === "")
79169
+ return {
79170
+ type: "suffix",
79171
+ length: Number(end)
79172
+ };
79173
+ if (end === "")
79174
+ return {
79175
+ type: "open-ended",
79176
+ start: Number(start)
79177
+ };
79178
+ return {
79179
+ type: "bounded",
79180
+ start: Number(start),
79181
+ end: Number(end)
79182
+ };
79183
+ };
79184
+ var resolveByteRange = (spec, size2) => {
79185
+ if (size2 === 0)
79186
+ return;
79187
+ if (spec.type === "suffix") {
79188
+ if (spec.length === 0)
79189
+ return;
79190
+ return {
79191
+ start: Math.max(size2 - spec.length, 0),
79192
+ end: size2 - 1
79193
+ };
79194
+ }
79195
+ const end = spec.type === "bounded" ? Math.min(spec.end, size2 - 1) : size2 - 1;
79196
+ if (spec.start >= size2 || spec.start > end)
79197
+ return;
79198
+ return {
79199
+ start: spec.start,
79200
+ end
79201
+ };
79202
+ };
78944
79203
  var tryDecode = (str, decoder) => {
78945
79204
  try {
78946
79205
  return decoder(str);
@@ -79016,19 +79275,24 @@ var serveStatic = (options = { root: "" }) => {
79016
79275
  result = c2.body(createStreamBody(createReadStream(path)), 200);
79017
79276
  } else {
79018
79277
  c2.header("Accept-Ranges", "bytes");
79019
- const parts = range.replace(/bytes=/, "").split("-", 2);
79020
- const start = parseInt(parts[0], 10) || 0;
79021
- let end = parseInt(parts[1], 10) || size2 - 1;
79022
- if (size2 < end - start + 1)
79023
- end = size2 - 1;
79024
- const chunksize = end - start + 1;
79025
- const stream = createReadStream(path, {
79026
- start,
79027
- end
79028
- });
79029
- c2.header("Content-Length", chunksize.toString());
79030
- c2.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
79031
- result = c2.body(createStreamBody(stream), 206);
79278
+ const resolvedRange = resolveByteRange(parseByteRange(range) ?? {
79279
+ type: "open-ended",
79280
+ start: 0
79281
+ }, size2);
79282
+ if (!resolvedRange) {
79283
+ c2.header("Content-Range", `bytes */${size2}`);
79284
+ result = c2.body(null, 416);
79285
+ } else {
79286
+ const { start, end } = resolvedRange;
79287
+ const chunkSize = end - start + 1;
79288
+ const stream = createReadStream(path, {
79289
+ start,
79290
+ end
79291
+ });
79292
+ c2.header("Content-Length", chunkSize.toString());
79293
+ c2.header("Content-Range", `bytes ${start}-${end}/${size2}`);
79294
+ result = c2.body(createStreamBody(stream), 206);
79295
+ }
79032
79296
  }
79033
79297
  await options.onFound?.(path, c2);
79034
79298
  return result;
@@ -79040,7 +79304,7 @@ import { existsSync as existsSync19 } from "node:fs";
79040
79304
  import { readFileSync as readFileSync17 } from "node:fs";
79041
79305
  import { join as join17 } from "node:path";
79042
79306
 
79043
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/compose.js
79307
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/compose.js
79044
79308
  var compose = (middleware, onError, onNotFound) => {
79045
79309
  return (context, next) => {
79046
79310
  let index = -1;
@@ -79084,10 +79348,10 @@ var compose = (middleware, onError, onNotFound) => {
79084
79348
  };
79085
79349
  };
79086
79350
 
79087
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/request/constants.js
79351
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/request/constants.js
79088
79352
  var GET_MATCH_RESULT = /* @__PURE__ */ Symbol();
79089
79353
 
79090
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/utils/buffer.js
79354
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/utils/buffer.js
79091
79355
  var bufferToFormData = (arrayBuffer, contentType2) => {
79092
79356
  const response = new Response(arrayBuffer, {
79093
79357
  headers: {
@@ -79097,7 +79361,7 @@ var bufferToFormData = (arrayBuffer, contentType2) => {
79097
79361
  return response.formData();
79098
79362
  };
79099
79363
 
79100
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/utils/body.js
79364
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/utils/body.js
79101
79365
  var isRawRequest = (request) => ("headers" in request);
79102
79366
  var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
79103
79367
  const { all = false, dot = false } = options;
@@ -79176,7 +79440,7 @@ var handleParsingNestedValues = (form, key, value) => {
79176
79440
  });
79177
79441
  };
79178
79442
 
79179
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/utils/url.js
79443
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/utils/url.js
79180
79444
  var splitPath = (path) => {
79181
79445
  const paths = path.split("/");
79182
79446
  if (paths[0] === "") {
@@ -79376,7 +79640,7 @@ var getQueryParams = (url, key) => {
79376
79640
  };
79377
79641
  var decodeURIComponent_ = decodeURIComponent;
79378
79642
 
79379
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/request.js
79643
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/request.js
79380
79644
  var tryDecodeURIComponent = (str) => tryDecode2(str, decodeURIComponent_);
79381
79645
  var HonoRequest = class {
79382
79646
  raw;
@@ -79490,7 +79754,7 @@ var HonoRequest = class {
79490
79754
  }
79491
79755
  };
79492
79756
 
79493
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/utils/html.js
79757
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/utils/html.js
79494
79758
  var HtmlEscapedCallbackPhase = {
79495
79759
  Stringify: 1,
79496
79760
  BeforeStream: 2,
@@ -79528,7 +79792,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer2) =>
79528
79792
  }
79529
79793
  };
79530
79794
 
79531
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/context.js
79795
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/context.js
79532
79796
  var TEXT_PLAIN = "text/plain; charset=UTF-8";
79533
79797
  var setDefaultContentType = (contentType2, headers) => {
79534
79798
  return {
@@ -79695,7 +79959,7 @@ var Context = class {
79695
79959
  };
79696
79960
  };
79697
79961
 
79698
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router.js
79962
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/router.js
79699
79963
  var METHOD_NAME_ALL = "ALL";
79700
79964
  var METHOD_NAME_ALL_LOWERCASE = "all";
79701
79965
  var METHODS = ["get", "post", "put", "delete", "options", "patch"];
@@ -79703,10 +79967,10 @@ var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is
79703
79967
  var UnsupportedPathError = class extends Error {
79704
79968
  };
79705
79969
 
79706
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/utils/constants.js
79970
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/utils/constants.js
79707
79971
  var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
79708
79972
 
79709
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/hono-base.js
79973
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/hono-base.js
79710
79974
  var notFoundHandler = (c2) => {
79711
79975
  return c2.text("404 Not Found", 404);
79712
79976
  };
@@ -79930,7 +80194,7 @@ var Hono = class _Hono {
79930
80194
  };
79931
80195
  };
79932
80196
 
79933
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router/reg-exp-router/matcher.js
80197
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/router/reg-exp-router/matcher.js
79934
80198
  var emptyParam = [];
79935
80199
  function match(method, path) {
79936
80200
  const matchers = this.buildAllMatchers();
@@ -79951,7 +80215,7 @@ function match(method, path) {
79951
80215
  return match2(method, path);
79952
80216
  }
79953
80217
 
79954
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router/reg-exp-router/node.js
80218
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/router/reg-exp-router/node.js
79955
80219
  var LABEL_REG_EXP_STR = "[^/]+";
79956
80220
  var ONLY_WILDCARD_REG_EXP_STR = ".*";
79957
80221
  var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
@@ -80055,7 +80319,7 @@ var Node = class _Node {
80055
80319
  }
80056
80320
  };
80057
80321
 
80058
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router/reg-exp-router/trie.js
80322
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/router/reg-exp-router/trie.js
80059
80323
  var Trie = class {
80060
80324
  #context = { varIndex: 0 };
80061
80325
  #root = new Node;
@@ -80111,7 +80375,7 @@ var Trie = class {
80111
80375
  }
80112
80376
  };
80113
80377
 
80114
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router/reg-exp-router/router.js
80378
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/router/reg-exp-router/router.js
80115
80379
  var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
80116
80380
  var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
80117
80381
  function buildWildcardRegExp(path) {
@@ -80276,7 +80540,7 @@ var RegExpRouter = class {
80276
80540
  }
80277
80541
  };
80278
80542
 
80279
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router/reg-exp-router/prepared-router.js
80543
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/router/reg-exp-router/prepared-router.js
80280
80544
  var PreparedRegExpRouter = class {
80281
80545
  name = "PreparedRegExpRouter";
80282
80546
  #matchers;
@@ -80348,7 +80612,7 @@ var PreparedRegExpRouter = class {
80348
80612
  match = match;
80349
80613
  };
80350
80614
 
80351
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router/smart-router/router.js
80615
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/router/smart-router/router.js
80352
80616
  var SmartRouter = class {
80353
80617
  name = "SmartRouter";
80354
80618
  #routers = [];
@@ -80403,7 +80667,7 @@ var SmartRouter = class {
80403
80667
  }
80404
80668
  };
80405
80669
 
80406
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router/trie-router/node.js
80670
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/router/trie-router/node.js
80407
80671
  var emptyParams = /* @__PURE__ */ Object.create(null);
80408
80672
  var hasChildren = (children) => {
80409
80673
  for (const _ in children) {
@@ -80575,7 +80839,7 @@ var Node2 = class _Node2 {
80575
80839
  }
80576
80840
  };
80577
80841
 
80578
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/router/trie-router/router.js
80842
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/router/trie-router/router.js
80579
80843
  var TrieRouter = class {
80580
80844
  name = "TrieRouter";
80581
80845
  #node;
@@ -80597,7 +80861,7 @@ var TrieRouter = class {
80597
80861
  }
80598
80862
  };
80599
80863
 
80600
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/hono.js
80864
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/hono.js
80601
80865
  var Hono2 = class extends Hono {
80602
80866
  constructor(options = {}) {
80603
80867
  super(options);
@@ -80607,7 +80871,7 @@ var Hono2 = class extends Hono {
80607
80871
  }
80608
80872
  };
80609
80873
 
80610
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/utils/color.js
80874
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/utils/color.js
80611
80875
  function getColorEnabled() {
80612
80876
  const { process: process10, Deno: Deno2 } = globalThis;
80613
80877
  const isNoColor = typeof Deno2?.noColor === "boolean" ? Deno2.noColor : process10 !== undefined ? "NO_COLOR" in process10?.env : false;
@@ -80626,7 +80890,7 @@ async function getColorEnabledAsync() {
80626
80890
  return !isNoColor;
80627
80891
  }
80628
80892
 
80629
- // ../../node_modules/.bun/hono@4.12.29/node_modules/hono/dist/middleware/logger/index.js
80893
+ // ../../node_modules/.bun/hono@4.12.30/node_modules/hono/dist/middleware/logger/index.js
80630
80894
  var humanize = (times) => {
80631
80895
  const [delimiter, separator] = [",", "."];
80632
80896
  const orderTimes = times.map((v) => v.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1" + delimiter));