@hot-updater/test-utils 1.2.0-rc.50 → 1.2.0-rc.52

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 CHANGED
@@ -17,7 +17,7 @@ test executors of `@hot-updater/test-utils/node` take `pg`, `mysql2` or
17
17
 
18
18
  ## Database adapters and providers
19
19
 
20
- Register three suites against a disposable test database:
20
+ Register four suites against a disposable test database:
21
21
 
22
22
  - `setupDatabaseAdapterConformanceSuite` runs the database adapter contract case
23
23
  by case: value round-trips, ordering, guards, all-or-nothing writes, unique
@@ -28,6 +28,10 @@ Register three suites against a disposable test database:
28
28
  over `meterReads({ name, adapter: verifyAdapter(adapter) })` from
29
29
  `@hot-updater/plugin-core`. `postgresRowsExamined` and `mysqlRowsExamined`
30
30
  also count the rows a SQL database examined.
31
+ Register `setupReleaseLabelEngineTestSuite` beside it with the same options:
32
+ it writes releases as a server of an earlier release left them, without
33
+ labels, and checks the label fill, its catalog rebuilds, concurrent fills,
34
+ and the label index's uniqueness on your adapter.
31
35
  - `setupDatabaseTestSuite` runs core, Bundles and the Release Catalog contract
32
36
  through the admin and client HTTP APIs of `createHotUpdater`, then the suites
33
37
  of the server plugins listed in `plugins`, such as the Insights plugin's
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
+ import { AnyHotUpdaterPlugin, BundlePatchRow, BundleRow, ChannelRow, ClientAuth, DatabaseAdapter, DeployReleasePolicy, EngineDatabase, HotUpdaterCoreApi, HotUpdaterDatabase, KeyValueStore, ModuleSchema, PhysicalTable, PluginApis, ReadMeasurement, ReleaseRow, StorageAdapter, StorageOperation, createEngine } from "@hot-updater/plugin-core";
1
2
  import { ArtifactFiles, ArtifactInfo, Bundle } from "@hot-updater/protocol";
2
- import { AnyHotUpdaterPlugin, BundlePatchRow, BundleRow, ChannelRow, ClientAuth, DatabaseAdapter, DeployReleasePolicy, EngineDatabase, HotUpdaterCoreApi, HotUpdaterDatabase, KeyValueStore, ModuleSchema, PhysicalTable, PluginApis, ReadMeasurement, ReleaseRow, StorageAdapter, StorageOperation } from "@hot-updater/plugin-core";
3
3
  import { BundleEventRow, InsightsModel } from "@hot-updater/plugin-insights/server";
4
4
  //#region src/httpTestClient.d.ts
5
5
  type HttpTestRequestInit = NonNullable<ConstructorParameters<typeof Request>[1]>;
@@ -52,6 +52,16 @@ declare const createAdminApiTestClient: (getClient: () => HttpTestClient) => {
52
52
  };
53
53
  type AdminApiTestClient = ReturnType<typeof createAdminApiTestClient>;
54
54
  //#endregion
55
+ //#region src/catalogFromLaterRelease.d.ts
56
+ /** A field no release of Hot Updater compiles, as a later release may add one. */
57
+ declare const LATER_RELEASE_CATALOG_FIELD = "laterReleaseField";
58
+ /**
59
+ * Rewrites a scope's stored catalog as a later release would compile it: a
60
+ * field this release does not know on each release descriptor, with the
61
+ * payload's hash and size to match. Returns the payload it wrote.
62
+ */
63
+ declare const writeCatalogFromLaterRelease: (core: ReturnType<typeof createEngine>["core"], scopeKey: string) => Promise<string>;
64
+ //#endregion
55
65
  //#region src/setupBundleMethodsTestSuite.d.ts
