@hot-updater/supabase 0.18.0 → 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.
@@ -300,7 +300,7 @@ Object.keys(r.modifier);
300
300
  const tD = Object.keys(r.color), eD = Object.keys(r.bgColor);
301
301
  [...tD, ...eD];
302
302
  function sD() {
303
- const t = new Map();
303
+ const t = /* @__PURE__ */ new Map();
304
304
  for (const [u$2, F$1] of Object.entries(r)) {
305
305
  for (const [e$1, s] of Object.entries(F$1)) r[e$1] = {
306
306
  open: `\x1B[${s[0]}m`,
@@ -515,7 +515,7 @@ var AD = Object.defineProperty, pD = (t, u$2, F$1) => u$2 in t ? AD(t, u$2, {
515
515
  }) : 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);
516
516
  var x = class {
517
517
  constructor(u$2, F$1 = !0) {
518
- 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");
518
+ 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");
519
519
  const { input: e$1 = node_process.stdin, output: s = node_process.stdout, render: i$1, signal: D$1,...C$1 } = u$2;
520
520
  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;
521
521
  }
@@ -1962,7 +1962,7 @@ const getVerboseObject = ({ type, result, verboseInfo: { escapedCommand, command
1962
1962
  type,
1963
1963
  escapedCommand,
1964
1964
  commandId: `${commandId}`,
1965
- timestamp: new Date(),
1965
+ timestamp: /* @__PURE__ */ new Date(),
1966
1966
  piped,
1967
1967
  result,
1968
1968
  options
@@ -3083,7 +3083,7 @@ const getFromStream = (source, from = "stdout") => {
3083
3083
  if (sourceStream === null || sourceStream === void 0) throw new TypeError(getInvalidStdioOptionMessage(fdNumber, from, options, isWritable));
3084
3084
  return sourceStream;
3085
3085
  };
3086
- const SUBPROCESS_OPTIONS = new WeakMap();
3086
+ const SUBPROCESS_OPTIONS = /* @__PURE__ */ new WeakMap();
3087
3087
  const getFdNumber = (fileDescriptors, fdName, isWritable) => {
3088
3088
  const fdNumber = parseFdNumber(fdName, isWritable);
3089
3089
  validateFdNumber(fdNumber, fdName, isWritable, fileDescriptors);
@@ -3212,7 +3212,7 @@ const onDisconnect = async ({ anyProcess, channel, isSubprocess, ipcEmitter, bou
3212
3212
  ipcEmitter.connected = false;
3213
3213
  ipcEmitter.emit("disconnect");
3214
3214
  };
3215
- const INCOMING_MESSAGES = new WeakMap();
3215
+ const INCOMING_MESSAGES = /* @__PURE__ */ new WeakMap();
3216
3216
 
3217
3217
  //#endregion
3218
3218
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/ipc/forward.js
@@ -3229,7 +3229,7 @@ const getIpcEmitter = (anyProcess, channel, isSubprocess) => {
3229
3229
  });
3230
3230
  return ipcEmitter;
3231
3231
  };
3232
- const IPC_EMITTERS = new WeakMap();
3232
+ const IPC_EMITTERS = /* @__PURE__ */ new WeakMap();
3233
3233
  const forwardEvents = ({ ipcEmitter, anyProcess, channel, isSubprocess }) => {
3234
3234
  const boundOnMessage = onMessage.bind(void 0, {
3235
3235
  anyProcess,
@@ -3328,7 +3328,7 @@ const RESPONSE_TYPE = "execa:ipc:response";
3328
3328
  //#endregion
3329
3329
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/ipc/outgoing.js
3330
3330
  const startSendMessage = (anyProcess, wrappedMessage, strict) => {
3331
- if (!OUTGOING_MESSAGES.has(anyProcess)) OUTGOING_MESSAGES.set(anyProcess, new Set());
3331
+ if (!OUTGOING_MESSAGES.has(anyProcess)) OUTGOING_MESSAGES.set(anyProcess, /* @__PURE__ */ new Set());
3332
3332
  const outgoingMessages = OUTGOING_MESSAGES.get(anyProcess);
3333
3333
  const onMessageSent = createDeferred();
3334
3334
  const id = strict ? wrappedMessage.id : void 0;
@@ -3353,7 +3353,7 @@ const waitForOutgoingMessages = async (anyProcess, ipcEmitter, wrappedMessage) =
3353
3353
  await Promise.all(outgoingMessages.map(({ onMessageSent }) => onMessageSent));
3354
3354
  }
3355
3355
  };
3356
- const OUTGOING_MESSAGES = new WeakMap();
3356
+ const OUTGOING_MESSAGES = /* @__PURE__ */ new WeakMap();
3357
3357
  const hasMessageListeners = (anyProcess, ipcEmitter) => ipcEmitter.listenerCount("message") > getMinListenerCount(anyProcess);
3358
3358
  const getMinListenerCount = (anyProcess) => SUBPROCESS_OPTIONS.has(anyProcess) && !getFdSpecificValue(SUBPROCESS_OPTIONS.get(anyProcess).options.buffer, "ipc") ? 1 : 0;
3359
3359
 
@@ -3425,7 +3425,7 @@ const getSendMethod = (anyProcess) => {
3425
3425
  PROCESS_SEND_METHODS.set(anyProcess, sendMethod);
3426
3426
  return sendMethod;
3427
3427
  };
3428
- const PROCESS_SEND_METHODS = new WeakMap();
3428
+ const PROCESS_SEND_METHODS = /* @__PURE__ */ new WeakMap();
3429
3429
 
3430
3430
  //#endregion
3431
3431
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/ipc/graceful.js
@@ -3742,14 +3742,14 @@ const CR_BINARY = CR.codePointAt(0);
3742
3742
  function isStream(stream, { checkOpen = true } = {}) {
3743
3743
  return stream !== null && typeof stream === "object" && (stream.writable || stream.readable || !checkOpen || stream.writable === void 0 && stream.readable === void 0) && typeof stream.pipe === "function";
3744
3744
  }
3745
- function isWritableStream$1(stream, { checkOpen = true } = {}) {
3745
+ function isWritableStream(stream, { checkOpen = true } = {}) {
3746
3746
  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";
3747
3747
  }
3748
- function isReadableStream$1(stream, { checkOpen = true } = {}) {
3748
+ function isReadableStream(stream, { checkOpen = true } = {}) {
3749
3749
  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";
3750
3750
  }
3751
3751
  function isDuplexStream(stream, options) {
3752
- return isWritableStream$1(stream, options) && isReadableStream$1(stream, options);
3752
+ return isWritableStream(stream, options) && isReadableStream(stream, options);
3753
3753
  }
3754
3754
 
3755
3755
  //#endregion
@@ -3836,7 +3836,7 @@ function h({ preventCancel: r$1 = !1 } = {}) {
3836
3836
  //#endregion
3837
3837
  //#region ../../node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/stream.js
3838
3838
  const getAsyncIterable = (stream) => {
3839
- if (isReadableStream$1(stream, { checkOpen: false }) && nodeImports.on !== void 0) return getStreamIterable(stream);
3839
+ if (isReadableStream(stream, { checkOpen: false }) && nodeImports.on !== void 0) return getStreamIterable(stream);
3840
3840
  if (typeof stream?.[Symbol.asyncIterator] === "function") return stream;
3841
3841
  if (toString.call(stream) === "[object ReadableStream]") return h.call(stream);
3842
3842
  throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.");
@@ -4535,10 +4535,10 @@ const KNOWN_STDIO_STRINGS = new Set([
4535
4535
  "overlapped",
4536
4536
  "pipe"
4537
4537
  ]);
4538
- const isReadableStream = (value) => Object.prototype.toString.call(value) === "[object ReadableStream]";
4539
- const isWritableStream = (value) => Object.prototype.toString.call(value) === "[object WritableStream]";
4540
- const isWebStream = (value) => isReadableStream(value) || isWritableStream(value);
4541
- const isTransformStream = (value) => isReadableStream(value?.readable) && isWritableStream(value?.writable);
4538
+ const isReadableStream$1 = (value) => Object.prototype.toString.call(value) === "[object ReadableStream]";
4539
+ const isWritableStream$1 = (value) => Object.prototype.toString.call(value) === "[object WritableStream]";
4540
+ const isWebStream = (value) => isReadableStream$1(value) || isWritableStream$1(value);
4541
+ const isTransformStream = (value) => isReadableStream$1(value?.readable) && isWritableStream$1(value?.writable);
4542
4542
  const isAsyncIterableObject = (value) => isObject(value) && typeof value[Symbol.asyncIterator] === "function";
4543
4543
  const isIterableObject = (value) => isObject(value) && typeof value[Symbol.iterator] === "function";
4544
4544
  const isObject = (value) => typeof value === "object" && value !== null;
@@ -4702,10 +4702,10 @@ const guessStreamDirection = {
4702
4702
  iterable: alwaysInput,
4703
4703
  asyncIterable: alwaysInput,
4704
4704
  uint8Array: alwaysInput,
4705
- webStream: (value) => isWritableStream(value) ? "output" : "input",
4705
+ webStream: (value) => isWritableStream$1(value) ? "output" : "input",
4706
4706
  nodeStream(value) {
4707
- if (!isReadableStream$1(value, { checkOpen: false })) return "output";
4708
- return isWritableStream$1(value, { checkOpen: false }) ? void 0 : "input";
4707
+ if (!isReadableStream(value, { checkOpen: false })) return "output";
4708
+ return isWritableStream(value, { checkOpen: false }) ? void 0 : "input";
4709
4709
  },
4710
4710
  webTransform: anyDirection,
4711
4711
  duplex: anyDirection,
@@ -4835,7 +4835,7 @@ const handleInputOption = (input) => input === void 0 ? [] : [{
4835
4835
  optionName: "input"
4836
4836
  }];
4837
4837
  const getInputType = (input) => {
4838
- if (isReadableStream$1(input, { checkOpen: false })) return "nodeStream";
4838
+ if (isReadableStream(input, { checkOpen: false })) return "nodeStream";
4839
4839
  if (typeof input === "string") return "string";
4840
4840
  if (isUint8Array(input)) return "uint8Array";
4841
4841
  throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.");
@@ -5973,7 +5973,7 @@ var MergedStream = class extends node_stream.PassThrough {
5973
5973
  #aborted = new Set([]);
5974
5974
  #onFinished;
5975
5975
  #unpipeEvent = Symbol("unpipe");
5976
- #streamPromises = new WeakMap();
5976
+ #streamPromises = /* @__PURE__ */ new WeakMap();
5977
5977
  add(stream) {
5978
5978
  validateStream(stream);
5979
5979
  if (this.#streams.has(stream)) return;
@@ -6153,7 +6153,7 @@ const abortSourceStream = (source) => {
6153
6153
  //#endregion
6154
6154
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/io/output-async.js
6155
6155
  const pipeOutputAsync = (subprocess, fileDescriptors, controller) => {
6156
- const pipeGroups = new Map();
6156
+ const pipeGroups = /* @__PURE__ */ new Map();
6157
6157
  for (const [fdNumber, { stdioItems, direction }] of Object.entries(fileDescriptors)) {
6158
6158
  for (const { stream } of stdioItems.filter(({ type }) => TRANSFORM_TYPES.has(type))) pipeTransform(subprocess, stream, direction, fdNumber);
6159
6159
  for (const { stream } of stdioItems.filter(({ type }) => !TRANSFORM_TYPES.has(type))) pipeStdioItem({
@@ -6559,7 +6559,7 @@ const cleanupMergedStreamsMap = async (destinationStream) => {
6559
6559
  } catch {}
6560
6560
  MERGED_STREAMS.delete(destinationStream);
6561
6561
  };
6562
- const MERGED_STREAMS = new WeakMap();
6562
+ const MERGED_STREAMS = /* @__PURE__ */ new WeakMap();
6563
6563
  const SOURCE_LISTENERS_PER_PIPE = 2;
6564
6564
  const DESTINATION_LISTENERS_PER_PIPE = 1;
6565
6565
 
@@ -7045,9 +7045,9 @@ const throwOnSubprocessError = async (subprocess, { signal }) => {
7045
7045
  //#endregion
7046
7046
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/convert/concurrent.js
7047
7047
  const initializeConcurrentStreams = () => ({
7048
- readableDestroy: new WeakMap(),
7049
- writableFinal: new WeakMap(),
7050
- writableDestroy: new WeakMap()
7048
+ readableDestroy: /* @__PURE__ */ new WeakMap(),
7049
+ writableFinal: /* @__PURE__ */ new WeakMap(),
7050
+ writableDestroy: /* @__PURE__ */ new WeakMap()
7051
7051
  });
7052
7052
  const addConcurrentStream = (concurrentStreams, stream, waitName) => {
7053
7053
  const weakMap = concurrentStreams[waitName];
@@ -7936,7 +7936,7 @@ const runInit = async ({ build }) => {
7936
7936
  }
7937
7937
  spinner.stop();
7938
7938
  const serviceRoleKey = apiKeys.find((key) => key.name === "service_role");
7939
- if (!serviceRoleKey) throw new Error("Service role key not found");
7939
+ if (!serviceRoleKey) throw new Error("Service role key not found, is your project paused?");
7940
7940
  const api = supabaseApi(`https://${project.id}.supabase.co`, serviceRoleKey.api_key);
7941
7941
  const bucket = await selectBucket(api);
7942
7942
  const scaffoldLibPath = path.default.dirname(path.default.resolve(require.resolve("@hot-updater/supabase/scaffold")));
@@ -13,7 +13,8 @@ interface SupabaseApi {
13
13
  }) => Promise<{
14
14
  name: string;
15
15
  }>;
16
- } //#endregion
16
+ }
17
+ //#endregion
17
18
  //#region iac/index.d.ts
18
19
  declare const selectProject: () => Promise<{
19
20
  id: string;
@@ -29,6 +30,5 @@ declare const runInit: ({
29
30
  }: {
30
31
  build: BuildType;
31
32
  }) => Promise<void>;
32
-
33
33
  //#endregion
34
34
  export { runInit, selectBucket, selectProject };
@@ -13,7 +13,8 @@ interface SupabaseApi {
13
13
  }) => Promise<{
14
14
  name: string;
15
15
  }>;
16
- } //#endregion
16
+ }
17
+ //#endregion
17
18
  //#region iac/index.d.ts
18
19
  declare const selectProject: () => Promise<{
19
20
  id: string;
@@ -29,6 +30,5 @@ declare const runInit: ({
29
30
  }: {
30
31
  build: BuildType;
31
32
  }) => Promise<void>;
32
-
33
33
  //#endregion
34
34
  export { runInit, selectBucket, selectProject };
package/dist/iac/index.js CHANGED
@@ -303,7 +303,7 @@ Object.keys(r.modifier);
303
303
  const tD = Object.keys(r.color), eD = Object.keys(r.bgColor);
304
304
  [...tD, ...eD];
305
305
  function sD() {
306
- const t = new Map();
306
+ const t = /* @__PURE__ */ new Map();
307
307
  for (const [u$2, F$1] of Object.entries(r)) {
308
308
  for (const [e$1, s] of Object.entries(F$1)) r[e$1] = {
309
309
  open: `\x1B[${s[0]}m`,
@@ -518,7 +518,7 @@ var AD = Object.defineProperty, pD = (t, u$2, F$1) => u$2 in t ? AD(t, u$2, {
518
518
  }) : 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);
519
519
  var x = class {
520
520
  constructor(u$2, F$1 = !0) {
521
- 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");
521
+ 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");
522
522
  const { input: e$1 = stdin, output: s = stdout, render: i$1, signal: D$1,...C$1 } = u$2;
523
523
  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;
524
524
  }
@@ -1965,7 +1965,7 @@ const getVerboseObject = ({ type, result, verboseInfo: { escapedCommand, command
1965
1965
  type,
1966
1966
  escapedCommand,
1967
1967
  commandId: `${commandId}`,
1968
- timestamp: new Date(),
1968
+ timestamp: /* @__PURE__ */ new Date(),
1969
1969
  piped,
1970
1970
  result,
1971
1971
  options
@@ -3086,7 +3086,7 @@ const getFromStream = (source, from = "stdout") => {
3086
3086
  if (sourceStream === null || sourceStream === void 0) throw new TypeError(getInvalidStdioOptionMessage(fdNumber, from, options, isWritable));
3087
3087
  return sourceStream;
3088
3088
  };
3089
- const SUBPROCESS_OPTIONS = new WeakMap();
3089
+ const SUBPROCESS_OPTIONS = /* @__PURE__ */ new WeakMap();
3090
3090
  const getFdNumber = (fileDescriptors, fdName, isWritable) => {
3091
3091
  const fdNumber = parseFdNumber(fdName, isWritable);
3092
3092
  validateFdNumber(fdNumber, fdName, isWritable, fileDescriptors);
@@ -3215,7 +3215,7 @@ const onDisconnect = async ({ anyProcess, channel, isSubprocess, ipcEmitter, bou
3215
3215
  ipcEmitter.connected = false;
3216
3216
  ipcEmitter.emit("disconnect");
3217
3217
  };
3218
- const INCOMING_MESSAGES = new WeakMap();
3218
+ const INCOMING_MESSAGES = /* @__PURE__ */ new WeakMap();
3219
3219
 
3220
3220
  //#endregion
3221
3221
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/ipc/forward.js
@@ -3232,7 +3232,7 @@ const getIpcEmitter = (anyProcess, channel, isSubprocess) => {
3232
3232
  });
3233
3233
  return ipcEmitter;
3234
3234
  };
3235
- const IPC_EMITTERS = new WeakMap();
3235
+ const IPC_EMITTERS = /* @__PURE__ */ new WeakMap();
3236
3236
  const forwardEvents = ({ ipcEmitter, anyProcess, channel, isSubprocess }) => {
3237
3237
  const boundOnMessage = onMessage.bind(void 0, {
3238
3238
  anyProcess,
@@ -3331,7 +3331,7 @@ const RESPONSE_TYPE = "execa:ipc:response";
3331
3331
  //#endregion
3332
3332
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/ipc/outgoing.js
3333
3333
  const startSendMessage = (anyProcess, wrappedMessage, strict) => {
3334
- if (!OUTGOING_MESSAGES.has(anyProcess)) OUTGOING_MESSAGES.set(anyProcess, new Set());
3334
+ if (!OUTGOING_MESSAGES.has(anyProcess)) OUTGOING_MESSAGES.set(anyProcess, /* @__PURE__ */ new Set());
3335
3335
  const outgoingMessages = OUTGOING_MESSAGES.get(anyProcess);
3336
3336
  const onMessageSent = createDeferred();
3337
3337
  const id = strict ? wrappedMessage.id : void 0;
@@ -3356,7 +3356,7 @@ const waitForOutgoingMessages = async (anyProcess, ipcEmitter, wrappedMessage) =
3356
3356
  await Promise.all(outgoingMessages.map(({ onMessageSent }) => onMessageSent));
3357
3357
  }
3358
3358
  };
3359
- const OUTGOING_MESSAGES = new WeakMap();
3359
+ const OUTGOING_MESSAGES = /* @__PURE__ */ new WeakMap();
3360
3360
  const hasMessageListeners = (anyProcess, ipcEmitter) => ipcEmitter.listenerCount("message") > getMinListenerCount(anyProcess);
3361
3361
  const getMinListenerCount = (anyProcess) => SUBPROCESS_OPTIONS.has(anyProcess) && !getFdSpecificValue(SUBPROCESS_OPTIONS.get(anyProcess).options.buffer, "ipc") ? 1 : 0;
3362
3362
 
@@ -3428,7 +3428,7 @@ const getSendMethod = (anyProcess) => {
3428
3428
  PROCESS_SEND_METHODS.set(anyProcess, sendMethod);
3429
3429
  return sendMethod;
3430
3430
  };
3431
- const PROCESS_SEND_METHODS = new WeakMap();
3431
+ const PROCESS_SEND_METHODS = /* @__PURE__ */ new WeakMap();
3432
3432
 
3433
3433
  //#endregion
3434
3434
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/ipc/graceful.js
@@ -3745,14 +3745,14 @@ const CR_BINARY = CR.codePointAt(0);
3745
3745
  function isStream(stream, { checkOpen = true } = {}) {
3746
3746
  return stream !== null && typeof stream === "object" && (stream.writable || stream.readable || !checkOpen || stream.writable === void 0 && stream.readable === void 0) && typeof stream.pipe === "function";
3747
3747
  }
3748
- function isWritableStream$1(stream, { checkOpen = true } = {}) {
3748
+ function isWritableStream(stream, { checkOpen = true } = {}) {
3749
3749
  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";
3750
3750
  }
3751
- function isReadableStream$1(stream, { checkOpen = true } = {}) {
3751
+ function isReadableStream(stream, { checkOpen = true } = {}) {
3752
3752
  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";
3753
3753
  }
3754
3754
  function isDuplexStream(stream, options) {
3755
- return isWritableStream$1(stream, options) && isReadableStream$1(stream, options);
3755
+ return isWritableStream(stream, options) && isReadableStream(stream, options);
3756
3756
  }
3757
3757
 
3758
3758
  //#endregion
@@ -3839,7 +3839,7 @@ function h({ preventCancel: r$1 = !1 } = {}) {
3839
3839
  //#endregion
3840
3840
  //#region ../../node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/stream.js
3841
3841
  const getAsyncIterable = (stream) => {
3842
- if (isReadableStream$1(stream, { checkOpen: false }) && nodeImports.on !== void 0) return getStreamIterable(stream);
3842
+ if (isReadableStream(stream, { checkOpen: false }) && nodeImports.on !== void 0) return getStreamIterable(stream);
3843
3843
  if (typeof stream?.[Symbol.asyncIterator] === "function") return stream;
3844
3844
  if (toString.call(stream) === "[object ReadableStream]") return h.call(stream);
3845
3845
  throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.");
@@ -4538,10 +4538,10 @@ const KNOWN_STDIO_STRINGS = new Set([
4538
4538
  "overlapped",
4539
4539
  "pipe"
4540
4540
  ]);
4541
- const isReadableStream = (value) => Object.prototype.toString.call(value) === "[object ReadableStream]";
4542
- const isWritableStream = (value) => Object.prototype.toString.call(value) === "[object WritableStream]";
4543
- const isWebStream = (value) => isReadableStream(value) || isWritableStream(value);
4544
- const isTransformStream = (value) => isReadableStream(value?.readable) && isWritableStream(value?.writable);
4541
+ const isReadableStream$1 = (value) => Object.prototype.toString.call(value) === "[object ReadableStream]";
4542
+ const isWritableStream$1 = (value) => Object.prototype.toString.call(value) === "[object WritableStream]";
4543
+ const isWebStream = (value) => isReadableStream$1(value) || isWritableStream$1(value);
4544
+ const isTransformStream = (value) => isReadableStream$1(value?.readable) && isWritableStream$1(value?.writable);
4545
4545
  const isAsyncIterableObject = (value) => isObject(value) && typeof value[Symbol.asyncIterator] === "function";
4546
4546
  const isIterableObject = (value) => isObject(value) && typeof value[Symbol.iterator] === "function";
4547
4547
  const isObject = (value) => typeof value === "object" && value !== null;
@@ -4705,10 +4705,10 @@ const guessStreamDirection = {
4705
4705
  iterable: alwaysInput,
4706
4706
  asyncIterable: alwaysInput,
4707
4707
  uint8Array: alwaysInput,
4708
- webStream: (value) => isWritableStream(value) ? "output" : "input",
4708
+ webStream: (value) => isWritableStream$1(value) ? "output" : "input",
4709
4709
  nodeStream(value) {
4710
- if (!isReadableStream$1(value, { checkOpen: false })) return "output";
4711
- return isWritableStream$1(value, { checkOpen: false }) ? void 0 : "input";
4710
+ if (!isReadableStream(value, { checkOpen: false })) return "output";
4711
+ return isWritableStream(value, { checkOpen: false }) ? void 0 : "input";
4712
4712
  },
4713
4713
  webTransform: anyDirection,
4714
4714
  duplex: anyDirection,
@@ -4838,7 +4838,7 @@ const handleInputOption = (input) => input === void 0 ? [] : [{
4838
4838
  optionName: "input"
4839
4839
  }];
4840
4840
  const getInputType = (input) => {
4841
- if (isReadableStream$1(input, { checkOpen: false })) return "nodeStream";
4841
+ if (isReadableStream(input, { checkOpen: false })) return "nodeStream";
4842
4842
  if (typeof input === "string") return "string";
4843
4843
  if (isUint8Array(input)) return "uint8Array";
4844
4844
  throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.");
@@ -5976,7 +5976,7 @@ var MergedStream = class extends PassThrough {
5976
5976
  #aborted = new Set([]);
5977
5977
  #onFinished;
5978
5978
  #unpipeEvent = Symbol("unpipe");
5979
- #streamPromises = new WeakMap();
5979
+ #streamPromises = /* @__PURE__ */ new WeakMap();
5980
5980
  add(stream) {
5981
5981
  validateStream(stream);
5982
5982
  if (this.#streams.has(stream)) return;
@@ -6156,7 +6156,7 @@ const abortSourceStream = (source) => {
6156
6156
  //#endregion
6157
6157
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/io/output-async.js
6158
6158
  const pipeOutputAsync = (subprocess, fileDescriptors, controller) => {
6159
- const pipeGroups = new Map();
6159
+ const pipeGroups = /* @__PURE__ */ new Map();
6160
6160
  for (const [fdNumber, { stdioItems, direction }] of Object.entries(fileDescriptors)) {
6161
6161
  for (const { stream } of stdioItems.filter(({ type }) => TRANSFORM_TYPES.has(type))) pipeTransform(subprocess, stream, direction, fdNumber);
6162
6162
  for (const { stream } of stdioItems.filter(({ type }) => !TRANSFORM_TYPES.has(type))) pipeStdioItem({
@@ -6562,7 +6562,7 @@ const cleanupMergedStreamsMap = async (destinationStream) => {
6562
6562
  } catch {}
6563
6563
  MERGED_STREAMS.delete(destinationStream);
6564
6564
  };
6565
- const MERGED_STREAMS = new WeakMap();
6565
+ const MERGED_STREAMS = /* @__PURE__ */ new WeakMap();
6566
6566
  const SOURCE_LISTENERS_PER_PIPE = 2;
6567
6567
  const DESTINATION_LISTENERS_PER_PIPE = 1;
6568
6568
 
@@ -7048,9 +7048,9 @@ const throwOnSubprocessError = async (subprocess, { signal }) => {
7048
7048
  //#endregion
7049
7049
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/convert/concurrent.js
7050
7050
  const initializeConcurrentStreams = () => ({
7051
- readableDestroy: new WeakMap(),
7052
- writableFinal: new WeakMap(),
7053
- writableDestroy: new WeakMap()
7051
+ readableDestroy: /* @__PURE__ */ new WeakMap(),
7052
+ writableFinal: /* @__PURE__ */ new WeakMap(),
7053
+ writableDestroy: /* @__PURE__ */ new WeakMap()
7054
7054
  });
7055
7055
  const addConcurrentStream = (concurrentStreams, stream, waitName) => {
7056
7056
  const weakMap = concurrentStreams[waitName];
@@ -7939,7 +7939,7 @@ const runInit = async ({ build }) => {
7939
7939
  }
7940
7940
  spinner.stop();
7941
7941
  const serviceRoleKey = apiKeys.find((key) => key.name === "service_role");
7942
- if (!serviceRoleKey) throw new Error("Service role key not found");
7942
+ if (!serviceRoleKey) throw new Error("Service role key not found, is your project paused?");
7943
7943
  const api = supabaseApi(`https://${project.id}.supabase.co`, serviceRoleKey.api_key);
7944
7944
  const bucket = await selectBucket(api);
7945
7945
  const scaffoldLibPath = path$1.dirname(path$1.resolve(__require.resolve("@hot-updater/supabase/scaffold")));
package/dist/index.cjs CHANGED
@@ -48,15 +48,21 @@ const supabaseDatabase = (config, hooks) => (0, __hot_updater_plugin_core.create
48
48
  };
49
49
  },
50
50
  async getBundles(context, options) {
51
- const { where, limit, offset = 0 } = options ?? {};
51
+ const { where, limit, offset } = options ?? {};
52
+ let countQuery = context.supabase.from("bundles").select("*", {
53
+ count: "exact",
54
+ head: true
55
+ });
56
+ if (where?.channel) countQuery = countQuery.eq("channel", where.channel);
57
+ if (where?.platform) countQuery = countQuery.eq("platform", where.platform);
58
+ const { count: total = 0 } = await countQuery;
52
59
  let query = context.supabase.from("bundles").select("*").order("id", { ascending: false });
53
60
  if (where?.channel) query = query.eq("channel", where.channel);
54
61
  if (where?.platform) query = query.eq("platform", where.platform);
55
62
  if (limit) query = query.limit(limit);
56
63
  if (offset) query = query.range(offset, offset + (limit || 20) - 1);
57
64
  const { data } = await query;
58
- if (!data) return [];
59
- return data.map((bundle) => ({
65
+ const bundles = data ? data.map((bundle) => ({
60
66
  channel: bundle.channel,
61
67
  enabled: bundle.enabled,
62
68
  shouldForceUpdate: bundle.should_force_update,
@@ -69,7 +75,15 @@ const supabaseDatabase = (config, hooks) => (0, __hot_updater_plugin_core.create
69
75
  fingerprintHash: bundle.fingerprint_hash,
70
76
  storageUri: bundle.storage_uri,
71
77
  metadata: bundle.metadata ?? {}
72
- }));
78
+ })) : [];
79
+ const pagination = (0, __hot_updater_plugin_core.calculatePagination)(total ?? 0, {
80
+ limit,
81
+ offset
82
+ });
83
+ return {
84
+ data: bundles,
85
+ pagination
86
+ };
73
87
  },
74
88
  async getChannels(context) {
75
89
  const { data, error } = await context.supabase.rpc("get_channels");
@@ -1370,16 +1384,16 @@ var __classPrivateFieldGet = void 0 && (void 0).__classPrivateFieldGet || functi
1370
1384
  var _Mime_extensionToType, _Mime_typeToExtension, _Mime_typeToExtensions;
1371
1385
  var Mime = class {
1372
1386
  constructor(...args) {
1373
- _Mime_extensionToType.set(this, new Map());
1374
- _Mime_typeToExtension.set(this, new Map());
1375
- _Mime_typeToExtensions.set(this, new Map());
1387
+ _Mime_extensionToType.set(this, /* @__PURE__ */ new Map());
1388
+ _Mime_typeToExtension.set(this, /* @__PURE__ */ new Map());
1389
+ _Mime_typeToExtensions.set(this, /* @__PURE__ */ new Map());
1376
1390
  for (const arg of args) this.define(arg);
1377
1391
  }
1378
1392
  define(typeMap, force = false) {
1379
1393
  for (let [type, extensions] of Object.entries(typeMap)) {
1380
1394
  type = type.toLowerCase();
1381
1395
  extensions = extensions.map((ext) => ext.toLowerCase());
1382
- if (!__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").has(type)) __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").set(type, new Set());
1396
+ if (!__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").has(type)) __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").set(type, /* @__PURE__ */ new Set());
1383
1397
  const allExtensions = __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type);
1384
1398
  let first = true;
1385
1399
  for (let extension of extensions) {
@@ -1429,7 +1443,7 @@ var Mime = class {
1429
1443
  };
1430
1444
  }
1431
1445
  };
1432
- _Mime_extensionToType = new WeakMap(), _Mime_typeToExtension = new WeakMap(), _Mime_typeToExtensions = new WeakMap();
1446
+ _Mime_extensionToType = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtension = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtensions = /* @__PURE__ */ new WeakMap();
1433
1447
  var Mime_default = Mime;
1434
1448
 
1435
1449
  //#endregion
package/dist/index.d.cts CHANGED
@@ -7,7 +7,6 @@ interface SupabaseDatabaseConfig {
7
7
  supabaseAnonKey: string;
8
8
  }
9
9
  declare const supabaseDatabase: (config: SupabaseDatabaseConfig, hooks?: DatabasePluginHooks) => (options: _hot_updater_plugin_core0.BasePluginArgs) => _hot_updater_plugin_core0.DatabasePlugin;
10
-
11
10
  //#endregion
12
11
  //#region src/supabaseStorage.d.ts
13
12
  interface SupabaseStorageConfig {
@@ -16,6 +15,5 @@ interface SupabaseStorageConfig {
16
15
  bucketName: string;
17
16
  }
18
17
  declare const supabaseStorage: (config: SupabaseStorageConfig, hooks?: StoragePluginHooks) => (_: BasePluginArgs) => StoragePlugin;
19
-
20
18
  //#endregion
21
19
  export { SupabaseDatabaseConfig, SupabaseStorageConfig, supabaseDatabase, supabaseStorage };
package/dist/index.d.ts CHANGED
@@ -7,7 +7,6 @@ interface SupabaseDatabaseConfig {
7
7
  supabaseAnonKey: string;
8
8
  }
9
9
  declare const supabaseDatabase: (config: SupabaseDatabaseConfig, hooks?: DatabasePluginHooks) => (options: _hot_updater_plugin_core0.BasePluginArgs) => _hot_updater_plugin_core0.DatabasePlugin;
10
-
11
10
  //#endregion
12
11
  //#region src/supabaseStorage.d.ts
13
12
  interface SupabaseStorageConfig {
@@ -16,6 +15,5 @@ interface SupabaseStorageConfig {
16
15
  bucketName: string;
17
16
  }
18
17
  declare const supabaseStorage: (config: SupabaseStorageConfig, hooks?: StoragePluginHooks) => (_: BasePluginArgs) => StoragePlugin;
19
-
20
18
  //#endregion
21
19
  export { SupabaseDatabaseConfig, SupabaseStorageConfig, supabaseDatabase, supabaseStorage };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createDatabasePlugin } from "@hot-updater/plugin-core";
1
+ import { calculatePagination, createDatabasePlugin } from "@hot-updater/plugin-core";
2
2
  import { createClient } from "@supabase/supabase-js";
3
3
  import path from "path";
4
4
  import fs from "fs/promises";
@@ -25,15 +25,21 @@ const supabaseDatabase = (config, hooks) => createDatabasePlugin("supabaseDataba
25
25
  };
26
26
  },
27
27
  async getBundles(context, options) {
28
- const { where, limit, offset = 0 } = options ?? {};
28
+ const { where, limit, offset } = options ?? {};
29
+ let countQuery = context.supabase.from("bundles").select("*", {
30
+ count: "exact",
31
+ head: true
32
+ });
33
+ if (where?.channel) countQuery = countQuery.eq("channel", where.channel);
34
+ if (where?.platform) countQuery = countQuery.eq("platform", where.platform);
35
+ const { count: total = 0 } = await countQuery;
29
36
  let query = context.supabase.from("bundles").select("*").order("id", { ascending: false });
30
37
  if (where?.channel) query = query.eq("channel", where.channel);
31
38
  if (where?.platform) query = query.eq("platform", where.platform);
32
39
  if (limit) query = query.limit(limit);
33
40
  if (offset) query = query.range(offset, offset + (limit || 20) - 1);
34
41
  const { data } = await query;
35
- if (!data) return [];
36
- return data.map((bundle) => ({
42
+ const bundles = data ? data.map((bundle) => ({
37
43
  channel: bundle.channel,
38
44
  enabled: bundle.enabled,
39
45
  shouldForceUpdate: bundle.should_force_update,
@@ -46,7 +52,15 @@ const supabaseDatabase = (config, hooks) => createDatabasePlugin("supabaseDataba
46
52
  fingerprintHash: bundle.fingerprint_hash,
47
53
  storageUri: bundle.storage_uri,
48
54
  metadata: bundle.metadata ?? {}
49
- }));
55
+ })) : [];
56
+ const pagination = calculatePagination(total ?? 0, {
57
+ limit,
58
+ offset
59
+ });
60
+ return {
61
+ data: bundles,
62
+ pagination
63
+ };
50
64
  },
51
65
  async getChannels(context) {
52
66
  const { data, error } = await context.supabase.rpc("get_channels");
@@ -1347,16 +1361,16 @@ var __classPrivateFieldGet = void 0 && (void 0).__classPrivateFieldGet || functi
1347
1361
  var _Mime_extensionToType, _Mime_typeToExtension, _Mime_typeToExtensions;
1348
1362
  var Mime = class {
1349
1363
  constructor(...args) {
1350
- _Mime_extensionToType.set(this, new Map());
1351
- _Mime_typeToExtension.set(this, new Map());
1352
- _Mime_typeToExtensions.set(this, new Map());
1364
+ _Mime_extensionToType.set(this, /* @__PURE__ */ new Map());
1365
+ _Mime_typeToExtension.set(this, /* @__PURE__ */ new Map());
1366
+ _Mime_typeToExtensions.set(this, /* @__PURE__ */ new Map());
1353
1367
  for (const arg of args) this.define(arg);
1354
1368
  }
1355
1369
  define(typeMap, force = false) {
1356
1370
  for (let [type, extensions] of Object.entries(typeMap)) {
1357
1371
  type = type.toLowerCase();
1358
1372
  extensions = extensions.map((ext) => ext.toLowerCase());
1359
- if (!__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").has(type)) __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").set(type, new Set());
1373
+ if (!__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").has(type)) __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").set(type, /* @__PURE__ */ new Set());
1360
1374
  const allExtensions = __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type);
1361
1375
  let first = true;
1362
1376
  for (let extension of extensions) {
@@ -1406,7 +1420,7 @@ var Mime = class {
1406
1420
  };
1407
1421
  }
1408
1422
  };
1409
- _Mime_extensionToType = new WeakMap(), _Mime_typeToExtension = new WeakMap(), _Mime_typeToExtensions = new WeakMap();
1423
+ _Mime_extensionToType = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtension = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtensions = /* @__PURE__ */ new WeakMap();
1410
1424
  var Mime_default = Mime;
1411
1425
 
1412
1426
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/supabase",
3
3
  "type": "module",
4
- "version": "0.18.0",
4
+ "version": "0.18.2",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.js",
@@ -40,8 +40,8 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "@supabase/supabase-js": "^2.47.10",
43
- "@hot-updater/core": "0.18.0",
44
- "@hot-updater/plugin-core": "0.18.0"
43
+ "@hot-updater/core": "0.18.2",
44
+ "@hot-updater/plugin-core": "0.18.2"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@clack/prompts": "0.10.0",
@@ -50,7 +50,7 @@
50
50
  "execa": "^9.5.2",
51
51
  "mime": "^4.0.4",
52
52
  "picocolors": "^1.0.0",
53
- "@hot-updater/postgres": "0.18.0"
53
+ "@hot-updater/postgres": "0.18.2"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "tsdown",