@hot-updater/plugin-core 1.2.0-rc.51 → 1.2.0-rc.53
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/engine/database/fence.cjs +24 -2
- package/dist/engine/database/fence.d.cts +4 -1
- package/dist/engine/database/fence.d.mts +4 -1
- package/dist/engine/database/fence.mjs +24 -3
- package/dist/engine/db/settingsMigrator.cjs +1 -12
- package/dist/engine/db/settingsMigrator.mjs +1 -12
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/releaseCatalogCompiler.cjs +71 -0
- package/dist/releaseCatalogCompiler.d.cts +12 -1
- package/dist/releaseCatalogCompiler.d.mts +12 -1
- package/dist/releaseCatalogCompiler.mjs +71 -1
- package/dist/releaseCatalogMutation.d.cts +2 -2
- package/dist/releaseCatalogMutation.d.mts +2 -2
- package/package.json +2 -2
|
@@ -33,6 +33,23 @@ const SETTINGS_TABLE = {
|
|
|
33
33
|
/** The engine's storage-layout generation; it changes only with a migration. */
|
|
34
34
|
const ENGINE_SCHEMA_KEY = "schema.engine";
|
|
35
35
|
const CORE_SCHEMA_KEY = "schema.core";
|
|
36
|
+
/** Compares dotted numeric versions, such as "1" and "1.2.0"; NaN when either is not one. */
|
|
37
|
+
const compareVersions = (left, right) => {
|
|
38
|
+
const parse = (version) => /^\d+(?:\.\d+)*$/u.test(version) ? version.split(".").map(Number) : [NaN];
|
|
39
|
+
const [a, b] = [parse(left), parse(right)];
|
|
40
|
+
if ([...a, ...b].some(Number.isNaN)) return NaN;
|
|
41
|
+
for (let index = 0; index < Math.max(a.length, b.length); index += 1) {
|
|
42
|
+
const difference = (a[index] ?? 0) - (b[index] ?? 0);
|
|
43
|
+
if (difference !== 0) return difference;
|
|
44
|
+
}
|
|
45
|
+
return 0;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The `schema.core` a newer release recorded, which `hot-updater db migrate`
|
|
49
|
+
* never moves back: the fix is to upgrade, not to migrate.
|
|
50
|
+
*/
|
|
51
|
+
const newerCore = (settings) => settings.find(({ key, expected, found }) => key === CORE_SCHEMA_KEY && found !== null && compareVersions(found, expected) > 0);
|
|
52
|
+
const newerMessage = (adapterName, { key, expected, found }) => `Hot Updater schema setting "${key}" for ${adapterName} is "${found}"; expected "${expected}". The database was migrated by Hot Updater ${found}: upgrade hot-updater and the @hot-updater packages to ${found} or later.`;
|
|
36
53
|
const stored = ({ key, expected, found }) => `"${key}" is ${found === null ? "missing" : `"${found}"`}; expected "${expected}"`;
|
|
37
54
|
/**
|
|
38
55
|
* How to migrate a database the fence refused: doctor names the command for
|
|
@@ -46,7 +63,10 @@ const pluginOf = ({ key }) => key.startsWith("schema.") && key !== "schema.engin
|
|
|
46
63
|
const listed = (items) => items.length < 2 ? items.join("") : `${items.slice(0, -1).join(", ")} and ${items.at(-1)}`;
|
|
47
64
|
const settingsMessage = (adapterName, settings) => `Hot Updater schema settings for ${adapterName} are not migrated: ${settings.map(stored).join(", and ")}. ${MIGRATE_SCHEMA_FIX}`;
|
|
48
65
|
const pluginsMessage = (adapterName, plugins, settings, fix) => `The tables of ${plugins.length === 1 ? "plugin" : "plugins"} ${listed(plugins.map((id) => `"${id}"`))} are not migrated on ${adapterName}: schema ${settings.length === 1 ? "setting" : "settings"} ${settings.map(stored).join(", and ")}. ${fix}`;
|
|
49
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* The database needs `hot-updater db migrate`, a new database, or a newer
|
|
68
|
+
* Hot Updater; the handler answers 503.
|
|
69
|
+
*/
|
|
50
70
|
var HotUpdaterSchemaMigrationRequiredError = class extends Error {
|
|
51
71
|
adapterName;
|
|
52
72
|
currentVersion;
|
|
@@ -61,7 +81,8 @@ var HotUpdaterSchemaMigrationRequiredError = class extends Error {
|
|
|
61
81
|
constructor(adapterName, currentVersion, setting, options) {
|
|
62
82
|
const settings = options?.settings ?? (setting === void 0 ? [] : [setting]);
|
|
63
83
|
const plugins = settings.flatMap((mismatch) => pluginOf(mismatch) ?? []);
|
|
64
|
-
|
|
84
|
+
const newer = newerCore(settings);
|
|
85
|
+
super(newer !== void 0 ? newerMessage(adapterName, newer) : setting === void 0 ? currentVersion === void 0 ? `Hot Updater database schema is not initialized for ${adapterName}. ${MIGRATE_SCHEMA_FIX}` : `Hot Updater v1 cannot migrate schema ${currentVersion} in place. Create a new empty database and run \`hot-updater db migrate\`.` : plugins.length > 0 && plugins.length === settings.length ? pluginsMessage(adapterName, plugins, settings, options?.fix ?? MIGRATE_SCHEMA_FIX) : settings.length > 1 && !(setting.key === "schema.engine" && setting.found === null) ? settingsMessage(adapterName, settings) : settingMessage(adapterName, setting), options?.cause === void 0 ? void 0 : { cause: options.cause });
|
|
65
86
|
this.adapterName = adapterName;
|
|
66
87
|
this.currentVersion = currentVersion;
|
|
67
88
|
this.setting = setting;
|
|
@@ -176,6 +197,7 @@ exports.ENGINE_SCHEMA_KEY = ENGINE_SCHEMA_KEY;
|
|
|
176
197
|
exports.HotUpdaterSchemaMigrationRequiredError = HotUpdaterSchemaMigrationRequiredError;
|
|
177
198
|
exports.SETTINGS_TABLE = SETTINGS_TABLE;
|
|
178
199
|
exports.checkSchemaFence = checkSchemaFence;
|
|
200
|
+
exports.compareVersions = compareVersions;
|
|
179
201
|
exports.fencedName = fencedName;
|
|
180
202
|
exports.isMissingSchemaError = isMissingSchemaError;
|
|
181
203
|
exports.readSettings = readSettings;
|
|
@@ -13,7 +13,10 @@ interface SchemaSettingMismatch {
|
|
|
13
13
|
readonly expected: string;
|
|
14
14
|
readonly found: string | null;
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* The database needs `hot-updater db migrate`, a new database, or a newer
|
|
18
|
+
* Hot Updater; the handler answers 503.
|
|
19
|
+
*/
|
|
17
20
|
declare class HotUpdaterSchemaMigrationRequiredError extends Error {
|
|
18
21
|
readonly adapterName: string;
|
|
19
22
|
readonly currentVersion: string | undefined;
|
|
@@ -13,7 +13,10 @@ interface SchemaSettingMismatch {
|
|
|
13
13
|
readonly expected: string;
|
|
14
14
|
readonly found: string | null;
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* The database needs `hot-updater db migrate`, a new database, or a newer
|
|
18
|
+
* Hot Updater; the handler answers 503.
|
|
19
|
+
*/
|
|
17
20
|
declare class HotUpdaterSchemaMigrationRequiredError extends Error {
|
|
18
21
|
readonly adapterName: string;
|
|
19
22
|
readonly currentVersion: string | undefined;
|
|
@@ -33,6 +33,23 @@ const SETTINGS_TABLE = {
|
|
|
33
33
|
/** The engine's storage-layout generation; it changes only with a migration. */
|
|
34
34
|
const ENGINE_SCHEMA_KEY = "schema.engine";
|
|
35
35
|
const CORE_SCHEMA_KEY = "schema.core";
|
|
36
|
+
/** Compares dotted numeric versions, such as "1" and "1.2.0"; NaN when either is not one. */
|
|
37
|
+
const compareVersions = (left, right) => {
|
|
38
|
+
const parse = (version) => /^\d+(?:\.\d+)*$/u.test(version) ? version.split(".").map(Number) : [NaN];
|
|
39
|
+
const [a, b] = [parse(left), parse(right)];
|
|
40
|
+
if ([...a, ...b].some(Number.isNaN)) return NaN;
|
|
41
|
+
for (let index = 0; index < Math.max(a.length, b.length); index += 1) {
|
|
42
|
+
const difference = (a[index] ?? 0) - (b[index] ?? 0);
|
|
43
|
+
if (difference !== 0) return difference;
|
|
44
|
+
}
|
|
45
|
+
return 0;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The `schema.core` a newer release recorded, which `hot-updater db migrate`
|
|
49
|
+
* never moves back: the fix is to upgrade, not to migrate.
|
|
50
|
+
*/
|
|
51
|
+
const newerCore = (settings) => settings.find(({ key, expected, found }) => key === CORE_SCHEMA_KEY && found !== null && compareVersions(found, expected) > 0);
|
|
52
|
+
const newerMessage = (adapterName, { key, expected, found }) => `Hot Updater schema setting "${key}" for ${adapterName} is "${found}"; expected "${expected}". The database was migrated by Hot Updater ${found}: upgrade hot-updater and the @hot-updater packages to ${found} or later.`;
|
|
36
53
|
const stored = ({ key, expected, found }) => `"${key}" is ${found === null ? "missing" : `"${found}"`}; expected "${expected}"`;
|
|
37
54
|
/**
|
|
38
55
|
* How to migrate a database the fence refused: doctor names the command for
|
|
@@ -46,7 +63,10 @@ const pluginOf = ({ key }) => key.startsWith("schema.") && key !== "schema.engin
|
|
|
46
63
|
const listed = (items) => items.length < 2 ? items.join("") : `${items.slice(0, -1).join(", ")} and ${items.at(-1)}`;
|
|
47
64
|
const settingsMessage = (adapterName, settings) => `Hot Updater schema settings for ${adapterName} are not migrated: ${settings.map(stored).join(", and ")}. ${MIGRATE_SCHEMA_FIX}`;
|
|
48
65
|
const pluginsMessage = (adapterName, plugins, settings, fix) => `The tables of ${plugins.length === 1 ? "plugin" : "plugins"} ${listed(plugins.map((id) => `"${id}"`))} are not migrated on ${adapterName}: schema ${settings.length === 1 ? "setting" : "settings"} ${settings.map(stored).join(", and ")}. ${fix}`;
|
|
49
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* The database needs `hot-updater db migrate`, a new database, or a newer
|
|
68
|
+
* Hot Updater; the handler answers 503.
|
|
69
|
+
*/
|
|
50
70
|
var HotUpdaterSchemaMigrationRequiredError = class extends Error {
|
|
51
71
|
adapterName;
|
|
52
72
|
currentVersion;
|
|
@@ -61,7 +81,8 @@ var HotUpdaterSchemaMigrationRequiredError = class extends Error {
|
|
|
61
81
|
constructor(adapterName, currentVersion, setting, options) {
|
|
62
82
|
const settings = options?.settings ?? (setting === void 0 ? [] : [setting]);
|
|
63
83
|
const plugins = settings.flatMap((mismatch) => pluginOf(mismatch) ?? []);
|
|
64
|
-
|
|
84
|
+
const newer = newerCore(settings);
|
|
85
|
+
super(newer !== void 0 ? newerMessage(adapterName, newer) : setting === void 0 ? currentVersion === void 0 ? `Hot Updater database schema is not initialized for ${adapterName}. ${MIGRATE_SCHEMA_FIX}` : `Hot Updater v1 cannot migrate schema ${currentVersion} in place. Create a new empty database and run \`hot-updater db migrate\`.` : plugins.length > 0 && plugins.length === settings.length ? pluginsMessage(adapterName, plugins, settings, options?.fix ?? MIGRATE_SCHEMA_FIX) : settings.length > 1 && !(setting.key === "schema.engine" && setting.found === null) ? settingsMessage(adapterName, settings) : settingMessage(adapterName, setting), options?.cause === void 0 ? void 0 : { cause: options.cause });
|
|
65
86
|
this.adapterName = adapterName;
|
|
66
87
|
this.currentVersion = currentVersion;
|
|
67
88
|
this.setting = setting;
|
|
@@ -172,4 +193,4 @@ const withSchemaFence = (adapter, adapterName, expected, fix) => {
|
|
|
172
193
|
};
|
|
173
194
|
};
|
|
174
195
|
//#endregion
|
|
175
|
-
export { ENGINE_SCHEMA_KEY, HotUpdaterSchemaMigrationRequiredError, SETTINGS_TABLE, checkSchemaFence, fencedName, isMissingSchemaError, readSettings, withSchemaFence };
|
|
196
|
+
export { ENGINE_SCHEMA_KEY, HotUpdaterSchemaMigrationRequiredError, SETTINGS_TABLE, checkSchemaFence, compareVersions, fencedName, isMissingSchemaError, readSettings, withSchemaFence };
|
|
@@ -36,17 +36,6 @@ const refuseV0Database = (adapterName, stored) => {
|
|
|
36
36
|
if (typeof version !== "string" || stored.has("schema.engine")) return;
|
|
37
37
|
throw new require_fence.HotUpdaterSchemaMigrationRequiredError(adapterName, version);
|
|
38
38
|
};
|
|
39
|
-
/** Compares dotted numeric versions, such as "1" and "1.2.0"; NaN when either is not one. */
|
|
40
|
-
const compareVersions = (left, right) => {
|
|
41
|
-
const parse = (version) => /^\d+(?:\.\d+)*$/u.test(version) ? version.split(".").map(Number) : [NaN];
|
|
42
|
-
const [a, b] = [parse(left), parse(right)];
|
|
43
|
-
if ([...a, ...b].some(Number.isNaN)) return NaN;
|
|
44
|
-
for (let index = 0; index < Math.max(a.length, b.length); index += 1) {
|
|
45
|
-
const difference = (a[index] ?? 0) - (b[index] ?? 0);
|
|
46
|
-
if (difference !== 0) return difference;
|
|
47
|
-
}
|
|
48
|
-
return 0;
|
|
49
|
-
};
|
|
50
39
|
/**
|
|
51
40
|
* The settings whose versions only move forward when a `ToolingTarget` names
|
|
52
41
|
* none. `schema.engine` is a storage layout, not a release: a store refuses
|
|
@@ -66,7 +55,7 @@ const refuseNewerSchema = (adapterName, stored, settings, ordered = DEFAULT_ORDE
|
|
|
66
55
|
const newer = ordered.flatMap((key) => {
|
|
67
56
|
const found = stored.get(key);
|
|
68
57
|
const expected = settings[key];
|
|
69
|
-
return typeof found === "string" && expected !== void 0 && compareVersions(found, expected) > 0 ? [{
|
|
58
|
+
return typeof found === "string" && expected !== void 0 && require_fence.compareVersions(found, expected) > 0 ? [{
|
|
70
59
|
key,
|
|
71
60
|
found,
|
|
72
61
|
expected
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HOT_UPDATER_SCHEMA_VERSION } from "../core/schema.mjs";
|
|
2
|
-
import { HotUpdaterSchemaMigrationRequiredError, SETTINGS_TABLE, isMissingSchemaError } from "../database/fence.mjs";
|
|
2
|
+
import { HotUpdaterSchemaMigrationRequiredError, SETTINGS_TABLE, compareVersions, isMissingSchemaError } from "../database/fence.mjs";
|
|
3
3
|
import { getEmptyMigrationResult } from "./fixedMigratorShared.mjs";
|
|
4
4
|
import { quoteSql } from "../database/sql/sqlSchema.mjs";
|
|
5
5
|
import { settingsStatements } from "./engineSql.mjs";
|
|
@@ -36,17 +36,6 @@ const refuseV0Database = (adapterName, stored) => {
|
|
|
36
36
|
if (typeof version !== "string" || stored.has("schema.engine")) return;
|
|
37
37
|
throw new HotUpdaterSchemaMigrationRequiredError(adapterName, version);
|
|
38
38
|
};
|
|
39
|
-
/** Compares dotted numeric versions, such as "1" and "1.2.0"; NaN when either is not one. */
|
|
40
|
-
const compareVersions = (left, right) => {
|
|
41
|
-
const parse = (version) => /^\d+(?:\.\d+)*$/u.test(version) ? version.split(".").map(Number) : [NaN];
|
|
42
|
-
const [a, b] = [parse(left), parse(right)];
|
|
43
|
-
if ([...a, ...b].some(Number.isNaN)) return NaN;
|
|
44
|
-
for (let index = 0; index < Math.max(a.length, b.length); index += 1) {
|
|
45
|
-
const difference = (a[index] ?? 0) - (b[index] ?? 0);
|
|
46
|
-
if (difference !== 0) return difference;
|
|
47
|
-
}
|
|
48
|
-
return 0;
|
|
49
|
-
};
|
|
50
39
|
/**
|
|
51
40
|
* The settings whose versions only move forward when a `ToolingTarget` names
|
|
52
41
|
* none. `schema.engine` is a storage layout, not a release: a store refuses
|
package/dist/index.cjs
CHANGED
|
@@ -136,6 +136,7 @@ exports.parseStorageUri = require_parseStorageUri.parseStorageUri;
|
|
|
136
136
|
exports.projectCompiledCatalog = require_releaseCatalogCompiler.projectCompiledCatalog;
|
|
137
137
|
exports.projectCompiledRollbackCatalog = require_releaseCatalogCompiler.projectCompiledRollbackCatalog;
|
|
138
138
|
exports.quoteSql = require_sqlSchema.quoteSql;
|
|
139
|
+
exports.readCompiledCatalogPayload = require_releaseCatalogCompiler.readCompiledCatalogPayload;
|
|
139
140
|
exports.referenceCompatibleReleases = require_releaseCatalogCompiler.referenceCompatibleReleases;
|
|
140
141
|
exports.releaseRowToRelease = require_databaseRows.releaseRowToRelease;
|
|
141
142
|
exports.releaseToRow = require_databaseRows.releaseToRow;
|
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWith
|
|
|
2
2
|
import { createStorageUriWithRelativePath, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri } from "./assetStorageLayout.cjs";
|
|
3
3
|
import { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath, isContentAddressedAssetFileHash } from "./contentAddressedAssets.cjs";
|
|
4
4
|
import { getContentType } from "./contentType.cjs";
|
|
5
|
-
import { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases } from "./releaseCatalogCompiler.cjs";
|
|
5
|
+
import { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, readCompiledCatalogPayload, referenceCompatibleReleases } from "./releaseCatalogCompiler.cjs";
|
|
6
6
|
import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, IosDeviceRow, IosDeviceStatus, NativeBuildArtifactKind, NativeBuildExportMethod, NativeBuildRow, NativeBuildSubmissionDestination, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.cjs";
|
|
7
7
|
import { CoreReads, ReleaseCatalogRequest } from "./serverPlugin/coreReads.cjs";
|
|
8
8
|
import { DATABASE_VERSION_COLUMN, DatabaseAdapter, DatabaseJson, DatabaseKey, DatabaseKeyValue, DatabaseSchemaError, DatabaseValue, PhysicalColumn, PhysicalColumnType, PhysicalIndex, PhysicalRetention, PhysicalTable, QueryBound, QueryRequest, StoredRow, WriteGuard, WriteOp, WriteResult, expiresAt, findPhysicalColumn, findPhysicalIndex, indexOrderColumns, rowKey } from "./database/adapter.cjs";
|
|
@@ -51,4 +51,4 @@ import { EngineSqlOptions, generateEngineSql, lateColumnStatements } from "./eng
|
|
|
51
51
|
import { EngineSqlMigratorOptions, createEngineSqlMigrator } from "./engine/db/engineSqlMigrator.cjs";
|
|
52
52
|
import { writeSchemaSettings } from "./engine/db/schemaSettings.cjs";
|
|
53
53
|
import { createSettingsMigrator } from "./engine/db/settingsMigrator.cjs";
|
|
54
|
-
export { type AggregateBatching, type AggregateChanges, type AggregateDefinition, type AggregateIdentity, type AggregateRow, type AnyHotUpdaterPlugin, ApplePlatform, BUNDLE_STORAGE_PREFIX, type BaseCandidateQuery, type BaseCandidateTarget, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, BuiltIns, type Bundle, type BundleDeployment, type BundleDetail, type BundlePatchRow, type BundleRow, BundleRowHydrationError, BundleRowHydrationErrorReason, type BundleRowUpdate, CONTENT_ADDRESSED_ASSET_PREFIX, CatalogVersionBound, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, type ClientAuth, CompiledCatalogSegment, CompiledReleaseCatalog, ConfigInput, type ConfiguredDatabase, type ConstraintReason, type CoreReader, type CoreReads, type CoreSchema, type CreateRow, CreateStorageAdapterOptions, CreateStorageUriInput, DATABASE_VERSION_COLUMN, type DatabaseAdapter, DatabaseAdapterContractError, DatabaseAdapterInputError, type DatabaseAdapterInputErrorCode, DatabaseAmbiguousCommitError, type DatabaseBundleMetadata, DatabaseBundleNotFoundError, DatabaseConflictError, DatabaseConstraintError, DatabaseCursorError, type DatabaseJson, type DatabaseJsonObject, type DatabaseJsonValue, type DatabaseKey, type DatabaseKeyValue, DatabaseQueryError, type DatabaseReadCount, type DatabaseReadMeter, DatabaseRowReferencedError, DatabaseSchemaError, type DatabaseTooling, DatabaseTransactionError, type DatabaseValue, type DeployReleasePolicy, type Deployment, type DerivedDefinition, type DerivedFields, type Engine, type EngineColumns, type EngineDatabase, type EngineDatabaseOptions, type EngineOptions, type EngineReadCount, type EngineSqlMigratorOptions, type EngineSqlOptions, type FieldDefinition, type FieldReference, type FieldType, type FieldValue, type FindAggregatesModel, type FindManyModel, FingerprintExtraSources, HasMultipleCallSignatures, HotUpdaterConfigError, type HotUpdaterCoreApi, type HotUpdaterDatabase, type HotUpdaterPlugin, HotUpdaterSchemaMigrationRequiredError, type HotUpdaterTransaction, type IndexDefinition, IosBuildDestination, type IosDeviceAccount, type IosDeviceAccountClaim, type IosDeviceOutcome, type IosDeviceOutcomeInput, type IosDeviceRequestResult, type IosDeviceRow, type IosDeviceStatus, type KeyLookup, type KeyValueStore, type KeysetInput, type KvAdapterOptions, type KvCondition, type KvItem, type KvKey, type KvOp, type KvRange, Lazy, LocalSigningConfig, type Lookup, type MemoryAdapterOptions, type MeteredDatabase, type MigrateOptions, type MigrationResult, type Migrator, type ModelDefinition, type ModuleSchema, NativeBuildAndroidScheme, NativeBuildArgs, type NativeBuildArtifactKind, type NativeBuildDeleteResult, type NativeBuildDistribution, type NativeBuildExportMethod, NativeBuildIosScheme, type NativeBuildMarkResult, NativeBuildOptions, type NativeBuildRegistration, type NativeBuildRow, NativeBuildSandboxOptions, type NativeBuildSandboxScope, type NativeBuildScope, type NativeBuildSubmissionDestination, NativeFingerprint, NativeFingerprintOptions, NativeFingerprintProvider, NativeFingerprintSource, type NormalizeOptions, type Page, ParsedStorageUri, type PhysicalColumn, type PhysicalColumnType, type PhysicalIndex, type PhysicalRetention, type PhysicalTable, type Platform, PlatformConfig, type PluginApis, type PluginCli, type PluginClientCredential, type PluginClientPlugin, type PluginContext, type PluginEndpoint, type PluginEndpointMethod, type PluginInstance, type PluginProvides, type PluginTables, Primitive, PromoteReleaseResult, type QueryBound, type QueryRequest, type ReadMeasurement, type ReadOptions, type ReadRow, type ReferenceAction, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, ReleaseCatalogMutationError, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, type ReleaseCatalogRequest, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, ReleaseCatalogScope, type ReleaseFilter, type ReleaseLabelFill, ReleaseManagementError, ReleasePolicyPatch, type ReleaseRow, type ReleaseRowUpdate, type ReleaseTarget, type RemoteDatabase, RequiredDeep, type ResolvedModel, type ResolvedSchema, type RetentionDefinition, type RetryOptions, type RowOf, SETTINGS_TABLE, type SchemaGenerator, type SchemaSettings, SecretRef, SecretsAdapter, SecretsContext, SigningConfig, type SqlAdapterOptions, type SqlColumnShape, type SqlConnection, type SqlDialect, type SqlExecutor, type SqlResult, type SqlStatement, type SqlTableShape, StorageAdapter, StorageAdapterWith, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StorageOperation, StoragePutInput, StoragePutResult, type StoredBundleDeployment, type StoredRow, type TableDefinition, type TableRow, type ToolingDatabase, type ToolingTarget, type UpdateSet, type VerifiedDatabaseAdapter, type VerifyAdapterOptions, WRITE_GUARD_TABLE, type WriteGuard, type WriteOp, type WriteResult, addDistinct, aggregateBatchingTables, assertStorageOperations, bundleToPatchRows, bundleToRow, canonicalizeAppVersion, compareUtf8, compileReleaseCatalog, coreSchema, coreSettings, coreTarget, countDistinct, createBundleStorageKey, createEngine, createEngineDatabase, createEngineSqlMigrator, createKvAdapter, createMemoryAdapter, createSettingsMigrator, createSqlAdapter, createStorageAdapter, createStorageKeyBuilder, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createTableStatements, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, defineAggregate, definePlugin, defineTable, encodeKvKey, expiresAt, extractTimestampFromUUIDv7, findPhysicalColumn, findPhysicalIndex, generateEngineSql, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, indexOrderColumns, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBusyError, isDatabaseJsonObject, isDatabaseMetadataObject, isMultiIndex, isRemoteDatabase, isUUIDv7, lateColumnStatements, mergeDistinct, meterReads, migrateCoreSchema, normalizeStoredRow, parseBaseCandidateKey, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, quoteSql, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, replaceStorageUriKeySuffix, resolveLazy, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowKey, rowToBundle, rowsToBundles, semverSatisfies, sqlTableShapes, supportedIosPlatforms, targetBaseCandidateKey, toolingTargetOf, verifyAdapter, writeSchemaSettings };
|
|
54
|
+
export { type AggregateBatching, type AggregateChanges, type AggregateDefinition, type AggregateIdentity, type AggregateRow, type AnyHotUpdaterPlugin, ApplePlatform, BUNDLE_STORAGE_PREFIX, type BaseCandidateQuery, type BaseCandidateTarget, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, BuiltIns, type Bundle, type BundleDeployment, type BundleDetail, type BundlePatchRow, type BundleRow, BundleRowHydrationError, BundleRowHydrationErrorReason, type BundleRowUpdate, CONTENT_ADDRESSED_ASSET_PREFIX, CatalogVersionBound, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, type ClientAuth, CompiledCatalogSegment, CompiledReleaseCatalog, ConfigInput, type ConfiguredDatabase, type ConstraintReason, type CoreReader, type CoreReads, type CoreSchema, type CreateRow, CreateStorageAdapterOptions, CreateStorageUriInput, DATABASE_VERSION_COLUMN, type DatabaseAdapter, DatabaseAdapterContractError, DatabaseAdapterInputError, type DatabaseAdapterInputErrorCode, DatabaseAmbiguousCommitError, type DatabaseBundleMetadata, DatabaseBundleNotFoundError, DatabaseConflictError, DatabaseConstraintError, DatabaseCursorError, type DatabaseJson, type DatabaseJsonObject, type DatabaseJsonValue, type DatabaseKey, type DatabaseKeyValue, DatabaseQueryError, type DatabaseReadCount, type DatabaseReadMeter, DatabaseRowReferencedError, DatabaseSchemaError, type DatabaseTooling, DatabaseTransactionError, type DatabaseValue, type DeployReleasePolicy, type Deployment, type DerivedDefinition, type DerivedFields, type Engine, type EngineColumns, type EngineDatabase, type EngineDatabaseOptions, type EngineOptions, type EngineReadCount, type EngineSqlMigratorOptions, type EngineSqlOptions, type FieldDefinition, type FieldReference, type FieldType, type FieldValue, type FindAggregatesModel, type FindManyModel, FingerprintExtraSources, HasMultipleCallSignatures, HotUpdaterConfigError, type HotUpdaterCoreApi, type HotUpdaterDatabase, type HotUpdaterPlugin, HotUpdaterSchemaMigrationRequiredError, type HotUpdaterTransaction, type IndexDefinition, IosBuildDestination, type IosDeviceAccount, type IosDeviceAccountClaim, type IosDeviceOutcome, type IosDeviceOutcomeInput, type IosDeviceRequestResult, type IosDeviceRow, type IosDeviceStatus, type KeyLookup, type KeyValueStore, type KeysetInput, type KvAdapterOptions, type KvCondition, type KvItem, type KvKey, type KvOp, type KvRange, Lazy, LocalSigningConfig, type Lookup, type MemoryAdapterOptions, type MeteredDatabase, type MigrateOptions, type MigrationResult, type Migrator, type ModelDefinition, type ModuleSchema, NativeBuildAndroidScheme, NativeBuildArgs, type NativeBuildArtifactKind, type NativeBuildDeleteResult, type NativeBuildDistribution, type NativeBuildExportMethod, NativeBuildIosScheme, type NativeBuildMarkResult, NativeBuildOptions, type NativeBuildRegistration, type NativeBuildRow, NativeBuildSandboxOptions, type NativeBuildSandboxScope, type NativeBuildScope, type NativeBuildSubmissionDestination, NativeFingerprint, NativeFingerprintOptions, NativeFingerprintProvider, NativeFingerprintSource, type NormalizeOptions, type Page, ParsedStorageUri, type PhysicalColumn, type PhysicalColumnType, type PhysicalIndex, type PhysicalRetention, type PhysicalTable, type Platform, PlatformConfig, type PluginApis, type PluginCli, type PluginClientCredential, type PluginClientPlugin, type PluginContext, type PluginEndpoint, type PluginEndpointMethod, type PluginInstance, type PluginProvides, type PluginTables, Primitive, PromoteReleaseResult, type QueryBound, type QueryRequest, type ReadMeasurement, type ReadOptions, type ReadRow, type ReferenceAction, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, ReleaseCatalogMutationError, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, type ReleaseCatalogRequest, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, ReleaseCatalogScope, type ReleaseFilter, type ReleaseLabelFill, ReleaseManagementError, ReleasePolicyPatch, type ReleaseRow, type ReleaseRowUpdate, type ReleaseTarget, type RemoteDatabase, RequiredDeep, type ResolvedModel, type ResolvedSchema, type RetentionDefinition, type RetryOptions, type RowOf, SETTINGS_TABLE, type SchemaGenerator, type SchemaSettings, SecretRef, SecretsAdapter, SecretsContext, SigningConfig, type SqlAdapterOptions, type SqlColumnShape, type SqlConnection, type SqlDialect, type SqlExecutor, type SqlResult, type SqlStatement, type SqlTableShape, StorageAdapter, StorageAdapterWith, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StorageOperation, StoragePutInput, StoragePutResult, type StoredBundleDeployment, type StoredRow, type TableDefinition, type TableRow, type ToolingDatabase, type ToolingTarget, type UpdateSet, type VerifiedDatabaseAdapter, type VerifyAdapterOptions, WRITE_GUARD_TABLE, type WriteGuard, type WriteOp, type WriteResult, addDistinct, aggregateBatchingTables, assertStorageOperations, bundleToPatchRows, bundleToRow, canonicalizeAppVersion, compareUtf8, compileReleaseCatalog, coreSchema, coreSettings, coreTarget, countDistinct, createBundleStorageKey, createEngine, createEngineDatabase, createEngineSqlMigrator, createKvAdapter, createMemoryAdapter, createSettingsMigrator, createSqlAdapter, createStorageAdapter, createStorageKeyBuilder, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createTableStatements, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, defineAggregate, definePlugin, defineTable, encodeKvKey, expiresAt, extractTimestampFromUUIDv7, findPhysicalColumn, findPhysicalIndex, generateEngineSql, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, indexOrderColumns, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBusyError, isDatabaseJsonObject, isDatabaseMetadataObject, isMultiIndex, isRemoteDatabase, isUUIDv7, lateColumnStatements, mergeDistinct, meterReads, migrateCoreSchema, normalizeStoredRow, parseBaseCandidateKey, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, quoteSql, readCompiledCatalogPayload, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, replaceStorageUriKeySuffix, resolveLazy, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowKey, rowToBundle, rowsToBundles, semverSatisfies, sqlTableShapes, supportedIosPlatforms, targetBaseCandidateKey, toolingTargetOf, verifyAdapter, writeSchemaSettings };
|
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWith
|
|
|
2
2
|
import { createStorageUriWithRelativePath, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri } from "./assetStorageLayout.mjs";
|
|
3
3
|
import { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath, isContentAddressedAssetFileHash } from "./contentAddressedAssets.mjs";
|
|
4
4
|
import { getContentType } from "./contentType.mjs";
|
|
5
|
-
import { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases } from "./releaseCatalogCompiler.mjs";
|
|
5
|
+
import { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, readCompiledCatalogPayload, referenceCompatibleReleases } from "./releaseCatalogCompiler.mjs";
|
|
6
6
|
import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, IosDeviceRow, IosDeviceStatus, NativeBuildArtifactKind, NativeBuildExportMethod, NativeBuildRow, NativeBuildSubmissionDestination, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.mjs";
|
|
7
7
|
import { CoreReads, ReleaseCatalogRequest } from "./serverPlugin/coreReads.mjs";
|
|
8
8
|
import { DATABASE_VERSION_COLUMN, DatabaseAdapter, DatabaseJson, DatabaseKey, DatabaseKeyValue, DatabaseSchemaError, DatabaseValue, PhysicalColumn, PhysicalColumnType, PhysicalIndex, PhysicalRetention, PhysicalTable, QueryBound, QueryRequest, StoredRow, WriteGuard, WriteOp, WriteResult, expiresAt, findPhysicalColumn, findPhysicalIndex, indexOrderColumns, rowKey } from "./database/adapter.mjs";
|
|
@@ -51,4 +51,4 @@ import { EngineSqlOptions, generateEngineSql, lateColumnStatements } from "./eng
|
|
|
51
51
|
import { EngineSqlMigratorOptions, createEngineSqlMigrator } from "./engine/db/engineSqlMigrator.mjs";
|
|
52
52
|
import { writeSchemaSettings } from "./engine/db/schemaSettings.mjs";
|
|
53
53
|
import { createSettingsMigrator } from "./engine/db/settingsMigrator.mjs";
|
|
54
|
-
export { type AggregateBatching, type AggregateChanges, type AggregateDefinition, type AggregateIdentity, type AggregateRow, type AnyHotUpdaterPlugin, ApplePlatform, BUNDLE_STORAGE_PREFIX, type BaseCandidateQuery, type BaseCandidateTarget, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, BuiltIns, type Bundle, type BundleDeployment, type BundleDetail, type BundlePatchRow, type BundleRow, BundleRowHydrationError, BundleRowHydrationErrorReason, type BundleRowUpdate, CONTENT_ADDRESSED_ASSET_PREFIX, CatalogVersionBound, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, type ClientAuth, CompiledCatalogSegment, CompiledReleaseCatalog, ConfigInput, type ConfiguredDatabase, type ConstraintReason, type CoreReader, type CoreReads, type CoreSchema, type CreateRow, CreateStorageAdapterOptions, CreateStorageUriInput, DATABASE_VERSION_COLUMN, type DatabaseAdapter, DatabaseAdapterContractError, DatabaseAdapterInputError, type DatabaseAdapterInputErrorCode, DatabaseAmbiguousCommitError, type DatabaseBundleMetadata, DatabaseBundleNotFoundError, DatabaseConflictError, DatabaseConstraintError, DatabaseCursorError, type DatabaseJson, type DatabaseJsonObject, type DatabaseJsonValue, type DatabaseKey, type DatabaseKeyValue, DatabaseQueryError, type DatabaseReadCount, type DatabaseReadMeter, DatabaseRowReferencedError, DatabaseSchemaError, type DatabaseTooling, DatabaseTransactionError, type DatabaseValue, type DeployReleasePolicy, type Deployment, type DerivedDefinition, type DerivedFields, type Engine, type EngineColumns, type EngineDatabase, type EngineDatabaseOptions, type EngineOptions, type EngineReadCount, type EngineSqlMigratorOptions, type EngineSqlOptions, type FieldDefinition, type FieldReference, type FieldType, type FieldValue, type FindAggregatesModel, type FindManyModel, FingerprintExtraSources, HasMultipleCallSignatures, HotUpdaterConfigError, type HotUpdaterCoreApi, type HotUpdaterDatabase, type HotUpdaterPlugin, HotUpdaterSchemaMigrationRequiredError, type HotUpdaterTransaction, type IndexDefinition, IosBuildDestination, type IosDeviceAccount, type IosDeviceAccountClaim, type IosDeviceOutcome, type IosDeviceOutcomeInput, type IosDeviceRequestResult, type IosDeviceRow, type IosDeviceStatus, type KeyLookup, type KeyValueStore, type KeysetInput, type KvAdapterOptions, type KvCondition, type KvItem, type KvKey, type KvOp, type KvRange, Lazy, LocalSigningConfig, type Lookup, type MemoryAdapterOptions, type MeteredDatabase, type MigrateOptions, type MigrationResult, type Migrator, type ModelDefinition, type ModuleSchema, NativeBuildAndroidScheme, NativeBuildArgs, type NativeBuildArtifactKind, type NativeBuildDeleteResult, type NativeBuildDistribution, type NativeBuildExportMethod, NativeBuildIosScheme, type NativeBuildMarkResult, NativeBuildOptions, type NativeBuildRegistration, type NativeBuildRow, NativeBuildSandboxOptions, type NativeBuildSandboxScope, type NativeBuildScope, type NativeBuildSubmissionDestination, NativeFingerprint, NativeFingerprintOptions, NativeFingerprintProvider, NativeFingerprintSource, type NormalizeOptions, type Page, ParsedStorageUri, type PhysicalColumn, type PhysicalColumnType, type PhysicalIndex, type PhysicalRetention, type PhysicalTable, type Platform, PlatformConfig, type PluginApis, type PluginCli, type PluginClientCredential, type PluginClientPlugin, type PluginContext, type PluginEndpoint, type PluginEndpointMethod, type PluginInstance, type PluginProvides, type PluginTables, Primitive, PromoteReleaseResult, type QueryBound, type QueryRequest, type ReadMeasurement, type ReadOptions, type ReadRow, type ReferenceAction, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, ReleaseCatalogMutationError, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, type ReleaseCatalogRequest, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, ReleaseCatalogScope, type ReleaseFilter, type ReleaseLabelFill, ReleaseManagementError, ReleasePolicyPatch, type ReleaseRow, type ReleaseRowUpdate, type ReleaseTarget, type RemoteDatabase, RequiredDeep, type ResolvedModel, type ResolvedSchema, type RetentionDefinition, type RetryOptions, type RowOf, SETTINGS_TABLE, type SchemaGenerator, type SchemaSettings, SecretRef, SecretsAdapter, SecretsContext, SigningConfig, type SqlAdapterOptions, type SqlColumnShape, type SqlConnection, type SqlDialect, type SqlExecutor, type SqlResult, type SqlStatement, type SqlTableShape, StorageAdapter, StorageAdapterWith, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StorageOperation, StoragePutInput, StoragePutResult, type StoredBundleDeployment, type StoredRow, type TableDefinition, type TableRow, type ToolingDatabase, type ToolingTarget, type UpdateSet, type VerifiedDatabaseAdapter, type VerifyAdapterOptions, WRITE_GUARD_TABLE, type WriteGuard, type WriteOp, type WriteResult, addDistinct, aggregateBatchingTables, assertStorageOperations, bundleToPatchRows, bundleToRow, canonicalizeAppVersion, compareUtf8, compileReleaseCatalog, coreSchema, coreSettings, coreTarget, countDistinct, createBundleStorageKey, createEngine, createEngineDatabase, createEngineSqlMigrator, createKvAdapter, createMemoryAdapter, createSettingsMigrator, createSqlAdapter, createStorageAdapter, createStorageKeyBuilder, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createTableStatements, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, defineAggregate, definePlugin, defineTable, encodeKvKey, expiresAt, extractTimestampFromUUIDv7, findPhysicalColumn, findPhysicalIndex, generateEngineSql, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, indexOrderColumns, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBusyError, isDatabaseJsonObject, isDatabaseMetadataObject, isMultiIndex, isRemoteDatabase, isUUIDv7, lateColumnStatements, mergeDistinct, meterReads, migrateCoreSchema, normalizeStoredRow, parseBaseCandidateKey, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, quoteSql, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, replaceStorageUriKeySuffix, resolveLazy, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowKey, rowToBundle, rowsToBundles, semverSatisfies, sqlTableShapes, supportedIosPlatforms, targetBaseCandidateKey, toolingTargetOf, verifyAdapter, writeSchemaSettings };
|
|
54
|
+
export { type AggregateBatching, type AggregateChanges, type AggregateDefinition, type AggregateIdentity, type AggregateRow, type AnyHotUpdaterPlugin, ApplePlatform, BUNDLE_STORAGE_PREFIX, type BaseCandidateQuery, type BaseCandidateTarget, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, BuiltIns, type Bundle, type BundleDeployment, type BundleDetail, type BundlePatchRow, type BundleRow, BundleRowHydrationError, BundleRowHydrationErrorReason, type BundleRowUpdate, CONTENT_ADDRESSED_ASSET_PREFIX, CatalogVersionBound, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, type ClientAuth, CompiledCatalogSegment, CompiledReleaseCatalog, ConfigInput, type ConfiguredDatabase, type ConstraintReason, type CoreReader, type CoreReads, type CoreSchema, type CreateRow, CreateStorageAdapterOptions, CreateStorageUriInput, DATABASE_VERSION_COLUMN, type DatabaseAdapter, DatabaseAdapterContractError, DatabaseAdapterInputError, type DatabaseAdapterInputErrorCode, DatabaseAmbiguousCommitError, type DatabaseBundleMetadata, DatabaseBundleNotFoundError, DatabaseConflictError, DatabaseConstraintError, DatabaseCursorError, type DatabaseJson, type DatabaseJsonObject, type DatabaseJsonValue, type DatabaseKey, type DatabaseKeyValue, DatabaseQueryError, type DatabaseReadCount, type DatabaseReadMeter, DatabaseRowReferencedError, DatabaseSchemaError, type DatabaseTooling, DatabaseTransactionError, type DatabaseValue, type DeployReleasePolicy, type Deployment, type DerivedDefinition, type DerivedFields, type Engine, type EngineColumns, type EngineDatabase, type EngineDatabaseOptions, type EngineOptions, type EngineReadCount, type EngineSqlMigratorOptions, type EngineSqlOptions, type FieldDefinition, type FieldReference, type FieldType, type FieldValue, type FindAggregatesModel, type FindManyModel, FingerprintExtraSources, HasMultipleCallSignatures, HotUpdaterConfigError, type HotUpdaterCoreApi, type HotUpdaterDatabase, type HotUpdaterPlugin, HotUpdaterSchemaMigrationRequiredError, type HotUpdaterTransaction, type IndexDefinition, IosBuildDestination, type IosDeviceAccount, type IosDeviceAccountClaim, type IosDeviceOutcome, type IosDeviceOutcomeInput, type IosDeviceRequestResult, type IosDeviceRow, type IosDeviceStatus, type KeyLookup, type KeyValueStore, type KeysetInput, type KvAdapterOptions, type KvCondition, type KvItem, type KvKey, type KvOp, type KvRange, Lazy, LocalSigningConfig, type Lookup, type MemoryAdapterOptions, type MeteredDatabase, type MigrateOptions, type MigrationResult, type Migrator, type ModelDefinition, type ModuleSchema, NativeBuildAndroidScheme, NativeBuildArgs, type NativeBuildArtifactKind, type NativeBuildDeleteResult, type NativeBuildDistribution, type NativeBuildExportMethod, NativeBuildIosScheme, type NativeBuildMarkResult, NativeBuildOptions, type NativeBuildRegistration, type NativeBuildRow, NativeBuildSandboxOptions, type NativeBuildSandboxScope, type NativeBuildScope, type NativeBuildSubmissionDestination, NativeFingerprint, NativeFingerprintOptions, NativeFingerprintProvider, NativeFingerprintSource, type NormalizeOptions, type Page, ParsedStorageUri, type PhysicalColumn, type PhysicalColumnType, type PhysicalIndex, type PhysicalRetention, type PhysicalTable, type Platform, PlatformConfig, type PluginApis, type PluginCli, type PluginClientCredential, type PluginClientPlugin, type PluginContext, type PluginEndpoint, type PluginEndpointMethod, type PluginInstance, type PluginProvides, type PluginTables, Primitive, PromoteReleaseResult, type QueryBound, type QueryRequest, type ReadMeasurement, type ReadOptions, type ReadRow, type ReferenceAction, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, ReleaseCatalogMutationError, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, type ReleaseCatalogRequest, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, ReleaseCatalogScope, type ReleaseFilter, type ReleaseLabelFill, ReleaseManagementError, ReleasePolicyPatch, type ReleaseRow, type ReleaseRowUpdate, type ReleaseTarget, type RemoteDatabase, RequiredDeep, type ResolvedModel, type ResolvedSchema, type RetentionDefinition, type RetryOptions, type RowOf, SETTINGS_TABLE, type SchemaGenerator, type SchemaSettings, SecretRef, SecretsAdapter, SecretsContext, SigningConfig, type SqlAdapterOptions, type SqlColumnShape, type SqlConnection, type SqlDialect, type SqlExecutor, type SqlResult, type SqlStatement, type SqlTableShape, StorageAdapter, StorageAdapterWith, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StorageOperation, StoragePutInput, StoragePutResult, type StoredBundleDeployment, type StoredRow, type TableDefinition, type TableRow, type ToolingDatabase, type ToolingTarget, type UpdateSet, type VerifiedDatabaseAdapter, type VerifyAdapterOptions, WRITE_GUARD_TABLE, type WriteGuard, type WriteOp, type WriteResult, addDistinct, aggregateBatchingTables, assertStorageOperations, bundleToPatchRows, bundleToRow, canonicalizeAppVersion, compareUtf8, compileReleaseCatalog, coreSchema, coreSettings, coreTarget, countDistinct, createBundleStorageKey, createEngine, createEngineDatabase, createEngineSqlMigrator, createKvAdapter, createMemoryAdapter, createSettingsMigrator, createSqlAdapter, createStorageAdapter, createStorageKeyBuilder, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createTableStatements, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, defineAggregate, definePlugin, defineTable, encodeKvKey, expiresAt, extractTimestampFromUUIDv7, findPhysicalColumn, findPhysicalIndex, generateEngineSql, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, indexOrderColumns, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBusyError, isDatabaseJsonObject, isDatabaseMetadataObject, isMultiIndex, isRemoteDatabase, isUUIDv7, lateColumnStatements, mergeDistinct, meterReads, migrateCoreSchema, normalizeStoredRow, parseBaseCandidateKey, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, quoteSql, readCompiledCatalogPayload, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, replaceStorageUriKeySuffix, resolveLazy, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowKey, rowToBundle, rowsToBundles, semverSatisfies, sqlTableShapes, supportedIosPlatforms, targetBaseCandidateKey, toolingTargetOf, verifyAdapter, writeSchemaSettings };
|
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { isDatabaseJsonObject, isDatabaseMetadataObject } from "./databaseJsonVa
|
|
|
10
10
|
import { BundleRowHydrationError, BundleRowHydrationErrorReason, bundleToPatchRows, bundleToRow, releaseRowToRelease, releaseToRow, rowToBundle, rowsToBundles } from "./databaseRows.mjs";
|
|
11
11
|
import { generateMinBundleId } from "./generateMinBundleId.mjs";
|
|
12
12
|
import { createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7, isUUIDv7 } from "./uuidv7.mjs";
|
|
13
|
-
import { ReleaseCatalogCompilationError, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases } from "./releaseCatalogCompiler.mjs";
|
|
13
|
+
import { ReleaseCatalogCompilationError, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, readCompiledCatalogPayload, referenceCompatibleReleases } from "./releaseCatalogCompiler.mjs";
|
|
14
14
|
import { ReleaseManagementError } from "./releaseManagement.mjs";
|
|
15
15
|
import { ReleaseCatalogMutationError } from "./releaseCatalogMutation.mjs";
|
|
16
16
|
import { semverSatisfies } from "./semverSatisfies.mjs";
|
|
@@ -38,4 +38,4 @@ import { createEngine } from "./engine/createEngine.mjs";
|
|
|
38
38
|
import { createKvAdapter, encodeKvKey } from "./engine/database/kv/kvAdapter.mjs";
|
|
39
39
|
import { WRITE_GUARD_TABLE, createSqlAdapter } from "./engine/database/sql/sqlAdapter.mjs";
|
|
40
40
|
import { createEngineSqlMigrator } from "./engine/db/engineSqlMigrator.mjs";
|
|
41
|
-
export { BUNDLE_STORAGE_PREFIX, BundleRowHydrationError, BundleRowHydrationErrorReason, CONTENT_ADDRESSED_ASSET_PREFIX, DATABASE_VERSION_COLUMN, DatabaseAdapterContractError, DatabaseAdapterInputError, DatabaseAmbiguousCommitError, DatabaseBundleNotFoundError, DatabaseConflictError, DatabaseConstraintError, DatabaseCursorError, DatabaseQueryError, DatabaseRowReferencedError, DatabaseSchemaError, DatabaseTransactionError, HotUpdaterConfigError, HotUpdaterSchemaMigrationRequiredError, ReleaseCatalogCompilationError, ReleaseCatalogMutationError, ReleaseManagementError, SETTINGS_TABLE, WRITE_GUARD_TABLE, addDistinct, aggregateBatchingTables, assertStorageOperations, bundleToPatchRows, bundleToRow, canonicalizeAppVersion, compareUtf8, compileReleaseCatalog, coreSchema, coreSettings, coreTarget, countDistinct, createBundleStorageKey, createEngine, createEngineDatabase, createEngineSqlMigrator, createKvAdapter, createMemoryAdapter, createSettingsMigrator, createSqlAdapter, createStorageAdapter, createStorageKeyBuilder, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createTableStatements, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, defineAggregate, definePlugin, defineTable, encodeKvKey, expiresAt, extractTimestampFromUUIDv7, findPhysicalColumn, findPhysicalIndex, generateEngineSql, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, indexOrderColumns, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBusyError, isDatabaseJsonObject, isDatabaseMetadataObject, isMultiIndex, isRemoteDatabase, isUUIDv7, lateColumnStatements, mergeDistinct, meterReads, migrateCoreSchema, normalizeStoredRow, parseBaseCandidateKey, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, quoteSql, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, replaceStorageUriKeySuffix, resolveLazy, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowKey, rowToBundle, rowsToBundles, semverSatisfies, sqlTableShapes, supportedIosPlatforms, targetBaseCandidateKey, toolingTargetOf, verifyAdapter, writeSchemaSettings };
|
|
41
|
+
export { BUNDLE_STORAGE_PREFIX, BundleRowHydrationError, BundleRowHydrationErrorReason, CONTENT_ADDRESSED_ASSET_PREFIX, DATABASE_VERSION_COLUMN, DatabaseAdapterContractError, DatabaseAdapterInputError, DatabaseAmbiguousCommitError, DatabaseBundleNotFoundError, DatabaseConflictError, DatabaseConstraintError, DatabaseCursorError, DatabaseQueryError, DatabaseRowReferencedError, DatabaseSchemaError, DatabaseTransactionError, HotUpdaterConfigError, HotUpdaterSchemaMigrationRequiredError, ReleaseCatalogCompilationError, ReleaseCatalogMutationError, ReleaseManagementError, SETTINGS_TABLE, WRITE_GUARD_TABLE, addDistinct, aggregateBatchingTables, assertStorageOperations, bundleToPatchRows, bundleToRow, canonicalizeAppVersion, compareUtf8, compileReleaseCatalog, coreSchema, coreSettings, coreTarget, countDistinct, createBundleStorageKey, createEngine, createEngineDatabase, createEngineSqlMigrator, createKvAdapter, createMemoryAdapter, createSettingsMigrator, createSqlAdapter, createStorageAdapter, createStorageKeyBuilder, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createTableStatements, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, defineAggregate, definePlugin, defineTable, encodeKvKey, expiresAt, extractTimestampFromUUIDv7, findPhysicalColumn, findPhysicalIndex, generateEngineSql, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, indexOrderColumns, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBusyError, isDatabaseJsonObject, isDatabaseMetadataObject, isMultiIndex, isRemoteDatabase, isUUIDv7, lateColumnStatements, mergeDistinct, meterReads, migrateCoreSchema, normalizeStoredRow, parseBaseCandidateKey, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, quoteSql, readCompiledCatalogPayload, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, replaceStorageUriKeySuffix, resolveLazy, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowKey, rowToBundle, rowsToBundles, semverSatisfies, sqlTableShapes, supportedIosPlatforms, targetBaseCandidateKey, toolingTargetOf, verifyAdapter, writeSchemaSettings };
|
|
@@ -308,6 +308,76 @@ function canonicalStringify(value) {
|
|
|
308
308
|
const record = value;
|
|
309
309
|
return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${canonicalStringify(record[key])}`).join(",")}}`;
|
|
310
310
|
}
|
|
311
|
+
const BOUND_SHAPE = {
|
|
312
|
+
inclusive: null,
|
|
313
|
+
version: null
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Every key this release's compiler writes in a catalog payload, where it
|
|
317
|
+
* writes it: the envelope's, a segment's and its bounds', and a release
|
|
318
|
+
* descriptor's. A key outside it was written by a later release.
|
|
319
|
+
*/
|
|
320
|
+
const COMPILED_CATALOG_SHAPE = {
|
|
321
|
+
fallbackPolicy: null,
|
|
322
|
+
schemaVersion: null,
|
|
323
|
+
strategy: null,
|
|
324
|
+
releaseIndexes: null,
|
|
325
|
+
rollbackReleaseIndexes: null,
|
|
326
|
+
segments: {
|
|
327
|
+
lower: BOUND_SHAPE,
|
|
328
|
+
upper: BOUND_SHAPE,
|
|
329
|
+
releaseIndexes: null,
|
|
330
|
+
rollbackReleaseIndexes: null
|
|
331
|
+
},
|
|
332
|
+
releaseDescriptors: {
|
|
333
|
+
releaseId: null,
|
|
334
|
+
kind: null,
|
|
335
|
+
bundleId: null,
|
|
336
|
+
rolloutCohortCount: null,
|
|
337
|
+
targetCohorts: null,
|
|
338
|
+
shouldForceUpdate: null,
|
|
339
|
+
message: null,
|
|
340
|
+
label: null
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
/**
|
|
344
|
+
* A stored catalog payload as this release reads it: canonical, with the
|
|
345
|
+
* keys a later release added left out, and whether it had any, a later
|
|
346
|
+
* schema version included. Server core compares a catalog by the fields
|
|
347
|
+
* its compiler writes, and refuses to rewrite one a later release wrote,
|
|
348
|
+
* which would drop what that release added.
|
|
349
|
+
*/
|
|
350
|
+
function readCompiledCatalogPayload(payload) {
|
|
351
|
+
let fromLaterRelease = false;
|
|
352
|
+
const known = (value, shape) => {
|
|
353
|
+
if (Array.isArray(value)) return value.map((item) => known(item, shape));
|
|
354
|
+
if (value === null || typeof value !== "object") return value;
|
|
355
|
+
const entries = Object.entries(value).filter(([key]) => {
|
|
356
|
+
if (Object.hasOwn(shape, key)) return true;
|
|
357
|
+
fromLaterRelease = true;
|
|
358
|
+
return false;
|
|
359
|
+
});
|
|
360
|
+
return Object.fromEntries(entries.map(([key, entry]) => {
|
|
361
|
+
const inner = shape[key];
|
|
362
|
+
return [key, inner === null ? entry : known(entry, inner)];
|
|
363
|
+
}));
|
|
364
|
+
};
|
|
365
|
+
let parsed;
|
|
366
|
+
try {
|
|
367
|
+
parsed = JSON.parse(payload);
|
|
368
|
+
} catch {
|
|
369
|
+
parsed = null;
|
|
370
|
+
}
|
|
371
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return {
|
|
372
|
+
canonicalPayload: payload,
|
|
373
|
+
fromLaterRelease: false
|
|
374
|
+
};
|
|
375
|
+
if ("schemaVersion" in parsed && typeof parsed.schemaVersion === "number" && parsed.schemaVersion > _hot_updater_protocol.RELEASE_CATALOG_SCHEMA_VERSION) fromLaterRelease = true;
|
|
376
|
+
return {
|
|
377
|
+
canonicalPayload: canonicalStringify(known(parsed, COMPILED_CATALOG_SHAPE)),
|
|
378
|
+
fromLaterRelease
|
|
379
|
+
};
|
|
380
|
+
}
|
|
311
381
|
async function compileReleaseCatalog(input) {
|
|
312
382
|
const releases = validateReleases(input.releases, input.strategy);
|
|
313
383
|
const targetCohorts = new Set(releases.flatMap((release) => release.targetCohorts));
|
|
@@ -390,4 +460,5 @@ Object.defineProperty(exports, "canonicalizeAppVersion", {
|
|
|
390
460
|
exports.compileReleaseCatalog = compileReleaseCatalog;
|
|
391
461
|
exports.projectCompiledCatalog = projectCompiledCatalog;
|
|
392
462
|
exports.projectCompiledRollbackCatalog = projectCompiledRollbackCatalog;
|
|
463
|
+
exports.readCompiledCatalogPayload = readCompiledCatalogPayload;
|
|
393
464
|
exports.referenceCompatibleReleases = referenceCompatibleReleases;
|
|
@@ -42,6 +42,17 @@ declare class ReleaseCatalogCompilationError extends Error {
|
|
|
42
42
|
readonly code: "INVALID_RELEASE" | "INVALID_TARGET_RANGE" | "TARGET_COHORT_LIMIT" | "DISTINCT_TARGET_COHORT_LIMIT" | "CATALOG_OVERSIZE";
|
|
43
43
|
constructor(code: "INVALID_RELEASE" | "INVALID_TARGET_RANGE" | "TARGET_COHORT_LIMIT" | "DISTINCT_TARGET_COHORT_LIMIT" | "CATALOG_OVERSIZE", message: string);
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* A stored catalog payload as this release reads it: canonical, with the
|
|
47
|
+
* keys a later release added left out, and whether it had any, a later
|
|
48
|
+
* schema version included. Server core compares a catalog by the fields
|
|
49
|
+
* its compiler writes, and refuses to rewrite one a later release wrote,
|
|
50
|
+
* which would drop what that release added.
|
|
51
|
+
*/
|
|
52
|
+
declare function readCompiledCatalogPayload(payload: string): {
|
|
53
|
+
readonly canonicalPayload: string;
|
|
54
|
+
readonly fromLaterRelease: boolean;
|
|
55
|
+
};
|
|
45
56
|
declare function compileReleaseCatalog(input: {
|
|
46
57
|
readonly strategy: ReleaseStrategy;
|
|
47
58
|
readonly releases: readonly Release[];
|
|
@@ -50,4 +61,4 @@ declare function projectCompiledCatalog(catalog: CompiledReleaseCatalog, appVers
|
|
|
50
61
|
declare function projectCompiledRollbackCatalog(catalog: CompiledReleaseCatalog, appVersion?: string): readonly ReleaseCatalogDescriptor[];
|
|
51
62
|
declare function referenceCompatibleReleases(releases: readonly Release[], appVersion: string): readonly Release[];
|
|
52
63
|
//#endregion
|
|
53
|
-
export { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases };
|
|
64
|
+
export { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, readCompiledCatalogPayload, referenceCompatibleReleases };
|
|
@@ -42,6 +42,17 @@ declare class ReleaseCatalogCompilationError extends Error {
|
|
|
42
42
|
readonly code: "INVALID_RELEASE" | "INVALID_TARGET_RANGE" | "TARGET_COHORT_LIMIT" | "DISTINCT_TARGET_COHORT_LIMIT" | "CATALOG_OVERSIZE";
|
|
43
43
|
constructor(code: "INVALID_RELEASE" | "INVALID_TARGET_RANGE" | "TARGET_COHORT_LIMIT" | "DISTINCT_TARGET_COHORT_LIMIT" | "CATALOG_OVERSIZE", message: string);
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* A stored catalog payload as this release reads it: canonical, with the
|
|
47
|
+
* keys a later release added left out, and whether it had any, a later
|
|
48
|
+
* schema version included. Server core compares a catalog by the fields
|
|
49
|
+
* its compiler writes, and refuses to rewrite one a later release wrote,
|
|
50
|
+
* which would drop what that release added.
|
|
51
|
+
*/
|
|
52
|
+
declare function readCompiledCatalogPayload(payload: string): {
|
|
53
|
+
readonly canonicalPayload: string;
|
|
54
|
+
readonly fromLaterRelease: boolean;
|
|
55
|
+
};
|
|
45
56
|
declare function compileReleaseCatalog(input: {
|
|
46
57
|
readonly strategy: ReleaseStrategy;
|
|
47
58
|
readonly releases: readonly Release[];
|
|
@@ -50,4 +61,4 @@ declare function projectCompiledCatalog(catalog: CompiledReleaseCatalog, appVers
|
|
|
50
61
|
declare function projectCompiledRollbackCatalog(catalog: CompiledReleaseCatalog, appVersion?: string): readonly ReleaseCatalogDescriptor[];
|
|
51
62
|
declare function referenceCompatibleReleases(releases: readonly Release[], appVersion: string): readonly Release[];
|
|
52
63
|
//#endregion
|
|
53
|
-
export { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion$1 as canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases };
|
|
64
|
+
export { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion$1 as canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, readCompiledCatalogPayload, referenceCompatibleReleases };
|
|
@@ -309,6 +309,76 @@ function canonicalStringify(value) {
|
|
|
309
309
|
const record = value;
|
|
310
310
|
return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${canonicalStringify(record[key])}`).join(",")}}`;
|
|
311
311
|
}
|
|
312
|
+
const BOUND_SHAPE = {
|
|
313
|
+
inclusive: null,
|
|
314
|
+
version: null
|
|
315
|
+
};
|
|
316
|
+
/**
|
|
317
|
+
* Every key this release's compiler writes in a catalog payload, where it
|
|
318
|
+
* writes it: the envelope's, a segment's and its bounds', and a release
|
|
319
|
+
* descriptor's. A key outside it was written by a later release.
|
|
320
|
+
*/
|
|
321
|
+
const COMPILED_CATALOG_SHAPE = {
|
|
322
|
+
fallbackPolicy: null,
|
|
323
|
+
schemaVersion: null,
|
|
324
|
+
strategy: null,
|
|
325
|
+
releaseIndexes: null,
|
|
326
|
+
rollbackReleaseIndexes: null,
|
|
327
|
+
segments: {
|
|
328
|
+
lower: BOUND_SHAPE,
|
|
329
|
+
upper: BOUND_SHAPE,
|
|
330
|
+
releaseIndexes: null,
|
|
331
|
+
rollbackReleaseIndexes: null
|
|
332
|
+
},
|
|
333
|
+
releaseDescriptors: {
|
|
334
|
+
releaseId: null,
|
|
335
|
+
kind: null,
|
|
336
|
+
bundleId: null,
|
|
337
|
+
rolloutCohortCount: null,
|
|
338
|
+
targetCohorts: null,
|
|
339
|
+
shouldForceUpdate: null,
|
|
340
|
+
message: null,
|
|
341
|
+
label: null
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
/**
|
|
345
|
+
* A stored catalog payload as this release reads it: canonical, with the
|
|
346
|
+
* keys a later release added left out, and whether it had any, a later
|
|
347
|
+
* schema version included. Server core compares a catalog by the fields
|
|
348
|
+
* its compiler writes, and refuses to rewrite one a later release wrote,
|
|
349
|
+
* which would drop what that release added.
|
|
350
|
+
*/
|
|
351
|
+
function readCompiledCatalogPayload(payload) {
|
|
352
|
+
let fromLaterRelease = false;
|
|
353
|
+
const known = (value, shape) => {
|
|
354
|
+
if (Array.isArray(value)) return value.map((item) => known(item, shape));
|
|
355
|
+
if (value === null || typeof value !== "object") return value;
|
|
356
|
+
const entries = Object.entries(value).filter(([key]) => {
|
|
357
|
+
if (Object.hasOwn(shape, key)) return true;
|
|
358
|
+
fromLaterRelease = true;
|
|
359
|
+
return false;
|
|
360
|
+
});
|
|
361
|
+
return Object.fromEntries(entries.map(([key, entry]) => {
|
|
362
|
+
const inner = shape[key];
|
|
363
|
+
return [key, inner === null ? entry : known(entry, inner)];
|
|
364
|
+
}));
|
|
365
|
+
};
|
|
366
|
+
let parsed;
|
|
367
|
+
try {
|
|
368
|
+
parsed = JSON.parse(payload);
|
|
369
|
+
} catch {
|
|
370
|
+
parsed = null;
|
|
371
|
+
}
|
|
372
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return {
|
|
373
|
+
canonicalPayload: payload,
|
|
374
|
+
fromLaterRelease: false
|
|
375
|
+
};
|
|
376
|
+
if ("schemaVersion" in parsed && typeof parsed.schemaVersion === "number" && parsed.schemaVersion > RELEASE_CATALOG_SCHEMA_VERSION) fromLaterRelease = true;
|
|
377
|
+
return {
|
|
378
|
+
canonicalPayload: canonicalStringify(known(parsed, COMPILED_CATALOG_SHAPE)),
|
|
379
|
+
fromLaterRelease
|
|
380
|
+
};
|
|
381
|
+
}
|
|
312
382
|
async function compileReleaseCatalog(input) {
|
|
313
383
|
const releases = validateReleases(input.releases, input.strategy);
|
|
314
384
|
const targetCohorts = new Set(releases.flatMap((release) => release.targetCohorts));
|
|
@@ -381,4 +451,4 @@ function referenceCompatibleReleases(releases, appVersion) {
|
|
|
381
451
|
return releases.filter((release) => release.enabled && release.targetAppVersion !== null && satisfies(canonicalVersion, release.targetAppVersion));
|
|
382
452
|
}
|
|
383
453
|
//#endregion
|
|
384
|
-
export { ReleaseCatalogCompilationError, canonicalizeAppVersion$1 as canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases };
|
|
454
|
+
export { ReleaseCatalogCompilationError, canonicalizeAppVersion$1 as canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, readCompiledCatalogPayload, referenceCompatibleReleases };
|
|
@@ -17,9 +17,9 @@ interface ReleaseCatalogMutationResult {
|
|
|
17
17
|
readonly release: ReleaseRow | null;
|
|
18
18
|
}
|
|
19
19
|
declare class ReleaseCatalogMutationError extends Error {
|
|
20
|
-
readonly code: "CATALOG_GENERATION_EXHAUSTED" | "CATALOG_IDENTITY_MISSING" | "INVALID_SCOPE" | "NON_MONOTONIC_RELEASE_ID" | "RELEASE_NOT_FOUND" | "VERSION_CONFLICT";
|
|
20
|
+
readonly code: "CATALOG_GENERATION_EXHAUSTED" | "CATALOG_IDENTITY_MISSING" | "CATALOG_FROM_LATER_RELEASE" | "INVALID_SCOPE" | "NON_MONOTONIC_RELEASE_ID" | "RELEASE_NOT_FOUND" | "VERSION_CONFLICT";
|
|
21
21
|
readonly name = "ReleaseCatalogMutationError";
|
|
22
|
-
constructor(code: "CATALOG_GENERATION_EXHAUSTED" | "CATALOG_IDENTITY_MISSING" | "INVALID_SCOPE" | "NON_MONOTONIC_RELEASE_ID" | "RELEASE_NOT_FOUND" | "VERSION_CONFLICT", message: string);
|
|
22
|
+
constructor(code: "CATALOG_GENERATION_EXHAUSTED" | "CATALOG_IDENTITY_MISSING" | "CATALOG_FROM_LATER_RELEASE" | "INVALID_SCOPE" | "NON_MONOTONIC_RELEASE_ID" | "RELEASE_NOT_FOUND" | "VERSION_CONFLICT", message: string);
|
|
23
23
|
}
|
|
24
24
|
/** What a release change would write, without writing it. */
|
|
25
25
|
interface ReleaseCatalogMutationPreflight {
|
|
@@ -17,9 +17,9 @@ interface ReleaseCatalogMutationResult {
|
|
|
17
17
|
readonly release: ReleaseRow | null;
|
|
18
18
|
}
|
|
19
19
|
declare class ReleaseCatalogMutationError extends Error {
|
|
20
|
-
readonly code: "CATALOG_GENERATION_EXHAUSTED" | "CATALOG_IDENTITY_MISSING" | "INVALID_SCOPE" | "NON_MONOTONIC_RELEASE_ID" | "RELEASE_NOT_FOUND" | "VERSION_CONFLICT";
|
|
20
|
+
readonly code: "CATALOG_GENERATION_EXHAUSTED" | "CATALOG_IDENTITY_MISSING" | "CATALOG_FROM_LATER_RELEASE" | "INVALID_SCOPE" | "NON_MONOTONIC_RELEASE_ID" | "RELEASE_NOT_FOUND" | "VERSION_CONFLICT";
|
|
21
21
|
readonly name = "ReleaseCatalogMutationError";
|
|
22
|
-
constructor(code: "CATALOG_GENERATION_EXHAUSTED" | "CATALOG_IDENTITY_MISSING" | "INVALID_SCOPE" | "NON_MONOTONIC_RELEASE_ID" | "RELEASE_NOT_FOUND" | "VERSION_CONFLICT", message: string);
|
|
22
|
+
constructor(code: "CATALOG_GENERATION_EXHAUSTED" | "CATALOG_IDENTITY_MISSING" | "CATALOG_FROM_LATER_RELEASE" | "INVALID_SCOPE" | "NON_MONOTONIC_RELEASE_ID" | "RELEASE_NOT_FOUND" | "VERSION_CONFLICT", message: string);
|
|
23
23
|
}
|
|
24
24
|
/** What a release change would write, without writing it. */
|
|
25
25
|
interface ReleaseCatalogMutationPreflight {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/plugin-core",
|
|
3
|
-
"version": "1.2.0-rc.
|
|
3
|
+
"version": "1.2.0-rc.53",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"es-toolkit": "^1.32.0",
|
|
46
46
|
"mime": "^4.0.4",
|
|
47
47
|
"verkit": "0.4.0",
|
|
48
|
-
"@hot-updater/protocol": "1.2.0-rc.
|
|
48
|
+
"@hot-updater/protocol": "1.2.0-rc.53"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@electric-sql/pglite": "0.4.1",
|