56
66
  /**
57
67
  * Bundles through admin API protocol 2: deployed with a release, read by
@@ -73,6 +83,140 @@ declare const setupCoreAdminTestSuite: (options: {
73
83
  readonly getClient: () => HttpTestClient;
74
84
  }) => void;
75
85
  //#endregion
86
+ //#region src/sqlRowsExamined.d.ts
87
+ /**
88
+ * Rows a SQL database examined for the reads a database adapter made: what
89
+ * read-budget suites compare with the rows the adapter read.
90
+ */
91
+ interface RowsExamined {
92
+ /** Counts the reads from now on, and only those. */
93
+ reset(): void;
94
+ /** Rows examined for the reads since `reset`. */
95
+ total(): Promise<number>;
96
+ /** Rows the backend examines natively for each row it returns (default 1). */
97
+ readonly perRow?: number;
98
+ /** Rows the backend examines natively for each read beyond those (default 0). */
99
+ readonly perRead?: number;
100
+ }
101
+ /** A statement as the SQL core runs it. */
102
+ interface SqlStatementLike {
103
+ readonly sql: string;
104
+ readonly params: readonly unknown[];
105
+ }
106
+ /** A SQL core executor: its top-level `execute` runs the adapter's reads. */
107
+ interface SqlExecutorLike {
108
+ execute(statement: SqlStatementLike): Promise<unknown>;
109
+ }
110
+ /** Runs one statement on the session reads are explained on. */
111
+ type SqlQuery = (sql: string, params: readonly unknown[]) => Promise<readonly Record<string, unknown>[]>;
112
+ /**
113
+ * Rows examined on PostgreSQL (PGlite or a server). Each SELECT a wrapped
114
+ * executor runs is first run under `EXPLAIN (ANALYZE, FORMAT JSON)` on
115
+ * `query`, one session with the planner settings above; each `reset` first
116
+ * vacuums and analyzes, as autovacuum keeps a production database. A plan
117
+ * then takes the index path a production-sized table takes, and a read no
118
+ * index serves still scans. A statement counts the rows its busiest table
119
+ * read examined, so an exact plan counts the rows it returns, a multi-valued
120
+ * index's own table included.
121
+ */
122
+ declare const postgresRowsExamined: (query: SqlQuery) => {
123
+ /** The executor, examining each SELECT it runs outside a transaction. */
124
+ wrap: <T extends SqlExecutorLike>(executor: T) => T;
125
+ examined: {
126
+ reset(): void;
127
+ total(): Promise<number>;
128
+ };
129
+ };
130
+ /**
131
+ * Rows examined on MySQL. Each SELECT a wrapped executor runs is first run
132
+ * under `EXPLAIN ANALYZE` on `query`, one session, after `ANALYZE TABLE` of
133
+ * the tables it reads once per `reset`, and with multi-range reads always
134
+ * on, so a secondary index's range is costed with sorted row reads, as a
135
+ * production-sized table's is. A statement counts the rows its busiest table
136
+ * read examined; a filter above a table read drops rows that read produced.
137
+ */
138
+ declare const mysqlRowsExamined: (query: SqlQuery) => {
139
+ /** The executor, examining each SELECT it runs outside a transaction. */
140
+ wrap: <T extends SqlExecutorLike>(executor: T) => T;
141
+ examined: {
142
+ reset(): void;
143
+ total(): Promise<number>;
144
+ };
145
+ };
146
+ //#endregion
147
+ //#region src/setupReadBudgetTestSuite.d.ts
148
+ interface ReadBudgetAdapterContext {
149
+ /**
150
+ * Core's tables, those of the plugins the suite measures, and the settings
151
+ * table, where the retention passes keep their lease.
152
+ */
153
+ readonly tables: readonly PhysicalTable[];
154
+ /** Test-only: the adapter must fetch at most this many rows per native page. */
155
+ readonly nativePageSize: number;
156
+ }
157
+ interface ReadBudgetSuiteOptions {
158
+ readonly name: string;
159
+ /** Returns an adapter over freshly created, empty tables. */
160
+ readonly createAdapter: (context: ReadBudgetAdapterContext) => Promise<{
161
+ readonly adapter: DatabaseAdapter;
162
+ readonly cleanup?: () => Promise<void>;
163
+ /** SQL backends: the rows the database examined for the adapter's reads. */
164
+ readonly examined?: RowsExamined;
165
+ /**
166
+ * The rows each statement of the adapter's writes and prunes read, as D1
167
+ * bills them, since `reset`.
168
+ */
169
+ readonly written?: {
170
+ reset(): void;
171
+ rows(): Promise<readonly number[]>;
172
+ };
173
+ /**
174
+ * Index reads return row copies without `_v`, as the key-value adapter's
175
+ * do, so a transaction reads the rows it guards again, whole.
176
+ */
177
+ readonly indexCopies?: boolean;
178
+ }>;
179
+ }
180
+ /**
181
+ * The read-budget suite (PRD S4) on one backend: core and the server's
182
+ * built-in plugins on `createMeasuredDatabase` over the backend's adapter,
183
+ * native pages capped at two rows. Every API in the read-budget list reads
184
+ * exactly its budget at the adapter and at the engine; with `examined`, the
185
+ * database examines no more rows than the adapter read, within the backend's
186
+ * native multipliers. It loads `@hot-updater/server`, an optional peer.
187
+ */
188
+ declare const setupReadBudgetTestSuite: (options: ReadBudgetSuiteOptions) => void;
189
+ //#endregion
190
+ //#region src/setupReleaseLabelEngineTestSuite.d.ts
191
+ /** The backend under test, as `setupReadBudgetTestSuite` takes it. */
192
+ type ReleaseLabelEngineSuiteOptions = Pick<ReadBudgetSuiteOptions, "name" | "createAdapter">;
193
+ /**
194
+ * Release labels on a backend's own rows, which no HTTP API writes: the
195
+ * releases a server of an earlier release left without labels and without
196
+ * counters, which the fill labels per channel and platform in ID order,
197
+ * concurrent fills and a deploy included, rebuilding the catalogs compiled
198
+ * without them; and the label index, which refuses a second row with a label
199
+ * and holds any number without one. Rows are written as an earlier server
200
+ * wrote them through a second engine on the same adapter. It also writes a
201
+ * catalog as a later release compiles it, with a field this one does not
202
+ * know, which core verifies, never rewrites, and refuses to change. Register
203
+ * it beside `setupReadBudgetTestSuite`, with the same options.
204
+ */
205
+ declare const setupReleaseLabelEngineTestSuite: (options: ReleaseLabelEngineSuiteOptions) => void;
206
+ //#endregion
207
+ //#region src/setupReleaseLabelTestSuite.d.ts
208
+ /**
209
+ * Release labels through a provider's admin and client HTTP APIs: deploys
210
+ * take each channel and platform's next label, concurrent ones never the
211
+ * same, a promotion takes the target's next, a delete leaves a gap, the
212
+ * list, detail and label lookup answer it, and the scope's catalog serves
213
+ * it. The backfill and the label index's uniqueness, which need rows an
214
+ * earlier server wrote, are `setupReleaseLabelEngineTestSuite`'s.
215
+ */
216
+ declare const setupReleaseLabelTestSuite: (options: {
217
+ readonly getClient: () => HttpTestClient;
218
+ }) => void;
219
+ //#endregion
76
220
  //#region src/setupSemverSatisfiesTestSuite.d.ts
77
221
  /**
78
222
  *
@@ -212,110 +356,6 @@ interface StorageAdapterTestSuiteOptions {
212
356
  */
213
357
  declare const setupStorageAdapterTestSuite: (options: StorageAdapterTestSuiteOptions) => void;
214
358
  //#endregion
