@hot-updater/firebase 0.18.1 → 0.18.2

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.
@@ -27,7 +27,7 @@ var __toESM$1 = (mod, isNodeMode, target) => (target = mod != null ? __create$1(
27
27
  const firebase_admin = __toESM$1(require("firebase-admin"));
28
28
 
29
29
  //#region ../../packages/core/dist/index.js
30
- const NIL_UUID$1 = "00000000-0000-0000-0000-000000000000";
30
+ const NIL_UUID = "00000000-0000-0000-0000-000000000000";
31
31
 
32
32
  //#endregion
33
33
  //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/body.js
@@ -3468,7 +3468,7 @@ var require_https = __commonJS$1({ "../../node_modules/.pnpm/firebase-functions@
3468
3468
 
3469
3469
  //#endregion
3470
3470
  //#region firebase/functions/createFirebaseApp.ts
3471
- var import_https = __toESM$1(require_https(), 1);
3471
+ var import_https = __toESM$1(require_https());
3472
3472
  function createFirebaseApp({ region }) {
3473
3473
  return (app$1) => {
3474
3474
  return (0, import_https.onRequest)({ region }, async (req, res) => {
@@ -4042,7 +4042,7 @@ var require_lrucache = __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_
4042
4042
  var LRUCache = class {
4043
4043
  constructor() {
4044
4044
  this.max = 1e3;
4045
- this.map = new Map();
4045
+ this.map = /* @__PURE__ */ new Map();
4046
4046
  }
4047
4047
  get(key) {
4048
4048
  const value = this.map.get(key);
@@ -4143,7 +4143,7 @@ var require_range = __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_mod
4143
4143
  return !!comp.match(re$1[t$1.COMPARATORLOOSE]);
4144
4144
  });
4145
4145
  debug$1("range list", rangeList);
4146
- const rangeMap = new Map();
4146
+ const rangeMap = /* @__PURE__ */ new Map();
4147
4147
  const comparators = rangeList.map((comp) => new Comparator$4(comp, this.options));
4148
4148
  for (const comp of comparators) {
4149
4149
  if (isNullSet(comp)) return [comp];
@@ -4655,7 +4655,7 @@ var require_subset = __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_mo
4655
4655
  else sub = minimumVersion;
4656
4656
  if (dom.length === 1 && dom[0].semver === ANY) if (options$1.includePrerelease) return true;
4657
4657
  else dom = minimumVersion;
4658
- const eqSet = new Set();
4658
+ const eqSet = /* @__PURE__ */ new Set();
4659
4659
  let gt$5, lt$4;
4660
4660
  for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt$5 = higherGT(gt$5, c, options$1);
4661
4661
  else if (c.operator === "<" || c.operator === "<=") lt$4 = lowerLT(lt$4, c, options$1);
@@ -4808,7 +4808,7 @@ var require_semver = __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_mo
4808
4808
  rcompareIdentifiers: identifiers.rcompareIdentifiers
4809
4809
  };
4810
4810
  } });
4811
- var import_semver = __toESM(require_semver(), 1);
4811
+ var import_semver = __toESM(require_semver());
4812
4812
  const semverSatisfies = (targetAppVersion, currentVersion) => {
4813
4813
  const currentCoerce = import_semver.default.coerce(currentVersion);
4814
4814
  if (!currentCoerce) return false;
@@ -4854,9 +4854,9 @@ const year = day * 365.25;
4854
4854
 
4855
4855
  //#endregion
4856
4856
  //#region firebase/functions/getUpdateInfo.ts
4857
- const NIL_UUID = "00000000-0000-0000-0000-000000000000";
4857
+ const NIL_UUID$1 = "00000000-0000-0000-0000-000000000000";
4858
4858
  const INIT_BUNDLE_ROLLBACK_UPDATE_INFO = {
4859
- id: NIL_UUID,
4859
+ id: NIL_UUID$1,
4860
4860
  shouldForceUpdate: true,
4861
4861
  message: null,
4862
4862
  status: "ROLLBACK",
@@ -4889,10 +4889,10 @@ const getUpdateInfo = async (db, args) => {
4889
4889
  default: return null;
4890
4890
  }
4891
4891
  };
4892
- const fingerprintStrategy = async (db, { platform, fingerprintHash, bundleId, minBundleId = NIL_UUID, channel = "production" }) => {
4892
+ const fingerprintStrategy = async (db, { platform, fingerprintHash, bundleId, minBundleId = NIL_UUID$1, channel = "production" }) => {
4893
4893
  try {
4894
4894
  let currentBundle = null;
4895
- if (bundleId !== NIL_UUID) {
4895
+ if (bundleId !== NIL_UUID$1) {
4896
4896
  const doc = await db.collection("bundles").doc(bundleId).get();
4897
4897
  if (doc.exists) {
4898
4898
  const data = doc.data();
@@ -4904,7 +4904,7 @@ const fingerprintStrategy = async (db, { platform, fingerprintHash, bundleId, mi
4904
4904
  const baseQuery = db.collection("bundles").where("platform", "==", platform).where("channel", "==", channel).where("enabled", "==", true).where("id", ">=", minBundleId).where("fingerprint_hash", "==", fingerprintHash);
4905
4905
  let updateCandidate = null;
4906
4906
  let rollbackCandidate = null;
4907
- if (bundleId === NIL_UUID) {
4907
+ if (bundleId === NIL_UUID$1) {
4908
4908
  const snap = await baseQuery.orderBy("id", "desc").limit(1).get();
4909
4909
  if (!snap.empty) {
4910
4910
  const data = snap.docs[0].data();
@@ -4922,7 +4922,7 @@ const fingerprintStrategy = async (db, { platform, fingerprintHash, bundleId, mi
4922
4922
  rollbackCandidate = convertToBundle(data);
4923
4923
  }
4924
4924
  }
4925
- if (bundleId === NIL_UUID) return updateCandidate ? makeResponse(updateCandidate, "UPDATE") : null;
4925
+ if (bundleId === NIL_UUID$1) return updateCandidate ? makeResponse(updateCandidate, "UPDATE") : null;
4926
4926
  if (updateCandidate && updateCandidate.id !== bundleId) return makeResponse(updateCandidate, "UPDATE");
4927
4927
  if (updateCandidate && updateCandidate.id === bundleId) {
4928
4928
  if (currentBundle?.enabled) return null;
@@ -4938,10 +4938,10 @@ const fingerprintStrategy = async (db, { platform, fingerprintHash, bundleId, mi
4938
4938
  throw error$1;
4939
4939
  }
4940
4940
  };
4941
- const appVersionStrategy = async (db, { platform, appVersion, bundleId, minBundleId = NIL_UUID, channel = "production" }) => {
4941
+ const appVersionStrategy = async (db, { platform, appVersion, bundleId, minBundleId = NIL_UUID$1, channel = "production" }) => {
4942
4942
  try {
4943
4943
  let currentBundle = null;
4944
- if (bundleId !== NIL_UUID) {
4944
+ if (bundleId !== NIL_UUID$1) {
4945
4945
  const doc = await db.collection("bundles").doc(bundleId).get();
4946
4946
  if (doc.exists) {
4947
4947
  const data = doc.data();
@@ -4957,7 +4957,7 @@ const appVersionStrategy = async (db, { platform, appVersion, bundleId, minBundl
4957
4957
  const baseQuery = db.collection("bundles").where("platform", "==", platform).where("channel", "==", channel).where("enabled", "==", true).where("id", ">=", minBundleId).where("target_app_version", "in", targetAppVersionList);
4958
4958
  let updateCandidate = null;
4959
4959
  let rollbackCandidate = null;
4960
- if (bundleId === NIL_UUID) {
4960
+ if (bundleId === NIL_UUID$1) {
4961
4961
  const snap = await baseQuery.orderBy("id", "desc").limit(1).get();
4962
4962
  if (!snap.empty) {
4963
4963
  const data = snap.docs[0].data();
@@ -4975,7 +4975,7 @@ const appVersionStrategy = async (db, { platform, appVersion, bundleId, minBundl
4975
4975
  rollbackCandidate = convertToBundle(data);
4976
4976
  }
4977
4977
  }
4978
- if (bundleId === NIL_UUID) return updateCandidate ? makeResponse(updateCandidate, "UPDATE") : null;
4978
+ if (bundleId === NIL_UUID$1) return updateCandidate ? makeResponse(updateCandidate, "UPDATE") : null;
4979
4979
  if (updateCandidate && updateCandidate.id !== bundleId) return makeResponse(updateCandidate, "UPDATE");
4980
4980
  if (updateCandidate && updateCandidate.id === bundleId) {
4981
4981
  if (currentBundle?.enabled) return null;
@@ -5003,7 +5003,7 @@ const handleUpdateRequest = async (db, updateConfig) => {
5003
5003
  const updateInfo = await getUpdateInfo(db, updateConfig);
5004
5004
  if (!updateInfo) return null;
5005
5005
  const { storageUri,...rest } = updateInfo;
5006
- if (rest.id === NIL_UUID$1) return {
5006
+ if (rest.id === NIL_UUID) return {
5007
5007
  ...rest,
5008
5008
  fileUrl: null
5009
5009
  };
@@ -5042,14 +5042,14 @@ app.get("/api/check-update", async (c) => {
5042
5042
  platform,
5043
5043
  fingerprintHash,
5044
5044
  bundleId,
5045
- minBundleId: minBundleId || NIL_UUID$1,
5045
+ minBundleId: minBundleId || NIL_UUID,
5046
5046
  channel: channel || "production",
5047
5047
  _updateStrategy: "fingerprint"
5048
5048
  } : {
5049
5049
  platform,
5050
5050
  appVersion,
5051
5051
  bundleId,
5052
- minBundleId: minBundleId || NIL_UUID$1,
5052
+ minBundleId: minBundleId || NIL_UUID,
5053
5053
  channel: channel || "production",
5054
5054
  _updateStrategy: "appVersion"
5055
5055
  };
@@ -5069,7 +5069,7 @@ app.get("/api/check-update/app-version/:platform/:app-version/:channel/:minBundl
5069
5069
  platform,
5070
5070
  appVersion,
5071
5071
  bundleId,
5072
- minBundleId: minBundleId || NIL_UUID$1,
5072
+ minBundleId: minBundleId || NIL_UUID,
5073
5073
  channel: channel || "production",
5074
5074
  _updateStrategy: "appVersion"
5075
5075
  };
@@ -5089,7 +5089,7 @@ app.get("/api/check-update/fingerprint/:platform/:fingerprintHash/:channel/:minB
5089
5089
  platform,
5090
5090
  fingerprintHash,
5091
5091
  bundleId,
5092
- minBundleId: minBundleId || NIL_UUID$1,
5092
+ minBundleId: minBundleId || NIL_UUID,
5093
5093
  channel: channel || "production",
5094
5094
  _updateStrategy: "fingerprint"
5095
5095
  };
@@ -299,7 +299,7 @@ Object.keys(r.modifier);
299
299
  const tD = Object.keys(r.color), eD = Object.keys(r.bgColor);
300
300
  [...tD, ...eD];
301
301
  function sD() {
302
- const t = new Map();
302
+ const t = /* @__PURE__ */ new Map();
303
303
  for (const [u$2, F$1] of Object.entries(r)) {
304
304
  for (const [e$1, s] of Object.entries(F$1)) r[e$1] = {
305
305
  open: `\x1B[${s[0]}m`,
@@ -514,7 +514,7 @@ var AD = Object.defineProperty, pD = (t, u$2, F$1) => u$2 in t ? AD(t, u$2, {
514
514
  }) : t[u$2] = F$1, h$1 = (t, u$2, F$1) => (pD(t, typeof u$2 != "symbol" ? u$2 + "" : u$2, F$1), F$1);
515
515
  var x = class {
516
516
  constructor(u$2, F$1 = !0) {
517
- h$1(this, "input"), h$1(this, "output"), h$1(this, "_abortSignal"), h$1(this, "rl"), h$1(this, "opts"), h$1(this, "_render"), h$1(this, "_track", !1), h$1(this, "_prevFrame", ""), h$1(this, "_subscribers", new Map()), h$1(this, "_cursor", 0), h$1(this, "state", "initial"), h$1(this, "error", ""), h$1(this, "value");
517
+ h$1(this, "input"), h$1(this, "output"), h$1(this, "_abortSignal"), h$1(this, "rl"), h$1(this, "opts"), h$1(this, "_render"), h$1(this, "_track", !1), h$1(this, "_prevFrame", ""), h$1(this, "_subscribers", /* @__PURE__ */ new Map()), h$1(this, "_cursor", 0), h$1(this, "state", "initial"), h$1(this, "error", ""), h$1(this, "value");
518
518
  const { input: e$1 = node_process.stdin, output: s = node_process.stdout, render: i$1, signal: D$1,...C$1 } = u$2;
519
519
  this.opts = C$1, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i$1.bind(this), this._track = F$1, this._abortSignal = D$1, this.input = e$1, this.output = s;
520
520
  }
@@ -1376,7 +1376,7 @@ function areObjectsEqual(a$1, b$2, stack, areValuesEqual) {
1376
1376
  case regexpTag: return a$1.source === b$2.source && a$1.flags === b$2.flags;
1377
1377
  case functionTag: return a$1 === b$2;
1378
1378
  }
1379
- stack = stack ?? new Map();
1379
+ stack = stack ?? /* @__PURE__ */ new Map();
1380
1380
  const aStack = stack.get(a$1);
1381
1381
  const bStack = stack.get(b$2);
1382
1382
  if (aStack != null && bStack != null) return aStack === b$2;
@@ -2177,7 +2177,7 @@ const getVerboseObject = ({ type, result, verboseInfo: { escapedCommand, command
2177
2177
  type,
2178
2178
  escapedCommand,
2179
2179
  commandId: `${commandId}`,
2180
- timestamp: new Date(),
2180
+ timestamp: /* @__PURE__ */ new Date(),
2181
2181
  piped,
2182
2182
  result,
2183
2183
  options
@@ -3298,7 +3298,7 @@ const getFromStream = (source, from = "stdout") => {
3298
3298
  if (sourceStream === null || sourceStream === void 0) throw new TypeError(getInvalidStdioOptionMessage(fdNumber, from, options, isWritable));
3299
3299
  return sourceStream;
3300
3300
  };
3301
- const SUBPROCESS_OPTIONS = new WeakMap();
3301
+ const SUBPROCESS_OPTIONS = /* @__PURE__ */ new WeakMap();
3302
3302
  const getFdNumber = (fileDescriptors, fdName, isWritable) => {
3303
3303
  const fdNumber = parseFdNumber(fdName, isWritable);
3304
3304
  validateFdNumber(fdNumber, fdName, isWritable, fileDescriptors);
@@ -3427,7 +3427,7 @@ const onDisconnect = async ({ anyProcess, channel, isSubprocess, ipcEmitter, bou
3427
3427
  ipcEmitter.connected = false;
3428
3428
  ipcEmitter.emit("disconnect");
3429
3429
  };
3430
- const INCOMING_MESSAGES = new WeakMap();
3430
+ const INCOMING_MESSAGES = /* @__PURE__ */ new WeakMap();
3431
3431
 
3432
3432
  //#endregion
3433
3433
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/ipc/forward.js
@@ -3444,7 +3444,7 @@ const getIpcEmitter = (anyProcess, channel, isSubprocess) => {
3444
3444
  });
3445
3445
  return ipcEmitter;
3446
3446
  };
3447
- const IPC_EMITTERS = new WeakMap();
3447
+ const IPC_EMITTERS = /* @__PURE__ */ new WeakMap();
3448
3448
  const forwardEvents = ({ ipcEmitter, anyProcess, channel, isSubprocess }) => {
3449
3449
  const boundOnMessage = onMessage.bind(void 0, {
3450
3450
  anyProcess,
@@ -3543,7 +3543,7 @@ const RESPONSE_TYPE = "execa:ipc:response";
3543
3543
  //#endregion
3544
3544
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/ipc/outgoing.js
3545
3545
  const startSendMessage = (anyProcess, wrappedMessage, strict) => {
3546
- if (!OUTGOING_MESSAGES.has(anyProcess)) OUTGOING_MESSAGES.set(anyProcess, new Set());
3546
+ if (!OUTGOING_MESSAGES.has(anyProcess)) OUTGOING_MESSAGES.set(anyProcess, /* @__PURE__ */ new Set());
3547
3547
  const outgoingMessages = OUTGOING_MESSAGES.get(anyProcess);
3548
3548
  const onMessageSent = createDeferred();
3549
3549
  const id = strict ? wrappedMessage.id : void 0;
@@ -3568,7 +3568,7 @@ const waitForOutgoingMessages = async (anyProcess, ipcEmitter, wrappedMessage) =
3568
3568
  await Promise.all(outgoingMessages.map(({ onMessageSent }) => onMessageSent));
3569
3569
  }
3570
3570
  };
3571
- const OUTGOING_MESSAGES = new WeakMap();
3571
+ const OUTGOING_MESSAGES = /* @__PURE__ */ new WeakMap();
3572
3572
  const hasMessageListeners = (anyProcess, ipcEmitter) => ipcEmitter.listenerCount("message") > getMinListenerCount(anyProcess);
3573
3573
  const getMinListenerCount = (anyProcess) => SUBPROCESS_OPTIONS.has(anyProcess) && !getFdSpecificValue(SUBPROCESS_OPTIONS.get(anyProcess).options.buffer, "ipc") ? 1 : 0;
3574
3574
 
@@ -3640,7 +3640,7 @@ const getSendMethod = (anyProcess) => {
3640
3640
  PROCESS_SEND_METHODS.set(anyProcess, sendMethod);
3641
3641
  return sendMethod;
3642
3642
  };
3643
- const PROCESS_SEND_METHODS = new WeakMap();
3643
+ const PROCESS_SEND_METHODS = /* @__PURE__ */ new WeakMap();
3644
3644
 
3645
3645
  //#endregion
3646
3646
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/ipc/graceful.js
@@ -3957,14 +3957,14 @@ const CR_BINARY = CR.codePointAt(0);
3957
3957
  function isStream(stream, { checkOpen = true } = {}) {
3958
3958
  return stream !== null && typeof stream === "object" && (stream.writable || stream.readable || !checkOpen || stream.writable === void 0 && stream.readable === void 0) && typeof stream.pipe === "function";
3959
3959
  }
3960
- function isWritableStream$1(stream, { checkOpen = true } = {}) {
3960
+ function isWritableStream(stream, { checkOpen = true } = {}) {
3961
3961
  return isStream(stream, { checkOpen }) && (stream.writable || !checkOpen) && typeof stream.write === "function" && typeof stream.end === "function" && typeof stream.writable === "boolean" && typeof stream.writableObjectMode === "boolean" && typeof stream.destroy === "function" && typeof stream.destroyed === "boolean";
3962
3962
  }
3963
- function isReadableStream$1(stream, { checkOpen = true } = {}) {
3963
+ function isReadableStream(stream, { checkOpen = true } = {}) {
3964
3964
  return isStream(stream, { checkOpen }) && (stream.readable || !checkOpen) && typeof stream.read === "function" && typeof stream.readable === "boolean" && typeof stream.readableObjectMode === "boolean" && typeof stream.destroy === "function" && typeof stream.destroyed === "boolean";
3965
3965
  }
3966
3966
  function isDuplexStream(stream, options) {
3967
- return isWritableStream$1(stream, options) && isReadableStream$1(stream, options);
3967
+ return isWritableStream(stream, options) && isReadableStream(stream, options);
3968
3968
  }
3969
3969
 
3970
3970
  //#endregion
@@ -4051,7 +4051,7 @@ function h({ preventCancel: r$1 = !1 } = {}) {
4051
4051
  //#endregion
4052
4052
  //#region ../../node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/stream.js
4053
4053
  const getAsyncIterable = (stream) => {
4054
- if (isReadableStream$1(stream, { checkOpen: false }) && nodeImports.on !== void 0) return getStreamIterable(stream);
4054
+ if (isReadableStream(stream, { checkOpen: false }) && nodeImports.on !== void 0) return getStreamIterable(stream);
4055
4055
  if (typeof stream?.[Symbol.asyncIterator] === "function") return stream;
4056
4056
  if (toString.call(stream) === "[object ReadableStream]") return h.call(stream);
4057
4057
  throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.");
@@ -4750,10 +4750,10 @@ const KNOWN_STDIO_STRINGS = new Set([
4750
4750
  "overlapped",
4751
4751
  "pipe"
4752
4752
  ]);
4753
- const isReadableStream = (value) => Object.prototype.toString.call(value) === "[object ReadableStream]";
4754
- const isWritableStream = (value) => Object.prototype.toString.call(value) === "[object WritableStream]";
4755
- const isWebStream = (value) => isReadableStream(value) || isWritableStream(value);
4756
- const isTransformStream = (value) => isReadableStream(value?.readable) && isWritableStream(value?.writable);
4753
+ const isReadableStream$1 = (value) => Object.prototype.toString.call(value) === "[object ReadableStream]";
4754
+ const isWritableStream$1 = (value) => Object.prototype.toString.call(value) === "[object WritableStream]";
4755
+ const isWebStream = (value) => isReadableStream$1(value) || isWritableStream$1(value);
4756
+ const isTransformStream = (value) => isReadableStream$1(value?.readable) && isWritableStream$1(value?.writable);
4757
4757
  const isAsyncIterableObject = (value) => isObject(value) && typeof value[Symbol.asyncIterator] === "function";
4758
4758
  const isIterableObject = (value) => isObject(value) && typeof value[Symbol.iterator] === "function";
4759
4759
  const isObject = (value) => typeof value === "object" && value !== null;
@@ -4917,10 +4917,10 @@ const guessStreamDirection = {
4917
4917
  iterable: alwaysInput,
4918
4918
  asyncIterable: alwaysInput,
4919
4919
  uint8Array: alwaysInput,
4920
- webStream: (value) => isWritableStream(value) ? "output" : "input",
4920
+ webStream: (value) => isWritableStream$1(value) ? "output" : "input",
4921
4921
  nodeStream(value) {
4922
- if (!isReadableStream$1(value, { checkOpen: false })) return "output";
4923
- return isWritableStream$1(value, { checkOpen: false }) ? void 0 : "input";
4922
+ if (!isReadableStream(value, { checkOpen: false })) return "output";
4923
+ return isWritableStream(value, { checkOpen: false }) ? void 0 : "input";
4924
4924
  },
4925
4925
  webTransform: anyDirection,
4926
4926
  duplex: anyDirection,
@@ -5050,7 +5050,7 @@ const handleInputOption = (input) => input === void 0 ? [] : [{
5050
5050
  optionName: "input"
5051
5051
  }];
5052
5052
  const getInputType = (input) => {
5053
- if (isReadableStream$1(input, { checkOpen: false })) return "nodeStream";
5053
+ if (isReadableStream(input, { checkOpen: false })) return "nodeStream";
5054
5054
  if (typeof input === "string") return "string";
5055
5055
  if (isUint8Array(input)) return "uint8Array";
5056
5056
  throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.");
@@ -6188,7 +6188,7 @@ var MergedStream = class extends node_stream.PassThrough {
6188
6188
  #aborted = new Set([]);
6189
6189
  #onFinished;
6190
6190
  #unpipeEvent = Symbol("unpipe");
6191
- #streamPromises = new WeakMap();
6191
+ #streamPromises = /* @__PURE__ */ new WeakMap();
6192
6192
  add(stream) {
6193
6193
  validateStream(stream);
6194
6194
  if (this.#streams.has(stream)) return;
@@ -6368,7 +6368,7 @@ const abortSourceStream = (source) => {
6368
6368
  //#endregion
6369
6369
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/io/output-async.js
6370
6370
  const pipeOutputAsync = (subprocess, fileDescriptors, controller) => {
6371
- const pipeGroups = new Map();
6371
+ const pipeGroups = /* @__PURE__ */ new Map();
6372
6372
  for (const [fdNumber, { stdioItems, direction }] of Object.entries(fileDescriptors)) {
6373
6373
  for (const { stream } of stdioItems.filter(({ type }) => TRANSFORM_TYPES.has(type))) pipeTransform(subprocess, stream, direction, fdNumber);
6374
6374
  for (const { stream } of stdioItems.filter(({ type }) => !TRANSFORM_TYPES.has(type))) pipeStdioItem({
@@ -6774,7 +6774,7 @@ const cleanupMergedStreamsMap = async (destinationStream) => {
6774
6774
  } catch {}
6775
6775
  MERGED_STREAMS.delete(destinationStream);
6776
6776
  };
6777
- const MERGED_STREAMS = new WeakMap();
6777
+ const MERGED_STREAMS = /* @__PURE__ */ new WeakMap();
6778
6778
  const SOURCE_LISTENERS_PER_PIPE = 2;
6779
6779
  const DESTINATION_LISTENERS_PER_PIPE = 1;
6780
6780
 
@@ -7260,9 +7260,9 @@ const throwOnSubprocessError = async (subprocess, { signal }) => {
7260
7260
  //#endregion
7261
7261
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/convert/concurrent.js
7262
7262
  const initializeConcurrentStreams = () => ({
7263
- readableDestroy: new WeakMap(),
7264
- writableFinal: new WeakMap(),
7265
- writableDestroy: new WeakMap()
7263
+ readableDestroy: /* @__PURE__ */ new WeakMap(),
7264
+ writableFinal: /* @__PURE__ */ new WeakMap(),
7265
+ writableDestroy: /* @__PURE__ */ new WeakMap()
7266
7266
  });
7267
7267
  const addConcurrentStream = (concurrentStreams, stream, waitName) => {
7268
7268
  const weakMap = concurrentStreams[waitName];
@@ -6,6 +6,5 @@ declare const runInit: ({
6
6
  }: {
7
7
  build: BuildType;
8
8
  }) => Promise<void>;
9
-
10
9
  //#endregion
11
10
  export { runInit };
@@ -6,6 +6,5 @@ declare const runInit: ({
6
6
  }: {
7
7
  build: BuildType;
8
8
  }) => Promise<void>;
9
-
10
9
  //#endregion
11
10
  export { runInit };
package/dist/iac/index.js CHANGED
@@ -302,7 +302,7 @@ Object.keys(r.modifier);
302
302
  const tD = Object.keys(r.color), eD = Object.keys(r.bgColor);
303
303
  [...tD, ...eD];
304
304
  function sD() {
305
- const t = new Map();
305
+ const t = /* @__PURE__ */ new Map();
306
306
  for (const [u$2, F$1] of Object.entries(r)) {
307
307
  for (const [e$1, s] of Object.entries(F$1)) r[e$1] = {
308
308
  open: `\x1B[${s[0]}m`,
@@ -517,7 +517,7 @@ var AD = Object.defineProperty, pD = (t, u$2, F$1) => u$2 in t ? AD(t, u$2, {
517
517
  }) : t[u$2] = F$1, h$1 = (t, u$2, F$1) => (pD(t, typeof u$2 != "symbol" ? u$2 + "" : u$2, F$1), F$1);
518
518
  var x = class {
519
519
  constructor(u$2, F$1 = !0) {
520
- h$1(this, "input"), h$1(this, "output"), h$1(this, "_abortSignal"), h$1(this, "rl"), h$1(this, "opts"), h$1(this, "_render"), h$1(this, "_track", !1), h$1(this, "_prevFrame", ""), h$1(this, "_subscribers", new Map()), h$1(this, "_cursor", 0), h$1(this, "state", "initial"), h$1(this, "error", ""), h$1(this, "value");
520
+ h$1(this, "input"), h$1(this, "output"), h$1(this, "_abortSignal"), h$1(this, "rl"), h$1(this, "opts"), h$1(this, "_render"), h$1(this, "_track", !1), h$1(this, "_prevFrame", ""), h$1(this, "_subscribers", /* @__PURE__ */ new Map()), h$1(this, "_cursor", 0), h$1(this, "state", "initial"), h$1(this, "error", ""), h$1(this, "value");
521
521
  const { input: e$1 = stdin, output: s = stdout, render: i$1, signal: D$1,...C$1 } = u$2;
522
522
  this.opts = C$1, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i$1.bind(this), this._track = F$1, this._abortSignal = D$1, this.input = e$1, this.output = s;
523
523
  }
@@ -1379,7 +1379,7 @@ function areObjectsEqual(a$1, b$2, stack, areValuesEqual) {
1379
1379
  case regexpTag: return a$1.source === b$2.source && a$1.flags === b$2.flags;
1380
1380
  case functionTag: return a$1 === b$2;
1381
1381
  }
1382
- stack = stack ?? new Map();
1382
+ stack = stack ?? /* @__PURE__ */ new Map();
1383
1383
  const aStack = stack.get(a$1);
1384
1384
  const bStack = stack.get(b$2);
1385
1385
  if (aStack != null && bStack != null) return aStack === b$2;
@@ -2180,7 +2180,7 @@ const getVerboseObject = ({ type, result, verboseInfo: { escapedCommand, command
2180
2180
  type,
2181
2181
  escapedCommand,
2182
2182
  commandId: `${commandId}`,
2183
- timestamp: new Date(),
2183
+ timestamp: /* @__PURE__ */ new Date(),
2184
2184
  piped,
2185
2185
  result,
2186
2186
  options
@@ -3301,7 +3301,7 @@ const getFromStream = (source, from = "stdout") => {
3301
3301
  if (sourceStream === null || sourceStream === void 0) throw new TypeError(getInvalidStdioOptionMessage(fdNumber, from, options, isWritable));
3302
3302
  return sourceStream;
3303
3303
  };
3304
- const SUBPROCESS_OPTIONS = new WeakMap();
3304
+ const SUBPROCESS_OPTIONS = /* @__PURE__ */ new WeakMap();
3305
3305
  const getFdNumber = (fileDescriptors, fdName, isWritable) => {
3306
3306
  const fdNumber = parseFdNumber(fdName, isWritable);
3307
3307
  validateFdNumber(fdNumber, fdName, isWritable, fileDescriptors);
@@ -3430,7 +3430,7 @@ const onDisconnect = async ({ anyProcess, channel, isSubprocess, ipcEmitter, bou
3430
3430
  ipcEmitter.connected = false;
3431
3431
  ipcEmitter.emit("disconnect");
3432
3432
  };
3433
- const INCOMING_MESSAGES = new WeakMap();
3433
+ const INCOMING_MESSAGES = /* @__PURE__ */ new WeakMap();
3434
3434
 
3435
3435
  //#endregion
3436
3436
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/ipc/forward.js
@@ -3447,7 +3447,7 @@ const getIpcEmitter = (anyProcess, channel, isSubprocess) => {
3447
3447
  });
3448
3448
  return ipcEmitter;
3449
3449
  };
3450
- const IPC_EMITTERS = new WeakMap();
3450
+ const IPC_EMITTERS = /* @__PURE__ */ new WeakMap();
3451
3451
  const forwardEvents = ({ ipcEmitter, anyProcess, channel, isSubprocess }) => {
3452
3452
  const boundOnMessage = onMessage.bind(void 0, {
3453
3453
  anyProcess,
@@ -3546,7 +3546,7 @@ const RESPONSE_TYPE = "execa:ipc:response";
3546
3546
  //#endregion
3547
3547
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/ipc/outgoing.js
3548
3548
  const startSendMessage = (anyProcess, wrappedMessage, strict) => {
3549
- if (!OUTGOING_MESSAGES.has(anyProcess)) OUTGOING_MESSAGES.set(anyProcess, new Set());
3549
+ if (!OUTGOING_MESSAGES.has(anyProcess)) OUTGOING_MESSAGES.set(anyProcess, /* @__PURE__ */ new Set());
3550
3550
  const outgoingMessages = OUTGOING_MESSAGES.get(anyProcess);
3551
3551
  const onMessageSent = createDeferred();
3552
3552
  const id = strict ? wrappedMessage.id : void 0;
@@ -3571,7 +3571,7 @@ const waitForOutgoingMessages = async (anyProcess, ipcEmitter, wrappedMessage) =
3571
3571
  await Promise.all(outgoingMessages.map(({ onMessageSent }) => onMessageSent));
3572
3572
  }
3573
3573
  };
3574
- const OUTGOING_MESSAGES = new WeakMap();
3574
+ const OUTGOING_MESSAGES = /* @__PURE__ */ new WeakMap();
3575
3575
  const hasMessageListeners = (anyProcess, ipcEmitter) => ipcEmitter.listenerCount("message") > getMinListenerCount(anyProcess);
3576
3576
  const getMinListenerCount = (anyProcess) => SUBPROCESS_OPTIONS.has(anyProcess) && !getFdSpecificValue(SUBPROCESS_OPTIONS.get(anyProcess).options.buffer, "ipc") ? 1 : 0;
3577
3577
 
@@ -3643,7 +3643,7 @@ const getSendMethod = (anyProcess) => {
3643
3643
  PROCESS_SEND_METHODS.set(anyProcess, sendMethod);
3644
3644
  return sendMethod;
3645
3645
  };
3646
- const PROCESS_SEND_METHODS = new WeakMap();
3646
+ const PROCESS_SEND_METHODS = /* @__PURE__ */ new WeakMap();
3647
3647
 
3648
3648
  //#endregion
3649
3649
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/ipc/graceful.js
@@ -3960,14 +3960,14 @@ const CR_BINARY = CR.codePointAt(0);
3960
3960
  function isStream(stream, { checkOpen = true } = {}) {
3961
3961
  return stream !== null && typeof stream === "object" && (stream.writable || stream.readable || !checkOpen || stream.writable === void 0 && stream.readable === void 0) && typeof stream.pipe === "function";
3962
3962
  }
3963
- function isWritableStream$1(stream, { checkOpen = true } = {}) {
3963
+ function isWritableStream(stream, { checkOpen = true } = {}) {
3964
3964
  return isStream(stream, { checkOpen }) && (stream.writable || !checkOpen) && typeof stream.write === "function" && typeof stream.end === "function" && typeof stream.writable === "boolean" && typeof stream.writableObjectMode === "boolean" && typeof stream.destroy === "function" && typeof stream.destroyed === "boolean";
3965
3965
  }
3966
- function isReadableStream$1(stream, { checkOpen = true } = {}) {
3966
+ function isReadableStream(stream, { checkOpen = true } = {}) {
3967
3967
  return isStream(stream, { checkOpen }) && (stream.readable || !checkOpen) && typeof stream.read === "function" && typeof stream.readable === "boolean" && typeof stream.readableObjectMode === "boolean" && typeof stream.destroy === "function" && typeof stream.destroyed === "boolean";
3968
3968
  }
3969
3969
  function isDuplexStream(stream, options) {
3970
- return isWritableStream$1(stream, options) && isReadableStream$1(stream, options);
3970
+ return isWritableStream(stream, options) && isReadableStream(stream, options);
3971
3971
  }
3972
3972
 
3973
3973
  //#endregion
@@ -4054,7 +4054,7 @@ function h({ preventCancel: r$1 = !1 } = {}) {
4054
4054
  //#endregion
4055
4055
  //#region ../../node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/stream.js
4056
4056
  const getAsyncIterable = (stream) => {
4057
- if (isReadableStream$1(stream, { checkOpen: false }) && nodeImports.on !== void 0) return getStreamIterable(stream);
4057
+ if (isReadableStream(stream, { checkOpen: false }) && nodeImports.on !== void 0) return getStreamIterable(stream);
4058
4058
  if (typeof stream?.[Symbol.asyncIterator] === "function") return stream;
4059
4059
  if (toString.call(stream) === "[object ReadableStream]") return h.call(stream);
4060
4060
  throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.");
@@ -4753,10 +4753,10 @@ const KNOWN_STDIO_STRINGS = new Set([
4753
4753
  "overlapped",
4754
4754
  "pipe"
4755
4755
  ]);
4756
- const isReadableStream = (value) => Object.prototype.toString.call(value) === "[object ReadableStream]";
4757
- const isWritableStream = (value) => Object.prototype.toString.call(value) === "[object WritableStream]";
4758
- const isWebStream = (value) => isReadableStream(value) || isWritableStream(value);
4759
- const isTransformStream = (value) => isReadableStream(value?.readable) && isWritableStream(value?.writable);
4756
+ const isReadableStream$1 = (value) => Object.prototype.toString.call(value) === "[object ReadableStream]";
4757
+ const isWritableStream$1 = (value) => Object.prototype.toString.call(value) === "[object WritableStream]";
4758
+ const isWebStream = (value) => isReadableStream$1(value) || isWritableStream$1(value);
4759
+ const isTransformStream = (value) => isReadableStream$1(value?.readable) && isWritableStream$1(value?.writable);
4760
4760
  const isAsyncIterableObject = (value) => isObject(value) && typeof value[Symbol.asyncIterator] === "function";
4761
4761
  const isIterableObject = (value) => isObject(value) && typeof value[Symbol.iterator] === "function";
4762
4762
  const isObject = (value) => typeof value === "object" && value !== null;
@@ -4920,10 +4920,10 @@ const guessStreamDirection = {
4920
4920
  iterable: alwaysInput,
4921
4921
  asyncIterable: alwaysInput,
4922
4922
  uint8Array: alwaysInput,
4923
- webStream: (value) => isWritableStream(value) ? "output" : "input",
4923
+ webStream: (value) => isWritableStream$1(value) ? "output" : "input",
4924
4924
  nodeStream(value) {
4925
- if (!isReadableStream$1(value, { checkOpen: false })) return "output";
4926
- return isWritableStream$1(value, { checkOpen: false }) ? void 0 : "input";
4925
+ if (!isReadableStream(value, { checkOpen: false })) return "output";
4926
+ return isWritableStream(value, { checkOpen: false }) ? void 0 : "input";
4927
4927
  },
4928
4928
  webTransform: anyDirection,
4929
4929
  duplex: anyDirection,
@@ -5053,7 +5053,7 @@ const handleInputOption = (input) => input === void 0 ? [] : [{
5053
5053
  optionName: "input"
5054
5054
  }];
5055
5055
  const getInputType = (input) => {
5056
- if (isReadableStream$1(input, { checkOpen: false })) return "nodeStream";
5056
+ if (isReadableStream(input, { checkOpen: false })) return "nodeStream";
5057
5057
  if (typeof input === "string") return "string";
5058
5058
  if (isUint8Array(input)) return "uint8Array";
5059
5059
  throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.");
@@ -6191,7 +6191,7 @@ var MergedStream = class extends PassThrough {
6191
6191
  #aborted = new Set([]);
6192
6192
  #onFinished;
6193
6193
  #unpipeEvent = Symbol("unpipe");
6194
- #streamPromises = new WeakMap();
6194
+ #streamPromises = /* @__PURE__ */ new WeakMap();
6195
6195
  add(stream) {
6196
6196
  validateStream(stream);
6197
6197
  if (this.#streams.has(stream)) return;
@@ -6371,7 +6371,7 @@ const abortSourceStream = (source) => {
6371
6371
  //#endregion
6372
6372
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/io/output-async.js
6373
6373
  const pipeOutputAsync = (subprocess, fileDescriptors, controller) => {
6374
- const pipeGroups = new Map();
6374
+ const pipeGroups = /* @__PURE__ */ new Map();
6375
6375
  for (const [fdNumber, { stdioItems, direction }] of Object.entries(fileDescriptors)) {
6376
6376
  for (const { stream } of stdioItems.filter(({ type }) => TRANSFORM_TYPES.has(type))) pipeTransform(subprocess, stream, direction, fdNumber);
6377
6377
  for (const { stream } of stdioItems.filter(({ type }) => !TRANSFORM_TYPES.has(type))) pipeStdioItem({
@@ -6777,7 +6777,7 @@ const cleanupMergedStreamsMap = async (destinationStream) => {
6777
6777
  } catch {}
6778
6778
  MERGED_STREAMS.delete(destinationStream);
6779
6779
  };
6780
- const MERGED_STREAMS = new WeakMap();
6780
+ const MERGED_STREAMS = /* @__PURE__ */ new WeakMap();
6781
6781
  const SOURCE_LISTENERS_PER_PIPE = 2;
6782
6782
  const DESTINATION_LISTENERS_PER_PIPE = 1;
6783
6783
 
@@ -7263,9 +7263,9 @@ const throwOnSubprocessError = async (subprocess, { signal }) => {
7263
7263
  //#endregion
7264
7264
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/convert/concurrent.js
7265
7265
  const initializeConcurrentStreams = () => ({
7266
- readableDestroy: new WeakMap(),
7267
- writableFinal: new WeakMap(),
7268
- writableDestroy: new WeakMap()
7266
+ readableDestroy: /* @__PURE__ */ new WeakMap(),
7267
+ writableFinal: /* @__PURE__ */ new WeakMap(),
7268
+ writableDestroy: /* @__PURE__ */ new WeakMap()
7269
7269
  });
7270
7270
  const addConcurrentStream = (concurrentStreams, stream, waitName) => {
7271
7271
  const weakMap = concurrentStreams[waitName];
package/dist/index.cjs CHANGED
@@ -1298,16 +1298,16 @@ var __classPrivateFieldGet = void 0 && (void 0).__classPrivateFieldGet || functi
1298
1298
  var _Mime_extensionToType, _Mime_typeToExtension, _Mime_typeToExtensions;
1299
1299
  var Mime = class {
1300
1300
  constructor(...args) {
1301
- _Mime_extensionToType.set(this, new Map());
1302
- _Mime_typeToExtension.set(this, new Map());
1303
- _Mime_typeToExtensions.set(this, new Map());
1301
+ _Mime_extensionToType.set(this, /* @__PURE__ */ new Map());
1302
+ _Mime_typeToExtension.set(this, /* @__PURE__ */ new Map());
1303
+ _Mime_typeToExtensions.set(this, /* @__PURE__ */ new Map());
1304
1304
  for (const arg of args) this.define(arg);
1305
1305
  }
1306
1306
  define(typeMap, force = false) {
1307
1307
  for (let [type, extensions] of Object.entries(typeMap)) {
1308
1308
  type = type.toLowerCase();
1309
1309
  extensions = extensions.map((ext) => ext.toLowerCase());
1310
- if (!__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").has(type)) __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").set(type, new Set());
1310
+ if (!__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").has(type)) __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").set(type, /* @__PURE__ */ new Set());
1311
1311
  const allExtensions = __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type);
1312
1312
  let first = true;
1313
1313
  for (let extension of extensions) {
@@ -1357,7 +1357,7 @@ var Mime = class {
1357
1357
  };
1358
1358
  }
1359
1359
  };
1360
- _Mime_extensionToType = new WeakMap(), _Mime_typeToExtension = new WeakMap(), _Mime_typeToExtensions = new WeakMap();
1360
+ _Mime_extensionToType = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtension = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtensions = /* @__PURE__ */ new WeakMap();
1361
1361
  var Mime_default = Mime;
1362
1362
 
1363
1363
  //#endregion
@@ -1448,26 +1448,31 @@ const firebaseDatabase = (config, hooks) => {
1448
1448
  return convertToBundle(firestoreData);
1449
1449
  },
1450
1450
  async getBundles(context, options) {
1451
- const { where, limit, offset = 0 } = options ?? {};
1451
+ const { where, limit, offset } = options;
1452
1452
  let query = context.bundlesCollection;
1453
1453
  if (where?.channel) query = query.where("channel", "==", where.channel);
1454
1454
  if (where?.platform) query = query.where("platform", "==", where.platform);
1455
1455
  query = query.orderBy("id", "desc");
1456
- if (offset) query = query.offset(offset);
1456
+ const totalCountQuery = query;
1457
+ const totalSnapshot = await totalCountQuery.get();
1458
+ const total = totalSnapshot.size;
1459
+ if (offset > 0) query = query.offset(offset);
1457
1460
  if (limit) query = query.limit(limit);
1458
1461
  const querySnapshot = await query.get();
1459
- if (querySnapshot.empty) {
1460
- bundles = [];
1461
- return bundles;
1462
- }
1463
1462
  bundles = querySnapshot.docs.map((doc) => convertToBundle(doc.data()));
1464
- return bundles;
1463
+ return {
1464
+ data: bundles,
1465
+ pagination: (0, __hot_updater_plugin_core.calculatePagination)(total, {
1466
+ limit,
1467
+ offset
1468
+ })
1469
+ };
1465
1470
  },
1466
1471
  async getChannels(context) {
1467
1472
  const channelsCollection = context.db.collection("channels");
1468
1473
  const querySnapshot = await channelsCollection.get();
1469
1474
  if (querySnapshot.empty) return [];
1470
- const channels = new Set();
1475
+ const channels = /* @__PURE__ */ new Set();
1471
1476
  for (const doc of querySnapshot.docs) {
1472
1477
  const data = doc.data();
1473
1478
  if (data.name) channels.add(data.name);
@@ -1506,8 +1511,8 @@ const firebaseDatabase = (config, hooks) => {
1506
1511
  transaction.set(channelRef, { name: data.channel }, { merge: true });
1507
1512
  }
1508
1513
  }
1509
- const requiredTargetVersionKeys = new Set();
1510
- const requiredChannels = new Set();
1514
+ const requiredTargetVersionKeys = /* @__PURE__ */ new Set();
1515
+ const requiredChannels = /* @__PURE__ */ new Set();
1511
1516
  for (const bundle of Object.values(bundlesMap)) {
1512
1517
  if (bundle.target_app_version) {
1513
1518
  const key = `${bundle.platform}_${bundle.channel}_${bundle.target_app_version}`;
package/dist/index.d.cts CHANGED
@@ -8,10 +8,8 @@ interface FirebaseStorageConfig extends admin$1.AppOptions {
8
8
  storageBucket: string;
9
9
  }
10
10
  declare const firebaseStorage: (config: FirebaseStorageConfig, hooks?: StoragePluginHooks) => (_: BasePluginArgs) => StoragePlugin;
11
-
12
11
  //#endregion
13
12
  //#region src/firebaseDatabase.d.ts
14
13
  declare const firebaseDatabase: (config: admin.AppOptions, hooks?: DatabasePluginHooks) => (options: _hot_updater_plugin_core0.BasePluginArgs) => _hot_updater_plugin_core0.DatabasePlugin;
15
-
16
14
  //#endregion
17
15
  export { FirebaseStorageConfig, firebaseDatabase, firebaseStorage };
package/dist/index.d.ts CHANGED
@@ -8,10 +8,8 @@ interface FirebaseStorageConfig extends admin$1.AppOptions {
8
8
  storageBucket: string;
9
9
  }
10
10
  declare const firebaseStorage: (config: FirebaseStorageConfig, hooks?: StoragePluginHooks) => (_: BasePluginArgs) => StoragePlugin;
11
-
12
11
  //#endregion
13
12
  //#region src/firebaseDatabase.d.ts
14
13
  declare const firebaseDatabase: (config: admin.AppOptions, hooks?: DatabasePluginHooks) => (options: _hot_updater_plugin_core0.BasePluginArgs) => _hot_updater_plugin_core0.DatabasePlugin;
15
-
16
14
  //#endregion
17
15
  export { FirebaseStorageConfig, firebaseDatabase, firebaseStorage };
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import path from "path";
2
2
  import * as admin$1 from "firebase-admin";
3
3
  import * as admin from "firebase-admin";
4
4
  import fs from "fs/promises";
5
- import { createDatabasePlugin } from "@hot-updater/plugin-core";
5
+ import { calculatePagination, createDatabasePlugin } from "@hot-updater/plugin-core";
6
6
 
7
7
  //#region ../../node_modules/.pnpm/mime@4.0.4/node_modules/mime/dist/types/other.js
8
8
  const types$1 = {
@@ -1276,16 +1276,16 @@ var __classPrivateFieldGet = void 0 && (void 0).__classPrivateFieldGet || functi
1276
1276
  var _Mime_extensionToType, _Mime_typeToExtension, _Mime_typeToExtensions;
1277
1277
  var Mime = class {
1278
1278
  constructor(...args) {
1279
- _Mime_extensionToType.set(this, new Map());
1280
- _Mime_typeToExtension.set(this, new Map());
1281
- _Mime_typeToExtensions.set(this, new Map());
1279
+ _Mime_extensionToType.set(this, /* @__PURE__ */ new Map());
1280
+ _Mime_typeToExtension.set(this, /* @__PURE__ */ new Map());
1281
+ _Mime_typeToExtensions.set(this, /* @__PURE__ */ new Map());
1282
1282
  for (const arg of args) this.define(arg);
1283
1283
  }
1284
1284
  define(typeMap, force = false) {
1285
1285
  for (let [type, extensions] of Object.entries(typeMap)) {
1286
1286
  type = type.toLowerCase();
1287
1287
  extensions = extensions.map((ext) => ext.toLowerCase());
1288
- if (!__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").has(type)) __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").set(type, new Set());
1288
+ if (!__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").has(type)) __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").set(type, /* @__PURE__ */ new Set());
1289
1289
  const allExtensions = __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type);
1290
1290
  let first = true;
1291
1291
  for (let extension of extensions) {
@@ -1335,7 +1335,7 @@ var Mime = class {
1335
1335
  };
1336
1336
  }
1337
1337
  };
1338
- _Mime_extensionToType = new WeakMap(), _Mime_typeToExtension = new WeakMap(), _Mime_typeToExtensions = new WeakMap();
1338
+ _Mime_extensionToType = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtension = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtensions = /* @__PURE__ */ new WeakMap();
1339
1339
  var Mime_default = Mime;
1340
1340
 
1341
1341
  //#endregion
@@ -1426,26 +1426,31 @@ const firebaseDatabase = (config, hooks) => {
1426
1426
  return convertToBundle(firestoreData);
1427
1427
  },
1428
1428
  async getBundles(context, options) {
1429
- const { where, limit, offset = 0 } = options ?? {};
1429
+ const { where, limit, offset } = options;
1430
1430
  let query = context.bundlesCollection;
1431
1431
  if (where?.channel) query = query.where("channel", "==", where.channel);
1432
1432
  if (where?.platform) query = query.where("platform", "==", where.platform);
1433
1433
  query = query.orderBy("id", "desc");
1434
- if (offset) query = query.offset(offset);
1434
+ const totalCountQuery = query;
1435
+ const totalSnapshot = await totalCountQuery.get();
1436
+ const total = totalSnapshot.size;
1437
+ if (offset > 0) query = query.offset(offset);
1435
1438
  if (limit) query = query.limit(limit);
1436
1439
  const querySnapshot = await query.get();
1437
- if (querySnapshot.empty) {
1438
- bundles = [];
1439
- return bundles;
1440
- }
1441
1440
  bundles = querySnapshot.docs.map((doc) => convertToBundle(doc.data()));
1442
- return bundles;
1441
+ return {
1442
+ data: bundles,
1443
+ pagination: calculatePagination(total, {
1444
+ limit,
1445
+ offset
1446
+ })
1447
+ };
1443
1448
  },
1444
1449
  async getChannels(context) {
1445
1450
  const channelsCollection = context.db.collection("channels");
1446
1451
  const querySnapshot = await channelsCollection.get();
1447
1452
  if (querySnapshot.empty) return [];
1448
- const channels = new Set();
1453
+ const channels = /* @__PURE__ */ new Set();
1449
1454
  for (const doc of querySnapshot.docs) {
1450
1455
  const data = doc.data();
1451
1456
  if (data.name) channels.add(data.name);
@@ -1484,8 +1489,8 @@ const firebaseDatabase = (config, hooks) => {
1484
1489
  transaction.set(channelRef, { name: data.channel }, { merge: true });
1485
1490
  }
1486
1491
  }
1487
- const requiredTargetVersionKeys = new Set();
1488
- const requiredChannels = new Set();
1492
+ const requiredTargetVersionKeys = /* @__PURE__ */ new Set();
1493
+ const requiredChannels = /* @__PURE__ */ new Set();
1489
1494
  for (const bundle of Object.values(bundlesMap)) {
1490
1495
  if (bundle.target_app_version) {
1491
1496
  const key = `${bundle.platform}_${bundle.channel}_${bundle.target_app_version}`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/firebase",
3
3
  "type": "module",
4
- "version": "0.18.1",
4
+ "version": "0.18.2",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "types": "dist/index.d.ts",
@@ -34,8 +34,8 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "firebase": "^11.3.1",
37
- "@hot-updater/core": "0.18.1",
38
- "@hot-updater/plugin-core": "0.18.1"
37
+ "@hot-updater/core": "0.18.2",
38
+ "@hot-updater/plugin-core": "0.18.2"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
@@ -53,7 +53,7 @@
53
53
  "hono": "^4.6.3",
54
54
  "mime": "^4.0.4",
55
55
  "picocolors": "^1.0.0",
56
- "@hot-updater/js": "0.18.1"
56
+ "@hot-updater/js": "0.18.2"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "firebase-admin": "*"