create-expo-updates-server 0.1.3 → 0.1.5
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/template/.env.docker.example +1 -0
- package/dist/template/.env.example +2 -0
- package/dist/template/README.md +16 -8
- package/dist/template/app/api/admin/distribution-control/route.test.ts +153 -0
- package/dist/template/app/api/admin/distribution-control/route.ts +111 -0
- package/dist/template/app/api/admin/embedded-updates/route.test.ts +36 -1
- package/dist/template/app/api/admin/guard-actions/[id]/route.test.ts +60 -0
- package/dist/template/app/api/admin/guard-actions/[id]/route.ts +32 -0
- package/dist/template/app/api/admin/guard-actions/route.test.ts +123 -0
- package/dist/template/app/api/admin/guard-actions/route.ts +66 -0
- package/dist/template/app/api/admin/updates/[encodedKey]/deactivate/route.ts +4 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/policy/route.test.ts +171 -0
- package/dist/template/app/api/admin/updates/[encodedKey]/policy/route.ts +75 -0
- package/dist/template/app/api/admin/updates/[encodedKey]/promote/route.ts +4 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/rollback/route.ts +4 -1
- package/dist/template/app/api/admin/updates/[encodedKey]/route.ts +4 -1
- package/dist/template/app/api/admin/updates/route.test.ts +29 -1
- package/dist/template/app/updates/[encodedKey]/page.tsx +74 -6
- package/dist/template/app/updates/embedded/page.tsx +6 -2
- package/dist/template/app/updates/page.tsx +28 -3
- package/dist/template/docs/expo-app-setup.md +14 -3
- package/dist/template/docs/getting-started.md +13 -7
- package/dist/template/docs/getting-started.ru.md +15 -7
- package/dist/template/docs/migrations/2026-09-01-app-version-columns.sql +23 -0
- package/dist/template/docs/migrations/2026-09-01-ota-update-policy.sql +108 -0
- package/dist/template/docs/migrations/2026-09-01-p1-guard-actions.sql +19 -0
- package/dist/template/docs/migrations/2026-09-01-p2-simplify-ota-guard-policy.sql +69 -0
- package/dist/template/docs/migrations/2026-09-01-policy-publication-correction.sql +44 -0
- package/dist/template/docs/migrations/2026-09-02-ota-distribution-control.sql +377 -0
- package/dist/template/docs/migrations/schema.sql +561 -2
- package/dist/template/docs/operations-guide.md +52 -1
- package/dist/template/docs/ota-emergency-recovery.md +22 -0
- package/dist/template/docs/ota-update-policy.md +89 -0
- package/dist/template/docs/supabase-setup.md +2 -1
- package/dist/template/package-lock.json +2 -2
- package/dist/template/package.json +1 -1
- package/dist/template/scripts/configure-expo-app.mjs +6 -0
- package/dist/template/scripts/lib/embedded-update-registrar.test.ts +383 -3
- package/dist/template/scripts/lib/expo-app-configurator.mjs +165 -9
- package/dist/template/scripts/lib/expo-app-configurator.test.ts +658 -9
- package/dist/template/src/client/admin-api.ts +80 -1
- package/dist/template/src/client/admin-types.ts +52 -2
- package/dist/template/src/client/distribution-control.tsx +231 -0
- package/dist/template/src/client/guard-action-combobox.test.ts +26 -0
- package/dist/template/src/client/guard-action-combobox.tsx +267 -0
- package/dist/template/src/client/guard-action-options.test.ts +62 -0
- package/dist/template/src/client/guard-action-options.ts +70 -0
- package/dist/template/src/client/update-policy-editor.test.ts +36 -0
- package/dist/template/src/client/update-policy-editor.tsx +436 -0
- package/dist/template/src/server/controllers/assets.test.ts +87 -0
- package/dist/template/src/server/controllers/assets.ts +26 -0
- package/dist/template/src/server/controllers/manifest.test.ts +413 -2
- package/dist/template/src/server/controllers/manifest.ts +103 -38
- package/dist/template/src/server/lib/admin-distribution-guard.test.ts +61 -0
- package/dist/template/src/server/lib/admin-embedded-updates.test.ts +57 -0
- package/dist/template/src/server/lib/admin-embedded-updates.ts +42 -25
- package/dist/template/src/server/lib/admin-update-policy.test.ts +176 -0
- package/dist/template/src/server/lib/admin-updates.test.ts +133 -0
- package/dist/template/src/server/lib/admin-updates.ts +174 -9
- package/dist/template/src/server/lib/distribution-control-migration.test.ts +94 -0
- package/dist/template/src/server/lib/distribution-control.test.ts +160 -0
- package/dist/template/src/server/lib/distribution-control.ts +250 -0
- package/dist/template/src/server/lib/guard-actions-migration.test.ts +56 -0
- package/dist/template/src/server/lib/guard-actions.test.ts +142 -0
- package/dist/template/src/server/lib/guard-actions.ts +106 -0
- package/dist/template/src/server/lib/ota-policy-migrations.test.ts +64 -0
- package/dist/template/src/server/lib/simple-policy-migration.test.ts +97 -0
- package/dist/template/src/server/lib/supabase.js +95 -8
- package/dist/template/src/server/lib/supabase.test.ts +194 -0
- package/dist/template/src/server/lib/update-policy.test.ts +98 -0
- package/dist/template/src/server/lib/update-policy.ts +171 -0
- package/dist/template/src/server/manifest/manifest-repository.ts +10 -1
- package/dist/template/src/server/manifest/manifest-response.ts +0 -16
- package/dist/template/src/server/manifest/manifest-values.test.ts +54 -0
- package/dist/template/src/server/manifest/manifest-values.ts +145 -0
- package/dist/template/templates/expo-app/ci_scripts/ci_post_xcodebuild.sh +23 -1
- package/dist/template/templates/expo-app/plugins/with-ota-embedded-registration.js +13 -4
- package/dist/template/templates/expo-app/scripts/ota-register-embedded/index.mjs +53 -7
- package/dist/template/templates/expo-app/scripts/ota-register-embedded/register-ios.sh +87 -0
- package/dist/template/tsconfig.json +4 -1
- package/dist/template-manifest.json +283 -88
- package/package.json +1 -1
- package/dist/template/templates/expo-app/ci_scripts/register-embedded-update.sh +0 -36
- /package/dist/template/templates/expo-app/scripts/ota-register-embedded/{android-register-embedded-update.sh → register-android.sh} +0 -0
|
@@ -10,6 +10,19 @@ const database = vi.hoisted(() => ({
|
|
|
10
10
|
servedManifests: [] as Row[],
|
|
11
11
|
emergencyRedirects: [] as Row[],
|
|
12
12
|
}));
|
|
13
|
+
const distributionControl = vi.hoisted(() => ({
|
|
14
|
+
blocked: false,
|
|
15
|
+
error: null as Error | null,
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
vi.mock("../lib/distribution-control", () => ({
|
|
19
|
+
isOtaDistributionBlocked: vi.fn(async () => {
|
|
20
|
+
if (distributionControl.error) {
|
|
21
|
+
throw distributionControl.error;
|
|
22
|
+
}
|
|
23
|
+
return distributionControl.blocked;
|
|
24
|
+
}),
|
|
25
|
+
}));
|
|
13
26
|
|
|
14
27
|
vi.mock("../lib/supabase.js", () => {
|
|
15
28
|
class Query {
|
|
@@ -26,6 +39,11 @@ vi.mock("../lib/supabase.js", () => {
|
|
|
26
39
|
return this;
|
|
27
40
|
}
|
|
28
41
|
|
|
42
|
+
is(column: string, value: unknown) {
|
|
43
|
+
this.filters.push({ column, value });
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
|
|
29
47
|
order() {
|
|
30
48
|
return this;
|
|
31
49
|
}
|
|
@@ -83,6 +101,11 @@ function makeUpdate(overrides: Row = {}): Row {
|
|
|
83
101
|
created_at_path: "2026-08-28T08-00-00.000Z",
|
|
84
102
|
storage_base_path: "1.0.0/android/production/update",
|
|
85
103
|
is_active: true,
|
|
104
|
+
delivery_mode: "manual",
|
|
105
|
+
guard_action: null,
|
|
106
|
+
guard_payload: null,
|
|
107
|
+
policy_version: 1,
|
|
108
|
+
policy_published_at: "2026-08-28T08:00:00.000Z",
|
|
86
109
|
manifest: {
|
|
87
110
|
runtimeVersion: "1.0.0",
|
|
88
111
|
assets: [
|
|
@@ -105,6 +128,7 @@ function makeUpdate(overrides: Row = {}): Row {
|
|
|
105
128
|
expoClient: {
|
|
106
129
|
name: "Example",
|
|
107
130
|
slug: "example",
|
|
131
|
+
version: "2.1.0",
|
|
108
132
|
},
|
|
109
133
|
},
|
|
110
134
|
},
|
|
@@ -137,6 +161,56 @@ describe("GET /api/manifest", () => {
|
|
|
137
161
|
database.embeddedUpdates = [];
|
|
138
162
|
database.servedManifests = [];
|
|
139
163
|
database.emergencyRedirects = [];
|
|
164
|
+
distributionControl.blocked = false;
|
|
165
|
+
distributionControl.error = null;
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it("returns signed noUpdateAvailable before redirect or update selection when globally blocked", async () => {
|
|
169
|
+
distributionControl.blocked = true;
|
|
170
|
+
vi.stubEnv(
|
|
171
|
+
"CODE_SIGNING_PRIVATE_KEY_PATH",
|
|
172
|
+
`${process.cwd()}/src/server/cert/codeSigningPrivateKey.pem`,
|
|
173
|
+
);
|
|
174
|
+
database.emergencyRedirects.push({
|
|
175
|
+
id: "redirect-id",
|
|
176
|
+
enabled: true,
|
|
177
|
+
embedded_update_id: previousUpdateId,
|
|
178
|
+
runtime_version: "1.0.0",
|
|
179
|
+
platform: "android",
|
|
180
|
+
from_channel: "production",
|
|
181
|
+
to_channel: "recovery",
|
|
182
|
+
target_mode: "follow",
|
|
183
|
+
});
|
|
184
|
+
database.channels.push({
|
|
185
|
+
runtime_version: "1.0.0",
|
|
186
|
+
channel: "recovery",
|
|
187
|
+
platform: "android",
|
|
188
|
+
latest_update_id: selectedUpdateId,
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
const response = await requestManifest(
|
|
192
|
+
makeRequest({
|
|
193
|
+
"expo-embedded-update-id": previousUpdateId,
|
|
194
|
+
"expo-expect-signature": "sig, keyid=main",
|
|
195
|
+
}),
|
|
196
|
+
);
|
|
197
|
+
const body = await response.text();
|
|
198
|
+
|
|
199
|
+
expect(response.status).toBe(200);
|
|
200
|
+
expect(body).toContain('{"type":"noUpdateAvailable"}');
|
|
201
|
+
expect(body).toContain('expo-signature: sig="');
|
|
202
|
+
expect(body).not.toContain(selectedUpdateId);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it("fails closed with noUpdateAvailable when global state cannot be read", async () => {
|
|
206
|
+
distributionControl.error = new Error("database unavailable");
|
|
207
|
+
|
|
208
|
+
const response = await requestManifest(makeRequest());
|
|
209
|
+
|
|
210
|
+
expect(response.status).toBe(200);
|
|
211
|
+
await expect(response.text()).resolves.toContain(
|
|
212
|
+
'{"type":"noUpdateAvailable"}',
|
|
213
|
+
);
|
|
140
214
|
});
|
|
141
215
|
|
|
142
216
|
it("rejects unsupported platforms", async () => {
|
|
@@ -161,6 +235,7 @@ describe("GET /api/manifest", () => {
|
|
|
161
235
|
});
|
|
162
236
|
|
|
163
237
|
it("returns the selected update as an Expo multipart manifest", async () => {
|
|
238
|
+
vi.stubEnv("OTA_CDN_BASE_URL", "https://storage-cdn.example.com");
|
|
164
239
|
database.channels.push({
|
|
165
240
|
latest_update_id: selectedUpdateId,
|
|
166
241
|
active_update_id: null,
|
|
@@ -194,12 +269,146 @@ describe("GET /api/manifest", () => {
|
|
|
194
269
|
expect(body).toContain(`"id":"${servedManifestId}"`);
|
|
195
270
|
expect(body).toContain('"createdAt":"2026-08-28T09:00:00.000Z"');
|
|
196
271
|
expect(body).toContain('"runtimeVersion":"1.0.0"');
|
|
272
|
+
expect(body).toContain(
|
|
273
|
+
'"updatePolicy":{"schemaVersion":1,"policyVersion":1,"delivery":"manual"}',
|
|
274
|
+
);
|
|
197
275
|
expect(body).toContain(
|
|
198
276
|
"https://updates.example.com/api/assets?runtimeVersion=1.0.0",
|
|
199
277
|
);
|
|
278
|
+
expect(body).not.toContain("storage-cdn.example.com");
|
|
200
279
|
expect(body).toContain('"key":"bundle-key"');
|
|
201
280
|
});
|
|
202
281
|
|
|
282
|
+
it("serves the configured unconditional Guard without mutating source", async () => {
|
|
283
|
+
database.channels.push({
|
|
284
|
+
latest_update_id: selectedUpdateId,
|
|
285
|
+
active_update_id: null,
|
|
286
|
+
active_changed_at: "2026-08-28T09:00:00.000Z",
|
|
287
|
+
served_manifest_id: servedManifestId,
|
|
288
|
+
served_manifest_changed_at: "2026-08-28T09:00:00.000Z",
|
|
289
|
+
runtime_version: "1.0.0",
|
|
290
|
+
channel: "production",
|
|
291
|
+
platform: "android",
|
|
292
|
+
});
|
|
293
|
+
const update = makeUpdate({
|
|
294
|
+
delivery_mode: "background",
|
|
295
|
+
policy_version: 7,
|
|
296
|
+
guard_action: "require-confirmation",
|
|
297
|
+
guard_payload: { message: "Ready" },
|
|
298
|
+
});
|
|
299
|
+
const sourceManifest = structuredClone(update.manifest);
|
|
300
|
+
database.updates.push(update);
|
|
301
|
+
|
|
302
|
+
const response = await requestManifest(makeRequest());
|
|
303
|
+
const body = await response.text();
|
|
304
|
+
|
|
305
|
+
expect(body).toContain(
|
|
306
|
+
'"updatePolicy":{"schemaVersion":1,"policyVersion":7,"delivery":"background","guard":{"action":"require-confirmation","payload":{"message":"Ready"}}}',
|
|
307
|
+
);
|
|
308
|
+
expect(update.manifest).toEqual(sourceManifest);
|
|
309
|
+
expect(
|
|
310
|
+
(update.manifest as Record<string, unknown>).extra,
|
|
311
|
+
).not.toHaveProperty("updatePolicy");
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
it("does not vary the configured Guard by request context", async () => {
|
|
315
|
+
database.channels.push({
|
|
316
|
+
latest_update_id: selectedUpdateId,
|
|
317
|
+
active_update_id: null,
|
|
318
|
+
active_changed_at: "2026-08-28T09:00:00.000Z",
|
|
319
|
+
served_manifest_id: servedManifestId,
|
|
320
|
+
served_manifest_changed_at: "2026-08-28T09:00:00.000Z",
|
|
321
|
+
runtime_version: "1.0.0",
|
|
322
|
+
channel: "production",
|
|
323
|
+
platform: "android",
|
|
324
|
+
});
|
|
325
|
+
database.updates.push(
|
|
326
|
+
makeUpdate({
|
|
327
|
+
guard_action: "unconditional-action",
|
|
328
|
+
}),
|
|
329
|
+
makeUpdate({
|
|
330
|
+
update_id: previousUpdateId,
|
|
331
|
+
build_id: previousUpdateId,
|
|
332
|
+
created_at: "2026-08-27T08:00:00.000Z",
|
|
333
|
+
}),
|
|
334
|
+
);
|
|
335
|
+
database.servedManifests.push({
|
|
336
|
+
served_manifest_id: previousServedManifestId,
|
|
337
|
+
update_id: previousUpdateId,
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
const body = await (
|
|
341
|
+
await requestManifest(
|
|
342
|
+
makeRequest({ "expo-current-update-id": previousServedManifestId }),
|
|
343
|
+
)
|
|
344
|
+
).text();
|
|
345
|
+
|
|
346
|
+
expect(body).toContain('"guard":{"action":"unconditional-action"}');
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
it("omits Guard when none is configured", async () => {
|
|
350
|
+
database.channels.push({
|
|
351
|
+
latest_update_id: selectedUpdateId,
|
|
352
|
+
active_update_id: null,
|
|
353
|
+
active_changed_at: "2026-08-28T09:00:00.000Z",
|
|
354
|
+
served_manifest_id: servedManifestId,
|
|
355
|
+
served_manifest_changed_at: "2026-08-28T09:00:00.000Z",
|
|
356
|
+
runtime_version: "1.0.0",
|
|
357
|
+
channel: "production",
|
|
358
|
+
platform: "android",
|
|
359
|
+
});
|
|
360
|
+
database.updates.push(
|
|
361
|
+
makeUpdate({
|
|
362
|
+
delivery_mode: "background",
|
|
363
|
+
policy_version: 2,
|
|
364
|
+
guard_action: null,
|
|
365
|
+
guard_payload: null,
|
|
366
|
+
}),
|
|
367
|
+
);
|
|
368
|
+
|
|
369
|
+
const body = await (await requestManifest(makeRequest())).text();
|
|
370
|
+
expect(body).toContain(
|
|
371
|
+
'"updatePolicy":{"schemaVersion":1,"policyVersion":2,"delivery":"background"}',
|
|
372
|
+
);
|
|
373
|
+
expect(body).not.toContain('"guard"');
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
it("logs corrupt persisted policy and continues with manual defaults", async () => {
|
|
377
|
+
database.channels.push({
|
|
378
|
+
latest_update_id: selectedUpdateId,
|
|
379
|
+
active_update_id: null,
|
|
380
|
+
active_changed_at: "2026-08-28T09:00:00.000Z",
|
|
381
|
+
served_manifest_id: servedManifestId,
|
|
382
|
+
served_manifest_changed_at: "2026-08-28T09:00:00.000Z",
|
|
383
|
+
runtime_version: "1.0.0",
|
|
384
|
+
channel: "production",
|
|
385
|
+
platform: "android",
|
|
386
|
+
});
|
|
387
|
+
database.updates.push(
|
|
388
|
+
makeUpdate({
|
|
389
|
+
delivery_mode: "background",
|
|
390
|
+
policy_version: 9,
|
|
391
|
+
guard_action: " invalid ",
|
|
392
|
+
guard_payload: null,
|
|
393
|
+
}),
|
|
394
|
+
);
|
|
395
|
+
const consoleError = vi
|
|
396
|
+
.spyOn(console, "error")
|
|
397
|
+
.mockImplementation(() => undefined);
|
|
398
|
+
|
|
399
|
+
const response = await requestManifest(makeRequest());
|
|
400
|
+
const body = await response.text();
|
|
401
|
+
|
|
402
|
+
expect(response.status).toBe(200);
|
|
403
|
+
expect(body).toContain(
|
|
404
|
+
'"updatePolicy":{"schemaVersion":1,"policyVersion":9,"delivery":"manual"}',
|
|
405
|
+
);
|
|
406
|
+
expect(consoleError).toHaveBeenCalledWith(
|
|
407
|
+
expect.stringContaining("Corrupt OTA update policy"),
|
|
408
|
+
);
|
|
409
|
+
consoleError.mockRestore();
|
|
410
|
+
});
|
|
411
|
+
|
|
203
412
|
it("returns no update when the device already runs the channel target", async () => {
|
|
204
413
|
database.channels.push({
|
|
205
414
|
latest_update_id: selectedUpdateId,
|
|
@@ -223,7 +432,203 @@ describe("GET /api/manifest", () => {
|
|
|
223
432
|
expect(body).not.toContain('"launchAsset"');
|
|
224
433
|
});
|
|
225
434
|
|
|
226
|
-
it("
|
|
435
|
+
it("trusts a newer registered app version when a cached APK rebuild reuses the embedded ID and stale timestamp", async () => {
|
|
436
|
+
const embeddedUpdateId = "55555555-5555-4555-8555-555555555555";
|
|
437
|
+
database.channels.push({
|
|
438
|
+
latest_update_id: selectedUpdateId,
|
|
439
|
+
active_update_id: null,
|
|
440
|
+
active_changed_at: "2026-08-28T09:00:00.000Z",
|
|
441
|
+
served_manifest_id: servedManifestId,
|
|
442
|
+
served_manifest_changed_at: "2026-08-28T09:00:00.000Z",
|
|
443
|
+
runtime_version: "1.1.20",
|
|
444
|
+
channel: "development",
|
|
445
|
+
platform: "android",
|
|
446
|
+
});
|
|
447
|
+
const candidateUpdate = makeUpdate({
|
|
448
|
+
runtime_version: "1.1.20",
|
|
449
|
+
channel: "development",
|
|
450
|
+
created_at: "2026-08-28T08:00:00.000Z",
|
|
451
|
+
});
|
|
452
|
+
(
|
|
453
|
+
candidateUpdate.manifest as {
|
|
454
|
+
extra: { expoClient: { version: string } };
|
|
455
|
+
}
|
|
456
|
+
).extra.expoClient.version = "1.7.10";
|
|
457
|
+
database.updates.push(candidateUpdate);
|
|
458
|
+
database.embeddedUpdates.push({
|
|
459
|
+
embedded_update_id: embeddedUpdateId,
|
|
460
|
+
app_version: "1.7.11",
|
|
461
|
+
created_at: "2026-08-27T08:00:00.000Z",
|
|
462
|
+
channel: "production",
|
|
463
|
+
platform: "android",
|
|
464
|
+
});
|
|
465
|
+
const consoleLog = vi
|
|
466
|
+
.spyOn(console, "log")
|
|
467
|
+
.mockImplementation(() => undefined);
|
|
468
|
+
|
|
469
|
+
const response = await requestManifest(
|
|
470
|
+
makeRequest({
|
|
471
|
+
"expo-runtime-version": "1.1.20",
|
|
472
|
+
"expo-channel-name": "development",
|
|
473
|
+
"expo-embedded-update-id": embeddedUpdateId,
|
|
474
|
+
}),
|
|
475
|
+
);
|
|
476
|
+
const body = await response.text();
|
|
477
|
+
|
|
478
|
+
expect(response.status).toBe(200);
|
|
479
|
+
expect(body).toContain('{"type":"noUpdateAvailable"}');
|
|
480
|
+
expect(body).not.toContain('"launchAsset"');
|
|
481
|
+
expect(consoleLog).toHaveBeenCalledWith(
|
|
482
|
+
expect.stringContaining("blockingReason=app-version"),
|
|
483
|
+
);
|
|
484
|
+
consoleLog.mockRestore();
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
it("derives a current OTA baseline app version from the manifest root", async () => {
|
|
488
|
+
database.channels.push({
|
|
489
|
+
latest_update_id: selectedUpdateId,
|
|
490
|
+
active_update_id: null,
|
|
491
|
+
active_changed_at: "2026-08-28T09:00:00.000Z",
|
|
492
|
+
served_manifest_id: servedManifestId,
|
|
493
|
+
served_manifest_changed_at: "2026-08-28T09:00:00.000Z",
|
|
494
|
+
runtime_version: "1.1.20",
|
|
495
|
+
channel: "production",
|
|
496
|
+
platform: "android",
|
|
497
|
+
});
|
|
498
|
+
database.updates.push(
|
|
499
|
+
makeUpdate({
|
|
500
|
+
runtime_version: "1.1.20",
|
|
501
|
+
manifest: {
|
|
502
|
+
expoClient: { version: "1.7.10" },
|
|
503
|
+
launchAsset: {
|
|
504
|
+
hash: "bundle-hash",
|
|
505
|
+
key: "bundle-key",
|
|
506
|
+
path: "bundles/android.js",
|
|
507
|
+
},
|
|
508
|
+
},
|
|
509
|
+
}),
|
|
510
|
+
makeUpdate({
|
|
511
|
+
update_id: previousUpdateId,
|
|
512
|
+
build_id: previousUpdateId,
|
|
513
|
+
runtime_version: "1.1.20",
|
|
514
|
+
channel: "beta",
|
|
515
|
+
created_at: "2026-08-27T08:00:00.000Z",
|
|
516
|
+
manifest: { expoClient: { version: "1.7.11" } },
|
|
517
|
+
}),
|
|
518
|
+
);
|
|
519
|
+
|
|
520
|
+
const body = await (
|
|
521
|
+
await requestManifest(
|
|
522
|
+
makeRequest({
|
|
523
|
+
"expo-runtime-version": "1.1.20",
|
|
524
|
+
"expo-current-update-id": previousUpdateId,
|
|
525
|
+
}),
|
|
526
|
+
)
|
|
527
|
+
).text();
|
|
528
|
+
|
|
529
|
+
expect(body).toContain('{"type":"noUpdateAvailable"}');
|
|
530
|
+
expect(body).not.toContain('"launchAsset"');
|
|
531
|
+
});
|
|
532
|
+
|
|
533
|
+
it.each([
|
|
534
|
+
["equal", "2.1.0"],
|
|
535
|
+
["unparseable", "release-two"],
|
|
536
|
+
["missing", null],
|
|
537
|
+
])(
|
|
538
|
+
"preserves timestamp protection when app versions are %s",
|
|
539
|
+
async (_case, appVersion) => {
|
|
540
|
+
const embeddedUpdateId = "66666666-6666-4666-8666-666666666666";
|
|
541
|
+
database.channels.push({
|
|
542
|
+
latest_update_id: selectedUpdateId,
|
|
543
|
+
active_update_id: null,
|
|
544
|
+
active_changed_at: "2026-08-28T09:00:00.000Z",
|
|
545
|
+
served_manifest_id: servedManifestId,
|
|
546
|
+
served_manifest_changed_at: "2026-08-28T09:00:00.000Z",
|
|
547
|
+
runtime_version: "1.0.0",
|
|
548
|
+
channel: "production",
|
|
549
|
+
platform: "android",
|
|
550
|
+
});
|
|
551
|
+
database.updates.push(makeUpdate());
|
|
552
|
+
database.embeddedUpdates.push({
|
|
553
|
+
embedded_update_id: embeddedUpdateId,
|
|
554
|
+
app_version: appVersion,
|
|
555
|
+
created_at: "2026-08-29T08:00:00.000Z",
|
|
556
|
+
channel: "production",
|
|
557
|
+
platform: "android",
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
const body = await (
|
|
561
|
+
await requestManifest(
|
|
562
|
+
makeRequest({ "expo-embedded-update-id": embeddedUpdateId }),
|
|
563
|
+
)
|
|
564
|
+
).text();
|
|
565
|
+
|
|
566
|
+
expect(body).toContain('{"type":"noUpdateAvailable"}');
|
|
567
|
+
expect(body).not.toContain('"launchAsset"');
|
|
568
|
+
},
|
|
569
|
+
);
|
|
570
|
+
|
|
571
|
+
it("serves selected app version 2.1.0 when installed 2.0.0 has a newer timestamp", async () => {
|
|
572
|
+
const embeddedUpdateId = "88888888-8888-4888-8888-888888888888";
|
|
573
|
+
database.channels.push({
|
|
574
|
+
latest_update_id: selectedUpdateId,
|
|
575
|
+
active_update_id: null,
|
|
576
|
+
active_changed_at: "2026-08-28T09:00:00.000Z",
|
|
577
|
+
served_manifest_id: servedManifestId,
|
|
578
|
+
served_manifest_changed_at: "2026-08-28T09:00:00.000Z",
|
|
579
|
+
runtime_version: "1.0.0",
|
|
580
|
+
channel: "production",
|
|
581
|
+
platform: "android",
|
|
582
|
+
});
|
|
583
|
+
database.updates.push(makeUpdate());
|
|
584
|
+
database.embeddedUpdates.push({
|
|
585
|
+
embedded_update_id: embeddedUpdateId,
|
|
586
|
+
app_version: "2.0.0",
|
|
587
|
+
created_at: "2026-08-29T08:00:00.000Z",
|
|
588
|
+
channel: "production",
|
|
589
|
+
platform: "android",
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
const body = await (
|
|
593
|
+
await requestManifest(
|
|
594
|
+
makeRequest({ "expo-embedded-update-id": embeddedUpdateId }),
|
|
595
|
+
)
|
|
596
|
+
).text();
|
|
597
|
+
|
|
598
|
+
expect(body).toContain('"launchAsset"');
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
it("does not apply version or date protection across platforms", async () => {
|
|
602
|
+
const embeddedUpdateId = "77777777-7777-4777-8777-777777777777";
|
|
603
|
+
database.channels.push({
|
|
604
|
+
latest_update_id: selectedUpdateId,
|
|
605
|
+
active_update_id: null,
|
|
606
|
+
active_changed_at: "2026-08-28T09:00:00.000Z",
|
|
607
|
+
served_manifest_id: servedManifestId,
|
|
608
|
+
served_manifest_changed_at: "2026-08-28T09:00:00.000Z",
|
|
609
|
+
runtime_version: "1.0.0",
|
|
610
|
+
channel: "production",
|
|
611
|
+
platform: "android",
|
|
612
|
+
});
|
|
613
|
+
database.updates.push(makeUpdate());
|
|
614
|
+
database.embeddedUpdates.push({
|
|
615
|
+
embedded_update_id: embeddedUpdateId,
|
|
616
|
+
app_version: "9.0.0",
|
|
617
|
+
created_at: "2026-08-29T08:00:00.000Z",
|
|
618
|
+
channel: "production",
|
|
619
|
+
platform: "ios",
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
const body = await (
|
|
623
|
+
await requestManifest(
|
|
624
|
+
makeRequest({ "expo-embedded-update-id": embeddedUpdateId }),
|
|
625
|
+
)
|
|
626
|
+
).text();
|
|
627
|
+
|
|
628
|
+
expect(body).toContain('"launchAsset"');
|
|
629
|
+
});
|
|
630
|
+
|
|
631
|
+
it("serves an older app version when rollback mode is enabled", async () => {
|
|
227
632
|
database.channels.push({
|
|
228
633
|
latest_update_id: selectedUpdateId,
|
|
229
634
|
active_update_id: previousUpdateId,
|
|
@@ -234,8 +639,14 @@ describe("GET /api/manifest", () => {
|
|
|
234
639
|
channel: "production",
|
|
235
640
|
platform: "android",
|
|
236
641
|
});
|
|
642
|
+
const latestUpdate = makeUpdate();
|
|
643
|
+
(
|
|
644
|
+
latestUpdate.manifest as {
|
|
645
|
+
extra: { expoClient: { version: string } };
|
|
646
|
+
}
|
|
647
|
+
).extra.expoClient.version = "2.2.0";
|
|
237
648
|
database.updates.push(
|
|
238
|
-
|
|
649
|
+
latestUpdate,
|
|
239
650
|
makeUpdate({
|
|
240
651
|
update_id: previousUpdateId,
|
|
241
652
|
build_id: previousUpdateId,
|