@wix/himalaya-cli 0.1678.0 → 0.1679.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/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/l10n/src/locale.d.ts +31 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/serve-runtime/src/wix-bridge.d.ts +12 -13
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/legacy-import.d.ts +51 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +37 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/l10n/locale.mjs +54 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/package.json +4 -0
- package/dist/browser-plane/sw.js +6 -6
- package/dist/cli.mjs +347 -272
- package/package.json +2 -2
package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/l10n/src/locale.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type LocaleTag = string;
|
|
2
|
+
export interface AvailableLocale {
|
|
3
|
+
tag: LocaleTag;
|
|
4
|
+
/** The language's own name — "English", "עברית". */
|
|
5
|
+
nativeName: string;
|
|
6
|
+
dir: "ltr" | "rtl";
|
|
7
|
+
}
|
|
8
|
+
export interface LocaleState {
|
|
9
|
+
/** The active app locale. */
|
|
10
|
+
tag: LocaleTag;
|
|
11
|
+
/** What chose it: an in-app choice, the device language, or the app's served default. */
|
|
12
|
+
source: "user" | "device" | "default";
|
|
13
|
+
/** The locales the app ships (its served `LocaleConfig`), source locale first. */
|
|
14
|
+
available: AvailableLocale[];
|
|
15
|
+
}
|
|
16
|
+
export interface SetLocaleResult {
|
|
17
|
+
ok: boolean;
|
|
18
|
+
/** The locale now active (on success). */
|
|
19
|
+
tag?: LocaleTag;
|
|
20
|
+
/** `unsupported_locale` — not a shipped locale nor `"system"`; nothing changed. */
|
|
21
|
+
error?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Follow the device language again (under the app's shipped locales). */
|
|
24
|
+
export declare const SYSTEM_LOCALE = "system";
|
|
25
|
+
/**
|
|
26
|
+
* Switch the app to [tag] — a locale from `getLocale().available`, or `"system"` to forget the
|
|
27
|
+
* choice and follow the device. Never throws for a bad tag: answers `{ ok: false, error }`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function setLocale(tag: LocaleTag): Promise<SetLocaleResult>;
|
|
30
|
+
/** The active locale, what chose it, and the locales the app ships. */
|
|
31
|
+
export declare function getLocale(): Promise<LocaleState>;
|
|
@@ -119,19 +119,18 @@ export declare class OwnerInstanceCache {
|
|
|
119
119
|
}
|
|
120
120
|
export declare const OWNER_SITES_QUERY_PATH = "/site-list/v2/sites/query";
|
|
121
121
|
export declare const OWNER_SITES_COUNT_PATH = "/site-list/v2/sites/count";
|
|
122
|
-
/** The Site List
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
};
|
|
122
|
+
/** The Site List filters that find ONE site by id, to try IN ORDER until one answers it.
|
|
123
|
+
*
|
|
124
|
+
* 1. The id alone. Site List then answers its default namespaces, which cover Wix and Wix Studio
|
|
125
|
+
* sites — what every ownership check did before #5679.
|
|
126
|
+
* 2. The id with `namespace: HEADLESS`. A headless site is invisible to the default (measured: its
|
|
127
|
+
* id alone answers `sites: []`), so it needs this second, narrower pass.
|
|
128
|
+
*
|
|
129
|
+
* Never one list of namespaces: measured 2026-11-12 on a live WIX site, a `namespace.$in` holding any
|
|
130
|
+
* value the filter does not accept (`WIX_STUDIO`, `STUDIO`, a made-up one) answers 200 with NO sites.
|
|
131
|
+
* #5679's `["WIX", "WIX_STUDIO", "HEADLESS"]` therefore found no site at all, and every owner-gated
|
|
132
|
+
* route and the `himi login --device --site` step read the owner as "not the owner". */
|
|
133
|
+
export declare function siteIdFilters(siteId: string): Array<Record<string, unknown>>;
|
|
135
134
|
/** True for the ONLY two paths the account-level owner-sites rung may reach. */
|
|
136
135
|
export declare function isOwnerSitesPath(path: string): boolean;
|
|
137
136
|
/**
|
package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/legacy-import.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Source kinds a baked config may name. A kind a binary does not register is skipped and
|
|
2
2
|
* reported at runtime, never a crash — but `defineApp` only accepts kinds the contract knows. */
|
|
3
|
-
export declare const LEGACY_IMPORT_SOURCE_KINDS: readonly ["files", "web-storage"];
|
|
3
|
+
export declare const LEGACY_IMPORT_SOURCE_KINDS: readonly ["files", "oneapp-mmkv", "web-storage"];
|
|
4
4
|
export type LegacyImportSourceKind = (typeof LEGACY_IMPORT_SOURCE_KINDS)[number];
|
|
5
5
|
/** Sinks an item can be mapped to. */
|
|
6
6
|
export declare const LEGACY_IMPORT_SINKS: readonly ["localDatabase", "state", "files", "report", "webStorageSnapshot", "installationId", "drop"];
|
|
@@ -28,6 +28,35 @@ export interface LegacyImportFilesSource {
|
|
|
28
28
|
/** Relative directory under `root` — no leading `/`, no `..`. */
|
|
29
29
|
path: string;
|
|
30
30
|
}
|
|
31
|
+
/** #4657 (H12c) — the encrypted MMKV instance of an app built on Wix's React Native OneApp engine
|
|
32
|
+
* (generic for any OneApp-based app; named for the format, never an app). Yields every live item
|
|
33
|
+
* as `{ key, namespace?, value, meta? }`: `woas.1.<ns>.__global.<key>` → key `<key>`, namespace
|
|
34
|
+
* `<ns>`; any other key → plain, its JSON parsed. Map rules match the FULL original key. */
|
|
35
|
+
export interface LegacyImportOneAppMmkvSource {
|
|
36
|
+
id: string;
|
|
37
|
+
kind: "oneapp-mmkv";
|
|
38
|
+
/** MMKV instance id (default `storage.core.mmkv`). */
|
|
39
|
+
instanceId?: string;
|
|
40
|
+
/** Keychain service holding the encryption key (default `engine.mmkv.encryption.key`). */
|
|
41
|
+
keychainService?: string;
|
|
42
|
+
/** Keychain account (default `-`). */
|
|
43
|
+
keychainAccount?: string;
|
|
44
|
+
/** iOS: read from this App Group container instead of `Documents/mmkv`. */
|
|
45
|
+
appGroup?: string;
|
|
46
|
+
/** Only these `woas.1.<ns>` namespaces (plus plain keys an explicit map rule names). */
|
|
47
|
+
namespaces?: string[];
|
|
48
|
+
}
|
|
49
|
+
/** What the bake adds to an `oneapp-mmkv` source with `namespaces`: the plain keys its map rules
|
|
50
|
+
* (or the `principal`) name (`plainKeys`) or match (`plainMatches`), which the native reader still yields. */
|
|
51
|
+
export interface BakedOneAppMmkvSource extends LegacyImportOneAppMmkvSource {
|
|
52
|
+
plainKeys?: string[];
|
|
53
|
+
plainMatches?: string[];
|
|
54
|
+
}
|
|
55
|
+
export declare const ONEAPP_MMKV_DEFAULTS: {
|
|
56
|
+
readonly instanceId: "storage.core.mmkv";
|
|
57
|
+
readonly keychainService: "engine.mmkv.encryption.key";
|
|
58
|
+
readonly keychainAccount: "-";
|
|
59
|
+
};
|
|
31
60
|
/** One legacy WebView origin's `localStorage` / `sessionStorage` (#4660). Reads a hidden WebView on
|
|
32
61
|
* the platform's default data store, loaded with `origin` as its base URL. One item, key
|
|
33
62
|
* `snapshot` (JSON `{ localStorage, sessionStorage }`); map it to the `webStorageSnapshot` sink.
|
|
@@ -38,7 +67,7 @@ export interface LegacyImportWebStorageSource {
|
|
|
38
67
|
/** `https://host[:port]` — scheme and authority only. */
|
|
39
68
|
origin: string;
|
|
40
69
|
}
|
|
41
|
-
export type LegacyImportSourceConfig = LegacyImportFilesSource | LegacyImportWebStorageSource;
|
|
70
|
+
export type LegacyImportSourceConfig = LegacyImportFilesSource | LegacyImportOneAppMmkvSource | LegacyImportWebStorageSource;
|
|
42
71
|
/** A well-formed web origin: http(s) scheme + host (+ port), no path, query or fragment. */
|
|
43
72
|
export declare function isWebOrigin(v: unknown): v is string;
|
|
44
73
|
/** How a `localDatabase` row gets its `id`:
|
|
@@ -162,3 +191,23 @@ export declare function ruleFor(cfg: Pick<LegacyImportConfig, "map">, sourceId:
|
|
|
162
191
|
/** The `keySuffix` of `key` under `rule`: the key minus the literal text before the first `*`
|
|
163
192
|
* (the whole key for a `key` rule), with a trailing `.ext` removed. */
|
|
164
193
|
export declare function keySuffix(rule: LegacyImportMapRule, key: string): string;
|
|
194
|
+
/** One item of a OneApp MMKV instance, as the source yields it. */
|
|
195
|
+
export interface OneAppMmkvItem {
|
|
196
|
+
key: string;
|
|
197
|
+
namespace?: string;
|
|
198
|
+
value: unknown;
|
|
199
|
+
meta?: {
|
|
200
|
+
lastUpdated?: number;
|
|
201
|
+
expirationTime?: number;
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
/** Reference item model the native readers mirror (iOS + Android): a module key
|
|
205
|
+
* `woas.1.<ns>.__global.<key>` holds JSON `{ value, meta }`; any other key is plain JSON, or — a
|
|
206
|
+
* value OneApp stored that is not JSON — the string itself. `"expired"` when a module item's
|
|
207
|
+
* `expirationTime` is before `nowMs` (the source skips and counts it); `null` when a module item's
|
|
208
|
+
* envelope is unreadable (skipped and counted `unreadable`). `fullKey` is what map rules match,
|
|
209
|
+
* never the shortened `key`. */
|
|
210
|
+
export declare function oneAppMmkvItem(fullKey: string, raw: string, nowMs: number): {
|
|
211
|
+
item: OneAppMmkvItem;
|
|
212
|
+
fullKey: string;
|
|
213
|
+
} | "expired" | null;
|
|
@@ -7444,10 +7444,15 @@ function gateScreenIdShapeProblem(id) {
|
|
|
7444
7444
|
}
|
|
7445
7445
|
|
|
7446
7446
|
// ../../core/ts/src/legacy-import.ts
|
|
7447
|
-
var LEGACY_IMPORT_SOURCE_KINDS = ["files", "web-storage"];
|
|
7447
|
+
var LEGACY_IMPORT_SOURCE_KINDS = ["files", "oneapp-mmkv", "web-storage"];
|
|
7448
7448
|
var LEGACY_IMPORT_SINKS = ["localDatabase", "state", "files", "report", "webStorageSnapshot", "installationId", "drop"];
|
|
7449
7449
|
var LEGACY_IMPORT_FILE_ROOTS = ["documents", "library", "caches", "files", "noBackup", "cache", "external"];
|
|
7450
7450
|
var LEGACY_IMPORT_ANDROID_FILE_ROOTS = ["files", "noBackup", "cache", "external"];
|
|
7451
|
+
var ONEAPP_MMKV_DEFAULTS = {
|
|
7452
|
+
instanceId: "storage.core.mmkv",
|
|
7453
|
+
keychainService: "engine.mmkv.encryption.key",
|
|
7454
|
+
keychainAccount: "-"
|
|
7455
|
+
};
|
|
7451
7456
|
function isWebOrigin(v) {
|
|
7452
7457
|
if (typeof v !== "string") return false;
|
|
7453
7458
|
try {
|
|
@@ -7501,6 +7506,7 @@ function legacyImportProblems(cfg, at = "legacyImport") {
|
|
|
7501
7506
|
if (!Array.isArray(cfg.sources) || cfg.sources.length === 0) {
|
|
7502
7507
|
out.push(`${at}.sources: must be a non-empty array`);
|
|
7503
7508
|
} else {
|
|
7509
|
+
const oneAppStores = /* @__PURE__ */ new Map(), oneAppKeys = /* @__PURE__ */ new Map();
|
|
7504
7510
|
cfg.sources.forEach((s, i) => {
|
|
7505
7511
|
const p = `${at}.sources[${i}]`;
|
|
7506
7512
|
if (!isObj(s)) {
|
|
@@ -7514,6 +7520,23 @@ function legacyImportProblems(cfg, at = "legacyImport") {
|
|
|
7514
7520
|
out.push(`${p}.kind: unknown source kind ${JSON.stringify(s.kind)} (known: ${LEGACY_IMPORT_SOURCE_KINDS.join(", ")})`);
|
|
7515
7521
|
return;
|
|
7516
7522
|
}
|
|
7523
|
+
if (s.kind === "oneapp-mmkv") {
|
|
7524
|
+
const store = `${typeof s.appGroup === "string" ? s.appGroup : ""}/${typeof s.instanceId === "string" ? s.instanceId : ONEAPP_MMKV_DEFAULTS.instanceId}`;
|
|
7525
|
+
const key = `${typeof s.keychainService === "string" ? s.keychainService : ONEAPP_MMKV_DEFAULTS.keychainService}/${typeof s.keychainAccount === "string" ? s.keychainAccount : ONEAPP_MMKV_DEFAULTS.keychainAccount}`;
|
|
7526
|
+
if (oneAppStores.has(store)) out.push(`${p}: reads the same MMKV store as ${oneAppStores.get(store)} \u2014 one oneapp-mmkv source per store (each deletes it)`);
|
|
7527
|
+
else oneAppStores.set(store, p);
|
|
7528
|
+
if (oneAppKeys.has(key)) out.push(`${p}: uses the same keychain key as ${oneAppKeys.get(key)} \u2014 one oneapp-mmkv source per key (each deletes it)`);
|
|
7529
|
+
else oneAppKeys.set(key, p);
|
|
7530
|
+
for (const f of ["instanceId", "keychainService", "keychainAccount", "appGroup"]) {
|
|
7531
|
+
if (s[f] !== void 0 && !nonEmpty(s[f])) out.push(`${p}.${f}: must be a non-empty string`);
|
|
7532
|
+
}
|
|
7533
|
+
if (nonEmpty(s.instanceId) && !/^[A-Za-z0-9_.-]+$/.test(s.instanceId)) out.push(`${p}.instanceId: must be a file-name-safe id (got ${JSON.stringify(s.instanceId)})`);
|
|
7534
|
+
if (nonEmpty(s.instanceId) && /^\.+$/.test(s.instanceId)) out.push(`${p}.instanceId: must not be "." or ".."`);
|
|
7535
|
+
if (s.namespaces !== void 0 && (!Array.isArray(s.namespaces) || s.namespaces.length === 0 || !s.namespaces.every((n) => nonEmpty(n) && !n.includes(".")))) {
|
|
7536
|
+
out.push(`${p}.namespaces: must be a non-empty array of namespace names without "." (got ${JSON.stringify(s.namespaces)})`);
|
|
7537
|
+
}
|
|
7538
|
+
return;
|
|
7539
|
+
}
|
|
7517
7540
|
if (s.kind === "web-storage") {
|
|
7518
7541
|
if (!isWebOrigin(s.origin)) out.push(`${p}.origin: must be an http(s) origin like "https://app.local" \u2014 no path, query or trailing slash (got ${JSON.stringify(s.origin)})`);
|
|
7519
7542
|
}
|
|
@@ -7606,7 +7629,19 @@ function bakeLegacyImport(cfg) {
|
|
|
7606
7629
|
const baked = {
|
|
7607
7630
|
version: 1,
|
|
7608
7631
|
id: cfg.id,
|
|
7609
|
-
sources: cfg.sources.map((s) =>
|
|
7632
|
+
sources: cfg.sources.map((s) => {
|
|
7633
|
+
if (s.kind !== "oneapp-mmkv" || !s.namespaces) return { ...s };
|
|
7634
|
+
const rules = cfg.map.filter((r) => r.from === s.id);
|
|
7635
|
+
const baked2 = { ...s, namespaces: [...s.namespaces] };
|
|
7636
|
+
const keys = [.../* @__PURE__ */ new Set([
|
|
7637
|
+
...rules.flatMap((r) => r.key !== void 0 ? [r.key] : []),
|
|
7638
|
+
...cfg.principal?.from === s.id ? [cfg.principal.key] : []
|
|
7639
|
+
])];
|
|
7640
|
+
const matches = rules.flatMap((r) => r.key === void 0 && r.match !== void 0 ? [r.match] : []);
|
|
7641
|
+
if (keys.length) baked2.plainKeys = keys;
|
|
7642
|
+
if (matches.length) baked2.plainMatches = matches;
|
|
7643
|
+
return baked2;
|
|
7644
|
+
}),
|
|
7610
7645
|
map: cfg.map.map((r) => ({ ...r, to: { ...r.to } })),
|
|
7611
7646
|
unmapped: cfg.unmapped,
|
|
7612
7647
|
retainDays: cfg.retainDays ?? LEGACY_IMPORT_DEFAULT_RETAIN_DAYS,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// ../../core/sdk/l10n/src/locale.ts
|
|
2
|
+
var SYSTEM_LOCALE = "system";
|
|
3
|
+
function host() {
|
|
4
|
+
const h = globalThis.himalaya;
|
|
5
|
+
if (!h || typeof h.dispatch !== "function") {
|
|
6
|
+
throw new Error("@himalaya/l10n/locale: called outside a Himalaya runtime (Tier-5 worker)");
|
|
7
|
+
}
|
|
8
|
+
const declared = Array.isArray(h.capabilities) ? h.capabilities : [];
|
|
9
|
+
if (!declared.includes("l10n")) throw new Error("capability not declared: l10n");
|
|
10
|
+
return h;
|
|
11
|
+
}
|
|
12
|
+
function decode(v) {
|
|
13
|
+
if (typeof v === "string") {
|
|
14
|
+
try {
|
|
15
|
+
v = JSON.parse(v);
|
|
16
|
+
} catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return v && typeof v === "object" ? v : null;
|
|
21
|
+
}
|
|
22
|
+
async function setLocale(tag) {
|
|
23
|
+
const h = host();
|
|
24
|
+
let raw;
|
|
25
|
+
try {
|
|
26
|
+
raw = await h.dispatch("locale.set", { tag: String(tag ?? "") });
|
|
27
|
+
} catch (e) {
|
|
28
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
29
|
+
return { ok: false, error: /unsupported_locale/.test(msg) ? "unsupported_locale" : msg };
|
|
30
|
+
}
|
|
31
|
+
const p = decode(raw);
|
|
32
|
+
if (p && typeof p.error === "string") return { ok: false, error: p.error };
|
|
33
|
+
return { ok: true, ...p && typeof p.tag === "string" ? { tag: p.tag } : {} };
|
|
34
|
+
}
|
|
35
|
+
async function getLocale() {
|
|
36
|
+
const p = decode(await host().dispatch("locale.get", {})) ?? {};
|
|
37
|
+
const source = p.source === "user" || p.source === "default" ? p.source : "device";
|
|
38
|
+
const available = Array.isArray(p.available) ? p.available.flatMap((a) => {
|
|
39
|
+
const r = decode(a);
|
|
40
|
+
if (!r || typeof r.tag !== "string") return [];
|
|
41
|
+
return [{
|
|
42
|
+
tag: r.tag,
|
|
43
|
+
nativeName: typeof r.nativeName === "string" ? r.nativeName : r.tag,
|
|
44
|
+
dir: r.dir === "rtl" ? "rtl" : "ltr"
|
|
45
|
+
}];
|
|
46
|
+
}) : [];
|
|
47
|
+
return { tag: typeof p.tag === "string" ? p.tag : "en", source, available };
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
SYSTEM_LOCALE,
|
|
51
|
+
getLocale,
|
|
52
|
+
setLocale
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=locale.mjs.map
|
|
@@ -150,6 +150,10 @@
|
|
|
150
150
|
"types": "./dist/_types/core/sdk/l10n/src/index.d.ts",
|
|
151
151
|
"import": "./dist/l10n.mjs"
|
|
152
152
|
},
|
|
153
|
+
"./l10n/locale": {
|
|
154
|
+
"types": "./dist/_types/core/sdk/l10n/src/locale.d.ts",
|
|
155
|
+
"import": "./dist/l10n/locale.mjs"
|
|
156
|
+
},
|
|
153
157
|
"./legacy-import": {
|
|
154
158
|
"types": "./dist/_types/core/sdk/legacy-import/src/index.d.ts",
|
|
155
159
|
"import": "./dist/legacy-import.mjs"
|