@wix/himalaya-cli 0.1853.0 → 0.1855.0
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/cli.mjs +1010 -681
- package/guides/iap-products.md +4 -0
- package/guides/one-app-section-mappings.md +1 -1
- package/guides/one-app-to-himi-app.md +10 -7
- package/guides/push-cli-onboarding.md +20 -0
- package/package.json +2 -2
- package/templates/branded-lite/tier5-src/_shared/announcement-section.ts +6 -14
- package/templates/branded-lite/tier5-src/_shared/draft-content.ts +66 -0
- package/templates/branded-lite/tier5-src/_shared/galleries-section.ts +52 -23
package/dist/cli.mjs
CHANGED
|
@@ -13560,10 +13560,10 @@ var init_preview = __esm({
|
|
|
13560
13560
|
}
|
|
13561
13561
|
},
|
|
13562
13562
|
kill: (pid, signal) => process.kill(pid, signal),
|
|
13563
|
-
portFree: (port) => new Promise((
|
|
13563
|
+
portFree: (port) => new Promise((resolve135) => {
|
|
13564
13564
|
const s5 = createServer();
|
|
13565
|
-
s5.once("error", () =>
|
|
13566
|
-
s5.listen(port, "127.0.0.1", () => s5.close(() =>
|
|
13565
|
+
s5.once("error", () => resolve135(false));
|
|
13566
|
+
s5.listen(port, "127.0.0.1", () => s5.close(() => resolve135(true)));
|
|
13567
13567
|
}),
|
|
13568
13568
|
sleep: (ms2) => new Promise((r3) => setTimeout(r3, ms2)),
|
|
13569
13569
|
servingIdentity: async (origin) => {
|
|
@@ -23100,11 +23100,11 @@ async function bootBundleWorker(bundleJs, opts) {
|
|
|
23100
23100
|
}
|
|
23101
23101
|
message5 = typeof asJson2 === "string" ? asJson2 : String(raw);
|
|
23102
23102
|
} else message5 = String(raw);
|
|
23103
|
-
const
|
|
23104
|
-
if (prev.status === "loading")
|
|
23105
|
-
if (prev.loading === true)
|
|
23106
|
-
if (typeof prev.error === "string")
|
|
23107
|
-
def2.state =
|
|
23103
|
+
const failed2 = { ...prev, _error: message5 };
|
|
23104
|
+
if (prev.status === "loading") failed2.status = "error";
|
|
23105
|
+
if (prev.loading === true) failed2.loading = false;
|
|
23106
|
+
if (typeof prev.error === "string") failed2.error = message5;
|
|
23107
|
+
def2.state = failed2;
|
|
23108
23108
|
};
|
|
23109
23109
|
const runAction = async (def2, label4, fn2, args) => {
|
|
23110
23110
|
let timer;
|
|
@@ -28160,7 +28160,7 @@ function createQuickJsWorkerRealm(options2 = {}) {
|
|
|
28160
28160
|
const w2 = ensureWorker();
|
|
28161
28161
|
const id = nextId++;
|
|
28162
28162
|
const himalaya = sandbox.himalaya;
|
|
28163
|
-
return new Promise((
|
|
28163
|
+
return new Promise((resolve135, reject) => {
|
|
28164
28164
|
const onMessage = async (msg) => {
|
|
28165
28165
|
if (msg.want) {
|
|
28166
28166
|
await handleWant(msg.want, opts, "boot");
|
|
@@ -28220,7 +28220,7 @@ function createQuickJsWorkerRealm(options2 = {}) {
|
|
|
28220
28220
|
}
|
|
28221
28221
|
};
|
|
28222
28222
|
}
|
|
28223
|
-
|
|
28223
|
+
resolve135(result);
|
|
28224
28224
|
};
|
|
28225
28225
|
failInFlight = (e2) => {
|
|
28226
28226
|
w2.off("message", onMessage);
|
|
@@ -28266,7 +28266,7 @@ function createQuickJsWorkerRealm(options2 = {}) {
|
|
|
28266
28266
|
}
|
|
28267
28267
|
async function runDispatch(w2, sessionId, service, action, argsJson, timeoutMs, opts, online) {
|
|
28268
28268
|
const id = nextId++;
|
|
28269
|
-
return new Promise((
|
|
28269
|
+
return new Promise((resolve135, reject) => {
|
|
28270
28270
|
const onMessage = async (msg) => {
|
|
28271
28271
|
if (msg.want) {
|
|
28272
28272
|
await handleWant(msg.want, opts, "dispatch");
|
|
@@ -28280,7 +28280,7 @@ function createQuickJsWorkerRealm(options2 = {}) {
|
|
|
28280
28280
|
return;
|
|
28281
28281
|
}
|
|
28282
28282
|
try {
|
|
28283
|
-
|
|
28283
|
+
resolve135(msg.actions ? parseWithNonFinite(msg.actions) : []);
|
|
28284
28284
|
} catch (e2) {
|
|
28285
28285
|
reject(new Error(`the guest dispatch results were unreadable: ${e2?.message ?? String(e2)}`));
|
|
28286
28286
|
}
|
|
@@ -28306,13 +28306,13 @@ function createQuickJsWorkerRealm(options2 = {}) {
|
|
|
28306
28306
|
async warm() {
|
|
28307
28307
|
const w2 = ensureWorker();
|
|
28308
28308
|
const id = nextId++;
|
|
28309
|
-
await new Promise((
|
|
28309
|
+
await new Promise((resolve135, reject) => {
|
|
28310
28310
|
const onMessage = (msg) => {
|
|
28311
28311
|
if (msg.id !== id) return;
|
|
28312
28312
|
w2.off("message", onMessage);
|
|
28313
28313
|
failInFlight = null;
|
|
28314
28314
|
if (msg.error) reject(new Error(msg.error));
|
|
28315
|
-
else
|
|
28315
|
+
else resolve135();
|
|
28316
28316
|
};
|
|
28317
28317
|
failInFlight = (e2) => {
|
|
28318
28318
|
w2.off("message", onMessage);
|
|
@@ -29675,7 +29675,7 @@ function literalTargets(bundleJs, ts34) {
|
|
|
29675
29675
|
ts34.forEachChild(node3, declarations);
|
|
29676
29676
|
};
|
|
29677
29677
|
declarations(file2);
|
|
29678
|
-
const
|
|
29678
|
+
const resolve135 = (node3) => {
|
|
29679
29679
|
if (callable(node3)) return node3;
|
|
29680
29680
|
if (node3 && ts34.isIdentifier(node3)) {
|
|
29681
29681
|
const symbol = symbols.get(node3.text);
|
|
@@ -29789,7 +29789,7 @@ function literalTargets(bundleJs, ts34) {
|
|
|
29789
29789
|
const actions = object16(initializer(property3(object16(node3.arguments[1]), "actions")));
|
|
29790
29790
|
for (const member of actions?.properties ?? []) {
|
|
29791
29791
|
const action = name(member.name);
|
|
29792
|
-
const fn2 = ts34.isMethodDeclaration(member) ? member :
|
|
29792
|
+
const fn2 = ts34.isMethodDeclaration(member) ? member : resolve135(ts34.isShorthandPropertyAssignment(member) ? member.name : initializer(member));
|
|
29793
29793
|
if (!action || !fn2?.body) continue;
|
|
29794
29794
|
const targets = [];
|
|
29795
29795
|
const target = (expr) => {
|
|
@@ -41156,9 +41156,9 @@ async function offRepoFontBytes(plan, opts = {}) {
|
|
|
41156
41156
|
out2.hostProvided.push(r3.family);
|
|
41157
41157
|
continue;
|
|
41158
41158
|
}
|
|
41159
|
-
const
|
|
41160
|
-
if (
|
|
41161
|
-
out2.unavailable.push({ family: r3.family, reason:
|
|
41159
|
+
const failed2 = r3.faces.find((f2) => !f2.got.ok);
|
|
41160
|
+
if (failed2 && !failed2.got.ok) {
|
|
41161
|
+
out2.unavailable.push({ family: r3.family, reason: failed2.got.reason });
|
|
41162
41162
|
continue;
|
|
41163
41163
|
}
|
|
41164
41164
|
out2.ready.push({
|
|
@@ -41847,7 +41847,7 @@ async function injectRequest(listener, request2) {
|
|
|
41847
41847
|
req.headers.host ??= url.host;
|
|
41848
41848
|
if (body && body.length > 0) req.push(body);
|
|
41849
41849
|
req.push(null);
|
|
41850
|
-
return await new Promise((
|
|
41850
|
+
return await new Promise((resolve135, reject) => {
|
|
41851
41851
|
const streamed = () => {
|
|
41852
41852
|
queueMicrotask(() => {
|
|
41853
41853
|
req.emit("close");
|
|
@@ -41863,7 +41863,7 @@ async function injectRequest(listener, request2) {
|
|
|
41863
41863
|
else headers2.set(name, value2);
|
|
41864
41864
|
}
|
|
41865
41865
|
const bodyless = out2.status === 204 || out2.status === 304 || request2.method === "HEAD";
|
|
41866
|
-
|
|
41866
|
+
resolve135(new Response(bodyless ? null : out2.body, { status: out2.status, headers: headers2 }));
|
|
41867
41867
|
}, streamed);
|
|
41868
41868
|
res.on("inject-error", reject);
|
|
41869
41869
|
try {
|
|
@@ -46187,12 +46187,12 @@ function finalizeRecording(key4, rec) {
|
|
|
46187
46187
|
if (rec.finalize) return rec.finalize;
|
|
46188
46188
|
rec.finalize = (async () => {
|
|
46189
46189
|
clearTimeout(rec.autoStop);
|
|
46190
|
-
await new Promise((
|
|
46190
|
+
await new Promise((resolve135) => {
|
|
46191
46191
|
let done = false;
|
|
46192
46192
|
const finish3 = () => {
|
|
46193
46193
|
if (!done) {
|
|
46194
46194
|
done = true;
|
|
46195
|
-
|
|
46195
|
+
resolve135();
|
|
46196
46196
|
}
|
|
46197
46197
|
};
|
|
46198
46198
|
rec.child.once("close", finish3);
|
|
@@ -46304,7 +46304,7 @@ var init_preview2 = __esm({
|
|
|
46304
46304
|
DEVICE_LIST_TIMEOUT_MS = 5e3;
|
|
46305
46305
|
defaultRunner = {
|
|
46306
46306
|
capture(cmd, args, timeoutMs = DEFAULT_CAPTURE_TIMEOUT_MS) {
|
|
46307
|
-
return new Promise((
|
|
46307
|
+
return new Promise((resolve135, reject) => {
|
|
46308
46308
|
const child3 = spawn2(cmd, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
46309
46309
|
const out2 = [];
|
|
46310
46310
|
const err = [];
|
|
@@ -46326,7 +46326,7 @@ var init_preview2 = __esm({
|
|
|
46326
46326
|
child3.stderr.on("data", (b3) => err.push(b3));
|
|
46327
46327
|
child3.on("error", (e2) => settle3(reject, e2));
|
|
46328
46328
|
child3.on("close", (code3) => {
|
|
46329
|
-
if (code3 === 0) settle3(
|
|
46329
|
+
if (code3 === 0) settle3(resolve135, Buffer.concat(out2));
|
|
46330
46330
|
else settle3(reject, new Error(`${cmd} exited ${code3}: ${Buffer.concat(err).toString("utf8")}`));
|
|
46331
46331
|
});
|
|
46332
46332
|
});
|
|
@@ -48093,10 +48093,10 @@ function ImagePreviewScope({ node: node3, ctx, render: render3 }) {
|
|
|
48093
48093
|
if (!item2) return null;
|
|
48094
48094
|
for (let attempt2 = 0; attempt2 < 3; attempt2++) {
|
|
48095
48095
|
for (const step of item2.revealSteps ?? []) collections2.current.get(imagePreviewPresentationKey(step.id, step.rows))?.(step.index);
|
|
48096
|
-
await new Promise((
|
|
48096
|
+
await new Promise((resolve135) => {
|
|
48097
48097
|
const view = root.ownerDocument.defaultView;
|
|
48098
|
-
if (view?.requestAnimationFrame) view.requestAnimationFrame(() =>
|
|
48099
|
-
else setTimeout(
|
|
48098
|
+
if (view?.requestAnimationFrame) view.requestAnimationFrame(() => resolve135());
|
|
48099
|
+
else setTimeout(resolve135, 0);
|
|
48100
48100
|
});
|
|
48101
48101
|
const tile = find2(position);
|
|
48102
48102
|
if (tile) {
|
|
@@ -48184,18 +48184,18 @@ function installImageNetworkReturns(doc = typeof document === "undefined" ? void
|
|
|
48184
48184
|
const view = doc?.defaultView;
|
|
48185
48185
|
if (!doc || !view || installed.has(doc)) return;
|
|
48186
48186
|
installed.add(doc);
|
|
48187
|
-
const
|
|
48187
|
+
const failed2 = /* @__PURE__ */ new WeakSet();
|
|
48188
48188
|
const tries = /* @__PURE__ */ new WeakMap();
|
|
48189
48189
|
let wasOffline = view.navigator?.onLine === false;
|
|
48190
48190
|
let timer;
|
|
48191
48191
|
const image = (event) => event.target instanceof view.HTMLImageElement ? event.target : void 0;
|
|
48192
48192
|
doc.addEventListener("error", (event) => {
|
|
48193
48193
|
const img = image(event);
|
|
48194
|
-
if (img)
|
|
48194
|
+
if (img) failed2.add(img);
|
|
48195
48195
|
}, true);
|
|
48196
48196
|
doc.addEventListener("load", (event) => {
|
|
48197
48197
|
const img = image(event);
|
|
48198
|
-
if (img)
|
|
48198
|
+
if (img) failed2.delete(img);
|
|
48199
48199
|
}, true);
|
|
48200
48200
|
const stop2 = () => {
|
|
48201
48201
|
if (timer !== void 0) view.clearTimeout(timer);
|
|
@@ -48216,8 +48216,8 @@ function installImageNetworkReturns(doc = typeof document === "undefined" ? void
|
|
|
48216
48216
|
function wake() {
|
|
48217
48217
|
view.dispatchEvent(new view.Event(RETURNED));
|
|
48218
48218
|
for (const img of Array.from(doc.querySelectorAll("img"))) {
|
|
48219
|
-
if (!
|
|
48220
|
-
|
|
48219
|
+
if (!failed2.has(img)) continue;
|
|
48220
|
+
failed2.delete(img);
|
|
48221
48221
|
const source2 = img.getAttribute("src") ?? "";
|
|
48222
48222
|
const tried = tries.get(img);
|
|
48223
48223
|
const count3 = tried?.source === source2 ? tried.count : 0;
|
|
@@ -48229,23 +48229,23 @@ function installImageNetworkReturns(doc = typeof document === "undefined" ? void
|
|
|
48229
48229
|
}
|
|
48230
48230
|
}
|
|
48231
48231
|
}
|
|
48232
|
-
function useReloadOnNetworkReturn(
|
|
48232
|
+
function useReloadOnNetworkReturn(failed2, reload) {
|
|
48233
48233
|
const latest = React3.useRef(reload);
|
|
48234
48234
|
latest.current = reload;
|
|
48235
48235
|
const tries = React3.useRef();
|
|
48236
48236
|
React3.useEffect(() => {
|
|
48237
48237
|
const view = typeof window === "undefined" ? void 0 : window;
|
|
48238
|
-
if (!
|
|
48238
|
+
if (!failed2 || !view) return;
|
|
48239
48239
|
installImageNetworkReturns(view.document);
|
|
48240
48240
|
const returned = () => {
|
|
48241
|
-
const count3 = tries.current?.source ===
|
|
48241
|
+
const count3 = tries.current?.source === failed2 ? tries.current.count : 0;
|
|
48242
48242
|
if (count3 >= LIMIT) return;
|
|
48243
|
-
tries.current = { source:
|
|
48243
|
+
tries.current = { source: failed2, count: count3 + 1 };
|
|
48244
48244
|
latest.current();
|
|
48245
48245
|
};
|
|
48246
48246
|
view.addEventListener(RETURNED, returned);
|
|
48247
48247
|
return () => view.removeEventListener(RETURNED, returned);
|
|
48248
|
-
}, [
|
|
48248
|
+
}, [failed2]);
|
|
48249
48249
|
}
|
|
48250
48250
|
var LIMIT, RETURNED, installed;
|
|
48251
48251
|
var init_image_network_returns = __esm({
|
|
@@ -48304,8 +48304,8 @@ function useImageSource(url, box) {
|
|
|
48304
48304
|
React4.useEffect(() => {
|
|
48305
48305
|
if (!url || !load6 || policy !== "ownerScoped" || !adapter) return;
|
|
48306
48306
|
const controller = new AbortController();
|
|
48307
|
-
const settle3 = (next,
|
|
48308
|
-
if (!controller.signal.aborted) setResolved({ source: url, adapter, url: next, failed:
|
|
48307
|
+
const settle3 = (next, failed2 = false) => {
|
|
48308
|
+
if (!controller.signal.aborted) setResolved({ source: url, adapter, url: next, failed: failed2 });
|
|
48309
48309
|
};
|
|
48310
48310
|
adapter.load(load6, controller.signal).then((next) => settle3(next), () => settle3(null, true));
|
|
48311
48311
|
return () => controller.abort();
|
|
@@ -49777,8 +49777,8 @@ var init_SnackbarBubble = __esm({
|
|
|
49777
49777
|
const size = SNACKBAR_LIMITS.imageSize;
|
|
49778
49778
|
const resolved3 = useImageSource(url, { width: size, height: size, mode: "fill" });
|
|
49779
49779
|
const sources = useResponsiveImage(resolved3.url, size, size, "fill");
|
|
49780
|
-
const [
|
|
49781
|
-
if (!resolved3.url ||
|
|
49780
|
+
const [failed2, setFailed] = React9.useState(null);
|
|
49781
|
+
if (!resolved3.url || failed2 === resolved3.url) return null;
|
|
49782
49782
|
return /* @__PURE__ */ jsx5(
|
|
49783
49783
|
"img",
|
|
49784
49784
|
{
|
|
@@ -51366,10 +51366,10 @@ function fullscreenEntry(doc, host, video) {
|
|
|
51366
51366
|
function canEnterFullscreen(doc, host, video) {
|
|
51367
51367
|
return fullscreenEntry(doc, host, video) !== void 0;
|
|
51368
51368
|
}
|
|
51369
|
-
function sameClip(loaded2, next,
|
|
51369
|
+
function sameClip(loaded2, next, failed2) {
|
|
51370
51370
|
if (!loaded2?.url || !next.url) return false;
|
|
51371
51371
|
if (loaded2.url === next.url) return true;
|
|
51372
|
-
if (
|
|
51372
|
+
if (failed2 || !loaded2.id || loaded2.id !== next.id) return false;
|
|
51373
51373
|
const strip4 = (raw) => {
|
|
51374
51374
|
try {
|
|
51375
51375
|
const u2 = new URL(raw);
|
|
@@ -51999,14 +51999,14 @@ function createRicosHostSession(o2) {
|
|
|
51999
51999
|
let baseline = null, lastContent = null;
|
|
52000
52000
|
let dirtyTimer = null;
|
|
52001
52001
|
const flushes = /* @__PURE__ */ new Map();
|
|
52002
|
-
const
|
|
52002
|
+
const unavailable2 = (r3) => {
|
|
52003
52003
|
if (state.unavailable || disposed) return;
|
|
52004
52004
|
state.unavailable = r3;
|
|
52005
52005
|
t2.clearTimeout(readyTimer);
|
|
52006
52006
|
o2.onUnavailable(r3);
|
|
52007
52007
|
};
|
|
52008
52008
|
const readyTimer = t2.setTimeout(() => {
|
|
52009
|
-
if (!state.ready)
|
|
52009
|
+
if (!state.ready) unavailable2("timeout");
|
|
52010
52010
|
}, o2.readyTimeoutMs ?? RICOS_HOST_DEFAULTS.readyTimeoutMs);
|
|
52011
52011
|
const sendInit = () => {
|
|
52012
52012
|
initSent = true;
|
|
@@ -52100,7 +52100,7 @@ function createRicosHostSession(o2) {
|
|
|
52100
52100
|
if (!m2.focused) void session.flush();
|
|
52101
52101
|
return;
|
|
52102
52102
|
case "error":
|
|
52103
|
-
if (isFatalPageError(m2.code))
|
|
52103
|
+
if (isFatalPageError(m2.code)) unavailable2("engine");
|
|
52104
52104
|
return;
|
|
52105
52105
|
}
|
|
52106
52106
|
},
|
|
@@ -52155,12 +52155,12 @@ function createRicosHostSession(o2) {
|
|
|
52155
52155
|
flush() {
|
|
52156
52156
|
if (!state.ready || state.unavailable || disposed) return Promise.resolve(null);
|
|
52157
52157
|
const requestId2 = newId();
|
|
52158
|
-
return new Promise((
|
|
52158
|
+
return new Promise((resolve135) => {
|
|
52159
52159
|
const timer = t2.setTimeout(() => {
|
|
52160
52160
|
flushes.delete(requestId2);
|
|
52161
|
-
|
|
52161
|
+
resolve135(null);
|
|
52162
52162
|
}, flushMs);
|
|
52163
|
-
flushes.set(requestId2, { resolve:
|
|
52163
|
+
flushes.set(requestId2, { resolve: resolve135, timer });
|
|
52164
52164
|
o2.send({ v: 1, type: "requestContent", requestId: requestId2 });
|
|
52165
52165
|
});
|
|
52166
52166
|
},
|
|
@@ -52177,7 +52177,7 @@ function createRicosHostSession(o2) {
|
|
|
52177
52177
|
if (state.ready) o2.send({ v: 1, type: "blur" });
|
|
52178
52178
|
},
|
|
52179
52179
|
markMissing() {
|
|
52180
|
-
if (!state.ready)
|
|
52180
|
+
if (!state.ready) unavailable2("missing");
|
|
52181
52181
|
},
|
|
52182
52182
|
dispose() {
|
|
52183
52183
|
disposed = true;
|
|
@@ -52220,7 +52220,7 @@ async function runRicosImageUpload(o2) {
|
|
|
52220
52220
|
};
|
|
52221
52221
|
session.insertMediaPlaceholder(requestId2);
|
|
52222
52222
|
try {
|
|
52223
|
-
const entry = await new Promise((
|
|
52223
|
+
const entry = await new Promise((resolve135) => {
|
|
52224
52224
|
let done = false;
|
|
52225
52225
|
let unsub = () => {
|
|
52226
52226
|
};
|
|
@@ -52229,7 +52229,7 @@ async function runRicosImageUpload(o2) {
|
|
|
52229
52229
|
done = true;
|
|
52230
52230
|
t2.clearTimeout(timer);
|
|
52231
52231
|
queueMicrotask(() => unsub());
|
|
52232
|
-
|
|
52232
|
+
resolve135(v2);
|
|
52233
52233
|
};
|
|
52234
52234
|
const timer = t2.setTimeout(() => finish3(null), o2.timeoutMs ?? RICOS_UPLOAD_TIMEOUT_MS);
|
|
52235
52235
|
unsub = deps.subscribe(`${svc}.uploads.${requestId2}`, (v2) => {
|
|
@@ -52794,9 +52794,9 @@ var init_presigned_upload_policy = __esm({
|
|
|
52794
52794
|
function mediaFieldName(label4) {
|
|
52795
52795
|
return typeof label4 === "string" && label4.trim() !== "" ? label4 : MEDIA_FIELD_DEFAULT_LABEL;
|
|
52796
52796
|
}
|
|
52797
|
-
function mediaFieldState(uploading, hasPhoto,
|
|
52797
|
+
function mediaFieldState(uploading, hasPhoto, failed2 = false) {
|
|
52798
52798
|
if (uploading) return "Uploading";
|
|
52799
|
-
if (
|
|
52799
|
+
if (failed2) return MEDIA_FIELD_UPLOAD_FAILED;
|
|
52800
52800
|
return hasPhoto ? "Photo added" : void 0;
|
|
52801
52801
|
}
|
|
52802
52802
|
function mediaFieldServicePath(valuePath) {
|
|
@@ -52826,10 +52826,10 @@ async function runMediaFieldUpload(o2) {
|
|
|
52826
52826
|
}, o2.timeoutMs ?? MEDIA_FIELD_UPLOAD_TIMEOUT_MS);
|
|
52827
52827
|
const bounded2 = (p2) => {
|
|
52828
52828
|
if (expired) return Promise.reject(new Deadline());
|
|
52829
|
-
return new Promise((
|
|
52829
|
+
return new Promise((resolve135, reject) => {
|
|
52830
52830
|
const stop2 = () => reject(new Deadline());
|
|
52831
52831
|
onExpire.push(stop2);
|
|
52832
|
-
p2.then(
|
|
52832
|
+
p2.then(resolve135, reject).finally(() => {
|
|
52833
52833
|
onExpire = onExpire.filter((f2) => f2 !== stop2);
|
|
52834
52834
|
});
|
|
52835
52835
|
});
|
|
@@ -52852,7 +52852,7 @@ async function runMediaFieldUpload(o2) {
|
|
|
52852
52852
|
const before = deps.value(urlPath);
|
|
52853
52853
|
let uploadUrl;
|
|
52854
52854
|
try {
|
|
52855
|
-
uploadUrl = await bounded2(new Promise((
|
|
52855
|
+
uploadUrl = await bounded2(new Promise((resolve135, reject) => {
|
|
52856
52856
|
let done = false;
|
|
52857
52857
|
let unsub = () => {
|
|
52858
52858
|
};
|
|
@@ -52860,7 +52860,7 @@ async function runMediaFieldUpload(o2) {
|
|
|
52860
52860
|
if (done || typeof v2 !== "string" || v2 === "" || v2 === before) return;
|
|
52861
52861
|
done = true;
|
|
52862
52862
|
queueMicrotask(() => unsub());
|
|
52863
|
-
|
|
52863
|
+
resolve135(v2);
|
|
52864
52864
|
});
|
|
52865
52865
|
onExpire.push(() => {
|
|
52866
52866
|
if (!done) {
|
|
@@ -52875,7 +52875,7 @@ async function runMediaFieldUpload(o2) {
|
|
|
52875
52875
|
if (typeof now === "string" && now !== "" && now !== before) {
|
|
52876
52876
|
done = true;
|
|
52877
52877
|
queueMicrotask(() => unsub());
|
|
52878
|
-
|
|
52878
|
+
resolve135(now);
|
|
52879
52879
|
return;
|
|
52880
52880
|
}
|
|
52881
52881
|
}
|
|
@@ -55962,7 +55962,7 @@ async function fetchData(url, type2 = "text") {
|
|
|
55962
55962
|
}
|
|
55963
55963
|
return response.text();
|
|
55964
55964
|
}
|
|
55965
|
-
return new Promise((
|
|
55965
|
+
return new Promise((resolve135, reject) => {
|
|
55966
55966
|
const request2 = new XMLHttpRequest();
|
|
55967
55967
|
request2.open("GET", url, true);
|
|
55968
55968
|
request2.responseType = type2 === "bytes" ? "arraybuffer" : type2;
|
|
@@ -55973,14 +55973,14 @@ async function fetchData(url, type2 = "text") {
|
|
|
55973
55973
|
if (request2.status === 200 || request2.status === 0) {
|
|
55974
55974
|
switch (type2) {
|
|
55975
55975
|
case "bytes":
|
|
55976
|
-
|
|
55976
|
+
resolve135(new Uint8Array(request2.response));
|
|
55977
55977
|
return;
|
|
55978
55978
|
case "blob":
|
|
55979
55979
|
case "json":
|
|
55980
|
-
|
|
55980
|
+
resolve135(request2.response);
|
|
55981
55981
|
return;
|
|
55982
55982
|
}
|
|
55983
|
-
|
|
55983
|
+
resolve135(request2.responseText);
|
|
55984
55984
|
return;
|
|
55985
55985
|
}
|
|
55986
55986
|
reject(new Error(request2.statusText));
|
|
@@ -58985,13 +58985,13 @@ var init_pdf = __esm({
|
|
|
58985
58985
|
var aCallable = __webpack_require__3(9306);
|
|
58986
58986
|
var $TypeError = TypeError;
|
|
58987
58987
|
var PromiseCapability = function(C2) {
|
|
58988
|
-
var
|
|
58988
|
+
var resolve135, reject;
|
|
58989
58989
|
this.promise = new C2(function($$resolve, $$reject) {
|
|
58990
|
-
if (
|
|
58991
|
-
|
|
58990
|
+
if (resolve135 !== void 0 || reject !== void 0) throw new $TypeError("Bad Promise constructor");
|
|
58991
|
+
resolve135 = $$resolve;
|
|
58992
58992
|
reject = $$reject;
|
|
58993
58993
|
});
|
|
58994
|
-
this.resolve = aCallable(
|
|
58994
|
+
this.resolve = aCallable(resolve135);
|
|
58995
58995
|
this.reject = aCallable(reject);
|
|
58996
58996
|
};
|
|
58997
58997
|
module.exports.f = function(C2) {
|
|
@@ -59359,8 +59359,8 @@ var init_pdf = __esm({
|
|
|
59359
59359
|
anObject(C2);
|
|
59360
59360
|
if (isObject6(x2) && x2.constructor === C2) return x2;
|
|
59361
59361
|
var promiseCapability = newPromiseCapability.f(C2);
|
|
59362
|
-
var
|
|
59363
|
-
|
|
59362
|
+
var resolve135 = promiseCapability.resolve;
|
|
59363
|
+
resolve135(x2);
|
|
59364
59364
|
return promiseCapability.promise;
|
|
59365
59365
|
};
|
|
59366
59366
|
},
|
|
@@ -63214,11 +63214,11 @@ var init_pdf = __esm({
|
|
|
63214
63214
|
const mustRemoveAspectRatioPromise = _ImageManager._isSVGFittingCanvas;
|
|
63215
63215
|
const fileReader = new FileReader();
|
|
63216
63216
|
const imageElement = new Image();
|
|
63217
|
-
const imagePromise = new Promise((
|
|
63217
|
+
const imagePromise = new Promise((resolve135, reject) => {
|
|
63218
63218
|
imageElement.onload = () => {
|
|
63219
63219
|
data.bitmap = imageElement;
|
|
63220
63220
|
data.isSvg = true;
|
|
63221
|
-
|
|
63221
|
+
resolve135();
|
|
63222
63222
|
};
|
|
63223
63223
|
fileReader.onload = async () => {
|
|
63224
63224
|
const url = data.svgUrl = fileReader.result;
|
|
@@ -63904,13 +63904,13 @@ var init_pdf = __esm({
|
|
|
63904
63904
|
return;
|
|
63905
63905
|
}
|
|
63906
63906
|
const {
|
|
63907
|
-
resolve:
|
|
63907
|
+
resolve: resolve135,
|
|
63908
63908
|
promise
|
|
63909
63909
|
} = Promise.withResolvers();
|
|
63910
63910
|
const onEditorsRendered = (evt) => {
|
|
63911
63911
|
if (evt.pageNumber === pageNumber2) {
|
|
63912
63912
|
this._eventBus.off("editorsrendered", onEditorsRendered);
|
|
63913
|
-
|
|
63913
|
+
resolve135();
|
|
63914
63914
|
}
|
|
63915
63915
|
};
|
|
63916
63916
|
this._eventBus.on("editorsrendered", onEditorsRendered, internalOpt);
|
|
@@ -68948,8 +68948,8 @@ var init_pdf = __esm({
|
|
|
68948
68948
|
if (this.isSyncFontLoadingSupported) {
|
|
68949
68949
|
return;
|
|
68950
68950
|
}
|
|
68951
|
-
await new Promise((
|
|
68952
|
-
const request2 = this._queueLoadingCallback(
|
|
68951
|
+
await new Promise((resolve135) => {
|
|
68952
|
+
const request2 = this._queueLoadingCallback(resolve135);
|
|
68953
68953
|
this._prepareFontLoadEvent(font, request2);
|
|
68954
68954
|
});
|
|
68955
68955
|
}
|
|
@@ -85989,7 +85989,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
85989
85989
|
input.type = "file";
|
|
85990
85990
|
input.accept = SupportedImageMimeTypes.join(",");
|
|
85991
85991
|
const signal = this._uiManager._signal;
|
|
85992
|
-
this.#bitmapPromise = new Promise((
|
|
85992
|
+
this.#bitmapPromise = new Promise((resolve135) => {
|
|
85993
85993
|
input.addEventListener("change", async () => {
|
|
85994
85994
|
if (!input.files || input.files.length === 0) {
|
|
85995
85995
|
this.remove();
|
|
@@ -86004,13 +86004,13 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
86004
86004
|
});
|
|
86005
86005
|
this.#getBitmapFetched(data);
|
|
86006
86006
|
}
|
|
86007
|
-
|
|
86007
|
+
resolve135();
|
|
86008
86008
|
}, {
|
|
86009
86009
|
signal
|
|
86010
86010
|
});
|
|
86011
86011
|
input.addEventListener("cancel", () => {
|
|
86012
86012
|
this.remove();
|
|
86013
|
-
|
|
86013
|
+
resolve135();
|
|
86014
86014
|
}, {
|
|
86015
86015
|
signal
|
|
86016
86016
|
});
|
|
@@ -136281,14 +136281,14 @@ function PdfDocument({ src, nativeSrc, title, height, startPage, zoomPercent, st
|
|
|
136281
136281
|
const [pages2, setPages] = React21.useState(0);
|
|
136282
136282
|
const [failedRequest, setFailedRequest] = React21.useState(null);
|
|
136283
136283
|
const request2 = JSON.stringify([src, zoomPercent]);
|
|
136284
|
-
const
|
|
136284
|
+
const failed2 = failedRequest === request2;
|
|
136285
136285
|
const containerRef = React21.useRef(null);
|
|
136286
136286
|
const frameRef = React21.useRef(null);
|
|
136287
136287
|
const startPageRef = React21.useRef(startPage);
|
|
136288
136288
|
startPageRef.current = startPage;
|
|
136289
136289
|
React21.useEffect(() => {
|
|
136290
|
-
if (
|
|
136291
|
-
}, [
|
|
136290
|
+
if (failed2) onFallback?.();
|
|
136291
|
+
}, [failed2, onFallback]);
|
|
136292
136292
|
React21.useEffect(() => {
|
|
136293
136293
|
const frame2 = frameRef.current;
|
|
136294
136294
|
const page = Math.min(pages2, Math.max(1, Math.floor(startPage ?? 1) || 1));
|
|
@@ -136340,7 +136340,7 @@ function PdfDocument({ src, nativeSrc, title, height, startPage, zoomPercent, st
|
|
|
136340
136340
|
// PDF pages need their own scroll viewport so every page remains reachable.
|
|
136341
136341
|
overflow: "auto"
|
|
136342
136342
|
};
|
|
136343
|
-
if (
|
|
136343
|
+
if (failed2) {
|
|
136344
136344
|
return /* @__PURE__ */ jsx14("object", { "data-himalaya-pdf": "native-fallback", "data-himalaya-pdf-zoom": zoomPercent ?? 100, data: nativeSrc, type: "application/pdf", "aria-label": title, style: frame });
|
|
136345
136345
|
}
|
|
136346
136346
|
return /* @__PURE__ */ jsxs11("div", { ref: frameRef, "data-himalaya-pdf": "canvas-document", "data-himalaya-pdf-src": src, "data-himalaya-pdf-zoom": zoomPercent ?? 100, "data-himalaya-pdf-start-page": startPage ?? 1, "data-himalaya-pdf-native-src": nativeSrc, role: "group", "aria-label": title, "aria-busy": pages2 === 0, style: frame, children: [
|
|
@@ -140597,14 +140597,14 @@ var init_renderNode = __esm({
|
|
|
140597
140597
|
const fallbackBound = useBoundValue(ctx, fallbackPathStr ? String(props2.fallbackTextPath) : "");
|
|
140598
140598
|
const fallbackText = typeof fallbackBound === "string" ? fallbackBound : "";
|
|
140599
140599
|
const [uploading, setUploading] = React22.useState(false);
|
|
140600
|
-
const [
|
|
140600
|
+
const [failed2, setFailed] = React22.useState(false);
|
|
140601
140601
|
const fileRef2 = React22.useRef(null);
|
|
140602
140602
|
const previewRef = React22.useRef(null);
|
|
140603
140603
|
const [localPreview, setLocalPreview] = React22.useState("");
|
|
140604
140604
|
const uploadService = typeof props2.uploadService === "string" ? props2.uploadService : "";
|
|
140605
140605
|
const resolvedLabel = asText2(resolveScalarStatic(props2.label, ctx));
|
|
140606
140606
|
const name = mediaFieldName(resolvedLabel);
|
|
140607
|
-
const state = mediaFieldState(uploading, imageUrl !== "",
|
|
140607
|
+
const state = mediaFieldState(uploading, imageUrl !== "", failed2);
|
|
140608
140608
|
const open6 = () => {
|
|
140609
140609
|
if (!uploading) fileRef2.current?.click();
|
|
140610
140610
|
};
|
|
@@ -140697,7 +140697,7 @@ var init_renderNode = __esm({
|
|
|
140697
140697
|
/* @__PURE__ */ jsxs12("div", { style: { display: "flex", flexDirection: "column", gap: 4, alignItems: "flex-start" }, children: [
|
|
140698
140698
|
heading ? /* @__PURE__ */ jsx15("span", { style: { fontFamily: fontStack(f2.family, ctx.idiom), fontWeight: f2.weight, fontSize: f2.remSize, color: C2("textSecondary", "#6B7280") }, children: heading }) : null,
|
|
140699
140699
|
/* @__PURE__ */ jsx15("span", { style: { fontSize: pxToRem(13), color: accentTextColor(ctx) }, children: caption }),
|
|
140700
|
-
|
|
140700
|
+
failed2 ? /* @__PURE__ */ jsx15("span", { "data-media-upload-error": "true", style: { fontSize: pxToRem(13), color: C2("danger", "#E62214") }, children: MEDIA_FIELD_UPLOAD_FAILED }) : null
|
|
140701
140701
|
] })
|
|
140702
140702
|
] }) : /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
140703
140703
|
assetSrc ? /* @__PURE__ */ jsx15("img", { src: assetSrc, alt: "", "aria-hidden": "true", style: { position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", display: "block" } }) : /* @__PURE__ */ jsxs12("div", { "aria-hidden": "true", style: { display: "flex", flexDirection: "column", alignItems: "center", gap: 8, color: accentTextColor(ctx) }, children: [
|
|
@@ -140705,7 +140705,7 @@ var init_renderNode = __esm({
|
|
|
140705
140705
|
/* @__PURE__ */ jsx15("span", { style: { fontFamily: fontStack(f2.family, ctx.idiom), fontWeight: f2.weight, fontSize: f2.remSize }, children: name })
|
|
140706
140706
|
] }),
|
|
140707
140707
|
uploading ? /* @__PURE__ */ jsx15("div", { "aria-hidden": "true", "data-media-uploading": "true", style: { position: "absolute", inset: 0, background: "rgba(0,0,0,0.35)" } }) : null,
|
|
140708
|
-
|
|
140708
|
+
failed2 && !uploading ? /* @__PURE__ */ jsx15("span", { "aria-hidden": "true", "data-media-upload-error": "true", style: { position: "absolute", left: 8, right: 8, bottom: 8, textAlign: "center", fontSize: pxToRem(13), color: C2("danger", "#E62214") }, children: MEDIA_FIELD_UPLOAD_FAILED }) : null
|
|
140709
140709
|
] })
|
|
140710
140710
|
]
|
|
140711
140711
|
}
|
|
@@ -141585,10 +141585,10 @@ var init_renderNode = __esm({
|
|
|
141585
141585
|
});
|
|
141586
141586
|
FormView = withExtras("FormView", ({ props: props2, ctx: inputCtx, wrap }) => {
|
|
141587
141587
|
const needsWorker = hasWorkerFormSubmit(props2.submitButton);
|
|
141588
|
-
const
|
|
141588
|
+
const unavailable2 = needsWorker && inputCtx.formReadiness === "unavailable";
|
|
141589
141589
|
const refreshing = needsWorker && inputCtx.formReadiness === "refreshing";
|
|
141590
|
-
const waiting = needsWorker && !
|
|
141591
|
-
const ctx = waiting ||
|
|
141590
|
+
const waiting = needsWorker && !unavailable2 && (refreshing || inputCtx.formReadiness === "pending" || inputCtx.formReadiness === void 0 && inputCtx.workerReady === false);
|
|
141591
|
+
const ctx = waiting || unavailable2 ? { ...inputCtx, onAction: null } : inputCtx;
|
|
141592
141592
|
const bagRef = React22.useRef(null);
|
|
141593
141593
|
if (!bagRef.current) bagRef.current = createFormBag();
|
|
141594
141594
|
const bag = bagRef.current;
|
|
@@ -141612,15 +141612,15 @@ var init_renderNode = __esm({
|
|
|
141612
141612
|
};
|
|
141613
141613
|
const submitNode = React22.useMemo(() => {
|
|
141614
141614
|
const node3 = props2.submitButton;
|
|
141615
|
-
if (!node3 || valid3 && !waiting && !
|
|
141615
|
+
if (!node3 || valid3 && !waiting && !unavailable2) return node3;
|
|
141616
141616
|
if (node3.body) return { ...node3, body: { ...node3.body, props: { ...node3.body.props ?? {}, disabled: true } } };
|
|
141617
141617
|
return { ...node3, props: { ...node3.props ?? {}, disabled: true } };
|
|
141618
|
-
}, [props2.submitButton, valid3, waiting,
|
|
141618
|
+
}, [props2.submitButton, valid3, waiting, unavailable2]);
|
|
141619
141619
|
return /* @__PURE__ */ jsxs12("div", { "aria-busy": waiting || void 0, style: { display: "flex", flexDirection: "column", gap: 14, width: "100%", ...wrap }, children: [
|
|
141620
141620
|
waiting && /* @__PURE__ */ jsx15("span", { role: "status", children: refreshing ? "Refreshing form\u2026" : "Loading form\u2026" }),
|
|
141621
|
-
|
|
141621
|
+
unavailable2 && /* @__PURE__ */ jsx15("span", { role: "status", children: "Form unavailable. Please try again." }),
|
|
141622
141622
|
/* @__PURE__ */ jsxs12(FormValuesContext.Provider, { value: bag, children: [
|
|
141623
|
-
/* @__PURE__ */ jsx15("fieldset", { disabled: waiting ||
|
|
141623
|
+
/* @__PURE__ */ jsx15("fieldset", { disabled: waiting || unavailable2, style: { display: waiting && !refreshing ? "none" : "contents", border: 0, padding: 0, margin: 0, minWidth: 0 }, children: kids2(props2.fields, ctx) }),
|
|
141624
141624
|
submitNode && renderNode(submitNode, submitCtx)
|
|
141625
141625
|
] })
|
|
141626
141626
|
] });
|
|
@@ -147911,13 +147911,13 @@ __export(render_descriptor_exports, {
|
|
|
147911
147911
|
stabilizePngPage: () => stabilizePngPage,
|
|
147912
147912
|
withRetry: () => withRetry
|
|
147913
147913
|
});
|
|
147914
|
-
function a11ySemantics(type2, props2, modifiers, ancestorHidden,
|
|
147914
|
+
function a11ySemantics(type2, props2, modifiers, ancestorHidden, resolve135) {
|
|
147915
147915
|
if (!A11Y_MODIFIER_KEYS.some((k3) => modifiers[k3] !== void 0)) return void 0;
|
|
147916
147916
|
const literal3 = (v2) => typeof v2 === "string" && v2.trim() !== "" && !isDynamicValue(v2) ? v2 : void 0;
|
|
147917
147917
|
const spoken = (v2) => {
|
|
147918
147918
|
const lit = literal3(v2);
|
|
147919
|
-
if (lit !== void 0 || !
|
|
147920
|
-
const r3 =
|
|
147919
|
+
if (lit !== void 0 || !resolve135 || typeof v2 !== "string" || !isDynamicValue(v2)) return lit;
|
|
147920
|
+
const r3 = resolve135(v2);
|
|
147921
147921
|
if (r3 === v2) return void 0;
|
|
147922
147922
|
return typeof r3 === "string" && r3.trim() !== "" ? r3 : typeof r3 === "number" ? String(r3) : void 0;
|
|
147923
147923
|
};
|
|
@@ -147931,7 +147931,7 @@ function a11ySemantics(type2, props2, modifiers, ancestorHidden, resolve134) {
|
|
|
147931
147931
|
if (name !== void 0 && exposure === "exposed") out2.name = name;
|
|
147932
147932
|
const hint = spoken(modifiers.accessibilityHint);
|
|
147933
147933
|
if (hint !== void 0) out2.hint = hint;
|
|
147934
|
-
const value2 = spoken(modifiers.accessibilityValue) ?? controlState(role, props2,
|
|
147934
|
+
const value2 = spoken(modifiers.accessibilityValue) ?? controlState(role, props2, resolve135);
|
|
147935
147935
|
if (value2 !== void 0) out2.value = value2;
|
|
147936
147936
|
if (typeof modifiers.headingLevel === "number") out2.headingLevel = modifiers.headingLevel;
|
|
147937
147937
|
if (exposure !== "exposed") out2.exposure = exposure;
|
|
@@ -147952,13 +147952,13 @@ function a11ySemantics(type2, props2, modifiers, ancestorHidden, resolve134) {
|
|
|
147952
147952
|
}
|
|
147953
147953
|
return out2;
|
|
147954
147954
|
}
|
|
147955
|
-
function controlState(role, props2,
|
|
147955
|
+
function controlState(role, props2, resolve135) {
|
|
147956
147956
|
if (role !== "toggle" && role !== "checkbox" && role !== "radio") return void 0;
|
|
147957
147957
|
if (role === "checkbox" && props2.indeterminate === true) return "mixed";
|
|
147958
147958
|
const binding2 = typeof props2.valuePath === "string" ? props2.valuePath : typeof props2.value === "string" && isDynamicValue(props2.value) ? props2.value : void 0;
|
|
147959
147959
|
let on4;
|
|
147960
147960
|
if (binding2 !== void 0) {
|
|
147961
|
-
const v2 =
|
|
147961
|
+
const v2 = resolve135 ? resolve135(binding2) : void 0;
|
|
147962
147962
|
if (v2 === true || v2 === 1 || v2 === "true" || v2 === "1") on4 = true;
|
|
147963
147963
|
else if (v2 === false || v2 === 0 || v2 === "false" || v2 === "0") on4 = false;
|
|
147964
147964
|
else return void 0;
|
|
@@ -148573,7 +148573,7 @@ async function stabilizePngPage(page, scheme) {
|
|
|
148573
148573
|
const browser = globalThis;
|
|
148574
148574
|
browser.document.documentElement.style.colorScheme = selected;
|
|
148575
148575
|
await browser.document.fonts?.ready;
|
|
148576
|
-
await new Promise((
|
|
148576
|
+
await new Promise((resolve135) => browser.requestAnimationFrame(() => browser.requestAnimationFrame(() => resolve135())));
|
|
148577
148577
|
}, scheme);
|
|
148578
148578
|
}
|
|
148579
148579
|
function setPngEgress(start2) {
|
|
@@ -148780,7 +148780,7 @@ async function resolveEgress(host, port, allow = allowedOrigins) {
|
|
|
148780
148780
|
return addrs.every((a3) => isPublicAddress(a3.address)) ? addrs : null;
|
|
148781
148781
|
}
|
|
148782
148782
|
function connectFirst(addrs, port, track2) {
|
|
148783
|
-
return new Promise((
|
|
148783
|
+
return new Promise((resolve135, reject) => {
|
|
148784
148784
|
const tryAt = (i2) => {
|
|
148785
148785
|
if (i2 >= addrs.length) return reject(new Error("no address answered"));
|
|
148786
148786
|
const s5 = net.connect({ host: addrs[i2].address, family: addrs[i2].family, port });
|
|
@@ -148794,7 +148794,7 @@ function connectFirst(addrs, port, track2) {
|
|
|
148794
148794
|
s5.once("connect", () => {
|
|
148795
148795
|
s5.off("error", onFail);
|
|
148796
148796
|
s5.setTimeout(0);
|
|
148797
|
-
|
|
148797
|
+
resolve135(s5);
|
|
148798
148798
|
});
|
|
148799
148799
|
};
|
|
148800
148800
|
tryAt(0);
|
|
@@ -148900,16 +148900,16 @@ async function startEgressProxy() {
|
|
|
148900
148900
|
upstream.pipe(socket);
|
|
148901
148901
|
socket.pipe(upstream);
|
|
148902
148902
|
});
|
|
148903
|
-
await new Promise((
|
|
148903
|
+
await new Promise((resolve135, reject) => {
|
|
148904
148904
|
server.once("error", reject);
|
|
148905
|
-
server.listen(0, "127.0.0.1", () =>
|
|
148905
|
+
server.listen(0, "127.0.0.1", () => resolve135());
|
|
148906
148906
|
});
|
|
148907
148907
|
const { port } = server.address();
|
|
148908
148908
|
return {
|
|
148909
148909
|
url: `http://127.0.0.1:${port}`,
|
|
148910
148910
|
blocked: blocked2,
|
|
148911
|
-
close: () => new Promise((
|
|
148912
|
-
server.close(() =>
|
|
148911
|
+
close: () => new Promise((resolve135) => {
|
|
148912
|
+
server.close(() => resolve135());
|
|
148913
148913
|
for (const s5 of sockets) s5.destroy();
|
|
148914
148914
|
server.closeAllConnections?.();
|
|
148915
148915
|
})
|
|
@@ -151530,14 +151530,14 @@ async function pipeWebWixStream(upstream, res, signal, recordStream) {
|
|
|
151530
151530
|
const chunk2 = await reader.read();
|
|
151531
151531
|
if (chunk2.done) break;
|
|
151532
151532
|
if (chunk2.value && !res.write(chunk2.value)) {
|
|
151533
|
-
await new Promise((
|
|
151533
|
+
await new Promise((resolve135) => {
|
|
151534
151534
|
let settled = false;
|
|
151535
151535
|
const finish3 = () => {
|
|
151536
151536
|
if (settled) return;
|
|
151537
151537
|
settled = true;
|
|
151538
151538
|
res.off("drain", finish3);
|
|
151539
151539
|
res.off("close", finish3);
|
|
151540
|
-
|
|
151540
|
+
resolve135();
|
|
151541
151541
|
};
|
|
151542
151542
|
if (res.destroyed || !res.writable) finish3();
|
|
151543
151543
|
else {
|
|
@@ -151625,7 +151625,7 @@ async function handleWebWix(req, res, state) {
|
|
|
151625
151625
|
}
|
|
151626
151626
|
if (match) {
|
|
151627
151627
|
const mocked = match.rule.response;
|
|
151628
|
-
if (mocked.delayMs) await new Promise((
|
|
151628
|
+
if (mocked.delayMs) await new Promise((resolve135) => setTimeout(resolve135, mocked.delayMs));
|
|
151629
151629
|
const payload = mocked.template ? renderTemplate(mocked.body, match.captures) : mocked.body;
|
|
151630
151630
|
recordStream("mock", mocked.status, match.rule.id, mocked.headers);
|
|
151631
151631
|
res.statusCode = mocked.status;
|
|
@@ -151910,7 +151910,7 @@ async function handleWebWix(req, res, state) {
|
|
|
151910
151910
|
}
|
|
151911
151911
|
if (match) {
|
|
151912
151912
|
const mocked = match.rule.response;
|
|
151913
|
-
if (mocked.delayMs) await new Promise((
|
|
151913
|
+
if (mocked.delayMs) await new Promise((resolve135) => setTimeout(resolve135, mocked.delayMs));
|
|
151914
151914
|
const responseBody = mocked.template ? renderTemplate(mocked.body, match.captures) : mocked.body;
|
|
151915
151915
|
record5("mock", mocked.status, responseBody, match.rule.id, mocked.headers);
|
|
151916
151916
|
return reply(200, { status: mocked.status, body: responseBody ?? "" });
|
|
@@ -155337,12 +155337,12 @@ var init_query = __esm({
|
|
|
155337
155337
|
});
|
|
155338
155338
|
|
|
155339
155339
|
// ../../core/dev-server/src/crawl-input.ts
|
|
155340
|
-
function resolved2(v2,
|
|
155341
|
-
if (typeof v2 === "string") return v2.startsWith("$service:") ?
|
|
155340
|
+
function resolved2(v2, resolve135) {
|
|
155341
|
+
if (typeof v2 === "string") return v2.startsWith("$service:") ? resolve135(v2) : v2;
|
|
155342
155342
|
if (Array.isArray(v2)) {
|
|
155343
155343
|
const out2 = v2.flatMap((el2) => {
|
|
155344
155344
|
if (typeof el2 !== "string" || !el2.startsWith("$service:")) return [el2];
|
|
155345
|
-
const r3 =
|
|
155345
|
+
const r3 = resolve135(el2);
|
|
155346
155346
|
return Array.isArray(r3) ? r3 : [r3];
|
|
155347
155347
|
});
|
|
155348
155348
|
return out2;
|
|
@@ -155356,9 +155356,9 @@ function hasRowBinding(props2) {
|
|
|
155356
155356
|
return itemToken(v2) || Array.isArray(v2) && v2.some(itemToken);
|
|
155357
155357
|
});
|
|
155358
155358
|
}
|
|
155359
|
-
function declaredOptionIds(props2,
|
|
155359
|
+
function declaredOptionIds(props2, resolve135) {
|
|
155360
155360
|
const literal3 = props2.options ?? props2.tabs ?? props2.chips;
|
|
155361
|
-
const bound2 = props2.optionsPath !== void 0 ? resolved2(props2.optionsPath,
|
|
155361
|
+
const bound2 = props2.optionsPath !== void 0 ? resolved2(props2.optionsPath, resolve135) : void 0;
|
|
155362
155362
|
const raw = Array.isArray(bound2) ? bound2 : literal3;
|
|
155363
155363
|
if (!Array.isArray(raw)) return [];
|
|
155364
155364
|
const out2 = [];
|
|
@@ -155401,24 +155401,24 @@ function seedTokens(state, limit = 48) {
|
|
|
155401
155401
|
walk5(state, 0);
|
|
155402
155402
|
return out2;
|
|
155403
155403
|
}
|
|
155404
|
-
function synthesizeInput(control,
|
|
155404
|
+
function synthesizeInput(control, resolve135, tokens2) {
|
|
155405
155405
|
const id = `${control.type}.${control.callback}`;
|
|
155406
155406
|
const row2 = SYNTHESIZED_CONTROLS[id];
|
|
155407
155407
|
if (!row2) return null;
|
|
155408
155408
|
const props2 = control.props;
|
|
155409
155409
|
if (hasRowBinding(props2)) return null;
|
|
155410
155410
|
if (row2.from === "declared-options") {
|
|
155411
|
-
const ids2 = declaredOptionIds(props2,
|
|
155411
|
+
const ids2 = declaredOptionIds(props2, resolve135);
|
|
155412
155412
|
if (!ids2.length) return null;
|
|
155413
155413
|
if (row2.encoding === "string-array") {
|
|
155414
|
-
const currentRaw2 = resolved2(props2.selectedIds,
|
|
155414
|
+
const currentRaw2 = resolved2(props2.selectedIds, resolve135);
|
|
155415
155415
|
const current3 = (Array.isArray(currentRaw2) ? currentRaw2 : []).filter((x2) => typeof x2 === "string");
|
|
155416
155416
|
const pick7 = ids2.find((o2) => !current3.includes(o2));
|
|
155417
155417
|
if (pick7 === void 0) return null;
|
|
155418
155418
|
const value2 = props2.multiSelect === true ? [...current3, pick7] : [pick7];
|
|
155419
155419
|
return { key: row2.key, value: value2, from: row2.from, current: current3, control: id };
|
|
155420
155420
|
}
|
|
155421
|
-
const currentRaw = resolved2(props2.selectedId,
|
|
155421
|
+
const currentRaw = resolved2(props2.selectedId, resolve135);
|
|
155422
155422
|
const current2 = typeof currentRaw === "string" ? currentRaw : void 0;
|
|
155423
155423
|
const pick6 = ids2.find((o2) => o2 !== current2);
|
|
155424
155424
|
if (pick6 === void 0) return null;
|
|
@@ -155426,7 +155426,7 @@ function synthesizeInput(control, resolve134, tokens2) {
|
|
|
155426
155426
|
}
|
|
155427
155427
|
if (!acceptsWords(props2) || !acceptsWords(control.wrapper ?? {})) return null;
|
|
155428
155428
|
const binding2 = typeof props2.valuePath === "string" ? props2.valuePath : typeof props2.value === "string" && props2.value.startsWith("$service:") ? props2.value : void 0;
|
|
155429
|
-
const bound2 = binding2 === void 0 ? void 0 :
|
|
155429
|
+
const bound2 = binding2 === void 0 ? void 0 : resolve135(binding2);
|
|
155430
155430
|
const literal3 = typeof props2.value === "string" && !props2.value.startsWith("$") ? props2.value : void 0;
|
|
155431
155431
|
const current = typeof bound2 === "string" ? bound2 : typeof bound2 === "number" ? String(bound2) : literal3 ?? "";
|
|
155432
155432
|
const max = typeof props2.maxLength === "number" && props2.maxLength > 0 ? props2.maxLength : void 0;
|
|
@@ -159219,14 +159219,14 @@ function countingWixCall(base2) {
|
|
|
159219
159219
|
let returned = 0;
|
|
159220
159220
|
let empty2 = 0;
|
|
159221
159221
|
let refused2 = 0;
|
|
159222
|
-
const
|
|
159222
|
+
const failed2 = [];
|
|
159223
159223
|
return {
|
|
159224
159224
|
call: async (method, path2, body) => {
|
|
159225
159225
|
let out2;
|
|
159226
159226
|
try {
|
|
159227
159227
|
out2 = await base2(method, path2, body);
|
|
159228
159228
|
} catch (e2) {
|
|
159229
|
-
|
|
159229
|
+
failed2.push(`${String(method).toUpperCase()} ${String(path2).split("?")[0]}`);
|
|
159230
159230
|
if (/^HTTP (401|403)\b/.test(e2?.message ?? "")) refused2 += 1;
|
|
159231
159231
|
throw e2;
|
|
159232
159232
|
}
|
|
@@ -159237,7 +159237,7 @@ function countingWixCall(base2) {
|
|
|
159237
159237
|
returned: () => returned,
|
|
159238
159238
|
empty: () => empty2,
|
|
159239
159239
|
refused: () => refused2,
|
|
159240
|
-
failed: () => [...
|
|
159240
|
+
failed: () => [...failed2]
|
|
159241
159241
|
};
|
|
159242
159242
|
}
|
|
159243
159243
|
function countingHostAnswers(host) {
|
|
@@ -159288,7 +159288,7 @@ async function liveRenderServices(bundleJs, opts) {
|
|
|
159288
159288
|
return loadBundleServicesLive(bundleJs, liveBootOptions(opts, bus));
|
|
159289
159289
|
}
|
|
159290
159290
|
async function settleUnawaitedWork() {
|
|
159291
|
-
for (let turn = 0; turn < SETTLE_TURNS; turn++) await new Promise((
|
|
159291
|
+
for (let turn = 0; turn < SETTLE_TURNS; turn++) await new Promise((resolve135) => setTimeout(resolve135, 0));
|
|
159292
159292
|
}
|
|
159293
159293
|
async function loadAndSettle(bundleJs, options2) {
|
|
159294
159294
|
const w2 = await bootBundleWorker(bundleJs, options2);
|
|
@@ -162532,8 +162532,8 @@ function materializeForPreview(appDir3, slug, displayName3) {
|
|
|
162532
162532
|
}
|
|
162533
162533
|
async function appId(dir) {
|
|
162534
162534
|
try {
|
|
162535
|
-
const { readFileSync:
|
|
162536
|
-
const m2 = JSON.parse(
|
|
162535
|
+
const { readFileSync: readFileSync197 } = await import("node:fs");
|
|
162536
|
+
const m2 = JSON.parse(readFileSync197(join42(dir, "himalaya.content.json"), "utf8"));
|
|
162537
162537
|
if (m2.name) return m2.name;
|
|
162538
162538
|
} catch {
|
|
162539
162539
|
}
|
|
@@ -162822,17 +162822,17 @@ function createScopedRegistryResolver(exec = execNpmConfig) {
|
|
|
162822
162822
|
};
|
|
162823
162823
|
}
|
|
162824
162824
|
function execNpmConfig(file2, args, options2) {
|
|
162825
|
-
return new Promise((
|
|
162826
|
-
execFile(file2, args, { ...options2, windowsHide: true }, (error, stdout) => error ? reject(error) :
|
|
162825
|
+
return new Promise((resolve135, reject) => {
|
|
162826
|
+
execFile(file2, args, { ...options2, windowsHide: true }, (error, stdout) => error ? reject(error) : resolve135(String(stdout)));
|
|
162827
162827
|
});
|
|
162828
162828
|
}
|
|
162829
162829
|
async function scopedRegistryBefore(lookup4, deadline, onTimeout) {
|
|
162830
162830
|
let cancel = () => {
|
|
162831
162831
|
};
|
|
162832
|
-
const expired = new Promise((
|
|
162832
|
+
const expired = new Promise((resolve135) => {
|
|
162833
162833
|
const timer = setTimeout(() => {
|
|
162834
162834
|
onTimeout?.();
|
|
162835
|
-
|
|
162835
|
+
resolve135(void 0);
|
|
162836
162836
|
}, Math.max(0, deadline - Date.now()));
|
|
162837
162837
|
cancel = () => clearTimeout(timer);
|
|
162838
162838
|
});
|
|
@@ -163583,7 +163583,7 @@ async function mintToken(args, label4, cacheKey, spawnImpl) {
|
|
|
163583
163583
|
tokenCache.set(cacheKey, fromEnv);
|
|
163584
163584
|
return fromEnv;
|
|
163585
163585
|
}
|
|
163586
|
-
const token = await new Promise((
|
|
163586
|
+
const token = await new Promise((resolve135, reject) => {
|
|
163587
163587
|
let child3;
|
|
163588
163588
|
try {
|
|
163589
163589
|
child3 = spawnImpl("wix", [...args]);
|
|
@@ -163614,12 +163614,12 @@ async function mintToken(args, label4, cacheKey, spawnImpl) {
|
|
|
163614
163614
|
child3.stdout?.on("data", (d2) => {
|
|
163615
163615
|
out2 += String(d2);
|
|
163616
163616
|
const m2 = out2.match(TOKEN_RE);
|
|
163617
|
-
if (m2) done(() =>
|
|
163617
|
+
if (m2) done(() => resolve135(m2[0]));
|
|
163618
163618
|
});
|
|
163619
163619
|
child3.stderr?.on("data", (d2) => {
|
|
163620
163620
|
out2 += String(d2);
|
|
163621
163621
|
const m2 = out2.match(TOKEN_RE);
|
|
163622
|
-
if (m2) done(() =>
|
|
163622
|
+
if (m2) done(() => resolve135(m2[0]));
|
|
163623
163623
|
});
|
|
163624
163624
|
child3.on("error", (e2) => done(() => reject(spawnFailure(label4, e2))));
|
|
163625
163625
|
child3.on("exit", (code3) => done(() => reject(new WixTokenError(
|
|
@@ -174641,10 +174641,10 @@ function assertPublicSiteUrl(raw) {
|
|
|
174641
174641
|
if (refusal2) throw new Error(refusal2);
|
|
174642
174642
|
}
|
|
174643
174643
|
function resolveAll(hostname8) {
|
|
174644
|
-
return new Promise((
|
|
174644
|
+
return new Promise((resolve135, reject) => {
|
|
174645
174645
|
dnsLookup(hostname8, { all: true, verbatim: true }, (err, addresses) => {
|
|
174646
174646
|
if (err) reject(err);
|
|
174647
|
-
else
|
|
174647
|
+
else resolve135(addresses);
|
|
174648
174648
|
});
|
|
174649
174649
|
});
|
|
174650
174650
|
}
|
|
@@ -174652,13 +174652,13 @@ function withAbort(start2, signal, what) {
|
|
|
174652
174652
|
if (signal?.aborted) return Promise.reject(new Error(`${what} aborted`));
|
|
174653
174653
|
const work = start2();
|
|
174654
174654
|
if (!signal) return work;
|
|
174655
|
-
return new Promise((
|
|
174655
|
+
return new Promise((resolve135, reject) => {
|
|
174656
174656
|
const onAbort = () => reject(new Error(`${what} aborted`));
|
|
174657
174657
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
174658
|
-
work.then(
|
|
174658
|
+
work.then(resolve135, reject).finally(() => signal.removeEventListener("abort", onAbort));
|
|
174659
174659
|
});
|
|
174660
174660
|
}
|
|
174661
|
-
async function pinAddress(url,
|
|
174661
|
+
async function pinAddress(url, resolve135 = resolveAll, signal) {
|
|
174662
174662
|
const host = url.hostname.replace(/^\[|\]$/g, "");
|
|
174663
174663
|
if (ipv4Octets(host)) {
|
|
174664
174664
|
if (isBlockedAddress(host)) throw new Error(`${host} is a blocked address`);
|
|
@@ -174668,7 +174668,7 @@ async function pinAddress(url, resolve134 = resolveAll, signal) {
|
|
|
174668
174668
|
if (isBlockedAddress(host)) throw new Error(`${host} is a blocked address`);
|
|
174669
174669
|
return { address: host, family: 6 };
|
|
174670
174670
|
}
|
|
174671
|
-
const addresses = await withAbort(() =>
|
|
174671
|
+
const addresses = await withAbort(() => resolve135(host), signal, `${host} lookup`);
|
|
174672
174672
|
if (!addresses.length) throw new Error(`${host} resolved to no address`);
|
|
174673
174673
|
const blocked2 = addresses.filter((a3) => isBlockedAddress(a3.address)).map((a3) => a3.address);
|
|
174674
174674
|
if (blocked2.length) throw new Error(`${host} resolves to a blocked address (${blocked2.join(", ")})`);
|
|
@@ -174708,7 +174708,7 @@ function copyIncomingHeaders(headers2) {
|
|
|
174708
174708
|
return out2;
|
|
174709
174709
|
}
|
|
174710
174710
|
function requestOnce(url, pinned, init) {
|
|
174711
|
-
return new Promise((
|
|
174711
|
+
return new Promise((resolve135, reject) => {
|
|
174712
174712
|
const headers2 = { host: url.host, "accept-encoding": "identity" };
|
|
174713
174713
|
new Headers(init.headers ?? {}).forEach((value2, key4) => {
|
|
174714
174714
|
if (key4.toLowerCase() !== "host") headers2[key4] = value2;
|
|
@@ -174738,7 +174738,7 @@ function requestOnce(url, pinned, init) {
|
|
|
174738
174738
|
reject(err);
|
|
174739
174739
|
return;
|
|
174740
174740
|
}
|
|
174741
|
-
|
|
174741
|
+
resolve135(new Response(body, { status: status2, statusText: res.statusMessage ?? "", headers: out2 }));
|
|
174742
174742
|
}
|
|
174743
174743
|
);
|
|
174744
174744
|
req.on("error", reject);
|
|
@@ -177213,22 +177213,22 @@ import { dirname as dirname36, join as join50 } from "node:path";
|
|
|
177213
177213
|
function noPlaywrightRemedy(platform = process.platform) {
|
|
177214
177214
|
return NO_PLAYWRIGHT_STEPS.join(platform === "win32" ? "\n" : " && ");
|
|
177215
177215
|
}
|
|
177216
|
-
function playwrightCliPath(
|
|
177216
|
+
function playwrightCliPath(resolve135) {
|
|
177217
177217
|
try {
|
|
177218
|
-
return join50(dirname36(
|
|
177218
|
+
return join50(dirname36(resolve135("playwright/package.json")), "cli.js");
|
|
177219
177219
|
} catch {
|
|
177220
177220
|
return void 0;
|
|
177221
177221
|
}
|
|
177222
177222
|
}
|
|
177223
|
-
function playwrightInstallCommand(
|
|
177224
|
-
const cli = playwrightCliPath(
|
|
177223
|
+
function playwrightInstallCommand(resolve135 = createRequire4(import.meta.url).resolve, platform = process.platform) {
|
|
177224
|
+
const cli = playwrightCliPath(resolve135);
|
|
177225
177225
|
if (!cli) return noPlaywrightRemedy(platform);
|
|
177226
177226
|
if (platform === "win32") return `node "${cli}" install chromium`;
|
|
177227
177227
|
return `node '${cli.replace(/'/g, "'\\''")}' install chromium`;
|
|
177228
177228
|
}
|
|
177229
177229
|
function browserReadiness(deps = {}) {
|
|
177230
177230
|
const require2 = createRequire4(import.meta.url);
|
|
177231
|
-
const
|
|
177231
|
+
const resolve135 = deps.resolve ?? require2.resolve;
|
|
177232
177232
|
const platform = deps.platform ?? process.platform;
|
|
177233
177233
|
const exists2 = deps.exists ?? existsSync58;
|
|
177234
177234
|
const readVersion = deps.readVersion ?? ((path2) => {
|
|
@@ -177241,7 +177241,7 @@ function browserReadiness(deps = {}) {
|
|
|
177241
177241
|
const chromiumPath = deps.chromiumPath ?? (() => require2("playwright").chromium.executablePath());
|
|
177242
177242
|
let pkg;
|
|
177243
177243
|
try {
|
|
177244
|
-
pkg =
|
|
177244
|
+
pkg = resolve135("playwright/package.json");
|
|
177245
177245
|
} catch {
|
|
177246
177246
|
return { ready: false, playwright: { installed: false }, chromium: { installed: false }, code: "browser_unavailable", fix: noPlaywrightRemedy(platform), fixSteps: [...NO_PLAYWRIGHT_STEPS] };
|
|
177247
177247
|
}
|
|
@@ -177261,8 +177261,8 @@ function browserReadiness(deps = {}) {
|
|
|
177261
177261
|
playwright,
|
|
177262
177262
|
chromium: { installed: false, ...executablePath ? { executablePath } : {} },
|
|
177263
177263
|
code: "browser_unavailable",
|
|
177264
|
-
fix: playwrightInstallCommand(
|
|
177265
|
-
fixSteps: [playwrightInstallCommand(
|
|
177264
|
+
fix: playwrightInstallCommand(resolve135, platform),
|
|
177265
|
+
fixSteps: [playwrightInstallCommand(resolve135, platform)]
|
|
177266
177266
|
};
|
|
177267
177267
|
}
|
|
177268
177268
|
function installChromium(deps = {}) {
|
|
@@ -179333,6 +179333,28 @@ var init_push_setup_apple_credentials = __esm({
|
|
|
179333
179333
|
}
|
|
179334
179334
|
});
|
|
179335
179335
|
|
|
179336
|
+
// ../../core/serve-control/src/setup/types.ts
|
|
179337
|
+
var PUSH_SETUP_STAGES, PUSH_SETUP_LEASE_MS;
|
|
179338
|
+
var init_types3 = __esm({
|
|
179339
|
+
"../../core/serve-control/src/setup/types.ts"() {
|
|
179340
|
+
init_define_HHP_CATALOG();
|
|
179341
|
+
PUSH_SETUP_STAGES = [
|
|
179342
|
+
"read_branded_record",
|
|
179343
|
+
"create_branded_record",
|
|
179344
|
+
"configure_branded_record",
|
|
179345
|
+
"migrate_branded_record",
|
|
179346
|
+
"write_build_secrets",
|
|
179347
|
+
"create_app_store_secrets",
|
|
179348
|
+
"save_push_credentials",
|
|
179349
|
+
"read_back_ping",
|
|
179350
|
+
// Android Google sign-in, after push setup has made the Firebase app.
|
|
179351
|
+
"write_certificate_fingerprint",
|
|
179352
|
+
"sync_android_client"
|
|
179353
|
+
];
|
|
179354
|
+
PUSH_SETUP_LEASE_MS = 5 * 6e4;
|
|
179355
|
+
}
|
|
179356
|
+
});
|
|
179357
|
+
|
|
179336
179358
|
// src/notify-errors.ts
|
|
179337
179359
|
var NOTIFY_FAILURE_CODES, notifyCode, login, tokenFrom, repair, NOTIFY_HINTS;
|
|
179338
179360
|
var init_notify_errors = __esm({
|
|
@@ -179654,7 +179676,9 @@ function renderPushStatus(http3, refresh = false) {
|
|
|
179654
179676
|
note: "Backend setup is separate from building the app, device registration and notification delivery."
|
|
179655
179677
|
};
|
|
179656
179678
|
}
|
|
179657
|
-
function report(http3, flags, io2, dir, config,
|
|
179679
|
+
function report(http3, flags, io2, dir, config, detail = {}) {
|
|
179680
|
+
const { withSignIn = false, withSteps = false } = detail;
|
|
179681
|
+
const steps = withSteps ? obj2(http3.body?.steps) : {};
|
|
179658
179682
|
const status2 = renderPushStatus(http3, flags.refresh === true);
|
|
179659
179683
|
const result = config && !config.pushOn ? { ...status2, ok: false, error: status2.error ?? (config.rolledBack ? "config_edit_rolled_back" : "config_push_not_on") } : status2;
|
|
179660
179684
|
const local = readPushOnboarding(dir).push;
|
|
@@ -179662,7 +179686,8 @@ function report(http3, flags, io2, dir, config, withSignIn = false) {
|
|
|
179662
179686
|
...result,
|
|
179663
179687
|
...local ? { localOnboarding: "deferred" } : {},
|
|
179664
179688
|
...config ? { config } : {},
|
|
179665
|
-
...withSignIn ? { signIn: renderSignInStatus(http3) } : {}
|
|
179689
|
+
...withSignIn ? { signIn: renderSignInStatus(http3) } : {},
|
|
179690
|
+
...withSteps && Object.keys(steps).length ? { steps } : {}
|
|
179666
179691
|
}, null, 2));
|
|
179667
179692
|
return result.ok ? 0 : 1;
|
|
179668
179693
|
}
|
|
@@ -179826,7 +179851,7 @@ async function runNotifySetup(pos, flags, io2, deps = {}) {
|
|
|
179826
179851
|
input.app = ownership.slug;
|
|
179827
179852
|
const common2 = { target, wixToken, previewTag, fetchImpl: deps.fetchImpl };
|
|
179828
179853
|
const readStatus2 = (live4 = false) => pushSetupRequest({ ...common2, operation: "status", query: { app: input.app, site: input.site, ...live4 ? { verify: "live" } : {} } });
|
|
179829
|
-
if (operation === "status") return report(await readStatus2(flags.refresh === true), flags, io2, dir, void 0, deps.withSignIn === true);
|
|
179854
|
+
if (operation === "status") return report(await readStatus2(flags.refresh === true), flags, io2, dir, void 0, { withSignIn: deps.withSignIn === true, withSteps: deps.withSteps === true });
|
|
179830
179855
|
const previous = await readStatus2();
|
|
179831
179856
|
if (!previous.ok || !STATES.has(String(previous.body?.state))) return report(previous, flags, io2, dir);
|
|
179832
179857
|
if (String(previous.body?.error ?? "").startsWith("apple_provisioning_outcome_unknown")) return refuse4(io2, "apple_provisioning_outcome_unknown", "Inspect the previous Apple operation before retrying.", 1);
|
|
@@ -179873,6 +179898,7 @@ var init_notify_setup = __esm({
|
|
|
179873
179898
|
init_define_HHP_CATALOG();
|
|
179874
179899
|
init_push_setup();
|
|
179875
179900
|
init_push_setup_apple_credentials();
|
|
179901
|
+
init_types3();
|
|
179876
179902
|
init_owner_claim();
|
|
179877
179903
|
init_hosted_owner();
|
|
179878
179904
|
init_notify_errors();
|
|
@@ -179884,7 +179910,7 @@ var init_notify_setup = __esm({
|
|
|
179884
179910
|
CHECK_STATES = /* @__PURE__ */ new Set(["verified", "missing", "mismatch", "unknown", "not_checked", "not_required"]);
|
|
179885
179911
|
SOCIAL_CHECKS = ["appleConnection", "appleCapability", "googleIos", "googleAndroid", "androidSha1"];
|
|
179886
179912
|
CODE = /^[a-z][a-z0-9_]{0,63}$/;
|
|
179887
|
-
STAGES =
|
|
179913
|
+
STAGES = new Set(PUSH_SETUP_STAGES);
|
|
179888
179914
|
ERROR_CODES = /* @__PURE__ */ new Set(["forbidden_site", "forbidden_cross_tenant", "unauthorized", "push_setup_unconfigured", "push_setup_unavailable", "already_running", "apple_provisioning_outcome_unknown", "ping_verification_unavailable", "bundle_id_changed", "site_already_claimed", "read_build_secrets_grant_missing"]);
|
|
179889
179915
|
PROMPTS = {
|
|
179890
179916
|
site: "Wix site ID (metaSiteId)",
|
|
@@ -181333,8 +181359,8 @@ function watchFlagConflict(opts) {
|
|
|
181333
181359
|
return null;
|
|
181334
181360
|
}
|
|
181335
181361
|
function rebuildBlocker(outcome, servedMissing) {
|
|
181336
|
-
const
|
|
181337
|
-
if (
|
|
181362
|
+
const failed2 = outcome.failedToBuild[0];
|
|
181363
|
+
if (failed2) return `${failed2.screenId}: ${failed2.error.split("\n")[0]}`;
|
|
181338
181364
|
const had = new Set(servedMissing.map((m2) => `${m2.screen}\0${m2.bundle}`));
|
|
181339
181365
|
const lost2 = outcome.missingBundles.find((m2) => !had.has(`${m2.screen}\0${m2.bundle}`));
|
|
181340
181366
|
if (lost2) return `${lost2.screen}: its worker bundle "${lost2.bundle}" is referenced but was not built`;
|
|
@@ -184739,14 +184765,14 @@ function parseSocialSignInConfig(configTs) {
|
|
|
184739
184765
|
if (!configTs.includes("socialSignIn")) return {};
|
|
184740
184766
|
const file2 = ts17.createSourceFile("config.ts", configTs, ts17.ScriptTarget.Latest, false, ts17.ScriptKind.TS);
|
|
184741
184767
|
const consts = collectConsts(file2);
|
|
184742
|
-
const
|
|
184768
|
+
const resolve135 = (e2, depth = 0) => {
|
|
184743
184769
|
while (e2 && (ts17.isAsExpression(e2) || ts17.isSatisfiesExpression(e2) || ts17.isParenthesizedExpression(e2))) e2 = e2.expression;
|
|
184744
|
-
return e2 && ts17.isIdentifier(e2) && depth < 8 ?
|
|
184770
|
+
return e2 && ts17.isIdentifier(e2) && depth < 8 ? resolve135(consts.get(e2.text), depth + 1) : e2;
|
|
184745
184771
|
};
|
|
184746
184772
|
const objectProp = (o2, name) => {
|
|
184747
184773
|
const p2 = o2.properties.filter((x2) => propName5(x2) === name).pop();
|
|
184748
184774
|
if (!p2) return void 0;
|
|
184749
|
-
return
|
|
184775
|
+
return resolve135(ts17.isPropertyAssignment(p2) ? p2.initializer : ts17.isShorthandPropertyAssignment(p2) ? p2.name : void 0);
|
|
184750
184776
|
};
|
|
184751
184777
|
const literal3 = (o2, name) => {
|
|
184752
184778
|
const v2 = objectProp(o2, name);
|
|
@@ -184755,7 +184781,7 @@ function parseSocialSignInConfig(configTs) {
|
|
|
184755
184781
|
let found = {};
|
|
184756
184782
|
const visit = (node3) => {
|
|
184757
184783
|
if ((ts17.isPropertyAssignment(node3) || ts17.isShorthandPropertyAssignment(node3)) && propName5(node3) === "socialSignIn") {
|
|
184758
|
-
const block =
|
|
184784
|
+
const block = resolve135(ts17.isPropertyAssignment(node3) ? node3.initializer : node3.name);
|
|
184759
184785
|
if (block && ts17.isObjectLiteralExpression(block)) {
|
|
184760
184786
|
const google = objectProp(block, "google");
|
|
184761
184787
|
found = google && ts17.isObjectLiteralExpression(google) ? { google: definedOnly({ iosClientId: literal3(google, "iosClientId"), serverClientId: literal3(google, "serverClientId") }) } : {};
|
|
@@ -190722,14 +190748,14 @@ function legacyImportSourceKinds(configTs) {
|
|
|
190722
190748
|
ts18.forEachChild(node3, collect2);
|
|
190723
190749
|
};
|
|
190724
190750
|
collect2(file2);
|
|
190725
|
-
const
|
|
190751
|
+
const resolve135 = (e2, depth = 0) => {
|
|
190726
190752
|
while (e2 && (ts18.isAsExpression(e2) || ts18.isSatisfiesExpression(e2) || ts18.isParenthesizedExpression(e2))) e2 = e2.expression;
|
|
190727
|
-
return e2 && ts18.isIdentifier(e2) && depth < 8 ?
|
|
190753
|
+
return e2 && ts18.isIdentifier(e2) && depth < 8 ? resolve135(consts.get(e2.text), depth + 1) : e2;
|
|
190728
190754
|
};
|
|
190729
|
-
const valueOf2 = (p2) => !p2 ? void 0 : ts18.isPropertyAssignment(p2) ?
|
|
190755
|
+
const valueOf2 = (p2) => !p2 ? void 0 : ts18.isPropertyAssignment(p2) ? resolve135(p2.initializer) : ts18.isShorthandPropertyAssignment(p2) ? resolve135(p2.name) : void 0;
|
|
190730
190756
|
const props2 = (o2, depth = 0) => o2.properties.flatMap((p2) => {
|
|
190731
190757
|
if (!ts18.isSpreadAssignment(p2)) return [p2];
|
|
190732
|
-
const inner =
|
|
190758
|
+
const inner = resolve135(p2.expression);
|
|
190733
190759
|
return inner && ts18.isObjectLiteralExpression(inner) && depth < 8 ? props2(inner, depth + 1) : [];
|
|
190734
190760
|
});
|
|
190735
190761
|
const prop2 = (o2, name) => props2(o2).filter((p2) => nameOf2(p2) === name).pop();
|
|
@@ -190741,11 +190767,11 @@ function legacyImportSourceKinds(configTs) {
|
|
|
190741
190767
|
if (sources && ts18.isArrayLiteralExpression(sources)) {
|
|
190742
190768
|
const flat2 = (els, depth = 0) => els.flatMap((x2) => {
|
|
190743
190769
|
if (!ts18.isSpreadElement(x2)) return [x2];
|
|
190744
|
-
const arr3 =
|
|
190770
|
+
const arr3 = resolve135(x2.expression);
|
|
190745
190771
|
return arr3 && ts18.isArrayLiteralExpression(arr3) && depth < 8 ? flat2(arr3.elements, depth + 1) : [];
|
|
190746
190772
|
});
|
|
190747
190773
|
for (const raw of flat2(sources.elements)) {
|
|
190748
|
-
const el2 =
|
|
190774
|
+
const el2 = resolve135(raw);
|
|
190749
190775
|
if (!el2 || !ts18.isObjectLiteralExpression(el2)) continue;
|
|
190750
190776
|
const kind = valueOf2(prop2(el2, "kind"));
|
|
190751
190777
|
if (kind && ts18.isStringLiteralLike(kind)) kinds.add(kind.text);
|
|
@@ -195150,7 +195176,7 @@ function commitChange(repo, base2, branch, rel2, body) {
|
|
|
195150
195176
|
return validationDiffHash(repo);
|
|
195151
195177
|
}
|
|
195152
195178
|
function runSelfTest() {
|
|
195153
|
-
let
|
|
195179
|
+
let failed2 = 0;
|
|
195154
195180
|
for (const testCase of SELF_TEST_CASES) {
|
|
195155
195181
|
let ok5 = false;
|
|
195156
195182
|
let thrown = null;
|
|
@@ -195164,12 +195190,12 @@ function runSelfTest() {
|
|
|
195164
195190
|
`);
|
|
195165
195191
|
continue;
|
|
195166
195192
|
}
|
|
195167
|
-
|
|
195193
|
+
failed2++;
|
|
195168
195194
|
process.stderr.write(` \u2717 ${testCase.name}
|
|
195169
195195
|
${thrown ?? testCase.reason}
|
|
195170
195196
|
`);
|
|
195171
195197
|
}
|
|
195172
|
-
return
|
|
195198
|
+
return failed2;
|
|
195173
195199
|
}
|
|
195174
195200
|
var VALIDATION_METADATA, SELF_TEST_CASES;
|
|
195175
195201
|
var init_diff_hash = __esm({
|
|
@@ -195250,10 +195276,10 @@ var init_diff_hash = __esm({
|
|
|
195250
195276
|
if (process.argv[1] && basename23(process.argv[1]) === "diff-hash.mjs" && import.meta.url === pathToFileURL7(process.argv[1]).href) {
|
|
195251
195277
|
if (process.argv.slice(2).includes("--self-test")) {
|
|
195252
195278
|
process.stdout.write("\u25B8 diff-hash --self-test: proving the identity can change, and can hold\n");
|
|
195253
|
-
const
|
|
195254
|
-
if (
|
|
195279
|
+
const failed2 = runSelfTest();
|
|
195280
|
+
if (failed2) {
|
|
195255
195281
|
process.stderr.write(
|
|
195256
|
-
`\u2717 diff-hash self-test FAILED (${
|
|
195282
|
+
`\u2717 diff-hash self-test FAILED (${failed2} case(s)) \u2014 the evidence record's diff identity cannot be trusted
|
|
195257
195283
|
`
|
|
195258
195284
|
);
|
|
195259
195285
|
process.exit(1);
|
|
@@ -196533,7 +196559,7 @@ async function pinnedFetch2(url, init, addresses, maxResponseBytes) {
|
|
|
196533
196559
|
const headers2 = Object.fromEntries(new Headers(init.headers).entries());
|
|
196534
196560
|
const request2 = url.protocol === "https:" ? httpsRequest2 : httpRequest;
|
|
196535
196561
|
const hostname8 = url.hostname.replace(/^\[|\]$/g, "");
|
|
196536
|
-
return await new Promise((
|
|
196562
|
+
return await new Promise((resolve135, reject) => {
|
|
196537
196563
|
let settled = false;
|
|
196538
196564
|
const finish3 = (fn2) => {
|
|
196539
196565
|
if (settled) return;
|
|
@@ -196570,7 +196596,7 @@ async function pinnedFetch2(url, init, addresses, maxResponseBytes) {
|
|
|
196570
196596
|
}
|
|
196571
196597
|
const responseHeaders = new Headers();
|
|
196572
196598
|
for (const [key4, value2] of Object.entries(response.headers)) if (value2 !== void 0) responseHeaders.set(key4, Array.isArray(value2) ? value2.join(", ") : value2);
|
|
196573
|
-
|
|
196599
|
+
resolve135(new Response(bytes2, { status: response.statusCode, statusText: response.statusMessage, headers: responseHeaders }));
|
|
196574
196600
|
}));
|
|
196575
196601
|
});
|
|
196576
196602
|
req.once("error", (error) => finish3(() => reject(error)));
|
|
@@ -196871,7 +196897,7 @@ function createLocalTestSandbox() {
|
|
|
196871
196897
|
}
|
|
196872
196898
|
})();
|
|
196873
196899
|
`;
|
|
196874
|
-
return await new Promise((
|
|
196900
|
+
return await new Promise((resolve135, reject) => {
|
|
196875
196901
|
const { port1, port2 } = new MessageChannel2();
|
|
196876
196902
|
const serializableContext = {
|
|
196877
196903
|
auth: context.auth,
|
|
@@ -196947,7 +196973,7 @@ function createLocalTestSandbox() {
|
|
|
196947
196973
|
timer = setTimeout(() => finish3(() => reject(new SandboxError("timeout", `execution exceeded ${limits.timeoutMs}ms`))), Math.max(1, limits.timeoutMs));
|
|
196948
196974
|
return;
|
|
196949
196975
|
}
|
|
196950
|
-
if (message5.ok) finish3(() =>
|
|
196976
|
+
if (message5.ok) finish3(() => resolve135({ value: message5.value, durationMs: Date.now() - started }));
|
|
196951
196977
|
else finish3(() => reject(new SandboxError("execution_failed", message5.message ?? "handler failed")));
|
|
196952
196978
|
});
|
|
196953
196979
|
worker.once("error", (error) => finish3(() => reject(new SandboxError("execution_failed", error.message))));
|
|
@@ -199012,12 +199038,12 @@ function createLoginSession(deps) {
|
|
|
199012
199038
|
current = pending2;
|
|
199013
199039
|
const out2 = [];
|
|
199014
199040
|
const err = [];
|
|
199015
|
-
return new Promise((
|
|
199041
|
+
return new Promise((resolve135) => {
|
|
199016
199042
|
let answered3 = false;
|
|
199017
199043
|
const answer = () => {
|
|
199018
199044
|
if (answered3) return;
|
|
199019
199045
|
answered3 = true;
|
|
199020
|
-
|
|
199046
|
+
resolve135(current);
|
|
199021
199047
|
};
|
|
199022
199048
|
let child3;
|
|
199023
199049
|
try {
|
|
@@ -199529,7 +199555,7 @@ function relaunchWithoutSystemCa(deps = {}, plan = planSystemCaRelaunch({
|
|
|
199529
199555
|
const kill = deps.kill ?? ((s5) => process.kill(process.pid, s5));
|
|
199530
199556
|
const on4 = deps.on ?? ((s5, h2) => void process.on(s5, h2));
|
|
199531
199557
|
const off = deps.off ?? ((s5, h2) => void process.off(s5, h2));
|
|
199532
|
-
return new Promise((
|
|
199558
|
+
return new Promise((resolve135) => {
|
|
199533
199559
|
const child3 = start2(plan);
|
|
199534
199560
|
const handlers = FORWARDED.map((signal) => {
|
|
199535
199561
|
const handler = () => void child3.kill(signal);
|
|
@@ -199543,7 +199569,7 @@ function relaunchWithoutSystemCa(deps = {}, plan = planSystemCaRelaunch({
|
|
|
199543
199569
|
if (spawned)
|
|
199544
199570
|
return;
|
|
199545
199571
|
detach();
|
|
199546
|
-
|
|
199572
|
+
resolve135();
|
|
199547
199573
|
});
|
|
199548
199574
|
child3.once("exit", (code3, signal) => {
|
|
199549
199575
|
detach();
|
|
@@ -199891,7 +199917,7 @@ var init_lock = __esm({
|
|
|
199891
199917
|
await rm(guard, { recursive: true, force: true });
|
|
199892
199918
|
if (attempt2 > 200)
|
|
199893
199919
|
throw new Error(`lock ${lockName(key4)} guard is busy`);
|
|
199894
|
-
await new Promise((
|
|
199920
|
+
await new Promise((resolve135) => setTimeout(resolve135, 5));
|
|
199895
199921
|
}
|
|
199896
199922
|
}
|
|
199897
199923
|
try {
|
|
@@ -200120,7 +200146,7 @@ var init_transport = __esm({
|
|
|
200120
200146
|
this.baseUrl = checkBaseUrl(options2.baseUrl);
|
|
200121
200147
|
this.fetchImpl = options2.fetch ?? ((input, init) => globalThis.fetch(input, init));
|
|
200122
200148
|
this.now = options2.now ?? Date.now;
|
|
200123
|
-
this.sleep = options2.sleep ?? ((ms2) => new Promise((
|
|
200149
|
+
this.sleep = options2.sleep ?? ((ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2)));
|
|
200124
200150
|
this.random = options2.random ?? Math.random;
|
|
200125
200151
|
this.retry = { ...DEFAULT_RETRY, ...options2.retry };
|
|
200126
200152
|
this.readOnly = options2.readOnly ?? { enabled: false, source: "" };
|
|
@@ -200886,7 +200912,7 @@ async function loginWithOAuthClient(options2) {
|
|
|
200886
200912
|
const challenge = createHash46("sha256").update(verifier2).digest("base64url");
|
|
200887
200913
|
const state = randomBytes5(16).toString("hex");
|
|
200888
200914
|
let redirect = "";
|
|
200889
|
-
const code3 = await new Promise((
|
|
200915
|
+
const code3 = await new Promise((resolve135, reject) => {
|
|
200890
200916
|
const finish3 = (error, value2) => {
|
|
200891
200917
|
clearTimeout(timer);
|
|
200892
200918
|
options2.signal?.removeEventListener("abort", onAbort);
|
|
@@ -200895,7 +200921,7 @@ async function loginWithOAuthClient(options2) {
|
|
|
200895
200921
|
if (error)
|
|
200896
200922
|
reject(error);
|
|
200897
200923
|
else
|
|
200898
|
-
|
|
200924
|
+
resolve135(value2);
|
|
200899
200925
|
};
|
|
200900
200926
|
const server = createServer4((req, res) => {
|
|
200901
200927
|
const url = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
@@ -200988,7 +201014,7 @@ var init_auth2 = __esm({
|
|
|
200988
201014
|
return { token: body.access_token, expiresAt: now() + (typeof body.expires_in === "number" ? body.expires_in : 3600) * 1e3 };
|
|
200989
201015
|
}
|
|
200990
201016
|
};
|
|
200991
|
-
execCommand = (command, args, options2 = {}) => new Promise((
|
|
201017
|
+
execCommand = (command, args, options2 = {}) => new Promise((resolve135, reject) => {
|
|
200992
201018
|
const child3 = spawn7(command, args, { stdio: options2.inherit ? "inherit" : ["pipe", "pipe", "pipe"], env: options2.env });
|
|
200993
201019
|
let stdout = "";
|
|
200994
201020
|
let stderr = "";
|
|
@@ -200997,7 +201023,7 @@ var init_auth2 = __esm({
|
|
|
200997
201023
|
child3.stdin?.on("error", () => void 0);
|
|
200998
201024
|
child3.stdin?.end(options2.input ?? "");
|
|
200999
201025
|
child3.on("error", reject);
|
|
201000
|
-
child3.on("close", (code3) =>
|
|
201026
|
+
child3.on("close", (code3) => resolve135({ code: code3 ?? 1, stdout, stderr }));
|
|
201001
201027
|
});
|
|
201002
201028
|
GOOGLE_OAUTH_HOSTS = /* @__PURE__ */ new Set(["accounts.google.com", HOSTS.oauth]);
|
|
201003
201029
|
FileCredentialStore = class {
|
|
@@ -202319,10 +202345,10 @@ async function connectGoogle(opts) {
|
|
|
202319
202345
|
let consoleNote;
|
|
202320
202346
|
const pending2 = openConsole(opts.console.launch, { reauth: opts.console.reauth, waitMs: opts.waitMs, notify: opts.notify }, opts.consoleIo);
|
|
202321
202347
|
let abort;
|
|
202322
|
-
const aborted = new Promise((
|
|
202323
|
-
abort = () =>
|
|
202348
|
+
const aborted = new Promise((resolve135) => {
|
|
202349
|
+
abort = () => resolve135("aborted");
|
|
202324
202350
|
if (opts.signal?.aborted)
|
|
202325
|
-
|
|
202351
|
+
resolve135("aborted");
|
|
202326
202352
|
else
|
|
202327
202353
|
opts.signal?.addEventListener("abort", abort, { once: true });
|
|
202328
202354
|
});
|
|
@@ -213462,7 +213488,7 @@ var init_transport2 = __esm({
|
|
|
213462
213488
|
}
|
|
213463
213489
|
async acquire() {
|
|
213464
213490
|
if (this.active >= this.size)
|
|
213465
|
-
await new Promise((
|
|
213491
|
+
await new Promise((resolve135) => this.waiting.push(resolve135));
|
|
213466
213492
|
this.active++;
|
|
213467
213493
|
return () => {
|
|
213468
213494
|
this.active--;
|
|
@@ -213499,7 +213525,7 @@ var init_transport2 = __esm({
|
|
|
213499
213525
|
this.origin = base2.origin;
|
|
213500
213526
|
this.fetchImpl = options2.fetch ?? ((input, init) => globalThis.fetch(input, init));
|
|
213501
213527
|
this.now = options2.now ?? Date.now;
|
|
213502
|
-
this.sleep = options2.sleep ?? ((ms2) => new Promise((
|
|
213528
|
+
this.sleep = options2.sleep ?? ((ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2)));
|
|
213503
213529
|
this.random = options2.random ?? Math.random;
|
|
213504
213530
|
this.retry = { ...DEFAULT_RETRY, ...options2.retry };
|
|
213505
213531
|
this.readOnly = options2.readOnly ?? { enabled: false, source: "" };
|
|
@@ -214465,7 +214491,7 @@ var init_rate_budget = __esm({
|
|
|
214465
214491
|
constructor(options2 = { ...APPLE_HOURLY_BUDGET }) {
|
|
214466
214492
|
this.options = options2;
|
|
214467
214493
|
this.now = options2.now ?? Date.now;
|
|
214468
|
-
this.sleep = options2.sleep ?? ((ms2) => new Promise((
|
|
214494
|
+
this.sleep = options2.sleep ?? ((ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2)));
|
|
214469
214495
|
}
|
|
214470
214496
|
take(issuerId, cost = 1) {
|
|
214471
214497
|
if (cost > this.options.capacity)
|
|
@@ -214515,11 +214541,11 @@ var init_run = __esm({
|
|
|
214515
214541
|
"../../node_modules/@wix/asc-core/dist/providers/run.js"() {
|
|
214516
214542
|
init_define_HHP_CATALOG();
|
|
214517
214543
|
({ execFile: execFile2 } = __ascBuiltin037);
|
|
214518
|
-
runQuiet = (command, args, options2 = {}) => new Promise((
|
|
214544
|
+
runQuiet = (command, args, options2 = {}) => new Promise((resolve135, reject) => {
|
|
214519
214545
|
const child3 = execFile2(command, args, { encoding: "utf8", maxBuffer: 64 * 1024 * 1024, windowsHide: true, timeout: 12e4 }, (e2, stdout, stderr) => {
|
|
214520
214546
|
if (e2)
|
|
214521
214547
|
return reject(Object.assign(new Error(`${command} failed`), { code: e2.code ?? e2.code, hadStderr: Boolean(stderr?.trim()) }));
|
|
214522
|
-
|
|
214548
|
+
resolve135(options2.stderr ? `${stdout}${stderr}` : stdout);
|
|
214523
214549
|
});
|
|
214524
214550
|
child3.stdin?.on("error", () => void 0);
|
|
214525
214551
|
child3.stdin?.end(options2.input ?? "");
|
|
@@ -214948,8 +214974,8 @@ var init_keychain = __esm({
|
|
|
214948
214974
|
init_jwt();
|
|
214949
214975
|
init_credentials();
|
|
214950
214976
|
({ execFile: execFile3 } = __ascBuiltin039);
|
|
214951
|
-
runSecurity = (command, args, options2 = {}) => new Promise((
|
|
214952
|
-
const child3 = execFile3(command, args, { encoding: "utf8", maxBuffer: 256 * 1024 * 1024 }, (error, stdout) => error ? reject(error) :
|
|
214977
|
+
runSecurity = (command, args, options2 = {}) => new Promise((resolve135, reject) => {
|
|
214978
|
+
const child3 = execFile3(command, args, { encoding: "utf8", maxBuffer: 256 * 1024 * 1024 }, (error, stdout) => error ? reject(error) : resolve135(stdout));
|
|
214953
214979
|
if (options2.input !== void 0)
|
|
214954
214980
|
child3.stdin?.end(options2.input);
|
|
214955
214981
|
});
|
|
@@ -215751,7 +215777,7 @@ var init_session_lock = __esm({
|
|
|
215751
215777
|
GUARD_STALE_MS = 1e4;
|
|
215752
215778
|
unusable = (dir, e2) => new SessionLockError(`could not lock the web session under ${dir} (${code(e2) ?? "error"}); fix or remove that directory and retry`);
|
|
215753
215779
|
code = (e2) => e2?.code;
|
|
215754
|
-
sleep3 = (ms2) => new Promise((
|
|
215780
|
+
sleep3 = (ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2));
|
|
215755
215781
|
baseName = (key4) => `session-${createHash60("sha256").update(key4).digest("hex")}`;
|
|
215756
215782
|
isStale3 = ({ holder, ageMs }, staleMs) => ageMs > staleMs || Number.isInteger(holder.pid) && holder.host === hostname4() && !isAlive(holder.pid);
|
|
215757
215783
|
isPartSet = (p2) => typeof p2?.id === "string" && /^[0-9a-f]+$/.test(p2.id) && Number.isInteger(p2.count) && p2.count >= 1 && p2.count <= 1e3;
|
|
@@ -215806,7 +215832,7 @@ var init_pacing = __esm({
|
|
|
215806
215832
|
now;
|
|
215807
215833
|
sleep;
|
|
215808
215834
|
next = 0;
|
|
215809
|
-
constructor(intervalMs, now = Date.now, sleep4 = (ms2) => new Promise((
|
|
215835
|
+
constructor(intervalMs, now = Date.now, sleep4 = (ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2))) {
|
|
215810
215836
|
this.intervalMs = intervalMs;
|
|
215811
215837
|
this.now = now;
|
|
215812
215838
|
this.sleep = sleep4;
|
|
@@ -216178,8 +216204,8 @@ var init_session = __esm({
|
|
|
216178
216204
|
async delete() {
|
|
216179
216205
|
}
|
|
216180
216206
|
};
|
|
216181
|
-
runCommand = (command, args, options2 = {}) => new Promise((
|
|
216182
|
-
const child3 = execFile4(command, args, { encoding: "utf8" }, (e2, out2) => e2 ? reject(Object.assign(new Error("the command failed"), { code: e2.code })) :
|
|
216207
|
+
runCommand = (command, args, options2 = {}) => new Promise((resolve135, reject) => {
|
|
216208
|
+
const child3 = execFile4(command, args, { encoding: "utf8" }, (e2, out2) => e2 ? reject(Object.assign(new Error("the command failed"), { code: e2.code })) : resolve135(out2));
|
|
216183
216209
|
child3.stdin?.on("error", () => void 0);
|
|
216184
216210
|
child3.stdin?.end(options2.input ?? "");
|
|
216185
216211
|
});
|
|
@@ -216371,10 +216397,10 @@ var init_session = __esm({
|
|
|
216371
216397
|
byId2.set(set3.id, { id: set3.id, count: Math.max(set3.count, byId2.get(set3.id)?.count ?? 0) });
|
|
216372
216398
|
const left = [];
|
|
216373
216399
|
for (const set3 of byId2.values()) {
|
|
216374
|
-
let
|
|
216400
|
+
let failed2 = false;
|
|
216375
216401
|
for (let n2 = 0; n2 < set3.count; n2++)
|
|
216376
|
-
await this.remove(this.chunkAccount(appleId, set3.id, n2)).catch(() => void (
|
|
216377
|
-
if (
|
|
216402
|
+
await this.remove(this.chunkAccount(appleId, set3.id, n2)).catch(() => void (failed2 = true));
|
|
216403
|
+
if (failed2)
|
|
216378
216404
|
left.push(set3);
|
|
216379
216405
|
}
|
|
216380
216406
|
return left;
|
|
@@ -216435,11 +216461,11 @@ function newSigninBackoff(error, now) {
|
|
|
216435
216461
|
};
|
|
216436
216462
|
}
|
|
216437
216463
|
function signinBackoffUntil(record5, now) {
|
|
216438
|
-
const
|
|
216464
|
+
const failed2 = Date.parse(record5.failedAt ?? "");
|
|
216439
216465
|
const until = Date.parse(record5.notBefore ?? "");
|
|
216440
|
-
if (Number.isNaN(
|
|
216466
|
+
if (Number.isNaN(failed2) || Number.isNaN(until) || failed2 > now)
|
|
216441
216467
|
return void 0;
|
|
216442
|
-
const capped = Math.min(until,
|
|
216468
|
+
const capped = Math.min(until, failed2 + MAX_SIGNIN_BACKOFF_MS);
|
|
216443
216469
|
return now < capped ? capped : void 0;
|
|
216444
216470
|
}
|
|
216445
216471
|
var createHash62, randomBytes15, chmod4, mkdir17, readFile17, rename7, rm9, writeFile13, join120, DEFAULT_SIGNIN_BACKOFF_MS, MAX_SIGNIN_BACKOFF_MS, VERSION, newer, SigninBackoffStore;
|
|
@@ -219398,13 +219424,13 @@ var init_iris = __esm({
|
|
|
219398
219424
|
await this.ensureTeam();
|
|
219399
219425
|
const url = new URL(path2, this.options.developerBase ?? this.options.ascBase ?? DEVELOPER);
|
|
219400
219426
|
const where = `${method} ${url.pathname}`;
|
|
219401
|
-
const
|
|
219427
|
+
const failed2 = (why, kind = init.write ? "uncertain" : "network") => new AscError(kind, `${where} ${why}${kind === "uncertain" ? " \u2014 it may have reached Apple; re-read before retrying" : ""}`);
|
|
219402
219428
|
const scrub = (e2) => scrubSecrets(e2.message, this.jar.cookies.map((c2) => c2.value));
|
|
219403
219429
|
let res;
|
|
219404
219430
|
try {
|
|
219405
219431
|
res = await this.send(url, { method, headers: { ...init.headers, Cookie: this.jar.header(url) }, ...init.body !== void 0 ? { body: init.body } : {}, redirect: "manual" });
|
|
219406
219432
|
} catch (e2) {
|
|
219407
|
-
throw
|
|
219433
|
+
throw failed2(`failed before a response: ${scrub(e2)}`);
|
|
219408
219434
|
}
|
|
219409
219435
|
this.absorb(url, res.headers);
|
|
219410
219436
|
const location = res.headers.get("location") ?? "";
|
|
@@ -219421,7 +219447,7 @@ var init_iris = __esm({
|
|
|
219421
219447
|
} else
|
|
219422
219448
|
text32 = await res.text();
|
|
219423
219449
|
} catch (e2) {
|
|
219424
|
-
throw
|
|
219450
|
+
throw failed2(`\u2192 ${res.status}, but the response could not be read: ${scrub(e2)}`);
|
|
219425
219451
|
}
|
|
219426
219452
|
return { status: res.status, headers: res.headers, text: text32, ...bytes2 ? { bytes: bytes2 } : {} };
|
|
219427
219453
|
}
|
|
@@ -220295,7 +220321,7 @@ var init_util4 = __esm({
|
|
|
220295
220321
|
init_define_HHP_CATALOG();
|
|
220296
220322
|
init_dist3();
|
|
220297
220323
|
({ createHash: createHash63 } = __ascBuiltin045);
|
|
220298
|
-
realClock = { now: Date.now, sleep: (ms2) => new Promise((
|
|
220324
|
+
realClock = { now: Date.now, sleep: (ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2)) };
|
|
220299
220325
|
md5 = (bytes2) => createHash63("md5").update(bytes2).digest("hex");
|
|
220300
220326
|
}
|
|
220301
220327
|
});
|
|
@@ -220768,7 +220794,7 @@ var init_review = __esm({
|
|
|
220768
220794
|
*/
|
|
220769
220795
|
async waitUntilDone(appRef2, options2 = {}) {
|
|
220770
220796
|
const now = options2.now ?? Date.now;
|
|
220771
|
-
const sleep4 = options2.sleep ?? ((ms2) => new Promise((
|
|
220797
|
+
const sleep4 = options2.sleep ?? ((ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2)));
|
|
220772
220798
|
const interval = options2.intervalMs ?? 6e4;
|
|
220773
220799
|
const deadline = now() + (options2.timeoutMs ?? 30 * 6e4);
|
|
220774
220800
|
for (; ; ) {
|
|
@@ -223810,11 +223836,11 @@ var init_validate2 = __esm({
|
|
|
223810
223836
|
for (const set3 of flatList((await this.t.list(`/v1/appStoreVersionLocalizations/${loc.id}/appPreviewSets`)).data)) {
|
|
223811
223837
|
const previews = flatList((await this.t.list(`/v1/appPreviewSets/${set3.id}/appPreviews`)).data);
|
|
223812
223838
|
const states = previews.map((p2) => [p2.fileName, p2.videoDeliveryState?.state ?? p2.assetDeliveryState?.state, p2.assetDeliveryState?.state]);
|
|
223813
|
-
const
|
|
223839
|
+
const failed2 = states.filter(([, video, asset]) => video === "FAILED" || asset === "FAILED").map(([name]) => name);
|
|
223814
223840
|
const waiting = states.filter(([, video, asset]) => video !== "FAILED" && asset !== "FAILED" && video !== "COMPLETE").map(([name]) => name);
|
|
223815
223841
|
const base2 = { locale: loc.locale, field: "previews", resourceType: "appPreviewSet", resourceId: set3.id };
|
|
223816
|
-
if (
|
|
223817
|
-
checks.push({ ...base2, id: "readiness.previews.failed", severity: "error", message: `${loc.locale} ${set3.previewType} holds ${
|
|
223842
|
+
if (failed2.length)
|
|
223843
|
+
checks.push({ ...base2, id: "readiness.previews.failed", severity: "error", message: `${loc.locale} ${set3.previewType} holds ${failed2.length} preview(s) that failed processing: ${failed2.join(", ")}`, remediation: "Replace them: asc-node previews apply" });
|
|
223818
223844
|
if (waiting.length)
|
|
223819
223845
|
checks.push({ ...base2, id: "readiness.previews.processing", severity: "warning", message: `${loc.locale} ${set3.previewType} holds ${waiting.length} preview(s) that have not finished processing: ${waiting.join(", ")}`, remediation: "Wait for them to finish, then validate again; if one stays there, replace it: asc-node previews apply" });
|
|
223820
223846
|
}
|
|
@@ -223858,9 +223884,9 @@ var init_validate2 = __esm({
|
|
|
223858
223884
|
checks.push({ id: "readiness.required.description", severity: "error", locale: loc.locale, field: "description", resourceType: "appStoreVersionLocalization", resourceId: loc.id, message: `the ${loc.locale} description is empty`, remediation: "Write the description: asc-node metadata apply" });
|
|
223859
223885
|
const sets = flatList((await this.t.list(`/v1/appStoreVersionLocalizations/${loc.id}/appScreenshotSets`)).data);
|
|
223860
223886
|
for (const set3 of sets) {
|
|
223861
|
-
const
|
|
223862
|
-
if (
|
|
223863
|
-
checks.push({ id: "readiness.screenshots.failed", severity: "error", locale: loc.locale, field: "screenshots", resourceType: "appScreenshotSet", resourceId: set3.id, message: `${loc.locale} ${set3.screenshotDisplayType} holds ${
|
|
223887
|
+
const failed2 = flatList((await this.t.list(`/v1/appScreenshotSets/${set3.id}/appScreenshots`)).data).filter((s5) => s5.assetDeliveryState?.state === "FAILED").length;
|
|
223888
|
+
if (failed2)
|
|
223889
|
+
checks.push({ id: "readiness.screenshots.failed", severity: "error", locale: loc.locale, field: "screenshots", resourceType: "appScreenshotSet", resourceId: set3.id, message: `${loc.locale} ${set3.screenshotDisplayType} holds ${failed2} screenshot(s) that failed processing`, remediation: "Delete or replace them: asc-node screenshots apply" });
|
|
223864
223890
|
}
|
|
223865
223891
|
const isPrimary2 = !app2.primaryLocale || loc.locale.toLowerCase() === app2.primaryLocale.toLowerCase();
|
|
223866
223892
|
sawIphone ||= sets.some((s5) => s5.screenshotDisplayType.startsWith("APP_IPHONE_"));
|
|
@@ -225000,13 +225026,13 @@ var init_actions_release = __esm({
|
|
|
225000
225026
|
const existing = attempts.find((u2) => u2.state?.state !== "FAILED");
|
|
225001
225027
|
if (existing?.state?.state === "COMPLETE")
|
|
225002
225028
|
return noop("buildUploads", `build ${buildNumber} already uploaded`);
|
|
225003
|
-
const
|
|
225029
|
+
const failed2 = attempts.filter((u2) => u2.state?.state === "FAILED");
|
|
225004
225030
|
return {
|
|
225005
225031
|
changes: [{ op: existing ? "update" : "create", resource: "buildUploads", id: existing?.id, summary: existing ? `resume upload ${existing.id} (${existing.state?.state})` : `upload ${p2.ipa.path} as ${version5} (${buildNumber})` }],
|
|
225006
225032
|
sideEffects: [
|
|
225007
225033
|
"the build number is used up for this version even if processing fails",
|
|
225008
225034
|
...ipaNotes(ipa),
|
|
225009
|
-
...
|
|
225035
|
+
...failed2.length && !existing ? [`an earlier upload of this build (${failed2.map((u2) => u2.id).join(", ")}) is FAILED; it is not reused: a new upload is made, and Apple says if the number is used up`] : []
|
|
225010
225036
|
],
|
|
225011
225037
|
facts: { existing: existing?.id ?? null, state: existing?.state?.state ?? null, supportsIpad: ipa.supportsIpad, version: version5, buildNumber }
|
|
225012
225038
|
};
|
|
@@ -226752,16 +226778,16 @@ var init_actions_team = __esm({
|
|
|
226752
226778
|
async apply({ api: api4 }, _p, plan) {
|
|
226753
226779
|
const steps = plan.facts.steps;
|
|
226754
226780
|
const done = [];
|
|
226755
|
-
const
|
|
226781
|
+
const failed2 = [];
|
|
226756
226782
|
const errors = [];
|
|
226757
226783
|
await Promise.all(steps.map((s5) => api4.availability.setTerritory(s5.id, s5.change).then(() => void done.push(s5.territory), (e2) => {
|
|
226758
226784
|
errors.push(e2);
|
|
226759
|
-
|
|
226785
|
+
failed2.push(`${s5.territory}: ${e2.message.split("\n")[0]}`);
|
|
226760
226786
|
})));
|
|
226761
|
-
if (
|
|
226787
|
+
if (failed2.length && !done.length)
|
|
226762
226788
|
throw errors[0];
|
|
226763
|
-
if (
|
|
226764
|
-
throw new AscError("uncertain", `changed ${done.sort().join(", ")}; not confirmed: ${
|
|
226789
|
+
if (failed2.length)
|
|
226790
|
+
throw new AscError("uncertain", `changed ${done.sort().join(", ")}; not confirmed: ${failed2.join("; ")} \u2014 re-plan to see what Apple holds`);
|
|
226765
226791
|
return { ids: steps.map((s5) => s5.id), detail: `${steps.length} territor${steps.length === 1 ? "y" : "ies"} changed: ${steps.map(stepText).join("; ")}` };
|
|
226766
226792
|
},
|
|
226767
226793
|
async verify({ api: api4 }, p2, plan) {
|
|
@@ -230758,9 +230784,9 @@ async function takeDownload(keys2, target, recovery, said) {
|
|
|
230758
230784
|
throw e2;
|
|
230759
230785
|
}
|
|
230760
230786
|
if (e2 instanceof KeyDownloadUnusableError) {
|
|
230761
|
-
const
|
|
230762
|
-
if (
|
|
230763
|
-
throw new AscError("server", `${said}, but ${e2.message}, and keeping its raw bytes in ${recovery.path} failed (${
|
|
230787
|
+
const failed2 = recovery.keep(e2.takeRaw());
|
|
230788
|
+
if (failed2)
|
|
230789
|
+
throw new AscError("server", `${said}, but ${e2.message}, and keeping its raw bytes in ${recovery.path} failed (${failed2}); that file may be partial: inspect it (it is 0600), and if it holds no key, ${revoke}`);
|
|
230764
230790
|
throw new AscError("server", `${said}, but ${e2.message}. Apple may count that as its one download, so the raw bytes are kept, unprinted, in ${recovery.path} (0600): inspect that file before anything else; if it holds no key, ${revoke}`);
|
|
230765
230791
|
}
|
|
230766
230792
|
if (e2 instanceof WebAuthError) {
|
|
@@ -230777,10 +230803,10 @@ async function takeDownload(keys2, target, recovery, said) {
|
|
|
230777
230803
|
try {
|
|
230778
230804
|
file2.write(pem);
|
|
230779
230805
|
} catch (e2) {
|
|
230780
|
-
const
|
|
230806
|
+
const failed2 = recovery.keep(Buffer.from(pem, "utf8"));
|
|
230781
230807
|
const removed = file2.release();
|
|
230782
230808
|
const partial = removed ? "the partial file was removed" : `the partial file ${file2.path} could not be removed: delete it`;
|
|
230783
|
-
throw new AscError("server", `${said} and downloaded, but writing ${file2.path} failed (${e2.code ?? "write error"}); ${partial}; ${
|
|
230809
|
+
throw new AscError("server", `${said} and downloaded, but writing ${file2.path} failed (${e2.code ?? "write error"}); ${partial}; ${failed2 ? `keeping it in ${recovery.path} failed too (${failed2}), so the private key is lost: ${revoke}` : `the private key is in ${recovery.path} (0600) instead: move it to ${file2.path}`}`);
|
|
230784
230810
|
}
|
|
230785
230811
|
recovery.discard();
|
|
230786
230812
|
return file2.path;
|
|
@@ -232493,9 +232519,9 @@ var init_messages_code = __esm({
|
|
|
232493
232519
|
}
|
|
232494
232520
|
};
|
|
232495
232521
|
isPrivacyError = (message5) => ["unable to open database file", "authorization denied", "operation not permitted", "not authorized", "permission denied"].some((m2) => message5.toLowerCase().includes(m2));
|
|
232496
|
-
systemSqliteQuery = (db, sql) => new Promise((
|
|
232522
|
+
systemSqliteQuery = (db, sql) => new Promise((resolve135, reject) => {
|
|
232497
232523
|
const uri = `${pathToFileURL8(db).href}?mode=ro`;
|
|
232498
|
-
execFile5(SYSTEM_SQLITE, ["-readonly", "-batch", "-noheader", "-list", "-separator", "|", "-cmd", ".timeout 2000", uri, sql], { encoding: "utf8", maxBuffer: 32 * 1024 * 1024 }, (e2, out2, err) => e2 ? reject(new Error(err?.trim() || `sqlite3 failed (exit ${String(e2.code ?? "?")})`)) :
|
|
232524
|
+
execFile5(SYSTEM_SQLITE, ["-readonly", "-batch", "-noheader", "-list", "-separator", "|", "-cmd", ".timeout 2000", uri, sql], { encoding: "utf8", maxBuffer: 32 * 1024 * 1024 }, (e2, out2, err) => e2 ? reject(new Error(err?.trim() || `sqlite3 failed (exit ${String(e2.code ?? "?")})`)) : resolve135(out2));
|
|
232499
232525
|
});
|
|
232500
232526
|
}
|
|
232501
232527
|
});
|
|
@@ -233059,7 +233085,7 @@ function sameOriginPost(req, origin) {
|
|
|
233059
233085
|
return (sent === void 0 || sent === "null") && req.headers["sec-fetch-site"] === "same-origin";
|
|
233060
233086
|
}
|
|
233061
233087
|
function readBody3(req) {
|
|
233062
|
-
return new Promise((
|
|
233088
|
+
return new Promise((resolve135, reject) => {
|
|
233063
233089
|
const chunks = [];
|
|
233064
233090
|
let size = 0;
|
|
233065
233091
|
req.on("data", (c2) => {
|
|
@@ -233070,7 +233096,7 @@ function readBody3(req) {
|
|
|
233070
233096
|
}
|
|
233071
233097
|
chunks.push(c2);
|
|
233072
233098
|
});
|
|
233073
|
-
req.on("end", () =>
|
|
233099
|
+
req.on("end", () => resolve135(Buffer.concat(chunks).toString("utf8")));
|
|
233074
233100
|
req.on("error", reject);
|
|
233075
233101
|
});
|
|
233076
233102
|
}
|
|
@@ -233082,21 +233108,21 @@ async function startConnectServer(opts) {
|
|
|
233082
233108
|
const prefix = `/c/${token}`;
|
|
233083
233109
|
const startedAt = now();
|
|
233084
233110
|
let settle3;
|
|
233085
|
-
const done = new Promise((
|
|
233086
|
-
settle3 =
|
|
233111
|
+
const done = new Promise((resolve135) => {
|
|
233112
|
+
settle3 = resolve135;
|
|
233087
233113
|
});
|
|
233088
233114
|
let closed;
|
|
233089
233115
|
let hostHeader = "";
|
|
233090
233116
|
let origin = "";
|
|
233091
|
-
const send2 = (res, status2, html = "", page = true, extra = {}) => new Promise((
|
|
233117
|
+
const send2 = (res, status2, html = "", page = true, extra = {}) => new Promise((resolve135) => {
|
|
233092
233118
|
if (res.destroyed || res.socket === null || res.socket.destroyed) {
|
|
233093
|
-
|
|
233119
|
+
resolve135();
|
|
233094
233120
|
return;
|
|
233095
233121
|
}
|
|
233096
|
-
res.once("error", () =>
|
|
233122
|
+
res.once("error", () => resolve135());
|
|
233097
233123
|
res.writeHead(status2, { ...page ? PAGE_HEADERS : { "Content-Type": "text/plain; charset=utf-8", "Cache-Control": "no-store" }, ...extra });
|
|
233098
|
-
res.once("close", () =>
|
|
233099
|
-
res.end(html, () =>
|
|
233124
|
+
res.once("close", () => resolve135());
|
|
233125
|
+
res.end(html, () => resolve135());
|
|
233100
233126
|
});
|
|
233101
233127
|
let busy2 = false;
|
|
233102
233128
|
let consumed = false;
|
|
@@ -233183,11 +233209,11 @@ async function startConnectServer(opts) {
|
|
|
233183
233209
|
}
|
|
233184
233210
|
})();
|
|
233185
233211
|
});
|
|
233186
|
-
await new Promise((
|
|
233212
|
+
await new Promise((resolve135, reject) => {
|
|
233187
233213
|
server.once("error", reject);
|
|
233188
233214
|
server.listen(0, "127.0.0.1", () => {
|
|
233189
233215
|
server.off("error", reject);
|
|
233190
|
-
|
|
233216
|
+
resolve135();
|
|
233191
233217
|
});
|
|
233192
233218
|
});
|
|
233193
233219
|
const port = server.address().port;
|
|
@@ -233214,12 +233240,12 @@ async function startConnectServer(opts) {
|
|
|
233214
233240
|
timer.unref();
|
|
233215
233241
|
function close() {
|
|
233216
233242
|
closing = true;
|
|
233217
|
-
closed ??= new Promise((
|
|
233243
|
+
closed ??= new Promise((resolve135) => {
|
|
233218
233244
|
clearTimeout(timer);
|
|
233219
233245
|
if (grace)
|
|
233220
233246
|
clearTimeout(grace);
|
|
233221
233247
|
settle3("expired");
|
|
233222
|
-
server.close(() =>
|
|
233248
|
+
server.close(() => resolve135());
|
|
233223
233249
|
server.closeAllConnections();
|
|
233224
233250
|
});
|
|
233225
233251
|
return closed;
|
|
@@ -233237,8 +233263,8 @@ async function startConnectServer(opts) {
|
|
|
233237
233263
|
if (maxWaitMs === void 0 || !inflight)
|
|
233238
233264
|
return drained;
|
|
233239
233265
|
let cap2;
|
|
233240
|
-
const late = new Promise((
|
|
233241
|
-
cap2 = setTimeout(() =>
|
|
233266
|
+
const late = new Promise((resolve135) => {
|
|
233267
|
+
cap2 = setTimeout(() => resolve135(false), maxWaitMs);
|
|
233242
233268
|
cap2.unref();
|
|
233243
233269
|
});
|
|
233244
233270
|
try {
|
|
@@ -233314,11 +233340,11 @@ function startAttempt(input) {
|
|
|
233314
233340
|
stop2.abort();
|
|
233315
233341
|
take()?.reject(new Cancelled());
|
|
233316
233342
|
},
|
|
233317
|
-
next: () => new Promise((
|
|
233343
|
+
next: () => new Promise((resolve135) => {
|
|
233318
233344
|
if (attempt2.outcome || attempt2.prompt)
|
|
233319
|
-
|
|
233345
|
+
resolve135();
|
|
233320
233346
|
else
|
|
233321
|
-
wake =
|
|
233347
|
+
wake = resolve135;
|
|
233322
233348
|
})
|
|
233323
233349
|
};
|
|
233324
233350
|
attempt2.settled = signIn({
|
|
@@ -233329,10 +233355,10 @@ function startAttempt(input) {
|
|
|
233329
233355
|
twoFactorMethod: input.sms ? "sms" : "auto",
|
|
233330
233356
|
...input.sms && input.phoneId !== void 0 ? { phoneId: input.phoneId } : {},
|
|
233331
233357
|
previous: input.previous,
|
|
233332
|
-
twoFactorCode: (prompt2) => new Promise((
|
|
233358
|
+
twoFactorCode: (prompt2) => new Promise((resolve135, reject) => {
|
|
233333
233359
|
if (stop2.signal.aborted)
|
|
233334
233360
|
return reject(new Cancelled());
|
|
233335
|
-
pending2 = { resolve:
|
|
233361
|
+
pending2 = { resolve: resolve135, reject };
|
|
233336
233362
|
attempt2.prompt = prompt2;
|
|
233337
233363
|
changed();
|
|
233338
233364
|
})
|
|
@@ -233605,10 +233631,10 @@ async function runConnectFlow(opts) {
|
|
|
233605
233631
|
await Promise.all([...live4].map((a3) => a3.settled));
|
|
233606
233632
|
};
|
|
233607
233633
|
let cancelled = false;
|
|
233608
|
-
const stopped = new Promise((
|
|
233634
|
+
const stopped = new Promise((resolve135) => {
|
|
233609
233635
|
const stop2 = () => {
|
|
233610
233636
|
cancelled = true;
|
|
233611
|
-
|
|
233637
|
+
resolve135();
|
|
233612
233638
|
};
|
|
233613
233639
|
if (opts.signal?.aborted)
|
|
233614
233640
|
stop2();
|
|
@@ -235499,7 +235525,7 @@ import * as __ascBuiltin142 from "node:os";
|
|
|
235499
235525
|
import * as __ascBuiltin222 from "node:path";
|
|
235500
235526
|
import * as __ascBuiltin38 from "node:fs";
|
|
235501
235527
|
function runForCode(command, env, requestedAt) {
|
|
235502
|
-
return new Promise((
|
|
235528
|
+
return new Promise((resolve135, reject) => execFile6("/bin/sh", ["-c", command], { encoding: "utf8", timeout: 5 * 6e4, env: { ...env, ASC_WEB_2FA_CODE_REQUESTED_AT: requestedAt.toISOString() } }, (e2, out2, err) => e2 ? reject(new Error(codeCommandFailure(e2.code, err))) : resolve135(out2.trim())));
|
|
235503
235529
|
}
|
|
235504
235530
|
function codeCommandFailure(exit, stderr) {
|
|
235505
235531
|
const line = (stderr ?? "").split(/\r?\n/).map((l3) => l3.trim()).filter(Boolean).pop() ?? "";
|
|
@@ -236854,16 +236880,16 @@ var init_commands_agreements = __esm({
|
|
|
236854
236880
|
]);
|
|
236855
236881
|
const notRead = [];
|
|
236856
236882
|
const failures = [];
|
|
236857
|
-
const
|
|
236883
|
+
const failed2 = (source2, e2) => {
|
|
236858
236884
|
notRead.push({ source: source2, error: e2.message });
|
|
236859
236885
|
failures.push(e2);
|
|
236860
236886
|
};
|
|
236861
236887
|
if (portal.status === "rejected")
|
|
236862
|
-
|
|
236888
|
+
failed2("developer portal agreements", portal.reason);
|
|
236863
236889
|
if (banner.status === "rejected")
|
|
236864
|
-
|
|
236890
|
+
failed2("App Store Connect agreement banner", banner.reason);
|
|
236865
236891
|
if (business.status === "rejected")
|
|
236866
|
-
|
|
236892
|
+
failed2("App Store Connect Business agreements", business.reason);
|
|
236867
236893
|
const contractMessages = banner.status === "fulfilled" ? banner.value : [];
|
|
236868
236894
|
const waiting = (business.status === "fulfilled" ? business.value : []).filter(needsAction).map((b3) => ({ name: b3.contractDisplayName ?? b3.contractId, contract: b3.contractId, status: b3.status, inEffect: b3.isInEffect, ...b3.availableNewContractConfigId ? { newConfiguration: b3.availableNewContractConfigId } : {} }));
|
|
236869
236895
|
const all = portal.status === "fulfilled" ? portal.value.all : [];
|
|
@@ -237231,10 +237257,10 @@ var init_commands_team = __esm({
|
|
|
237231
237257
|
options: { app: { type: "string" }, available: { type: "string", multiple: true }, unavailable: { type: "string", multiple: true }, "pre-orders-off": { type: "boolean" }, ...writeOptions },
|
|
237232
237258
|
async run(inv) {
|
|
237233
237259
|
const available = list2(inv, "available", true);
|
|
237234
|
-
const
|
|
237235
|
-
if (!available.length && !
|
|
237260
|
+
const unavailable2 = list2(inv, "unavailable", true);
|
|
237261
|
+
if (!available.length && !unavailable2.length && !inv.opts["pre-orders-off"])
|
|
237236
237262
|
throw new UsageError("pass --available, --unavailable or --pre-orders-off");
|
|
237237
|
-
return write2(inv, "app.availability", { appId: await appId2(inv), ...available.length ? { available } : {}, ...
|
|
237263
|
+
return write2(inv, "app.availability", { appId: await appId2(inv), ...available.length ? { available } : {}, ...unavailable2.length ? { unavailable: unavailable2 } : {}, ...inv.opts["pre-orders-off"] ? { preOrdersOff: true } : {} });
|
|
237238
237264
|
}
|
|
237239
237265
|
},
|
|
237240
237266
|
// ---- Users --------------------------------------------------------------------------------
|
|
@@ -238307,7 +238333,7 @@ async function startCallback(timeoutMs) {
|
|
|
238307
238333
|
const path2 = `/callback/${b64url3(randomBytes18(16))}`;
|
|
238308
238334
|
let expected;
|
|
238309
238335
|
let settle3;
|
|
238310
|
-
const result = new Promise((
|
|
238336
|
+
const result = new Promise((resolve135, reject) => settle3 = { resolve: resolve135, reject });
|
|
238311
238337
|
result.catch(() => {
|
|
238312
238338
|
});
|
|
238313
238339
|
const page = (status2, text32) => ({ status: status2, body: `<!doctype html><meta charset="utf-8"><title>asc-node</title><p>${text32}</p>` });
|
|
@@ -238334,7 +238360,7 @@ async function startCallback(timeoutMs) {
|
|
|
238334
238360
|
send2(page(200, "Signed in. You can close this tab and go back to the terminal."));
|
|
238335
238361
|
settle3.resolve(code3);
|
|
238336
238362
|
});
|
|
238337
|
-
await new Promise((
|
|
238363
|
+
await new Promise((resolve135) => server.listen(0, "127.0.0.1", resolve135));
|
|
238338
238364
|
const port = server.address().port;
|
|
238339
238365
|
const timer = setTimeout(() => settle3.reject(new AscError("auth", `sign-in to the worker's gateway was not finished within ${Math.round(timeoutMs / 1e3)}s`)), timeoutMs);
|
|
238340
238366
|
timer.unref?.();
|
|
@@ -238343,7 +238369,7 @@ async function startCallback(timeoutMs) {
|
|
|
238343
238369
|
code: (state) => (expected = state, result),
|
|
238344
238370
|
close: () => {
|
|
238345
238371
|
clearTimeout(timer);
|
|
238346
|
-
return new Promise((
|
|
238372
|
+
return new Promise((resolve135) => (server.closeAllConnections(), server.close(() => resolve135())));
|
|
238347
238373
|
}
|
|
238348
238374
|
};
|
|
238349
238375
|
}
|
|
@@ -238782,7 +238808,7 @@ var init_context = __esm({
|
|
|
238782
238808
|
onRequest: options2.onRequest
|
|
238783
238809
|
});
|
|
238784
238810
|
const pollMs = Number(this.io.env.ASC_POLL_MS) || void 0;
|
|
238785
|
-
return new AscApi(transport, { pollMs, mediaTimeoutMs: resolveMediaTimeoutMs(this.io.env), clock: { now: this.io.now ?? Date.now, sleep: this.io.sleep ?? ((ms2) => new Promise((
|
|
238811
|
+
return new AscApi(transport, { pollMs, mediaTimeoutMs: resolveMediaTimeoutMs(this.io.env), clock: { now: this.io.now ?? Date.now, sleep: this.io.sleep ?? ((ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2))) } });
|
|
238786
238812
|
}
|
|
238787
238813
|
async api(options2 = {}) {
|
|
238788
238814
|
if (this.worker)
|
|
@@ -243434,7 +243460,7 @@ var init_store_android = __esm({
|
|
|
243434
243460
|
}
|
|
243435
243461
|
}
|
|
243436
243462
|
const planned2 = jobs.filter((j2) => j2.status === "planned");
|
|
243437
|
-
const
|
|
243463
|
+
const failed2 = jobs.filter((j2) => j2.status === "planFailed");
|
|
243438
243464
|
const complete = !todo(steps).length && !fromRecord?.stale;
|
|
243439
243465
|
return ok2({
|
|
243440
243466
|
platform: "android",
|
|
@@ -243447,7 +243473,7 @@ var init_store_android = __esm({
|
|
|
243447
243473
|
jobs,
|
|
243448
243474
|
complete,
|
|
243449
243475
|
...fromRecord ? fromRecord.view : {},
|
|
243450
|
-
next: !todo(steps).length ? `${driftNote(fromRecord?.drift ?? [])}${staleNote(fromRecord)}${nothingLeft(fromRecord)}` : `${driftNote(fromRecord?.drift ?? [])}${staleNote(fromRecord)}${planned2.length ? `Show the person each job's changes and plan hash. store_apply (platform android, jobId, planHash, confirm: true) applies one job, asking the person to approve it; apply them in the order listed, then call store_plan again. ` : ""}${
|
|
243476
|
+
next: !todo(steps).length ? `${driftNote(fromRecord?.drift ?? [])}${staleNote(fromRecord)}${nothingLeft(fromRecord)}` : `${driftNote(fromRecord?.drift ?? [])}${staleNote(fromRecord)}${planned2.length ? `Show the person each job's changes and plan hash. store_apply (platform android, jobId, planHash, confirm: true) applies one job, asking the person to approve it; apply them in the order listed, then call store_plan again. ` : ""}${failed2.length ? `${failed2.length} job(s) could not be planned (see their error). ` : ""}Steps with owner: true are not planned here; who says who does them and how.`
|
|
243451
243477
|
});
|
|
243452
243478
|
},
|
|
243453
243479
|
async apply(google, ctx, a3, call, ref) {
|
|
@@ -243883,8 +243909,8 @@ async function appleStatus(a3, base2, host) {
|
|
|
243883
243909
|
}
|
|
243884
243910
|
} else
|
|
243885
243911
|
out2.unknown.push("medical device: unknown \u2014 needs a web session", "App Privacy: unknown \u2014 needs a web session");
|
|
243886
|
-
const
|
|
243887
|
-
const incomplete =
|
|
243912
|
+
const failed2 = Object.keys(out2.errors);
|
|
243913
|
+
const incomplete = failed2.length || out2.unknown.length ? `This status is incomplete: ${[...failed2.map((k3) => `${k3} could not be read`), ...out2.unknown.map((u2) => u2.replace(/: unknown — (.*)$/s, " unknown ($1)"))].join("; ")}. ` : "";
|
|
243888
243914
|
out2.complete = !incomplete;
|
|
243889
243915
|
out2.next = `${incomplete}${out2.unknown.some((u2) => /needs a web session/.test(u2)) ? "Call store_connect so the person signs in; then store_status can read the medical device answer and App Privacy." : out2.gaps.length ? "store_plan plans what it can of these; the rest needs the person (or the app's facts)." : incomplete ? "Nothing that could be read blocks a submission; look at errors before relying on it." : "Nothing blocks a submission: store_plan plans it."}`;
|
|
243890
243916
|
return recorded(ok2(out2));
|
|
@@ -243910,14 +243936,14 @@ async function applePlan(a3, base2, host) {
|
|
|
243910
243936
|
if (!plan.lines.length)
|
|
243911
243937
|
return ok2({ batch: null, ...view, ...fromRecord?.read && plan.complete && !fromRecord.stale ? { next: `${lead}Per the record (${fromRecord.ages}) and the steps planned live, ${plan.next.charAt(0).toLowerCase()}${plan.next.slice(1)}` } : {} });
|
|
243912
243938
|
const { batch, files, session } = await planOrdered(ctx, plan.lines, appleId);
|
|
243913
|
-
const
|
|
243939
|
+
const failed2 = batch.items.filter((i2) => i2.status === "planFailed");
|
|
243914
243940
|
return ok2({
|
|
243915
243941
|
batch: batch.id,
|
|
243916
243942
|
planHash: batch.planHash,
|
|
243917
243943
|
ordered: true,
|
|
243918
243944
|
lines: linesView(batch),
|
|
243919
243945
|
...view,
|
|
243920
|
-
...
|
|
243946
|
+
...failed2.length ? { next: `${lead}A line could not be planned (${failed2.map((i2) => `${i2.key}: ${i2.error}`).join("; ")}); fix it and call store_plan again. Do not apply this batch.` } : {},
|
|
243921
243947
|
...files.length || factFiles.length ? { files: [...factFiles.map((f2) => ({ line: "facts", ...f2 })), ...files] } : {},
|
|
243922
243948
|
...session ? { webSession: { appleId: session.appleId, team: session.teamName ?? session.team } } : {}
|
|
243923
243949
|
});
|
|
@@ -244084,9 +244110,9 @@ A submission can take more than one batch: after store_apply, call store_plan ag
|
|
|
244084
244110
|
const lineProfile = planned2.items.find((i2) => i2.account?.profile)?.account.profile;
|
|
244085
244111
|
if (!a3.profile && lineProfile)
|
|
244086
244112
|
ctx = withArgs(base2, { profile: lineProfile, appleId: a3.appleId });
|
|
244087
|
-
const
|
|
244088
|
-
if (
|
|
244089
|
-
throw new AscError("invalid", `batch ${a3.batchId} has lines that could not be planned, so nothing was asked or applied: ${
|
|
244113
|
+
const failed2 = planned2.ordered ? planned2.items.filter((i2) => i2.status === "planFailed") : [];
|
|
244114
|
+
if (failed2.length)
|
|
244115
|
+
throw new AscError("invalid", `batch ${a3.batchId} has lines that could not be planned, so nothing was asked or applied: ${failed2.map((i2) => `${i2.key}: ${i2.error}`).join("; ")}. Call store_plan again`);
|
|
244090
244116
|
const batch = await applyBatchAsking(ctx, { batchId: a3.batchId, planHash: a3.planHash }, call);
|
|
244091
244117
|
const was = new Map(planned2.items.map((i2) => [i2.key, i2.status]));
|
|
244092
244118
|
const verified2 = host.record ? batch.items.filter((i2) => i2.status === "verified" && was.get(i2.key) !== "verified" && i2.jobId).map((i2) => i2.jobId) : [];
|
|
@@ -244170,9 +244196,9 @@ A submission can take more than one batch: after store_apply, call store_plan ag
|
|
|
244170
244196
|
{ key: "resubmit", action: "submission.submit", params: { appId: app2.id } }
|
|
244171
244197
|
];
|
|
244172
244198
|
const { batch, files } = await planOrdered(ctx, lines2, a3.appleId);
|
|
244173
|
-
const
|
|
244174
|
-
if (
|
|
244175
|
-
throw new AscError("invalid", `the reply batch could not be planned, so nothing was asked or sent: ${
|
|
244199
|
+
const failed2 = batch.items.filter((i2) => i2.status === "planFailed");
|
|
244200
|
+
if (failed2.length)
|
|
244201
|
+
throw new AscError("invalid", `the reply batch could not be planned, so nothing was asked or sent: ${failed2.map((i2) => `${i2.action}: ${i2.error}`).join("; ")}`);
|
|
244176
244202
|
if (batch.items.every((i2) => i2.status === "noop"))
|
|
244177
244203
|
return ok2({ ...batchReport(batch), lines: linesView(batch), next: "The reply was already sent and the app is already submitted: nothing to do." });
|
|
244178
244204
|
const sendsReply = batch.items[0].status === "planned";
|
|
@@ -244598,6 +244624,115 @@ var init_store_iap_purchases = __esm({
|
|
|
244598
244624
|
}
|
|
244599
244625
|
});
|
|
244600
244626
|
|
|
244627
|
+
// src/iap-setup/snapshot.ts
|
|
244628
|
+
async function readIapSetup(api4) {
|
|
244629
|
+
return { apps: await api4.listApps() };
|
|
244630
|
+
}
|
|
244631
|
+
function appForBundle(snapshot4, bundleId) {
|
|
244632
|
+
return snapshot4.apps.find((app2) => app2.bundleId === bundleId);
|
|
244633
|
+
}
|
|
244634
|
+
var init_snapshot = __esm({
|
|
244635
|
+
"src/iap-setup/snapshot.ts"() {
|
|
244636
|
+
init_define_HHP_CATALOG();
|
|
244637
|
+
}
|
|
244638
|
+
});
|
|
244639
|
+
|
|
244640
|
+
// src/iap-setup/step.ts
|
|
244641
|
+
function failedStep(what, error) {
|
|
244642
|
+
return { state: "failed", code: "request_failed", detail: `could not ${what}: ${error instanceof Error ? error.message : String(error)}` };
|
|
244643
|
+
}
|
|
244644
|
+
var init_step = __esm({
|
|
244645
|
+
"src/iap-setup/step.ts"() {
|
|
244646
|
+
init_define_HHP_CATALOG();
|
|
244647
|
+
}
|
|
244648
|
+
});
|
|
244649
|
+
|
|
244650
|
+
// src/iap-setup/purchases-app.ts
|
|
244651
|
+
function checkPurchasesApp(input, snapshot4) {
|
|
244652
|
+
const app2 = appForBundle(snapshot4, input.bundleId);
|
|
244653
|
+
return app2 ? { state: "ready", detail: `purchases app ${app2.id}` } : { state: "missing", code: "no_purchases_app", detail: `no purchases app for ${input.bundleId} on this site` };
|
|
244654
|
+
}
|
|
244655
|
+
async function applyPurchasesApp(api4, input, options2) {
|
|
244656
|
+
const { bundleId, name, site } = input;
|
|
244657
|
+
const existing = appForBundle(options2.snapshot ?? await readIapSetup(api4), bundleId);
|
|
244658
|
+
if (existing) return { app: existing, step: { state: "reused", detail: `purchases app ${existing.id} for ${bundleId} on site ${site}` } };
|
|
244659
|
+
if (!options2.apply) return { step: { state: "planned", detail: `register ${bundleId} on site ${site}` } };
|
|
244660
|
+
try {
|
|
244661
|
+
const app2 = await api4.registerApp({ name, bundleId });
|
|
244662
|
+
return { app: app2, step: { state: "done", detail: `registered purchases app ${app2.id} for ${bundleId} on site ${site}` } };
|
|
244663
|
+
} catch (error) {
|
|
244664
|
+
if (refusalCode(error) !== "ALREADY_EXISTS") return { step: failedStep("register the app", error) };
|
|
244665
|
+
let apps;
|
|
244666
|
+
try {
|
|
244667
|
+
apps = await api4.listApps();
|
|
244668
|
+
} catch (rereadError) {
|
|
244669
|
+
return { step: failedStep("re-read the site's purchases apps after the bundle was reported registered", rereadError) };
|
|
244670
|
+
}
|
|
244671
|
+
const raced = apps.find((app2) => app2.bundleId === bundleId);
|
|
244672
|
+
if (raced) return { app: raced, step: { state: "reused", detail: `purchases app ${raced.id} for ${bundleId} on site ${site}` } };
|
|
244673
|
+
return {
|
|
244674
|
+
step: {
|
|
244675
|
+
state: "conflict",
|
|
244676
|
+
code: "bundle_registered_elsewhere",
|
|
244677
|
+
detail: `${bundleId} is already registered to another app, on another site (this site has none for it). A bundle id belongs to one purchases app platform-wide; only the owner of that registration can remove it. Nothing was changed.`
|
|
244678
|
+
}
|
|
244679
|
+
};
|
|
244680
|
+
}
|
|
244681
|
+
}
|
|
244682
|
+
var init_purchases_app = __esm({
|
|
244683
|
+
"src/iap-setup/purchases-app.ts"() {
|
|
244684
|
+
init_define_HHP_CATALOG();
|
|
244685
|
+
init_store_iap_purchases();
|
|
244686
|
+
init_snapshot();
|
|
244687
|
+
init_step();
|
|
244688
|
+
}
|
|
244689
|
+
});
|
|
244690
|
+
|
|
244691
|
+
// src/iap-setup/iap-key.ts
|
|
244692
|
+
function checkIapKey(input, snapshot4) {
|
|
244693
|
+
const app2 = appForBundle(snapshot4, input.bundleId);
|
|
244694
|
+
if (!app2) return { state: "missing", code: "no_purchases_app", detail: "no purchases app to hold the key" };
|
|
244695
|
+
return app2.privateKeyStored ? { state: "ready" } : { state: "missing", code: "apple_key_missing", detail: "the purchases app has no In-App Purchase key" };
|
|
244696
|
+
}
|
|
244697
|
+
async function keepIapKey(deps, app2, apply2) {
|
|
244698
|
+
if (app2.privateKeyStored) return { state: "reused", detail: "an In-App Purchase key is already stored" };
|
|
244699
|
+
if (!deps.appleKey) return iapKeyPlan(deps);
|
|
244700
|
+
if (!apply2) return iapKeyPlan(deps);
|
|
244701
|
+
try {
|
|
244702
|
+
await deps.api.setAppleCredentials(app2.id, deps.appleKey);
|
|
244703
|
+
return { state: "done", detail: "stored the In-App Purchase key" };
|
|
244704
|
+
} catch (error) {
|
|
244705
|
+
return failedStep("store the In-App Purchase key", error);
|
|
244706
|
+
}
|
|
244707
|
+
}
|
|
244708
|
+
function iapKeyPlan(deps) {
|
|
244709
|
+
if (!deps.appleKey && deps.serverKeyOnly) return {
|
|
244710
|
+
state: "blocked",
|
|
244711
|
+
code: "apple_key_missing",
|
|
244712
|
+
detail: "The purchases app has no In-App Purchase key. Run himi store apple-keys setup --app <slug> --site <metaSiteId> --bundle-id <id> --iap-key <AuthKey.p8> --iap-key-id <id> --iap-issuer-id <issuer> --yes, then rerun connect. An App Store Connect API key cannot replace this credential."
|
|
244713
|
+
};
|
|
244714
|
+
return deps.appleKey ? { state: "planned", detail: "store the In-App Purchase key" } : {
|
|
244715
|
+
state: "blocked",
|
|
244716
|
+
code: "apple_key_missing",
|
|
244717
|
+
detail: "no In-App Purchase key: create one in App Store Connect \u2192 Users and Access \u2192 Integrations \u2192 In-App Purchase, then run himi store apple-keys setup with --iap-key <AuthKey.p8> --iap-key-id <key id> --iap-issuer-id <issuer>, or rerun legacy connect with its key flags (an App Store Connect API key is rejected)."
|
|
244718
|
+
};
|
|
244719
|
+
}
|
|
244720
|
+
async function replaceIapKey(api4, app2, key4) {
|
|
244721
|
+
await api4.setAppleCredentials(app2.id, key4);
|
|
244722
|
+
}
|
|
244723
|
+
async function confirmIapKey(api4, bundleId) {
|
|
244724
|
+
const confirmed = appForBundle(await readIapSetup(api4), bundleId);
|
|
244725
|
+
if (!confirmed?.privateKeyStored) throw new Error("IAP key not confirmed");
|
|
244726
|
+
return confirmed;
|
|
244727
|
+
}
|
|
244728
|
+
var init_iap_key = __esm({
|
|
244729
|
+
"src/iap-setup/iap-key.ts"() {
|
|
244730
|
+
init_define_HHP_CATALOG();
|
|
244731
|
+
init_snapshot();
|
|
244732
|
+
init_step();
|
|
244733
|
+
}
|
|
244734
|
+
});
|
|
244735
|
+
|
|
244601
244736
|
// src/apple-keys.ts
|
|
244602
244737
|
var apple_keys_exports = {};
|
|
244603
244738
|
__export(apple_keys_exports, {
|
|
@@ -244673,7 +244808,7 @@ async function runAppleKeys(pos, flags, io2, deps = {}) {
|
|
|
244673
244808
|
if (ascKey && iapKey && publicKeyBytes(ascKey.key).equals(publicKeyBytes(iapKey.key))) throw new UsageError2("ASC and In-App Purchase require separate keys.");
|
|
244674
244809
|
let asc = { present: null, state: "not_checked" };
|
|
244675
244810
|
let iap = { present: null, state: "not_checked" };
|
|
244676
|
-
let
|
|
244811
|
+
let failed2 = false;
|
|
244677
244812
|
if (ascKey || !setup) {
|
|
244678
244813
|
try {
|
|
244679
244814
|
asc = await ascKeyRequest(owner.session, { app: app2, site, ...ascKey && !dryRun ? { key: ascKey } : {} }, deps.fetchImpl ?? fetch);
|
|
@@ -244683,40 +244818,36 @@ async function runAppleKeys(pos, flags, io2, deps = {}) {
|
|
|
244683
244818
|
}
|
|
244684
244819
|
} catch {
|
|
244685
244820
|
asc = { present: null, state: "unavailable" };
|
|
244686
|
-
|
|
244821
|
+
failed2 = true;
|
|
244687
244822
|
}
|
|
244688
244823
|
}
|
|
244689
244824
|
let purchasesAppId = null;
|
|
244690
244825
|
if (iapKey || !setup) {
|
|
244691
244826
|
try {
|
|
244692
244827
|
const api4 = createPurchasesOwnerApi((deps.purchases ?? ((id) => ownerTransport(id, (url, init) => (deps.fetchImpl ?? fetch)(url, { ...init, redirect: "error" }), void 0, userSiteToken)))(site));
|
|
244693
|
-
|
|
244828
|
+
const snapshot4 = await readIapSetup(api4);
|
|
244829
|
+
let purchasesApp = appForBundle(snapshot4, bundleId);
|
|
244694
244830
|
if (iapKey && !dryRun) {
|
|
244695
244831
|
if (!purchasesApp) {
|
|
244696
|
-
|
|
244697
|
-
|
|
244698
|
-
|
|
244699
|
-
|
|
244700
|
-
if (refusalCode(error) !== "ALREADY_EXISTS") throw error;
|
|
244701
|
-
purchasesApp = (await api4.listApps()).find((candidate) => candidate.bundleId === bundleId);
|
|
244702
|
-
if (!purchasesApp) throw error;
|
|
244703
|
-
}
|
|
244832
|
+
const registered = await applyPurchasesApp(api4, { site, bundleId, name: text15(flags["display-name"]) ?? app2 }, { apply: true, snapshot: snapshot4 });
|
|
244833
|
+
if (!registered.app) throw new Error(registered.step.detail);
|
|
244834
|
+
if (registered.step.state === "done") completed.push("purchases_app");
|
|
244835
|
+
purchasesApp = registered.app;
|
|
244704
244836
|
}
|
|
244705
244837
|
purchasesAppId = purchasesApp.id;
|
|
244706
|
-
await api4
|
|
244838
|
+
await replaceIapKey(api4, purchasesApp, { keyId: iapKey.keyId, issuerId: iapKey.issuerId, privateKey: iapKey.key });
|
|
244707
244839
|
completed.push("iap");
|
|
244708
|
-
purchasesApp =
|
|
244709
|
-
if (!purchasesApp?.privateKeyStored) throw new Error("IAP key not confirmed");
|
|
244840
|
+
purchasesApp = await confirmIapKey(api4, bundleId);
|
|
244710
244841
|
}
|
|
244711
244842
|
iap = { present: purchasesApp?.privateKeyStored === true };
|
|
244712
244843
|
purchasesAppId = purchasesApp?.id ?? null;
|
|
244713
244844
|
} catch {
|
|
244714
244845
|
iap = { present: null, state: "unavailable" };
|
|
244715
|
-
|
|
244846
|
+
failed2 = true;
|
|
244716
244847
|
}
|
|
244717
244848
|
}
|
|
244718
244849
|
const result = {
|
|
244719
|
-
ok: !
|
|
244850
|
+
ok: !failed2,
|
|
244720
244851
|
app: app2,
|
|
244721
244852
|
site,
|
|
244722
244853
|
bundleId,
|
|
@@ -244724,12 +244855,12 @@ async function runAppleKeys(pos, flags, io2, deps = {}) {
|
|
|
244724
244855
|
iap,
|
|
244725
244856
|
ready: asc.present === true && iap.present === true,
|
|
244726
244857
|
purchasesAppId,
|
|
244727
|
-
...
|
|
244858
|
+
...failed2 ? { code: "apple_keys_failed", hint: "Read apple-keys status before retrying; completed writes remain stored." } : {},
|
|
244728
244859
|
...dryRun ? { dryRun: true, planned: [...ascKey ? ["asc"] : [], ...iapKey ? ["iap"] : []] } : {},
|
|
244729
244860
|
completed
|
|
244730
244861
|
};
|
|
244731
|
-
(
|
|
244732
|
-
return
|
|
244862
|
+
(failed2 ? io2.error : io2.log)(JSON.stringify(result));
|
|
244863
|
+
return failed2 ? 1 : 0;
|
|
244733
244864
|
} catch (error) {
|
|
244734
244865
|
const usage2 = error instanceof UsageError2;
|
|
244735
244866
|
io2.error(JSON.stringify({
|
|
@@ -244747,6 +244878,9 @@ var init_apple_keys = __esm({
|
|
|
244747
244878
|
init_define_HHP_CATALOG();
|
|
244748
244879
|
init_hosted_owner();
|
|
244749
244880
|
init_store_iap_purchases();
|
|
244881
|
+
init_snapshot();
|
|
244882
|
+
init_purchases_app();
|
|
244883
|
+
init_iap_key();
|
|
244750
244884
|
init_wix_owner();
|
|
244751
244885
|
init_preflight();
|
|
244752
244886
|
init_push_setup_apple_credentials();
|
|
@@ -246173,8 +246307,8 @@ function track(p2) {
|
|
|
246173
246307
|
void p2.then(() => busy.delete(p2), () => busy.delete(p2));
|
|
246174
246308
|
}
|
|
246175
246309
|
function queueStoreRecordSync(app2, fold2, run4) {
|
|
246176
|
-
return new Promise((
|
|
246177
|
-
const waiter = { resolve:
|
|
246310
|
+
return new Promise((resolve135, reject) => {
|
|
246311
|
+
const waiter = { resolve: resolve135, reject };
|
|
246178
246312
|
const queue = syncQueues.get(app2);
|
|
246179
246313
|
if (queue) {
|
|
246180
246314
|
const waiting = queue.slice(1).find((e2) => e2.fold === fold2);
|
|
@@ -246758,9 +246892,9 @@ async function startMcpServer(opts) {
|
|
|
246758
246892
|
root: deps.defaultDir,
|
|
246759
246893
|
currentRoot: () => rootDir || opts.workspace || process.cwd()
|
|
246760
246894
|
});
|
|
246761
|
-
const closed = new Promise((
|
|
246762
|
-
stdin.once("end",
|
|
246763
|
-
stdin.once("close",
|
|
246895
|
+
const closed = new Promise((resolve135) => {
|
|
246896
|
+
stdin.once("end", resolve135);
|
|
246897
|
+
stdin.once("close", resolve135);
|
|
246764
246898
|
});
|
|
246765
246899
|
const handle = serveStdio(
|
|
246766
246900
|
() => {
|
|
@@ -246968,8 +247102,8 @@ __export(input_evidence_isolation_exports, {
|
|
|
246968
247102
|
});
|
|
246969
247103
|
async function installInputEvidenceIsolation(dir) {
|
|
246970
247104
|
const { lstatSync: lstatSync44, readdirSync: readdirSync68, readlinkSync: readlinkSync4, realpathSync: realpathSync27 } = await import("node:fs");
|
|
246971
|
-
const { dirname: dirname92, isAbsolute: isAbsolute23, join: join215, relative: relative40, resolve:
|
|
246972
|
-
const root =
|
|
247105
|
+
const { dirname: dirname92, isAbsolute: isAbsolute23, join: join215, relative: relative40, resolve: resolve135, sep: sep37 } = await import("node:path");
|
|
247106
|
+
const root = resolve135(dir);
|
|
246973
247107
|
const privateDir = join215(root, ".himi");
|
|
246974
247108
|
const privateReal = join215(realpathSync27(root), ".himi") + sep37;
|
|
246975
247109
|
const within2 = (base2, path2) => {
|
|
@@ -246982,12 +247116,12 @@ async function installInputEvidenceIsolation(dir) {
|
|
|
246982
247116
|
if (path2 === recording) {
|
|
246983
247117
|
const link4 = readlinkSync4(path2);
|
|
246984
247118
|
if (isAbsolute23(link4)) return false;
|
|
246985
|
-
const target =
|
|
247119
|
+
const target = resolve135(dirname92(path2), link4);
|
|
246986
247120
|
if (!within2(privateDir, target)) return false;
|
|
246987
247121
|
if (realpathSync27(path2) !== join215(realpathSync27(root), relative40(root, target))) return false;
|
|
246988
247122
|
return lstatSync44(target).isFile();
|
|
246989
247123
|
}
|
|
246990
|
-
return within2(privateDir,
|
|
247124
|
+
return within2(privateDir, resolve135(path2)) && realpathSync27(path2).startsWith(privateReal);
|
|
246991
247125
|
} catch {
|
|
246992
247126
|
return false;
|
|
246993
247127
|
}
|
|
@@ -247026,7 +247160,7 @@ async function runInputEvidenceChild(ctx) {
|
|
|
247026
247160
|
log: line => process.stdout.write(line + '\\n'),
|
|
247027
247161
|
error: line => process.stderr.write(line + '\\n')
|
|
247028
247162
|
});`;
|
|
247029
|
-
const result = await new Promise((
|
|
247163
|
+
const result = await new Promise((resolve135) => {
|
|
247030
247164
|
const child3 = execFile8(process.execPath, [
|
|
247031
247165
|
...entry.pathname.endsWith(".ts") ? ["--import", import.meta.resolve("tsx")] : [],
|
|
247032
247166
|
"--input-type=module",
|
|
@@ -247038,7 +247172,7 @@ async function runInputEvidenceChild(ctx) {
|
|
|
247038
247172
|
process.removeListener("exit", stop2);
|
|
247039
247173
|
process.removeListener("SIGTERM", terminate);
|
|
247040
247174
|
process.removeListener("SIGINT", interrupt);
|
|
247041
|
-
|
|
247175
|
+
resolve135({ code: error ? typeof error.code === "number" ? error.code : 1 : 0, stdout, stderr });
|
|
247042
247176
|
});
|
|
247043
247177
|
const stop2 = () => {
|
|
247044
247178
|
child3.kill();
|
|
@@ -247502,10 +247636,10 @@ function collectSdkModules(files, resolveSubpath) {
|
|
|
247502
247636
|
for (const source2 of Object.values(files)) visit(source2);
|
|
247503
247637
|
return { modules, unsupported: unsupported2 };
|
|
247504
247638
|
}
|
|
247505
|
-
function sdkSubpathReader(
|
|
247639
|
+
function sdkSubpathReader(resolve135) {
|
|
247506
247640
|
return (sub) => {
|
|
247507
247641
|
try {
|
|
247508
|
-
return readFileSync131(
|
|
247642
|
+
return readFileSync131(resolve135(`@wix/himalaya/${sub}`), "utf8");
|
|
247509
247643
|
} catch {
|
|
247510
247644
|
return null;
|
|
247511
247645
|
}
|
|
@@ -247583,7 +247717,7 @@ async function runBrowserAuthoring(opts) {
|
|
|
247583
247717
|
const token = mintToken2(payload);
|
|
247584
247718
|
const unusable2 = await probeAuthoringPage(opts.authoringBase, opts.fetchImpl, opts.probeTimeoutMs);
|
|
247585
247719
|
if (unusable2) throw new Error(unusable2);
|
|
247586
|
-
return await new Promise((
|
|
247720
|
+
return await new Promise((resolve135, reject) => {
|
|
247587
247721
|
let settled = false;
|
|
247588
247722
|
let url = "";
|
|
247589
247723
|
const server = createServer6();
|
|
@@ -247635,7 +247769,7 @@ async function runBrowserAuthoring(opts) {
|
|
|
247635
247769
|
}
|
|
247636
247770
|
res.writeHead(200, { "content-type": "text/plain" }).end("ok");
|
|
247637
247771
|
const report9 = body.result;
|
|
247638
|
-
finish3(() =>
|
|
247772
|
+
finish3(() => resolve135({ report: report9, url }));
|
|
247639
247773
|
})();
|
|
247640
247774
|
});
|
|
247641
247775
|
server.on("error", (e2) => finish3(() => reject(e2)));
|
|
@@ -248342,12 +248476,17 @@ function appObject(source2) {
|
|
|
248342
248476
|
const argument = call?.arguments[0];
|
|
248343
248477
|
return argument && ts19.isObjectLiteralExpression(argument) ? argument : void 0;
|
|
248344
248478
|
}
|
|
248479
|
+
function appMayBeOverridden(app2) {
|
|
248480
|
+
const literal3 = findProperty(app2, "app");
|
|
248481
|
+
const after = literal3 ? app2.properties.slice(app2.properties.indexOf(literal3) + 1) : app2.properties;
|
|
248482
|
+
return after.some((property3) => ts19.isSpreadAssignment(property3) || ts19.isComputedPropertyName(property3.name) || propName6(property3.name) === "app");
|
|
248483
|
+
}
|
|
248345
248484
|
function declaresNewApp(configText) {
|
|
248346
248485
|
const source2 = ts19.createSourceFile("config.ts", configText, ts19.ScriptTarget.Latest, true, ts19.ScriptKind.TS);
|
|
248347
248486
|
const app2 = appObject(source2);
|
|
248348
248487
|
const block = app2 && findProperty(app2, "app");
|
|
248349
248488
|
const declared = block && ts19.isObjectLiteralExpression(block.initializer) ? findProperty(block.initializer, "newApp") : void 0;
|
|
248350
|
-
return declared?.initializer.kind === ts19.SyntaxKind.TrueKeyword;
|
|
248489
|
+
return declared?.initializer.kind === ts19.SyntaxKind.TrueKeyword && !appMayBeOverridden(app2);
|
|
248351
248490
|
}
|
|
248352
248491
|
function avatarNavWorkerOf(configText) {
|
|
248353
248492
|
const source2 = ts19.createSourceFile("config.ts", configText, ts19.ScriptTarget.Latest, true, ts19.ScriptKind.TS);
|
|
@@ -249826,6 +249965,28 @@ function applyScreens(source2, gates, context) {
|
|
|
249826
249965
|
const text32 = applyEdits(afterRows, edits);
|
|
249827
249966
|
return { status: text32 === source2 ? "unchanged" : "written", text: text32, wrapped, rows, missing: missing4 };
|
|
249828
249967
|
}
|
|
249968
|
+
function newAppEdit(file2, app2) {
|
|
249969
|
+
const appProperty = findProperty(app2, "app");
|
|
249970
|
+
const appBlock = objectValue(appProperty);
|
|
249971
|
+
if (appProperty && !appBlock || appMayBeOverridden(app2)) return { kind: "not_literal" };
|
|
249972
|
+
const declared = appBlock && findProperty(appBlock, "newApp");
|
|
249973
|
+
if (declared) return { kind: declared.initializer.kind === ts23.SyntaxKind.TrueKeyword ? "declared" : "declared_false" };
|
|
249974
|
+
if (appBlock) return { kind: "missing", edit: { start: appBlock.getStart() + 1, end: appBlock.getStart() + 1, replacement: `
|
|
249975
|
+
${" ".repeat(Math.max(2, file2.getLineAndCharacterOfPosition(appBlock.getStart()).character + 2))}"newApp": true,` } };
|
|
249976
|
+
const first = app2.properties[0];
|
|
249977
|
+
const indent = " ".repeat(first ? file2.getLineAndCharacterOfPosition(first.getStart()).character : 2);
|
|
249978
|
+
return { kind: "missing", edit: { start: app2.getStart() + 1, end: app2.getStart() + 1, replacement: `
|
|
249979
|
+
${indent}"app": { "newApp": true },` } };
|
|
249980
|
+
}
|
|
249981
|
+
function declareNewApp(configText) {
|
|
249982
|
+
const file2 = parse5("config.ts", configText);
|
|
249983
|
+
const app2 = file2 && appObject(file2);
|
|
249984
|
+
if (!file2 || !app2) return { status: "manual", text: configText, reason: "config.ts has no literal defineApp({...}) to declare `app.newApp` in" };
|
|
249985
|
+
const found = newAppEdit(file2, app2);
|
|
249986
|
+
if (found.kind === "not_literal") return { status: "manual", text: configText, reason: NEW_APP_NOT_LITERAL };
|
|
249987
|
+
if (found.kind !== "missing") return { status: "unchanged", text: configText };
|
|
249988
|
+
return { status: "written", text: applyEdits(configText, [found.edit]) };
|
|
249989
|
+
}
|
|
249829
249990
|
function navMembersNamed(file2) {
|
|
249830
249991
|
const members2 = /* @__PURE__ */ new Set();
|
|
249831
249992
|
const member = new RegExp(`(?:^|[:.])${NAV_SERVICE}\\.([A-Za-z0-9_]+)`, "g");
|
|
@@ -249881,21 +250042,12 @@ ${indent}"navLogicBundle": ${indented(headerBadgesBundleRef(ACCESS_NAV_BUNDLE),
|
|
|
249881
250042
|
}
|
|
249882
250043
|
}
|
|
249883
250044
|
if (gates.length) {
|
|
249884
|
-
const
|
|
249885
|
-
|
|
249886
|
-
|
|
249887
|
-
if (
|
|
249888
|
-
|
|
249889
|
-
|
|
249890
|
-
else if (!options2.newApp) return { ...refuse10(NEW_APP_REASON), needsNewApp: true };
|
|
249891
|
-
else if (appBlock) edits.push({ start: appBlock.getStart() + 1, end: appBlock.getStart() + 1, replacement: `
|
|
249892
|
-
${" ".repeat(Math.max(2, file2.getLineAndCharacterOfPosition(appBlock.getStart()).character + 2))}"newApp": true,` });
|
|
249893
|
-
else {
|
|
249894
|
-
const first = app2.properties[0];
|
|
249895
|
-
const indent = " ".repeat(first ? file2.getLineAndCharacterOfPosition(first.getStart()).character : 2);
|
|
249896
|
-
edits.push({ start: app2.getStart() + 1, end: app2.getStart() + 1, replacement: `
|
|
249897
|
-
${indent}"app": { "newApp": true },` });
|
|
249898
|
-
}
|
|
250045
|
+
const newApp = newAppEdit(file2, app2);
|
|
250046
|
+
if (newApp.kind === "not_literal") conflicts.push(NEW_APP_NOT_LITERAL);
|
|
250047
|
+
else if (newApp.kind === "declared_false") conflicts.push("`app.newApp` is declared but not `true`: the page locks need app services, which an app that already shipped older binaries cannot use yet");
|
|
250048
|
+
else if (newApp.kind === "missing") {
|
|
250049
|
+
if (!options2.newApp) return { ...refuse10(NEW_APP_REASON), needsNewApp: true };
|
|
250050
|
+
edits.push(newApp.edit);
|
|
249899
250051
|
}
|
|
249900
250052
|
}
|
|
249901
250053
|
const kind = stringValue2(findProperty(navigation, "navKind")?.initializer) ?? "";
|
|
@@ -250081,7 +250233,7 @@ function renderGateTable(gates) {
|
|
|
250081
250233
|
""
|
|
250082
250234
|
].join("\n");
|
|
250083
250235
|
}
|
|
250084
|
-
var obj10, text18, strings2, mayHide, STOCK_COPY, node, SIGN_IN_SCREEN, CHAT_SCREEN, PLANS_SCREEN, slotPrefix, accessStatePath, accessRowHiddenPath, accessHiddenPath, slice, stringValue2, objectValue, PAYLOAD_KEYS, indented, LOGIN_HELPER, LOGIN_GATE_SCREEN, sameStatement, loginHelperSource, NEW_APP_REASON;
|
|
250236
|
+
var obj10, text18, strings2, mayHide, STOCK_COPY, node, SIGN_IN_SCREEN, CHAT_SCREEN, PLANS_SCREEN, slotPrefix, accessStatePath, accessRowHiddenPath, accessHiddenPath, slice, stringValue2, objectValue, PAYLOAD_KEYS, indented, LOGIN_HELPER, LOGIN_GATE_SCREEN, sameStatement, loginHelperSource, NEW_APP_NOT_LITERAL, NEW_APP_REASON;
|
|
250085
250237
|
var init_access = __esm({
|
|
250086
250238
|
"src/one-app/access.ts"() {
|
|
250087
250239
|
init_define_HHP_CATALOG();
|
|
@@ -250120,6 +250272,7 @@ ${indent}`);
|
|
|
250120
250272
|
LOGIN_GATE_SCREEN = "himi_sign_in";
|
|
250121
250273
|
sameStatement = (a3, b3) => a3.replace(/\s+/g, " ").trim() === b3.replace(/\s+/g, " ").trim();
|
|
250122
250274
|
loginHelperSource = (gateScreenId) => `const ${LOGIN_HELPER} = <T extends { config?: Record<string, unknown> }>(auth: T): T => ({ ...auth, config: { ${gateScreenId ? `gateScreenId: ${JSON.stringify(gateScreenId)}, ` : ""}...auth.config, required: true } });`;
|
|
250275
|
+
NEW_APP_NOT_LITERAL = "`app` in config.ts is not an object literal, or defineApp has a spread, shorthand, duplicate or computed key written after it that can set `app` at runtime, so `newApp` cannot be declared or relied on safely";
|
|
250123
250276
|
NEW_APP_REASON = "Page locks read app-level state through app services (`$app:`), which an app may use only when it has never shipped a binary older than the first one with app services (1.9.0). If this migrated app is new, pass --new-app and it declares `app: { newApp: true }`. If it has already shipped, locks must wait for the enforced runtime floor.";
|
|
250124
250277
|
}
|
|
250125
250278
|
});
|
|
@@ -250455,19 +250608,19 @@ async function runOneAppAccess(args, io2) {
|
|
|
250455
250608
|
writeFileSync54(write3.path, write3.after, "utf8");
|
|
250456
250609
|
}
|
|
250457
250610
|
} catch (error) {
|
|
250458
|
-
const
|
|
250611
|
+
const failed2 = [];
|
|
250459
250612
|
for (const write3 of done.reverse()) {
|
|
250460
250613
|
try {
|
|
250461
250614
|
if (write3.before === void 0) rmSync31(write3.path, { force: true });
|
|
250462
250615
|
else if (!existsSync114(write3.path) || readFileSync135(write3.path, "utf8") !== write3.before) writeFileSync54(write3.path, write3.before, "utf8");
|
|
250463
250616
|
} catch {
|
|
250464
|
-
|
|
250617
|
+
failed2.push(write3.path);
|
|
250465
250618
|
}
|
|
250466
250619
|
}
|
|
250467
250620
|
return report3(io2, false, {
|
|
250468
250621
|
code: "app_uninspectable",
|
|
250469
250622
|
...summary2,
|
|
250470
|
-
error: `${errorText(error)}; ${
|
|
250623
|
+
error: `${errorText(error)}; ${failed2.length ? `these files could NOT be restored: ${failed2.join(", ")}` : "the files written so far were put back as they were"}.`
|
|
250471
250624
|
});
|
|
250472
250625
|
}
|
|
250473
250626
|
}
|
|
@@ -251501,9 +251654,9 @@ function readVerifiedEvidence(evidenceDir, { runtime = "required" } = {}) {
|
|
|
251501
251654
|
const manifest2 = readJson12(join150(evidenceDir, "manifest.json"));
|
|
251502
251655
|
if (manifest2.workflow !== "one-app-to-himi-app") throw new Error("manifest.json is not for the one-app-to-himi-app workflow.");
|
|
251503
251656
|
if (manifest2.stage !== "collected") throw new Error('manifest.json must have stage "collected".');
|
|
251504
|
-
const
|
|
251505
|
-
if (
|
|
251506
|
-
throw new Error(`Platform top-bar behavior is unverified: ${
|
|
251657
|
+
const unavailable2 = (Array.isArray(manifest2.warnings) ? manifest2.warnings : []).map(object11).filter((warning) => warning?.code === "runtime_context_unavailable" && (warning.platform === "ios" || warning.platform === "android"));
|
|
251658
|
+
if (unavailable2.length && runtime === "required") {
|
|
251659
|
+
throw new Error(`Platform top-bar behavior is unverified: ${unavailable2.map((warning) => warning.platform).join(", ")} runtime context unavailable.`);
|
|
251507
251660
|
}
|
|
251508
251661
|
const rawPath = join150(evidenceDir, "raw-structure.json");
|
|
251509
251662
|
const rawBytes = readFileSync138(rawPath);
|
|
@@ -259453,8 +259606,8 @@ async function applyInvite(c2, plan, consentId) {
|
|
|
259453
259606
|
const seat = c2.p.seat;
|
|
259454
259607
|
const host = c2.google.host;
|
|
259455
259608
|
if (plan.savePackage) {
|
|
259456
|
-
const
|
|
259457
|
-
if (
|
|
259609
|
+
const failed2 = await savePackage(c2, plan.packageName, { consentId });
|
|
259610
|
+
if (failed2 !== void 0) return { code: failed2 };
|
|
259458
259611
|
}
|
|
259459
259612
|
const already = { consentId, ...plan.savePackage ? { packageName: plan.packageName } : {} };
|
|
259460
259613
|
const { note, extra: savedExtra } = savedNote(already);
|
|
@@ -259692,8 +259845,8 @@ async function createApp3(c2) {
|
|
|
259692
259845
|
if (!agreed) return fail11(io2, "consent_declined", "not confirmed; no app was created and no declaration was accepted", { packageName: pkg.packageName });
|
|
259693
259846
|
const ownerApprovalId = `local-${c2.now().getTime()}`;
|
|
259694
259847
|
if (pkg.save) {
|
|
259695
|
-
const
|
|
259696
|
-
if (
|
|
259848
|
+
const failed2 = await savePackage(c2, pkg.packageName);
|
|
259849
|
+
if (failed2 !== void 0) return failed2;
|
|
259697
259850
|
}
|
|
259698
259851
|
const already = pkg.save ? { packageName: pkg.packageName } : {};
|
|
259699
259852
|
const { note, extra: savedExtra } = savedNote(already);
|
|
@@ -260661,10 +260814,10 @@ async function run3(c2) {
|
|
|
260661
260814
|
job = await approveAndApply(runner2, job, c2.person, c2.actor, c2.now);
|
|
260662
260815
|
}
|
|
260663
260816
|
} catch (e2) {
|
|
260664
|
-
const
|
|
260665
|
-
const upgraded = upgradedRefusal(io2, p2, `${e2.message ?? ""} ${
|
|
260817
|
+
const failed2 = e2 instanceof JobFailure || e2 instanceof ReadyRefusal ? e2.job : e2.job;
|
|
260818
|
+
const upgraded = upgradedRefusal(io2, p2, `${e2.message ?? ""} ${failed2?.error ?? ""}`, { ...base2, ...failed2 ? { jobId: failed2.id, status: failed2.status } : {} });
|
|
260666
260819
|
if (upgraded !== void 0) return upgraded;
|
|
260667
|
-
return fail13(io2, "job_failed", e2.message ?? String(e2), { ...base2, ...readyOut, ...
|
|
260820
|
+
return fail13(io2, "job_failed", e2.message ?? String(e2), { ...base2, ...readyOut, ...failed2 ? { jobId: failed2.id, status: failed2.status, next: `gplay-node jobs show ${failed2.id}` } : {} });
|
|
260668
260821
|
}
|
|
260669
260822
|
if (job && job.status !== "verified") {
|
|
260670
260823
|
const upgraded = upgradedRefusal(io2, p2, String(job.error ?? ""), { ...base2, jobId: job.id, status: job.status });
|
|
@@ -260694,12 +260847,12 @@ async function run3(c2) {
|
|
|
260694
260847
|
}
|
|
260695
260848
|
}
|
|
260696
260849
|
} catch (e2) {
|
|
260697
|
-
const
|
|
260850
|
+
const failed2 = e2 instanceof ReadyRefusal || e2 instanceof JobFailure ? e2.job : e2.job;
|
|
260698
260851
|
return fail13(
|
|
260699
260852
|
io2,
|
|
260700
260853
|
"job_failed",
|
|
260701
260854
|
`the pool group is ${adding ? "on" : "off"} the track, but readying it stopped: ${e2.message ?? String(e2)}`,
|
|
260702
|
-
{ ...base2, groups: after, ...readyOut, ...
|
|
260855
|
+
{ ...base2, groups: after, ...readyOut, ...failed2 ? { jobId: failed2.id, status: failed2.status, next: `gplay-node jobs show ${failed2.id}` } : {} }
|
|
260703
260856
|
);
|
|
260704
260857
|
}
|
|
260705
260858
|
}
|
|
@@ -261388,7 +261541,7 @@ var init_iap_client = __esm({
|
|
|
261388
261541
|
this.options = options2;
|
|
261389
261542
|
this.fetchImpl = options2.fetchImpl ?? ((input, init) => globalThis.fetch(input, init));
|
|
261390
261543
|
this.now = options2.now ?? Date.now;
|
|
261391
|
-
this.sleep = options2.sleep ?? ((ms2) => new Promise((
|
|
261544
|
+
this.sleep = options2.sleep ?? ((ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2)));
|
|
261392
261545
|
}
|
|
261393
261546
|
fetchImpl;
|
|
261394
261547
|
now;
|
|
@@ -261799,8 +261952,8 @@ async function probe(id, read2, failure4) {
|
|
|
261799
261952
|
return { id, ...failure4 };
|
|
261800
261953
|
}
|
|
261801
261954
|
}
|
|
261802
|
-
async function optionalCheck(id, read2,
|
|
261803
|
-
return read2 ? probe(id, read2, blocked("setup_read_failed", `Could not read ${id}; check owner permissions and retry.`)) : { id, ...
|
|
261955
|
+
async function optionalCheck(id, read2, unavailable2) {
|
|
261956
|
+
return read2 ? probe(id, read2, blocked("setup_read_failed", `Could not read ${id}; check owner permissions and retry.`)) : { id, ...unavailable2 };
|
|
261804
261957
|
}
|
|
261805
261958
|
function mappingCheck(item2, mappings) {
|
|
261806
261959
|
const rule = item2.wix && APPLE_PROVISIONING_RULES[item2.wix.entityType];
|
|
@@ -263381,8 +263534,8 @@ async function runOps(run4, ops, context, manifest2) {
|
|
|
263381
263534
|
return steps;
|
|
263382
263535
|
}
|
|
263383
263536
|
function outcomeOf(ops, steps, unmet) {
|
|
263384
|
-
const
|
|
263385
|
-
if (
|
|
263537
|
+
const failed2 = steps.some((s5) => s5.state === "failed");
|
|
263538
|
+
if (failed2) return steps.some((s5) => s5.state === "done" || s5.state === "reconciled") ? "partial" : "failed";
|
|
263386
263539
|
if (unmet.length) return "partial";
|
|
263387
263540
|
if (ops.some((op) => op.kind === "createProduct")) return "created";
|
|
263388
263541
|
return ops.length ? "updated" : "reused";
|
|
@@ -264542,6 +264695,41 @@ var init_store_iap_catalog = __esm({
|
|
|
264542
264695
|
}
|
|
264543
264696
|
});
|
|
264544
264697
|
|
|
264698
|
+
// src/iap-setup/payment-provider.ts
|
|
264699
|
+
function checkPaymentProvider() {
|
|
264700
|
+
return { state: "unverified", code: "provider_check_unavailable", detail: "wix-iap has no read-only provider-readiness method" };
|
|
264701
|
+
}
|
|
264702
|
+
async function connectPaymentProvider(provider, appId3, apply2) {
|
|
264703
|
+
if (provider && !apply2) {
|
|
264704
|
+
return {
|
|
264705
|
+
state: "unverified",
|
|
264706
|
+
detail: "whether the appleIAP payment provider is connected cannot be read (wix-iap has no read-only provider-readiness method), so applying sends ConnectProviderAccount again"
|
|
264707
|
+
};
|
|
264708
|
+
}
|
|
264709
|
+
if (!provider || !apply2) return paymentProviderPlan(provider);
|
|
264710
|
+
try {
|
|
264711
|
+
const { connected } = await provider.connect(appId3);
|
|
264712
|
+
return connected ? { state: "done", detail: "the appleIAP payment provider is connected on the site" } : { state: "blocked", code: "provider_not_connected", detail: "wix-iap answered, but the appleIAP provider account is not connected" };
|
|
264713
|
+
} catch (error) {
|
|
264714
|
+
const e2 = error;
|
|
264715
|
+
if (e2?.status === 404 && !e2.body?.details?.applicationError?.code) return paymentProviderPlan(null);
|
|
264716
|
+
return failedStep("connect the appleIAP provider", error);
|
|
264717
|
+
}
|
|
264718
|
+
}
|
|
264719
|
+
function paymentProviderPlan(provider) {
|
|
264720
|
+
return provider ? { state: "planned", detail: "connect the appleIAP payment provider through wix-iap" } : {
|
|
264721
|
+
state: "blocked",
|
|
264722
|
+
code: "provider_route_unavailable",
|
|
264723
|
+
detail: "the appleIAP provider is connected through Serve's IAP routes (wix-iap ConnectProviderAccount), and this Serve target has none."
|
|
264724
|
+
};
|
|
264725
|
+
}
|
|
264726
|
+
var init_payment_provider = __esm({
|
|
264727
|
+
"src/iap-setup/payment-provider.ts"() {
|
|
264728
|
+
init_define_HHP_CATALOG();
|
|
264729
|
+
init_step();
|
|
264730
|
+
}
|
|
264731
|
+
});
|
|
264732
|
+
|
|
264545
264733
|
// src/store-iap-connect.ts
|
|
264546
264734
|
async function planCheck(items, deps) {
|
|
264547
264735
|
const rules = deps.saleRules ?? APPLE_PROVISIONING_RULES;
|
|
@@ -264568,95 +264756,21 @@ async function connectIap(manifest2, deps, options2) {
|
|
|
264568
264756
|
};
|
|
264569
264757
|
};
|
|
264570
264758
|
const plans = await planCheck(manifest2.items, deps);
|
|
264571
|
-
const found = await
|
|
264759
|
+
const found = await applyPurchasesApp(deps.api, { site: target.wixSiteId, bundleId: target.bundleId, name: target.himiApp }, { apply: options2.apply });
|
|
264572
264760
|
if (!found.app) {
|
|
264573
264761
|
const skipped = found.step.state === "planned" ? planned : noApp;
|
|
264574
264762
|
return report9(found.step, null, {
|
|
264575
|
-
credentials: found.step.state === "planned" ?
|
|
264576
|
-
provider: found.step.state === "planned" ?
|
|
264763
|
+
credentials: found.step.state === "planned" ? iapKeyPlan(deps) : skipped("the app is not registered"),
|
|
264764
|
+
provider: found.step.state === "planned" ? paymentProviderPlan(deps.provider) : skipped("the app is not registered"),
|
|
264577
264765
|
mappings: manifest2.items.map((item2) => mappingWithoutApp(item2, found.step.state === "planned", plans, deps.saleRules))
|
|
264578
264766
|
});
|
|
264579
264767
|
}
|
|
264580
264768
|
const { app: app2 } = found;
|
|
264581
|
-
const credentials = await
|
|
264582
|
-
const provider = await
|
|
264769
|
+
const credentials = await keepIapKey(deps, app2, options2.apply);
|
|
264770
|
+
const provider = await connectPaymentProvider(deps.provider, app2.id, options2.apply);
|
|
264583
264771
|
const mappings = await mapItems(deps.catalog, app2.id, manifest2.items, options2.apply, plans, deps.saleRules);
|
|
264584
264772
|
return report9(found.step, app2.id, { credentials, provider, mappings });
|
|
264585
264773
|
}
|
|
264586
|
-
async function findOrRegister(api4, manifest2, apply2) {
|
|
264587
|
-
const { bundleId, himiApp, wixSiteId } = manifest2.target;
|
|
264588
|
-
const existing = (await api4.listApps()).find((app2) => app2.bundleId === bundleId);
|
|
264589
|
-
if (existing) return { app: existing, step: { state: "reused", detail: `purchases app ${existing.id} for ${bundleId} on site ${wixSiteId}` } };
|
|
264590
|
-
if (!apply2) return { step: { state: "planned", detail: `register ${bundleId} on site ${wixSiteId}` } };
|
|
264591
|
-
try {
|
|
264592
|
-
const app2 = await api4.registerApp({ name: himiApp, bundleId });
|
|
264593
|
-
return { app: app2, step: { state: "done", detail: `registered purchases app ${app2.id} for ${bundleId} on site ${wixSiteId}` } };
|
|
264594
|
-
} catch (error) {
|
|
264595
|
-
if (refusalCode(error) !== "ALREADY_EXISTS") return { step: failed("register the app", error) };
|
|
264596
|
-
let apps;
|
|
264597
|
-
try {
|
|
264598
|
-
apps = await api4.listApps();
|
|
264599
|
-
} catch (rereadError) {
|
|
264600
|
-
return { step: failed("re-read the site's purchases apps after the bundle was reported registered", rereadError) };
|
|
264601
|
-
}
|
|
264602
|
-
const raced = apps.find((app2) => app2.bundleId === bundleId);
|
|
264603
|
-
if (raced) return { app: raced, step: { state: "reused", detail: `purchases app ${raced.id} for ${bundleId} on site ${wixSiteId}` } };
|
|
264604
|
-
return {
|
|
264605
|
-
step: {
|
|
264606
|
-
state: "conflict",
|
|
264607
|
-
code: "bundle_registered_elsewhere",
|
|
264608
|
-
detail: `${bundleId} is already registered to another app, on another site (this site has none for it). A bundle id belongs to one purchases app platform-wide; only the owner of that registration can remove it. Nothing was changed.`
|
|
264609
|
-
}
|
|
264610
|
-
};
|
|
264611
|
-
}
|
|
264612
|
-
}
|
|
264613
|
-
async function storeKey(deps, app2, apply2) {
|
|
264614
|
-
if (app2.privateKeyStored) return { state: "reused", detail: "an In-App Purchase key is already stored" };
|
|
264615
|
-
if (!deps.appleKey) return credentialsPlan(deps);
|
|
264616
|
-
if (!apply2) return credentialsPlan(deps);
|
|
264617
|
-
try {
|
|
264618
|
-
await deps.api.setAppleCredentials(app2.id, deps.appleKey);
|
|
264619
|
-
return { state: "done", detail: "stored the In-App Purchase key" };
|
|
264620
|
-
} catch (error) {
|
|
264621
|
-
return failed("store the In-App Purchase key", error);
|
|
264622
|
-
}
|
|
264623
|
-
}
|
|
264624
|
-
function credentialsPlan(deps) {
|
|
264625
|
-
if (!deps.appleKey && deps.serverKeyOnly) return {
|
|
264626
|
-
state: "blocked",
|
|
264627
|
-
code: "apple_key_missing",
|
|
264628
|
-
detail: "The purchases app has no In-App Purchase key. Run himi store apple-keys setup --app <slug> --site <metaSiteId> --bundle-id <id> --iap-key <AuthKey.p8> --iap-key-id <id> --iap-issuer-id <issuer> --yes, then rerun connect. An App Store Connect API key cannot replace this credential."
|
|
264629
|
-
};
|
|
264630
|
-
return deps.appleKey ? { state: "planned", detail: "store the In-App Purchase key" } : {
|
|
264631
|
-
state: "blocked",
|
|
264632
|
-
code: "apple_key_missing",
|
|
264633
|
-
detail: "no In-App Purchase key: create one in App Store Connect \u2192 Users and Access \u2192 Integrations \u2192 In-App Purchase, then run himi store apple-keys setup with --iap-key <AuthKey.p8> --iap-key-id <key id> --iap-issuer-id <issuer>, or rerun legacy connect with its key flags (an App Store Connect API key is rejected)."
|
|
264634
|
-
};
|
|
264635
|
-
}
|
|
264636
|
-
async function connectProvider(provider, appId3, apply2) {
|
|
264637
|
-
if (provider && !apply2) {
|
|
264638
|
-
return {
|
|
264639
|
-
state: "unverified",
|
|
264640
|
-
detail: "whether the appleIAP payment provider is connected cannot be read (wix-iap has no read-only provider-readiness method), so applying sends ConnectProviderAccount again"
|
|
264641
|
-
};
|
|
264642
|
-
}
|
|
264643
|
-
if (!provider || !apply2) return providerPlan(provider);
|
|
264644
|
-
try {
|
|
264645
|
-
const { connected } = await provider.connect(appId3);
|
|
264646
|
-
return connected ? { state: "done", detail: "the appleIAP payment provider is connected on the site" } : { state: "blocked", code: "provider_not_connected", detail: "wix-iap answered, but the appleIAP provider account is not connected" };
|
|
264647
|
-
} catch (error) {
|
|
264648
|
-
const e2 = error;
|
|
264649
|
-
if (e2?.status === 404 && !e2.body?.details?.applicationError?.code) return providerPlan(null);
|
|
264650
|
-
return failed("connect the appleIAP provider", error);
|
|
264651
|
-
}
|
|
264652
|
-
}
|
|
264653
|
-
function providerPlan(provider) {
|
|
264654
|
-
return provider ? { state: "planned", detail: "connect the appleIAP payment provider through wix-iap" } : {
|
|
264655
|
-
state: "blocked",
|
|
264656
|
-
code: "provider_route_unavailable",
|
|
264657
|
-
detail: "the appleIAP provider is connected through Serve's IAP routes (wix-iap ConnectProviderAccount), and this Serve target has none."
|
|
264658
|
-
};
|
|
264659
|
-
}
|
|
264660
264774
|
async function mapItems(api4, appId3, items, apply2, plans, rules = APPLE_PROVISIONING_RULES) {
|
|
264661
264775
|
let catalog4;
|
|
264662
264776
|
try {
|
|
@@ -264664,7 +264778,7 @@ async function mapItems(api4, appId3, items, apply2, plans, rules = APPLE_PROVIS
|
|
|
264664
264778
|
} catch (error) {
|
|
264665
264779
|
return items.map((item2) => {
|
|
264666
264780
|
const target = mappingTarget(item2, plans, rules);
|
|
264667
|
-
return "skip" in target ? target.skip : { ...target, ...
|
|
264781
|
+
return "skip" in target ? target.skip : { ...target, ...failedStep("read the app's catalog", error) };
|
|
264668
264782
|
});
|
|
264669
264783
|
}
|
|
264670
264784
|
const steps = [];
|
|
@@ -264684,7 +264798,7 @@ async function mapItems(api4, appId3, items, apply2, plans, rules = APPLE_PROVIS
|
|
|
264684
264798
|
steps.push({ ...target, state: "done", detail: `mapped ${target.appProductId} \u2192 ${target.storeProductId}` });
|
|
264685
264799
|
} catch (error) {
|
|
264686
264800
|
const now = await api4.listProducts(appId3).catch(() => catalog4);
|
|
264687
|
-
steps.push(decide2(now, target) ?? (refusalCode(error) === "STORE_PRODUCT_ID_IN_USE" ? { ...target, state: "conflict", code: "sku_in_use", detail: `${target.storeProductId} is already in use; nothing was changed` } : { ...target, ...
|
|
264801
|
+
steps.push(decide2(now, target) ?? (refusalCode(error) === "STORE_PRODUCT_ID_IN_USE" ? { ...target, state: "conflict", code: "sku_in_use", detail: `${target.storeProductId} is already in use; nothing was changed` } : { ...target, ...failedStep("map the item", error) }));
|
|
264688
264802
|
}
|
|
264689
264803
|
}
|
|
264690
264804
|
return steps;
|
|
@@ -264759,15 +264873,16 @@ function planned(detail) {
|
|
|
264759
264873
|
function noApp(why) {
|
|
264760
264874
|
return { state: "skipped", code: "no_purchases_app", detail: `${why}, so this step did not run` };
|
|
264761
264875
|
}
|
|
264762
|
-
function failed(what, error) {
|
|
264763
|
-
return { state: "failed", code: "request_failed", detail: `could not ${what}: ${error instanceof Error ? error.message : String(error)}` };
|
|
264764
|
-
}
|
|
264765
264876
|
var PRODUCT_TYPE, DIFF_BUCKET;
|
|
264766
264877
|
var init_store_iap_connect = __esm({
|
|
264767
264878
|
"src/store-iap-connect.ts"() {
|
|
264768
264879
|
init_define_HHP_CATALOG();
|
|
264769
264880
|
init_wix_payments_contract();
|
|
264770
264881
|
init_store_iap_purchases();
|
|
264882
|
+
init_step();
|
|
264883
|
+
init_purchases_app();
|
|
264884
|
+
init_iap_key();
|
|
264885
|
+
init_payment_provider();
|
|
264771
264886
|
PRODUCT_TYPE = { nonConsumable: "NON_CONSUMABLE", consumable: "CONSUMABLE" };
|
|
264772
264887
|
DIFF_BUCKET = {
|
|
264773
264888
|
reused: "inPlace",
|
|
@@ -264967,9 +265082,9 @@ import { join as join176 } from "node:path";
|
|
|
264967
265082
|
function renderProblems(render3, entityId) {
|
|
264968
265083
|
const problems = (render3.liveErrors ?? []).map((e2) => `${e2.service}: ${e2.message}`);
|
|
264969
265084
|
const ofItem = (call) => call.toLowerCase().includes(entityId.toLowerCase());
|
|
264970
|
-
const
|
|
265085
|
+
const failed2 = (render3.liveFailed ?? []).filter(ofItem);
|
|
264971
265086
|
const attempted = (render3.liveCalls ?? []).filter(ofItem).length;
|
|
264972
|
-
if (
|
|
265087
|
+
if (failed2.length > 0 && attempted <= failed2.length) problems.push(`reading the item failed (${failed2[0]}), so the screen could not show it`);
|
|
264973
265088
|
return problems;
|
|
264974
265089
|
}
|
|
264975
265090
|
function workerBundleDir(result, dir) {
|
|
@@ -265875,7 +265990,7 @@ function defaultStoreIapDeps() {
|
|
|
265875
265990
|
profileTeam: (profile) => resolveStoreCredentials({ app: profile, cfg: {}, profileFlag: profile, env: {} }).team,
|
|
265876
265991
|
confirm: confirmOnTerminal,
|
|
265877
265992
|
now: () => /* @__PURE__ */ new Date(),
|
|
265878
|
-
sleep: (ms2) => new Promise((
|
|
265993
|
+
sleep: (ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2))
|
|
265879
265994
|
};
|
|
265880
265995
|
}
|
|
265881
265996
|
var STORE_IAP_USAGE, SUMMARY_THRESHOLD, SUMMARY_DETAIL_LIMIT, UsageError10, CommandOutput, pad, DECISION_ORDER, OUTCOME_ORDER, COMPLETE, DRAFT_MODES, TERRITORY_CODE, LOCALE_CODE, GRID_UNAVAILABLE_NOTE, KeyError, CredentialsError, writesPlanned, COMMANDS4;
|
|
@@ -267050,7 +267165,7 @@ async function browserLogin2(opts) {
|
|
|
267050
267165
|
const log = opts.log ?? (() => {
|
|
267051
267166
|
});
|
|
267052
267167
|
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS6;
|
|
267053
|
-
return await new Promise((
|
|
267168
|
+
return await new Promise((resolve135, reject) => {
|
|
267054
267169
|
let settled = false;
|
|
267055
267170
|
let loginUrl = "";
|
|
267056
267171
|
const server = createServer9();
|
|
@@ -267121,7 +267236,7 @@ async function browserLogin2(opts) {
|
|
|
267121
267236
|
res.writeHead(200, { "content-type": "text/html; charset=utf-8", "cache-control": "no-store", connection: "close" }).end(closePage(opts.doneTitle ?? "Signed in to himi"));
|
|
267122
267237
|
const extra = {};
|
|
267123
267238
|
for (const [k3, v2] of params) if (k3 !== "token" && k3 !== "state") extra[k3] = v2;
|
|
267124
|
-
finish3(() =>
|
|
267239
|
+
finish3(() => resolve135({ token, loginUrl, extra }));
|
|
267125
267240
|
});
|
|
267126
267241
|
});
|
|
267127
267242
|
server.on("error", (err) => finish3(() => reject(err)));
|
|
@@ -267945,7 +268060,7 @@ async function runAllMembers(args) {
|
|
|
267945
268060
|
const result = await sendCampaign({
|
|
267946
268061
|
recipients,
|
|
267947
268062
|
campaignId: requestId2,
|
|
267948
|
-
wait: deps.wait ?? ((ms2) => new Promise((
|
|
268063
|
+
wait: deps.wait ?? ((ms2) => new Promise((resolve135) => setTimeout(resolve135, ms2))),
|
|
267949
268064
|
onProgress: (completed) => {
|
|
267950
268065
|
if (completed % 10 === 0 || completed === recipients.length) {
|
|
267951
268066
|
io2.log(JSON.stringify({ ok: true, state: "progress", campaignId: requestId2, completed, recipients: recipients.length }));
|
|
@@ -268330,6 +268445,121 @@ var init_notify = __esm({
|
|
|
268330
268445
|
}
|
|
268331
268446
|
});
|
|
268332
268447
|
|
|
268448
|
+
// src/setup-checks.ts
|
|
268449
|
+
function failure(refusal2) {
|
|
268450
|
+
if (!refusal2) return { ok: false, code: "setup_status_unreadable" };
|
|
268451
|
+
const error = text28(refusal2.error) ?? "setup_check_failed";
|
|
268452
|
+
const code3 = text28(refusal2.code) ?? error;
|
|
268453
|
+
return { ok: false, error, code: code3, ...text28(refusal2.hint) ? { hint: refusal2.hint } : {} };
|
|
268454
|
+
}
|
|
268455
|
+
function pushSection(result) {
|
|
268456
|
+
const { signIn: _signIn, steps: _steps, ...push } = result;
|
|
268457
|
+
if (push.ok === true) return { ...push, ok: true };
|
|
268458
|
+
const code3 = text28(push.code) ?? text28(push.error) ?? (text28(push.state) ? `push_${push.state}` : "push_not_ready");
|
|
268459
|
+
return { ...push, ok: false, code: code3 };
|
|
268460
|
+
}
|
|
268461
|
+
function signInSection(signIn3) {
|
|
268462
|
+
const ready = [signIn3.appleReady, signIn3.googleIosReady, signIn3.googleAndroidReady];
|
|
268463
|
+
const ok5 = ready.includes(false) ? false : ready.every((v2) => v2 === true) ? true : null;
|
|
268464
|
+
return { ok: ok5, ...signIn3 };
|
|
268465
|
+
}
|
|
268466
|
+
function stepsSection(raw, vocabulary) {
|
|
268467
|
+
const steps = Object.fromEntries(Object.entries(raw).filter(([id]) => STEP_ID.test(id)).map(([id, value2]) => [id, stepLine(obj14(value2) ?? {}, vocabulary)]));
|
|
268468
|
+
const states = Object.values(steps).map((s5) => s5.state);
|
|
268469
|
+
const ok5 = states.some((s5) => vocabulary.failing.has(s5)) ? false : states.some((s5) => s5 === "unknown" || vocabulary.unverified.has(s5)) ? null : true;
|
|
268470
|
+
return { ok: ok5, steps };
|
|
268471
|
+
}
|
|
268472
|
+
function stepLine(step, vocabulary) {
|
|
268473
|
+
const state = typeof step.state === "string" && vocabulary.states.has(step.state) ? step.state : "unknown";
|
|
268474
|
+
return {
|
|
268475
|
+
state,
|
|
268476
|
+
...text28(step.failedStage) && CODE2.test(step.failedStage) ? { failedStage: step.failedStage } : {},
|
|
268477
|
+
...text28(step.code) && CODE2.test(step.code) ? { code: step.code } : {},
|
|
268478
|
+
...text28(step.error) ? { error: step.error } : {},
|
|
268479
|
+
...text28(step.detail) ? { detail: step.detail } : {}
|
|
268480
|
+
};
|
|
268481
|
+
}
|
|
268482
|
+
function stepsIn(steps, areas) {
|
|
268483
|
+
return Object.fromEntries(Object.entries(steps).filter(([id]) => (STEP_AREAS[id] ?? ["push"]).some((a3) => areas.includes(a3))));
|
|
268484
|
+
}
|
|
268485
|
+
var AREAS, obj14, text28, SERVER_STEPS, IAP_SETUP_STEPS, STEP_ID, CODE2, STEP_AREAS, pushStatus, SETUP_CHECKS;
|
|
268486
|
+
var init_setup_checks = __esm({
|
|
268487
|
+
"src/setup-checks.ts"() {
|
|
268488
|
+
init_define_HHP_CATALOG();
|
|
268489
|
+
AREAS = ["push", "signin", "iap"];
|
|
268490
|
+
obj14 = (v2) => v2 && typeof v2 === "object" && !Array.isArray(v2) ? v2 : void 0;
|
|
268491
|
+
text28 = (v2) => typeof v2 === "string" && v2.length > 0 ? v2 : void 0;
|
|
268492
|
+
SERVER_STEPS = {
|
|
268493
|
+
states: /* @__PURE__ */ new Set(["not_configured", "provisioning", "ready", "needs_attention", "not_required"]),
|
|
268494
|
+
failing: /* @__PURE__ */ new Set(["needs_attention"]),
|
|
268495
|
+
unverified: /* @__PURE__ */ new Set(["provisioning"])
|
|
268496
|
+
};
|
|
268497
|
+
IAP_SETUP_STEPS = {
|
|
268498
|
+
states: /* @__PURE__ */ new Set(["ready", "missing", "unverified", "unavailable", "not_checked"]),
|
|
268499
|
+
failing: /* @__PURE__ */ new Set(["missing", "unavailable"]),
|
|
268500
|
+
unverified: /* @__PURE__ */ new Set(["unverified", "not_checked"])
|
|
268501
|
+
};
|
|
268502
|
+
STEP_ID = /^[a-z][a-z-]{0,39}$/;
|
|
268503
|
+
CODE2 = /^[a-z][a-z0-9_]{0,63}$/;
|
|
268504
|
+
STEP_AREAS = {
|
|
268505
|
+
"app-identity": ["push", "signin"],
|
|
268506
|
+
apns: ["push"],
|
|
268507
|
+
"apple-signing": ["push"],
|
|
268508
|
+
firebase: ["push"],
|
|
268509
|
+
"ping-readback": ["push"],
|
|
268510
|
+
"android-signin": ["signin"]
|
|
268511
|
+
};
|
|
268512
|
+
pushStatus = (ctx) => ctx.read("pushStatus", { json: true });
|
|
268513
|
+
SETUP_CHECKS = [
|
|
268514
|
+
{
|
|
268515
|
+
name: "push",
|
|
268516
|
+
areas: ["push"],
|
|
268517
|
+
async run(ctx) {
|
|
268518
|
+
const { result, refusal: refusal2 } = await pushStatus(ctx) ?? {};
|
|
268519
|
+
return result ? pushSection(result) : failure(refusal2);
|
|
268520
|
+
}
|
|
268521
|
+
},
|
|
268522
|
+
{
|
|
268523
|
+
name: "signIn",
|
|
268524
|
+
areas: ["signin"],
|
|
268525
|
+
async run(ctx) {
|
|
268526
|
+
const { result, refusal: refusal2 } = await pushStatus(ctx) ?? {};
|
|
268527
|
+
const signIn3 = obj14(result?.signIn);
|
|
268528
|
+
return signIn3 ? signInSection(signIn3) : failure(result ? { error: text28(result.error) ?? "sign_in_status_missing" } : refusal2);
|
|
268529
|
+
}
|
|
268530
|
+
},
|
|
268531
|
+
{
|
|
268532
|
+
name: "steps",
|
|
268533
|
+
areas: ["push", "signin"],
|
|
268534
|
+
async run(ctx) {
|
|
268535
|
+
const steps = obj14((await pushStatus(ctx))?.result?.steps);
|
|
268536
|
+
return steps ? stepsSection(stepsIn(steps, ctx.areas), SERVER_STEPS) : void 0;
|
|
268537
|
+
}
|
|
268538
|
+
},
|
|
268539
|
+
{
|
|
268540
|
+
name: "iap",
|
|
268541
|
+
areas: ["iap"],
|
|
268542
|
+
async run(ctx) {
|
|
268543
|
+
const manifest2 = text28(ctx.flags["iap-manifest"]);
|
|
268544
|
+
if (!manifest2) return { ok: null, state: "not_checked", code: "iap_manifest_missing", fix: "Pass --iap-manifest <file> (and --catalog-route <path>) to check IAP." };
|
|
268545
|
+
const { result, refusal: refusal2 } = await ctx.read("iapCheck", { manifest: manifest2, json: true }) ?? {};
|
|
268546
|
+
return result && typeof result.ok === "boolean" ? { ...result, ok: result.ok } : failure(refusal2);
|
|
268547
|
+
}
|
|
268548
|
+
},
|
|
268549
|
+
{
|
|
268550
|
+
name: "iapSetup",
|
|
268551
|
+
areas: ["iap"],
|
|
268552
|
+
async run(ctx) {
|
|
268553
|
+
const read2 = await ctx.read("iapSetup", { json: true });
|
|
268554
|
+
if (!read2) return void 0;
|
|
268555
|
+
const steps = obj14(read2.result?.steps);
|
|
268556
|
+
return steps ? stepsSection(steps, IAP_SETUP_STEPS) : failure(read2.refusal);
|
|
268557
|
+
}
|
|
268558
|
+
}
|
|
268559
|
+
];
|
|
268560
|
+
}
|
|
268561
|
+
});
|
|
268562
|
+
|
|
268333
268563
|
// src/setup-check.ts
|
|
268334
268564
|
var setup_check_exports = {};
|
|
268335
268565
|
__export(setup_check_exports, {
|
|
@@ -268348,24 +268578,17 @@ async function capture(run4) {
|
|
|
268348
268578
|
await run4({ log: (s5) => out2.push(s5), error: (s5) => err.push(s5) });
|
|
268349
268579
|
const result = parse9(out2.join("\n")) ?? out2.map(parse9).filter(Boolean).at(-1);
|
|
268350
268580
|
const refusal2 = err.map(parse9).filter((row2) => Boolean(row2) && row2.event === void 0).at(-1);
|
|
268351
|
-
return { result, refusal: refusal2 };
|
|
268352
|
-
}
|
|
268353
|
-
function failure(refusal2) {
|
|
268354
|
-
if (!refusal2) return { ok: false, code: "setup_status_unreadable" };
|
|
268355
|
-
const error = text28(refusal2.error) ?? "setup_check_failed";
|
|
268356
|
-
const code3 = text28(refusal2.code) ?? error;
|
|
268357
|
-
return { ok: false, error, code: code3, ...text28(refusal2.hint) ? { hint: refusal2.hint } : {} };
|
|
268358
|
-
}
|
|
268359
|
-
function pushSection(result) {
|
|
268360
|
-
const { signIn: _2, ...push } = result;
|
|
268361
|
-
if (push.ok === true) return { ...push, ok: true };
|
|
268362
|
-
const code3 = text28(push.code) ?? text28(push.error) ?? (text28(push.state) ? `push_${push.state}` : "push_not_ready");
|
|
268363
|
-
return { ...push, ok: false, code: code3 };
|
|
268581
|
+
return { ...result ? { result } : {}, ...refusal2 ? { refusal: refusal2 } : {} };
|
|
268364
268582
|
}
|
|
268365
|
-
function
|
|
268366
|
-
const
|
|
268367
|
-
|
|
268368
|
-
|
|
268583
|
+
function sourceReader(flags, deps) {
|
|
268584
|
+
const cache4 = /* @__PURE__ */ new Map();
|
|
268585
|
+
return (source2, extra = {}) => {
|
|
268586
|
+
const run4 = deps[source2];
|
|
268587
|
+
if (!run4) return Promise.resolve(void 0);
|
|
268588
|
+
const key4 = `${source2}:${JSON.stringify(extra)}`;
|
|
268589
|
+
if (!cache4.has(key4)) cache4.set(key4, capture((io2) => run4({ ...flags, ...extra }, io2)));
|
|
268590
|
+
return cache4.get(key4);
|
|
268591
|
+
};
|
|
268369
268592
|
}
|
|
268370
268593
|
function areasFrom(flags) {
|
|
268371
268594
|
const only = text28(flags.only);
|
|
@@ -268379,32 +268602,20 @@ function refuse9(io2, code3, error) {
|
|
|
268379
268602
|
io2.error(JSON.stringify({ ok: false, error, code: code3 }));
|
|
268380
268603
|
return 2;
|
|
268381
268604
|
}
|
|
268382
|
-
async function runSetupCheck(flags, io2, deps) {
|
|
268605
|
+
async function runSetupCheck(flags, io2, deps, checks = SETUP_CHECKS) {
|
|
268383
268606
|
for (const name of ["only", "iap-manifest"]) {
|
|
268384
268607
|
if (flags[name] !== void 0 && !text28(flags[name])) return refuse9(io2, "missing_flag_value", `--${name} needs a value`);
|
|
268385
268608
|
}
|
|
268386
268609
|
const areas = areasFrom(flags);
|
|
268387
268610
|
if (!Array.isArray(areas)) return refuse9(io2, areas.code, areas.error);
|
|
268388
|
-
|
|
268389
|
-
if (text28(flags.only) && areas.includes("iap") && !manifest2) {
|
|
268611
|
+
if (text28(flags.only) && areas.includes("iap") && !text28(flags["iap-manifest"])) {
|
|
268390
268612
|
return refuse9(io2, "iap_manifest_required", "--only iap needs --iap-manifest <file>");
|
|
268391
268613
|
}
|
|
268614
|
+
const read2 = sourceReader(flags, deps);
|
|
268392
268615
|
const report9 = {};
|
|
268393
|
-
|
|
268394
|
-
const
|
|
268395
|
-
|
|
268396
|
-
if (areas.includes("push")) {
|
|
268397
|
-
if (result) report9.push = pushSection(result);
|
|
268398
|
-
else report9.push = failure(refusal2);
|
|
268399
|
-
}
|
|
268400
|
-
if (areas.includes("signin")) report9.signIn = signIn3 ? signInSection(signIn3) : failure(result ? { error: text28(result.error) ?? "sign_in_status_missing" } : refusal2);
|
|
268401
|
-
}
|
|
268402
|
-
if (areas.includes("iap")) {
|
|
268403
|
-
if (!manifest2) report9.iap = { ok: null, state: "not_checked", code: "iap_manifest_missing", fix: "Pass --iap-manifest <file> (and --catalog-route <path>) to check IAP." };
|
|
268404
|
-
else {
|
|
268405
|
-
const { result, refusal: refusal2 } = await capture((sub) => deps.iapCheck({ ...flags, manifest: manifest2, json: true }, sub));
|
|
268406
|
-
report9.iap = result && typeof result.ok === "boolean" ? { ...result, ok: result.ok } : failure(refusal2);
|
|
268407
|
-
}
|
|
268616
|
+
for (const check of checks.filter((c2) => c2.areas.some((a3) => areas.includes(a3)))) {
|
|
268617
|
+
const section3 = await check.run({ flags, areas, read: read2 });
|
|
268618
|
+
if (section3) report9[check.name] = section3;
|
|
268408
268619
|
}
|
|
268409
268620
|
const sections2 = Object.entries(report9);
|
|
268410
268621
|
const ok5 = sections2.every(([, s5]) => s5.ok !== false);
|
|
@@ -268412,13 +268623,110 @@ async function runSetupCheck(flags, io2, deps) {
|
|
|
268412
268623
|
io2.log(JSON.stringify({ ok: ok5, ...unverified.length ? { unverified } : {}, ...report9 }, null, 2));
|
|
268413
268624
|
return ok5 ? 0 : 1;
|
|
268414
268625
|
}
|
|
268415
|
-
var AREAS, obj14, text28;
|
|
268416
268626
|
var init_setup_check = __esm({
|
|
268417
268627
|
"src/setup-check.ts"() {
|
|
268418
268628
|
init_define_HHP_CATALOG();
|
|
268419
|
-
|
|
268420
|
-
|
|
268421
|
-
|
|
268629
|
+
init_setup_checks();
|
|
268630
|
+
}
|
|
268631
|
+
});
|
|
268632
|
+
|
|
268633
|
+
// src/iap-setup/check.ts
|
|
268634
|
+
var check_exports = {};
|
|
268635
|
+
__export(check_exports, {
|
|
268636
|
+
runIapSetupCheck: () => runIapSetupCheck
|
|
268637
|
+
});
|
|
268638
|
+
import { readFileSync as readFileSync173 } from "node:fs";
|
|
268639
|
+
import { resolve as resolve117 } from "node:path";
|
|
268640
|
+
async function runIapSetupCheck(flags, io2, deps = {}) {
|
|
268641
|
+
const target = identityFrom(flags, deps);
|
|
268642
|
+
if ("refused" in target) {
|
|
268643
|
+
io2.error(JSON.stringify({ ok: false, code: target.refused, error: target.refused, hint: target.hint }));
|
|
268644
|
+
return 2;
|
|
268645
|
+
}
|
|
268646
|
+
const owner = await (deps.session ?? hostedOwnerSession)(flags);
|
|
268647
|
+
if (!owner.ok) {
|
|
268648
|
+
io2.error(JSON.stringify({ ok: false, code: "owner_session_unavailable", error: owner.error, ...owner.hint ? { hint: owner.hint } : {} }));
|
|
268649
|
+
return owner.exit;
|
|
268650
|
+
}
|
|
268651
|
+
const identity = { ...target, app: await (deps.resolveApp ?? ownedSlug(deps))(owner.session, target.app) };
|
|
268652
|
+
const snapshot4 = await readSnapshot(identity.site, deps);
|
|
268653
|
+
const steps = {
|
|
268654
|
+
"asc-key": await ascKeyCheck(owner.session, identity, deps),
|
|
268655
|
+
"purchases-app": snapshot4 ? checkPurchasesApp({ ...identity, name: identity.app }, snapshot4) : unavailable(),
|
|
268656
|
+
"iap-key": snapshot4 ? checkIapKey(identity, snapshot4) : unavailable(),
|
|
268657
|
+
"payment-provider": checkPaymentProvider()
|
|
268658
|
+
};
|
|
268659
|
+
io2.log(JSON.stringify({ ok: true, app: identity.app, site: identity.site, bundleId: identity.bundleId, steps }));
|
|
268660
|
+
return 0;
|
|
268661
|
+
}
|
|
268662
|
+
function identityFrom(flags, deps) {
|
|
268663
|
+
const input = (deps.inputs ?? inputsFromContent)(flags);
|
|
268664
|
+
const manifestPath = typeof flags["iap-manifest"] === "string" && flags["iap-manifest"] ? flags["iap-manifest"] : void 0;
|
|
268665
|
+
let manifest2;
|
|
268666
|
+
if (manifestPath) {
|
|
268667
|
+
try {
|
|
268668
|
+
manifest2 = (deps.manifestTarget ?? readManifestTarget)(manifestPath);
|
|
268669
|
+
} catch {
|
|
268670
|
+
return { refused: "iap_manifest_unreadable", hint: `Could not read the IAP manifest at ${manifestPath}.` };
|
|
268671
|
+
}
|
|
268672
|
+
}
|
|
268673
|
+
const bundleFlag = typeof flags["bundle-id"] === "string" && flags["bundle-id"] ? flags["bundle-id"] : void 0;
|
|
268674
|
+
const app2 = input.app ?? manifest2?.himiApp;
|
|
268675
|
+
const site = manifest2?.wixSiteId ?? input.site;
|
|
268676
|
+
const bundleId = manifest2?.bundleId ?? bundleFlag ?? input.bundleId;
|
|
268677
|
+
if (!app2 || !site || !bundleId) {
|
|
268678
|
+
return { refused: "iap_setup_identity_missing", hint: "Run it from the app's content folder (--content <dir>), or pass --app, --site and --bundle-id, or --iap-manifest <file>." };
|
|
268679
|
+
}
|
|
268680
|
+
return { app: app2, site, bundleId };
|
|
268681
|
+
}
|
|
268682
|
+
function readManifestTarget(path2) {
|
|
268683
|
+
return parseIapManifest(readFileSync173(path2, "utf8"), path2).target;
|
|
268684
|
+
}
|
|
268685
|
+
function ownedSlug(deps) {
|
|
268686
|
+
return async (session, app2) => {
|
|
268687
|
+
const verdict = await verifyAppOwnership({ ownerIssue: session.ownerIssue, controlToken: session.controlToken, declaredName: app2, ...deps.fetchImpl ? { fetchImpl: deps.fetchImpl } : {} });
|
|
268688
|
+
return verdict.state === "owned" ? verdict.slug : app2;
|
|
268689
|
+
};
|
|
268690
|
+
}
|
|
268691
|
+
function inputsFromContent(flags) {
|
|
268692
|
+
const dir = resolve117(typeof flags.content === "string" && flags.content ? flags.content : process.cwd());
|
|
268693
|
+
return mergePushInputs(pushInputsFromContent(dir), flags);
|
|
268694
|
+
}
|
|
268695
|
+
async function readSnapshot(site, deps) {
|
|
268696
|
+
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
268697
|
+
const transport = (deps.purchases ?? ((id) => ownerTransport(id, (url, init) => fetchImpl(url, { ...init, redirect: "error" }), void 0, userSiteToken)))(site);
|
|
268698
|
+
try {
|
|
268699
|
+
return await readIapSetup(createPurchasesOwnerApi(transport));
|
|
268700
|
+
} catch {
|
|
268701
|
+
return null;
|
|
268702
|
+
}
|
|
268703
|
+
}
|
|
268704
|
+
async function ascKeyCheck(session, identity, deps) {
|
|
268705
|
+
const status2 = deps.ascStatus ?? ((s5, input) => ascKeyRequest(s5, input, deps.fetchImpl ?? fetch));
|
|
268706
|
+
try {
|
|
268707
|
+
const asc = await status2(session, { app: identity.app, site: identity.site });
|
|
268708
|
+
return asc.present ? { state: "ready", ...asc.keyId ? { detail: `key ${asc.keyId}` } : {} } : { state: "missing", code: "asc_key_missing", detail: "no App Store Connect key on the site" };
|
|
268709
|
+
} catch {
|
|
268710
|
+
return unavailable();
|
|
268711
|
+
}
|
|
268712
|
+
}
|
|
268713
|
+
function unavailable() {
|
|
268714
|
+
return { state: "unavailable", code: "read_failed" };
|
|
268715
|
+
}
|
|
268716
|
+
var init_check2 = __esm({
|
|
268717
|
+
"src/iap-setup/check.ts"() {
|
|
268718
|
+
init_define_HHP_CATALOG();
|
|
268719
|
+
init_iap_manifest();
|
|
268720
|
+
init_apple_keys();
|
|
268721
|
+
init_hosted_owner();
|
|
268722
|
+
init_owner_claim();
|
|
268723
|
+
init_push_onboarding();
|
|
268724
|
+
init_store_iap_purchases();
|
|
268725
|
+
init_wix_owner();
|
|
268726
|
+
init_iap_key();
|
|
268727
|
+
init_payment_provider();
|
|
268728
|
+
init_purchases_app();
|
|
268729
|
+
init_snapshot();
|
|
268422
268730
|
}
|
|
268423
268731
|
});
|
|
268424
268732
|
|
|
@@ -268921,16 +269229,16 @@ __export(runtime_copy_exports, {
|
|
|
268921
269229
|
rowId: () => rowId
|
|
268922
269230
|
});
|
|
268923
269231
|
import { createHash as createHash93 } from "node:crypto";
|
|
268924
|
-
import { existsSync as existsSync143, readFileSync as
|
|
269232
|
+
import { existsSync as existsSync143, readFileSync as readFileSync174, writeFileSync as writeFileSync66 } from "node:fs";
|
|
268925
269233
|
import { readdirSync as readdirSync63 } from "node:fs";
|
|
268926
|
-
import { dirname as dirname81, join as join184, relative as relative34, resolve as
|
|
269234
|
+
import { dirname as dirname81, join as join184, relative as relative34, resolve as resolve118 } from "node:path";
|
|
268927
269235
|
import { fileURLToPath as fileURLToPath41 } from "node:url";
|
|
268928
269236
|
function appSourceCatalogs() {
|
|
268929
269237
|
const appsDir = join184(REPO_ROOT8, "apps");
|
|
268930
269238
|
return readdirSync63(appsDir).sort().map((app2) => join184(appsDir, app2, "l10n", "en.json")).filter((p2) => existsSync143(p2));
|
|
268931
269239
|
}
|
|
268932
269240
|
function loadTable(path2 = TABLE_PATH) {
|
|
268933
|
-
const raw = JSON.parse(
|
|
269241
|
+
const raw = JSON.parse(readFileSync174(path2, "utf8"));
|
|
268934
269242
|
const out2 = {};
|
|
268935
269243
|
for (const [k3, v2] of Object.entries(raw)) {
|
|
268936
269244
|
if (k3.startsWith("_")) continue;
|
|
@@ -269013,7 +269321,7 @@ function expectedOutputs(table = loadTable()) {
|
|
|
269013
269321
|
{ path: TS_OUT, content: renderTs(table) }
|
|
269014
269322
|
];
|
|
269015
269323
|
for (const p2 of appSourceCatalogs()) {
|
|
269016
|
-
out2.push({ path: p2, content: JSON.stringify(injectRuntimeRows(JSON.parse(
|
|
269324
|
+
out2.push({ path: p2, content: JSON.stringify(injectRuntimeRows(JSON.parse(readFileSync174(p2, "utf8")), table), null, 2) + "\n" });
|
|
269017
269325
|
}
|
|
269018
269326
|
return out2;
|
|
269019
269327
|
}
|
|
@@ -269021,7 +269329,7 @@ var REPO_ROOT8, TABLE_PATH, SWIFT_OUT, KOTLIN_OUT, TS_OUT, HEADER3, RUNTIME_KIND
|
|
|
269021
269329
|
var init_runtime_copy = __esm({
|
|
269022
269330
|
"../l10n/runtime-copy.ts"() {
|
|
269023
269331
|
init_define_HHP_CATALOG();
|
|
269024
|
-
REPO_ROOT8 =
|
|
269332
|
+
REPO_ROOT8 = resolve118(dirname81(fileURLToPath41(import.meta.url)), "../..");
|
|
269025
269333
|
TABLE_PATH = join184(REPO_ROOT8, "core/runtime/l10n/runtime/en.json");
|
|
269026
269334
|
SWIFT_OUT = join184(REPO_ROOT8, "core/runtime/ios/HimalayaCore/Sources/HimalayaCore/RuntimeCopyDefaults.generated.swift");
|
|
269027
269335
|
KOTLIN_OUT = join184(REPO_ROOT8, "core/runtime/android/io/himalaya/core/src/main/kotlin/io/himalaya/core/RuntimeCopyDefaults.generated.kt");
|
|
@@ -269069,8 +269377,8 @@ __export(auth_gate_copy_exports, {
|
|
|
269069
269377
|
scanThrownMessages: () => scanThrownMessages
|
|
269070
269378
|
});
|
|
269071
269379
|
import { createHash as createHash94 } from "node:crypto";
|
|
269072
|
-
import { existsSync as existsSync144, readdirSync as readdirSync64, readFileSync as
|
|
269073
|
-
import { dirname as dirname82, join as join185, relative as relative35, resolve as
|
|
269380
|
+
import { existsSync as existsSync144, readdirSync as readdirSync64, readFileSync as readFileSync175, writeFileSync as writeFileSync67 } from "node:fs";
|
|
269381
|
+
import { dirname as dirname82, join as join185, relative as relative35, resolve as resolve119 } from "node:path";
|
|
269074
269382
|
import { fileURLToPath as fileURLToPath42 } from "node:url";
|
|
269075
269383
|
function discoverMessageSources() {
|
|
269076
269384
|
const roots2 = [
|
|
@@ -269090,7 +269398,7 @@ function discoverMessageSources() {
|
|
|
269090
269398
|
if (/^(?:test|tests|Tests|androidTest|build|node_modules|\.build)$/.test(name.name)) continue;
|
|
269091
269399
|
visit(child3);
|
|
269092
269400
|
} else if (/\.(?:swift|kt)$/.test(name.name) && !GATE_SOURCES.includes(child3)) {
|
|
269093
|
-
if (MESSAGE_FILE.test(
|
|
269401
|
+
if (MESSAGE_FILE.test(readFileSync175(join185(REPO_ROOT9, child3), "utf8"))) out2.push(child3);
|
|
269094
269402
|
}
|
|
269095
269403
|
}
|
|
269096
269404
|
};
|
|
@@ -269098,7 +269406,7 @@ function discoverMessageSources() {
|
|
|
269098
269406
|
return out2.sort();
|
|
269099
269407
|
}
|
|
269100
269408
|
function loadTable2(path2 = TABLE_PATH2) {
|
|
269101
|
-
const raw = JSON.parse(
|
|
269409
|
+
const raw = JSON.parse(readFileSync175(path2, "utf8"));
|
|
269102
269410
|
const out2 = {};
|
|
269103
269411
|
for (const [k3, v2] of Object.entries(raw)) {
|
|
269104
269412
|
if (k3.startsWith("_")) continue;
|
|
@@ -269172,7 +269480,7 @@ function nativeKeysPath(appDir3) {
|
|
|
269172
269480
|
function loadNativeKeys(appDir3) {
|
|
269173
269481
|
const p2 = nativeKeysPath(appDir3);
|
|
269174
269482
|
if (!existsSync144(p2)) return void 0;
|
|
269175
|
-
const raw = JSON.parse(
|
|
269483
|
+
const raw = JSON.parse(readFileSync175(p2, "utf8"));
|
|
269176
269484
|
if (!Array.isArray(raw.keys) || raw.keys.some((k3) => typeof k3 !== "string")) {
|
|
269177
269485
|
throw new Error(`${p2}: expected { "keys": string[] }`);
|
|
269178
269486
|
}
|
|
@@ -269181,7 +269489,7 @@ function loadNativeKeys(appDir3) {
|
|
|
269181
269489
|
function loadAppTable(appDir3) {
|
|
269182
269490
|
const p2 = join185(appDir3, "strings", "en.json");
|
|
269183
269491
|
if (!existsSync144(p2)) return {};
|
|
269184
|
-
const raw = JSON.parse(
|
|
269492
|
+
const raw = JSON.parse(readFileSync175(p2, "utf8"));
|
|
269185
269493
|
const out2 = {};
|
|
269186
269494
|
for (const [k3, v2] of Object.entries(raw)) if (!k3.startsWith("_") && typeof v2 === "string") out2[k3] = v2;
|
|
269187
269495
|
return out2;
|
|
@@ -269239,14 +269547,14 @@ function innermostCallee(before) {
|
|
|
269239
269547
|
return m2?.[1].replace(/\s+/g, "");
|
|
269240
269548
|
}
|
|
269241
269549
|
function loadAllow(section3, path2 = ALLOW_PATH) {
|
|
269242
|
-
const raw = JSON.parse(
|
|
269550
|
+
const raw = JSON.parse(readFileSync175(path2, "utf8"));
|
|
269243
269551
|
const list5 = raw[section3] ?? [];
|
|
269244
269552
|
for (const e2 of list5) {
|
|
269245
269553
|
if (!e2.file || !e2.text || !e2.reason) throw new Error(`allowlist entry missing file/text/reason: ${JSON.stringify(e2)}`);
|
|
269246
269554
|
}
|
|
269247
269555
|
return list5;
|
|
269248
269556
|
}
|
|
269249
|
-
function scanProse(files, allow = [], read2 = (rel2) =>
|
|
269557
|
+
function scanProse(files, allow = [], read2 = (rel2) => readFileSync175(join185(REPO_ROOT9, rel2), "utf8")) {
|
|
269250
269558
|
const hits = [];
|
|
269251
269559
|
const usedAllow = /* @__PURE__ */ new Set();
|
|
269252
269560
|
for (const file2 of files) {
|
|
@@ -269275,12 +269583,12 @@ function expectedOutputs2(table = loadTable2()) {
|
|
|
269275
269583
|
{ path: KOTLIN_OUT2, content: renderKotlin2(table) }
|
|
269276
269584
|
];
|
|
269277
269585
|
for (const p2 of appSourceCatalogs2()) {
|
|
269278
|
-
const committed = JSON.parse(
|
|
269586
|
+
const committed = JSON.parse(readFileSync175(p2, "utf8"));
|
|
269279
269587
|
out2.push({ path: p2, content: serializeCatalog(injectAllNativeRows(committed, dirname82(dirname82(p2)), table)) });
|
|
269280
269588
|
}
|
|
269281
269589
|
return out2;
|
|
269282
269590
|
}
|
|
269283
|
-
function scanThrownMessages(files, read2 = (rel2) =>
|
|
269591
|
+
function scanThrownMessages(files, read2 = (rel2) => readFileSync175(join185(REPO_ROOT9, rel2), "utf8")) {
|
|
269284
269592
|
const out2 = [];
|
|
269285
269593
|
for (const file2 of files) {
|
|
269286
269594
|
const src = read2(file2);
|
|
@@ -269304,7 +269612,7 @@ var init_auth_gate_copy = __esm({
|
|
|
269304
269612
|
init_governs();
|
|
269305
269613
|
init_runtime_copy();
|
|
269306
269614
|
HERE5 = dirname82(fileURLToPath42(import.meta.url));
|
|
269307
|
-
REPO_ROOT9 =
|
|
269615
|
+
REPO_ROOT9 = resolve119(HERE5, "../..");
|
|
269308
269616
|
TABLE_PATH2 = join185(REPO_ROOT9, "core/runtime/l10n/auth-gate/en.json");
|
|
269309
269617
|
SWIFT_OUT2 = join185(
|
|
269310
269618
|
REPO_ROOT9,
|
|
@@ -269347,7 +269655,7 @@ var init_auth_gate_copy = __esm({
|
|
|
269347
269655
|
});
|
|
269348
269656
|
|
|
269349
269657
|
// ../l10n/extract.ts
|
|
269350
|
-
import { resolve as
|
|
269658
|
+
import { resolve as resolve120, join as join186, relative as relative36, dirname as dirname83 } from "node:path";
|
|
269351
269659
|
import { createHash as createHash95 } from "node:crypto";
|
|
269352
269660
|
import { fileURLToPath as fileURLToPath43 } from "node:url";
|
|
269353
269661
|
function keyOf3(source2) {
|
|
@@ -269361,7 +269669,7 @@ var init_extract = __esm({
|
|
|
269361
269669
|
init_bindings();
|
|
269362
269670
|
init_auth_gate_copy();
|
|
269363
269671
|
init_runtime_copy();
|
|
269364
|
-
ROOT8 =
|
|
269672
|
+
ROOT8 = resolve120(fileURLToPath43(new URL("../..", import.meta.url)));
|
|
269365
269673
|
if (false) {
|
|
269366
269674
|
void main();
|
|
269367
269675
|
}
|
|
@@ -269733,8 +270041,8 @@ __export(base44_adopt_exports, {
|
|
|
269733
270041
|
renderAdoptModule: () => renderAdoptModule,
|
|
269734
270042
|
runBase44Adopt: () => runBase44Adopt
|
|
269735
270043
|
});
|
|
269736
|
-
import { existsSync as existsSync146, readFileSync as
|
|
269737
|
-
import { join as join188, resolve as
|
|
270044
|
+
import { existsSync as existsSync146, readFileSync as readFileSync177, writeFileSync as writeFileSync69 } from "node:fs";
|
|
270045
|
+
import { join as join188, resolve as resolve122 } from "node:path";
|
|
269738
270046
|
function prop(entity, key4) {
|
|
269739
270047
|
const props2 = entity.schema?.properties;
|
|
269740
270048
|
const p2 = props2 && typeof props2 === "object" ? props2[key4] : void 0;
|
|
@@ -269824,11 +270132,11 @@ function renderAdoptModule(r3, source2 = ".himi/base44-book/book.json") {
|
|
|
269824
270132
|
].join("\n");
|
|
269825
270133
|
}
|
|
269826
270134
|
function runBase44Adopt(opts) {
|
|
269827
|
-
const bookDir =
|
|
270135
|
+
const bookDir = resolve122(opts.cwd, opts.book ?? ".himi/base44-book");
|
|
269828
270136
|
const bookPath = join188(bookDir, "book.json");
|
|
269829
270137
|
let book;
|
|
269830
270138
|
try {
|
|
269831
|
-
book = JSON.parse(
|
|
270139
|
+
book = JSON.parse(readFileSync177(bookPath, "utf8"));
|
|
269832
270140
|
if (!book || typeof book !== "object" || !Array.isArray(book.entities)) throw new Error("not a Base44 app book (no entities[])");
|
|
269833
270141
|
} catch (e2) {
|
|
269834
270142
|
throw new AdoptError("book_unreadable", `could not read ${bookPath}: ${e2.message}. Run \`himi base44 analyze --app-id <id>\` first.`);
|
|
@@ -269841,7 +270149,7 @@ function runBase44Adopt(opts) {
|
|
|
269841
270149
|
const module = renderAdoptModule(result, opts.book ? join188(opts.book, "book.json") : void 0);
|
|
269842
270150
|
const issues = validateBase44Entities({ entities: result.entities, functions: result.functions }, opts.app);
|
|
269843
270151
|
if (opts.write === void 0 || opts.write === false || issues.some((i2) => i2.severity === "error")) return { result, module, issues };
|
|
269844
|
-
const target = typeof opts.write === "string" ?
|
|
270152
|
+
const target = typeof opts.write === "string" ? resolve122(opts.cwd, opts.write) : join188(opts.cwd, ADOPT_MODULE_FILENAME);
|
|
269845
270153
|
if (existsSync146(target)) {
|
|
269846
270154
|
throw new AdoptError("adopt_target_exists", `${target} already exists \u2014 adopt never overwrites. Delete or rename it, or pass --write <other path>.`, 1, { path: target });
|
|
269847
270155
|
}
|
|
@@ -270093,7 +270401,7 @@ __export(generate_exports, {
|
|
|
270093
270401
|
writeGenerated: () => writeGenerated2
|
|
270094
270402
|
});
|
|
270095
270403
|
import { createHash as createHash96 } from "node:crypto";
|
|
270096
|
-
import { existsSync as existsSync147, mkdirSync as mkdirSync63, readdirSync as readdirSync66, readFileSync as
|
|
270404
|
+
import { existsSync as existsSync147, mkdirSync as mkdirSync63, readdirSync as readdirSync66, readFileSync as readFileSync178, writeFileSync as writeFileSync70 } from "node:fs";
|
|
270097
270405
|
import { dirname as dirname85, join as join189 } from "node:path";
|
|
270098
270406
|
function withHeader(body) {
|
|
270099
270407
|
return `${GENERATED_HEADER}${sha2568(body)}
|
|
@@ -270222,7 +270530,7 @@ function writeGenerated2(dir, files, opts = {}) {
|
|
|
270222
270530
|
let outcome;
|
|
270223
270531
|
if (!existsSync147(abs)) outcome = "written";
|
|
270224
270532
|
else {
|
|
270225
|
-
const cur =
|
|
270533
|
+
const cur = readFileSync178(abs, "utf8");
|
|
270226
270534
|
if (cur === next) outcome = "unchanged";
|
|
270227
270535
|
else if (isEdited(cur) && !opts.force) outcome = "skipped-edited";
|
|
270228
270536
|
else outcome = "written";
|
|
@@ -270247,7 +270555,7 @@ function orphanedFiles(dir, current) {
|
|
|
270247
270555
|
}
|
|
270248
270556
|
for (const rel2 of candidates.sort()) {
|
|
270249
270557
|
if (keep.has(rel2) || !existsSync147(join189(dir, rel2))) continue;
|
|
270250
|
-
if (
|
|
270558
|
+
if (readFileSync178(join189(dir, rel2), "utf8").startsWith(GENERATED_HEADER)) found.push(rel2);
|
|
270251
270559
|
}
|
|
270252
270560
|
return found;
|
|
270253
270561
|
}
|
|
@@ -270286,7 +270594,7 @@ __export(base44_auth_exports, {
|
|
|
270286
270594
|
usableBase44Auth: () => usableBase44Auth,
|
|
270287
270595
|
writeBase44Session: () => writeBase44Session
|
|
270288
270596
|
});
|
|
270289
|
-
import { chmodSync as chmodSync7, existsSync as existsSync148, mkdirSync as mkdirSync64, readFileSync as
|
|
270597
|
+
import { chmodSync as chmodSync7, existsSync as existsSync148, mkdirSync as mkdirSync64, readFileSync as readFileSync179, rmSync as rmSync44, writeFileSync as writeFileSync71 } from "node:fs";
|
|
270290
270598
|
import { homedir as homedir22 } from "node:os";
|
|
270291
270599
|
import { dirname as dirname86, join as join190 } from "node:path";
|
|
270292
270600
|
function base44ApiBase(env = process.env) {
|
|
@@ -270299,7 +270607,7 @@ function readBase44Session(home2) {
|
|
|
270299
270607
|
const p2 = base44SessionPath(home2);
|
|
270300
270608
|
if (!existsSync148(p2)) return void 0;
|
|
270301
270609
|
try {
|
|
270302
|
-
const s5 = JSON.parse(
|
|
270610
|
+
const s5 = JSON.parse(readFileSync179(p2, "utf8"));
|
|
270303
270611
|
return typeof s5.accessToken === "string" && s5.accessToken ? s5 : void 0;
|
|
270304
270612
|
} catch {
|
|
270305
270613
|
return void 0;
|
|
@@ -270419,7 +270727,7 @@ function hasBase44WriteScope(auth) {
|
|
|
270419
270727
|
function importBase44CliSession(home2 = homedir22(), env = process.env) {
|
|
270420
270728
|
const src = join190(home2, ".base44", "auth", "auth.json");
|
|
270421
270729
|
if (!existsSync148(src)) throw new Error(`no Base44 CLI session at ${src} \u2014 run \`npx base44 login\` first, or use \`himi base44 login\``);
|
|
270422
|
-
const a3 = JSON.parse(
|
|
270730
|
+
const a3 = JSON.parse(readFileSync179(src, "utf8"));
|
|
270423
270731
|
if (typeof a3.accessToken !== "string" || !a3.accessToken) throw new Error(`${src} holds no access token`);
|
|
270424
270732
|
const session = {
|
|
270425
270733
|
accessToken: a3.accessToken,
|
|
@@ -270518,14 +270826,14 @@ __export(seed_exports, {
|
|
|
270518
270826
|
seedBase44Entities: () => seedBase44Entities,
|
|
270519
270827
|
writeBase44SeedRows: () => writeBase44SeedRows
|
|
270520
270828
|
});
|
|
270521
|
-
import { existsSync as existsSync149, readFileSync as
|
|
270829
|
+
import { existsSync as existsSync149, readFileSync as readFileSync180, writeFileSync as writeFileSync72 } from "node:fs";
|
|
270522
270830
|
import { join as join191 } from "node:path";
|
|
270523
270831
|
function readBase44SeedFile(dir) {
|
|
270524
270832
|
const file2 = join191(dir, BASE44_SEED_FILE);
|
|
270525
270833
|
if (!existsSync149(file2)) return {};
|
|
270526
270834
|
let parsed;
|
|
270527
270835
|
try {
|
|
270528
|
-
parsed = JSON.parse(
|
|
270836
|
+
parsed = JSON.parse(readFileSync180(file2, "utf8"));
|
|
270529
270837
|
} catch (e2) {
|
|
270530
270838
|
throw new SeedFileError(`${BASE44_SEED_FILE} is not valid JSON (${e2.message}). Fix or delete it.`);
|
|
270531
270839
|
}
|
|
@@ -270685,7 +270993,7 @@ function writeBase44SeedRows(opts) {
|
|
|
270685
270993
|
if (existsSync149(path2)) {
|
|
270686
270994
|
let parsed;
|
|
270687
270995
|
try {
|
|
270688
|
-
parsed = JSON.parse(
|
|
270996
|
+
parsed = JSON.parse(readFileSync180(path2, "utf8"));
|
|
270689
270997
|
} catch (e2) {
|
|
270690
270998
|
throw new SeedFileError(`${BASE44_SEED_FILE} is not valid JSON (${e2.message}). Refusing to regenerate, because overwriting it would discard the rows already in it.`);
|
|
270691
270999
|
}
|
|
@@ -271372,7 +271680,7 @@ async function readEntitySnapshot(appId3, deps) {
|
|
|
271372
271680
|
}
|
|
271373
271681
|
}
|
|
271374
271682
|
var JSON_FILE2;
|
|
271375
|
-
var
|
|
271683
|
+
var init_snapshot2 = __esm({
|
|
271376
271684
|
"src/base44-provision/snapshot.ts"() {
|
|
271377
271685
|
init_define_HHP_CATALOG();
|
|
271378
271686
|
init_app_source();
|
|
@@ -271389,7 +271697,7 @@ __export(apply_exports2, {
|
|
|
271389
271697
|
createBase44Entities: () => createBase44Entities,
|
|
271390
271698
|
fileLedger: () => fileLedger
|
|
271391
271699
|
});
|
|
271392
|
-
import { existsSync as existsSync151, readFileSync as
|
|
271700
|
+
import { existsSync as existsSync151, readFileSync as readFileSync181, writeFileSync as writeFileSync73 } from "node:fs";
|
|
271393
271701
|
import { join as join193 } from "node:path";
|
|
271394
271702
|
function fileLedger(dir, appId3) {
|
|
271395
271703
|
const path2 = join193(dir, LEDGER_FILE2);
|
|
@@ -271397,7 +271705,7 @@ function fileLedger(dir, appId3) {
|
|
|
271397
271705
|
if (!existsSync151(path2)) return {};
|
|
271398
271706
|
let v2;
|
|
271399
271707
|
try {
|
|
271400
|
-
v2 = JSON.parse(
|
|
271708
|
+
v2 = JSON.parse(readFileSync181(path2, "utf8"));
|
|
271401
271709
|
} catch (e2) {
|
|
271402
271710
|
throw new LedgerError(`${LEDGER_FILE2} is not valid JSON (${e2.message}) \u2014 fix it (a merge conflict?) rather than let himi rewrite it`);
|
|
271403
271711
|
}
|
|
@@ -271500,7 +271808,7 @@ var init_apply3 = __esm({
|
|
|
271500
271808
|
init_base44_schema();
|
|
271501
271809
|
init_http3();
|
|
271502
271810
|
init_plan6();
|
|
271503
|
-
|
|
271811
|
+
init_snapshot2();
|
|
271504
271812
|
LEDGER_FILE2 = "base44-provisioned.json";
|
|
271505
271813
|
LedgerError = class extends Error {
|
|
271506
271814
|
};
|
|
@@ -271946,7 +272254,7 @@ var init_visitor = __esm({
|
|
|
271946
272254
|
|
|
271947
272255
|
// src/base44-analyze/types.ts
|
|
271948
272256
|
var BASE44_BOOK_SCHEMA_VERSION, DEFAULT_SAMPLE_ROWS;
|
|
271949
|
-
var
|
|
272257
|
+
var init_types4 = __esm({
|
|
271950
272258
|
"src/base44-analyze/types.ts"() {
|
|
271951
272259
|
init_define_HHP_CATALOG();
|
|
271952
272260
|
BASE44_BOOK_SCHEMA_VERSION = 1;
|
|
@@ -272041,7 +272349,7 @@ var init_analyze = __esm({
|
|
|
272041
272349
|
init_owner();
|
|
272042
272350
|
init_redact();
|
|
272043
272351
|
init_visitor();
|
|
272044
|
-
|
|
272352
|
+
init_types4();
|
|
272045
272353
|
Base44InputError = class extends Error {
|
|
272046
272354
|
exit = 2;
|
|
272047
272355
|
};
|
|
@@ -272049,11 +272357,11 @@ var init_analyze = __esm({
|
|
|
272049
272357
|
});
|
|
272050
272358
|
|
|
272051
272359
|
// src/base44-analyze/write-artifacts.ts
|
|
272052
|
-
import { existsSync as existsSync152, mkdirSync as mkdirSync65, readFileSync as
|
|
272053
|
-
import { dirname as dirname87, join as join194, resolve as
|
|
272360
|
+
import { existsSync as existsSync152, mkdirSync as mkdirSync65, readFileSync as readFileSync182, rmSync as rmSync45, writeFileSync as writeFileSync74 } from "node:fs";
|
|
272361
|
+
import { dirname as dirname87, join as join194, resolve as resolve123, sep as sep34 } from "node:path";
|
|
272054
272362
|
function isBookFolder(dir) {
|
|
272055
272363
|
try {
|
|
272056
|
-
return JSON.parse(
|
|
272364
|
+
return JSON.parse(readFileSync182(join194(dir, "book.json"), "utf8")).kind === "base44-app-book";
|
|
272057
272365
|
} catch {
|
|
272058
272366
|
return false;
|
|
272059
272367
|
}
|
|
@@ -272127,7 +272435,7 @@ function renderBookMd(book) {
|
|
|
272127
272435
|
return L2.join("\n");
|
|
272128
272436
|
}
|
|
272129
272437
|
function writeBase44Book(result, outDir, opts = {}) {
|
|
272130
|
-
const out2 =
|
|
272438
|
+
const out2 = resolve123(outDir);
|
|
272131
272439
|
const book = result.book;
|
|
272132
272440
|
const files = [];
|
|
272133
272441
|
const shots = (opts.screenshots ?? []).filter((s5) => safeRel(s5.filename) && !s5.filename.includes("/"));
|
|
@@ -273032,10 +273340,10 @@ function permuteDomain(domain, allowSpecialUseDomain) {
|
|
|
273032
273340
|
}
|
|
273033
273341
|
function createPromiseCallback(cb) {
|
|
273034
273342
|
let callback;
|
|
273035
|
-
let
|
|
273343
|
+
let resolve135;
|
|
273036
273344
|
let reject;
|
|
273037
273345
|
const promise = new Promise((_resolve, _reject) => {
|
|
273038
|
-
|
|
273346
|
+
resolve135 = _resolve;
|
|
273039
273347
|
reject = _reject;
|
|
273040
273348
|
});
|
|
273041
273349
|
if (typeof cb === "function") {
|
|
@@ -273051,7 +273359,7 @@ function createPromiseCallback(cb) {
|
|
|
273051
273359
|
callback = (err, result) => {
|
|
273052
273360
|
try {
|
|
273053
273361
|
if (err) reject(err);
|
|
273054
|
-
else
|
|
273362
|
+
else resolve135(result);
|
|
273055
273363
|
} catch (e2) {
|
|
273056
273364
|
reject(e2 instanceof Error ? e2 : new Error());
|
|
273057
273365
|
}
|
|
@@ -275708,7 +276016,7 @@ __export(cli_exports, {
|
|
|
275708
276016
|
import { execFile as execFile7 } from "node:child_process";
|
|
275709
276017
|
import { mkdirSync as mkdirSync66, mkdtempSync as mkdtempSync14, rmSync as rmSync46, writeFileSync as writeFileSync75 } from "node:fs";
|
|
275710
276018
|
import { tmpdir as tmpdir15 } from "node:os";
|
|
275711
|
-
import { join as join195, resolve as
|
|
276019
|
+
import { join as join195, resolve as resolve124 } from "node:path";
|
|
275712
276020
|
import { promisify as promisify2 } from "node:util";
|
|
275713
276021
|
function projectDownloader(apiFetch, apiBase, token, extract = systemTar) {
|
|
275714
276022
|
return async (appId3) => {
|
|
@@ -275763,7 +276071,7 @@ async function runBase44Analyze(opts) {
|
|
|
275763
276071
|
now: opts.now ?? (() => /* @__PURE__ */ new Date())
|
|
275764
276072
|
};
|
|
275765
276073
|
const result = await analyzeBase44({ url: opts.url, appId: opts.appId, sample: opts.sample }, ports);
|
|
275766
|
-
const written = writeBase44Book(result,
|
|
276074
|
+
const written = writeBase44Book(result, resolve124(opts.cwd ?? process.cwd(), opts.outDir ?? ".himi/base44-book"), { screenshots });
|
|
275767
276075
|
return { ok: true, out: written.outDir, files: written.files, mode: result.book.mode, gaps: result.book.gaps, book: result.book };
|
|
275768
276076
|
}
|
|
275769
276077
|
var MAX_TARBALL_BYTES, systemTar;
|
|
@@ -277095,8 +277403,8 @@ var init_invite_plan = __esm({
|
|
|
277095
277403
|
});
|
|
277096
277404
|
|
|
277097
277405
|
// src/one-app/header-badges-cli.ts
|
|
277098
|
-
import { existsSync as existsSync154, lstatSync as lstatSync42, readFileSync as
|
|
277099
|
-
import { join as join197, resolve as
|
|
277406
|
+
import { existsSync as existsSync154, lstatSync as lstatSync42, readFileSync as readFileSync183, rmSync as rmSync47, statSync as statSync52, writeFileSync as writeFileSync76 } from "node:fs";
|
|
277407
|
+
import { join as join197, resolve as resolve126 } from "node:path";
|
|
277100
277408
|
function guestSignInParams(contentDir2) {
|
|
277101
277409
|
const profile = screenLoadParams(contentDir2, PROFILE_AVATAR_ITEM.onTap.params.screenId) ?? {};
|
|
277102
277410
|
const text32 = (key4) => typeof profile[key4] === "string" ? profile[key4] : "";
|
|
@@ -277108,12 +277416,17 @@ function parseArgs5(args) {
|
|
|
277108
277416
|
let evidenceDir;
|
|
277109
277417
|
let contentDir2;
|
|
277110
277418
|
let dryRun = false;
|
|
277419
|
+
let notNewApp = false;
|
|
277111
277420
|
for (let i2 = 0; i2 < args.length; i2++) {
|
|
277112
277421
|
const arg2 = args[i2];
|
|
277113
277422
|
if (arg2 === "--dry-run") {
|
|
277114
277423
|
dryRun = true;
|
|
277115
277424
|
continue;
|
|
277116
277425
|
}
|
|
277426
|
+
if (arg2 === "--not-new-app") {
|
|
277427
|
+
notNewApp = true;
|
|
277428
|
+
continue;
|
|
277429
|
+
}
|
|
277117
277430
|
if (arg2 !== "--evidence-dir" && arg2 !== "--content") throw new Error(`Unknown option: ${arg2}`);
|
|
277118
277431
|
const value2 = args[++i2];
|
|
277119
277432
|
if (!value2 || value2.startsWith("--")) throw new Error(`${arg2} requires a directory path.`);
|
|
@@ -277126,12 +277439,12 @@ function parseArgs5(args) {
|
|
|
277126
277439
|
}
|
|
277127
277440
|
}
|
|
277128
277441
|
if (!evidenceDir || !contentDir2) throw new Error("Both --evidence-dir and --content are required.");
|
|
277129
|
-
return { evidenceDir:
|
|
277442
|
+
return { evidenceDir: resolve126(evidenceDir), contentDir: resolve126(contentDir2), dryRun, notNewApp };
|
|
277130
277443
|
}
|
|
277131
277444
|
function contentScreens(contentDir2) {
|
|
277132
277445
|
const path2 = join197(contentDir2, "himalaya.content.json");
|
|
277133
277446
|
if (!existsSync154(path2)) throw new Error("himalaya.content.json not found: --content must be a Himi content package");
|
|
277134
|
-
const parsed = JSON.parse(
|
|
277447
|
+
const parsed = JSON.parse(readFileSync183(path2, "utf8"));
|
|
277135
277448
|
return new Set(Object.keys(parsed.screens ?? {}));
|
|
277136
277449
|
}
|
|
277137
277450
|
function mapCoverage2(evidenceDir, contentDir2, plan, bound2, dryRun) {
|
|
@@ -277160,7 +277473,7 @@ function mapCoverage2(evidenceDir, contentDir2, plan, bound2, dryRun) {
|
|
|
277160
277473
|
mapped++;
|
|
277161
277474
|
} else conflicts.push(`${source2.buttonId ?? source2.source}: already mapped to ${row2.target.screenId}/${row2.target.controlId ?? "?"}, not ${target.screenId}/${target.controlId}`);
|
|
277162
277475
|
}
|
|
277163
|
-
if (mapped && !dryRun) writeFileSync76(join197(
|
|
277476
|
+
if (mapped && !dryRun) writeFileSync76(join197(resolve126(contentDir2), COVERAGE_FILE), JSON.stringify(coverage2, null, 2) + "\n");
|
|
277164
277477
|
return { mapped, kept, conflicts };
|
|
277165
277478
|
}
|
|
277166
277479
|
function report6(io2, ok5, body) {
|
|
@@ -277194,13 +277507,18 @@ async function runOneAppHeaderBadges(args, io2) {
|
|
|
277194
277507
|
let configLinked = false;
|
|
277195
277508
|
try {
|
|
277196
277509
|
configLinked = lstatSync42(configPath).isSymbolicLink();
|
|
277197
|
-
if (!configLinked && statSync52(configPath).isFile()) configText =
|
|
277510
|
+
if (!configLinked && statSync52(configPath).isFile()) configText = readFileSync183(configPath, "utf8");
|
|
277198
277511
|
} catch {
|
|
277199
277512
|
}
|
|
277200
|
-
const
|
|
277513
|
+
const declaration2 = options2.notNewApp || !configText ? void 0 : declareNewApp(configText);
|
|
277514
|
+
const declaredNow = declaration2?.status === "written";
|
|
277515
|
+
if (declaredNow) configText = declaration2.text;
|
|
277516
|
+
const newApp = !options2.notNewApp && declaresNewApp(configText);
|
|
277517
|
+
const notNewReason = options2.notNewApp ? "--not-new-app was passed" : declaration2?.status === "manual" ? declaration2.reason : "config.ts declares `app.newApp` as not true";
|
|
277518
|
+
const nextStep2 = declaration2?.status === "manual" ? "Make `app` a plain object literal with `newApp: true` in it, and remove any spread, shorthand or computed key written after it that could set `app`; then run this command again." : "If it is new, set `app: { newApp: true }` in config.ts (or drop `--not-new-app`) and run this command again.";
|
|
277201
277519
|
const avatar = {
|
|
277202
277520
|
avatar: newApp ? hasProfileAvatar(configText) ? "present" : "not_written" : "skipped_not_new_app",
|
|
277203
|
-
...newApp ? {} : { avatarNote:
|
|
277521
|
+
...newApp ? {} : { avatarNote: `No profile avatar was written: the app is not treated as new (${notNewReason}). ${nextStep2}` }
|
|
277204
277522
|
};
|
|
277205
277523
|
const common2 = { sources: plan.sources, unmapped: plan.unmapped, warnings: plan.warnings, ...unverified.length ? { unverifiedPlatforms: unverified } : {}, ...avatar };
|
|
277206
277524
|
if (!plan.counters.length && !newApp) {
|
|
@@ -277240,7 +277558,7 @@ async function runOneAppHeaderBadges(args, io2) {
|
|
|
277240
277558
|
error: `tier5-src/${worker}/index.ts is missing: this app was scaffolded before that worker shipped. Re-scaffold from the current branded-lite template, or copy that worker and the _shared files it imports.`
|
|
277241
277559
|
});
|
|
277242
277560
|
}
|
|
277243
|
-
if (newApp && !(servesMemberAvatar(
|
|
277561
|
+
if (newApp && !(servesMemberAvatar(readFileSync183(workerSource, "utf8")) && existsSync154(join197(options2.contentDir, AVATAR_HELPER)))) {
|
|
277244
277562
|
return report6(io2, false, {
|
|
277245
277563
|
code: "worker_missing",
|
|
277246
277564
|
headerBadges: bindable,
|
|
@@ -277250,6 +277568,10 @@ async function runOneAppHeaderBadges(args, io2) {
|
|
|
277250
277568
|
});
|
|
277251
277569
|
}
|
|
277252
277570
|
const patch = patchConfig(configText, bindable, { avatar: newApp });
|
|
277571
|
+
if (declaredNow && patch.status === "unchanged") {
|
|
277572
|
+
patch.status = "written";
|
|
277573
|
+
patch.text = configText;
|
|
277574
|
+
}
|
|
277253
277575
|
if (patch.status === "manual") {
|
|
277254
277576
|
return report6(io2, false, {
|
|
277255
277577
|
code: "config_needs_manual_merge",
|
|
@@ -277277,11 +277599,11 @@ async function runOneAppHeaderBadges(args, io2) {
|
|
|
277277
277599
|
return report6(io2, false, { code: "content_invalid", headerBadges: bindable, skipped, ...common2, error: `The Profile screen could not be edited: ${error instanceof Error ? error.message : String(error)}` });
|
|
277278
277600
|
}
|
|
277279
277601
|
}
|
|
277280
|
-
const ledgerPath = join197(
|
|
277602
|
+
const ledgerPath = join197(resolve126(options2.contentDir), COVERAGE_FILE);
|
|
277281
277603
|
let ledgerBefore = null;
|
|
277282
277604
|
let coverage2;
|
|
277283
277605
|
try {
|
|
277284
|
-
ledgerBefore = existsSync154(ledgerPath) ?
|
|
277606
|
+
ledgerBefore = existsSync154(ledgerPath) ? readFileSync183(ledgerPath) : null;
|
|
277285
277607
|
coverage2 = bindable.length ? mapCoverage2(options2.evidenceDir, options2.contentDir, plan, bindable, options2.dryRun) : void 0;
|
|
277286
277608
|
} catch (error) {
|
|
277287
277609
|
return report6(io2, false, { code: "evidence_invalid", error: error instanceof Error ? error.message : String(error), headerBadges: bindable });
|
|
@@ -277335,6 +277657,7 @@ async function runOneAppHeaderBadges(args, io2) {
|
|
|
277335
277657
|
...common2.avatar === "not_written" ? { avatar: written ?? "present" } : {},
|
|
277336
277658
|
// The trailing actions that opened Account, dropped from navigation.topBarDefault.actions because the avatar is the profile entry now.
|
|
277337
277659
|
// A screen's own bar (dev/index.ts) is not edited: `validate-topbar` names each one left there.
|
|
277660
|
+
...declaredNow ? { newApp: options2.dryRun ? "would_declare" : "declared" } : {},
|
|
277338
277661
|
...newApp ? { removedProfileActions: patch.removedProfileActions ?? [] } : {},
|
|
277339
277662
|
next: "Map each source screen to its Himi screen (the `route` rows of ONE-APP-COVERAGE.json), then run `himi one-app validate-topbar` against the same evidence and content."
|
|
277340
277663
|
});
|
|
@@ -277348,17 +277671,18 @@ var init_header_badges_cli = __esm({
|
|
|
277348
277671
|
init_storefront();
|
|
277349
277672
|
init_provision();
|
|
277350
277673
|
init_template_adopt();
|
|
277674
|
+
init_access();
|
|
277351
277675
|
init_header_badges();
|
|
277352
277676
|
PROFILE_PAGES_PARAMS = { showPages: "1", signInOnAppear: "1" };
|
|
277353
277677
|
VISITOR_ONLY_PROFILE_PARAMS = { showPages: "1" };
|
|
277354
277678
|
GUEST_SIGN_IN_SCREENS = [HEADER_BADGE_SPEC.notifications.screenId, INBOX_SCREEN];
|
|
277355
277679
|
AVATAR_HELPER = "tier5-src/_shared/nav-member-avatar.ts";
|
|
277356
|
-
HEADER_BADGES_USAGE = "himi one-app header-badges --evidence-dir <.himi/one-app> --content <app-dir> [--dry-run]";
|
|
277680
|
+
HEADER_BADGES_USAGE = "himi one-app header-badges --evidence-dir <.himi/one-app> --content <app-dir> [--not-new-app] [--dry-run]";
|
|
277357
277681
|
}
|
|
277358
277682
|
});
|
|
277359
277683
|
|
|
277360
277684
|
// src/one-app/recipes.ts
|
|
277361
|
-
import { existsSync as existsSync155, readFileSync as
|
|
277685
|
+
import { existsSync as existsSync155, readFileSync as readFileSync184 } from "node:fs";
|
|
277362
277686
|
import { join as join198 } from "node:path";
|
|
277363
277687
|
function readRecipe(contentDir2, name, values) {
|
|
277364
277688
|
return readParts(contentDir2, name, values, "node");
|
|
@@ -277374,7 +277698,7 @@ function readParts(contentDir2, name, values, key4) {
|
|
|
277374
277698
|
}
|
|
277375
277699
|
let file2;
|
|
277376
277700
|
try {
|
|
277377
|
-
file2 = JSON.parse(
|
|
277701
|
+
file2 = JSON.parse(readFileSync184(path2, "utf8"));
|
|
277378
277702
|
} catch {
|
|
277379
277703
|
throw new RecipeError(`recipes/${name}.json is not valid JSON`);
|
|
277380
277704
|
}
|
|
@@ -278167,14 +278491,14 @@ function resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen
|
|
|
278167
278491
|
const screenOf = new Map(out2.routes.filter((r3) => r3.screenId).map((r3) => [r3.layoutItemId, r3.screenId]));
|
|
278168
278492
|
const taken2 = /* @__PURE__ */ new Set();
|
|
278169
278493
|
const tabOfScreen = new Map((hasTabBar ? out2.tabs : []).map((tab) => [tab.screenId, tabIdFor(tab, taken2)]));
|
|
278170
|
-
const
|
|
278494
|
+
const resolve135 = (value2) => {
|
|
278171
278495
|
const [named3, fallback, siblingType] = value2.slice(ROUTE_PLACEHOLDER.length).split("|");
|
|
278172
278496
|
const source2 = named3 && !screenOf.has(named3) && !pageOfScreen.has(named3) ? slugs.get(named3) ?? named3 : named3;
|
|
278173
278497
|
const page = source2 && !fellBack.has(`${source2}|${siblingType}`) ? screenOf.get(source2) ?? screenOf.get(pageOfScreen.get(source2) ?? "") : void 0;
|
|
278174
278498
|
return page || fallback || "";
|
|
278175
278499
|
};
|
|
278176
278500
|
const retarget = (tap) => {
|
|
278177
|
-
const target =
|
|
278501
|
+
const target = resolve135(str16(obj15(tap.params).screenId));
|
|
278178
278502
|
const tab = tabOfScreen.get(target);
|
|
278179
278503
|
const carries = Object.keys(obj15(tap.params)).some((key4) => key4 !== "screenId");
|
|
278180
278504
|
return tab && !carries ? { actionId: "himi.tab", params: { tab } } : { ...tap, params: { ...obj15(tap.params), screenId: target } };
|
|
@@ -278183,12 +278507,12 @@ function resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen
|
|
|
278183
278507
|
const isDeadButton = (v2) => {
|
|
278184
278508
|
const body = obj15(obj15(v2).body);
|
|
278185
278509
|
const action = obj15(body.props).action;
|
|
278186
|
-
return body.type === "Button" && isPlaceholderTap(action) && !
|
|
278510
|
+
return body.type === "Button" && isPlaceholderTap(action) && !resolve135(str16(obj15(obj15(action).params).screenId));
|
|
278187
278511
|
};
|
|
278188
278512
|
const DEAD = Symbol("dead");
|
|
278189
278513
|
let stats = { forum: 0, other: 0 };
|
|
278190
278514
|
const walk5 = (value2, dropped) => {
|
|
278191
|
-
if (typeof value2 === "string" && value2.startsWith(ROUTE_PLACEHOLDER)) return
|
|
278515
|
+
if (typeof value2 === "string" && value2.startsWith(ROUTE_PLACEHOLDER)) return resolve135(value2);
|
|
278192
278516
|
if (Array.isArray(value2)) return value2.map((v2) => walk5(v2, dropped)).filter((v2) => v2 !== DEAD);
|
|
278193
278517
|
if (value2 && typeof value2 === "object") {
|
|
278194
278518
|
if (isDeadButton(value2)) {
|
|
@@ -278199,7 +278523,7 @@ function resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen
|
|
|
278199
278523
|
else stats.other++;
|
|
278200
278524
|
return DEAD;
|
|
278201
278525
|
}
|
|
278202
|
-
const next = Object.fromEntries(Object.entries(value2).filter(([, v2]) => !(isPlaceholderTap(v2) && !
|
|
278526
|
+
const next = Object.fromEntries(Object.entries(value2).filter(([, v2]) => !(isPlaceholderTap(v2) && !resolve135(str16(obj15(obj15(v2).params).screenId)))).map(([k3, v2]) => [k3, isPlaceholderTap(v2) ? retarget(v2) : walk5(v2, dropped)]));
|
|
278203
278527
|
const type2 = obj15(obj15(value2).body).type;
|
|
278204
278528
|
const before = obj15(obj15(obj15(value2).body).props).children, after = obj15(obj15(next.body).props).children;
|
|
278205
278529
|
if ((type2 === "VStack" || type2 === "HStack") && Array.isArray(before) && before.length && Array.isArray(after) && !after.length) return DEAD;
|
|
@@ -278832,7 +279156,8 @@ var init_generate2 = __esm({
|
|
|
278832
279156
|
return plansSection(id, s5, index, ctx, { planIds: selectedPlanIds(st2), showBenefits: true, ...order ? { order } : {} });
|
|
278833
279157
|
},
|
|
278834
279158
|
// The site's first Pro Gallery galleries as cover cards (a rail, or full-width cards when the source turns its carousel off), as many as
|
|
278835
|
-
// the source's `maxGalleries`.
|
|
279159
|
+
// the source's `maxGalleries`. Like the source, which lists a member's non-hidden, non-empty galleries and shows a visitor (or a list it
|
|
279160
|
+
// cannot read) its empty state, the module reads for a signed-in member only. A card opens the template's gallery screen and View All its galleries screen: a scaffold without either
|
|
278836
279161
|
// keeps the title and a link, as every data section does.
|
|
278837
279162
|
progallery_carousel_section: (id, s5, st2, index, ctx, sectionId) => {
|
|
278838
279163
|
const asked = typeof st2.maxGalleries === "number" && st2.maxGalleries >= 1 ? Math.floor(st2.maxGalleries) : void 0;
|
|
@@ -279293,7 +279618,7 @@ var init_generate2 = __esm({
|
|
|
279293
279618
|
});
|
|
279294
279619
|
|
|
279295
279620
|
// src/one-app/apply-navigation.ts
|
|
279296
|
-
import { existsSync as existsSync156, readFileSync as
|
|
279621
|
+
import { existsSync as existsSync156, readFileSync as readFileSync185 } from "node:fs";
|
|
279297
279622
|
import { join as join199 } from "node:path";
|
|
279298
279623
|
import ts29 from "typescript";
|
|
279299
279624
|
function pagesWithoutScreen(plan, planned2) {
|
|
@@ -279396,7 +279721,7 @@ function stringOf2(node3) {
|
|
|
279396
279721
|
}
|
|
279397
279722
|
function definedScreens(contentDir2) {
|
|
279398
279723
|
try {
|
|
279399
|
-
const manifest2 = JSON.parse(
|
|
279724
|
+
const manifest2 = JSON.parse(readFileSync185(join199(contentDir2, "himalaya.content.json"), "utf8"));
|
|
279400
279725
|
return new Set(Object.keys(manifest2.screens ?? {}));
|
|
279401
279726
|
} catch {
|
|
279402
279727
|
return void 0;
|
|
@@ -279435,7 +279760,7 @@ async function runOneAppApplyNavigation(args, io2) {
|
|
|
279435
279760
|
const tabsPath = options2.tabs ?? tabsFileOf(join199(options2.evidenceDir, "gen", "screens.json"));
|
|
279436
279761
|
let plan;
|
|
279437
279762
|
try {
|
|
279438
|
-
plan = JSON.parse(
|
|
279763
|
+
plan = JSON.parse(readFileSync185(tabsPath, "utf8"));
|
|
279439
279764
|
if (plan.version !== 1 || !Array.isArray(plan.tabs) || !Array.isArray(plan.moreRows)) throw new Error("not a generated tabs file");
|
|
279440
279765
|
} catch {
|
|
279441
279766
|
return report7(io2, false, { code: "tabs_unavailable", error: `${tabsPath} is missing or unreadable: run \`himi one-app generate\` first, and \`himi template screens --upsert\` with its screens.` });
|
|
@@ -279473,7 +279798,7 @@ async function runOneAppApplyNavigation(args, io2) {
|
|
|
279473
279798
|
}
|
|
279474
279799
|
const configPath = join199(contentDir2, "config.ts");
|
|
279475
279800
|
if (!existsSync156(configPath)) return report7(io2, false, { code: "content_invalid", error: `${configPath} not found.` });
|
|
279476
|
-
const edit = applyNavigationToConfig(
|
|
279801
|
+
const edit = applyNavigationToConfig(readFileSync185(configPath, "utf8"), plan);
|
|
279477
279802
|
if (edit.status === "kept") return report7(io2, false, { code: "config_unwritable", error: edit.reason, tabs: plan.tabs });
|
|
279478
279803
|
if (edit.status === "set" && !options2.dryRun) writeFileAtomic(configPath, edit.source);
|
|
279479
279804
|
const icons = plan.tabs.filter((tab) => tab.layoutItemId !== "(more)").map((tab) => ({ tab: tab.label, source: tab.icon ?? null, ...tabIcon(tab.icon, tab.pageIcon) }));
|
|
@@ -279564,7 +279889,7 @@ var init_bookings = __esm({
|
|
|
279564
279889
|
});
|
|
279565
279890
|
|
|
279566
279891
|
// src/one-app/starter-keep-list.ts
|
|
279567
|
-
import { existsSync as existsSync157, readFileSync as
|
|
279892
|
+
import { existsSync as existsSync157, readFileSync as readFileSync186, writeFileSync as writeFileSync77 } from "node:fs";
|
|
279568
279893
|
import { join as join200 } from "node:path";
|
|
279569
279894
|
import ts30 from "typescript";
|
|
279570
279895
|
function screensOpenedBy(node3, found = /* @__PURE__ */ new Set()) {
|
|
@@ -279601,7 +279926,7 @@ function seedKeepList(facts) {
|
|
|
279601
279926
|
}
|
|
279602
279927
|
function loadStarter(dir) {
|
|
279603
279928
|
try {
|
|
279604
|
-
const dev =
|
|
279929
|
+
const dev = readFileSync186(join200(dir, "dev", "index.ts"), "utf8"), config = readFileSync186(join200(dir, "config.ts"), "utf8");
|
|
279605
279930
|
const workers = listWorkers(dir);
|
|
279606
279931
|
return { sources: { dev, config, workerDirs: workers.dirs, workerFiles: workers.files }, app: parseApp(dev, config), moduleTargets: /* @__PURE__ */ new Map() };
|
|
279607
279932
|
} catch (error) {
|
|
@@ -279803,7 +280128,7 @@ function writeStarterKeepList(contentDir2, facts) {
|
|
|
279803
280128
|
const seed2 = [...seedKeepList({ ...facts, template }), ...workerOpenedScreens(contentDir2, facts.workers ?? [])];
|
|
279804
280129
|
const excluded2 = [...closureExcludes(facts.storefront), ...bookingsClosureExcludes(facts.bookings)];
|
|
279805
280130
|
const wanted = new Set(seed2.map((row2) => row2.id));
|
|
279806
|
-
const pruned = created ? { text: SPEC_TEMPLATE, dropped: [] } : dropSelfWrittenRows(
|
|
280131
|
+
const pruned = created ? { text: SPEC_TEMPLATE, dropped: [] } : dropSelfWrittenRows(readFileSync186(path2, "utf8"), new Set(excluded2.filter((id) => !wanted.has(id))));
|
|
279807
280132
|
const spec = pruned.text;
|
|
279808
280133
|
const existing = specScreens(spec), mine = selfWrittenRows(spec);
|
|
279809
280134
|
const closure = closeOverTrim(contentDir2, [...seed2.map((row2) => row2.id), ...existing.filter((id) => !mine.has(id))], facts.generated, existing, excluded2);
|
|
@@ -279837,15 +280162,15 @@ var init_starter_keep_list = __esm({
|
|
|
279837
280162
|
});
|
|
279838
280163
|
|
|
279839
280164
|
// src/one-app/generate-cli.ts
|
|
279840
|
-
import { existsSync as existsSync158, mkdirSync as mkdirSync67, readdirSync as readdirSync67, readFileSync as
|
|
279841
|
-
import { dirname as dirname88, join as join201, resolve as
|
|
280165
|
+
import { existsSync as existsSync158, mkdirSync as mkdirSync67, readdirSync as readdirSync67, readFileSync as readFileSync187, rmSync as rmSync48, writeFileSync as writeFileSync78 } from "node:fs";
|
|
280166
|
+
import { dirname as dirname88, join as join201, resolve as resolve127 } from "node:path";
|
|
279842
280167
|
function removeStaleGeneratedWorkers(contentDir2, current) {
|
|
279843
280168
|
const root = join201(contentDir2, "tier5-src");
|
|
279844
280169
|
if (!existsSync158(root)) return;
|
|
279845
280170
|
for (const name of readdirSync67(root)) {
|
|
279846
280171
|
if (current.has(name) || name === "_shared") continue;
|
|
279847
280172
|
const index = join201(root, name, "index.ts");
|
|
279848
|
-
if (existsSync158(index) &&
|
|
280173
|
+
if (existsSync158(index) && readFileSync187(index, "utf8").startsWith(GENERATED_WORKER_MARKER)) rmSync48(join201(root, name), { recursive: true, force: true });
|
|
279849
280174
|
}
|
|
279850
280175
|
}
|
|
279851
280176
|
function parseArgs6(args) {
|
|
@@ -279867,11 +280192,11 @@ function parseArgs6(args) {
|
|
|
279867
280192
|
}
|
|
279868
280193
|
}
|
|
279869
280194
|
if (!evidenceDir || !contentDir2) throw new Error("Both --evidence-dir and --content are required.");
|
|
279870
|
-
return { evidenceDir:
|
|
280195
|
+
return { evidenceDir: resolve127(evidenceDir), contentDir: resolve127(contentDir2), out: resolve127(out2 ?? join201(evidenceDir, "gen", "screens.json")) };
|
|
279871
280196
|
}
|
|
279872
280197
|
function claimedHome(out2) {
|
|
279873
280198
|
try {
|
|
279874
|
-
return JSON.parse(
|
|
280199
|
+
return JSON.parse(readFileSync187(homeFile(out2), "utf8")).homeScreenId === TEMPLATE_HOME_SCREEN;
|
|
279875
280200
|
} catch {
|
|
279876
280201
|
return false;
|
|
279877
280202
|
}
|
|
@@ -279879,7 +280204,7 @@ function claimedHome(out2) {
|
|
|
279879
280204
|
function previousOutput(out2) {
|
|
279880
280205
|
const keys2 = (path2) => {
|
|
279881
280206
|
try {
|
|
279882
|
-
const value2 = JSON.parse(
|
|
280207
|
+
const value2 = JSON.parse(readFileSync187(path2, "utf8"));
|
|
279883
280208
|
return Array.isArray(value2) ? value2.filter((v2) => typeof v2 === "string") : value2 && typeof value2 === "object" ? Object.keys(value2) : [];
|
|
279884
280209
|
} catch {
|
|
279885
280210
|
return [];
|
|
@@ -279917,7 +280242,7 @@ async function runOneAppGenerate(args, io2) {
|
|
|
279917
280242
|
}
|
|
279918
280243
|
const fetchedAt = (() => {
|
|
279919
280244
|
try {
|
|
279920
|
-
const m2 = JSON.parse(
|
|
280245
|
+
const m2 = JSON.parse(readFileSync187(join201(options2.evidenceDir, "manifest.json"), "utf8"));
|
|
279921
280246
|
return typeof m2.source?.fetchedAt === "string" ? m2.source.fetchedAt : void 0;
|
|
279922
280247
|
} catch {
|
|
279923
280248
|
return void 0;
|
|
@@ -279927,7 +280252,7 @@ async function runOneAppGenerate(args, io2) {
|
|
|
279927
280252
|
let homeScreenId;
|
|
279928
280253
|
const previousIds = previousOutput(options2.out);
|
|
279929
280254
|
try {
|
|
279930
|
-
const manifest2 = JSON.parse(
|
|
280255
|
+
const manifest2 = JSON.parse(readFileSync187(join201(options2.contentDir, "himalaya.content.json"), "utf8"));
|
|
279931
280256
|
taken2 = new Set(Object.keys(manifest2.screens ?? {}));
|
|
279932
280257
|
if (taken2.has(TEMPLATE_HOME_SCREEN) && (!previousIds.includes(TEMPLATE_HOME_SCREEN) || claimedHome(options2.out))) homeScreenId = TEMPLATE_HOME_SCREEN;
|
|
279933
280258
|
for (const id of previousIds) taken2.delete(id);
|
|
@@ -280004,7 +280329,7 @@ async function runOneAppGenerate(args, io2) {
|
|
|
280004
280329
|
const lockWarnings = locks.status !== "carried" ? [] : coverage2.status === "skipped" ? [`the coverage ledger does not carry the page locks yet: ${coverage2.reason}`] : recordPageLockRows(options2.evidenceDir, options2.contentDir, locks.plan, raw);
|
|
280005
280330
|
let keepList;
|
|
280006
280331
|
try {
|
|
280007
|
-
const manifest2 = JSON.parse(
|
|
280332
|
+
const manifest2 = JSON.parse(readFileSync187(join201(options2.evidenceDir, "manifest.json"), "utf8"));
|
|
280008
280333
|
const badgePlan = readHashedEvidenceJson(options2.evidenceDir, "header-badge-plan.json");
|
|
280009
280334
|
const generated = Object.keys(result.screens);
|
|
280010
280335
|
const routed = result.routes.flatMap((route) => route.kind === "template" && route.screenId ? [route.screenId] : []);
|
|
@@ -280102,8 +280427,8 @@ var init_access_policy = __esm({
|
|
|
280102
280427
|
});
|
|
280103
280428
|
|
|
280104
280429
|
// src/one-app/payment-review.ts
|
|
280105
|
-
import { readFileSync as
|
|
280106
|
-
import { join as join202, resolve as
|
|
280430
|
+
import { readFileSync as readFileSync188 } from "node:fs";
|
|
280431
|
+
import { join as join202, resolve as resolve128 } from "node:path";
|
|
280107
280432
|
function preservesUnverifiedFlow(flow) {
|
|
280108
280433
|
const checkout = obj16(flow.checkout);
|
|
280109
280434
|
return flow.payment === "online-paid" && obj16(flow.readiness).state === "unverified" && checkout.state === "supported" && text30(checkout.evidence) && (flow.decision === void 0 || obj16(flow.decision).action === "proceed");
|
|
@@ -280185,14 +280510,14 @@ function runPaymentReview(args, io2) {
|
|
|
280185
280510
|
for (let i2 = 0; i2 < args.length; i2++) {
|
|
280186
280511
|
if (args[i2] === "--json" || args[i2] === "--skip-version-check") continue;
|
|
280187
280512
|
if (args[i2] !== "--evidence-dir" || evidenceDir || !args[i2 + 1] || args[i2 + 1].startsWith("--")) return fail16("invalid_usage", ["Pass --evidence-dir once."], 2);
|
|
280188
|
-
evidenceDir =
|
|
280513
|
+
evidenceDir = resolve128(args[++i2]);
|
|
280189
280514
|
}
|
|
280190
280515
|
if (!evidenceDir) return fail16("invalid_usage", ["Pass --evidence-dir."], 2);
|
|
280191
280516
|
try {
|
|
280192
280517
|
const { manifest: manifest2 } = verifiedEvidence(evidenceDir);
|
|
280193
280518
|
const metaSiteId = obj16(manifest2.source).metaSiteId;
|
|
280194
280519
|
if (typeof metaSiteId !== "string") throw Error("Missing site binding");
|
|
280195
|
-
const review = JSON.parse(
|
|
280520
|
+
const review = JSON.parse(readFileSync188(join202(evidenceDir, "payment-review.json"), "utf8"));
|
|
280196
280521
|
const issues = paymentReviewIssues(review, metaSiteId);
|
|
280197
280522
|
if (issues.length) return fail16("payment_decision_required", issues, 1);
|
|
280198
280523
|
const warnings = obj16(review).flows.map(obj16).filter(preservesUnverifiedFlow).map((flow) => ({
|
|
@@ -280445,10 +280770,10 @@ __export(cli_exports2, {
|
|
|
280445
280770
|
ONE_APP_WORKFLOW: () => ONE_APP_WORKFLOW,
|
|
280446
280771
|
runOneAppCommand: () => runOneAppCommand
|
|
280447
280772
|
});
|
|
280448
|
-
import { closeSync as closeSync15, constants as constants13, lstatSync as lstatSync43, mkdirSync as mkdirSync68, openSync as openSync14, readFileSync as
|
|
280773
|
+
import { closeSync as closeSync15, constants as constants13, lstatSync as lstatSync43, mkdirSync as mkdirSync68, openSync as openSync14, readFileSync as readFileSync189, realpathSync as realpathSync24, writeFileSync as writeFileSync79 } from "node:fs";
|
|
280449
280774
|
import { createHash as createHash99 } from "node:crypto";
|
|
280450
280775
|
import { isIP as isIP2 } from "node:net";
|
|
280451
|
-
import { dirname as dirname89, join as join203, parse as parse11, resolve as
|
|
280776
|
+
import { dirname as dirname89, join as join203, parse as parse11, resolve as resolve129 } from "node:path";
|
|
280452
280777
|
function nativeSiteHost(host) {
|
|
280453
280778
|
if (isIP2(host.startsWith("[") ? host.slice(1, -1) : host)) return true;
|
|
280454
280779
|
const labels = host.replace(/\.$/, "").split(".");
|
|
@@ -280516,10 +280841,10 @@ function readOptions(argv, cwd, commandIncluded) {
|
|
|
280516
280841
|
let prompt2 = flags.prompt ?? "";
|
|
280517
280842
|
if (flags["prompt-file"] !== void 0) {
|
|
280518
280843
|
try {
|
|
280519
|
-
const file2 =
|
|
280844
|
+
const file2 = resolve129(cwd, flags["prompt-file"]);
|
|
280520
280845
|
const stat10 = lstatSync43(file2);
|
|
280521
280846
|
if (!stat10.isFile() || stat10.size > MAX_PROMPT_BYTES) throw new Error("invalid prompt file");
|
|
280522
|
-
prompt2 =
|
|
280847
|
+
prompt2 = readFileSync189(file2, "utf8");
|
|
280523
280848
|
} catch {
|
|
280524
280849
|
throw new OneAppError("invalid_prompt", "Use a readable text file of at most 64 KiB for --prompt-file.");
|
|
280525
280850
|
}
|
|
@@ -280534,7 +280859,7 @@ function readOptions(argv, cwd, commandIncluded) {
|
|
|
280534
280859
|
if (flags.dir !== void 0 && !flags.dir.trim()) {
|
|
280535
280860
|
throw new OneAppError("invalid_output_path", "Pass a parent directory with --dir.");
|
|
280536
280861
|
}
|
|
280537
|
-
const parentDir =
|
|
280862
|
+
const parentDir = resolve129(cwd, flags.dir ?? ".");
|
|
280538
280863
|
const workspace = join203(parentDir, name);
|
|
280539
280864
|
assertSafeParents(parentDir);
|
|
280540
280865
|
if (pathExists(workspace)) throw new OneAppError("output_exists", "The destination already exists. Choose a new --name or --dir.");
|
|
@@ -280859,7 +281184,7 @@ var init_cli2 = __esm({
|
|
|
280859
281184
|
init_version2();
|
|
280860
281185
|
init_migration_context();
|
|
280861
281186
|
init_site_language();
|
|
280862
|
-
ONE_APP_USAGE = "himi one-app migrate --msid <uuid> [--app-instance branded|free] [--locale <tag>] [--languages <tag,tag>] [--prompt <text> | --prompt-file <file>] [--name <slug>] [--dir <parent>] [--target bo] [--top-tabs bottom-tabs|keep] [--json]\nhimi one-app validate-topbar --evidence-dir <.himi/one-app> --content <app-dir> [--json]\nhimi one-app header-badges --evidence-dir <.himi/one-app> --content <app-dir> [--dry-run]\nhimi one-app generate --evidence-dir <.himi/one-app> --content <app-dir> [--out <screens.json>]\n" + APPLY_NAVIGATION_USAGE + "\nhimi one-app provision --evidence-dir <.himi/one-app> --content <app-dir> [--dry-run]\n" + ACCESS_USAGE + "\nhimi one-app validate-design --evidence-dir <.himi/one-app> --content <app-dir> [--json] [--fix] [--record --release-hash <sha256>]\nhimi one-app coverage init|sync|check|verify --evidence-dir <.himi/one-app> --content <app-dir> [--release-hash <sha256>] (verify only: [--stage publish|pre-publish])\nhimi one-app validate-identity --evidence-dir <.himi/one-app> --content <app-dir> [--json] [--fix]\n" + PAYMENT_REVIEW_USAGE;
|
|
281187
|
+
ONE_APP_USAGE = "himi one-app migrate --msid <uuid> [--app-instance branded|free] [--locale <tag>] [--languages <tag,tag>] [--prompt <text> | --prompt-file <file>] [--name <slug>] [--dir <parent>] [--target bo] [--top-tabs bottom-tabs|keep] [--json]\nhimi one-app validate-topbar --evidence-dir <.himi/one-app> --content <app-dir> [--json]\nhimi one-app header-badges --evidence-dir <.himi/one-app> --content <app-dir> [--not-new-app] [--dry-run]\nhimi one-app generate --evidence-dir <.himi/one-app> --content <app-dir> [--out <screens.json>]\n" + APPLY_NAVIGATION_USAGE + "\nhimi one-app provision --evidence-dir <.himi/one-app> --content <app-dir> [--dry-run]\n" + ACCESS_USAGE + "\nhimi one-app validate-design --evidence-dir <.himi/one-app> --content <app-dir> [--json] [--fix] [--record --release-hash <sha256>]\nhimi one-app coverage init|sync|check|verify --evidence-dir <.himi/one-app> --content <app-dir> [--release-hash <sha256>] (verify only: [--stage publish|pre-publish])\nhimi one-app validate-identity --evidence-dir <.himi/one-app> --content <app-dir> [--json] [--fix]\n" + PAYMENT_REVIEW_USAGE;
|
|
280863
281188
|
UUID2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
280864
281189
|
SLUG2 = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
280865
281190
|
VALUE_FLAGS = /* @__PURE__ */ new Set(["msid", "app-instance", "locale", "languages", "prompt", "prompt-file", "name", "dir", "target", "top-tabs"]);
|
|
@@ -282824,7 +283149,7 @@ var init_analyze2 = __esm({
|
|
|
282824
283149
|
});
|
|
282825
283150
|
|
|
282826
283151
|
// src/site-analyze/site-pages-apply.ts
|
|
282827
|
-
import { existsSync as existsSync159, readFileSync as
|
|
283152
|
+
import { existsSync as existsSync159, readFileSync as readFileSync190 } from "node:fs";
|
|
282828
283153
|
import { join as join204 } from "node:path";
|
|
282829
283154
|
import ts31 from "typescript";
|
|
282830
283155
|
function packageScreenIds(dir) {
|
|
@@ -282832,7 +283157,7 @@ function packageScreenIds(dir) {
|
|
|
282832
283157
|
const config = join204(dir, "config.ts");
|
|
282833
283158
|
if (!existsSync159(dev) || !existsSync159(config)) return void 0;
|
|
282834
283159
|
try {
|
|
282835
|
-
const app2 = parseApp(
|
|
283160
|
+
const app2 = parseApp(readFileSync190(dev, "utf8"), readFileSync190(config, "utf8"));
|
|
282836
283161
|
return new Set(app2.routes.filter((r3) => r3.kind === "screen").map((r3) => r3.label));
|
|
282837
283162
|
} catch {
|
|
282838
283163
|
return void 0;
|
|
@@ -282886,7 +283211,7 @@ function applySitePagesToPackage(dir, site, opts = {}) {
|
|
|
282886
283211
|
if (!existsSync159(devPath) || !existsSync159(configPath)) return none("the package has no dev/index.ts + config.ts to add website pages to");
|
|
282887
283212
|
let existing;
|
|
282888
283213
|
try {
|
|
282889
|
-
const app2 = parseApp(
|
|
283214
|
+
const app2 = parseApp(readFileSync190(devPath, "utf8"), readFileSync190(configPath, "utf8"));
|
|
282890
283215
|
existing = app2.routes.filter((r3) => r3.kind === "screen" && isWebsiteScreenId(r3.label)).map((r3) => r3.label);
|
|
282891
283216
|
} catch (e2) {
|
|
282892
283217
|
return none(`the package is not in the plain-JSON shape \`himi init\` writes, which this step edits (${e2.message})`);
|
|
@@ -282896,21 +283221,21 @@ function applySitePagesToPackage(dir, site, opts = {}) {
|
|
|
282896
283221
|
const removed = existing.filter((id) => !wanted.includes(id));
|
|
282897
283222
|
const added = wanted.filter((id) => !existing.includes(id));
|
|
282898
283223
|
const replaced = wanted.filter((id) => existing.includes(id));
|
|
282899
|
-
const probe2 = spliceWebsiteDrawer(
|
|
283224
|
+
const probe2 = spliceWebsiteDrawer(readFileSync190(configPath, "utf8"), site);
|
|
282900
283225
|
if ("refused" in probe2) return none(probe2.refused);
|
|
282901
283226
|
if (opts.dryRun) return { added, replaced, removed, rows: probe2.rows, wrote: [] };
|
|
282902
|
-
const before = new Map(["dev/index.ts", "config.ts", "himalaya.content.json"].map((rel2) => [rel2, existsSync159(join204(dir, rel2)) ?
|
|
283227
|
+
const before = new Map(["dev/index.ts", "config.ts", "himalaya.content.json"].map((rel2) => [rel2, existsSync159(join204(dir, rel2)) ? readFileSync190(join204(dir, rel2), "utf8") : void 0]));
|
|
282903
283228
|
try {
|
|
282904
283229
|
if (removed.length) removeScreens(dir, removed);
|
|
282905
283230
|
if (wanted.length) upsertScreens(dir, screens);
|
|
282906
|
-
const spliced = spliceWebsiteDrawer(
|
|
283231
|
+
const spliced = spliceWebsiteDrawer(readFileSync190(configPath, "utf8"), site);
|
|
282907
283232
|
if ("refused" in spliced) throw new TrimRefusal(spliced.refused);
|
|
282908
|
-
if (spliced.source !==
|
|
283233
|
+
if (spliced.source !== readFileSync190(configPath, "utf8")) writeFileAtomic(configPath, spliced.source);
|
|
282909
283234
|
} catch (e2) {
|
|
282910
|
-
for (const [rel2, text32] of before) if (text32 !== void 0 &&
|
|
283235
|
+
for (const [rel2, text32] of before) if (text32 !== void 0 && readFileSync190(join204(dir, rel2), "utf8") !== text32) writeFileAtomic(join204(dir, rel2), text32);
|
|
282911
283236
|
return none(`stopped and restored every file: ${e2.message}`);
|
|
282912
283237
|
}
|
|
282913
|
-
const wrote = [...before].filter(([rel2, text32]) => text32 !== void 0 &&
|
|
283238
|
+
const wrote = [...before].filter(([rel2, text32]) => text32 !== void 0 && readFileSync190(join204(dir, rel2), "utf8") !== text32).map(([rel2]) => join204(dir, rel2));
|
|
282914
283239
|
return { added, replaced, removed, rows: probe2.rows, wrote };
|
|
282915
283240
|
}
|
|
282916
283241
|
var ANCHOR_ROWS;
|
|
@@ -282939,8 +283264,8 @@ var init_customer_build = __esm({
|
|
|
282939
283264
|
});
|
|
282940
283265
|
|
|
282941
283266
|
// src/site-analyze/apply.ts
|
|
282942
|
-
import { existsSync as existsSync160, readFileSync as
|
|
282943
|
-
import { dirname as dirname90, isAbsolute as isAbsolute21, join as join205, resolve as
|
|
283267
|
+
import { existsSync as existsSync160, readFileSync as readFileSync191, writeFileSync as writeFileSync80, copyFileSync as copyFileSync3, mkdirSync as mkdirSync69, realpathSync as realpathSync25, statSync as statSync53 } from "node:fs";
|
|
283268
|
+
import { dirname as dirname90, isAbsolute as isAbsolute21, join as join205, resolve as resolve130, sep as sep35 } from "node:path";
|
|
282944
283269
|
import { spawnSync as spawnSync13 } from "node:child_process";
|
|
282945
283270
|
function inRepoBakeRefusal(repoRoot2, shell) {
|
|
282946
283271
|
if (isBrandable(repoRoot2, shell)) return null;
|
|
@@ -282974,7 +283299,7 @@ function unpairedRedirectNote(overlay) {
|
|
|
282974
283299
|
return `no OAuth redirect paired with client ${overlay.wix.clientId} \u2014 the app (and prepare:customer) will refuse to start until one is set. Register it with \`himi site client ensure --site ${overlay.siteId?.trim() || "<msid>"} --redirect-uri <uri> --yes\`, then re-run analyze with \`--redirect-uri <uri>\` (or export HIMI_BRANDED_LITE_WIX_REDIRECT_URI)`;
|
|
282975
283300
|
}
|
|
282976
283301
|
function posix4(p2) {
|
|
282977
|
-
return
|
|
283302
|
+
return resolve130(p2).replace(/\\/g, "/");
|
|
282978
283303
|
}
|
|
282979
283304
|
function committedShellProvisioning(path2) {
|
|
282980
283305
|
return committedShellFor(posix4(path2));
|
|
@@ -283011,7 +283336,7 @@ function assertNotCommitted(path2, forbidden2) {
|
|
|
283011
283336
|
`refusing to overwrite committed ${committedProvisioningPath(committed)} \u2014 use prepare:customer --contract`
|
|
283012
283337
|
);
|
|
283013
283338
|
}
|
|
283014
|
-
if (forbidden2 &&
|
|
283339
|
+
if (forbidden2 && resolve130(path2) === resolve130(forbidden2)) {
|
|
283015
283340
|
const named3 = committedShellProvisioning(forbidden2);
|
|
283016
283341
|
throw new Error(
|
|
283017
283342
|
`refusing to overwrite committed ${named3 ? committedProvisioningPath(named3) : forbidden2} \u2014 pass a content-package provisioning.json or use prepare:customer --contract`
|
|
@@ -283241,12 +283566,12 @@ function buildMergedContract(options2) {
|
|
|
283241
283566
|
if (!existsSync160(committedPath)) {
|
|
283242
283567
|
throw new Error(`shell has no committed provisioning.json at ${committedPath} to build a contract from`);
|
|
283243
283568
|
}
|
|
283244
|
-
const committed = JSON.parse(
|
|
283569
|
+
const committed = JSON.parse(readFileSync191(committedPath, "utf8"));
|
|
283245
283570
|
const previousPath = join205(appDir3, LOCAL_CONTRACT_REL);
|
|
283246
283571
|
let evidenceOverlay = overlay;
|
|
283247
283572
|
if ((overlay.businessContact === void 0 || overlay.loyalty === void 0 || overlay.businessTimeZone === void 0) && existsSync160(previousPath)) {
|
|
283248
283573
|
try {
|
|
283249
|
-
const previous = JSON.parse(
|
|
283574
|
+
const previous = JSON.parse(readFileSync191(previousPath, "utf8"));
|
|
283250
283575
|
if (previous && typeof previous === "object" && !Array.isArray(previous) && sameKnownSite(previous, overlay)) {
|
|
283251
283576
|
evidenceOverlay = {
|
|
283252
283577
|
...overlay,
|
|
@@ -283261,7 +283586,7 @@ function buildMergedContract(options2) {
|
|
|
283261
283586
|
let keepSite = options2.keepSite === true;
|
|
283262
283587
|
if (!keepSite && options2.sitePageHost && existsSync160(previousPath)) {
|
|
283263
283588
|
try {
|
|
283264
|
-
const carried = websiteSiteToCarry(JSON.parse(
|
|
283589
|
+
const carried = websiteSiteToCarry(JSON.parse(readFileSync191(previousPath, "utf8")), overlay);
|
|
283265
283590
|
if (carried) {
|
|
283266
283591
|
evidenceOverlay = { ...evidenceOverlay, site: carried };
|
|
283267
283592
|
keepSite = true;
|
|
@@ -283275,8 +283600,8 @@ function buildMergedContract(options2) {
|
|
|
283275
283600
|
const staged = [];
|
|
283276
283601
|
const contained = (root, rel2) => {
|
|
283277
283602
|
if (isAbsolute21(rel2)) return void 0;
|
|
283278
|
-
const full =
|
|
283279
|
-
return full.startsWith(
|
|
283603
|
+
const full = resolve130(root, rel2);
|
|
283604
|
+
return full.startsWith(resolve130(root) + sep35) ? full : void 0;
|
|
283280
283605
|
};
|
|
283281
283606
|
const stage = (fromRel, toRel) => {
|
|
283282
283607
|
const from = contained(packageDir, fromRel);
|
|
@@ -283307,7 +283632,7 @@ function buildMergedContract(options2) {
|
|
|
283307
283632
|
if (existsSync160(facesPath)) {
|
|
283308
283633
|
let faces = [];
|
|
283309
283634
|
try {
|
|
283310
|
-
const parsed = JSON.parse(
|
|
283635
|
+
const parsed = JSON.parse(readFileSync191(facesPath, "utf8"));
|
|
283311
283636
|
faces = Array.isArray(parsed) ? parsed : [];
|
|
283312
283637
|
} catch {
|
|
283313
283638
|
faces = [];
|
|
@@ -283365,10 +283690,10 @@ function catalogTypography(overlay, template) {
|
|
|
283365
283690
|
function staticFaqFor(overlay, overlayPath) {
|
|
283366
283691
|
const own6 = overlay.faq;
|
|
283367
283692
|
if (own6 !== void 0) return deriveStaticFaq(own6);
|
|
283368
|
-
const bookPath = join205(dirname90(
|
|
283693
|
+
const bookPath = join205(dirname90(resolve130(overlayPath)), "book.json");
|
|
283369
283694
|
if (!existsSync160(bookPath)) return void 0;
|
|
283370
283695
|
try {
|
|
283371
|
-
const book = JSON.parse(
|
|
283696
|
+
const book = JSON.parse(readFileSync191(bookPath, "utf8"));
|
|
283372
283697
|
const copy = book?.copy;
|
|
283373
283698
|
if (!copy || typeof copy !== "object" || copy.unavailable) return void 0;
|
|
283374
283699
|
const pairs2 = deriveStaticFaq(copy.faq);
|
|
@@ -283382,10 +283707,10 @@ function staticGalleriesFor(overlay, overlayPath) {
|
|
|
283382
283707
|
if (overlay.galleries !== void 0) return deriveStaticGalleries(
|
|
283383
283708
|
overlay.galleries.map((gallery) => ({ role: "gallery", title: gallery.title, galleryImageUrls: gallery.photos }))
|
|
283384
283709
|
);
|
|
283385
|
-
const bookPath = join205(dirname90(
|
|
283710
|
+
const bookPath = join205(dirname90(resolve130(overlayPath)), "book.json");
|
|
283386
283711
|
if (!existsSync160(bookPath)) return void 0;
|
|
283387
283712
|
try {
|
|
283388
|
-
const book = JSON.parse(
|
|
283713
|
+
const book = JSON.parse(readFileSync191(bookPath, "utf8"));
|
|
283389
283714
|
if (!book.look || book.look.unavailable || !Array.isArray(book.look.pages)) return void 0;
|
|
283390
283715
|
const galleries = deriveStaticGalleries(book.look.pages);
|
|
283391
283716
|
return galleries.length || book.look.complete === true ? galleries : void 0;
|
|
@@ -283394,17 +283719,17 @@ function staticGalleriesFor(overlay, overlayPath) {
|
|
|
283394
283719
|
}
|
|
283395
283720
|
}
|
|
283396
283721
|
async function applyOverlays(input) {
|
|
283397
|
-
const cwd =
|
|
283722
|
+
const cwd = resolve130(input.cwd);
|
|
283398
283723
|
const shell = input.shell ?? DEFAULT_BRANDABLE_SHELL;
|
|
283399
283724
|
assertKnownShell(shell);
|
|
283400
283725
|
const pagesRefusal = input.sitePages ? sitePagesTargetRefusal({ cwd, shell }) : void 0;
|
|
283401
283726
|
if (pagesRefusal) throw Object.assign(new Error(pagesRefusal.error), { exit: 2, code: pagesRefusal.code });
|
|
283402
|
-
const overlay = JSON.parse(
|
|
283727
|
+
const overlay = JSON.parse(readFileSync191(input.overlayPath, "utf8"));
|
|
283403
283728
|
const sitePages = input.sitePages === true;
|
|
283404
283729
|
const plan = input.sitePagesPlan;
|
|
283405
283730
|
const planNote = sitePages && plan ? plan.notes[0] : void 0;
|
|
283406
283731
|
const sitePagesOut = (screens) => sitePages && plan ? { sitePages: { site: plan.site, native: plan.native, skipped: plan.skipped, ...screens ? { screens } : {} } } : {};
|
|
283407
|
-
const tokens2 = JSON.parse(
|
|
283732
|
+
const tokens2 = JSON.parse(readFileSync191(input.tokensPath, "utf8"));
|
|
283408
283733
|
const faq = staticFaqFor(overlay, input.overlayPath);
|
|
283409
283734
|
if (faq !== void 0) overlay.faq = faq;
|
|
283410
283735
|
const galleries = staticGalleriesFor(overlay, input.overlayPath);
|
|
@@ -283420,7 +283745,7 @@ async function applyOverlays(input) {
|
|
|
283420
283745
|
if (bakeRefusal) throw Object.assign(new Error(bakeRefusal), { exit: 2, code: APPLY_SHELL_CANNOT_BAKE });
|
|
283421
283746
|
const appDir3 = join205(repoRoot2, shellAppDir(shell));
|
|
283422
283747
|
assertOverlayNamesSite(join205(appDir3, "provisioning.json"), overlay, `shell "${shell}"`, ` --shell ${shell}`);
|
|
283423
|
-
const packageDir = dirname90(
|
|
283748
|
+
const packageDir = dirname90(resolve130(input.overlayPath));
|
|
283424
283749
|
if (input.dryRun) {
|
|
283425
283750
|
return {
|
|
283426
283751
|
mode: "dry",
|
|
@@ -283492,7 +283817,7 @@ async function applyOverlays(input) {
|
|
|
283492
283817
|
let packageFaq = faq;
|
|
283493
283818
|
let packageGalleries = galleries;
|
|
283494
283819
|
if (existsSync160(pkgProv)) {
|
|
283495
|
-
const cur = JSON.parse(
|
|
283820
|
+
const cur = JSON.parse(readFileSync191(pkgProv, "utf8"));
|
|
283496
283821
|
if (galleries === void 0 && !sameKnownSite(cur, overlay)) overlay.galleries = [];
|
|
283497
283822
|
const merged = deepMerge4(cur, overlay);
|
|
283498
283823
|
if (overlay.businessContact !== void 0) merged.businessContact = overlay.businessContact;
|
|
@@ -283527,7 +283852,7 @@ async function applyOverlays(input) {
|
|
|
283527
283852
|
}
|
|
283528
283853
|
const pkgTokens = join205(cwd, "tokens.json");
|
|
283529
283854
|
if (existsSync160(pkgTokens) && (tokens2.colors || tokens2.typography)) {
|
|
283530
|
-
const cur = JSON.parse(
|
|
283855
|
+
const cur = JSON.parse(readFileSync191(pkgTokens, "utf8"));
|
|
283531
283856
|
let tokensIn = tokens2;
|
|
283532
283857
|
if (tokens2.typography) {
|
|
283533
283858
|
const fonts = catalogTypography(tokens2.typography, cur.typography);
|
|
@@ -283554,7 +283879,7 @@ async function applyOverlays(input) {
|
|
|
283554
283879
|
const homeAction = homeRefreshActionId(shell);
|
|
283555
283880
|
const homeSrc = join205(cwd, "dev/index.ts");
|
|
283556
283881
|
if (homeAction && existsSync160(homeSrc)) {
|
|
283557
|
-
const prev =
|
|
283882
|
+
const prev = readFileSync191(homeSrc, "utf8");
|
|
283558
283883
|
const patched = patchBrandParams(prev, overlay, homeAction);
|
|
283559
283884
|
let next = patched.src;
|
|
283560
283885
|
if (!patched.foreign && faq?.length && prev.includes('"tier5.himiBrandedFaq.load"') && !prev.includes('"staticFaq"')) {
|
|
@@ -283598,7 +283923,7 @@ async function applyOverlays(input) {
|
|
|
283598
283923
|
else pageScreens = { added: pages2.added, replaced: pages2.replaced, removed: pages2.removed, rows: pages2.rows };
|
|
283599
283924
|
}
|
|
283600
283925
|
if (!input.iconPath || !existsSync160(input.iconPath)) {
|
|
283601
|
-
const book = input.iconPath ? dirname90(dirname90(
|
|
283926
|
+
const book = input.iconPath ? dirname90(dirname90(resolve130(input.iconPath))) : void 0;
|
|
283602
283927
|
notes.push(
|
|
283603
283928
|
book ? `no icon installed \u2014 ${siteLogoAbsence(book).hint}` : "no icon installed and no business book to say why \u2014 `himi icon generate` draws one from the accent, or `himi icon set <file.png>` installs the customer's own mark"
|
|
283604
283929
|
);
|
|
@@ -284356,13 +284681,13 @@ __export(cli_exports3, {
|
|
|
284356
284681
|
sitePagesRefusal: () => sitePagesRefusal,
|
|
284357
284682
|
targetIsSiteShell: () => targetIsSiteShell
|
|
284358
284683
|
});
|
|
284359
|
-
import { existsSync as existsSync161, readFileSync as
|
|
284684
|
+
import { existsSync as existsSync161, readFileSync as readFileSync192 } from "node:fs";
|
|
284360
284685
|
import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
|
|
284361
|
-
import { resolve as
|
|
284686
|
+
import { resolve as resolve131 } from "node:path";
|
|
284362
284687
|
function sitePagesRefusal(opts) {
|
|
284363
284688
|
const shell = opts.shell ?? DEFAULT_BRANDABLE_SHELL;
|
|
284364
284689
|
if (opts.sitePages && SHELL_NAMES.includes(shell)) {
|
|
284365
|
-
const refusal2 = sitePagesTargetRefusal({ cwd:
|
|
284690
|
+
const refusal2 = sitePagesTargetRefusal({ cwd: resolve131(opts.cwd ?? process.cwd()), shell });
|
|
284366
284691
|
if (refusal2) return refusal2;
|
|
284367
284692
|
}
|
|
284368
284693
|
if (opts.dryRun && !(opts.apply && opts.sitePages)) return { code: DRY_RUN_NEEDS_SITE_PAGES, error: DRY_RUN_NEEDS_SITE_PAGES_MESSAGE };
|
|
@@ -284370,7 +284695,7 @@ function sitePagesRefusal(opts) {
|
|
|
284370
284695
|
}
|
|
284371
284696
|
function targetIsSiteShell(opts) {
|
|
284372
284697
|
if (opts.shell !== void 0 && !SHELL_NAMES.includes(opts.shell)) return false;
|
|
284373
|
-
return siteShellTarget({ cwd:
|
|
284698
|
+
return siteShellTarget({ cwd: resolve131(opts.cwd ?? process.cwd()), shell: opts.shell }).siteShell;
|
|
284374
284699
|
}
|
|
284375
284700
|
function applyNeedsClient(shell, cwd) {
|
|
284376
284701
|
if (shell !== void 0 && !SHELL_NAMES.includes(shell)) return true;
|
|
@@ -284396,7 +284721,7 @@ async function mobileAppAuthFor(ownerAuth, deps = {}) {
|
|
|
284396
284721
|
}
|
|
284397
284722
|
async function runSiteAnalyze(opts) {
|
|
284398
284723
|
if (opts.shell !== void 0) assertKnownShell(opts.shell);
|
|
284399
|
-
const cwd =
|
|
284724
|
+
const cwd = resolve131(opts.cwd ?? process.cwd());
|
|
284400
284725
|
const pagesRefusal = sitePagesRefusal({ ...opts, cwd });
|
|
284401
284726
|
if (pagesRefusal) throw Object.assign(new Error(pagesRefusal.error), { exit: 2, code: pagesRefusal.code });
|
|
284402
284727
|
if (opts.apply) {
|
|
@@ -284412,7 +284737,7 @@ async function runSiteAnalyze(opts) {
|
|
|
284412
284737
|
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
284413
284738
|
const assetFetch = assetFetchFor(opts);
|
|
284414
284739
|
const siteFetch = guardedSiteFetch;
|
|
284415
|
-
const outDir =
|
|
284740
|
+
const outDir = resolve131(cwd, opts.outDir ?? ".himi/business-book");
|
|
284416
284741
|
let ownerAuth;
|
|
284417
284742
|
let msid;
|
|
284418
284743
|
const ownerSite = ownerSiteFor(opts);
|
|
@@ -284442,7 +284767,7 @@ async function runSiteAnalyze(opts) {
|
|
|
284442
284767
|
if (siteShell) {
|
|
284443
284768
|
try {
|
|
284444
284769
|
const kind = siteKindForOrigin(result.book.input.siteUrl, { wix: wixConfirmsOrigin(result.book, result.book.input.siteUrl) });
|
|
284445
|
-
const book = kind === "base44" ? base44BookRoutes(
|
|
284770
|
+
const book = kind === "base44" ? base44BookRoutes(resolve131(cwd, ".himi/base44-book/book.json"), result.book.input.siteUrl) : void 0;
|
|
284446
284771
|
const routes = book?.routes;
|
|
284447
284772
|
if (book?.skipped) result.warnings = [...result.warnings ?? [], book.skipped];
|
|
284448
284773
|
const derived2 = deriveSiteShell({ siteUrl: result.book.input.siteUrl, look: result.book.look, kind, routes });
|
|
@@ -284450,16 +284775,16 @@ async function runSiteAnalyze(opts) {
|
|
|
284450
284775
|
delete result.provisioningOverlay.wix;
|
|
284451
284776
|
derived2.notes.push("wix binding: left out \u2014 a web site is visitor-only, so the client id is not used.");
|
|
284452
284777
|
}
|
|
284453
|
-
const prevOverlayPath =
|
|
284778
|
+
const prevOverlayPath = resolve131(outDir, "provisioning.overlay.json");
|
|
284454
284779
|
const readSite = (path2) => {
|
|
284455
284780
|
try {
|
|
284456
|
-
return JSON.parse(
|
|
284781
|
+
return JSON.parse(readFileSync192(path2, "utf8")).site;
|
|
284457
284782
|
} catch {
|
|
284458
284783
|
return void 0;
|
|
284459
284784
|
}
|
|
284460
284785
|
};
|
|
284461
284786
|
const overlaySite = existsSync161(prevOverlayPath) ? readSite(prevOverlayPath) : void 0;
|
|
284462
|
-
const packagePath =
|
|
284787
|
+
const packagePath = resolve131(cwd, "provisioning.json");
|
|
284463
284788
|
const target = siteShellTarget({ cwd, shell: opts.shell });
|
|
284464
284789
|
const packageSite = target.where === "off-repo" && target.manifest === packagePath && existsSync161(packagePath) ? readSite(packagePath) : void 0;
|
|
284465
284790
|
const asBlock = (v2) => v2 && typeof v2 === "object" && !Array.isArray(v2) ? v2 : void 0;
|
|
@@ -284523,9 +284848,9 @@ async function runSiteAnalyze(opts) {
|
|
|
284523
284848
|
];
|
|
284524
284849
|
}
|
|
284525
284850
|
}
|
|
284526
|
-
const previousOverlay =
|
|
284851
|
+
const previousOverlay = resolve131(outDir, "provisioning.overlay.json");
|
|
284527
284852
|
carryOverGoals(
|
|
284528
|
-
existsSync161(previousOverlay) ?
|
|
284853
|
+
existsSync161(previousOverlay) ? readFileSync192(previousOverlay, "utf8") : void 0,
|
|
284529
284854
|
result.provisioningOverlay
|
|
284530
284855
|
);
|
|
284531
284856
|
const ownerCall = ownerAuth ? ownerTransportFrom(fetchImpl, ownerAuth) : void 0;
|
|
@@ -284544,9 +284869,9 @@ async function runSiteAnalyze(opts) {
|
|
|
284544
284869
|
if (opts.apply) {
|
|
284545
284870
|
applied = await applyOverlays({
|
|
284546
284871
|
cwd,
|
|
284547
|
-
overlayPath:
|
|
284548
|
-
tokensPath:
|
|
284549
|
-
iconPath:
|
|
284872
|
+
overlayPath: resolve131(outDir, "provisioning.overlay.json"),
|
|
284873
|
+
tokensPath: resolve131(outDir, "tokens.overlay.json"),
|
|
284874
|
+
iconPath: resolve131(outDir, "media/icon.png"),
|
|
284550
284875
|
shell: opts.shell,
|
|
284551
284876
|
sitePages: opts.sitePages === true,
|
|
284552
284877
|
sitePagesPlan,
|
|
@@ -284587,8 +284912,8 @@ async function runSiteFunctionCli(opts) {
|
|
|
284587
284912
|
const token = opts.token ?? await siteToken(msid);
|
|
284588
284913
|
let source2;
|
|
284589
284914
|
if (opts.sourcePath) {
|
|
284590
|
-
const p2 =
|
|
284591
|
-
source2 =
|
|
284915
|
+
const p2 = resolve131(opts.cwd ?? process.cwd(), opts.sourcePath);
|
|
284916
|
+
source2 = readFileSync192(p2, "utf8");
|
|
284592
284917
|
}
|
|
284593
284918
|
let body;
|
|
284594
284919
|
if (opts.bodyRaw != null) {
|
|
@@ -284618,7 +284943,7 @@ async function runSiteFunctionCli(opts) {
|
|
|
284618
284943
|
function base44BookRoutes(bookPath, siteUrl) {
|
|
284619
284944
|
if (!existsSync161(bookPath)) return void 0;
|
|
284620
284945
|
try {
|
|
284621
|
-
const book = JSON.parse(
|
|
284946
|
+
const book = JSON.parse(readFileSync192(bookPath, "utf8"));
|
|
284622
284947
|
if (book.kind !== "base44-app-book" || !Array.isArray(book.routes)) return void 0;
|
|
284623
284948
|
const host = (u2) => {
|
|
284624
284949
|
try {
|
|
@@ -284672,7 +284997,7 @@ async function accountToken2(spawnImpl = spawn9) {
|
|
|
284672
284997
|
cached2 = fromEnv;
|
|
284673
284998
|
return fromEnv;
|
|
284674
284999
|
}
|
|
284675
|
-
const token = await new Promise((
|
|
285000
|
+
const token = await new Promise((resolve135, reject) => {
|
|
284676
285001
|
let child3;
|
|
284677
285002
|
try {
|
|
284678
285003
|
child3 = spawnImpl("wix", ["token"]);
|
|
@@ -284701,7 +285026,7 @@ async function accountToken2(spawnImpl = spawn9) {
|
|
|
284701
285026
|
const scan = (d2) => {
|
|
284702
285027
|
out2 += String(d2);
|
|
284703
285028
|
const m2 = out2.match(TOKEN_RE2);
|
|
284704
|
-
if (m2) done(() =>
|
|
285029
|
+
if (m2) done(() => resolve135(m2[0]));
|
|
284705
285030
|
};
|
|
284706
285031
|
child3.stdout?.on("data", scan);
|
|
284707
285032
|
child3.stderr?.on("data", scan);
|
|
@@ -284790,7 +285115,7 @@ __export(site_create_exports, {
|
|
|
284790
285115
|
runSiteList: () => runSiteList,
|
|
284791
285116
|
writeProvisioningBinding: () => writeProvisioningBinding
|
|
284792
285117
|
});
|
|
284793
|
-
import { existsSync as existsSync162, readFileSync as
|
|
285118
|
+
import { existsSync as existsSync162, readFileSync as readFileSync193, writeFileSync as writeFileSync81 } from "node:fs";
|
|
284794
285119
|
import { resolve as resolvePath4 } from "node:path";
|
|
284795
285120
|
function oauthClientName(projectName) {
|
|
284796
285121
|
return `${projectName} client`;
|
|
@@ -284939,7 +285264,7 @@ async function runSiteCreate(opts) {
|
|
|
284939
285264
|
if (!wantOauthApp) return { ...base2, nextSteps: nextSteps(metaSiteId) };
|
|
284940
285265
|
return { ...base2, clientId, redirectUri, nextSteps: nextSteps(metaSiteId, clientId) };
|
|
284941
285266
|
}
|
|
284942
|
-
function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync162, readFileSync:
|
|
285267
|
+
function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync162, readFileSync: readFileSync193, writeFileSync: writeFileSync81 }) {
|
|
284943
285268
|
const msid = binding2.siteId;
|
|
284944
285269
|
const path2 = resolvePath4(target);
|
|
284945
285270
|
const committed = committedShellProvisioning(path2);
|
|
@@ -285550,7 +285875,7 @@ async function collectSiteContext(opts) {
|
|
|
285550
285875
|
visitorToken = await mintVisitorToken(fetcher, opts.clientId);
|
|
285551
285876
|
visitorAuth = { status: "ok" };
|
|
285552
285877
|
} catch (e2) {
|
|
285553
|
-
visitorAuth =
|
|
285878
|
+
visitorAuth = failed(e2);
|
|
285554
285879
|
}
|
|
285555
285880
|
}
|
|
285556
285881
|
const visitor = visitorToken ? makeTransport(fetcher, { token: visitorToken, msid: opts.siteId }) : void 0;
|
|
@@ -285567,7 +285892,7 @@ async function collectSiteContext(opts) {
|
|
|
285567
285892
|
currency: identity2.locale.currency
|
|
285568
285893
|
} };
|
|
285569
285894
|
} catch (e2) {
|
|
285570
|
-
return
|
|
285895
|
+
return failed(e2);
|
|
285571
285896
|
}
|
|
285572
285897
|
};
|
|
285573
285898
|
const cmsRead = async () => {
|
|
@@ -285580,7 +285905,7 @@ async function collectSiteContext(opts) {
|
|
|
285580
285905
|
return data;
|
|
285581
285906
|
} catch (e2) {
|
|
285582
285907
|
const code3 = e2 instanceof WixApiError2 ? e2.body?.details?.applicationError?.code : void 0;
|
|
285583
|
-
failure4 = code3 === "WDE0110" ? { status: "unavailable", httpStatus: 400 } :
|
|
285908
|
+
failure4 = code3 === "WDE0110" ? { status: "unavailable", httpStatus: 400 } : failed(e2);
|
|
285584
285909
|
throw e2;
|
|
285585
285910
|
}
|
|
285586
285911
|
} : void 0;
|
|
@@ -285602,7 +285927,7 @@ async function collectSiteContext(opts) {
|
|
|
285602
285927
|
try {
|
|
285603
285928
|
return await owner(method, path2, body);
|
|
285604
285929
|
} catch (e2) {
|
|
285605
|
-
readFailure =
|
|
285930
|
+
readFailure = failed(e2);
|
|
285606
285931
|
throw e2;
|
|
285607
285932
|
}
|
|
285608
285933
|
};
|
|
@@ -285647,7 +285972,7 @@ async function collectSiteContext(opts) {
|
|
|
285647
285972
|
truncated: files.length > selected.size || [...selected.values()].some((f2) => f2.sourceTruncated)
|
|
285648
285973
|
};
|
|
285649
285974
|
} catch (e2) {
|
|
285650
|
-
return { ...
|
|
285975
|
+
return { ...failed(e2), files: [], sourceIncluded: false };
|
|
285651
285976
|
}
|
|
285652
285977
|
};
|
|
285653
285978
|
const [identity, cms, velo, probes] = await Promise.all([
|
|
@@ -285658,7 +285983,7 @@ async function collectSiteContext(opts) {
|
|
|
285658
285983
|
]);
|
|
285659
285984
|
const probeRead = (p2, available, auth) => {
|
|
285660
285985
|
if (!available) return auth;
|
|
285661
|
-
if (p2.httpStatus) return { ...
|
|
285986
|
+
if (p2.httpStatus) return { ...failed(new WixApiError2(p2.httpStatus, "", "", null)), count: p2.count };
|
|
285662
285987
|
return { status: p2.status === "ok" || p2.status === "empty" ? p2.status : "error", count: p2.count };
|
|
285663
285988
|
};
|
|
285664
285989
|
return {
|
|
@@ -285674,7 +285999,7 @@ async function collectSiteContext(opts) {
|
|
|
285674
285999
|
}))
|
|
285675
286000
|
};
|
|
285676
286001
|
}
|
|
285677
|
-
var responseKeys, definitions, reads2,
|
|
286002
|
+
var responseKeys, definitions, reads2, failed;
|
|
285678
286003
|
var init_context2 = __esm({
|
|
285679
286004
|
"src/site-analyze/context.ts"() {
|
|
285680
286005
|
init_define_HHP_CATALOG();
|
|
@@ -285711,7 +286036,7 @@ var init_context2 = __esm({
|
|
|
285711
286036
|
...OWNER_VELO_PROBES.map((p2) => `${p2.method} ${p2.path}`),
|
|
285712
286037
|
...definitions.flatMap((p2) => [p2, ...p2.fallbacks ?? []].map((a3) => `${a3.method} ${a3.path}`))
|
|
285713
286038
|
]);
|
|
285714
|
-
|
|
286039
|
+
failed = (e2) => {
|
|
285715
286040
|
const httpStatus = e2 instanceof WixApiError2 ? e2.status : void 0;
|
|
285716
286041
|
return { status: httpStatus === 401 ? "unauthorized" : httpStatus === 403 ? "forbidden" : httpStatus === 404 || httpStatus === 428 ? "unavailable" : "error", ...httpStatus ? { httpStatus } : {} };
|
|
285717
286042
|
};
|
|
@@ -285748,7 +286073,7 @@ __export(check_report_exports, {
|
|
|
285748
286073
|
import { createHash as createHash100, randomUUID as randomUUID20 } from "node:crypto";
|
|
285749
286074
|
import { request as httpRequest2 } from "node:http";
|
|
285750
286075
|
import { createConnection } from "node:net";
|
|
285751
|
-
import { isAbsolute as isAbsolute22, relative as relative38, resolve as
|
|
286076
|
+
import { isAbsolute as isAbsolute22, relative as relative38, resolve as resolve132 } from "node:path";
|
|
285752
286077
|
function credentialValue(value2) {
|
|
285753
286078
|
const v2 = value2.trim();
|
|
285754
286079
|
if (!v2 || /^(?:[01]|true|false|yes|no|on|off|null|none|undefined)$/i.test(v2)) return null;
|
|
@@ -285840,7 +286165,7 @@ function boundedText(value2, secrets) {
|
|
|
285840
286165
|
return clean3.length <= MAX_TEXT4 ? clean3 : `${clean3.slice(0, MAX_TEXT4 - 1)}\u2026`;
|
|
285841
286166
|
}
|
|
285842
286167
|
function contentRelative(file2, contentDir2) {
|
|
285843
|
-
const rel2 = isAbsolute22(file2) ? relative38(
|
|
286168
|
+
const rel2 = isAbsolute22(file2) ? relative38(resolve132(contentDir2), file2) : file2;
|
|
285844
286169
|
const normal = rel2.split(/[\\/]+/).filter((part5) => part5 && part5 !== ".");
|
|
285845
286170
|
if (!normal.length || isAbsolute22(rel2) || normal.includes("..")) return void 0;
|
|
285846
286171
|
const joined = normal.join("/");
|
|
@@ -286325,9 +286650,9 @@ var init_capture = __esm({
|
|
|
286325
286650
|
|
|
286326
286651
|
// src/fidelity/judge.ts
|
|
286327
286652
|
import { spawn as spawn10 } from "node:child_process";
|
|
286328
|
-
import { copyFileSync as copyFileSync4, mkdtempSync as mkdtempSync15, readFileSync as
|
|
286653
|
+
import { copyFileSync as copyFileSync4, mkdtempSync as mkdtempSync15, readFileSync as readFileSync194, rmSync as rmSync50 } from "node:fs";
|
|
286329
286654
|
import { tmpdir as tmpdir16 } from "node:os";
|
|
286330
|
-
import { basename as basename42, dirname as dirname91, join as join207, resolve as
|
|
286655
|
+
import { basename as basename42, dirname as dirname91, join as join207, resolve as resolve133 } from "node:path";
|
|
286331
286656
|
import { fileURLToPath as fileURLToPath44 } from "node:url";
|
|
286332
286657
|
function parseVerdict(value2, captured) {
|
|
286333
286658
|
const v2 = value2;
|
|
@@ -286367,8 +286692,8 @@ async function judgeStrip(strip4, screen, variant, opts = {}) {
|
|
|
286367
286692
|
const judgeDir = opts.judgeDir ?? SOURCE_JUDGE_DIR;
|
|
286368
286693
|
let prompt2, schema2;
|
|
286369
286694
|
try {
|
|
286370
|
-
prompt2 =
|
|
286371
|
-
schema2 =
|
|
286695
|
+
prompt2 = readFileSync194(resolve133(judgeDir, "JUDGE.md"), "utf8");
|
|
286696
|
+
schema2 = readFileSync194(resolve133(judgeDir, "verdict.schema.json"), "utf8");
|
|
286372
286697
|
} catch (e2) {
|
|
286373
286698
|
return cannotTell(`the judge prompt could not be read from ${judgeDir}: ${e2.message}`);
|
|
286374
286699
|
}
|
|
@@ -286403,7 +286728,7 @@ var SOURCE_JUDGE_DIR, JUDGE_MODEL, spawnProcess, cannotTell, SEVERITY, worse, VE
|
|
|
286403
286728
|
var init_judge = __esm({
|
|
286404
286729
|
"src/fidelity/judge.ts"() {
|
|
286405
286730
|
init_define_HHP_CATALOG();
|
|
286406
|
-
SOURCE_JUDGE_DIR =
|
|
286731
|
+
SOURCE_JUDGE_DIR = resolve133(dirname91(fileURLToPath44(import.meta.url)), "../../../judges/fidelity");
|
|
286407
286732
|
JUDGE_MODEL = "claude-sonnet-5-5";
|
|
286408
286733
|
spawnProcess = (cmd, args, { cwd, input, timeoutMs }) => new Promise((done) => {
|
|
286409
286734
|
let stdout = "", stderr = "", timedOut = false;
|
|
@@ -286501,13 +286826,13 @@ var runProcess;
|
|
|
286501
286826
|
var init_score = __esm({
|
|
286502
286827
|
"src/fidelity/score.ts"() {
|
|
286503
286828
|
init_define_HHP_CATALOG();
|
|
286504
|
-
runProcess = (cmd, args) => new Promise((
|
|
286829
|
+
runProcess = (cmd, args) => new Promise((resolve135, reject) => {
|
|
286505
286830
|
const child3 = spawn11(cmd, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
286506
286831
|
let stdout = "", stderr = "";
|
|
286507
286832
|
child3.stdout.on("data", (d2) => stdout += d2);
|
|
286508
286833
|
child3.stderr.on("data", (d2) => stderr += d2);
|
|
286509
286834
|
child3.on("error", reject);
|
|
286510
|
-
child3.on("close", (code3) =>
|
|
286835
|
+
child3.on("close", (code3) => resolve135({ code: code3 ?? 1, stdout, stderr }));
|
|
286511
286836
|
});
|
|
286512
286837
|
}
|
|
286513
286838
|
});
|
|
@@ -286800,7 +287125,7 @@ __export(native_exports, {
|
|
|
286800
287125
|
screenLink: () => screenLink
|
|
286801
287126
|
});
|
|
286802
287127
|
import { spawn as spawn12 } from "node:child_process";
|
|
286803
|
-
import { readFileSync as
|
|
287128
|
+
import { readFileSync as readFileSync195, writeFileSync as writeFileSync84 } from "node:fs";
|
|
286804
287129
|
import { join as join211 } from "node:path";
|
|
286805
287130
|
function resumedPackages(dumpsys) {
|
|
286806
287131
|
const lines2 = dumpsys.split("\n").filter((l3) => /\b(?:topResumedActivity|mResumedActivity|ResumedActivity)\b/.test(l3));
|
|
@@ -286812,22 +287137,22 @@ function focusedWindow(dumpsys) {
|
|
|
286812
287137
|
return m2?.[1]?.trim();
|
|
286813
287138
|
}
|
|
286814
287139
|
function runWithTimeout(cmd, args, timeoutMs) {
|
|
286815
|
-
return new Promise((
|
|
287140
|
+
return new Promise((resolve135) => {
|
|
286816
287141
|
const child3 = spawn12(cmd, args, { stdio: ["ignore", "pipe", "ignore"] });
|
|
286817
287142
|
const chunks = [];
|
|
286818
287143
|
const timer = setTimeout(() => {
|
|
286819
287144
|
child3.kill("SIGKILL");
|
|
286820
287145
|
child3.stdout.destroy();
|
|
286821
|
-
|
|
287146
|
+
resolve135({ code: 124, stdout: Buffer.concat(chunks), timedOut: true });
|
|
286822
287147
|
}, timeoutMs);
|
|
286823
287148
|
child3.stdout.on("data", (c2) => chunks.push(c2));
|
|
286824
287149
|
child3.on("error", () => {
|
|
286825
287150
|
clearTimeout(timer);
|
|
286826
|
-
|
|
287151
|
+
resolve135({ code: 127, stdout: Buffer.alloc(0) });
|
|
286827
287152
|
});
|
|
286828
287153
|
child3.on("close", (code3) => {
|
|
286829
287154
|
clearTimeout(timer);
|
|
286830
|
-
|
|
287155
|
+
resolve135({ code: code3 ?? 1, stdout: Buffer.concat(chunks) });
|
|
286831
287156
|
});
|
|
286832
287157
|
});
|
|
286833
287158
|
}
|
|
@@ -286856,7 +287181,7 @@ function nativeCapture(devices, opts) {
|
|
|
286856
287181
|
return r3;
|
|
286857
287182
|
};
|
|
286858
287183
|
const gone = /* @__PURE__ */ new Set();
|
|
286859
|
-
const read2 = opts.readFile ?? ((p2) =>
|
|
287184
|
+
const read2 = opts.readFile ?? ((p2) => readFileSync195(p2));
|
|
286860
287185
|
const sleep4 = opts.sleep ?? ((ms2) => new Promise((r3) => setTimeout(r3, ms2)));
|
|
286861
287186
|
const settleMs = opts.settleMs ?? 1e3;
|
|
286862
287187
|
const maxWaitMs = opts.maxWaitMs ?? 3e4;
|
|
@@ -287417,7 +287742,7 @@ async function publishSizeCommand(ctx) {
|
|
|
287417
287742
|
log: line => process.stdout.write(line + '\\n'),
|
|
287418
287743
|
error: line => process.stderr.write(line + '\\n')
|
|
287419
287744
|
});`;
|
|
287420
|
-
const result = await new Promise((
|
|
287745
|
+
const result = await new Promise((resolve135) => {
|
|
287421
287746
|
execFile8(process.execPath, [
|
|
287422
287747
|
...entry.pathname.endsWith(".ts") ? ["--import", import.meta.resolve("tsx")] : [],
|
|
287423
287748
|
"--input-type=module",
|
|
@@ -287426,7 +287751,7 @@ async function publishSizeCommand(ctx) {
|
|
|
287426
287751
|
JSON.stringify(ctx.argv),
|
|
287427
287752
|
entry.href
|
|
287428
287753
|
], { env: { ...process.env, HIMI_PUBLISH_SIZE_WORKER: "1" }, maxBuffer: 4 * 1024 * 1024 }, (error, stdout, stderr) => {
|
|
287429
|
-
|
|
287754
|
+
resolve135({ code: error ? typeof error.code === "number" ? error.code : 1 : 0, stdout, stderr });
|
|
287430
287755
|
});
|
|
287431
287756
|
});
|
|
287432
287757
|
try {
|
|
@@ -287578,7 +287903,7 @@ __export(ext_impl_exports, {
|
|
|
287578
287903
|
addExtensionToConfigSource: () => addExtensionToConfigSource,
|
|
287579
287904
|
runExt: () => runExt
|
|
287580
287905
|
});
|
|
287581
|
-
import { existsSync as existsSync167, mkdirSync as mkdirSync73, readFileSync as
|
|
287906
|
+
import { existsSync as existsSync167, mkdirSync as mkdirSync73, readFileSync as readFileSync196, writeFileSync as writeFileSync85 } from "node:fs";
|
|
287582
287907
|
import { join as join214 } from "node:path";
|
|
287583
287908
|
import ts33 from "typescript";
|
|
287584
287909
|
async function runExt(ctx) {
|
|
@@ -287687,9 +288012,9 @@ async function runExt(ctx) {
|
|
|
287687
288012
|
return 0;
|
|
287688
288013
|
}
|
|
287689
288014
|
function loadModelFor(extDir) {
|
|
287690
|
-
const parsed = parseExtensionManifest(JSON.parse(
|
|
288015
|
+
const parsed = parseExtensionManifest(JSON.parse(readFileSync196(join214(extDir, EXTENSION_MANIFEST), "utf8")));
|
|
287691
288016
|
if (!parsed.ok) return { ok: false, message: parsed.problems.map((p2) => p2.message).join("; ") };
|
|
287692
|
-
const iface = parseExtensionInterface(
|
|
288017
|
+
const iface = parseExtensionInterface(readFileSync196(join214(extDir, parsed.manifest.interface), "utf8"), parsed.manifest);
|
|
287693
288018
|
if (!iface.ok) return { ok: false, message: iface.problems.map((p2) => p2.message).join("; ") };
|
|
287694
288019
|
return { ok: true, model: iface.model };
|
|
287695
288020
|
}
|
|
@@ -287717,7 +288042,7 @@ function declaredExtensionsNode(app2) {
|
|
|
287717
288042
|
return void 0;
|
|
287718
288043
|
}
|
|
287719
288044
|
function addToConfig(configPath, name) {
|
|
287720
|
-
writeFileAtomic(configPath, addExtensionToConfigSource(
|
|
288045
|
+
writeFileAtomic(configPath, addExtensionToConfigSource(readFileSync196(configPath, "utf8"), name));
|
|
287721
288046
|
}
|
|
287722
288047
|
function listExtensions(dir, print) {
|
|
287723
288048
|
const prepared = prepareExtensions(dir, { write: false });
|
|
@@ -287853,7 +288178,7 @@ import { AsyncLocalStorage as AsyncLocalStorage4 } from "node:async_hooks";
|
|
|
287853
288178
|
import { rmSync as rmSync55 } from "node:fs";
|
|
287854
288179
|
import { spawn as spawn13 } from "node:child_process";
|
|
287855
288180
|
import { homedir as homedir23 } from "node:os";
|
|
287856
|
-
import { resolve as
|
|
288181
|
+
import { resolve as resolve134 } from "node:path";
|
|
287857
288182
|
import { fileURLToPath as fileURLToPath45 } from "node:url";
|
|
287858
288183
|
|
|
287859
288184
|
// src/cli-flags.ts
|
|
@@ -289084,7 +289409,7 @@ var COMMANDS = [
|
|
|
289084
289409
|
{ name: "logout", summary: "remove the stored control token for a target", required: "[--target <t>]" },
|
|
289085
289410
|
{ name: "connector", summary: "personal access tokens for the hosted MCP connector (Wix Native App Builder), for an AI tool that cannot sign in with OAuth (e.g. Base44's builder): `token create` opens a Wix sign-in page and prints a long-lived token once, to paste into the tool as `Authorization: Bearer <token>`; `token list` / `token revoke <id>` manage them with the `himi login --browser` token. The token can only build and publish DRAFTS.", required: "token create [--name <n>] [--days <1-90>] [--no-open] | token list | token revoke <id> [--target <t>]" },
|
|
289086
289411
|
{ name: "notify", summary: "Hosted --all-members requires --yes for a live send; --dry-run checks ownership/readiness and counts approved recipients without sending. `setup` optionally configures Branded/Ping from local customer key files (`--platforms android` for an Android-only app: no Apple key); `status --refresh` reads live backend readiness. Setup may be deferred while building. These use serve-control and require owner plus Wix account authentication. `send`, `tokens`, `doctor`: send a REAL push notification to registered devices (RFC 0036 WS5) \u2014 APNs .p8 over HTTP/2 for iOS, FCM v1 for Android. `send` targets one device (--token / --device <registry id>) or fans out to the whole app (--all), reporting a per-device result; a token the provider says is uninstalled (APNs 410 Unregistered / FCM UNREGISTERED) is auto-disabled, while a merely wrong one (BadDeviceToken \u2014 usually a sandbox/production mismatch) is recorded and left enabled. `tokens` lists the registry. `doctor` reports which credentials resolve and which sender each platform picks. Talks to the admin-server via --admin-url/HIMALAYA_ADMIN_URL, authenticated with --admin-session/HIMALAYA_ADMIN_SESSION. `send --provider ping` is the hosted alternative: the serve plane sends to one site member (--member-email) or all approved members (--all-members) through Ping as Himalaya, with owner login instead of provider keys, and reports acceptance, never delivery. NOT `himi push`, which publishes a release.", required: "setup|status [--content <dir>] [--target <t>] [--platforms ios|android|ios,android] [--refresh] [--yes] [--no-push-setup] | send --provider ping [--content <dir>] [--app <a>] [--site <msid>] (--member-email <email> | --all-members (--dry-run | --yes)) --title <s> [--body <s>] --link <url> [--request-id <uuid>] [--dry-run] [--json] | send|tokens|doctor [--app <a>] [--token <t> | --device <id> | --all] [--title <s>] [--body <s>] [--link <url>] [--platform ios|android] [--badge <n>] [--channel <id>] [--silent] [--dry-run] [--json]" },
|
|
289087
|
-
{ name: "setup", summary: "`check`: one readiness report for an app's backend setup \u2014 `push` (the same check as `himi notify status`), `signIn` (member Apple, Google iOS and Google Android sign-in, read from the site's Branded record)
|
|
289412
|
+
{ name: "setup", summary: "`check`: one readiness report for an app's backend setup \u2014 `push` (the same check as `himi notify status`), `signIn` (member Apple, Google iOS and Google Android sign-in, read from the site's Branded record) `iap` (the same check as `himi store iap check`, run only with --iap-manifest; without it the section is `not_checked`), `steps` (each server setup step \u2014 app-identity, apns, apple-signing, firebase, android-signin, ping-readback \u2014 with its state and last error; false only when a step needs attention) and `iapSetup` (the IAP setup steps \u2014 asc-key, purchases-app, iap-key, payment-provider \u2014 read without a manifest; the provider stays unverified because nothing can read it). The table of every step is in `himi docs push-cli-onboarding`. Each section has `ok`: true when ready, false when something is missing or wrong (with a `code` and a fix), null when it could not be verified \u2014 listed under `unverified`, never counted as ready. The top-level `ok` is false when any section is false; exit 0 when ok, 1 when not, 2 for bad input (`invalid_setup_area`, `iap_manifest_required`). `--only push,signin,iap` limits it to those areas; `--refresh` reads live backend readiness. Read-only. Needs owner plus Wix account authentication, like `notify status`.", required: "check [--content <dir>] [--target <t>] [--refresh] [--only push,signin,iap] [--iap-manifest <file> --catalog-route <path> [--purchases-app <id>] [--plist <Info.plist>]]" },
|
|
289088
289413
|
{ name: "signing", summary: "READ-ONLY App Store Connect inventory for customer BYO TestFlight readiness. `inspect` lists whether the bundle id, distribution certificate, IOS_APP_STORE profile, and ASC app record exist for --bundle-id / --team-id using a local ASC .p8 (flags or ASC_KEY_* env). Never uploads or mutates Apple resources. Optional --cert-file/--profile-file classify on-disk material.", required: "inspect --bundle-id <id> --team-id <id> --asc-key-file <path> --asc-key-id <id> --asc-issuer-id <id> [--cert-file <p12> --cert-password <pw> --profile-file <mobileprovision>] [--json]" },
|
|
289089
289414
|
{ name: "site", summary: "PROVISION a Wix project, then analyze or extend it. `create` is the one door that makes a site instead of adopting one: POST /funnel/projects/v1/create (a WIX site, a HEADLESS backend, a BRANDED_APP, or a VIBE site), and for headless it also mints the OAuth app whose id IS the `WIX_CLIENT_ID` \u2014 with --redirect-uri already registered, because an unregistered redirect makes native signInDirect fail at redirect-session. `--verticals` REQUIRES `--template` and reports only what Wix confirmed: measured, installing onto a project created from the BLANK template returns 200 while the vertical's API answers 428 forever, because there is no site for it to attach to (the install asks for CREATE_SITE). A real template ships its verticals installed and populated, and installing further ones onto it then works. It MUTATES your Wix account and needs --yes; without it you get the payload and nothing is sent. `list` is the read-only site inventory (with each site's premium flag, which is what explains an installed-but-428 vertical). Auth is the account-scoped `wix token` (no --site), falling back to WIX_API_KEY + WIX_ACCOUNT_ID. `client` is the same OAuth step for a site that ALREADY exists \u2014 the one himi adopts rather than makes \u2014 so a clientId no longer means a manual trip to the dashboard: `client ensure` reconciles rather than mints, because a site can already carry a client with NO registered redirect and shipping that one fails signInDirect at runtime; it reuses a client that carries --redirect-uri, PATCHes one that matches --name but lacks it (unioning, so another app's redirect survives), and creates only when there is nothing to reuse (--new forces a fresh one). --name IS the idempotency key. `client` auth is SITE-scoped (WIX_API_KEY, else the owner's account token in WIX_TOKEN exchanged for that site, else `wix token --site <msid>`) because minting is owner-of-that-site, and --yes gates every mutation: a site that already has a usable client resolves WITHOUT it, but --write-provisioning needs --yes even then because it rewrites a manifest on disk (the dry run's planned.provisioning names the file). That query endpoint IGNORES paging (measured: query.paging, cursorPaging and a top-level paging all return the full set at offset 0), so when pagingMetadata reports more clients than came back, `ensure` REFUSES EVERY outcome \u2014 create, patch AND reuse. Reuse is refused too because pickClient breaks ties on the OLDEST createdDate, so an omitted older same-named MOBILE client with the same redirect would win a later complete read and the resolved clientId would MOVE between runs \u2014 and it gets written into provisioning.json; convergence is what makes a stray duplicate untidy rather than harmful. --name cannot narrow the query (no filter is sent; the name is applied to the rows after they arrive), so the recovery is the dashboard; --new skips the query entirely. A `patched` result is verified against what Wix STORED \u2014 the redirect list is read off the PATCH response, and re-read via GET when the response omits it, because falling back to the list himi just sent would make the guard pass vacuously on exactly the silent no-op it exists to catch. `client list` is the read-only inventory of a site's clients: act on its `shippable` column rather than `hasRedirect`, because shippable ALSO requires a MOBILE applicationType and `ensure` refuses a WEB client \u2014 a WEB one carrying your redirect looks right and is not a candidate \u2014 and it sets truncated:true rather than presenting a partial inventory as the whole one. `analyze --read-only` returns API-only generation context as JSON (identity, access probes, CMS permissions and selected redacted Velo source); it needs no browser and never uploads or applies anything. A URL is optional there: `--url` lets it read the published page's Velo code-app ids (credential-free, pinned transport) so the backend source is found on sites where the owner code-app probe 404s. `analyze` reads a site into a business-book folder (REST + Playwright, GET-only); `--url` alone is the visitor-only pass over the published pages, and `--client-id` adds the vertical probes and the app binding `--apply` requires; with no Playwright/Chromium it refuses before any work (code \"browser_unavailable\", the install command in `fix`) unless `--no-browser` asks for the static-HTML-only pass; `site function` list/get/put/publish/invokes that site's Velo HTTP functions and is not `himi functions` (serve-plane jobs). `--apply` bakes into a brandable shell (a site shell needs no `--client-id`: it is visitor-only and binds no client); `--shell` takes the same names `himi dist --shell` does and defaults to branded-lite, and a shell that ships no prepare:customer is refused by name rather than half-built. A site shell (RFC 0062) \u2014 a target whose contract has a `site` block, whatever the shell is called: `--shell brandy` in the repo, or off-repo a content package whose provisioning.json names the website \u2014 also derives the site's page map from its published pages and header menu \u2014 Home first, up to four tabs for the pages a visitor returns to, the rest in the drawer \u2014 into the overlay's `site` block, so it can be edited before `--apply`; only a site shell ever receives that block, and a branded-lite target without one stays a native app. It never overwrites any shell's committed apps/<shell>/provisioning.json. `member-app set|clear|show <msid>` is the site's member app in Spaces (#4091): the himi app the site's members open in Spaces Lite instead of Branded Lite. `set --app <id>` takes the site's own app or one your account owns (an owned app not yet tied to the site is linked first; another account's app is refused, 403); `clear` returns the site to Branded Lite; `show` prints the pick plus the COMPUTED verdict \u2014 the picked release's requirements judged against the Spaces host manifest (checkHostCompatibility, `--platform` to judge one phone platform) \u2014 and `reason` when it falls back to Branded Lite. Auth is your `himi login` control token plus the account `wix token`, which the plane uses to verify you own the site.", required: "create <name> [--type wix|headless|branded-app|vibe] [--template <guid>] [--verticals stores,bookings,\u2026] [--folder <guid>] [--redirect-uri <uri>] [--no-oauth-app] [--write-provisioning [path]] [--site-url <url>] [--json] --yes | list | client ensure|list --site <msid> [--name <name>] [--redirect-uri <uri>] [--new] [--write-provisioning [path]] [--site-url <url>] [--json] --yes | analyze --read-only [--site <msid>] [--client-id <id>] [--url <https>] [--json] | analyze --url <https> [--client-id <id>] [--site <msid>] [--out <dir>] [--redirect-uri <uri>] [--apply [--site-pages] [--dry-run]] [--no-browser] [--shell " + SHELL_ENUM + "] | function list|get|put|publish|invoke [--site <msid>] [--url <https>] [--method GET|POST|PUT|DELETE] [--source <file>] [--body <json>] [--publish] [--invoke] | member-app set|clear|show <msid> [--app <id>] [--platform ios|android]" },
|
|
289090
289415
|
{ name: "base44", summary: "read a BASE44 app into an app book (book.json + BOOK.md) for the agent building a Himi app from it \u2014 the Base44 counterpart of `site analyze`, READ-ONLY. `analyze --url <published app>` is the VISITOR pass: the app id, name, favicon and colours from the published SPA, its router paths, and screenshots + look tokens from the Playwright crawl. `analyze --app-id <id>` adds the OWNER pass and needs a session: the project source under <out>/source/ (the read half of `base44 eject` \u2014 GET api/apps/<id>/eject \u2014 through the same deny-list and secret scan `himi push` uses, widened by the book's token shapes; `eject` itself is never run because it CREATES a copy of the app), every entity's JSON schema, required fields and RLS rules with up to --sample redacted rows (default 5, 0 = off), backend functions, agents, connectors (names and scopes only, never tokens), secret NAMES (never values), auth visibility + providers, and the route \u2192 component \u2192 entities map from the source router. Every chapter it could not read is listed in `gaps` rather than failing the run. `login` runs Base44's device sign-in and stores the session in ~/.himi/base44/session.json (never the repo; --from-base44-cli imports `npx base44 login`'s session instead); BASE44_ACCESS_TOKEN in the environment wins, for CI. `whoami` prints who is signed in (never the token); `logout` removes the stored session. `auth-check --url <tenant> --ios-app-id <PREFIX.bundle.id>` and/or `--android-package <package> --android-sha256 <fingerprint>` checks public native-login associations and prints missing entries; it never reads an owner token. --json prints the book itself. himi docs base44-app-context. `adopt` turns the book into a reviewable base44-entities.ts of ADOPTED entity + function declarations for config.ts (never edits config.ts, never overwrites); `entities query` is READ-ONLY and reports, per declared entity, ownership, row count and schema drift against the live app, plus foreign entities. `entities create` provisions the app's OWNED Himi<App>* entities: Base44's schema write is a destructive full-set sync, so the single PUT carries every entity in a freshly read eject snapshot (foreign ones verbatim) and the run refuses BEFORE sending when one would be dropped, the snapshot is unreadable or empty, or it moved since the plan; removing an owned field/entity needs --allow-destructive, rewriting owned RLS needs --apply-permissions. `entities seed` bulk-inserts seed rows into empty owned entities only (--ai writes base44-seed.json offline). `functions deploy` ships owned functions one PUT each, never the bulk sync or DELETE, and refuses a name deployed by someone else. All three print a plan and write only with --yes, which needs a `login --write` (apps:write) session. `types` writes tier5-src/_shared/base44-entities.ts \u2014 a row type and a typed `entities<Row>()` handle per declared entity, byte-stable \u2014 and `himi validate` reports base44-types-stale when that file falls behind the block (nothing when it is absent). himi docs base44-entities. `screens` (base44-starter packages) writes one generated list + detail screen per declared entity over the template's shared engine, with write controls gated by the entity's rls; an unchanged config reports every file `unchanged`, a hand-edited generated file is `skipped-edited` unless --force; never calls Base44. himi docs base44-app-to-himi-app", required: "analyze (--url <https://\u2026> | --app-id <id>) [--out .himi/base44-book] [--sample <n>] [--json] | adopt [--book .himi/base44-book] [--entities A,B] [--write [path]] [--json] | entities query [--content <dir>] [--all] [--json] | entities create [--app <a>] [--yes] [--allow-destructive] [--apply-permissions] [--empty-app-ok] | entities seed [--app <a>] [--yes] [--only A,B] [--ai] | functions deploy [--app <a>] [--yes] [--only a,b] | types [--content <dir>] [--json] | screens [--content <dir>] [--force] [--dry-run] [--json] | login [--write] [--from-base44-cli] | whoami | logout | auth-check --url <https://tenant> [--ios-app-id <PREFIX.bundle.id>] [--android-package <package> --android-sha256 <fingerprint>]" },
|
|
@@ -289252,8 +289577,8 @@ async function resolveFromUrl(ctx) {
|
|
|
289252
289577
|
const { pixelToolchainAvailable: pixelToolchainAvailable2 } = await Promise.resolve().then(() => (init_icon(), icon_exports));
|
|
289253
289578
|
if (await pixelToolchainAvailable2()) {
|
|
289254
289579
|
const { sourceImageMinEdge: sourceImageMinEdge2 } = await Promise.resolve().then(() => (init_pixels(), pixels_exports));
|
|
289255
|
-
const { readFileSync:
|
|
289256
|
-
if (await sourceImageMinEdge2(
|
|
289580
|
+
const { readFileSync: readFileSync197 } = await import("node:fs");
|
|
289581
|
+
if (await sourceImageMinEdge2(readFileSync197(spec.icon)) === null) {
|
|
289257
289582
|
throw new FromUrlError2("app_spec_invalid", `app spec: icon ${spec.icon} is not an image this CLI can read \u2014 supply a PNG or JPEG, ideally 1024x1024`);
|
|
289258
289583
|
}
|
|
289259
289584
|
}
|
|
@@ -290269,17 +290594,17 @@ async function buildCommand(ctx) {
|
|
|
290269
290594
|
const dir = contentDir(flags);
|
|
290270
290595
|
const { buildContentBundles: buildContentBundles2 } = await loadAuthoring();
|
|
290271
290596
|
const res = await buildContentBundles2(dir, { resolution: resolutionFlag(flags) });
|
|
290272
|
-
const
|
|
290597
|
+
const failed2 = res.compileErrors;
|
|
290273
290598
|
print({
|
|
290274
|
-
ok:
|
|
290599
|
+
ok: failed2.length === 0,
|
|
290275
290600
|
outDir: res.outDir,
|
|
290276
290601
|
built: res.built,
|
|
290277
|
-
...
|
|
290602
|
+
...failed2.length ? { compileErrors: failed2 } : {},
|
|
290278
290603
|
// #642.1b — a stale @wix/himalaya is advisory on `build` (the bundles may
|
|
290279
290604
|
// still compile); `validate --strict` is where it hard-fails.
|
|
290280
290605
|
...res.sdkVersionIssue || res.staleShared ? { warnings: [...res.sdkVersionIssue ? [res.sdkVersionIssue] : [], ...res.staleShared ? [res.staleShared] : []] } : {}
|
|
290281
290606
|
});
|
|
290282
|
-
return
|
|
290607
|
+
return failed2.length ? 1 : 0;
|
|
290283
290608
|
}
|
|
290284
290609
|
|
|
290285
290610
|
// src/commands/eject.ts
|
|
@@ -291194,13 +291519,13 @@ async function testCommand(ctx) {
|
|
|
291194
291519
|
return 2;
|
|
291195
291520
|
}
|
|
291196
291521
|
nativeAvailabilities = platforms.map((platform) => platform === "ios" ? detectNativeDecode2() : detectAndroidNativeDecode2());
|
|
291197
|
-
const
|
|
291198
|
-
if (flags.native !== true &&
|
|
291199
|
-
io2.error(JSON.stringify({ error: `--native ${
|
|
291522
|
+
const unavailable2 = nativeAvailabilities.filter((availability) => !availability.available);
|
|
291523
|
+
if (flags.native !== true && unavailable2.length > 0) {
|
|
291524
|
+
io2.error(JSON.stringify({ error: `--native ${unavailable2[0].platform} unavailable: ${unavailable2[0].reason}` }));
|
|
291200
291525
|
return 2;
|
|
291201
291526
|
}
|
|
291202
291527
|
if (nativeAvailabilities.every((availability) => !availability.available)) {
|
|
291203
|
-
io2.error(JSON.stringify({ error: `--native unavailable: ${
|
|
291528
|
+
io2.error(JSON.stringify({ error: `--native unavailable: ${unavailable2.map((item2) => `${item2.platform}: ${item2.reason}`).join("; ")}` }));
|
|
291204
291529
|
return 2;
|
|
291205
291530
|
}
|
|
291206
291531
|
}
|
|
@@ -292032,8 +292357,8 @@ function pushAuthHint(status2, token, target, hasOwnerIssuer = true) {
|
|
|
292032
292357
|
}
|
|
292033
292358
|
async function contentVisibility(dir) {
|
|
292034
292359
|
try {
|
|
292035
|
-
const { readFileSync:
|
|
292036
|
-
const m2 = JSON.parse(
|
|
292360
|
+
const { readFileSync: readFileSync197 } = await import("node:fs");
|
|
292361
|
+
const m2 = JSON.parse(readFileSync197(join161(dir, "himalaya.content.json"), "utf8"));
|
|
292037
292362
|
if (m2.visibility === "public" || m2.visibility === "unlisted") return m2.visibility;
|
|
292038
292363
|
} catch {
|
|
292039
292364
|
}
|
|
@@ -293436,9 +293761,9 @@ async function runPackageCommand(ctx) {
|
|
|
293436
293761
|
});
|
|
293437
293762
|
await announce(run4);
|
|
293438
293763
|
print({ ok: true, app: run4.app, url: run4.url, port: run4.port, plane: "browser" });
|
|
293439
|
-
await new Promise((
|
|
293764
|
+
await new Promise((resolve135) => {
|
|
293440
293765
|
const stop2 = () => {
|
|
293441
|
-
void retract().catch((e2) => io2.error(JSON.stringify({ run: "stop_cleanup_failed", message: e2.message }))).finally(() => run4.close().finally(() =>
|
|
293766
|
+
void retract().catch((e2) => io2.error(JSON.stringify({ run: "stop_cleanup_failed", message: e2.message }))).finally(() => run4.close().finally(() => resolve135()));
|
|
293442
293767
|
};
|
|
293443
293768
|
dropEarlySignals?.();
|
|
293444
293769
|
process.once("SIGINT", stop2);
|
|
@@ -293481,7 +293806,7 @@ async function runPackageCommand(ctx) {
|
|
|
293481
293806
|
const live4 = join167(running.releaseRoot, running.app);
|
|
293482
293807
|
const manifestOf = (tree) => JSON.parse(readFileSync155(join167(tree, "release-manifest.json"), "utf8"));
|
|
293483
293808
|
let current = manifestOf(live4);
|
|
293484
|
-
const
|
|
293809
|
+
const failed2 = async (message5) => {
|
|
293485
293810
|
if (stopping) return;
|
|
293486
293811
|
bus.publish("build.failed", { message: message5 });
|
|
293487
293812
|
record5(running, { ok: false, at: (/* @__PURE__ */ new Date()).toISOString(), error: message5 });
|
|
@@ -293496,14 +293821,14 @@ async function runPackageCommand(ctx) {
|
|
|
293496
293821
|
if (bres.compileErrors.length) {
|
|
293497
293822
|
const first = bres.compileErrors[0];
|
|
293498
293823
|
const diag = first.errors[0];
|
|
293499
|
-
await
|
|
293824
|
+
await failed2(`${first.bundle}: ${diag ? `${diag.file ? `${diag.file}${diag.line ? `:${diag.line}` : ""} ` : ""}${diag.text}` : "did not compile"}`);
|
|
293500
293825
|
return;
|
|
293501
293826
|
}
|
|
293502
293827
|
const hasWorkers = bres.built.length > 0;
|
|
293503
293828
|
const outcome = await buildReleaseFromContent2(dir, next, { ...hasWorkers ? { tier5Dir: bundleOutDir2(dir) } : {}, freshModule: true, ...RUN_CONTENT_BUILD2 });
|
|
293504
293829
|
const blocker = watchKit.rebuildBlocker(outcome, servedMissing);
|
|
293505
293830
|
if (blocker) {
|
|
293506
|
-
await
|
|
293831
|
+
await failed2(blocker);
|
|
293507
293832
|
return;
|
|
293508
293833
|
}
|
|
293509
293834
|
if (stopping) return;
|
|
@@ -293526,7 +293851,7 @@ async function runPackageCommand(ctx) {
|
|
|
293526
293851
|
await refreshBoard();
|
|
293527
293852
|
io2.error(JSON.stringify({ watch: "rebuilt", ms: Date.now() - t0, screens: diff.screens, tokens: diff.tokens, config: diff.config, ...changes.items.length ? { changed: headline2(changes), changes } : {}, tabs: bus.listeners }));
|
|
293528
293853
|
} catch (e2) {
|
|
293529
|
-
await
|
|
293854
|
+
await failed2(e2.message.split("\n")[0]);
|
|
293530
293855
|
} finally {
|
|
293531
293856
|
rmSync39(next, { recursive: true, force: true });
|
|
293532
293857
|
}
|
|
@@ -298184,7 +298509,11 @@ async function setupCommand(ctx) {
|
|
|
298184
298509
|
return runSetupCheck2(flags, io2, {
|
|
298185
298510
|
pushStatus: async (sub, subIo) => {
|
|
298186
298511
|
const { runNotifySetup: runNotifySetup2 } = await Promise.resolve().then(() => (init_notify_setup(), notify_setup_exports));
|
|
298187
|
-
return runNotifySetup2(["notify", "status"], sub, subIo, { withSignIn: true });
|
|
298512
|
+
return runNotifySetup2(["notify", "status"], sub, subIo, { withSignIn: true, withSteps: true });
|
|
298513
|
+
},
|
|
298514
|
+
iapSetup: async (sub, subIo) => {
|
|
298515
|
+
const { runIapSetupCheck: runIapSetupCheck2 } = await Promise.resolve().then(() => (init_check2(), check_exports));
|
|
298516
|
+
return runIapSetupCheck2(sub, subIo);
|
|
298188
298517
|
},
|
|
298189
298518
|
iapCheck: async (sub, subIo) => {
|
|
298190
298519
|
const { runStoreIap: runStoreIap2, defaultStoreIapDeps: defaultStoreIapDeps2 } = await Promise.resolve().then(() => (init_store_iap(), store_iap_exports));
|
|
@@ -298289,7 +298618,7 @@ import {
|
|
|
298289
298618
|
lstatSync as lstatSync40,
|
|
298290
298619
|
mkdirSync as mkdirSync62,
|
|
298291
298620
|
openSync as openSync13,
|
|
298292
|
-
readFileSync as
|
|
298621
|
+
readFileSync as readFileSync176,
|
|
298293
298622
|
readdirSync as readdirSync65,
|
|
298294
298623
|
realpathSync as realpathSync23,
|
|
298295
298624
|
renameSync as renameSync26,
|
|
@@ -298297,7 +298626,7 @@ import {
|
|
|
298297
298626
|
statSync as statSync51,
|
|
298298
298627
|
writeFileSync as writeFileSync68
|
|
298299
298628
|
} from "node:fs";
|
|
298300
|
-
import { basename as basename41, dirname as dirname84, join as join187, relative as relative37, resolve as
|
|
298629
|
+
import { basename as basename41, dirname as dirname84, join as join187, relative as relative37, resolve as resolve121 } from "node:path";
|
|
298301
298630
|
var L10N_USAGE = "usage: himi l10n import --format oneapp <dir> (--app <slug> | --content <app dir>) [--locales en,he] [--source en] [--overwrite] [--json]";
|
|
298302
298631
|
var MESSAGES_FILE = /^messages_(.+)\.json$/;
|
|
298303
298632
|
var UnsafePath = class extends Error {
|
|
@@ -298310,7 +298639,7 @@ function readRegularFile(path2) {
|
|
|
298310
298639
|
const fd = openSync13(path2, constants12.O_RDONLY | (constants12.O_NOFOLLOW ?? 0));
|
|
298311
298640
|
try {
|
|
298312
298641
|
if (!fstatSync4(fd).isFile()) throw new Error(`${path2} is not a regular file`);
|
|
298313
|
-
return
|
|
298642
|
+
return readFileSync176(fd);
|
|
298314
298643
|
} finally {
|
|
298315
298644
|
closeSync14(fd);
|
|
298316
298645
|
}
|
|
@@ -298370,7 +298699,7 @@ async function l10nCommand(ctx) {
|
|
|
298370
298699
|
if (!/^[a-z0-9][a-z0-9-]*$/.test(slug)) {
|
|
298371
298700
|
return fail16("app_not_found", { error: `--app ${slug}: an app slug, not a path`, hint: "pass --content <app dir> to target a directory" }, 2);
|
|
298372
298701
|
}
|
|
298373
|
-
const dir =
|
|
298702
|
+
const dir = resolve121("apps", slug);
|
|
298374
298703
|
if (!existsSync145(join187(dir, "config.ts")) && !existsSync145(join187(dir, "config.js")) && !existsSync145(join187(dir, "config.mjs"))) {
|
|
298375
298704
|
return fail16("app_not_found", { error: `--app ${slug}: no apps/${slug}/config.ts under ${process.cwd()}`, hint: "run from the repo root, or pass --content <app dir>" }, 2);
|
|
298376
298705
|
}
|
|
@@ -298379,7 +298708,7 @@ async function l10nCommand(ctx) {
|
|
|
298379
298708
|
} else {
|
|
298380
298709
|
return fail16("invalid_usage", { error: "name the app: --app <slug> (in a checkout) or --content <app dir>" }, 2);
|
|
298381
298710
|
}
|
|
298382
|
-
const messagesDir =
|
|
298711
|
+
const messagesDir = resolve121(dirArg);
|
|
298383
298712
|
if (!existsSync145(messagesDir) || !statSync51(messagesDir).isDirectory()) {
|
|
298384
298713
|
return fail16("messages_dir_not_found", { error: `${dirArg} is not a directory`, dir: messagesDir }, 1);
|
|
298385
298714
|
}
|
|
@@ -298586,7 +298915,7 @@ async function l10nCommand(ctx) {
|
|
|
298586
298915
|
init_define_HHP_CATALOG();
|
|
298587
298916
|
init_cli_shared();
|
|
298588
298917
|
import { existsSync as existsSync153 } from "node:fs";
|
|
298589
|
-
import { join as join196, resolve as
|
|
298918
|
+
import { join as join196, resolve as resolve125 } from "node:path";
|
|
298590
298919
|
async function base44Command(ctx) {
|
|
298591
298920
|
const { io: io2, pos, flags, print } = ctx;
|
|
298592
298921
|
if (pos[1] === "auth-check") {
|
|
@@ -298742,7 +299071,7 @@ async function base44Command(ctx) {
|
|
|
298742
299071
|
const slug = str3(flags.app);
|
|
298743
299072
|
if (!provisioning || str3(flags.content) !== void 0 || !slug) return contentDir(flags);
|
|
298744
299073
|
if (!/^[a-z0-9][a-z0-9-]*$/.test(slug)) return void 0;
|
|
298745
|
-
const dir =
|
|
299074
|
+
const dir = resolve125("apps", slug);
|
|
298746
299075
|
return existsSync153(join196(dir, "config.ts")) || existsSync153(join196(dir, "config.mjs")) ? dir : void 0;
|
|
298747
299076
|
};
|
|
298748
299077
|
if (sub === "entities" || sub === "functions") {
|
|
@@ -299232,7 +299561,7 @@ function createTrimValidator(deps = {}, spawnFn = spawn13) {
|
|
|
299232
299561
|
return { code: code3, counts, ...errors ? { errors } : {}, ...code3 !== 0 ? { tail: said.slice(-4e3) } : {} };
|
|
299233
299562
|
};
|
|
299234
299563
|
return async (dir, opts = {}) => {
|
|
299235
|
-
const argv = ["validate", "--content",
|
|
299564
|
+
const argv = ["validate", "--content", resolve134(dir), "--strict", "--skip-version-check"];
|
|
299236
299565
|
if (!opts.fresh) {
|
|
299237
299566
|
const out2 = [];
|
|
299238
299567
|
const err = [];
|