@hot-updater/firebase 1.0.0-rc.0 → 1.0.0-rc.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.
- package/dist/firebase/functions/index.cjs +1255 -841
- package/dist/firebase/public/firestore.indexes.json +27 -37
- package/dist/iac/index.cjs +374 -173
- package/dist/iac/index.d.cts +1 -5
- package/dist/iac/index.d.mts +1 -5
- package/dist/iac/index.mjs +368 -167
- package/dist/index.cjs +183 -43
- package/dist/index.d.cts +2 -4
- package/dist/index.d.mts +1 -3
- package/dist/index.mjs +184 -44
- package/package.json +6 -6
package/dist/iac/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
11
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
12
|
key = keys[i];
|
|
@@ -17,15 +17,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
21
21
|
value: mod,
|
|
22
22
|
enumerable: true
|
|
23
23
|
}) : target, mod));
|
|
24
24
|
//#endregion
|
|
25
25
|
let fs = require("fs");
|
|
26
|
-
fs = __toESM(fs);
|
|
26
|
+
fs = __toESM(fs, 1);
|
|
27
27
|
let path = require("path");
|
|
28
|
-
path = __toESM(path);
|
|
28
|
+
path = __toESM(path, 1);
|
|
29
29
|
let _hot_updater_cli_tools = require("@hot-updater/cli-tools");
|
|
30
30
|
let _hot_updater_server = require("@hot-updater/server");
|
|
31
31
|
let node_url = require("node:url");
|
|
@@ -33,14 +33,14 @@ let node_child_process = require("node:child_process");
|
|
|
33
33
|
let node_string_decoder = require("node:string_decoder");
|
|
34
34
|
let node_util = require("node:util");
|
|
35
35
|
let node_process = require("node:process");
|
|
36
|
-
node_process = __toESM(node_process);
|
|
36
|
+
node_process = __toESM(node_process, 1);
|
|
37
37
|
let node_tty = require("node:tty");
|
|
38
|
-
node_tty = __toESM(node_tty);
|
|
38
|
+
node_tty = __toESM(node_tty, 1);
|
|
39
39
|
let node_path = require("node:path");
|
|
40
|
-
node_path = __toESM(node_path);
|
|
40
|
+
node_path = __toESM(node_path, 1);
|
|
41
41
|
let node_timers_promises = require("node:timers/promises");
|
|
42
42
|
let node_os = require("node:os");
|
|
43
|
-
node_os = __toESM(node_os);
|
|
43
|
+
node_os = __toESM(node_os, 1);
|
|
44
44
|
let node_events = require("node:events");
|
|
45
45
|
let node_v8 = require("node:v8");
|
|
46
46
|
let node_fs = require("node:fs");
|
|
@@ -52,9 +52,9 @@ let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
|
|
|
52
52
|
let _hot_updater_plugin_core_internal = require("@hot-updater/plugin-core/internal");
|
|
53
53
|
let firebase_admin_firestore = require("firebase-admin/firestore");
|
|
54
54
|
let fs_promises = require("fs/promises");
|
|
55
|
-
fs_promises = __toESM(fs_promises);
|
|
55
|
+
fs_promises = __toESM(fs_promises, 1);
|
|
56
56
|
let node_fs_promises = require("node:fs/promises");
|
|
57
|
-
node_fs_promises = __toESM(node_fs_promises);
|
|
57
|
+
node_fs_promises = __toESM(node_fs_promises, 1);
|
|
58
58
|
//#region ../../node_modules/.pnpm/es-toolkit@1.47.0/node_modules/es-toolkit/dist/_internal/compareValues.mjs
|
|
59
59
|
function compareValues(a, b, order) {
|
|
60
60
|
if (a < b) return order === "asc" ? -1 : 1;
|
|
@@ -658,7 +658,8 @@ const parseTemplate = ({ templates, expressions, tokens, index, template }) => {
|
|
|
658
658
|
const newTokens = concatTokens(tokens, nextTokens, leadingWhitespaces);
|
|
659
659
|
if (index === expressions.length) return newTokens;
|
|
660
660
|
const expression = expressions[index];
|
|
661
|
-
|
|
661
|
+
const expressionTokens = Array.isArray(expression) ? expression.map((expression) => parseExpression(expression)) : [parseExpression(expression)];
|
|
662
|
+
return concatTokens(newTokens, expressionTokens, trailingWhitespaces);
|
|
662
663
|
};
|
|
663
664
|
const splitByWhitespaces = (template, rawTemplate) => {
|
|
664
665
|
if (rawTemplate.length === 0) return {
|
|
@@ -691,7 +692,7 @@ const splitByWhitespaces = (template, rawTemplate) => {
|
|
|
691
692
|
trailingWhitespaces
|
|
692
693
|
};
|
|
693
694
|
};
|
|
694
|
-
const DELIMITERS = new Set([
|
|
695
|
+
const DELIMITERS = /* @__PURE__ */ new Set([
|
|
695
696
|
" ",
|
|
696
697
|
" ",
|
|
697
698
|
"\r",
|
|
@@ -743,7 +744,8 @@ const normalizeFdSpecificOptions = (options) => {
|
|
|
743
744
|
};
|
|
744
745
|
const normalizeFdSpecificOption = (options, optionName) => {
|
|
745
746
|
const optionBaseArray = Array.from({ length: getStdioLength(options) + 1 });
|
|
746
|
-
|
|
747
|
+
const optionArray = normalizeFdSpecificValue(options[optionName], optionBaseArray, optionName);
|
|
748
|
+
return addDefaultValue$1(optionArray, optionName);
|
|
747
749
|
};
|
|
748
750
|
const getStdioLength = ({ stdio }) => Array.isArray(stdio) ? Math.max(stdio.length, STANDARD_STREAMS_ALIASES.length) : STANDARD_STREAMS_ALIASES.length;
|
|
749
751
|
const normalizeFdSpecificValue = (optionValue, optionArray, optionName) => isPlainObject(optionValue) ? normalizeOptionObject(optionValue, optionArray, optionName) : optionArray.fill(optionValue);
|
|
@@ -776,7 +778,7 @@ const addDefaultValue$1 = (optionArray, optionName) => optionArray.map((optionVa
|
|
|
776
778
|
const DEFAULT_OPTIONS = {
|
|
777
779
|
lines: false,
|
|
778
780
|
buffer: true,
|
|
779
|
-
maxBuffer:
|
|
781
|
+
maxBuffer: 1e8,
|
|
780
782
|
verbose: (0, node_util.debuglog)("execa").enabled ? "full" : "none",
|
|
781
783
|
stripFinalNewline: true
|
|
782
784
|
};
|
|
@@ -824,7 +826,7 @@ const escapeControlCharacter = (character) => {
|
|
|
824
826
|
};
|
|
825
827
|
const getSpecialCharRegExp = () => {
|
|
826
828
|
try {
|
|
827
|
-
return
|
|
829
|
+
return new RegExp("\\p{Separator}|\\p{Other}", "gu");
|
|
828
830
|
} catch {
|
|
829
831
|
return /[\s\u0000-\u001F\u007F-\u009F\u00AD]/g;
|
|
830
832
|
}
|
|
@@ -1244,11 +1246,13 @@ const appendNewline = (printedLine) => printedLine.endsWith("\n") ? printedLine
|
|
|
1244
1246
|
//#endregion
|
|
1245
1247
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/verbose/log.js
|
|
1246
1248
|
const verboseLog = ({ type, verboseMessage, fdNumber, verboseInfo, result }) => {
|
|
1247
|
-
const
|
|
1249
|
+
const verboseObject = getVerboseObject({
|
|
1248
1250
|
type,
|
|
1249
1251
|
result,
|
|
1250
1252
|
verboseInfo
|
|
1251
|
-
})
|
|
1253
|
+
});
|
|
1254
|
+
const printedLines = getPrintedLines(verboseMessage, verboseObject);
|
|
1255
|
+
const finalLines = applyVerboseOnLines(printedLines, verboseInfo, fdNumber);
|
|
1252
1256
|
if (finalLines !== "") console.warn(finalLines.slice(0, -1));
|
|
1253
1257
|
};
|
|
1254
1258
|
const getVerboseObject = ({ type, result, verboseInfo: { escapedCommand, commandId, rawOptions: { piped = false, ...options } } }) => ({
|
|
@@ -1271,7 +1275,8 @@ const getPrintedLine = (verboseObject) => {
|
|
|
1271
1275
|
};
|
|
1272
1276
|
};
|
|
1273
1277
|
const serializeVerboseMessage = (message) => {
|
|
1274
|
-
|
|
1278
|
+
const messageString = typeof message === "string" ? message : (0, node_util.inspect)(message);
|
|
1279
|
+
return escapeLines(messageString).replaceAll(" ", " ".repeat(TAB_SIZE));
|
|
1275
1280
|
};
|
|
1276
1281
|
const TAB_SIZE = 2;
|
|
1277
1282
|
//#endregion
|
|
@@ -1316,7 +1321,8 @@ const getDurationMs = (startTime) => Number(node_process.hrtime.bigint() - start
|
|
|
1316
1321
|
const handleCommand = (filePath, rawArguments, rawOptions) => {
|
|
1317
1322
|
const startTime = getStartTime();
|
|
1318
1323
|
const { command, escapedCommand } = joinCommand(filePath, rawArguments);
|
|
1319
|
-
const
|
|
1324
|
+
const verbose = normalizeFdSpecificOption(rawOptions, "verbose");
|
|
1325
|
+
const verboseInfo = getVerboseInfo(verbose, escapedCommand, { ...rawOptions });
|
|
1320
1326
|
logCommand(escapedCommand, verboseInfo);
|
|
1321
1327
|
return {
|
|
1322
1328
|
command,
|
|
@@ -1437,7 +1443,8 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1437
1443
|
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
1438
1444
|
const getPathInfo = (cmd, opt) => {
|
|
1439
1445
|
const colon = opt.colon || COLON;
|
|
1440
|
-
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
|
|
1446
|
+
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
|
|
1447
|
+
/* istanbul ignore next: very unusual */ "").split(colon)];
|
|
1441
1448
|
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
1442
1449
|
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
1443
1450
|
if (isWindows) {
|
|
@@ -1462,14 +1469,17 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1462
1469
|
const ppRaw = pathEnv[i];
|
|
1463
1470
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
1464
1471
|
const pCmd = path$11.join(pathPart, cmd);
|
|
1465
|
-
|
|
1472
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
1473
|
+
resolve(subStep(p, i, 0));
|
|
1466
1474
|
});
|
|
1467
1475
|
const subStep = (p, i, ii) => new Promise((resolve, reject) => {
|
|
1468
1476
|
if (ii === pathExt.length) return resolve(step(i + 1));
|
|
1469
1477
|
const ext = pathExt[ii];
|
|
1470
1478
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
1471
|
-
if (!er && is)
|
|
1472
|
-
|
|
1479
|
+
if (!er && is) {
|
|
1480
|
+
if (opt.all) found.push(p + ext);
|
|
1481
|
+
else return resolve(p + ext);
|
|
1482
|
+
}
|
|
1473
1483
|
return resolve(subStep(p, i, ii + 1));
|
|
1474
1484
|
});
|
|
1475
1485
|
});
|
|
@@ -1487,8 +1497,10 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1487
1497
|
for (let j = 0; j < pathExt.length; j++) {
|
|
1488
1498
|
const cur = p + pathExt[j];
|
|
1489
1499
|
try {
|
|
1490
|
-
if (isexe.sync(cur, { pathExt: pathExtExe }))
|
|
1491
|
-
|
|
1500
|
+
if (isexe.sync(cur, { pathExt: pathExtExe })) {
|
|
1501
|
+
if (opt.all) found.push(cur);
|
|
1502
|
+
else return cur;
|
|
1503
|
+
}
|
|
1492
1504
|
} catch (ex) {}
|
|
1493
1505
|
}
|
|
1494
1506
|
}
|
|
@@ -2179,7 +2191,7 @@ const normalizeForceKillAfterDelay = (forceKillAfterDelay) => {
|
|
|
2179
2191
|
if (!Number.isFinite(forceKillAfterDelay) || forceKillAfterDelay < 0) throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${forceKillAfterDelay}\` (${typeof forceKillAfterDelay})`);
|
|
2180
2192
|
return forceKillAfterDelay;
|
|
2181
2193
|
};
|
|
2182
|
-
const DEFAULT_FORCE_KILL_TIMEOUT =
|
|
2194
|
+
const DEFAULT_FORCE_KILL_TIMEOUT = 5e3;
|
|
2183
2195
|
const subprocessKill = ({ kill, options: { forceKillAfterDelay, killSignal }, onInternalError, context, controller }, signalOrError, errorArgument) => {
|
|
2184
2196
|
const { signal, error } = parseKillArguments(signalOrError, errorArgument, killSignal);
|
|
2185
2197
|
emitKillError(error, onInternalError);
|
|
@@ -2281,7 +2293,7 @@ const handleSerializationError = ({ error, methodName, isSubprocess, message })
|
|
|
2281
2293
|
if (isSerializationError(error)) throw new Error(`${getMethodName(methodName, isSubprocess)}'s argument type is invalid: the message cannot be serialized: ${String(message)}.`, { cause: error });
|
|
2282
2294
|
};
|
|
2283
2295
|
const isSerializationError = ({ code, message }) => SERIALIZATION_ERROR_CODES.has(code) || SERIALIZATION_ERROR_MESSAGES.some((serializationErrorMessage) => message.includes(serializationErrorMessage));
|
|
2284
|
-
const SERIALIZATION_ERROR_CODES = new Set(["ERR_MISSING_ARGS", "ERR_INVALID_ARG_TYPE"]);
|
|
2296
|
+
const SERIALIZATION_ERROR_CODES = /* @__PURE__ */ new Set(["ERR_MISSING_ARGS", "ERR_INVALID_ARG_TYPE"]);
|
|
2285
2297
|
const SERIALIZATION_ERROR_MESSAGES = [
|
|
2286
2298
|
"could not be cloned",
|
|
2287
2299
|
"circular structure",
|
|
@@ -2491,7 +2503,8 @@ const isConnected = (anyProcess) => {
|
|
|
2491
2503
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/ipc/strict.js
|
|
2492
2504
|
const handleSendStrict = ({ anyProcess, channel, isSubprocess, message, strict }) => {
|
|
2493
2505
|
if (!strict) return message;
|
|
2494
|
-
const
|
|
2506
|
+
const ipcEmitter = getIpcEmitter(anyProcess, channel, isSubprocess);
|
|
2507
|
+
const hasListeners = hasMessageListeners(anyProcess, ipcEmitter);
|
|
2495
2508
|
return {
|
|
2496
2509
|
id: count++,
|
|
2497
2510
|
type: REQUEST_TYPE,
|
|
@@ -2723,7 +2736,8 @@ const throwOnGracefulCancel = ({ subprocess, cancelSignal, gracefulCancel, force
|
|
|
2723
2736
|
})] : [];
|
|
2724
2737
|
const sendOnAbort = async ({ subprocess, cancelSignal, forceKillAfterDelay, context, controller: { signal } }) => {
|
|
2725
2738
|
await onAbortedSignal(cancelSignal, signal);
|
|
2726
|
-
|
|
2739
|
+
const reason = getReason(cancelSignal);
|
|
2740
|
+
await sendAbort(subprocess, reason);
|
|
2727
2741
|
killOnTimeout({
|
|
2728
2742
|
kill: subprocess.kill,
|
|
2729
2743
|
forceKillAfterDelay,
|
|
@@ -2835,8 +2849,8 @@ Please rename it to ${serializeEncoding(correctEncoding)}.`);
|
|
|
2835
2849
|
throw new TypeError(`Invalid option \`encoding: ${serializeEncoding(encoding)}\`.
|
|
2836
2850
|
Please rename it to one of: ${correctEncodings}.`);
|
|
2837
2851
|
};
|
|
2838
|
-
const TEXT_ENCODINGS = new Set(["utf8", "utf16le"]);
|
|
2839
|
-
const BINARY_ENCODINGS = new Set([
|
|
2852
|
+
const TEXT_ENCODINGS = /* @__PURE__ */ new Set(["utf8", "utf16le"]);
|
|
2853
|
+
const BINARY_ENCODINGS = /* @__PURE__ */ new Set([
|
|
2840
2854
|
"buffer",
|
|
2841
2855
|
"hex",
|
|
2842
2856
|
"base64",
|
|
@@ -2844,7 +2858,7 @@ const BINARY_ENCODINGS = new Set([
|
|
|
2844
2858
|
"latin1",
|
|
2845
2859
|
"ascii"
|
|
2846
2860
|
]);
|
|
2847
|
-
const ENCODINGS = new Set([...TEXT_ENCODINGS, ...BINARY_ENCODINGS]);
|
|
2861
|
+
const ENCODINGS = /* @__PURE__ */ new Set([...TEXT_ENCODINGS, ...BINARY_ENCODINGS]);
|
|
2848
2862
|
const getCorrectEncoding = (encoding) => {
|
|
2849
2863
|
if (encoding === null) return "buffer";
|
|
2850
2864
|
if (typeof encoding !== "string") return;
|
|
@@ -2891,7 +2905,8 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
|
2891
2905
|
rawOptions.cwd = normalizeCwd(rawOptions.cwd);
|
|
2892
2906
|
const [processedFile, processedArguments, processedOptions] = handleNodeOption(filePath, rawArguments, rawOptions);
|
|
2893
2907
|
const { command: file, args: commandArguments, options: initialOptions } = import_cross_spawn.default._parse(processedFile, processedArguments, processedOptions);
|
|
2894
|
-
const
|
|
2908
|
+
const fdOptions = normalizeFdSpecificOptions(initialOptions);
|
|
2909
|
+
const options = addDefaultOptions(fdOptions);
|
|
2895
2910
|
validateTimeout(options);
|
|
2896
2911
|
validateEncoding(options);
|
|
2897
2912
|
validateIpcInputOption(options);
|
|
@@ -3092,14 +3107,17 @@ const getStreamContents$1 = async (stream, { init, convertChunk, getSize, trunca
|
|
|
3092
3107
|
const state = init();
|
|
3093
3108
|
state.length = 0;
|
|
3094
3109
|
try {
|
|
3095
|
-
for await (const chunk of asyncIterable)
|
|
3096
|
-
convertedChunk
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3110
|
+
for await (const chunk of asyncIterable) {
|
|
3111
|
+
const convertedChunk = convertChunk[getChunkType(chunk)](chunk, state);
|
|
3112
|
+
appendChunk({
|
|
3113
|
+
convertedChunk,
|
|
3114
|
+
state,
|
|
3115
|
+
getSize,
|
|
3116
|
+
truncateChunk,
|
|
3117
|
+
addChunk,
|
|
3118
|
+
maxBuffer
|
|
3119
|
+
});
|
|
3120
|
+
}
|
|
3103
3121
|
appendFinalChunk({
|
|
3104
3122
|
state,
|
|
3105
3123
|
convertChunk,
|
|
@@ -3385,7 +3403,8 @@ const getErrorPrefix = ({ originalError, timedOut, timeout, isMaxBuffer, maxBuff
|
|
|
3385
3403
|
const getForcefulSuffix = (isForcefullyTerminated, forceKillAfterDelay) => isForcefullyTerminated ? ` and was forcefully terminated after ${forceKillAfterDelay} milliseconds` : "";
|
|
3386
3404
|
const getOriginalMessage = (originalError, cwd) => {
|
|
3387
3405
|
if (originalError instanceof DiscardedError) return;
|
|
3388
|
-
const
|
|
3406
|
+
const originalMessage = isExecaError(originalError) ? originalError.originalMessage : String(originalError?.message ?? originalError);
|
|
3407
|
+
const escapedOriginalMessage = escapeLines(fixCwdError(originalMessage, cwd));
|
|
3389
3408
|
return escapedOriginalMessage === "" ? void 0 : escapedOriginalMessage;
|
|
3390
3409
|
};
|
|
3391
3410
|
const serializeIpcMessage = (ipcMessage) => typeof ipcMessage === "string" ? ipcMessage : (0, node_util.inspect)(ipcMessage);
|
|
@@ -3596,26 +3615,28 @@ function prettyMilliseconds(milliseconds, options) {
|
|
|
3596
3615
|
add(Number(parsed.hours), "hour", "h");
|
|
3597
3616
|
}
|
|
3598
3617
|
add(Number(parsed.minutes), "minute", "m");
|
|
3599
|
-
if (!options.hideSeconds)
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3618
|
+
if (!options.hideSeconds) {
|
|
3619
|
+
if (options.separateMilliseconds || options.formatSubMilliseconds || !options.colonNotation && milliseconds < 1e3 && !options.subSecondsAsDecimals) {
|
|
3620
|
+
const seconds = Number(parsed.seconds);
|
|
3621
|
+
const milliseconds = Number(parsed.milliseconds);
|
|
3622
|
+
const microseconds = Number(parsed.microseconds);
|
|
3623
|
+
const nanoseconds = Number(parsed.nanoseconds);
|
|
3624
|
+
add(seconds, "second", "s");
|
|
3625
|
+
if (options.formatSubMilliseconds) {
|
|
3626
|
+
add(milliseconds, "millisecond", "ms");
|
|
3627
|
+
add(microseconds, "microsecond", "µs");
|
|
3628
|
+
add(nanoseconds, "nanosecond", "ns");
|
|
3629
|
+
} else {
|
|
3630
|
+
const millisecondsAndBelow = milliseconds + microseconds / 1e3 + nanoseconds / 1e6;
|
|
3631
|
+
const millisecondsDecimalDigits = typeof options.millisecondsDecimalDigits === "number" ? options.millisecondsDecimalDigits : 0;
|
|
3632
|
+
const millisecondsString = millisecondsDecimalDigits ? millisecondsAndBelow.toFixed(millisecondsDecimalDigits) : millisecondsAndBelow >= 1 ? Math.round(millisecondsAndBelow) : Math.ceil(millisecondsAndBelow);
|
|
3633
|
+
add(Number.parseFloat(millisecondsString), "millisecond", "ms", millisecondsString);
|
|
3634
|
+
}
|
|
3609
3635
|
} else {
|
|
3610
|
-
const
|
|
3611
|
-
const
|
|
3612
|
-
|
|
3613
|
-
add(Number.parseFloat(millisecondsString), "millisecond", "ms", millisecondsString);
|
|
3636
|
+
const secondsFixed = floorDecimals((isBigInt ? Number(milliseconds % ONE_DAY_IN_MILLISECONDS) : milliseconds) / 1e3 % 60, typeof options.secondsDecimalDigits === "number" ? options.secondsDecimalDigits : 1);
|
|
3637
|
+
const secondsString = options.keepDecimalsOnWholeSeconds ? secondsFixed : secondsFixed.replace(/\.0+$/, "");
|
|
3638
|
+
add(Number.parseFloat(secondsString), "second", "s", secondsString);
|
|
3614
3639
|
}
|
|
3615
|
-
} else {
|
|
3616
|
-
const secondsFixed = floorDecimals((isBigInt ? Number(milliseconds % ONE_DAY_IN_MILLISECONDS) : milliseconds) / 1e3 % 60, typeof options.secondsDecimalDigits === "number" ? options.secondsDecimalDigits : 1);
|
|
3617
|
-
const secondsString = options.keepDecimalsOnWholeSeconds ? secondsFixed : secondsFixed.replace(/\.0+$/, "");
|
|
3618
|
-
add(Number.parseFloat(secondsString), "second", "s", secondsString);
|
|
3619
3640
|
}
|
|
3620
3641
|
if (result.length === 0) return sign + "0" + (options.verbose ? " milliseconds" : "ms");
|
|
3621
3642
|
const separator = options.colonNotation ? ":" : " ";
|
|
@@ -3640,9 +3661,10 @@ const logResult = (result, verboseInfo) => {
|
|
|
3640
3661
|
logDuration(result, verboseInfo);
|
|
3641
3662
|
};
|
|
3642
3663
|
const logDuration = (result, verboseInfo) => {
|
|
3664
|
+
const verboseMessage = `(done in ${prettyMilliseconds(result.durationMs)})`;
|
|
3643
3665
|
verboseLog({
|
|
3644
3666
|
type: "duration",
|
|
3645
|
-
verboseMessage
|
|
3667
|
+
verboseMessage,
|
|
3646
3668
|
verboseInfo,
|
|
3647
3669
|
result
|
|
3648
3670
|
});
|
|
@@ -3710,10 +3732,10 @@ const isTransformOptions = (value) => isPlainObject(value) && (value.transform !
|
|
|
3710
3732
|
const isUrl = (value) => Object.prototype.toString.call(value) === "[object URL]";
|
|
3711
3733
|
const isRegularUrl = (value) => isUrl(value) && value.protocol !== "file:";
|
|
3712
3734
|
const isFilePathObject = (value) => isPlainObject(value) && Object.keys(value).length > 0 && Object.keys(value).every((key) => FILE_PATH_KEYS.has(key)) && isFilePathString(value.file);
|
|
3713
|
-
const FILE_PATH_KEYS = new Set(["file", "append"]);
|
|
3735
|
+
const FILE_PATH_KEYS = /* @__PURE__ */ new Set(["file", "append"]);
|
|
3714
3736
|
const isFilePathString = (file) => typeof file === "string";
|
|
3715
3737
|
const isUnknownStdioString = (type, value) => type === "native" && typeof value === "string" && !KNOWN_STDIO_STRINGS.has(value);
|
|
3716
|
-
const KNOWN_STDIO_STRINGS = new Set([
|
|
3738
|
+
const KNOWN_STDIO_STRINGS = /* @__PURE__ */ new Set([
|
|
3717
3739
|
"ipc",
|
|
3718
3740
|
"ignore",
|
|
3719
3741
|
"inherit",
|
|
@@ -3727,24 +3749,24 @@ const isTransformStream = (value) => isReadableStream(value?.readable) && isWrit
|
|
|
3727
3749
|
const isAsyncIterableObject = (value) => isObject(value) && typeof value[Symbol.asyncIterator] === "function";
|
|
3728
3750
|
const isIterableObject = (value) => isObject(value) && typeof value[Symbol.iterator] === "function";
|
|
3729
3751
|
const isObject = (value) => typeof value === "object" && value !== null;
|
|
3730
|
-
const TRANSFORM_TYPES = new Set([
|
|
3752
|
+
const TRANSFORM_TYPES = /* @__PURE__ */ new Set([
|
|
3731
3753
|
"generator",
|
|
3732
3754
|
"asyncGenerator",
|
|
3733
3755
|
"duplex",
|
|
3734
3756
|
"webTransform"
|
|
3735
3757
|
]);
|
|
3736
|
-
const FILE_TYPES = new Set([
|
|
3758
|
+
const FILE_TYPES = /* @__PURE__ */ new Set([
|
|
3737
3759
|
"fileUrl",
|
|
3738
3760
|
"filePath",
|
|
3739
3761
|
"fileNumber"
|
|
3740
3762
|
]);
|
|
3741
|
-
const SPECIAL_DUPLICATE_TYPES_SYNC = new Set(["fileUrl", "filePath"]);
|
|
3742
|
-
const SPECIAL_DUPLICATE_TYPES = new Set([
|
|
3763
|
+
const SPECIAL_DUPLICATE_TYPES_SYNC = /* @__PURE__ */ new Set(["fileUrl", "filePath"]);
|
|
3764
|
+
const SPECIAL_DUPLICATE_TYPES = /* @__PURE__ */ new Set([
|
|
3743
3765
|
...SPECIAL_DUPLICATE_TYPES_SYNC,
|
|
3744
3766
|
"webStream",
|
|
3745
3767
|
"nodeStream"
|
|
3746
3768
|
]);
|
|
3747
|
-
const FORBID_DUPLICATE_TYPES = new Set(["webTransform", "duplex"]);
|
|
3769
|
+
const FORBID_DUPLICATE_TYPES = /* @__PURE__ */ new Set(["webTransform", "duplex"]);
|
|
3748
3770
|
const TYPE_TO_MESSAGE = {
|
|
3749
3771
|
generator: "a generator",
|
|
3750
3772
|
asyncGenerator: "an async generator",
|
|
@@ -4077,7 +4099,8 @@ const validateDuplicateStreamSync = ({ otherStdioItems, type, value, optionName,
|
|
|
4077
4099
|
const getDuplicateStreamInstance = ({ otherStdioItems, type, value, optionName, direction }) => {
|
|
4078
4100
|
const duplicateStdioItems = otherStdioItems.filter((stdioItem) => hasSameValue(stdioItem, value));
|
|
4079
4101
|
if (duplicateStdioItems.length === 0) return;
|
|
4080
|
-
|
|
4102
|
+
const differentStdioItem = duplicateStdioItems.find((stdioItem) => stdioItem.direction !== direction);
|
|
4103
|
+
throwOnDuplicateStream(differentStdioItem, optionName, type);
|
|
4081
4104
|
return direction === "output" ? duplicateStdioItems[0].stream : void 0;
|
|
4082
4105
|
};
|
|
4083
4106
|
const hasSameValue = ({ type, value }, secondValue) => {
|
|
@@ -4086,7 +4109,8 @@ const hasSameValue = ({ type, value }, secondValue) => {
|
|
|
4086
4109
|
return value === secondValue;
|
|
4087
4110
|
};
|
|
4088
4111
|
const validateDuplicateTransform = ({ otherStdioItems, type, value, optionName }) => {
|
|
4089
|
-
|
|
4112
|
+
const duplicateStdioItem = otherStdioItems.find(({ value: { transform } }) => transform === value.transform);
|
|
4113
|
+
throwOnDuplicateStream(duplicateStdioItem, optionName, type);
|
|
4090
4114
|
};
|
|
4091
4115
|
const throwOnDuplicateStream = (stdioItem, optionName, type) => {
|
|
4092
4116
|
if (stdioItem !== void 0) throw new TypeError(`The \`${stdioItem.optionName}\` and \`${optionName}\` options must not target ${TYPE_TO_MESSAGE[type]} that is the same.`);
|
|
@@ -4094,13 +4118,14 @@ const throwOnDuplicateStream = (stdioItem, optionName, type) => {
|
|
|
4094
4118
|
//#endregion
|
|
4095
4119
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/stdio/handle.js
|
|
4096
4120
|
const handleStdio = (addProperties, options, verboseInfo, isSync) => {
|
|
4121
|
+
const initialFileDescriptors = normalizeStdioOption(options, verboseInfo, isSync).map((stdioOption, fdNumber) => getFileDescriptor({
|
|
4122
|
+
stdioOption,
|
|
4123
|
+
fdNumber,
|
|
4124
|
+
options,
|
|
4125
|
+
isSync
|
|
4126
|
+
}));
|
|
4097
4127
|
const fileDescriptors = getFinalFileDescriptors({
|
|
4098
|
-
initialFileDescriptors
|
|
4099
|
-
stdioOption,
|
|
4100
|
-
fdNumber,
|
|
4101
|
-
options,
|
|
4102
|
-
isSync
|
|
4103
|
-
})),
|
|
4128
|
+
initialFileDescriptors,
|
|
4104
4129
|
addProperties,
|
|
4105
4130
|
options,
|
|
4106
4131
|
isSync
|
|
@@ -4117,13 +4142,14 @@ const getFileDescriptor = ({ stdioOption, fdNumber, options, isSync }) => {
|
|
|
4117
4142
|
optionName
|
|
4118
4143
|
});
|
|
4119
4144
|
const direction = getStreamDirection(initialStdioItems, fdNumber, optionName);
|
|
4120
|
-
const
|
|
4145
|
+
const stdioItems = initialStdioItems.map((stdioItem) => handleNativeStream({
|
|
4121
4146
|
stdioItem,
|
|
4122
4147
|
isStdioArray,
|
|
4123
4148
|
fdNumber,
|
|
4124
4149
|
direction,
|
|
4125
4150
|
isSync
|
|
4126
|
-
}))
|
|
4151
|
+
}));
|
|
4152
|
+
const normalizedStdioItems = normalizeTransforms(stdioItems, optionName, direction, options);
|
|
4127
4153
|
const objectMode = getFdObjectMode(normalizedStdioItems, direction);
|
|
4128
4154
|
validateFileObjectMode(normalizedStdioItems, objectMode);
|
|
4129
4155
|
return {
|
|
@@ -4133,7 +4159,8 @@ const getFileDescriptor = ({ stdioOption, fdNumber, options, isSync }) => {
|
|
|
4133
4159
|
};
|
|
4134
4160
|
};
|
|
4135
4161
|
const initializeStdioItems = ({ stdioOption, fdNumber, options, optionName }) => {
|
|
4136
|
-
const
|
|
4162
|
+
const initialStdioItems = [...(Array.isArray(stdioOption) ? stdioOption : [stdioOption]).map((value) => initializeStdioItem(value, optionName)), ...handleInputOptions(options, fdNumber)];
|
|
4163
|
+
const stdioItems = filterDuplicates(initialStdioItems);
|
|
4137
4164
|
const isStdioArray = stdioItems.length > 1;
|
|
4138
4165
|
validateStdioArray(stdioItems, isStdioArray, optionName);
|
|
4139
4166
|
validateStreams(stdioItems);
|
|
@@ -4152,7 +4179,7 @@ const validateStdioArray = (stdioItems, isStdioArray, optionName) => {
|
|
|
4152
4179
|
if (!isStdioArray) return;
|
|
4153
4180
|
for (const { value, optionName } of stdioItems) if (INVALID_STDIO_ARRAY_OPTIONS.has(value)) throw new Error(`The \`${optionName}\` option must not include \`${value}\`.`);
|
|
4154
4181
|
};
|
|
4155
|
-
const INVALID_STDIO_ARRAY_OPTIONS = new Set(["ignore", "ipc"]);
|
|
4182
|
+
const INVALID_STDIO_ARRAY_OPTIONS = /* @__PURE__ */ new Set(["ignore", "ipc"]);
|
|
4156
4183
|
const validateStreams = (stdioItems) => {
|
|
4157
4184
|
for (const stdioItem of stdioItems) validateFileStdio(stdioItem);
|
|
4158
4185
|
};
|
|
@@ -4481,7 +4508,10 @@ const generatorToStream = ({ value, value: { transform, final, writableObjectMod
|
|
|
4481
4508
|
const runGeneratorsSync = (chunks, stdioItems, encoding, isInput) => {
|
|
4482
4509
|
const generators = stdioItems.filter(({ type }) => type === "generator");
|
|
4483
4510
|
const reversedGenerators = isInput ? generators.reverse() : generators;
|
|
4484
|
-
for (const { value, optionName } of reversedGenerators)
|
|
4511
|
+
for (const { value, optionName } of reversedGenerators) {
|
|
4512
|
+
const generators = addInternalGenerators(value, encoding, optionName);
|
|
4513
|
+
chunks = runTransformSync(generators, chunks);
|
|
4514
|
+
}
|
|
4485
4515
|
return chunks;
|
|
4486
4516
|
};
|
|
4487
4517
|
const addInternalGenerators = ({ transform, final, binary, writableObjectMode, readableObjectMode, preserveNewlines }, encoding, optionName) => {
|
|
@@ -4517,7 +4547,8 @@ const addInputOptionSync = (fileDescriptors, fdNumber, options) => {
|
|
|
4517
4547
|
const [{ type, optionName }] = allStdioItems;
|
|
4518
4548
|
throw new TypeError(`Only the \`stdin\` option, not \`${optionName}\`, can be ${TYPE_TO_MESSAGE[type]} with synchronous methods.`);
|
|
4519
4549
|
}
|
|
4520
|
-
|
|
4550
|
+
const transformedContents = allStdioItems.map(({ contents }) => contents).map((contents) => applySingleInputGeneratorsSync(contents, stdioItems));
|
|
4551
|
+
options.input = joinToUint8Array(transformedContents);
|
|
4521
4552
|
};
|
|
4522
4553
|
const applySingleInputGeneratorsSync = (contents, stdioItems) => {
|
|
4523
4554
|
const newContents = runGeneratorsSync(contents, stdioItems, "utf8", true);
|
|
@@ -4532,7 +4563,7 @@ const validateSerializable = (newContents) => {
|
|
|
4532
4563
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/verbose/output.js
|
|
4533
4564
|
const shouldLogOutput = ({ stdioItems, encoding, verboseInfo, fdNumber }) => fdNumber !== "all" && isFullVerbose(verboseInfo, fdNumber) && !BINARY_ENCODINGS.has(encoding) && fdUsesVerbose(fdNumber) && (stdioItems.some(({ type, value }) => type === "native" && PIPED_STDIO_VALUES.has(value)) || stdioItems.every(({ type }) => TRANSFORM_TYPES.has(type)));
|
|
4534
4565
|
const fdUsesVerbose = (fdNumber) => fdNumber === 1 || fdNumber === 2;
|
|
4535
|
-
const PIPED_STDIO_VALUES = new Set(["pipe", "overlapped"]);
|
|
4566
|
+
const PIPED_STDIO_VALUES = /* @__PURE__ */ new Set(["pipe", "overlapped"]);
|
|
4536
4567
|
const logLines = async (linesIterable, stream, fdNumber, verboseInfo) => {
|
|
4537
4568
|
for await (const line of linesIterable) if (!isPipingStream(stream)) logLine(line, fdNumber, verboseInfo);
|
|
4538
4569
|
};
|
|
@@ -4541,9 +4572,10 @@ const logLinesSync = (linesArray, fdNumber, verboseInfo) => {
|
|
|
4541
4572
|
};
|
|
4542
4573
|
const isPipingStream = (stream) => stream._readableState.pipes.length > 0;
|
|
4543
4574
|
const logLine = (line, fdNumber, verboseInfo) => {
|
|
4575
|
+
const verboseMessage = serializeVerboseMessage(line);
|
|
4544
4576
|
verboseLog({
|
|
4545
4577
|
type: "output",
|
|
4546
|
-
verboseMessage
|
|
4578
|
+
verboseMessage,
|
|
4547
4579
|
fdNumber,
|
|
4548
4580
|
verboseInfo
|
|
4549
4581
|
});
|
|
@@ -4569,10 +4601,12 @@ const transformOutputSync = ({ fileDescriptors, syncResult: { output }, options,
|
|
|
4569
4601
|
};
|
|
4570
4602
|
const transformOutputResultSync = ({ result, fileDescriptors, fdNumber, state, outputFiles, isMaxBuffer, verboseInfo }, { buffer, encoding, lines, stripFinalNewline, maxBuffer }) => {
|
|
4571
4603
|
if (result === null) return;
|
|
4572
|
-
const
|
|
4604
|
+
const truncatedResult = truncateMaxBufferSync(result, isMaxBuffer, maxBuffer);
|
|
4605
|
+
const uint8ArrayResult = bufferToUint8Array(truncatedResult);
|
|
4573
4606
|
const { stdioItems, objectMode } = fileDescriptors[fdNumber];
|
|
4607
|
+
const chunks = runOutputGeneratorsSync([uint8ArrayResult], stdioItems, encoding, state);
|
|
4574
4608
|
const { serializedResult, finalResult = serializedResult } = serializeChunks({
|
|
4575
|
-
chunks
|
|
4609
|
+
chunks,
|
|
4576
4610
|
objectMode,
|
|
4577
4611
|
encoding,
|
|
4578
4612
|
lines,
|
|
@@ -4696,7 +4730,7 @@ const getResultError = (error, exitCode, signal) => {
|
|
|
4696
4730
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/methods/main-sync.js
|
|
4697
4731
|
const execaCoreSync = (rawFile, rawArguments, rawOptions) => {
|
|
4698
4732
|
const { file, commandArguments, command, escapedCommand, startTime, verboseInfo, options, fileDescriptors } = handleSyncArguments(rawFile, rawArguments, rawOptions);
|
|
4699
|
-
|
|
4733
|
+
const result = spawnSubprocessSync({
|
|
4700
4734
|
file,
|
|
4701
4735
|
commandArguments,
|
|
4702
4736
|
options,
|
|
@@ -4705,11 +4739,13 @@ const execaCoreSync = (rawFile, rawArguments, rawOptions) => {
|
|
|
4705
4739
|
verboseInfo,
|
|
4706
4740
|
fileDescriptors,
|
|
4707
4741
|
startTime
|
|
4708
|
-
})
|
|
4742
|
+
});
|
|
4743
|
+
return handleResult(result, verboseInfo, options);
|
|
4709
4744
|
};
|
|
4710
4745
|
const handleSyncArguments = (rawFile, rawArguments, rawOptions) => {
|
|
4711
4746
|
const { command, escapedCommand, startTime, verboseInfo } = handleCommand(rawFile, rawArguments, rawOptions);
|
|
4712
|
-
const
|
|
4747
|
+
const syncOptions = normalizeSyncOptions(rawOptions);
|
|
4748
|
+
const { file, commandArguments, options } = normalizeOptions(rawFile, rawArguments, syncOptions);
|
|
4713
4749
|
validateSyncOptions(options);
|
|
4714
4750
|
return {
|
|
4715
4751
|
file,
|
|
@@ -4754,14 +4790,16 @@ const spawnSubprocessSync = ({ file, commandArguments, options, command, escaped
|
|
|
4754
4790
|
isMaxBuffer,
|
|
4755
4791
|
verboseInfo
|
|
4756
4792
|
});
|
|
4793
|
+
const stdio = output.map((stdioOutput, fdNumber) => stripNewline(stdioOutput, options, fdNumber));
|
|
4794
|
+
const all = stripNewline(getAllSync(output, options), options, "all");
|
|
4757
4795
|
return getSyncResult({
|
|
4758
4796
|
error,
|
|
4759
4797
|
exitCode,
|
|
4760
4798
|
signal,
|
|
4761
4799
|
timedOut,
|
|
4762
4800
|
isMaxBuffer,
|
|
4763
|
-
stdio
|
|
4764
|
-
all
|
|
4801
|
+
stdio,
|
|
4802
|
+
all,
|
|
4765
4803
|
options,
|
|
4766
4804
|
command,
|
|
4767
4805
|
escapedCommand,
|
|
@@ -4771,7 +4809,8 @@ const spawnSubprocessSync = ({ file, commandArguments, options, command, escaped
|
|
|
4771
4809
|
const runSubprocessSync = ({ file, commandArguments, options, command, escapedCommand, fileDescriptors, startTime }) => {
|
|
4772
4810
|
try {
|
|
4773
4811
|
addInputOptionsSync(fileDescriptors, options);
|
|
4774
|
-
|
|
4812
|
+
const normalizedOptions = normalizeSpawnSyncOptions(options);
|
|
4813
|
+
return (0, node_child_process.spawnSync)(file, commandArguments, normalizedOptions);
|
|
4775
4814
|
} catch (error) {
|
|
4776
4815
|
return makeEarlyError({
|
|
4777
4816
|
error,
|
|
@@ -4985,17 +5024,18 @@ const handleEarlyError = ({ error, command, escapedCommand, fileDescriptors, opt
|
|
|
4985
5024
|
writable,
|
|
4986
5025
|
duplex
|
|
4987
5026
|
});
|
|
5027
|
+
const earlyError = makeEarlyError({
|
|
5028
|
+
error,
|
|
5029
|
+
command,
|
|
5030
|
+
escapedCommand,
|
|
5031
|
+
fileDescriptors,
|
|
5032
|
+
options,
|
|
5033
|
+
startTime,
|
|
5034
|
+
isSync: false
|
|
5035
|
+
});
|
|
4988
5036
|
return {
|
|
4989
5037
|
subprocess,
|
|
4990
|
-
promise: handleDummyPromise(
|
|
4991
|
-
error,
|
|
4992
|
-
command,
|
|
4993
|
-
escapedCommand,
|
|
4994
|
-
fileDescriptors,
|
|
4995
|
-
options,
|
|
4996
|
-
startTime,
|
|
4997
|
-
isSync: false
|
|
4998
|
-
}), verboseInfo, options)
|
|
5038
|
+
promise: handleDummyPromise(earlyError, verboseInfo, options)
|
|
4999
5039
|
};
|
|
5000
5040
|
};
|
|
5001
5041
|
const createDummyStreams = (subprocess, fileDescriptors) => {
|
|
@@ -5179,8 +5219,10 @@ const endWhenStreamsDone = async ({ passThroughStream, stream, streams, ended, a
|
|
|
5179
5219
|
controller.abort();
|
|
5180
5220
|
updateMaxListeners(passThroughStream, -PASSTHROUGH_LISTENERS_PER_STREAM);
|
|
5181
5221
|
}
|
|
5182
|
-
if (streams.size > 0 && streams.size === ended.size + aborted.size)
|
|
5183
|
-
|
|
5222
|
+
if (streams.size > 0 && streams.size === ended.size + aborted.size) {
|
|
5223
|
+
if (ended.size === 0 && aborted.size > 0) abortStream(passThroughStream);
|
|
5224
|
+
else endStream(passThroughStream);
|
|
5225
|
+
}
|
|
5184
5226
|
};
|
|
5185
5227
|
const afterMergedStreamFinished = async (onFinished, stream, { signal }) => {
|
|
5186
5228
|
try {
|
|
@@ -5286,7 +5328,10 @@ const pipeOutputAsync = (subprocess, fileDescriptors, controller) => {
|
|
|
5286
5328
|
controller
|
|
5287
5329
|
});
|
|
5288
5330
|
}
|
|
5289
|
-
for (const [outputStream, inputStreams] of pipeGroups.entries())
|
|
5331
|
+
for (const [outputStream, inputStreams] of pipeGroups.entries()) {
|
|
5332
|
+
const inputStream = inputStreams.length === 1 ? inputStreams[0] : mergeStreams(inputStreams);
|
|
5333
|
+
pipeStreams(inputStream, outputStream);
|
|
5334
|
+
}
|
|
5290
5335
|
};
|
|
5291
5336
|
const pipeTransform = (subprocess, stream, direction, fdNumber) => {
|
|
5292
5337
|
if (direction === "output") pipeStreams(subprocess.stdio[fdNumber], stream);
|
|
@@ -5775,12 +5820,13 @@ const stopReadingOnStreamEnd = async (onStreamEnd, controller, stream) => {
|
|
|
5775
5820
|
}
|
|
5776
5821
|
};
|
|
5777
5822
|
const iterateOnStream = ({ stream, controller, binary, shouldEncode, encoding, shouldSplit, preserveNewlines }) => {
|
|
5823
|
+
const onStdoutChunk = (0, node_events.on)(stream, "data", {
|
|
5824
|
+
signal: controller.signal,
|
|
5825
|
+
highWaterMark: HIGH_WATER_MARK,
|
|
5826
|
+
highWatermark: HIGH_WATER_MARK
|
|
5827
|
+
});
|
|
5778
5828
|
return iterateOnData({
|
|
5779
|
-
onStdoutChunk
|
|
5780
|
-
signal: controller.signal,
|
|
5781
|
-
highWaterMark: HIGH_WATER_MARK,
|
|
5782
|
-
highWatermark: HIGH_WATER_MARK
|
|
5783
|
-
}),
|
|
5829
|
+
onStdoutChunk,
|
|
5784
5830
|
controller,
|
|
5785
5831
|
binary,
|
|
5786
5832
|
shouldEncode,
|
|
@@ -5824,12 +5870,13 @@ const getStreamOutput = async ({ stream, onStreamEnd, fdNumber, encoding, buffer
|
|
|
5824
5870
|
await Promise.all([resumeStream(stream), logPromise]);
|
|
5825
5871
|
return;
|
|
5826
5872
|
}
|
|
5873
|
+
const stripFinalNewlineValue = getStripFinalNewline(stripFinalNewline, fdNumber);
|
|
5827
5874
|
const iterable = iterateForResult({
|
|
5828
5875
|
stream,
|
|
5829
5876
|
onStreamEnd,
|
|
5830
5877
|
lines,
|
|
5831
5878
|
encoding,
|
|
5832
|
-
stripFinalNewline:
|
|
5879
|
+
stripFinalNewline: stripFinalNewlineValue,
|
|
5833
5880
|
allMixed
|
|
5834
5881
|
});
|
|
5835
5882
|
const [output] = await Promise.all([getStreamContents({
|
|
@@ -5849,14 +5896,15 @@ const logOutputAsync = async ({ stream, onStreamEnd, fdNumber, encoding, allMixe
|
|
|
5849
5896
|
verboseInfo,
|
|
5850
5897
|
fdNumber
|
|
5851
5898
|
})) return;
|
|
5852
|
-
|
|
5899
|
+
const linesIterable = iterateForResult({
|
|
5853
5900
|
stream,
|
|
5854
5901
|
onStreamEnd,
|
|
5855
5902
|
lines: true,
|
|
5856
5903
|
encoding,
|
|
5857
5904
|
stripFinalNewline: true,
|
|
5858
5905
|
allMixed
|
|
5859
|
-
})
|
|
5906
|
+
});
|
|
5907
|
+
await logLines(linesIterable, stream, fdNumber, verboseInfo);
|
|
5860
5908
|
};
|
|
5861
5909
|
const resumeStream = async (stream) => {
|
|
5862
5910
|
await (0, node_timers_promises.setImmediate)();
|
|
@@ -6002,9 +6050,10 @@ const getAllMixed = ({ all, stdout, stderr }) => all && stdout && stderr && stdo
|
|
|
6002
6050
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/verbose/ipc.js
|
|
6003
6051
|
const shouldLogIpc = (verboseInfo) => isFullVerbose(verboseInfo, "ipc");
|
|
6004
6052
|
const logIpcOutput = (message, verboseInfo) => {
|
|
6053
|
+
const verboseMessage = serializeVerboseMessage(message);
|
|
6005
6054
|
verboseLog({
|
|
6006
6055
|
type: "ipc",
|
|
6007
|
-
verboseMessage
|
|
6056
|
+
verboseMessage,
|
|
6008
6057
|
fdNumber: "ipc",
|
|
6009
6058
|
verboseInfo
|
|
6010
6059
|
});
|
|
@@ -6400,14 +6449,15 @@ const onDuplexDestroy = async ({ subprocessStdout, subprocessStdin, subprocess,
|
|
|
6400
6449
|
const createIterable = (subprocess, encoding, { from, binary: binaryOption = false, preserveNewlines = false } = {}) => {
|
|
6401
6450
|
const binary = binaryOption || BINARY_ENCODINGS.has(encoding);
|
|
6402
6451
|
const subprocessStdout = getFromStream(subprocess, from);
|
|
6403
|
-
|
|
6452
|
+
const onStdoutData = iterateOnSubprocessStream({
|
|
6404
6453
|
subprocessStdout,
|
|
6405
6454
|
subprocess,
|
|
6406
6455
|
binary,
|
|
6407
6456
|
shouldEncode: true,
|
|
6408
6457
|
encoding,
|
|
6409
6458
|
preserveNewlines
|
|
6410
|
-
})
|
|
6459
|
+
});
|
|
6460
|
+
return iterateOnStdoutData(onStdoutData, subprocessStdout, subprocess);
|
|
6411
6461
|
};
|
|
6412
6462
|
const iterateOnStdoutData = async function* (onStdoutData, subprocessStdout, subprocess) {
|
|
6413
6463
|
try {
|
|
@@ -6567,19 +6617,22 @@ const handlePromise = async ({ subprocess, options, startTime, verboseInfo, file
|
|
|
6567
6617
|
});
|
|
6568
6618
|
controller.abort();
|
|
6569
6619
|
onInternalError.resolve();
|
|
6570
|
-
|
|
6620
|
+
const stdio = stdioResults.map((stdioResult, fdNumber) => stripNewline(stdioResult, options, fdNumber));
|
|
6621
|
+
const all = stripNewline(allResult, options, "all");
|
|
6622
|
+
const result = getAsyncResult({
|
|
6571
6623
|
errorInfo,
|
|
6572
6624
|
exitCode,
|
|
6573
6625
|
signal,
|
|
6574
|
-
stdio
|
|
6575
|
-
all
|
|
6626
|
+
stdio,
|
|
6627
|
+
all,
|
|
6576
6628
|
ipcOutput,
|
|
6577
6629
|
context,
|
|
6578
6630
|
options,
|
|
6579
6631
|
command,
|
|
6580
6632
|
escapedCommand,
|
|
6581
6633
|
startTime
|
|
6582
|
-
})
|
|
6634
|
+
});
|
|
6635
|
+
return handleResult(result, verboseInfo, options);
|
|
6583
6636
|
};
|
|
6584
6637
|
const getAsyncResult = ({ errorInfo, exitCode, signal, stdio, all, ipcOutput, context, options, command, escapedCommand, startTime }) => "error" in errorInfo ? makeError({
|
|
6585
6638
|
error: errorInfo.error,
|
|
@@ -6623,7 +6676,7 @@ const mergeOption = (optionName, boundOptionValue, optionValue) => {
|
|
|
6623
6676
|
};
|
|
6624
6677
|
return optionValue;
|
|
6625
6678
|
};
|
|
6626
|
-
const DEEP_OPTIONS = new Set(["env", ...FD_SPECIFIC_OPTIONS]);
|
|
6679
|
+
const DEEP_OPTIONS = /* @__PURE__ */ new Set(["env", ...FD_SPECIFIC_OPTIONS]);
|
|
6627
6680
|
//#endregion
|
|
6628
6681
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/methods/create.js
|
|
6629
6682
|
const createExeca = (mapArguments, boundOptions, deepOptions, setBoundExeca) => {
|
|
@@ -6650,7 +6703,8 @@ const callBoundExeca = ({ mapArguments, deepOptions = {}, boundOptions = {}, set
|
|
|
6650
6703
|
return isSync ? execaCoreSync(file, commandArguments, options) : execaCoreAsync(file, commandArguments, options, createNested);
|
|
6651
6704
|
};
|
|
6652
6705
|
const parseArguments = ({ mapArguments, firstArgument, nextArguments, deepOptions, boundOptions }) => {
|
|
6653
|
-
const
|
|
6706
|
+
const callArguments = isTemplateString(firstArgument) ? parseTemplates(firstArgument, nextArguments) : [firstArgument, ...nextArguments];
|
|
6707
|
+
const [initialFile, initialArguments, initialOptions] = normalizeParameters(...callArguments);
|
|
6654
6708
|
const mergedOptions = mergeOptions(mergeOptions(deepOptions, boundOptions), initialOptions);
|
|
6655
6709
|
const { file = initialFile, commandArguments = initialArguments, options = mergedOptions, isSync = false } = mapArguments({
|
|
6656
6710
|
file: initialFile,
|
|
@@ -6721,6 +6775,7 @@ const { sendMessage, getOneMessage, getEachMessage, getCancelSignal } = getIpcEx
|
|
|
6721
6775
|
//#endregion
|
|
6722
6776
|
//#region src/firebaseDatabaseParserShared.ts
|
|
6723
6777
|
var FirebaseDatabaseDataError = class extends Error {
|
|
6778
|
+
source;
|
|
6724
6779
|
name = "FirebaseDatabaseDataError";
|
|
6725
6780
|
constructor(source) {
|
|
6726
6781
|
super(`Invalid Firebase database data at "${source}".`);
|
|
@@ -6832,6 +6887,24 @@ const parseFirebaseBundleEventRow = (value, source) => {
|
|
|
6832
6887
|
received_at_ms: number(property(input, "received_at_ms"), source)
|
|
6833
6888
|
};
|
|
6834
6889
|
};
|
|
6890
|
+
const parseFirebaseInsightsInstallationRow = (value, source) => {
|
|
6891
|
+
const input = record(value, source);
|
|
6892
|
+
const type = string(property(input, "type"), source);
|
|
6893
|
+
if (type !== "UPDATE_APPLIED" && type !== "RECOVERED" && type !== "RELEASE_ADOPTED" && type !== "UNCHANGED") throw new FirebaseDatabaseDataError(source);
|
|
6894
|
+
return {
|
|
6895
|
+
id: string(property(input, "id"), source),
|
|
6896
|
+
type,
|
|
6897
|
+
install_id: string(property(input, "install_id"), source),
|
|
6898
|
+
user_id: nullableString(property(input, "user_id"), source),
|
|
6899
|
+
username: nullableString(property(input, "username"), source),
|
|
6900
|
+
to_bundle_id: string(property(input, "to_bundle_id"), source),
|
|
6901
|
+
platform: platform(property(input, "platform"), source),
|
|
6902
|
+
app_version: string(property(input, "app_version"), source),
|
|
6903
|
+
channel: string(property(input, "channel"), source),
|
|
6904
|
+
cohort: string(property(input, "cohort"), source),
|
|
6905
|
+
received_at_ms: number(property(input, "received_at_ms"), source)
|
|
6906
|
+
};
|
|
6907
|
+
};
|
|
6835
6908
|
const parseFirebaseApiKeyRow = (value, source) => {
|
|
6836
6909
|
const input = record(value, source);
|
|
6837
6910
|
const role = string(property(input, "role"), source);
|
|
@@ -6912,13 +6985,15 @@ const matchesCondition = (row, condition) => {
|
|
|
6912
6985
|
switch (condition.operator ?? "eq") {
|
|
6913
6986
|
case "eq": {
|
|
6914
6987
|
if (typeof expected !== "string") return actual === expected;
|
|
6915
|
-
const
|
|
6988
|
+
const mode = "mode" in condition ? condition.mode : void 0;
|
|
6989
|
+
const comparison = normalizeStringComparison(actual, expected, mode);
|
|
6916
6990
|
return comparison !== null && comparison[0] === comparison[1];
|
|
6917
6991
|
}
|
|
6918
6992
|
case "ne": {
|
|
6919
6993
|
if (actual === null || actual === void 0) return false;
|
|
6920
6994
|
if (typeof expected !== "string") return actual !== expected;
|
|
6921
|
-
const
|
|
6995
|
+
const mode = "mode" in condition ? condition.mode : void 0;
|
|
6996
|
+
const comparison = normalizeStringComparison(actual, expected, mode);
|
|
6922
6997
|
return comparison === null || comparison[0] !== comparison[1];
|
|
6923
6998
|
}
|
|
6924
6999
|
case "gt":
|
|
@@ -6943,17 +7018,20 @@ const matchesCondition = (row, condition) => {
|
|
|
6943
7018
|
}
|
|
6944
7019
|
case "contains": {
|
|
6945
7020
|
if (typeof expected !== "string") return false;
|
|
6946
|
-
const
|
|
7021
|
+
const mode = "mode" in condition ? condition.mode : void 0;
|
|
7022
|
+
const comparison = normalizeStringComparison(actual, expected, mode);
|
|
6947
7023
|
return comparison?.[0].includes(comparison[1]) ?? false;
|
|
6948
7024
|
}
|
|
6949
7025
|
case "starts_with": {
|
|
6950
7026
|
if (typeof expected !== "string") return false;
|
|
6951
|
-
const
|
|
7027
|
+
const mode = "mode" in condition ? condition.mode : void 0;
|
|
7028
|
+
const comparison = normalizeStringComparison(actual, expected, mode);
|
|
6952
7029
|
return comparison?.[0].startsWith(comparison[1]) ?? false;
|
|
6953
7030
|
}
|
|
6954
7031
|
case "ends_with": {
|
|
6955
7032
|
if (typeof expected !== "string") return false;
|
|
6956
|
-
const
|
|
7033
|
+
const mode = "mode" in condition ? condition.mode : void 0;
|
|
7034
|
+
const comparison = normalizeStringComparison(actual, expected, mode);
|
|
6957
7035
|
return comparison?.[0].endsWith(comparison[1]) ?? false;
|
|
6958
7036
|
}
|
|
6959
7037
|
}
|
|
@@ -6998,6 +7076,7 @@ const queryFirebaseDatabaseRows = (rows, input) => {
|
|
|
6998
7076
|
//#endregion
|
|
6999
7077
|
//#region src/firebaseDatabaseState.ts
|
|
7000
7078
|
var FirebaseDatabaseConstraintError = class extends Error {
|
|
7079
|
+
constraint;
|
|
7001
7080
|
name = "FirebaseDatabaseConstraintError";
|
|
7002
7081
|
constructor(constraint) {
|
|
7003
7082
|
super(`Firebase database constraint failed: ${constraint}`);
|
|
@@ -7008,6 +7087,7 @@ const cloneFirebaseDatabaseSnapshot = (snapshot) => ({
|
|
|
7008
7087
|
bundles: new Map(snapshot.bundles),
|
|
7009
7088
|
bundlePatches: new Map(snapshot.bundlePatches),
|
|
7010
7089
|
bundleEvents: new Map(snapshot.bundleEvents),
|
|
7090
|
+
bundleInstallations: new Map(snapshot.bundleInstallations),
|
|
7011
7091
|
channels: new Map(snapshot.channels),
|
|
7012
7092
|
apiKeys: new Map(snapshot.apiKeys),
|
|
7013
7093
|
releaseCatalogs: new Map(snapshot.releaseCatalogs),
|
|
@@ -7037,6 +7117,13 @@ const createFirebaseDatabaseState = (snapshot) => ({
|
|
|
7037
7117
|
requireUnique(snapshot.bundleEvents, input.data.id, input.model);
|
|
7038
7118
|
snapshot.bundleEvents.set(input.data.id, input.data);
|
|
7039
7119
|
return input.data;
|
|
7120
|
+
case "bundle_installations": {
|
|
7121
|
+
const current = snapshot.bundleInstallations.get(input.data.install_id);
|
|
7122
|
+
if (current && input.onConflict === "ignore") return current;
|
|
7123
|
+
if (current) throw new FirebaseDatabaseConstraintError("bundle_installations.install_id.unique");
|
|
7124
|
+
snapshot.bundleInstallations.set(input.data.install_id, input.data);
|
|
7125
|
+
return input.data;
|
|
7126
|
+
}
|
|
7040
7127
|
case "releases":
|
|
7041
7128
|
requireUnique(snapshot.releases, input.data.id, input.model);
|
|
7042
7129
|
if (!snapshot.channels.has(input.data.channel_id)) throw new FirebaseDatabaseConstraintError("releases.channel_id.foreign-key");
|
|
@@ -7066,6 +7153,16 @@ const createFirebaseDatabaseState = (snapshot) => ({
|
|
|
7066
7153
|
}
|
|
7067
7154
|
},
|
|
7068
7155
|
async update(input) {
|
|
7156
|
+
if (input.model === "bundle_installations") {
|
|
7157
|
+
const current = [...snapshot.bundleInstallations.values()].find((row) => matchesFirebaseDatabaseWhere(row, input.where));
|
|
7158
|
+
if (!current) return null;
|
|
7159
|
+
const updated = {
|
|
7160
|
+
...current,
|
|
7161
|
+
...input.update
|
|
7162
|
+
};
|
|
7163
|
+
snapshot.bundleInstallations.set(current.install_id, updated);
|
|
7164
|
+
return updated;
|
|
7165
|
+
}
|
|
7069
7166
|
if (input.model === "api_keys") {
|
|
7070
7167
|
const current = [...snapshot.apiKeys.values()].find((row) => matchesFirebaseDatabaseWhere(row, input.where));
|
|
7071
7168
|
if (!current) return null;
|
|
@@ -7127,6 +7224,8 @@ const createFirebaseDatabaseState = (snapshot) => ({
|
|
|
7127
7224
|
case "bundles": return distinctCount([...snapshot.bundles.values()].filter((row) => matchesFirebaseDatabaseWhere(row, input.where)), input.distinct);
|
|
7128
7225
|
case "bundle_patches": return distinctCount([...snapshot.bundlePatches.values()].filter((row) => matchesFirebaseDatabaseWhere(row, input.where)), input.distinct);
|
|
7129
7226
|
case "releases": return distinctCount([...snapshot.releases.values()].filter((row) => matchesFirebaseDatabaseWhere(row, input.where)), input.distinct);
|
|
7227
|
+
case "bundle_installations": return distinctCount([...snapshot.bundleInstallations.values()].filter((row) => matchesFirebaseDatabaseWhere(row, input.where)), input.distinct);
|
|
7228
|
+
case "bundle_events": return distinctCount([...snapshot.bundleEvents.values()].filter((row) => matchesFirebaseDatabaseWhere(row, input.where)), input.distinct);
|
|
7130
7229
|
}
|
|
7131
7230
|
},
|
|
7132
7231
|
async findOne(input) {
|
|
@@ -7137,6 +7236,7 @@ const createFirebaseDatabaseState = (snapshot) => ({
|
|
|
7137
7236
|
case "bundle_patches": return [...snapshot.bundlePatches.values()].find((row) => matchesFirebaseDatabaseWhere(row, input.where)) ?? null;
|
|
7138
7237
|
case "releases": return [...snapshot.releases.values()].find((row) => matchesFirebaseDatabaseWhere(row, input.where)) ?? null;
|
|
7139
7238
|
case "release_catalogs": return [...snapshot.releaseCatalogs.values()].find((row) => matchesFirebaseDatabaseWhere(row, input.where)) ?? null;
|
|
7239
|
+
case "bundle_installations": return [...snapshot.bundleInstallations.values()].find((row) => matchesFirebaseDatabaseWhere(row, input.where)) ?? null;
|
|
7140
7240
|
}
|
|
7141
7241
|
},
|
|
7142
7242
|
async findMany(input) {
|
|
@@ -7144,6 +7244,7 @@ const createFirebaseDatabaseState = (snapshot) => ({
|
|
|
7144
7244
|
case "bundles": return queryFirebaseDatabaseRows([...snapshot.bundles.values()], input);
|
|
7145
7245
|
case "bundle_patches": return queryFirebaseDatabaseRows([...snapshot.bundlePatches.values()], input);
|
|
7146
7246
|
case "bundle_events": return queryFirebaseDatabaseRows([...snapshot.bundleEvents.values()], input);
|
|
7247
|
+
case "bundle_installations": return queryFirebaseDatabaseRows([...snapshot.bundleInstallations.values()], input);
|
|
7147
7248
|
case "channels": return queryFirebaseDatabaseRows([...snapshot.channels.values()], input);
|
|
7148
7249
|
case "api_keys": return queryFirebaseDatabaseRows([...snapshot.apiKeys.values()], input);
|
|
7149
7250
|
case "releases": return queryFirebaseDatabaseRows([...snapshot.releases.values()], input);
|
|
@@ -7157,6 +7258,7 @@ const FIREBASE_V1_FUNCTION_NAME = "hot-updater-v1";
|
|
|
7157
7258
|
const FIREBASE_V1_COLLECTION_NAMES = {
|
|
7158
7259
|
apiKeys: "hot_updater_v1_api_keys",
|
|
7159
7260
|
bundleEvents: "hot_updater_v1_bundle_events",
|
|
7261
|
+
bundleInstallations: "hot_updater_v1_bundle_installations",
|
|
7160
7262
|
bundlePatches: "hot_updater_v1_bundle_patches",
|
|
7161
7263
|
bundles: "hot_updater_v1_bundles",
|
|
7162
7264
|
channels: "hot_updater_v1_channels",
|
|
@@ -7167,6 +7269,7 @@ const FIREBASE_V1_COLLECTION_NAMES = {
|
|
|
7167
7269
|
//#endregion
|
|
7168
7270
|
//#region src/firebaseDatabasePersistence.ts
|
|
7169
7271
|
var FirebaseDatabaseAdapterVersionError = class extends Error {
|
|
7272
|
+
version;
|
|
7170
7273
|
name = "FirebaseDatabaseAdapterVersionError";
|
|
7171
7274
|
constructor(version) {
|
|
7172
7275
|
super(`Unsupported Firebase database adapter version: ${String(version)}`);
|
|
@@ -7177,6 +7280,7 @@ const createFirebaseDatabaseCollections = (db) => ({
|
|
|
7177
7280
|
bundles: db.collection(FIREBASE_V1_COLLECTION_NAMES.bundles),
|
|
7178
7281
|
bundlePatches: db.collection(FIREBASE_V1_COLLECTION_NAMES.bundlePatches),
|
|
7179
7282
|
bundleEvents: db.collection(FIREBASE_V1_COLLECTION_NAMES.bundleEvents),
|
|
7283
|
+
bundleInstallations: db.collection(FIREBASE_V1_COLLECTION_NAMES.bundleInstallations),
|
|
7180
7284
|
channels: db.collection(FIREBASE_V1_COLLECTION_NAMES.channels),
|
|
7181
7285
|
apiKeys: db.collection(FIREBASE_V1_COLLECTION_NAMES.apiKeys),
|
|
7182
7286
|
releaseCatalogs: db.collection(FIREBASE_V1_COLLECTION_NAMES.releaseCatalogs),
|
|
@@ -7185,14 +7289,15 @@ const createFirebaseDatabaseCollections = (db) => ({
|
|
|
7185
7289
|
});
|
|
7186
7290
|
const firebaseChannelDocumentId = (name) => `name_${Buffer.from(name, "utf8").toString("base64url")}`;
|
|
7187
7291
|
const firebaseChannelIdDocumentId = (id) => `channel_id_${Buffer.from(id, "utf8").toString("base64url")}`;
|
|
7292
|
+
const firebaseInstallationDocumentId = (id) => `install_${Buffer.from(id, "utf8").toString("base64url")}`;
|
|
7188
7293
|
const requireFirebaseDocumentKey = (model, documentId, row) => {
|
|
7189
|
-
if (documentId !== ("id" in row ? row.id : row.scope_key)) throw new FirebaseDatabaseConstraintError(`${model}.id.document-key`);
|
|
7294
|
+
if (documentId !== (model === "bundle_installations" ? firebaseInstallationDocumentId(row.install_id) : "id" in row ? row.id : row.scope_key)) throw new FirebaseDatabaseConstraintError(`${model}.id.document-key`);
|
|
7190
7295
|
return row;
|
|
7191
7296
|
};
|
|
7192
7297
|
const documentMap = (model, documents) => {
|
|
7193
7298
|
const rows = /* @__PURE__ */ new Map();
|
|
7194
7299
|
for (const { row } of documents) {
|
|
7195
|
-
const key = "id" in row ? row.id : row.scope_key;
|
|
7300
|
+
const key = model === "bundle_installations" ? row.install_id : "id" in row ? row.id : row.scope_key;
|
|
7196
7301
|
if (rows.has(key)) throw new FirebaseDatabaseConstraintError(`${model}.id.unique`);
|
|
7197
7302
|
rows.set(key, row);
|
|
7198
7303
|
}
|
|
@@ -7207,10 +7312,6 @@ const patchMap = (snapshot) => documentMap("bundle_patches", snapshot.docs.map((
|
|
|
7207
7312
|
document,
|
|
7208
7313
|
row: parseFirebasePatchRow(document.data(), `bundle_patches/${document.id}`)
|
|
7209
7314
|
})));
|
|
7210
|
-
const eventMap = (snapshot) => documentMap("bundle_events", snapshot.docs.map((document) => ({
|
|
7211
|
-
document,
|
|
7212
|
-
row: parseFirebaseBundleEventRow(document.data(), `bundle_events/${document.id}`)
|
|
7213
|
-
})));
|
|
7214
7315
|
const channelMap = (snapshot) => {
|
|
7215
7316
|
const rows = /* @__PURE__ */ new Map();
|
|
7216
7317
|
const names = /* @__PURE__ */ new Set();
|
|
@@ -7241,18 +7342,18 @@ const toSnapshot = (documents) => {
|
|
|
7241
7342
|
return {
|
|
7242
7343
|
bundles: bundleMap(documents[0]),
|
|
7243
7344
|
bundlePatches: patchMap(documents[1]),
|
|
7244
|
-
bundleEvents:
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7345
|
+
bundleEvents: /* @__PURE__ */ new Map(),
|
|
7346
|
+
bundleInstallations: /* @__PURE__ */ new Map(),
|
|
7347
|
+
channels: channelMap(documents[2]),
|
|
7348
|
+
apiKeys: apiKeyMap(documents[3]),
|
|
7349
|
+
releases: releaseMap(documents[4]),
|
|
7350
|
+
releaseCatalogs: releaseCatalogMap(documents[5])
|
|
7249
7351
|
};
|
|
7250
7352
|
};
|
|
7251
7353
|
const loadFirebaseDatabaseSnapshot = async (collections) => {
|
|
7252
|
-
const [bundles, patches,
|
|
7354
|
+
const [bundles, patches, channels, apiKeys, releases, releaseCatalogs] = await Promise.all([
|
|
7253
7355
|
collections.bundles.get(),
|
|
7254
7356
|
collections.bundlePatches.get(),
|
|
7255
|
-
collections.bundleEvents.get(),
|
|
7256
7357
|
collections.channels.get(),
|
|
7257
7358
|
collections.apiKeys.get(),
|
|
7258
7359
|
collections.releases.get(),
|
|
@@ -7261,7 +7362,6 @@ const loadFirebaseDatabaseSnapshot = async (collections) => {
|
|
|
7261
7362
|
return toSnapshot([
|
|
7262
7363
|
bundles,
|
|
7263
7364
|
patches,
|
|
7264
|
-
events,
|
|
7265
7365
|
channels,
|
|
7266
7366
|
apiKeys,
|
|
7267
7367
|
releases,
|
|
@@ -7269,10 +7369,9 @@ const loadFirebaseDatabaseSnapshot = async (collections) => {
|
|
|
7269
7369
|
]);
|
|
7270
7370
|
};
|
|
7271
7371
|
const loadFirebaseTransactionSnapshot = async (transaction, collections) => {
|
|
7272
|
-
const [bundles, patches,
|
|
7372
|
+
const [bundles, patches, channels, apiKeys, releases, releaseCatalogs] = await Promise.all([
|
|
7273
7373
|
transaction.get(collections.bundles),
|
|
7274
7374
|
transaction.get(collections.bundlePatches),
|
|
7275
|
-
transaction.get(collections.bundleEvents),
|
|
7276
7375
|
transaction.get(collections.channels),
|
|
7277
7376
|
transaction.get(collections.apiKeys),
|
|
7278
7377
|
transaction.get(collections.releases),
|
|
@@ -7281,7 +7380,6 @@ const loadFirebaseTransactionSnapshot = async (transaction, collections) => {
|
|
|
7281
7380
|
return toSnapshot([
|
|
7282
7381
|
bundles,
|
|
7283
7382
|
patches,
|
|
7284
|
-
events,
|
|
7285
7383
|
channels,
|
|
7286
7384
|
apiKeys,
|
|
7287
7385
|
releases,
|
|
@@ -7307,13 +7405,6 @@ const persistFirebaseDatabaseSnapshot = ({ transaction, collections, before, aft
|
|
|
7307
7405
|
after: after.bundlePatches,
|
|
7308
7406
|
documentId: (row) => row.id
|
|
7309
7407
|
});
|
|
7310
|
-
persistCollection({
|
|
7311
|
-
transaction,
|
|
7312
|
-
collection: collections.bundleEvents,
|
|
7313
|
-
before: before.bundleEvents,
|
|
7314
|
-
after: after.bundleEvents,
|
|
7315
|
-
documentId: (row) => row.id
|
|
7316
|
-
});
|
|
7317
7408
|
persistCollection({
|
|
7318
7409
|
transaction,
|
|
7319
7410
|
collection: collections.channels,
|
|
@@ -7345,7 +7436,7 @@ const persistFirebaseDatabaseSnapshot = ({ transaction, collections, before, aft
|
|
|
7345
7436
|
documentId: (row) => row.scope_key
|
|
7346
7437
|
});
|
|
7347
7438
|
};
|
|
7348
|
-
const migrateFirebaseDatabase = async (
|
|
7439
|
+
const migrateFirebaseDatabase = async (collections) => {
|
|
7349
7440
|
const versionDocument = collections.settings.doc("database_adapter_version");
|
|
7350
7441
|
const version = await versionDocument.get();
|
|
7351
7442
|
const adapterVersion = version.data()?.version;
|
|
@@ -7356,7 +7447,9 @@ const migrateFirebaseDatabase = async (_db, collections) => {
|
|
|
7356
7447
|
collections.bundlePatches.limit(1).get(),
|
|
7357
7448
|
collections.channels.limit(1).get(),
|
|
7358
7449
|
collections.releases.limit(1).get(),
|
|
7359
|
-
collections.releaseCatalogs.limit(1).get()
|
|
7450
|
+
collections.releaseCatalogs.limit(1).get(),
|
|
7451
|
+
collections.bundleInstallations.limit(1).get(),
|
|
7452
|
+
collections.bundleEvents.limit(1).get()
|
|
7360
7453
|
])).some((snapshot) => !snapshot.empty)) throw new FirebaseDatabaseAdapterVersionError("v0");
|
|
7361
7454
|
try {
|
|
7362
7455
|
await versionDocument.create({ version: 4 });
|
|
@@ -7371,13 +7464,40 @@ const exactId = (input) => {
|
|
|
7371
7464
|
const [condition] = input.where;
|
|
7372
7465
|
return condition.field === "id" && (condition.operator === void 0 || condition.operator === "eq") && typeof condition.value === "string" ? condition.value : void 0;
|
|
7373
7466
|
};
|
|
7467
|
+
const exactInstallId = (input) => {
|
|
7468
|
+
const condition = input.where?.find(({ field, operator }) => field === "install_id" && (operator === void 0 || operator === "eq"));
|
|
7469
|
+
return typeof condition?.value === "string" ? condition.value : void 0;
|
|
7470
|
+
};
|
|
7471
|
+
const firestoreOperator = (operator) => {
|
|
7472
|
+
switch (operator ?? "eq") {
|
|
7473
|
+
case "eq": return "==";
|
|
7474
|
+
case "ne": return "!=";
|
|
7475
|
+
case "gt": return ">";
|
|
7476
|
+
case "gte": return ">=";
|
|
7477
|
+
case "lt": return "<";
|
|
7478
|
+
case "lte": return "<=";
|
|
7479
|
+
case "in": return "in";
|
|
7480
|
+
case "not_in": return "not-in";
|
|
7481
|
+
default: return;
|
|
7482
|
+
}
|
|
7483
|
+
};
|
|
7484
|
+
const applyFirebaseWhere = (initial, where) => {
|
|
7485
|
+
let query = initial;
|
|
7486
|
+
for (const condition of where) {
|
|
7487
|
+
const operator = firestoreOperator(condition.operator);
|
|
7488
|
+
if (condition.connector === "OR" || operator === void 0) throw new FirebaseDatabaseConstraintError("query.unsupported");
|
|
7489
|
+
query = query.where(condition.field, operator, condition.value);
|
|
7490
|
+
}
|
|
7491
|
+
return query;
|
|
7492
|
+
};
|
|
7374
7493
|
const firebaseDatabase = (config) => {
|
|
7375
|
-
const
|
|
7376
|
-
const
|
|
7494
|
+
const implementation = (() => {
|
|
7495
|
+
const app = (0, firebase_admin_app.getApps)().length ? (0, firebase_admin_app.getApp)() : (0, firebase_admin_app.initializeApp)(config);
|
|
7496
|
+
const db = (0, firebase_admin_firestore.getFirestore)(app);
|
|
7377
7497
|
const collections = createFirebaseDatabaseCollections(db);
|
|
7378
7498
|
let migration;
|
|
7379
7499
|
const ensureMigrated = () => {
|
|
7380
|
-
migration ??= migrateFirebaseDatabase(
|
|
7500
|
+
migration ??= migrateFirebaseDatabase(collections).catch((error) => {
|
|
7381
7501
|
migration = void 0;
|
|
7382
7502
|
throw error;
|
|
7383
7503
|
});
|
|
@@ -7400,14 +7520,74 @@ const firebaseDatabase = (config) => {
|
|
|
7400
7520
|
};
|
|
7401
7521
|
const read = async (operation) => {
|
|
7402
7522
|
await ensureMigrated();
|
|
7403
|
-
|
|
7523
|
+
const snapshot = await loadFirebaseDatabaseSnapshot(collections);
|
|
7524
|
+
return operation(createFirebaseDatabaseState(snapshot));
|
|
7404
7525
|
};
|
|
7405
7526
|
return {
|
|
7406
|
-
|
|
7407
|
-
|
|
7527
|
+
recordInsights: async ({ event, installation }) => {
|
|
7528
|
+
await ensureMigrated();
|
|
7529
|
+
await db.runTransaction(async (transaction) => {
|
|
7530
|
+
const eventReference = collections.bundleEvents.doc(event.id);
|
|
7531
|
+
const installationReference = collections.bundleInstallations.doc(firebaseInstallationDocumentId(installation.install_id));
|
|
7532
|
+
const [storedEvent, storedInstallation] = await transaction.getAll(eventReference, installationReference);
|
|
7533
|
+
if (storedEvent.exists) return;
|
|
7534
|
+
const current = storedInstallation.exists ? requireFirebaseDocumentKey("bundle_installations", storedInstallation.id, parseFirebaseInsightsInstallationRow(storedInstallation.data(), `bundle_installations/${storedInstallation.id}`)) : null;
|
|
7535
|
+
transaction.create(eventReference, event);
|
|
7536
|
+
if (current === null || installation.received_at_ms > current.received_at_ms || installation.received_at_ms === current.received_at_ms && (0, _hot_updater_plugin_core.compareInsightsText)(installation.id, current.id) > 0) transaction.set(installationReference, installation);
|
|
7537
|
+
});
|
|
7538
|
+
},
|
|
7539
|
+
create: async (input) => {
|
|
7540
|
+
if (input.model !== "bundle_events" && input.model !== "bundle_installations") return mutate((database) => database.create(input));
|
|
7541
|
+
await ensureMigrated();
|
|
7542
|
+
return db.runTransaction(async (transaction) => {
|
|
7543
|
+
const collection = input.model === "bundle_events" ? collections.bundleEvents : collections.bundleInstallations;
|
|
7544
|
+
const documentId = input.model === "bundle_events" ? input.data.id : firebaseInstallationDocumentId(input.data.install_id);
|
|
7545
|
+
const reference = collection.doc(documentId);
|
|
7546
|
+
const document = await transaction.get(reference);
|
|
7547
|
+
if (document.exists) {
|
|
7548
|
+
const row = input.model === "bundle_events" ? requireFirebaseDocumentKey("bundle_events", document.id, parseFirebaseBundleEventRow(document.data(), `bundle_events/${document.id}`)) : requireFirebaseDocumentKey("bundle_installations", document.id, parseFirebaseInsightsInstallationRow(document.data(), `bundle_installations/${document.id}`));
|
|
7549
|
+
if (input.onConflict === "ignore") return row;
|
|
7550
|
+
throw new FirebaseDatabaseConstraintError(`${input.model}.id.unique`);
|
|
7551
|
+
}
|
|
7552
|
+
transaction.create(reference, input.data);
|
|
7553
|
+
return input.data;
|
|
7554
|
+
});
|
|
7555
|
+
},
|
|
7556
|
+
update: async (input) => {
|
|
7557
|
+
if (input.model !== "bundle_installations") return mutate((database) => database.update(input));
|
|
7558
|
+
const installId = exactInstallId(input);
|
|
7559
|
+
if (installId === void 0) return mutate((database) => database.update(input));
|
|
7560
|
+
await ensureMigrated();
|
|
7561
|
+
return db.runTransaction(async (transaction) => {
|
|
7562
|
+
const reference = collections.bundleInstallations.doc(firebaseInstallationDocumentId(installId));
|
|
7563
|
+
const document = await transaction.get(reference);
|
|
7564
|
+
if (!document.exists) return null;
|
|
7565
|
+
const current = requireFirebaseDocumentKey("bundle_installations", document.id, parseFirebaseInsightsInstallationRow(document.data(), `bundle_installations/${document.id}`));
|
|
7566
|
+
if (!matchesFirebaseDatabaseWhere(current, input.where)) return null;
|
|
7567
|
+
const updated = {
|
|
7568
|
+
...current,
|
|
7569
|
+
...input.update
|
|
7570
|
+
};
|
|
7571
|
+
transaction.set(reference, updated, { merge: true });
|
|
7572
|
+
return updated;
|
|
7573
|
+
});
|
|
7574
|
+
},
|
|
7408
7575
|
delete: (input) => mutate((database) => database.delete(input)),
|
|
7409
|
-
count: (input) =>
|
|
7576
|
+
count: async (input) => {
|
|
7577
|
+
if (input.model !== "bundle_installations" && input.model !== "bundle_events") return read((database) => database.count(input));
|
|
7578
|
+
await ensureMigrated();
|
|
7579
|
+
let query = applyFirebaseWhere(input.model === "bundle_events" ? collections.bundleEvents : collections.bundleInstallations, input.where ?? []);
|
|
7580
|
+
if (input.model === "bundle_events") query = query.orderBy("received_at_ms", "desc").orderBy("id", "desc");
|
|
7581
|
+
return (await query.count().get()).data().count;
|
|
7582
|
+
},
|
|
7410
7583
|
findOne: async (input) => {
|
|
7584
|
+
if (input.model === "bundle_installations") {
|
|
7585
|
+
const installId = exactInstallId(input);
|
|
7586
|
+
if (installId === void 0) return read((database) => database.findOne(input));
|
|
7587
|
+
await ensureMigrated();
|
|
7588
|
+
const document = await collections.bundleInstallations.doc(firebaseInstallationDocumentId(installId)).get();
|
|
7589
|
+
return document.exists ? requireFirebaseDocumentKey("bundle_installations", document.id, parseFirebaseInsightsInstallationRow(document.data(), `bundle_installations/${document.id}`)) : null;
|
|
7590
|
+
}
|
|
7411
7591
|
const id = exactId(input);
|
|
7412
7592
|
if (id === void 0) return read((database) => database.findOne(input));
|
|
7413
7593
|
await ensureMigrated();
|
|
@@ -7428,9 +7608,21 @@ const firebaseDatabase = (config) => {
|
|
|
7428
7608
|
}
|
|
7429
7609
|
},
|
|
7430
7610
|
findMany: async (input) => {
|
|
7431
|
-
if (input.model
|
|
7432
|
-
|
|
7433
|
-
|
|
7611
|
+
if (input.model === "bundle_events" || input.model === "bundle_installations") {
|
|
7612
|
+
await ensureMigrated();
|
|
7613
|
+
const collection = input.model === "bundle_events" ? collections.bundleEvents : collections.bundleInstallations;
|
|
7614
|
+
let query = applyFirebaseWhere(collection, input.where ?? []);
|
|
7615
|
+
for (const order of input.orderBy ?? []) {
|
|
7616
|
+
if (order.nulls !== void 0) throw new FirebaseDatabaseConstraintError("query.unsupported");
|
|
7617
|
+
query = query.orderBy(order.field, order.direction);
|
|
7618
|
+
}
|
|
7619
|
+
return (await query.offset(input.offset).limit(input.limit).get()).docs.map((document) => input.model === "bundle_events" ? requireFirebaseDocumentKey("bundle_events", document.id, parseFirebaseBundleEventRow(document.data(), `bundle_events/${document.id}`)) : requireFirebaseDocumentKey("bundle_installations", document.id, parseFirebaseInsightsInstallationRow(document.data(), `bundle_installations/${document.id}`)));
|
|
7620
|
+
}
|
|
7621
|
+
if (input.model === "channels") {
|
|
7622
|
+
await ensureMigrated();
|
|
7623
|
+
return queryFirebaseDatabaseRows(await loadFirebaseChannels(collections), input);
|
|
7624
|
+
}
|
|
7625
|
+
return read((database) => database.findMany(input));
|
|
7434
7626
|
},
|
|
7435
7627
|
insertChannel: async (input) => {
|
|
7436
7628
|
await ensureMigrated();
|
|
@@ -7482,7 +7674,8 @@ const firebaseDatabase = (config) => {
|
|
|
7482
7674
|
},
|
|
7483
7675
|
transaction: (callback) => mutate(callback)
|
|
7484
7676
|
};
|
|
7485
|
-
})()
|
|
7677
|
+
})();
|
|
7678
|
+
const adapter = (0, _hot_updater_plugin_core_internal.createDatabasePluginAdapter)("firebaseDatabase", implementation);
|
|
7486
7679
|
return (0, _hot_updater_plugin_core.createDatabasePlugin)({
|
|
7487
7680
|
name: "firebaseDatabase",
|
|
7488
7681
|
models: adapter.models,
|
|
@@ -7550,8 +7743,9 @@ const resolveFirebaseInfrastructureState = ({ adapterVersion, hasData }) => {
|
|
|
7550
7743
|
return "fresh";
|
|
7551
7744
|
};
|
|
7552
7745
|
const assertFirebaseInfrastructureCanInitialize = async ({ applicationCredentials, projectId }) => {
|
|
7746
|
+
const credential = applicationCredentials ? (0, firebase_admin_app.cert)(JSON.parse(await fs_promises.default.readFile(applicationCredentials, "utf8"))) : (0, firebase_admin_app.applicationDefault)();
|
|
7553
7747
|
const app = (0, firebase_admin_app.initializeApp)({
|
|
7554
|
-
credential
|
|
7748
|
+
credential,
|
|
7555
7749
|
projectId
|
|
7556
7750
|
}, `hot-updater-init-${projectId}-${Date.now()}`);
|
|
7557
7751
|
try {
|
|
@@ -7810,10 +8004,11 @@ const getConfigScaffold = (build) => {
|
|
|
7810
8004
|
// Example: GOOGLE_APPLICATION_CREDENTIALS=./firebase-adminsdk-credentials.json
|
|
7811
8005
|
const credential = applicationDefault();`.trim()
|
|
7812
8006
|
}];
|
|
7813
|
-
|
|
8007
|
+
const builder = new _hot_updater_cli_tools.ConfigBuilder().setBuildType(build).setStorage(storageConfig).setDatabase(databaseConfig).addImport({
|
|
7814
8008
|
pkg: "firebase-admin/app",
|
|
7815
8009
|
named: ["applicationDefault"]
|
|
7816
|
-
}).setIntermediateCode(helperStatements.map((statement) => statement.code.trim()).join("\n\n"))
|
|
8010
|
+
}).setIntermediateCode(helperStatements.map((statement) => statement.code.trim()).join("\n\n"));
|
|
8011
|
+
return (0, _hot_updater_cli_tools.createHotUpdaterConfigScaffoldFromBuilder)(builder, { helperStatements });
|
|
7817
8012
|
};
|
|
7818
8013
|
const setEnv = async ({ applicationCredentials, projectId, storageBucket, build, region }) => {
|
|
7819
8014
|
await (0, _hot_updater_cli_tools.makeEnv)({
|
|
@@ -7976,6 +8171,10 @@ const initFirebaseUser = async (cwd, preferredProjectId, nonInteractive = false,
|
|
|
7976
8171
|
"--format=json"
|
|
7977
8172
|
], {
|
|
7978
8173
|
env: selectedProjectCliEnv,
|
|
8174
|
+
/**
|
|
8175
|
+
* API [firestore.googleapis.com] not enabled on project [xxx]. Would you
|
|
8176
|
+
like to enable and retry (this will take a few minutes)? (y/N)?
|
|
8177
|
+
*/
|
|
7979
8178
|
input: "N\n"
|
|
7980
8179
|
});
|
|
7981
8180
|
if (JSON.parse(databases.stdout).length === 0) {
|
|
@@ -8262,7 +8461,8 @@ const runInit = async ({ build, envFile }) => {
|
|
|
8262
8461
|
_hot_updater_cli_tools.p.log.step((0, _hot_updater_cli_tools.link)("https://cloud.google.com/sdk/docs/install"));
|
|
8263
8462
|
process.exit(1);
|
|
8264
8463
|
}
|
|
8265
|
-
const
|
|
8464
|
+
const firebaseRootDir = path.default.dirname(path.default.dirname(require.resolve("@hot-updater/firebase/functions")));
|
|
8465
|
+
const { tmpDir, removeTmpDir, functionsDir } = await prepareFirebaseTemplate(firebaseRootDir);
|
|
8266
8466
|
const functionsIndexPath = path.default.join(functionsDir, "index.cjs");
|
|
8267
8467
|
const runtimePackageInfo = await syncFunctionsPackageJson(functionsDir);
|
|
8268
8468
|
const initializeVariable = await initFirebaseUser(tmpDir, savedInputs.projectId, nonInteractive, cliEnv, async (projectId) => {
|
|
@@ -8294,13 +8494,14 @@ const runInit = async ({ build, envFile }) => {
|
|
|
8294
8494
|
projectId: initializeVariable.projectId,
|
|
8295
8495
|
region: currentRegion
|
|
8296
8496
|
};
|
|
8497
|
+
const persistCredentialInputs = await (0, _hot_updater_cli_tools.confirmInitInputPersistence)({
|
|
8498
|
+
existingEnv: managedEnv,
|
|
8499
|
+
inputs: resolvedInputs,
|
|
8500
|
+
nonInteractive,
|
|
8501
|
+
provider: initProvider
|
|
8502
|
+
});
|
|
8297
8503
|
const persistedInputs = (0, _hot_updater_cli_tools.getInitProviderEnvVars)({
|
|
8298
|
-
includeConsentInputs:
|
|
8299
|
-
existingEnv: managedEnv,
|
|
8300
|
-
inputs: resolvedInputs,
|
|
8301
|
-
nonInteractive,
|
|
8302
|
-
provider: initProvider
|
|
8303
|
-
}),
|
|
8504
|
+
includeConsentInputs: persistCredentialInputs,
|
|
8304
8505
|
inputs: resolvedInputs,
|
|
8305
8506
|
provider: initProvider
|
|
8306
8507
|
});
|