215
- //#region src/sqlRowsExamined.d.ts
216
- /**
217
- * Rows a SQL database examined for the reads a database adapter made: what
218
- * read-budget suites compare with the rows the adapter read.
219
- */
220
- interface RowsExamined {
221
- /** Counts the reads from now on, and only those. */
222
- reset(): void;
223
- /** Rows examined for the reads since `reset`. */
224
- total(): Promise<number>;
225
- /** Rows the backend examines natively for each row it returns (default 1). */
226
- readonly perRow?: number;
227
- /** Rows the backend examines natively for each read beyond those (default 0). */
228
- readonly perRead?: number;
229
- }
230
- /** A statement as the SQL core runs it. */
231
- interface SqlStatementLike {
232
- readonly sql: string;
233
- readonly params: readonly unknown[];
234
- }
235
- /** A SQL core executor: its top-level `execute` runs the adapter's reads. */
236
- interface SqlExecutorLike {
237
- execute(statement: SqlStatementLike): Promise<unknown>;
238
- }
239
- /** Runs one statement on the session reads are explained on. */
240
- type SqlQuery = (sql: string, params: readonly unknown[]) => Promise<readonly Record<string, unknown>[]>;
241
- /**
242
- * Rows examined on PostgreSQL (PGlite or a server). Each SELECT a wrapped
243
- * executor runs is first run under `EXPLAIN (ANALYZE, FORMAT JSON)` on
244
- * `query`, one session with the planner settings above; each `reset` first
245
- * vacuums and analyzes, as autovacuum keeps a production database. A plan
246
- * then takes the index path a production-sized table takes, and a read no
247
- * index serves still scans. A statement counts the rows its busiest table
248
- * read examined, so an exact plan counts the rows it returns, a multi-valued
249
- * index's own table included.
250
- */
251
- declare const postgresRowsExamined: (query: SqlQuery) => {
252
- /** The executor, examining each SELECT it runs outside a transaction. */
253
- wrap: <T extends SqlExecutorLike>(executor: T) => T;
254
- examined: {
255
- reset(): void;
256
- total(): Promise<number>;
257
- };
258
- };
259
- /**
260
- * Rows examined on MySQL. Each SELECT a wrapped executor runs is first run
261
- * under `EXPLAIN ANALYZE` on `query`, one session, after `ANALYZE TABLE` of
262
- * the tables it reads once per `reset`, and with multi-range reads always
263
- * on, so a secondary index's range is costed with sorted row reads, as a
264
- * production-sized table's is. A statement counts the rows its busiest table
265
- * read examined; a filter above a table read drops rows that read produced.
266
- */
267
- declare const mysqlRowsExamined: (query: SqlQuery) => {
268
- /** The executor, examining each SELECT it runs outside a transaction. */
269
- wrap: <T extends SqlExecutorLike>(executor: T) => T;
270
- examined: {
271
- reset(): void;
272
- total(): Promise<number>;
273
- };
274
- };
275
- //#endregion
276
- //#region src/setupReadBudgetTestSuite.d.ts
277
- interface ReadBudgetAdapterContext {
278
- /**
279
- * Core's tables, those of the plugins the suite measures, and the settings
280
- * table, where the retention passes keep their lease.
281
- */
282
- readonly tables: readonly PhysicalTable[];
283
- /** Test-only: the adapter must fetch at most this many rows per native page. */
284
- readonly nativePageSize: number;
285
- }
286
- interface ReadBudgetSuiteOptions {
287
- readonly name: string;
288
- /** Returns an adapter over freshly created, empty tables. */
289
- readonly createAdapter: (context: ReadBudgetAdapterContext) => Promise<{
290
- readonly adapter: DatabaseAdapter;
291
- readonly cleanup?: () => Promise<void>;
292
- /** SQL backends: the rows the database examined for the adapter's reads. */
293
- readonly examined?: RowsExamined;
294
- /**
295
- * The rows each statement of the adapter's writes and prunes read, as D1
296
- * bills them, since `reset`.
297
- */
298
- readonly written?: {
299
- reset(): void;
300
- rows(): Promise<readonly number[]>;
301
- };
302
- /**
303
- * Index reads return row copies without `_v`, as the key-value adapter's
304
- * do, so a transaction reads the rows it guards again, whole.
305
- */
306
- readonly indexCopies?: boolean;
307
- }>;
308
- }
309
- /**
310
- * The read-budget suite (PRD S4) on one backend: core and the server's
311
- * built-in plugins on `createMeasuredDatabase` over the backend's adapter,
312
- * native pages capped at two rows. Every API in the read-budget list reads
313
- * exactly its budget at the adapter and at the engine; with `examined`, the
314
- * database examines no more rows than the adapter read, within the backend's
315
- * native multipliers. It loads `@hot-updater/server`, an optional peer.
316
- */
317
- declare const setupReadBudgetTestSuite: (options: ReadBudgetSuiteOptions) => void;
318
- //#endregion
319
359
  //#region src/setupAggregateBatchingTestSuite.d.ts
