create-expo-updates-server 0.3.0 → 0.6.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/README.md +4 -2
- package/dist/template/Dockerfile +4 -6
- package/dist/template/README.md +5 -10
- package/dist/template/app/api/admin/device-favorites/route.test.ts +125 -0
- package/dist/template/app/api/admin/device-favorites/route.ts +91 -0
- package/dist/template/app/api/admin/distribution-history/restore/route.ts +39 -0
- package/dist/template/app/api/admin/distribution-history/route.test.ts +55 -0
- package/dist/template/app/api/admin/distribution-history/route.ts +24 -0
- package/dist/template/app/api/admin/updates/[encodedKey]/deactivate/route.ts +2 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/promote/route.ts +2 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/rollback/route.ts +2 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/route.ts +2 -1
- package/dist/template/app/api/admin/updates/route.test.ts +21 -0
- package/dist/template/app/api/admin/updates/route.ts +12 -1
- package/dist/template/app/globals.css +65 -68
- package/dist/template/app/login/page.tsx +66 -42
- package/dist/template/app/updates/[encodedKey]/page.tsx +382 -248
- package/dist/template/app/updates/devices/page.tsx +187 -145
- package/dist/template/app/updates/embedded/page.tsx +80 -34
- package/dist/template/app/updates/emergency-redirects/page.tsx +138 -71
- package/dist/template/app/updates/layout.tsx +2 -1
- package/dist/template/app/updates/page.tsx +385 -274
- package/dist/template/app/updates/releases.test.tsx +156 -0
- package/dist/template/components/admin/admin-role.ts +5 -0
- package/dist/template/components/admin/admin-shell.tsx +166 -95
- package/dist/template/components/admin/confirm-action.tsx +123 -0
- package/dist/template/components/admin/language-switcher.tsx +27 -16
- package/dist/template/components/admin/release-badges.test.tsx +50 -0
- package/dist/template/components/admin/release-badges.tsx +101 -0
- package/dist/template/components/ui/alert.tsx +10 -3
- package/dist/template/components/ui/avatar.tsx +108 -0
- package/dist/template/components/ui/badge.tsx +2 -2
- package/dist/template/components/ui/breadcrumb.tsx +108 -0
- package/dist/template/components/ui/button.tsx +5 -5
- package/dist/template/components/ui/card.tsx +2 -2
- package/dist/template/components/ui/chart.tsx +1 -1
- package/dist/template/components/ui/collapsible.tsx +7 -0
- package/dist/template/components/ui/dialog.tsx +13 -4
- package/dist/template/components/ui/empty.tsx +103 -0
- package/dist/template/components/ui/field.tsx +248 -0
- package/dist/template/components/ui/input-group.tsx +170 -0
- package/dist/template/components/ui/input.tsx +1 -1
- package/dist/template/components/ui/native-select.tsx +1 -1
- package/dist/template/components/ui/radio-group.tsx +41 -0
- package/dist/template/components/ui/sheet.tsx +6 -2
- package/dist/template/components/ui/sidebar.tsx +62 -17
- package/dist/template/components/ui/status-tones.ts +15 -0
- package/dist/template/components/ui/table.tsx +1 -1
- package/dist/template/components/ui/textarea.tsx +1 -1
- package/dist/template/docs/admin-ui.md +22 -24
- package/dist/template/docs/device-targeting.md +6 -12
- package/dist/template/docs/doctor.md +2 -2
- package/dist/template/docs/expo-app-setup.md +9 -27
- package/dist/template/docs/getting-started.md +3 -4
- package/dist/template/docs/getting-started.ru.md +11 -544
- package/dist/template/docs/index.md +1 -1
- package/dist/template/docs/installation-telemetry.md +6 -12
- package/dist/template/docs/migrations/2026-10-16-manifest-identity.sql +5 -0
- package/dist/template/docs/migrations/2026-11-25-device-favorites.sql +53 -0
- package/dist/template/docs/migrations/2026-11-25-download-on-postpone.sql +5 -0
- package/dist/template/docs/migrations/2026-11-25-public-distribution-history.sql +283 -0
- package/dist/template/docs/migrations/schema.sql +349 -0
- package/dist/template/docs/npm-installer.md +3 -3
- package/dist/template/docs/operations-guide.md +9 -7
- package/dist/template/docs/ota-client-lifecycle.md +30 -68
- package/dist/template/docs/ota-emergency-recovery.md +34 -57
- package/dist/template/docs/ota-update-policy.md +9 -20
- package/dist/template/docs/ru/admin-ui.md +33 -0
- package/dist/template/docs/ru/device-targeting.md +59 -0
- package/dist/template/docs/ru/doctor.md +98 -0
- package/dist/template/docs/ru/expo-app-setup.md +497 -0
- package/dist/template/docs/ru/getting-started.md +391 -0
- package/dist/template/docs/ru/index.md +50 -0
- package/dist/template/docs/ru/installation-telemetry.md +125 -0
- package/dist/template/docs/ru/npm-installer.md +71 -0
- package/dist/template/docs/ru/operations-guide.md +322 -0
- package/dist/template/docs/ru/ota-client-lifecycle.md +162 -0
- package/dist/template/docs/ru/ota-emergency-recovery.md +108 -0
- package/dist/template/docs/ru/ota-update-policy.md +69 -0
- package/dist/template/docs/ru/publishing-npm-installer.md +49 -0
- package/dist/template/docs/ru/supabase-setup.md +120 -0
- package/dist/template/docs/uk/admin-ui.md +33 -0
- package/dist/template/docs/uk/device-targeting.md +59 -0
- package/dist/template/docs/uk/doctor.md +98 -0
- package/dist/template/docs/uk/expo-app-setup.md +497 -0
- package/dist/template/docs/uk/getting-started.md +391 -0
- package/dist/template/docs/uk/index.md +50 -0
- package/dist/template/docs/uk/installation-telemetry.md +125 -0
- package/dist/template/docs/uk/npm-installer.md +71 -0
- package/dist/template/docs/uk/operations-guide.md +322 -0
- package/dist/template/docs/uk/ota-client-lifecycle.md +162 -0
- package/dist/template/docs/uk/ota-emergency-recovery.md +108 -0
- package/dist/template/docs/uk/ota-update-policy.md +69 -0
- package/dist/template/docs/uk/publishing-npm-installer.md +49 -0
- package/dist/template/docs/uk/supabase-setup.md +120 -0
- package/dist/template/lib/audience-ids.ts +4 -0
- package/dist/template/package-lock.json +46 -0
- package/dist/template/package.json +4 -1
- package/dist/template/scripts/configure-expo-app.mjs +3 -3
- package/dist/template/scripts/create-access-token.mjs +1 -1
- package/dist/template/scripts/lib/doctor.mjs +10 -7
- package/dist/template/scripts/lib/doctor.test.mjs +7 -5
- package/dist/template/scripts/lib/embedded-update-registrar.test.ts +22 -7
- package/dist/template/scripts/lib/expo-app-configurator.mjs +25 -22
- package/dist/template/scripts/lib/expo-app-configurator.test.ts +37 -2
- package/dist/template/scripts/lib/ota-client-configurator.mjs +152 -55
- package/dist/template/scripts/lib/ota-client-configurator.test.ts +60 -20
- package/dist/template/scripts/lib/ota-client-package.mjs +25 -0
- package/dist/template/scripts/lib/ota-root-hook-patcher.mjs +90 -32
- package/dist/template/scripts/lib/ota-root-hook-patcher.test.ts +49 -6
- package/dist/template/scripts/tests/device-analytics-migrations.mjs +12 -1
- package/dist/template/scripts/tests/device-targeting-activation.mjs +2 -3
- package/dist/template/scripts/tests/e2e/client-lifecycle.mjs +161 -0
- package/dist/template/scripts/tests/e2e/client-lifecycle.scenario.jsx +465 -0
- package/dist/template/scripts/tests/e2e/client-vitest.mts +18 -0
- package/dist/template/scripts/tests/e2e/console.mjs +86 -0
- package/dist/template/scripts/tests/e2e/delivery.mjs +296 -0
- package/dist/template/scripts/tests/e2e/device-favorites.mjs +309 -0
- package/dist/template/scripts/tests/e2e/installations.mjs +132 -0
- package/dist/template/scripts/tests/e2e/policy.mjs +253 -0
- package/dist/template/scripts/tests/e2e/registrar-token.mjs +59 -0
- package/dist/template/scripts/tests/e2e/release-matrix.mjs +307 -0
- package/dist/template/scripts/tests/e2e/releases.mjs +162 -0
- package/dist/template/scripts/tests/e2e/run.mjs +224 -0
- package/dist/template/scripts/tests/manifest-identity.sql +7 -5
- package/dist/template/scripts/tests/public-distribution-history.mjs +102 -0
- package/dist/template/src/client/admin-api.ts +45 -10
- package/dist/template/src/client/admin-types.ts +35 -1
- package/dist/template/src/client/devices/analytics.tsx +169 -219
- package/dist/template/src/client/devices/cohorts.tsx +181 -0
- package/dist/template/src/client/devices/device-name.tsx +37 -21
- package/dist/template/src/client/devices/favorite-targets.tsx +381 -0
- package/dist/template/src/client/devices/registry.tsx +265 -233
- package/dist/template/src/client/devices/use-devices-report.test.tsx +98 -0
- package/dist/template/src/client/devices/use-devices-report.ts +53 -82
- package/dist/template/src/client/devices/version-adoption-chart.tsx +48 -38
- package/dist/template/src/client/distribution-control.tsx +98 -53
- package/dist/template/src/client/distribution-history.tsx +353 -0
- package/dist/template/src/client/guard-action-catalog.tsx +183 -0
- package/dist/template/src/client/guard-action-combobox.test.ts +16 -22
- package/dist/template/src/client/guard-action-combobox.tsx +134 -234
- package/dist/template/src/client/guard-action-options.ts +4 -6
- package/dist/template/src/client/i18n/en.json +335 -2
- package/dist/template/src/client/i18n/language-switching.test.tsx +233 -0
- package/dist/template/src/client/i18n/messages.test.ts +102 -19
- package/dist/template/src/client/i18n/messages.ts +31 -16
- package/dist/template/src/client/i18n/provider.tsx +6 -3
- package/dist/template/src/client/i18n/ru.json +619 -0
- package/dist/template/src/client/i18n/uk.json +619 -0
- package/dist/template/src/client/i18n/use-formatters.ts +5 -0
- package/dist/template/src/client/logout-button.tsx +3 -3
- package/dist/template/src/client/policy-draft.ts +138 -0
- package/dist/template/src/client/update-audience-editor.tsx +597 -199
- package/dist/template/src/client/update-policy-editor.test.ts +101 -29
- package/dist/template/src/client/update-policy-editor.tsx +466 -307
- package/dist/template/src/client/use-filtered-results.ts +55 -0
- package/dist/template/src/server/controllers/manifest.test.ts +23 -3
- package/dist/template/src/server/controllers/manifest.ts +15 -1
- package/dist/template/src/server/devices/audience.ts +9 -5
- package/dist/template/src/server/lib/admin-audience-activation.test.ts +37 -90
- package/dist/template/src/server/lib/admin-release-history.test.ts +138 -0
- package/dist/template/src/server/lib/admin-updates.ts +160 -534
- package/dist/template/src/server/lib/distribution-history.ts +97 -0
- package/dist/template/src/server/lib/supabase.js +24 -0
- package/dist/template/src/server/lib/supabase.test.ts +38 -1
- package/dist/template/src/server/lib/update-policy.test.ts +20 -0
- package/dist/template/src/server/lib/update-policy.ts +23 -10
- package/dist/template/src/server/manifest/manifest-repository.ts +11 -3
- package/dist/template/src/server/manifest/manifest-values.test.ts +2 -0
- package/dist/template/src/server/manifest/manifest-values.ts +21 -13
- package/dist/template/templates/expo-app/scripts/ota-publish/api/database-client.mjs +7 -30
- package/dist/template/templates/expo-app/scripts/ota-register-embedded/index.mjs +2 -1
- package/dist/template/tsconfig.json +2 -2
- package/dist/template-manifest.json +571 -271
- package/package.json +1 -1
- package/dist/template/scripts/lib/device-identity.test.ts +0 -29
- package/dist/template/scripts/lib/ota-client.test.ts +0 -55
- package/dist/template/scripts/lib/ota-update-controller.test.ts +0 -232
- package/dist/template/scripts/lib/ota-updates-ui.test.tsx +0 -154
- package/dist/template/scripts/tests/ota-client-types.mjs +0 -69
- package/dist/template/templates/expo-app/ota-client/README.md +0 -73
- package/dist/template/templates/expo-app/ota-client/controller.ts +0 -107
- package/dist/template/templates/expo-app/ota-client/device-identity.ts +0 -48
- package/dist/template/templates/expo-app/ota-client/docs/update-lifecycle.md +0 -61
- package/dist/template/templates/expo-app/ota-client/index.ts +0 -16
- package/dist/template/templates/expo-app/ota-client/model/hooks/useOtaUpdates.ts +0 -97
- package/dist/template/templates/expo-app/ota-client/model/update-controller.ts +0 -293
- package/dist/template/templates/expo-app/ota-client/runtime.ts +0 -153
- package/dist/template/templates/expo-app/ota-client/types.ts +0 -85
- package/dist/template/templates/expo-app/ota-client/ui/ota-update-gate.tsx +0 -25
- package/dist/template/templates/expo-app/ota-client/ui/ota-updates.tsx +0 -196
|
@@ -14,6 +14,11 @@ export function useFormatters() {
|
|
|
14
14
|
month: "short",
|
|
15
15
|
timeZone: "UTC",
|
|
16
16
|
}).format(new Date(value)),
|
|
17
|
+
calendarDate: (value: string) =>
|
|
18
|
+
new Intl.DateTimeFormat(formatLocale, {
|
|
19
|
+
dateStyle: "medium",
|
|
20
|
+
timeZone: "UTC",
|
|
21
|
+
}).format(new Date(value)),
|
|
17
22
|
fullDate: (value: string | null) =>
|
|
18
23
|
value
|
|
19
24
|
? new Intl.DateTimeFormat(formatLocale, {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { Button } from "@/components/ui/button";
|
|
2
3
|
import { useI18n } from "@/src/client/i18n/provider";
|
|
3
4
|
|
|
4
5
|
import { adminLogout } from "@/src/client/admin-api";
|
|
@@ -21,13 +22,12 @@ export default function LogoutButton() {
|
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
return (
|
|
24
|
-
<
|
|
25
|
+
<Button variant="outline"
|
|
25
26
|
type="button"
|
|
26
27
|
onClick={handleLogout}
|
|
27
28
|
disabled={isLoading}
|
|
28
|
-
className="rounded-md border border-zinc-300 px-4 py-4 text-sm hover:bg-zinc-100 disabled:cursor-not-allowed disabled:opacity-60 dark:border-zinc-700 dark:hover:bg-zinc-900"
|
|
29
29
|
>
|
|
30
30
|
{isLoading ? t("Выход...") : t("Выйти")}
|
|
31
|
-
</
|
|
31
|
+
</Button>
|
|
32
32
|
);
|
|
33
33
|
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { UpdatePolicy, UpdatePolicyGuard } from "./admin-types";
|
|
2
|
+
|
|
3
|
+
export const behaviors = [
|
|
4
|
+
"manual",
|
|
5
|
+
"manual-postpone",
|
|
6
|
+
"background",
|
|
7
|
+
"required",
|
|
8
|
+
"immediate",
|
|
9
|
+
"store",
|
|
10
|
+
"custom",
|
|
11
|
+
] as const;
|
|
12
|
+
export type PolicyBehavior = (typeof behaviors)[number];
|
|
13
|
+
export type PolicyDraft = {
|
|
14
|
+
behavior: PolicyBehavior;
|
|
15
|
+
delivery: UpdatePolicy["delivery"];
|
|
16
|
+
action: string;
|
|
17
|
+
payload: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const required = "ota-force-update";
|
|
21
|
+
const store = "ota-force-store-update";
|
|
22
|
+
export const isBuiltInAction = (action: string) =>
|
|
23
|
+
action === required || action === store;
|
|
24
|
+
|
|
25
|
+
export function draftFromPolicy(
|
|
26
|
+
policy: Pick<UpdatePolicy, "delivery" | "guard">,
|
|
27
|
+
): PolicyDraft {
|
|
28
|
+
const { guard, delivery } = policy;
|
|
29
|
+
let behavior: PolicyBehavior = delivery;
|
|
30
|
+
if (guard) {
|
|
31
|
+
behavior =
|
|
32
|
+
guard.action === required
|
|
33
|
+
? delivery === "background"
|
|
34
|
+
? "immediate"
|
|
35
|
+
: "required"
|
|
36
|
+
: guard.action === store
|
|
37
|
+
? "store"
|
|
38
|
+
: "custom";
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
behavior,
|
|
42
|
+
delivery,
|
|
43
|
+
action: guard?.action ?? "",
|
|
44
|
+
payload:
|
|
45
|
+
guard?.payload == null ? "" : JSON.stringify(guard.payload, null, 2),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function isDeliveryProfile(
|
|
50
|
+
behavior: PolicyBehavior,
|
|
51
|
+
): behavior is UpdatePolicy["delivery"] {
|
|
52
|
+
return (
|
|
53
|
+
behavior === "manual" ||
|
|
54
|
+
behavior === "background" ||
|
|
55
|
+
behavior === "manual-postpone"
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function chooseBehavior(
|
|
60
|
+
current: PolicyDraft,
|
|
61
|
+
behavior: PolicyBehavior,
|
|
62
|
+
): PolicyDraft {
|
|
63
|
+
if (behavior === current.behavior) return current;
|
|
64
|
+
if (behavior === "required" || behavior === "immediate") {
|
|
65
|
+
return {
|
|
66
|
+
behavior,
|
|
67
|
+
delivery: behavior === "immediate" ? "background" : "manual",
|
|
68
|
+
action: required,
|
|
69
|
+
payload: current.action === required ? current.payload : "",
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (isDeliveryProfile(behavior))
|
|
73
|
+
return { behavior, delivery: behavior, action: "", payload: "" };
|
|
74
|
+
const delivery =
|
|
75
|
+
current.delivery === "manual-postpone" ? "manual" : current.delivery;
|
|
76
|
+
const action = behavior === "store" ? store : "";
|
|
77
|
+
return { behavior, delivery, action, payload: "" };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function policyFromDraft(
|
|
81
|
+
draft: PolicyDraft,
|
|
82
|
+
): Pick<UpdatePolicy, "delivery" | "guard"> {
|
|
83
|
+
let guard: UpdatePolicyGuard | null = null;
|
|
84
|
+
if (!isDeliveryProfile(draft.behavior)) {
|
|
85
|
+
if (!draft.action) throw new Error("Select or create a Guard action.");
|
|
86
|
+
try {
|
|
87
|
+
guard = {
|
|
88
|
+
action: draft.action,
|
|
89
|
+
...(draft.payload.trim() ? { payload: JSON.parse(draft.payload) } : {}),
|
|
90
|
+
};
|
|
91
|
+
} catch {
|
|
92
|
+
throw new Error("Guard payload must be valid JSON.");
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return { delivery: draft.delivery, guard };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Only offer structured inputs when editing a link can preserve every other field.
|
|
99
|
+
export function storePayloadObject(
|
|
100
|
+
payload: string,
|
|
101
|
+
): Record<string, unknown> | null {
|
|
102
|
+
try {
|
|
103
|
+
const value = payload.trim() ? JSON.parse(payload) : {};
|
|
104
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
105
|
+
return null;
|
|
106
|
+
return ["url", "iosUrl", "androidUrl"].every(
|
|
107
|
+
(key) => value[key] === undefined || typeof value[key] === "string",
|
|
108
|
+
)
|
|
109
|
+
? value
|
|
110
|
+
: null;
|
|
111
|
+
} catch {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function setStoreLink(
|
|
117
|
+
fields: Record<string, unknown>,
|
|
118
|
+
key: string,
|
|
119
|
+
value: string,
|
|
120
|
+
) {
|
|
121
|
+
const next = { ...fields };
|
|
122
|
+
if (value) next[key] = value;
|
|
123
|
+
else delete next[key];
|
|
124
|
+
return Object.keys(next).length ? JSON.stringify(next, null, 2) : "";
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function validStoreLink(payload: string, platform?: string): boolean {
|
|
128
|
+
try {
|
|
129
|
+
const fields = JSON.parse(payload);
|
|
130
|
+
if (!fields || typeof fields !== "object") return false;
|
|
131
|
+
const link = fields[(platform || "") + "Url"] || fields.url;
|
|
132
|
+
if (typeof link !== "string") return false;
|
|
133
|
+
const url = new URL(link);
|
|
134
|
+
return /^(https|market|itms-apps):\/\//i.test(link) && Boolean(url.host);
|
|
135
|
+
} catch {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
}
|