@hot-updater/azure 1.2.0-rc.50 → 1.2.0-rc.51
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/functions/index.mjs +485 -38
- package/dist/init/index.cjs +1 -0
- package/dist/init/index.mjs +2 -1
- package/package.json +6 -6
package/dist/functions/index.mjs
CHANGED
|
@@ -4413,7 +4413,8 @@ const releaseRowToRelease = (row) => ({
|
|
|
4413
4413
|
operation: row.operation,
|
|
4414
4414
|
sourceReleaseId: row.source_release_id,
|
|
4415
4415
|
createdAtMs: row.created_at_ms,
|
|
4416
|
-
updatedAtMs: row.updated_at_ms
|
|
4416
|
+
updatedAtMs: row.updated_at_ms,
|
|
4417
|
+
label: row.label ?? null
|
|
4417
4418
|
});
|
|
4418
4419
|
const bundleToRow = (bundle) => {
|
|
4419
4420
|
const metadata = bundleMetadataToRow(bundle.metadata);
|
|
@@ -4922,7 +4923,7 @@ function rangeToIntervals(range) {
|
|
|
4922
4923
|
throw new ReleaseCatalogCompilationError("INVALID_TARGET_RANGE", `Invalid target app-version range: ${range}`);
|
|
4923
4924
|
}
|
|
4924
4925
|
}
|
|
4925
|
-
function releaseDescriptor(release) {
|
|
4926
|
+
function releaseDescriptor(release, labels) {
|
|
4926
4927
|
return {
|
|
4927
4928
|
releaseId: release.id,
|
|
4928
4929
|
kind: release.kind,
|
|
@@ -4930,7 +4931,8 @@ function releaseDescriptor(release) {
|
|
|
4930
4931
|
rolloutCohortCount: release.rolloutCohortCount,
|
|
4931
4932
|
targetCohorts: [...new Set(release.targetCohorts)].sort(),
|
|
4932
4933
|
shouldForceUpdate: release.shouldForceUpdate,
|
|
4933
|
-
message: release.message
|
|
4934
|
+
message: release.message,
|
|
4935
|
+
...labels && typeof release.label === "number" ? { label: release.label } : {}
|
|
4934
4936
|
};
|
|
4935
4937
|
}
|
|
4936
4938
|
function validateReleases(releases, strategy) {
|
|
@@ -5143,12 +5145,21 @@ async function compileReleaseCatalog(input) {
|
|
|
5143
5145
|
const targetCohorts = new Set(releases.flatMap((release) => release.targetCohorts));
|
|
5144
5146
|
if (targetCohorts.size > 512) throw new ReleaseCatalogCompilationError("DISTINCT_TARGET_COHORT_LIMIT", `Scope exceeds 512 distinct target cohorts`);
|
|
5145
5147
|
const { envelope, retainedReleases } = input.strategy === "APP_VERSION" ? compileAppVersion(releases) : compileFingerprint(releases);
|
|
5146
|
-
const
|
|
5147
|
-
|
|
5148
|
-
|
|
5148
|
+
const compile = (labels) => {
|
|
5149
|
+
const payload = {
|
|
5150
|
+
...envelope,
|
|
5151
|
+
releaseDescriptors: retainedReleases.map((release) => releaseDescriptor(release, labels))
|
|
5152
|
+
};
|
|
5153
|
+
const canonicalPayload = canonicalStringify(payload);
|
|
5154
|
+
return {
|
|
5155
|
+
payload,
|
|
5156
|
+
canonicalPayload,
|
|
5157
|
+
byteSize: new TextEncoder().encode(canonicalPayload).byteLength
|
|
5158
|
+
};
|
|
5149
5159
|
};
|
|
5150
|
-
|
|
5151
|
-
|
|
5160
|
+
let compiled = compile(true);
|
|
5161
|
+
if (compiled.byteSize > 262144 && retainedReleases.some((release) => typeof release.label === "number")) compiled = compile(false);
|
|
5162
|
+
const { payload, canonicalPayload, byteSize } = compiled;
|
|
5152
5163
|
if (byteSize > 262144) throw new ReleaseCatalogCompilationError("CATALOG_OVERSIZE", `Compiled Release catalog is ${byteSize} bytes; maximum is ${MAX_COMPILED_CATALOG_BYTES}`);
|
|
5153
5164
|
return {
|
|
5154
5165
|
byteSize,
|
|
@@ -5891,7 +5902,11 @@ const releases = defineTable({
|
|
|
5891
5902
|
}
|
|
5892
5903
|
},
|
|
5893
5904
|
created_at_ms: { type: "integer" },
|
|
5894
|
-
updated_at_ms: { type: "integer" }
|
|
5905
|
+
updated_at_ms: { type: "integer" },
|
|
5906
|
+
label: {
|
|
5907
|
+
type: "integer",
|
|
5908
|
+
required: false
|
|
5909
|
+
}
|
|
5895
5910
|
}, {
|
|
5896
5911
|
key: ["id"],
|
|
5897
5912
|
indexes: {
|
|
@@ -5928,6 +5943,15 @@ const releases = defineTable({
|
|
|
5928
5943
|
scopes: {
|
|
5929
5944
|
eq: [],
|
|
5930
5945
|
sort: ["scope_key"]
|
|
5946
|
+
},
|
|
5947
|
+
byLabel: {
|
|
5948
|
+
eq: [
|
|
5949
|
+
"channel_id",
|
|
5950
|
+
"platform",
|
|
5951
|
+
"label"
|
|
5952
|
+
],
|
|
5953
|
+
sort: [],
|
|
5954
|
+
unique: true
|
|
5931
5955
|
}
|
|
5932
5956
|
}
|
|
5933
5957
|
});
|
|
@@ -5935,6 +5959,25 @@ const LATE_INDEXES = [{
|
|
|
5935
5959
|
table: "releases",
|
|
5936
5960
|
index: "scopes"
|
|
5937
5961
|
}];
|
|
5962
|
+
const LATE_COLUMNS = [{
|
|
5963
|
+
table: "releases",
|
|
5964
|
+
column: "label"
|
|
5965
|
+
}];
|
|
5966
|
+
const labelSequences = defineTable({
|
|
5967
|
+
id: {
|
|
5968
|
+
type: "string",
|
|
5969
|
+
maxLength: 1440,
|
|
5970
|
+
ascii: true
|
|
5971
|
+
},
|
|
5972
|
+
last_label: { type: "integer" },
|
|
5973
|
+
is_filled: { type: "boolean" }
|
|
5974
|
+
}, {
|
|
5975
|
+
key: ["id"],
|
|
5976
|
+
indexes: { all: {
|
|
5977
|
+
eq: [],
|
|
5978
|
+
sort: ["id"]
|
|
5979
|
+
} }
|
|
5980
|
+
});
|
|
5938
5981
|
const releaseCatalogs = defineTable({
|
|
5939
5982
|
scope_key: {
|
|
5940
5983
|
type: "string",
|
|
@@ -6241,7 +6284,8 @@ const coreModule = {
|
|
|
6241
6284
|
}),
|
|
6242
6285
|
native_builds: nativeBuilds,
|
|
6243
6286
|
ios_devices: iosDevices,
|
|
6244
|
-
ios_device_account: iosDeviceAccount
|
|
6287
|
+
ios_device_account: iosDeviceAccount,
|
|
6288
|
+
label_sequences: labelSequences
|
|
6245
6289
|
}
|
|
6246
6290
|
};
|
|
6247
6291
|
//#endregion
|
|
@@ -6338,10 +6382,23 @@ const fillLateIndexes = async (adapter, tables, { dryRun = false } = {}) => {
|
|
|
6338
6382
|
}
|
|
6339
6383
|
return lacking;
|
|
6340
6384
|
};
|
|
6385
|
+
const addLateColumns = async (adapter, tables, { dryRun = false } = {}) => {
|
|
6386
|
+
const addColumns = adapter.migrations?.addColumns;
|
|
6387
|
+
if (addColumns === void 0) return [];
|
|
6388
|
+
const lacking = [];
|
|
6389
|
+
for (const table of tables) {
|
|
6390
|
+
const columns = LATE_COLUMNS.filter(({ table: name }) => name === table.name).map(({ column }) => column);
|
|
6391
|
+
if (columns.length === 0) continue;
|
|
6392
|
+
const added = await addColumns(table, columns, { dryRun });
|
|
6393
|
+
lacking.push(...added.map((column) => `${table.name}.${column}`));
|
|
6394
|
+
}
|
|
6395
|
+
return lacking;
|
|
6396
|
+
};
|
|
6341
6397
|
const migrateSchema = async (adapter, adapterName, tables, settings, ordered) => {
|
|
6342
6398
|
if (adapter.migrations === void 0) throw new Error(`${adapterName} creates its tables with its own tooling; write only the settings rows.`);
|
|
6343
6399
|
const stored = await storedSettings(adapter, Object.keys(settings)).catch(() => void 0);
|
|
6344
6400
|
if (stored !== void 0) refuseNewerSchema(adapterName, new Map([...stored].map(([key, row]) => [key, row?.value])), settings, ordered);
|
|
6401
|
+
await addLateColumns(adapter, tables);
|
|
6345
6402
|
await adapter.migrations.apply([...tables, SETTINGS_TABLE]);
|
|
6346
6403
|
await fillLateIndexes(adapter, tables);
|
|
6347
6404
|
await writeSchemaSettings(adapter, adapterName, settings, ordered);
|
|
@@ -7233,23 +7290,45 @@ const createEngineMigrator = (options) => {
|
|
|
7233
7290
|
refuseNewerSchema(options.adapterName, stored, options.settings, options.ordered);
|
|
7234
7291
|
const changed = Object.entries(options.settings).filter(([key, value]) => stored.get(key) !== value);
|
|
7235
7292
|
if (changed.length === 0) {
|
|
7293
|
+
const columns = await addLateColumns(options.adapter, options.schema.tables, { dryRun: true });
|
|
7236
7294
|
const lacking = await fillLateIndexes(options.adapter, options.schema.tables, { dryRun: true });
|
|
7237
|
-
if (lacking.length === 0) return getEmptyMigrationResult();
|
|
7295
|
+
if (columns.length === 0 && lacking.length === 0) return getEmptyMigrationResult();
|
|
7238
7296
|
return {
|
|
7239
|
-
operations: [
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7297
|
+
operations: [
|
|
7298
|
+
...columns.map((column) => ({
|
|
7299
|
+
type: "custom",
|
|
7300
|
+
description: `Add column: ${column}`
|
|
7301
|
+
})),
|
|
7302
|
+
...columns.length === 0 ? [] : [{
|
|
7303
|
+
type: "custom",
|
|
7304
|
+
description: "Create the tables and indexes the database lacks"
|
|
7305
|
+
}],
|
|
7306
|
+
...lacking.length === 0 ? [] : [{
|
|
7307
|
+
type: "custom",
|
|
7308
|
+
description: `Write the index items rows lack: ${lacking.join(", ")}`
|
|
7309
|
+
}]
|
|
7310
|
+
],
|
|
7243
7311
|
execute: async () => {
|
|
7312
|
+
if (columns.length > 0) {
|
|
7313
|
+
await addLateColumns(options.adapter, options.schema.tables);
|
|
7314
|
+
await options.adapter.migrations.apply([...options.schema.tables, SETTINGS_TABLE]);
|
|
7315
|
+
}
|
|
7244
7316
|
await fillLateIndexes(options.adapter, options.schema.tables);
|
|
7245
7317
|
}
|
|
7246
7318
|
};
|
|
7247
7319
|
}
|
|
7248
7320
|
return {
|
|
7249
|
-
operations: [
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7321
|
+
operations: [
|
|
7322
|
+
...(await addLateColumns(options.adapter, options.schema.tables, { dryRun: true }).catch(() => [])).map((column) => ({
|
|
7323
|
+
type: "custom",
|
|
7324
|
+
description: `Add column: ${column}`
|
|
7325
|
+
})),
|
|
7326
|
+
{
|
|
7327
|
+
type: "custom",
|
|
7328
|
+
description: "Create the tables and indexes the database lacks"
|
|
7329
|
+
},
|
|
7330
|
+
...migrate.updateSettings === false ? [] : [settingsOperation(stored, changed)]
|
|
7331
|
+
],
|
|
7253
7332
|
execute: () => migrateSchema(options.adapter, options.adapterName, options.schema.tables, options.settings, options.ordered)
|
|
7254
7333
|
};
|
|
7255
7334
|
};
|
|
@@ -8344,7 +8423,7 @@ const createKvAdapter = ({ store, tablePrefix = "" }) => {
|
|
|
8344
8423
|
};
|
|
8345
8424
|
//#endregion
|
|
8346
8425
|
//#region ../../packages/server/dist/version.mjs
|
|
8347
|
-
const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.
|
|
8426
|
+
const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.51";
|
|
8348
8427
|
//#endregion
|
|
8349
8428
|
//#region ../../packages/server/dist/handlerVersionRoutes.mjs
|
|
8350
8429
|
const createVersionRouteHandlers = (plugins = []) => {
|
|
@@ -9082,7 +9161,7 @@ const baseBundleIdsOf = (row, range, bundleId, limit) => {
|
|
|
9082
9161
|
};
|
|
9083
9162
|
//#endregion
|
|
9084
9163
|
//#region ../../packages/server/dist/core/reads.mjs
|
|
9085
|
-
const PAGE$
|
|
9164
|
+
const PAGE$4 = 500;
|
|
9086
9165
|
const pick$2 = (fields) => (row) => Object.fromEntries(fields.map((field) => [field, row[field]]));
|
|
9087
9166
|
const toBundleRow = pick$2([
|
|
9088
9167
|
"id",
|
|
@@ -9103,7 +9182,7 @@ const toPatchRow = pick$2([
|
|
|
9103
9182
|
"byte_size",
|
|
9104
9183
|
"order_index"
|
|
9105
9184
|
]);
|
|
9106
|
-
const
|
|
9185
|
+
const pickReleaseRow = pick$2([
|
|
9107
9186
|
"id",
|
|
9108
9187
|
"revision",
|
|
9109
9188
|
"scope_key",
|
|
@@ -9124,6 +9203,12 @@ const toReleaseRow = pick$2([
|
|
|
9124
9203
|
"created_at_ms",
|
|
9125
9204
|
"updated_at_ms"
|
|
9126
9205
|
]);
|
|
9206
|
+
const toReleaseRow = (row) => {
|
|
9207
|
+
return {
|
|
9208
|
+
...pickReleaseRow(row),
|
|
9209
|
+
label: typeof row.label === "number" ? row.label : null
|
|
9210
|
+
};
|
|
9211
|
+
};
|
|
9127
9212
|
const toCatalogRow = pick$2([
|
|
9128
9213
|
"scope_key",
|
|
9129
9214
|
"catalog_id",
|
|
@@ -9167,7 +9252,7 @@ const createCoreReads = (db, storage) => {
|
|
|
9167
9252
|
const page = await db.findMany("bundle_patches", {
|
|
9168
9253
|
index: "byBundle",
|
|
9169
9254
|
where: { bundle_id: row.id },
|
|
9170
|
-
limit: Math.min(count - patches.length, PAGE$
|
|
9255
|
+
limit: Math.min(count - patches.length, PAGE$4),
|
|
9171
9256
|
...cursor === void 0 ? {} : { cursor }
|
|
9172
9257
|
});
|
|
9173
9258
|
patches.push(...page.rows.map(toPatchRow));
|
|
@@ -9268,6 +9353,18 @@ const createCoreReads = (db, storage) => {
|
|
|
9268
9353
|
const row = await db.findOne("releases", { id });
|
|
9269
9354
|
return row === null ? null : toReleaseRow(row);
|
|
9270
9355
|
},
|
|
9356
|
+
async getReleaseByLabel({ channel, platform, label }) {
|
|
9357
|
+
const found = await db.findOne("releases", {
|
|
9358
|
+
channel_id: `channel:${encodeChannelKey(channel)}`,
|
|
9359
|
+
platform,
|
|
9360
|
+
label
|
|
9361
|
+
});
|
|
9362
|
+
if (found === null) return null;
|
|
9363
|
+
const row = await db.findOne("releases", { id: found.id });
|
|
9364
|
+
if (row === null) return null;
|
|
9365
|
+
const release = toReleaseRow(row);
|
|
9366
|
+
return release.label === label && release.platform === platform ? release : null;
|
|
9367
|
+
},
|
|
9271
9368
|
async listReleases(input) {
|
|
9272
9369
|
const { filter } = input;
|
|
9273
9370
|
const options = {
|
|
@@ -9359,7 +9456,7 @@ const createCoreReads = (db, storage) => {
|
|
|
9359
9456
|
return (await drain$1((page) => db.findMany("channels", {
|
|
9360
9457
|
index: "all",
|
|
9361
9458
|
where: {},
|
|
9362
|
-
limit: PAGE$
|
|
9459
|
+
limit: PAGE$4,
|
|
9363
9460
|
...page
|
|
9364
9461
|
}))).map(toChannelRow);
|
|
9365
9462
|
},
|
|
@@ -9658,6 +9755,269 @@ const NATIVE_BUILD_SUBMISSION_DESTINATIONS = {
|
|
|
9658
9755
|
ios: ["testflight"]
|
|
9659
9756
|
};
|
|
9660
9757
|
//#endregion
|
|
9758
|
+
//#region ../../packages/server/dist/core/labels.mjs
|
|
9759
|
+
const labelSequenceId = (channelId, platform) => `releases/${platform}/${channelId}`;
|
|
9760
|
+
const LABEL_PLATFORMS = ["ios", "android"];
|
|
9761
|
+
var NeedsLabelFill = class extends Error {
|
|
9762
|
+
channelId;
|
|
9763
|
+
platform;
|
|
9764
|
+
constructor(channelId, platform) {
|
|
9765
|
+
super(`Release labels of ${platform} ${channelId} need a fill first.`);
|
|
9766
|
+
this.channelId = channelId;
|
|
9767
|
+
this.platform = platform;
|
|
9768
|
+
}
|
|
9769
|
+
};
|
|
9770
|
+
const createLabelAllocator = (tx, used, caughtUp) => {
|
|
9771
|
+
const sequences = /* @__PURE__ */ new Map();
|
|
9772
|
+
return {
|
|
9773
|
+
async next(channelId, platform) {
|
|
9774
|
+
const id = labelSequenceId(channelId, platform);
|
|
9775
|
+
let sequence = sequences.get(id);
|
|
9776
|
+
if (sequence === void 0) {
|
|
9777
|
+
const row = await tx.findOne("label_sequences", { id });
|
|
9778
|
+
if (row === null || !row.is_filled) {
|
|
9779
|
+
const channel = row === null ? await tx.findOne("channels", { id: channelId }) : null;
|
|
9780
|
+
if (channel === null || (channel._refs_releases_channel_id ?? 0) > 0) throw new NeedsLabelFill(channelId, platform);
|
|
9781
|
+
}
|
|
9782
|
+
const read = row?.last_label ?? 0;
|
|
9783
|
+
sequence = {
|
|
9784
|
+
row,
|
|
9785
|
+
read,
|
|
9786
|
+
last: read
|
|
9787
|
+
};
|
|
9788
|
+
sequences.set(id, sequence);
|
|
9789
|
+
used.set(id, {
|
|
9790
|
+
channelId,
|
|
9791
|
+
platform,
|
|
9792
|
+
read
|
|
9793
|
+
});
|
|
9794
|
+
}
|
|
9795
|
+
sequence.last += 1;
|
|
9796
|
+
return sequence.last;
|
|
9797
|
+
},
|
|
9798
|
+
caughtUp(channelId, platform) {
|
|
9799
|
+
caughtUp.set(labelSequenceId(channelId, platform), {
|
|
9800
|
+
channelId,
|
|
9801
|
+
platform
|
|
9802
|
+
});
|
|
9803
|
+
},
|
|
9804
|
+
flush() {
|
|
9805
|
+
for (const [id, { row, read, last }] of sequences) if (row === null) tx.create("label_sequences", {
|
|
9806
|
+
id,
|
|
9807
|
+
last_label: last,
|
|
9808
|
+
is_filled: true
|
|
9809
|
+
});
|
|
9810
|
+
else if (last !== read) tx.update("label_sequences", row, { last_label: last });
|
|
9811
|
+
}
|
|
9812
|
+
};
|
|
9813
|
+
};
|
|
9814
|
+
const FILL_BATCH = 25;
|
|
9815
|
+
const PAGE$3 = 500;
|
|
9816
|
+
const fillLabels = async (db, { channelId, platform }, { dryRun = false } = {}) => {
|
|
9817
|
+
const id = labelSequenceId(channelId, platform);
|
|
9818
|
+
let labeled = 0;
|
|
9819
|
+
let batchSize = FILL_BATCH;
|
|
9820
|
+
const label = async (ids) => {
|
|
9821
|
+
for (let at = 0; at < ids.length;) {
|
|
9822
|
+
const batch = ids.slice(at, at + batchSize);
|
|
9823
|
+
try {
|
|
9824
|
+
labeled += await db.transaction(async (tx) => {
|
|
9825
|
+
const counter = await tx.findOne("label_sequences", { id });
|
|
9826
|
+
let last = counter?.last_label ?? 0;
|
|
9827
|
+
let count = 0;
|
|
9828
|
+
for (const releaseId of batch) {
|
|
9829
|
+
const row = await tx.findOne("releases", { id: releaseId });
|
|
9830
|
+
if (row === null || typeof row.label === "number") continue;
|
|
9831
|
+
last += 1;
|
|
9832
|
+
count += 1;
|
|
9833
|
+
tx.update("releases", row, { label: last });
|
|
9834
|
+
}
|
|
9835
|
+
if (counter === null) tx.create("label_sequences", {
|
|
9836
|
+
id,
|
|
9837
|
+
last_label: last,
|
|
9838
|
+
is_filled: false
|
|
9839
|
+
});
|
|
9840
|
+
else if (last !== counter.last_label) tx.update("label_sequences", counter, { last_label: last });
|
|
9841
|
+
return count;
|
|
9842
|
+
});
|
|
9843
|
+
at += batch.length;
|
|
9844
|
+
} catch (error) {
|
|
9845
|
+
if (batchSize > 1 && error instanceof DatabaseConstraintError && error.reason === "too_large") {
|
|
9846
|
+
batchSize = Math.max(1, Math.floor(batchSize / 2));
|
|
9847
|
+
continue;
|
|
9848
|
+
}
|
|
9849
|
+
throw error;
|
|
9850
|
+
}
|
|
9851
|
+
}
|
|
9852
|
+
};
|
|
9853
|
+
let cursor;
|
|
9854
|
+
do {
|
|
9855
|
+
const page = await db.findMany("releases", {
|
|
9856
|
+
index: "byChannelPlatform",
|
|
9857
|
+
where: {
|
|
9858
|
+
channel_id: channelId,
|
|
9859
|
+
platform
|
|
9860
|
+
},
|
|
9861
|
+
limit: PAGE$3,
|
|
9862
|
+
...cursor === void 0 ? {} : { cursor }
|
|
9863
|
+
});
|
|
9864
|
+
const unlabeled = page.rows.filter((row) => typeof row.label !== "number").map((row) => row.id);
|
|
9865
|
+
if (dryRun) labeled += unlabeled.length;
|
|
9866
|
+
else await label(unlabeled);
|
|
9867
|
+
cursor = page.next;
|
|
9868
|
+
} while (cursor !== void 0);
|
|
9869
|
+
if (dryRun) return labeled;
|
|
9870
|
+
await db.transaction(async (tx) => {
|
|
9871
|
+
const counter = await tx.findOne("label_sequences", { id });
|
|
9872
|
+
if (counter === null) tx.create("label_sequences", {
|
|
9873
|
+
id,
|
|
9874
|
+
last_label: 0,
|
|
9875
|
+
is_filled: true
|
|
9876
|
+
});
|
|
9877
|
+
else if (!counter.is_filled) tx.update("label_sequences", counter, { is_filled: true });
|
|
9878
|
+
});
|
|
9879
|
+
return labeled;
|
|
9880
|
+
};
|
|
9881
|
+
const probeLabelSchema = async (db, { channelId, platform }) => {
|
|
9882
|
+
await db.findOne("label_sequences", { id: labelSequenceId(channelId, platform) });
|
|
9883
|
+
await db.findMany("releases", {
|
|
9884
|
+
index: "byLabel",
|
|
9885
|
+
where: {
|
|
9886
|
+
channel_id: channelId,
|
|
9887
|
+
platform,
|
|
9888
|
+
label: 0
|
|
9889
|
+
},
|
|
9890
|
+
limit: 1
|
|
9891
|
+
});
|
|
9892
|
+
};
|
|
9893
|
+
const REPAIRS = 4;
|
|
9894
|
+
const RACES = 32;
|
|
9895
|
+
const writeWithLabels = async (db, write) => {
|
|
9896
|
+
const filled = /* @__PURE__ */ new Set();
|
|
9897
|
+
const fill = async (pairs) => {
|
|
9898
|
+
for (const pair of pairs) {
|
|
9899
|
+
filled.add(labelSequenceId(pair.channelId, pair.platform));
|
|
9900
|
+
await fillLabels(db, pair);
|
|
9901
|
+
}
|
|
9902
|
+
};
|
|
9903
|
+
for (let repairs = 0, races = 0;;) {
|
|
9904
|
+
const used = /* @__PURE__ */ new Map();
|
|
9905
|
+
const caughtUp = /* @__PURE__ */ new Map();
|
|
9906
|
+
try {
|
|
9907
|
+
return await db.transaction(async (tx) => {
|
|
9908
|
+
used.clear();
|
|
9909
|
+
caughtUp.clear();
|
|
9910
|
+
const labels = createLabelAllocator(tx, used, caughtUp);
|
|
9911
|
+
const result = await write(tx, labels);
|
|
9912
|
+
labels.flush();
|
|
9913
|
+
return result;
|
|
9914
|
+
});
|
|
9915
|
+
} catch (error) {
|
|
9916
|
+
const needs = error instanceof NeedsLabelFill ? [error] : error instanceof DatabaseConstraintError && error.reason === "too_large" ? [...caughtUp.values()] : [];
|
|
9917
|
+
if (needs.length > 0) {
|
|
9918
|
+
const fresh = needs.some(({ channelId, platform }) => !filled.has(labelSequenceId(channelId, platform)));
|
|
9919
|
+
if (fresh || repairs < REPAIRS) {
|
|
9920
|
+
if (!fresh) repairs += 1;
|
|
9921
|
+
await fill(needs);
|
|
9922
|
+
continue;
|
|
9923
|
+
}
|
|
9924
|
+
}
|
|
9925
|
+
if (error instanceof DatabaseConstraintError && error.reason === "unique" && error.model === "releases" && used.size > 0) {
|
|
9926
|
+
if (await db.transaction(async (tx) => {
|
|
9927
|
+
const moves = [];
|
|
9928
|
+
for (const [id, { channelId, read }] of used) {
|
|
9929
|
+
const counter = await tx.findOne("label_sequences", { id });
|
|
9930
|
+
if (counter !== null) {
|
|
9931
|
+
if (counter.last_label !== read) return false;
|
|
9932
|
+
moves.push(() => tx.update("label_sequences", counter, { last_label: read + 1 }));
|
|
9933
|
+
continue;
|
|
9934
|
+
}
|
|
9935
|
+
const channel = await tx.findOne("channels", { id: channelId });
|
|
9936
|
+
if (channel === null || (channel._refs_releases_channel_id ?? 0) > 0) return false;
|
|
9937
|
+
moves.push(() => tx.create("label_sequences", {
|
|
9938
|
+
id,
|
|
9939
|
+
last_label: read + 1,
|
|
9940
|
+
is_filled: true
|
|
9941
|
+
}));
|
|
9942
|
+
}
|
|
9943
|
+
for (const move of moves) move();
|
|
9944
|
+
return true;
|
|
9945
|
+
}) ? (repairs += 1) <= REPAIRS : (races += 1) <= RACES) continue;
|
|
9946
|
+
}
|
|
9947
|
+
throw error;
|
|
9948
|
+
}
|
|
9949
|
+
}
|
|
9950
|
+
};
|
|
9951
|
+
const catchUpLabels = async (tx, labels, latest) => {
|
|
9952
|
+
const given = /* @__PURE__ */ new Map();
|
|
9953
|
+
if (latest === null || typeof latest.label === "number") return given;
|
|
9954
|
+
const unlabeled = [];
|
|
9955
|
+
let cursor;
|
|
9956
|
+
scan: do {
|
|
9957
|
+
const page = await tx.findMany("releases", {
|
|
9958
|
+
index: "byScope",
|
|
9959
|
+
where: { scope_key: latest.scope_key },
|
|
9960
|
+
order: "desc",
|
|
9961
|
+
limit: FILL_BATCH,
|
|
9962
|
+
...cursor === void 0 ? {} : { cursor }
|
|
9963
|
+
});
|
|
9964
|
+
for (const row of page.rows) {
|
|
9965
|
+
if (typeof row.label === "number") break scan;
|
|
9966
|
+
unlabeled.push(row);
|
|
9967
|
+
}
|
|
9968
|
+
cursor = page.next;
|
|
9969
|
+
} while (cursor !== void 0);
|
|
9970
|
+
labels.caughtUp(latest.channel_id, latest.platform);
|
|
9971
|
+
for (const row of unlabeled.reverse()) {
|
|
9972
|
+
const { id, channel_id, platform } = toReleaseRow(row);
|
|
9973
|
+
const label = await labels.next(channel_id, platform);
|
|
9974
|
+
tx.update("releases", row, { label });
|
|
9975
|
+
given.set(id, label);
|
|
9976
|
+
}
|
|
9977
|
+
return given;
|
|
9978
|
+
};
|
|
9979
|
+
const pendingLabelPairs = async (db) => {
|
|
9980
|
+
const pairs = /* @__PURE__ */ new Map();
|
|
9981
|
+
for (let last = "";;) {
|
|
9982
|
+
const { rows } = await db.findMany("releases", {
|
|
9983
|
+
index: "scopes",
|
|
9984
|
+
where: {},
|
|
9985
|
+
limit: 1,
|
|
9986
|
+
range: { gt: last }
|
|
9987
|
+
});
|
|
9988
|
+
if (rows[0] === void 0) break;
|
|
9989
|
+
last = rows[0].scope_key;
|
|
9990
|
+
const { rows: newest } = await db.findMany("releases", {
|
|
9991
|
+
index: "byScope",
|
|
9992
|
+
where: { scope_key: last },
|
|
9993
|
+
order: "desc",
|
|
9994
|
+
limit: 1
|
|
9995
|
+
});
|
|
9996
|
+
if (newest[0] === void 0) continue;
|
|
9997
|
+
const { channel_id: channelId, platform, label } = toReleaseRow(newest[0]);
|
|
9998
|
+
const id = labelSequenceId(channelId, platform);
|
|
9999
|
+
const pair = pairs.get(id) ?? {
|
|
10000
|
+
channelId,
|
|
10001
|
+
platform,
|
|
10002
|
+
pending: false
|
|
10003
|
+
};
|
|
10004
|
+
pair.pending ||= label === null;
|
|
10005
|
+
pairs.set(id, pair);
|
|
10006
|
+
}
|
|
10007
|
+
const pending = [];
|
|
10008
|
+
for (const [id, { channelId, platform, pending: unlabeled }] of pairs) {
|
|
10009
|
+
if (!unlabeled) {
|
|
10010
|
+
const counter = await db.findOne("label_sequences", { id });
|
|
10011
|
+
if (counter !== null && counter.is_filled) continue;
|
|
10012
|
+
}
|
|
10013
|
+
pending.push({
|
|
10014
|
+
channelId,
|
|
10015
|
+
platform
|
|
10016
|
+
});
|
|
10017
|
+
}
|
|
10018
|
+
return pending;
|
|
10019
|
+
};
|
|
10020
|
+
//#endregion
|
|
9661
10021
|
//#region ../../packages/server/dist/core/writes.mjs
|
|
9662
10022
|
const PAGE$2 = 500;
|
|
9663
10023
|
const countBundle = (tx, platform, delta) => {
|
|
@@ -9744,6 +10104,10 @@ const deleteChannel = (db, id) => db.transaction(async (tx) => {
|
|
|
9744
10104
|
deleted: false,
|
|
9745
10105
|
reason: "not_empty"
|
|
9746
10106
|
};
|
|
10107
|
+
for (const platform of LABEL_PLATFORMS) {
|
|
10108
|
+
const counter = await tx.findOne("label_sequences", { id: labelSequenceId(id, platform) });
|
|
10109
|
+
if (counter !== null) await tx.delete("label_sequences", counter);
|
|
10110
|
+
}
|
|
9747
10111
|
await tx.delete("channels", row);
|
|
9748
10112
|
return { deleted: true };
|
|
9749
10113
|
});
|
|
@@ -10203,14 +10567,14 @@ const enabledIn = (scopeKey, cursor) => ({
|
|
|
10203
10567
|
...cursor === void 0 ? {} : { cursor }
|
|
10204
10568
|
});
|
|
10205
10569
|
const enabledReleases = (tx, scopeKey) => drainReleases((cursor) => tx.findMany("releases", enabledIn(scopeKey, cursor)));
|
|
10206
|
-
const
|
|
10570
|
+
const latestRelease = async (tx, scopeKey) => {
|
|
10207
10571
|
const { rows } = await tx.findMany("releases", {
|
|
10208
10572
|
index: "byScope",
|
|
10209
10573
|
where: { scope_key: scopeKey },
|
|
10210
10574
|
order: "desc",
|
|
10211
10575
|
limit: 1
|
|
10212
10576
|
});
|
|
10213
|
-
return rows[0]
|
|
10577
|
+
return rows[0] === void 0 ? null : toReleaseRow(rows[0]);
|
|
10214
10578
|
};
|
|
10215
10579
|
const nextCatalog = (scope, stored, compilation, updatedAtMs) => {
|
|
10216
10580
|
const generation = (stored.catalog?.generation ?? 0) + 1;
|
|
@@ -10264,10 +10628,10 @@ const readCatalog = async (tx, scopeKey) => {
|
|
|
10264
10628
|
const assertHistory = (stored, hasReleases) => {
|
|
10265
10629
|
if (stored.catalog === null && hasReleases) fail$1("CATALOG_IDENTITY_MISSING", "Catalog history is missing. Restore its catalog row from backup before rebuilding or deploying.");
|
|
10266
10630
|
};
|
|
10267
|
-
const changeRelease = async (tx, { scope, change, bundle, updatedAtMs }) => {
|
|
10631
|
+
const changeRelease = async (tx, { scope, change, bundle, updatedAtMs }, labels) => {
|
|
10268
10632
|
checkScope(scope);
|
|
10269
10633
|
const stored = await readCatalog(tx, scope.scopeKey);
|
|
10270
|
-
|
|
10634
|
+
let enabled = await enabledReleases(tx, scope.scopeKey);
|
|
10271
10635
|
if (bundle !== void 0) {
|
|
10272
10636
|
insertBundle(tx, bundle.row);
|
|
10273
10637
|
for (const patch of bundle.patches) tx.create("bundle_patches", patch);
|
|
@@ -10275,14 +10639,22 @@ const changeRelease = async (tx, { scope, change, bundle, updatedAtMs }) => {
|
|
|
10275
10639
|
let before = null;
|
|
10276
10640
|
let release;
|
|
10277
10641
|
if (change.operation === "insert") {
|
|
10278
|
-
|
|
10642
|
+
if (labels === void 0) throw new Error("A release insert takes its label from an allocator.");
|
|
10643
|
+
const newest = await latestRelease(tx, scope.scopeKey);
|
|
10644
|
+
const latest = newest?.id ?? null;
|
|
10279
10645
|
assertHistory(stored, latest !== null);
|
|
10280
10646
|
const floor = [latest, bundle && isUUIDv7(bundle.row.id) ? bundle.row.id : null].filter((id) => id !== null).sort().at(-1);
|
|
10281
10647
|
const id = change.row.id ?? createUUIDv7After(floor ?? null);
|
|
10282
10648
|
if (latest !== null && id <= latest) fail$1("NON_MONOTONIC_RELEASE_ID", `Release "${id}" must sort after "${latest}"`);
|
|
10649
|
+
const given = await catchUpLabels(tx, labels, newest);
|
|
10650
|
+
if (given.size > 0) enabled = enabled.map((row) => given.has(row.id) ? {
|
|
10651
|
+
...row,
|
|
10652
|
+
label: given.get(row.id)
|
|
10653
|
+
} : row);
|
|
10283
10654
|
release = {
|
|
10284
10655
|
...change.row,
|
|
10285
|
-
id
|
|
10656
|
+
id,
|
|
10657
|
+
label: await labels.next(scope.channelId, scope.platform)
|
|
10286
10658
|
};
|
|
10287
10659
|
if (release.scope_key !== scope.scopeKey || release.channel_id !== scope.channelId || release.platform !== scope.platform || release.strategy !== scope.strategy || release.fingerprint_hash !== scope.fingerprintHash || release.revision !== 1) fail$1("INVALID_SCOPE", "Inserted Release does not match its catalog scope");
|
|
10288
10660
|
tx.create("releases", release);
|
|
@@ -10295,8 +10667,9 @@ const changeRelease = async (tx, { scope, change, bundle, updatedAtMs }) => {
|
|
|
10295
10667
|
await tx.delete("releases", row);
|
|
10296
10668
|
release = null;
|
|
10297
10669
|
} else {
|
|
10670
|
+
const { label: _label, ...update } = change.update;
|
|
10298
10671
|
const set = {
|
|
10299
|
-
...
|
|
10672
|
+
...update,
|
|
10300
10673
|
revision: before.revision + 1
|
|
10301
10674
|
};
|
|
10302
10675
|
tx.update("releases", row, set);
|
|
@@ -10317,13 +10690,21 @@ const changeRelease = async (tx, { scope, change, bundle, updatedAtMs }) => {
|
|
|
10317
10690
|
};
|
|
10318
10691
|
const changeReleases = (db, inputs) => {
|
|
10319
10692
|
if (new Set(inputs.map(({ scope }) => scope.scopeKey)).size !== inputs.length) fail$1("INVALID_SCOPE", "A batch cannot change one catalog scope twice");
|
|
10320
|
-
return db
|
|
10693
|
+
return writeWithLabels(db, async (tx, labels) => {
|
|
10321
10694
|
const results = [];
|
|
10322
|
-
for (const input of inputs) results.push(await changeRelease(tx, input));
|
|
10695
|
+
for (const input of inputs) results.push(await changeRelease(tx, input, labels));
|
|
10323
10696
|
return results;
|
|
10324
10697
|
});
|
|
10325
10698
|
};
|
|
10326
10699
|
const isCurrent = (scope, current, compilation) => current.strategy === scope.strategy && current.channel_id === scope.channelId && current.channel_key === encodeChannelKey(scope.channelName) && current.platform === scope.platform && current.fingerprint_hash === scope.fingerprintHash && current.catalog_hash === compilation.catalogHash;
|
|
10700
|
+
const withoutLabels = (payload) => {
|
|
10701
|
+
const parsed = JSON.parse(payload);
|
|
10702
|
+
return JSON.stringify({
|
|
10703
|
+
...parsed,
|
|
10704
|
+
releaseDescriptors: (parsed.releaseDescriptors ?? []).map(({ label: _label, ...descriptor }) => descriptor)
|
|
10705
|
+
});
|
|
10706
|
+
};
|
|
10707
|
+
const differsInLabelsOnly = (current, projected) => current.payload !== projected.payload && current.strategy === projected.strategy && current.channel_id === projected.channel_id && current.channel_key === projected.channel_key && current.platform === projected.platform && current.fingerprint_hash === projected.fingerprint_hash && withoutLabels(current.payload) === withoutLabels(projected.payload);
|
|
10327
10708
|
const catalogRowScope = (row) => ({
|
|
10328
10709
|
channelId: row.channel_id,
|
|
10329
10710
|
channelName: decodeChannelKey(row.channel_key),
|
|
@@ -10341,17 +10722,19 @@ const preflightRebuild = async (db, scopeKey, updatedAtMs) => {
|
|
|
10341
10722
|
const enabled = await drainReleases((cursor) => db.findMany("releases", enabledIn(scopeKey, cursor)));
|
|
10342
10723
|
const compilation = await compileScope(scope, enabled);
|
|
10343
10724
|
const changed = !isCurrent(scope, current, compilation);
|
|
10725
|
+
const projectedCatalog = changed ? nextCatalog(scope, { catalog: current }, compilation, updatedAtMs) : current;
|
|
10344
10726
|
return {
|
|
10345
10727
|
changed,
|
|
10728
|
+
labelsOnly: changed && differsInLabelsOnly(current, projectedCatalog),
|
|
10346
10729
|
currentCatalog: current,
|
|
10347
10730
|
diagnostics: compilation.diagnostics,
|
|
10348
|
-
projectedCatalog
|
|
10731
|
+
projectedCatalog
|
|
10349
10732
|
};
|
|
10350
10733
|
};
|
|
10351
10734
|
const rebuildScope = async (tx, scope, updatedAtMs) => {
|
|
10352
10735
|
checkScope(scope);
|
|
10353
10736
|
const stored = await readCatalog(tx, scope.scopeKey);
|
|
10354
|
-
assertHistory(stored, await
|
|
10737
|
+
assertHistory(stored, await latestRelease(tx, scope.scopeKey) !== null);
|
|
10355
10738
|
const enabled = await enabledReleases(tx, scope.scopeKey);
|
|
10356
10739
|
const compilation = await compileScope(scope, enabled);
|
|
10357
10740
|
const current = stored.catalog;
|
|
@@ -10371,6 +10754,7 @@ const rebuildScope = async (tx, scope, updatedAtMs) => {
|
|
|
10371
10754
|
};
|
|
10372
10755
|
//#endregion
|
|
10373
10756
|
//#region ../../packages/server/dist/core/operations.mjs
|
|
10757
|
+
const CATALOG_PAGE = 100;
|
|
10374
10758
|
var Preflight = class extends Error {
|
|
10375
10759
|
result;
|
|
10376
10760
|
constructor(result) {
|
|
@@ -10589,7 +10973,7 @@ const createCoreOperations = (db, { now = Date.now } = {}) => {
|
|
|
10589
10973
|
if (targetChannel.length === 0) throw new ReleaseManagementError("TARGET_RELEASE_INVALID", "Promotion requires a target channel.");
|
|
10590
10974
|
const channel = await ensureChannel(targetChannel);
|
|
10591
10975
|
const updatedAtMs = now();
|
|
10592
|
-
return db
|
|
10976
|
+
return writeWithLabels(db, async (tx, labels) => {
|
|
10593
10977
|
const { release: source, scope: sourceScope } = await loadTarget(tx, input);
|
|
10594
10978
|
checkSource(source);
|
|
10595
10979
|
const targetScope = scopeOf$1(channel, source.platform, source.fingerprint_hash);
|
|
@@ -10617,12 +11001,13 @@ const createCoreOperations = (db, { now = Date.now } = {}) => {
|
|
|
10617
11001
|
},
|
|
10618
11002
|
updatedAtMs
|
|
10619
11003
|
}) : null;
|
|
11004
|
+
const { label: _label, ...copied } = source;
|
|
10620
11005
|
const target = await changeRelease(tx, {
|
|
10621
11006
|
scope: targetScope,
|
|
10622
11007
|
change: {
|
|
10623
11008
|
operation: "insert",
|
|
10624
11009
|
row: {
|
|
10625
|
-
...
|
|
11010
|
+
...copied,
|
|
10626
11011
|
id: createUUIDv7After(floor ?? null, updatedAtMs),
|
|
10627
11012
|
revision: 1,
|
|
10628
11013
|
scope_key: targetScope.scopeKey,
|
|
@@ -10637,7 +11022,7 @@ const createCoreOperations = (db, { now = Date.now } = {}) => {
|
|
|
10637
11022
|
}
|
|
10638
11023
|
},
|
|
10639
11024
|
updatedAtMs
|
|
10640
|
-
});
|
|
11025
|
+
}, labels);
|
|
10641
11026
|
return {
|
|
10642
11027
|
source: moved === null ? null : mutationResult(moved),
|
|
10643
11028
|
target: mutationResult(target)
|
|
@@ -10655,6 +11040,38 @@ const createCoreOperations = (db, { now = Date.now } = {}) => {
|
|
|
10655
11040
|
});
|
|
10656
11041
|
},
|
|
10657
11042
|
preflightReleaseCatalogRebuild: (scopeKey) => preflightRebuild(db, scopeKey, now()),
|
|
11043
|
+
fillReleaseLabels: async ({ dryRun = false, catalogs = true } = {}) => {
|
|
11044
|
+
let releases = 0;
|
|
11045
|
+
const pairs = await pendingLabelPairs(db);
|
|
11046
|
+
if (dryRun && pairs[0] !== void 0) await probeLabelSchema(db, pairs[0]);
|
|
11047
|
+
for (const pair of pairs) releases += await fillLabels(db, pair, { dryRun });
|
|
11048
|
+
let rebuilt = 0;
|
|
11049
|
+
if (catalogs) {
|
|
11050
|
+
let cursor;
|
|
11051
|
+
do {
|
|
11052
|
+
const page = await db.findMany("release_catalogs", {
|
|
11053
|
+
index: "all",
|
|
11054
|
+
where: {},
|
|
11055
|
+
limit: CATALOG_PAGE,
|
|
11056
|
+
...cursor === void 0 ? {} : { cursor }
|
|
11057
|
+
});
|
|
11058
|
+
for (const row of page.rows) {
|
|
11059
|
+
if (row.is_tombstone) continue;
|
|
11060
|
+
const preflight = await preflightRebuild(db, row.scope_key, now()).catch(() => null);
|
|
11061
|
+
if (preflight === null || !preflight.labelsOnly) continue;
|
|
11062
|
+
rebuilt += 1;
|
|
11063
|
+
if (dryRun) continue;
|
|
11064
|
+
const updatedAtMs = now();
|
|
11065
|
+
await db.transaction((tx) => rebuildScope(tx, catalogRowScope(toCatalogRow(row)), updatedAtMs));
|
|
11066
|
+
}
|
|
11067
|
+
cursor = page.next;
|
|
11068
|
+
} while (cursor !== void 0);
|
|
11069
|
+
}
|
|
11070
|
+
return {
|
|
11071
|
+
releases,
|
|
11072
|
+
catalogs: rebuilt
|
|
11073
|
+
};
|
|
11074
|
+
},
|
|
10658
11075
|
ensureChannel,
|
|
10659
11076
|
deleteChannel: (id) => deleteChannel(db, id),
|
|
10660
11077
|
updateBundle: (id, update) => db.transaction(async (tx) => {
|
|
@@ -11185,6 +11602,26 @@ const createAdminRouteHandlers = () => ({
|
|
|
11185
11602
|
return row === null ? notFound() : json$2({ data: row });
|
|
11186
11603
|
}),
|
|
11187
11604
|
rebuildReleaseCatalog: onCore(async (core, _request, params) => json$2({ data: await core.rebuildReleaseCatalog(scopeKeyOf(params)) })),
|
|
11605
|
+
getReleaseByLabel: onCore(async (core, request) => {
|
|
11606
|
+
const url = new URL(request.url);
|
|
11607
|
+
const channel = url.searchParams.get("channel");
|
|
11608
|
+
const platform = platformOf(url);
|
|
11609
|
+
const label = Number(url.searchParams.get("label"));
|
|
11610
|
+
if (channel === null || channel.length === 0 || platform === void 0 || !Number.isSafeInteger(label) || label < 1) throw new HandlerBadRequestError("A release label lookup takes channel, platform, and a label of 1 or more.");
|
|
11611
|
+
return json$2({ data: await core.getReleaseByLabel({
|
|
11612
|
+
channel,
|
|
11613
|
+
platform,
|
|
11614
|
+
label
|
|
11615
|
+
}) });
|
|
11616
|
+
}),
|
|
11617
|
+
fillReleaseLabels: onCore(async (core, request) => {
|
|
11618
|
+
const body = await request.json().catch(() => ({}));
|
|
11619
|
+
const input = body !== null && typeof body === "object" ? body : {};
|
|
11620
|
+
return json$2({ data: await core.fillReleaseLabels({
|
|
11621
|
+
dryRun: input.dryRun === true,
|
|
11622
|
+
catalogs: input.catalogs !== false
|
|
11623
|
+
}) });
|
|
11624
|
+
}),
|
|
11188
11625
|
updateBundle: onCore(async (core, request, params) => {
|
|
11189
11626
|
const bundleId = requireRouteParam(params, "id");
|
|
11190
11627
|
const update = bundleUpdateOf(await request.json(), bundleId);
|
|
@@ -11411,6 +11848,16 @@ const ADMIN_ROUTES = [
|
|
|
11411
11848
|
path: "/release-scopes",
|
|
11412
11849
|
handler: "listReleaseScopeKeys"
|
|
11413
11850
|
},
|
|
11851
|
+
{
|
|
11852
|
+
method: "GET",
|
|
11853
|
+
path: "/release-labels",
|
|
11854
|
+
handler: "getReleaseByLabel"
|
|
11855
|
+
},
|
|
11856
|
+
{
|
|
11857
|
+
method: "POST",
|
|
11858
|
+
path: "/release-labels/fill",
|
|
11859
|
+
handler: "fillReleaseLabels"
|
|
11860
|
+
},
|
|
11414
11861
|
{
|
|
11415
11862
|
method: "POST",
|
|
11416
11863
|
path: "/release-catalogs/:scopeKey/rebuild",
|
package/dist/init/index.cjs
CHANGED
|
@@ -7883,6 +7883,7 @@ const runInit = async ({ build, envFile, secretsEnv }) => {
|
|
|
7883
7883
|
});
|
|
7884
7884
|
let credential;
|
|
7885
7885
|
try {
|
|
7886
|
+
await (0, _hot_updater_cli_tools.fillReleaseLabels)(server);
|
|
7886
7887
|
credential = await (0, _hot_updater_cli_tools.provisionClientCredential)(server, {
|
|
7887
7888
|
env: initInputEnv,
|
|
7888
7889
|
name: "Azure init"
|
package/dist/init/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { createHash } from "crypto";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import { ConfigBuilder, InitError, assembleServer, createHotUpdaterConfigScaffoldFromBuilder, createZip, getCwd, getHotUpdaterInitInputEnv, getInitProviderEnvVars, getInitProviderTextPromptValues, link, makeEnv, p, printAppSetup, provisionClientCredential, readHotUpdaterInitEnv, resolveInitProviderInputs, shouldAutoSelectOnlyInitResource, writeHotUpdaterFiles } from "@hot-updater/cli-tools";
|
|
4
|
+
import { ConfigBuilder, InitError, assembleServer, createHotUpdaterConfigScaffoldFromBuilder, createZip, fillReleaseLabels, getCwd, getHotUpdaterInitInputEnv, getInitProviderEnvVars, getInitProviderTextPromptValues, link, makeEnv, p, printAppSetup, provisionClientCredential, readHotUpdaterInitEnv, resolveInitProviderInputs, shouldAutoSelectOnlyInitResource, writeHotUpdaterFiles } from "@hot-updater/cli-tools";
|
|
5
5
|
import { apiKeys, insights, remoteConfig } from "@hot-updater/server/plugins";
|
|
6
6
|
import { CosmosClient } from "@azure/cosmos";
|
|
7
7
|
import { SETTINGS_TABLE, createEngineDatabase, createKvAdapter, encodeKvKey, migrateCoreSchema, toolingTargetOf } from "@hot-updater/plugin-core";
|
|
@@ -7878,6 +7878,7 @@ const runInit = async ({ build, envFile, secretsEnv }) => {
|
|
|
7878
7878
|
});
|
|
7879
7879
|
let credential;
|
|
7880
7880
|
try {
|
|
7881
|
+
await fillReleaseLabels(server);
|
|
7881
7882
|
credential = await provisionClientCredential(server, {
|
|
7882
7883
|
env: initInputEnv,
|
|
7883
7884
|
name: "Azure init"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/azure",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.0-rc.
|
|
4
|
+
"version": "1.2.0-rc.51",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": "^22.23.4 || ^24.22.1 || >=26.12.1"
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"@azure/identity": "4.14.0",
|
|
45
45
|
"@azure/keyvault-secrets": "4.11.2",
|
|
46
46
|
"@azure/storage-blob": "12.34.0",
|
|
47
|
-
"@hot-updater/cli-tools": "1.2.0-rc.
|
|
48
|
-
"@hot-updater/plugin-core": "1.2.0-rc.
|
|
49
|
-
"@hot-updater/protocol": "1.2.0-rc.
|
|
50
|
-
"@hot-updater/server": "1.2.0-rc.
|
|
47
|
+
"@hot-updater/cli-tools": "1.2.0-rc.51",
|
|
48
|
+
"@hot-updater/plugin-core": "1.2.0-rc.51",
|
|
49
|
+
"@hot-updater/protocol": "1.2.0-rc.51",
|
|
50
|
+
"@hot-updater/server": "1.2.0-rc.51"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@azure/functions": "4.16.5",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"execa": "9.5.2",
|
|
56
56
|
"jszip": "^3.10.1",
|
|
57
57
|
"vitest": "4.1.4",
|
|
58
|
-
"@hot-updater/test-utils": "1.2.0-rc.
|
|
58
|
+
"@hot-updater/test-utils": "1.2.0-rc.51"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "tsdown",
|