320
360
  interface AggregateBatchingSuiteOptions {
321
361
  readonly name: string;
@@ -546,4 +586,4 @@ declare const RELEASE_CATALOG_STORAGE_FIXTURES: Readonly<Record<string, string>>
546
586
  /** Storage boundary shared by provider and separately spawned server tests. */
547
587
  declare const createReleaseCatalogTestStorage: () => StorageAdapter;
548
588
  //#endregion
549
- export { AdminApiTestClient, AggregateBatchingSuiteOptions, ContentionOptions, ContentionReport, DatabaseAdapterConformanceContext, DatabaseAdapterConformanceOptions, DatabasePluginTestSuite, type DatabaseTestLifecycle, DatabaseTestSuiteOptions, HttpTestClient, HttpTestHandlers, HttpTestRequest, HttpTestRequestInit, HttpTestServer, MeasuredDatabase, MeasuredDatabaseOptions, MeasuredDatabaseStorage, MemoryKeyValueStoreOptions, PluginTestHarnessOptions, RELEASE_CATALOG_DOWNLOAD_HASH, RELEASE_CATALOG_MANIFEST_URIS, RELEASE_CATALOG_STORAGE_FIXTURES, ReadBudgetAdapterContext, ReadBudgetSuiteOptions, RowsExamined, SqlExecutorLike, SqlQuery, SqlStatementLike, StorageAdapterTestSuiteOptions, conformanceCounters, conformanceExpiring, conformanceItems, createAdminApiTestClient, createBundleEventRowFixture, createBundleFixture, createBundlePatchRowFixture, createBundleRowFixture, createChannelRowFixture, createHandlerHttpTestClient, createHttpTestClient, createMeasuredDatabase, createMemoryKeyValueStore, createPluginTestHarness, createReleaseCatalogTestStorage, createReleaseRowFixture, expectInsightsIndex, insightsTestSuite, jsonRequest, mysqlRowsExamined, postgresRowsExamined, releaseCatalogArtifact, releaseCatalogArtifactFiles, releaseCatalogDownloadUrl, runContentionHarness, setupAggregateBatchingTestSuite, setupBundleMethodsTestSuite, setupCoreAdminTestSuite, setupDatabaseAdapterConformanceSuite, setupDatabaseTestSuite, setupInsightsHttpTestSuite, setupInsightsModelTestSuite, setupReadBudgetTestSuite, setupReleaseCatalogTestSuite, setupSemverSatisfiesTestSuite, setupStorageAdapterTestSuite, startHttpTestServer, storeBundles, toDeployBundle, withAdapterLatency };
589
+ export { AdminApiTestClient, AggregateBatchingSuiteOptions, ContentionOptions, ContentionReport, DatabaseAdapterConformanceContext, DatabaseAdapterConformanceOptions, DatabasePluginTestSuite, type DatabaseTestLifecycle, DatabaseTestSuiteOptions, HttpTestClient, HttpTestHandlers, HttpTestRequest, HttpTestRequestInit, HttpTestServer, LATER_RELEASE_CATALOG_FIELD, MeasuredDatabase, MeasuredDatabaseOptions, MeasuredDatabaseStorage, MemoryKeyValueStoreOptions, PluginTestHarnessOptions, RELEASE_CATALOG_DOWNLOAD_HASH, RELEASE_CATALOG_MANIFEST_URIS, RELEASE_CATALOG_STORAGE_FIXTURES, ReadBudgetAdapterContext, ReadBudgetSuiteOptions, ReleaseLabelEngineSuiteOptions, RowsExamined, SqlExecutorLike, SqlQuery, SqlStatementLike, StorageAdapterTestSuiteOptions, conformanceCounters, conformanceExpiring, conformanceItems, createAdminApiTestClient, createBundleEventRowFixture, createBundleFixture, createBundlePatchRowFixture, createBundleRowFixture, createChannelRowFixture, createHandlerHttpTestClient, createHttpTestClient, createMeasuredDatabase, createMemoryKeyValueStore, createPluginTestHarness, createReleaseCatalogTestStorage, createReleaseRowFixture, expectInsightsIndex, insightsTestSuite, jsonRequest, mysqlRowsExamined, postgresRowsExamined, releaseCatalogArtifact, releaseCatalogArtifactFiles, releaseCatalogDownloadUrl, runContentionHarness, setupAggregateBatchingTestSuite, setupBundleMethodsTestSuite, setupCoreAdminTestSuite, setupDatabaseAdapterConformanceSuite, setupDatabaseTestSuite, setupInsightsHttpTestSuite, setupInsightsModelTestSuite, setupReadBudgetTestSuite, setupReleaseCatalogTestSuite, setupReleaseLabelEngineTestSuite, setupReleaseLabelTestSuite, setupSemverSatisfiesTestSuite, setupStorageAdapterTestSuite, startHttpTestServer, storeBundles, toDeployBundle, withAdapterLatency, writeCatalogFromLaterRelease };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
2
+ import { DATABASE_VERSION_COLUMN, DatabaseAdapterContractError, DatabaseConstraintError, SETTINGS_TABLE, addDistinct, aggregateBatchingTables, assertStorageOperations, bundleToPatchRows, bundleToRow, compareUtf8, coreSchema, countDistinct, createBundleStorageKey, createEngine, createMemoryAdapter, createStorageKeyBuilder, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, findPhysicalIndex, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, indexOrderColumns, meterReads, parseStorageUri, targetBaseCandidateKey, toolingTargetOf, verifyAdapter } from "@hot-updater/plugin-core";
2
3
  import { NIL_UUID, createReleaseCatalogScopeKey, encodeChannelKey, selectDesiredRelease } from "@hot-updater/protocol";
3
- import { DATABASE_VERSION_COLUMN, DatabaseAdapterContractError, SETTINGS_TABLE, addDistinct, aggregateBatchingTables, assertStorageOperations, bundleToPatchRows, bundleToRow, compareUtf8, coreSchema, countDistinct, createBundleStorageKey, createEngine, createMemoryAdapter, createStorageKeyBuilder, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, findPhysicalIndex, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, indexOrderColumns, meterReads, parseStorageUri, targetBaseCandidateKey, toolingTargetOf, verifyAdapter } from "@hot-updater/plugin-core";
4
4
  import { createServer } from "node:http";
5
5
  //#region src/adminApiTestClient.ts
6
6
  const jsonRequest = (method, body) => ({
@@ -79,6 +79,43 @@ const createAdminApiTestClient = (getClient) => {
79
79
  };
80
80
  };
81
81
  //#endregion
82
+ //#region src/catalogFromLaterRelease.ts
83
+ /** A field no release of Hot Updater compiles, as a later release may add one. */
84
+ const LATER_RELEASE_CATALOG_FIELD = "laterReleaseField";
85
+ const sha256 = async (value) => {
86
+ const digest = await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(value));
87
+ return `sha256:${[...new Uint8Array(digest)].map((byte) => byte.toString(16).padStart(2, "0")).join("")}`;
88
+ };
89
+ const canonical = (value) => {
90
+ if (value === null || typeof value !== "object") return JSON.stringify(value);
91
+ if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
92
+ const record = value;
93
+ return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${canonical(record[key])}`).join(",")}}`;
94
+ };
95
+ /**
96
+ * Rewrites a scope's stored catalog as a later release would compile it: a
97
+ * field this release does not know on each release descriptor, with the
98
+ * payload's hash and size to match. Returns the payload it wrote.
99
+ */
100
+ const writeCatalogFromLaterRelease = async (core, scopeKey) => core.transaction(async (tx) => {
101
+ const row = await tx.findOne("release_catalogs", { scope_key: scopeKey });
102
+ if (row === null) throw new Error(`No catalog for ${scopeKey}.`);
103
+ const parsed = JSON.parse(row.payload);
104
+ const payload = canonical({
105
+ ...parsed,
106
+ releaseDescriptors: parsed.releaseDescriptors.map((descriptor) => ({
107
+ ...descriptor,
108
+ [LATER_RELEASE_CATALOG_FIELD]: `for ${String(descriptor.releaseId)}`
109
+ }))
110
+ });
111
+ tx.update("release_catalogs", row, {
112
+ payload,
113
+ catalog_hash: await sha256(payload),
114
+ byte_size: new TextEncoder().encode(payload).byteLength
115
+ });
116
+ return payload;
117
+ });
118
+ //#endregion
82
119
  //#region src/databaseTestFixtures.ts
83
120
  const fixtureId$1 = (suffix) => `00000000-0000-7000-8000-${suffix.padStart(12, "0")}`;
84
121
  const channelFixtureSuffix = (name) => {
@@ -128,7 +165,8 @@ const createReleaseRowFixture = (suffix, bundle, channel) => ({
128
165
  source_release_id: null,
129
166
  revision: 1,
130
167
  created_at_ms: Number(suffix),
131
- updated_at_ms: Number(suffix)
168
+ updated_at_ms: Number(suffix),
169
+ label: null
132
170
  });
133
171
  const createBundleFixture = (suffix, _channel = "production") => ({
134
172
  id: fixtureId$1(suffix),
@@ -969,6 +1007,384 @@ const setupCoreAdminTestSuite = (options) => {
969
1007
  });
970
1008
  };
971
1009
  //#endregion
1010
+ //#region src/createMeasuredDatabase.ts
1011
+ const storageOf = (storage) => ({
1012
+ name: "measuredStorage",
1013
+ protocol: "storage",
1014
+ get: async ({ storageUri }) => {
1015
+ const text = await storage.readStorageText?.(storageUri) ?? null;
1016
+ return { response: text === null ? null : new Response(text) };
1017
+ },
1018
+ getDownloadUrl: async ({ storageUri }) => ({ url: await storage.resolveFileUrl(storageUri) })
1019
+ });
1020
+ /**
1021
+ * Core and the plugins over `adapter` as `createHotUpdater` runs them: what
1022
+ * read-budget suites measure. The database is `meterReads` over
1023
+ * `verifyAdapter(adapter)`, so every adapter call is checked against the
1024
+ * contract and `measureReads` reports each call's reads; the adapter runs
1025
+ * as given, without the schema fence. It loads `@hot-updater/server`, an
1026
+ * optional peer, when called.
1027
+ */
1028
+ const createMeasuredDatabase = async (adapter, plugins, options = {}) => {
1029
+ const { createHotUpdater } = await import("@hot-updater/server");
1030
+ let clientAuth;
1031
+ const observed = plugins.map((plugin) => Object.defineProperties({}, {
1032
+ ...Object.getOwnPropertyDescriptors(plugin),
1033
+ init: {
1034
+ configurable: true,
1035
+ enumerable: true,
1036
+ writable: true,
1037
+ value: (context) => {
1038
+ const instance = plugin.init(options.now === void 0 ? context : {
1039
+ ...context,
1040
+ now: options.now
1041
+ });
1042
+ if (instance.clientAuth !== void 0) clientAuth = instance.clientAuth;
1043
+ return instance;
1044
+ }
1045
+ }
1046
+ }));
1047
+ const database = meterReads({
1048
+ name: "measured",
1049
+ adapter: verifyAdapter(adapter)
1050
+ });
1051
+ const hotUpdater = createHotUpdater({
1052
+ database,
1053
+ storage: options.storage === void 0 ? {
1054
+ name: "measuredStorage",
1055
+ protocol: "none"
1056
+ } : storageOf(options.storage),
1057
+ plugins: observed,
1058
+ ...plugins.some((plugin) => plugin.provides?.clientAuth === true) ? {} : { clientAccess: "public" }
1059
+ });
1060
+ return {
1061
+ core: hotUpdater.core,
1062
+ api: hotUpdater.api,
1063
+ ...clientAuth === void 0 ? {} : { clientAuth },
1064
+ measureReads: database.measureReads
1065
+ };
1066
+ };
1067
+ //#endregion
1068
+ //#region src/setupReleaseLabelEngineTestSuite.ts
1069
+ const NATIVE_PAGE_SIZE$1 = 2;
1070
+ /**
1071
+ * Release labels on a backend's own rows, which no HTTP API writes: the
1072
+ * releases a server of an earlier release left without labels and without
1073
+ * counters, which the fill labels per channel and platform in ID order,
1074
+ * concurrent fills and a deploy included, rebuilding the catalogs compiled
1075
+ * without them; and the label index, which refuses a second row with a label
1076
+ * and holds any number without one. Rows are written as an earlier server
1077
+ * wrote them through a second engine on the same adapter. It also writes a
1078
+ * catalog as a later release compiles it, with a field this one does not
1079
+ * know, which core verifies, never rewrites, and refuses to change. Register
1080
+ * it beside `setupReadBudgetTestSuite`, with the same options.
1081
+ */
1082
+ const setupReleaseLabelEngineTestSuite = (options) => {
1083
+ describe(`${options.name} release labels`, () => {
1084
+ let created;
1085
+ let core;
1086
+ let raw;
1087
+ beforeAll(async () => {
1088
+ created = await options.createAdapter({
1089
+ tables: [...toolingTargetOf([]).schema.tables, SETTINGS_TABLE],
1090
+ nativePageSize: NATIVE_PAGE_SIZE$1
1091
+ });
1092
+ ({core} = await createMeasuredDatabase(created.adapter, []));
1093
+ raw = createEngine({
1094
+ name: "raw",
1095
+ adapter: created.adapter
1096
+ }).core;
1097
+ }, 18e4);
1098
+ afterAll(async () => {
1099
+ await created?.cleanup?.();
1100
+ }, 6e4);
1101
+ let suffix = 0;
1102
+ let namespace = 0;
1103
+ const channel = (name) => `${name}-${namespace}`;
1104
+ const deploy = async (name, { platform = "ios", fingerprintHash = null } = {}) => {
1105
+ suffix += 1;
1106
+ const deployment = {
1107
+ bundle: {
1108
+ ...createBundleFixture(String(9e3 + suffix)),
1109
+ platform
1110
+ },
1111
+ release: {
1112
+ channel: channel(name),
1113
+ enabled: true,
1114
+ fingerprintHash,
1115
+ message: null,
1116
+ shouldForceUpdate: false,
1117
+ targetAppVersion: fingerprintHash === null ? "1.0.x" : null
1118
+ }
1119
+ };
1120
+ const [result] = await core.deploy([deployment]);
1121
+ return result.release;
1122
+ };
1123
+ /** Takes the labels off `releases` and drops their pairs' counters, as an earlier server left them. */
1124
+ const asBeforeLabels = async (releases) => {
1125
+ await raw.transaction(async (tx) => {
1126
+ const counters = /* @__PURE__ */ new Set();
1127
+ for (const { id } of releases) {
1128
+ const row = await tx.findOne("releases", { id });
1129
+ tx.update("releases", row, { label: null });
1130
+ counters.add(`releases/${row.platform}/${row.channel_id}`);
1131
+ }
1132
+ for (const id of counters) {
1133
+ const counter = await tx.findOne("label_sequences", { id });
1134
+ if (counter !== null) await tx.delete("label_sequences", counter);
1135
+ }
1136
+ });
1137
+ };
1138
+ const labelOf = async (id) => (await core.getRelease(id))?.label;
1139
+ it("labels releases an earlier server wrote in ID order per channel and platform, rebuilds their catalogs, and a deploy then takes the next", async () => {
1140
+ namespace += 1;
1141
+ const releases = [
1142
+ await deploy("fill"),
1143
+ await deploy("fill", { fingerprintHash: "fp-a" }),
1144
+ await deploy("fill"),
1145
+ await deploy("fill", { platform: "android" }),
1146
+ await deploy("fill", { fingerprintHash: "fp-b" })
1147
+ ];
1148
+ await asBeforeLabels(releases);
1149
+ for (const scope of new Set(releases.map((row) => row.scope_key))) await core.rebuildReleaseCatalog(scope);
1150
+ await expect(core.fillReleaseLabels({ dryRun: true })).resolves.toEqual({
1151
+ releases: 5,
1152
+ catalogs: 0
1153
+ });
1154
+ await expect(core.fillReleaseLabels()).resolves.toEqual({
1155
+ releases: 5,
1156
+ catalogs: 4
1157
+ });
1158
+ const inIdOrder = (rows) => rows.map(({ id }) => id).sort();
1159
+ const ios = inIdOrder(releases.filter(({ platform }) => platform === "ios"));
1160
+ const labels = {};
1161
+ for (const { id } of releases) labels[id] = await labelOf(id);
1162
+ expect(labels).toEqual({
1163
+ ...Object.fromEntries(ios.map((id, index) => [id, index + 1])),
1164
+ [releases[3].id]: 1
1165
+ });
1166
+ const served = JSON.parse((await core.getReleaseCatalogRow(releases[0].scope_key)).payload).releaseDescriptors;
1167
+ expect(Object.fromEntries(served.map(({ releaseId, label }) => [releaseId, label]))).toEqual({
1168
+ [releases[0].id]: labels[releases[0].id],
1169
+ [releases[2].id]: labels[releases[2].id]
1170
+ });
1171
+ await expect(core.fillReleaseLabels({ dryRun: true })).resolves.toEqual({
1172
+ releases: 0,
1173
+ catalogs: 0
1174
+ });
1175
+ await expect(deploy("fill")).resolves.toMatchObject({ label: 5 });
1176
+ });
1177
+ it("verifies a catalog a later release compiled with a field this one doesn't know, and refuses to rewrite it without that field", async () => {
1178
+ namespace += 1;
1179
+ const first = await deploy("later");
1180
+ await deploy("later");
1181
+ const scopeKey = first.scope_key;
1182
+ const payload = await writeCatalogFromLaterRelease(raw, scopeKey);
1183
+ const counter = async () => (await raw.findOne("label_sequences", { id: `releases/ios/${first.channel_id}` })).last_label;
1184
+ const before = await counter();
1185
+ const stored = async () => await core.getReleaseCatalogRow(scopeKey);
1186
+ const generation = (await stored()).generation;
1187
+ await expect(core.preflightReleaseCatalogRebuild(scopeKey)).resolves.toMatchObject({
1188
+ changed: false,
1189
+ labelsOnly: false
1190
+ });
1191
+ await expect(core.rebuildReleaseCatalog(scopeKey)).resolves.toMatchObject({ changed: false });
1192
+ await expect(core.fillReleaseLabels()).resolves.toMatchObject({ catalogs: 0 });
1193
+ const refusal = {
1194
+ code: "CATALOG_FROM_LATER_RELEASE",
1195
+ message: "The ios release catalog of channel \"later-" + String(namespace) + "\" was written by a later Hot Updater.\nUpgrade hot-updater, then try again."
1196
+ };
1197
+ await expect(deploy("later")).rejects.toMatchObject(refusal);
1198
+ await expect(core.updateReleasePolicy({
1199
+ releaseId: first.id,
1200
+ patch: { message: "changed" }
1201
+ })).rejects.toMatchObject(refusal);
1202
+ await expect(core.preflightReleasePolicy({
1203
+ releaseId: first.id,
1204
+ patch: { message: "changed" }
1205
+ })).rejects.toMatchObject(refusal);
1206
+ expect(await stored()).toMatchObject({
1207
+ generation,
1208
+ payload
1209
+ });
1210
+ expect(payload).toContain(LATER_RELEASE_CATALOG_FIELD);
1211
+ expect(await counter()).toBe(before);
1212
+ await expect(core.listReleases({
1213
+ filter: {
1214
+ kind: "scope",
1215
+ scopeKey
1216
+ },
1217
+ limit: 10
1218
+ })).resolves.toHaveLength(2);
1219
+ expect((await core.getRelease(first.id))?.message).toBeNull();
1220
+ });
1221
+ it("labels each release once when fills run beside a deploy that needs one", async () => {
1222
+ namespace += 1;
1223
+ const releases = [];
1224
+ for (let index = 0; index < 5; index += 1) releases.push(await deploy("race"));
1225
+ await asBeforeLabels(releases);
1226
+ const [, , deployed] = await Promise.all([
1227
+ core.fillReleaseLabels(),
1228
+ core.fillReleaseLabels(),
1229
+ deploy("race")
1230
+ ]);
1231
+ const labels = {};
1232
+ for (const { id } of releases) labels[id] = await labelOf(id);
1233
+ expect(labels).toEqual(Object.fromEntries(releases.map(({ id }) => id).sort().map((id, index) => [id, index + 1])));
1234
+ expect(deployed.label).toBe(6);
1235
+ });
1236
+ it("refuses a second release with a label in its channel and platform, and holds any number without one", async () => {
1237
+ namespace += 1;
1238
+ const releases = [
1239
+ await deploy("unique"),
1240
+ await deploy("unique"),
1241
+ await deploy("unique")
1242
+ ];
1243
+ const set = (id, label) => raw.transaction(async (tx) => {
1244
+ const row = await tx.findOne("releases", { id });
1245
+ tx.update("releases", row, { label });
1246
+ });
1247
+ await set(releases[0].id, null);
1248
+ await set(releases[1].id, null);
1249
+ await expect(set(releases[2].id, 2)).resolves.toBeUndefined();
1250
+ await expect(set(releases[0].id, 2)).rejects.toBeInstanceOf(DatabaseConstraintError);
1251
+ const other = await deploy("unique-other");
1252
+ expect(other.label).toBe(1);
1253
+ await expect(set(other.id, 2)).resolves.toBeUndefined();
1254
+ await set(other.id, 1);
1255
+ await set(releases[2].id, 3);
1256
+ await set(releases[1].id, 2);
1257
+ await set(releases[0].id, 1);
1258
+ await expect(core.getReleaseByLabel({
1259
+ channel: channel("unique"),
1260
+ platform: "ios",
1261
+ label: 3
1262
+ })).resolves.toMatchObject({ id: releases[2].id });
1263
+ });
1264
+ });
1265
+ };
1266
+ //#endregion
1267
+ //#region src/setupReleaseLabelTestSuite.ts
1268
+ /**
1269
+ * Release labels through a provider's admin and client HTTP APIs: deploys
1270
+ * take each channel and platform's next label, concurrent ones never the
1271
+ * same, a promotion takes the target's next, a delete leaves a gap, the
1272
+ * list, detail and label lookup answer it, and the scope's catalog serves
1273
+ * it. The backfill and the label index's uniqueness, which need rows an
1274
+ * earlier server wrote, are `setupReleaseLabelEngineTestSuite`'s.
1275
+ */
1276
+ const setupReleaseLabelTestSuite = (options) => {
1277
+ describe("Release labels", () => {
1278
+ const api = createAdminApiTestClient(options.getClient);
1279
+ const { adminJson } = api;
1280
+ let namespace;
1281
+ beforeEach(() => {
1282
+ namespace = crypto.randomUUID();
1283
+ });
1284
+ afterEach(async () => {
1285
+ await api.cleanup();
1286
+ });
1287
+ const bundleRow = (suffix) => ({
1288
+ ...createBundleRowFixture(suffix),
1289
+ id: `${namespace.slice(0, 8)}-0000-7000-8000-${suffix.padStart(12, "0")}`
1290
+ });
1291
+ const channel = (name = "labels") => `${name}-${namespace}`;
1292
+ const deploy = (suffix, { fingerprintHash = null, platform = "ios", channelName = channel() } = {}) => api.deploy({
1293
+ bundle: {
1294
+ ...toDeployBundle(bundleRow(suffix)),
1295
+ platform
1296
+ },
1297
+ release: {
1298
+ channel: channelName,
1299
+ enabled: true,
1300
+ fingerprintHash,
1301
+ message: null,
1302
+ shouldForceUpdate: false,
1303
+ targetAppVersion: fingerprintHash === null ? "1.0.x" : null
1304
+ }
1305
+ });
1306
+ const byLabel = async (label, { platform = "ios", channelName = channel() } = {}) => (await adminJson(`/release-labels?channel=${encodeURIComponent(channelName)}&platform=${platform}&label=${label}`)).data;
1307
+ const detail = async (id) => (await adminJson(`/releases/${encodeURIComponent(id)}`)).data;
1308
+ it("labels each channel and platform's deploys in order, and answers the label in the list, the detail and the lookup", async () => {
1309
+ const first = await deploy("1");
1310
+ const second = await deploy("2");
1311
+ const android = await deploy("3", { platform: "android" });
1312
+ expect([
1313
+ first.label,
1314
+ second.label,
1315
+ android.label
1316
+ ]).toEqual([
1317
+ 1,
1318
+ 2,
1319
+ 1
1320
+ ]);
1321
+ const { data: listed } = await adminJson(`/releases?channelId=${encodeURIComponent(first.channel_id)}&platform=ios&limit=10`);
1322
+ expect(Object.fromEntries(listed.map(({ id, label }) => [id, label]))).toEqual({
1323
+ [first.id]: 1,
1324
+ [second.id]: 2
1325
+ });
1326
+ await expect(detail(second.id)).resolves.toMatchObject({ label: 2 });
1327
+ await expect(byLabel(2)).resolves.toMatchObject({
1328
+ id: second.id,
1329
+ label: 2
1330
+ });
1331
+ await expect(byLabel(1, { platform: "android" })).resolves.toMatchObject({ id: android.id });
1332
+ await expect(byLabel(3)).resolves.toBeNull();
1333
+ });
1334
+ it("never gives concurrent deploys one label", async () => {
1335
+ await deploy("10");
1336
+ const releases = await Promise.all([
1337
+ "11",
1338
+ "12",
1339
+ "13",
1340
+ "14"
1341
+ ].map((suffix) => deploy(suffix, { fingerprintHash: `fingerprint-${suffix}` })));
1342
+ expect(releases.map(({ label }) => label).sort()).toEqual([
1343
+ 2,
1344
+ 3,
1345
+ 4,
1346
+ 5
1347
+ ]);
1348
+ });
1349
+ it("keeps a label through disable and enable, leaves a gap on delete, and gives a promotion the target's next label", async () => {
1350
+ const first = await deploy("21");
1351
+ const second = await deploy("22");
1352
+ await adminJson(`/releases/${encodeURIComponent(first.id)}`, jsonRequest("PATCH", { patch: { enabled: false } }));
1353
+ await adminJson(`/releases/${encodeURIComponent(first.id)}`, jsonRequest("PATCH", { patch: { enabled: true } }));
1354
+ await expect(detail(first.id)).resolves.toMatchObject({ label: 1 });
1355
+ await api.removeRelease(second.id);
1356
+ api.forget(second.id);
1357
+ await expect(deploy("23")).resolves.toMatchObject({ label: 3 });
1358
+ await deploy("24", { channelName: channel("target") });
1359
+ const { data: promoted } = await adminJson(`/releases/${encodeURIComponent(first.id)}/promote`, jsonRequest("POST", {
1360
+ targetChannel: channel("target"),
1361
+ action: "copy"
1362
+ }));
1363
+ api.track(promoted.target.release.id);
1364
+ expect(promoted.target.release).toMatchObject({ label: 2 });
1365
+ await expect(detail(first.id)).resolves.toMatchObject({ label: 1 });
1366
+ });
1367
+ it("serves each release's label in its scope's catalog", async () => {
1368
+ const first = await deploy("31");
1369
+ const second = await deploy("32");
1370
+ const response = await options.getClient().client(`/release-catalogs/app-version/ios/${encodeChannelKey(channel())}/1.0.0`);
1371
+ expect(response.status).toBe(200);
1372
+ const catalog = await response.json();
1373
+ expect(Object.fromEntries(catalog.releases.map(({ releaseId, label }) => [releaseId, label]))).toEqual({
1374
+ [first.id]: 1,
1375
+ [second.id]: 2
1376
+ });
1377
+ });
1378
+ it("has nothing to fill on a database whose releases all have labels", async () => {
1379
+ await deploy("41");
1380
+ await expect(adminJson("/release-labels/fill", jsonRequest("POST", { dryRun: true }))).resolves.toEqual({ data: {
1381
+ releases: 0,
1382
+ catalogs: 0
1383
+ } });
1384
+ });
1385
+ });
1386
+ };
1387
+ //#endregion
972
1388
  //#region src/setupSemverSatisfiesTestSuite.ts
973
1389
  /**
974
1390
  *
@@ -1974,6 +2390,7 @@ const setupDatabaseTestSuite = (options) => {
1974
2390
  setupCoreAdminTestSuite({ getClient });
1975
2391
  setupBundleMethodsTestSuite({ getClient });
1976
2392
  setupReleaseCatalogTestSuite({ getClient });
2393
+ setupReleaseLabelTestSuite({ getClient });
1977
2394
  for (const suite of options.plugins ?? []) describe(suite.name, () => {
1978
2395
  suite.register({
1979
2396
  getClient,
@@ -3443,64 +3860,6 @@ const setupStorageAdapterTestSuite = (options) => {
3443
3860
  });
3444
3861
  };
3445
3862
  //#endregion
3446
- //#region src/createMeasuredDatabase.ts
3447
- const storageOf = (storage) => ({
3448
- name: "measuredStorage",
3449
- protocol: "storage",
3450
- get: async ({ storageUri }) => {
3451
- const text = await storage.readStorageText?.(storageUri) ?? null;
3452
- return { response: text === null ? null : new Response(text) };
3453
- },
3454
- getDownloadUrl: async ({ storageUri }) => ({ url: await storage.resolveFileUrl(storageUri) })
3455
- });
3456
- /**
3457
- * Core and the plugins over `adapter` as `createHotUpdater` runs them: what
3458
- * read-budget suites measure. The database is `meterReads` over
3459
- * `verifyAdapter(adapter)`, so every adapter call is checked against the
3460
- * contract and `measureReads` reports each call's reads; the adapter runs
3461
- * as given, without the schema fence. It loads `@hot-updater/server`, an
3462
- * optional peer, when called.
3463
- */
3464
- const createMeasuredDatabase = async (adapter, plugins, options = {}) => {
3465
- const { createHotUpdater } = await import("@hot-updater/server");
3466
- let clientAuth;
3467
- const observed = plugins.map((plugin) => Object.defineProperties({}, {
3468
- ...Object.getOwnPropertyDescriptors(plugin),
3469
- init: {
3470
- configurable: true,
3471
- enumerable: true,
3472
- writable: true,
3473
- value: (context) => {
3474
- const instance = plugin.init(options.now === void 0 ? context : {
3475
- ...context,
3476
- now: options.now
3477
- });
3478
- if (instance.clientAuth !== void 0) clientAuth = instance.clientAuth;
3479
- return instance;
3480
- }
3481
- }
3482
- }));
3483
- const database = meterReads({
3484
- name: "measured",
3485
- adapter: verifyAdapter(adapter)
3486
- });
3487
- const hotUpdater = createHotUpdater({
3488
- database,
3489
- storage: options.storage === void 0 ? {
3490
- name: "measuredStorage",
3491
- protocol: "none"
3492
- } : storageOf(options.storage),
3493
- plugins: observed,
3494
- ...plugins.some((plugin) => plugin.provides?.clientAuth === true) ? {} : { clientAccess: "public" }
3495
- });
3496
- return {
3497
- core: hotUpdater.core,
3498
- api: hotUpdater.api,
3499
- ...clientAuth === void 0 ? {} : { clientAuth },
3500
- measureReads: database.measureReads
3501
- };
3502
- };
3503
- //#endregion
3504
3863
  //#region src/setupReadBudgetTestSuite.ts
3505
3864
  /** A published template: a greeting that beta devices get another value of. */
3506
3865
  const remoteConfigTemplate = (greeting) => ({
@@ -4571,13 +4930,27 @@ const READ_BUDGETS = [
4571
4930
  bundle: bundleOf("107"),
4572
4931
  release: production
4573
4932
  }]),
4574
- adapter: (copies) => reads(copies ? 5 : 3, copies ? 8 : 3, 3, 6),
4933
+ adapter: (copies) => reads(copies ? 6 : 4, copies ? 9 : 4, 3, 6),
4575
4934
  engine: {
4576
- calls: 6,
4577
- rows: 9
4935
+ calls: 7,
4936
+ rows: 10
4578
4937
  },
4579
4938
  writes: 1
4580
4939
  }),
4940
+ budget({
4941
+ api: "release by label: its unique index, then the release",
4942
+ read: ({ core }) => core.getReleaseByLabel({
4943
+ channel: "production",
4944
+ platform: "ios",
4945
+ label: 2
4946
+ }),
4947
+ adapter: reads(1, 1, 1, 1),
4948
+ engine: {
4949
+ calls: 2,
4950
+ rows: 2
4951
+ },
4952
+ check: (release) => expect(release).toMatchObject({ label: 2 })
4953
+ }),
4581
4954
  budget({
4582
4955
  api: "channel insert: 1 write, after the name's read finds nothing",
4583
4956
  read: ({ core }) => core.ensureChannel("read-budgets"),
@@ -4589,11 +4962,11 @@ const READ_BUDGETS = [
4589
4962
  writes: 1
4590
4963
  }),
4591
4964
  budget({
4592
- api: "channel delete: the channel, its native builds under it, and 1 write",
4965
+ api: "channel delete: the channel, its native builds under it, its label counters, and 1 write",
4593
4966
  read: ({ core, nightlyId }) => core.deleteChannel(nightlyId),
4594
- adapter: reads(2, 2, 1, 0),
4967
+ adapter: reads(4, 4, 1, 0),
4595
4968
  engine: {
4596
- calls: 3,
4969
+ calls: 5,
4597
4970
  rows: 2
4598
4971
  },
4599
4972
  writes: 1,
@@ -6771,4 +7144,4 @@ async function startHttpTestServer(handlers) {
6771
7144
  };
6772
7145
  }
6773
7146
  //#endregion
6774
- export { RELEASE_CATALOG_DOWNLOAD_HASH, RELEASE_CATALOG_MANIFEST_URIS, RELEASE_CATALOG_STORAGE_FIXTURES, conformanceCounters, conformanceExpiring, conformanceItems, createAdminApiTestClient, createBundleEventRowFixture, createBundleFixture, createBundlePatchRowFixture, createBundleRowFixture, createChannelRowFixture, createHandlerHttpTestClient, createHttpTestClient, createMeasuredDatabase, createMemoryKeyValueStore, createPluginTestHarness, createReleaseCatalogTestStorage, createReleaseRowFixture, expectInsightsIndex, insightsTestSuite, jsonRequest, mysqlRowsExamined, postgresRowsExamined, releaseCatalogArtifact, releaseCatalogArtifactFiles, releaseCatalogDownloadUrl, runContentionHarness, setupAggregateBatchingTestSuite, setupBundleMethodsTestSuite, setupCoreAdminTestSuite, setupDatabaseAdapterConformanceSuite, setupDatabaseTestSuite, setupInsightsHttpTestSuite, setupInsightsModelTestSuite, setupReadBudgetTestSuite, setupReleaseCatalogTestSuite, setupSemverSatisfiesTestSuite, setupStorageAdapterTestSuite, startHttpTestServer, storeBundles, toDeployBundle, withAdapterLatency };
7147
+ export { LATER_RELEASE_CATALOG_FIELD, RELEASE_CATALOG_DOWNLOAD_HASH, RELEASE_CATALOG_MANIFEST_URIS, RELEASE_CATALOG_STORAGE_FIXTURES, conformanceCounters, conformanceExpiring, conformanceItems, createAdminApiTestClient, createBundleEventRowFixture, createBundleFixture, createBundlePatchRowFixture, createBundleRowFixture, createChannelRowFixture, createHandlerHttpTestClient, createHttpTestClient, createMeasuredDatabase, createMemoryKeyValueStore, createPluginTestHarness, createReleaseCatalogTestStorage, createReleaseRowFixture, expectInsightsIndex, insightsTestSuite, jsonRequest, mysqlRowsExamined, postgresRowsExamined, releaseCatalogArtifact, releaseCatalogArtifactFiles, releaseCatalogDownloadUrl, runContentionHarness, setupAggregateBatchingTestSuite, setupBundleMethodsTestSuite, setupCoreAdminTestSuite, setupDatabaseAdapterConformanceSuite, setupDatabaseTestSuite, setupInsightsHttpTestSuite, setupInsightsModelTestSuite, setupReadBudgetTestSuite, setupReleaseCatalogTestSuite, setupReleaseLabelEngineTestSuite, setupReleaseLabelTestSuite, setupSemverSatisfiesTestSuite, setupStorageAdapterTestSuite, startHttpTestServer, storeBundles, toDeployBundle, withAdapterLatency, writeCatalogFromLaterRelease };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/test-utils",
3
- "version": "1.2.0-rc.50",
3
+ "version": "1.2.0-rc.52",
4
4
  "type": "module",
5
5
  "description": "Test utilities for Hot Updater packages",
6
6
  "sideEffects": false,
@@ -50,10 +50,10 @@
50
50
  "mysql2": "*",
51
51
  "pg": "*",
52
52
  "vitest": "^4.0.0",
53
- "@hot-updater/plugin-insights": "^1.2.0-rc.50",
54
- "@hot-updater/protocol": "^1.2.0-rc.50",
55
- "@hot-updater/plugin-core": "^1.2.0-rc.50",
56
- "@hot-updater/server": "^1.2.0-rc.50"
53
+ "@hot-updater/plugin-insights": "^1.2.0-rc.52",
54
+ "@hot-updater/protocol": "^1.2.0-rc.52",
55
+ "@hot-updater/plugin-core": "^1.2.0-rc.52",
56
+ "@hot-updater/server": "^1.2.0-rc.52"
57
57
  },
58
58
  "peerDependenciesMeta": {
59
59
  "@electric-sql/pglite": {
@@ -84,10 +84,10 @@
84
84
  "typescript": "npm:@typescript/typescript6@6.0.2",
85
85
  "vitest": "4.1.4",
86
86
  "workspace-tools": "^0.42.3",
87
- "@hot-updater/protocol": "1.2.0-rc.50",
88
- "@hot-updater/plugin-insights": "1.2.0-rc.50",
89
- "@hot-updater/plugin-core": "1.2.0-rc.50",
90
- "@hot-updater/server": "1.2.0-rc.50"
87
+ "@hot-updater/plugin-insights": "1.2.0-rc.52",
88
+ "@hot-updater/protocol": "1.2.0-rc.52",
89
+ "@hot-updater/plugin-core": "1.2.0-rc.52",
90
+ "@hot-updater/server": "1.2.0-rc.52"
91
91
  },
92
92
  "inlinedDependencies": {
93
93
  "@clack/core": "1.4.3",