@hot-updater/plugin-core 1.0.0-rc.3 → 1.0.0-rc.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/dist/baseCandidateKey.cjs +50 -0
- package/dist/baseCandidateKey.d.cts +27 -0
- package/dist/baseCandidateKey.d.mts +27 -0
- package/dist/baseCandidateKey.mjs +49 -0
- package/dist/bundleStorageLayout.cjs +7 -0
- package/dist/bundleStorageLayout.d.cts +5 -1
- package/dist/bundleStorageLayout.d.mts +5 -1
- package/dist/bundleStorageLayout.mjs +7 -1
- package/dist/contentType.cjs +9 -0
- package/dist/contentType.d.cts +4 -0
- package/dist/contentType.d.mts +4 -0
- package/dist/contentType.mjs +7 -0
- package/dist/coreApi.d.cts +131 -0
- package/dist/coreApi.d.mts +131 -0
- package/dist/createStorageAdapter.cjs +8 -0
- package/dist/createStorageAdapter.d.cts +9 -0
- package/dist/createStorageAdapter.d.mts +9 -0
- package/dist/createStorageAdapter.mjs +7 -0
- package/dist/database/adapter.cjs +61 -0
- package/dist/database/adapter.d.cts +200 -0
- package/dist/database/adapter.d.mts +200 -0
- package/dist/database/adapter.mjs +55 -0
- package/dist/database/distinct.cjs +88 -0
- package/dist/database/distinct.d.cts +18 -0
- package/dist/database/distinct.d.mts +18 -0
- package/dist/database/distinct.mjs +85 -0
- package/dist/database/memoryAdapter.cjs +107 -0
- package/dist/database/memoryAdapter.d.cts +14 -0
- package/dist/database/memoryAdapter.d.mts +14 -0
- package/dist/database/memoryAdapter.mjs +107 -0
- package/dist/database/values.cjs +114 -0
- package/dist/database/values.d.cts +17 -0
- package/dist/database/values.d.mts +17 -0
- package/dist/database/values.mjs +104 -0
- package/dist/database/verifyAdapter.cjs +137 -0
- package/dist/database/verifyAdapter.d.cts +37 -0
- package/dist/database/verifyAdapter.d.mts +37 -0
- package/dist/database/verifyAdapter.mjs +136 -0
- package/dist/databaseErrors.cjs +30 -0
- package/dist/databaseErrors.d.cts +21 -0
- package/dist/databaseErrors.d.mts +21 -0
- package/dist/databaseErrors.mjs +28 -0
- package/dist/databaseJsonValue.cjs +6 -0
- package/dist/databaseJsonValue.d.cts +9 -2
- package/dist/databaseJsonValue.d.mts +9 -2
- package/dist/databaseJsonValue.mjs +6 -0
- package/dist/databaseMetadata.cjs +4 -4
- package/dist/databaseMetadata.mjs +3 -3
- package/dist/databaseRows.cjs +6 -12
- package/dist/databaseRows.d.cts +1 -1
- package/dist/databaseRows.d.mts +1 -1
- package/dist/databaseRows.mjs +1 -7
- package/dist/engine/core/schema.cjs +279 -0
- package/dist/engine/core/schema.d.cts +312 -0
- package/dist/engine/core/schema.d.mts +312 -0
- package/dist/engine/core/schema.mjs +277 -0
- package/dist/engine/createEngine.cjs +72 -0
- package/dist/engine/createEngine.d.cts +45 -0
- package/dist/engine/createEngine.d.mts +45 -0
- package/dist/engine/createEngine.mjs +72 -0
- package/dist/engine/database/aggregateBatching.cjs +627 -0
- package/dist/engine/database/aggregateBatching.mjs +626 -0
- package/dist/engine/database/cursor.cjs +42 -0
- package/dist/engine/database/cursor.mjs +38 -0
- package/dist/engine/database/database.cjs +68 -0
- package/dist/engine/database/database.mjs +68 -0
- package/dist/engine/database/engine.cjs +37 -0
- package/dist/engine/database/engine.mjs +37 -0
- package/dist/engine/database/engineAggregates.cjs +120 -0
- package/dist/engine/database/engineAggregates.mjs +117 -0
- package/dist/engine/database/engineReads.cjs +182 -0
- package/dist/engine/database/engineReads.d.cts +10 -0
- package/dist/engine/database/engineReads.d.mts +10 -0
- package/dist/engine/database/engineReads.mjs +181 -0
- package/dist/engine/database/engineTransaction.cjs +399 -0
- package/dist/engine/database/engineTransaction.d.cts +18 -0
- package/dist/engine/database/engineTransaction.d.mts +18 -0
- package/dist/engine/database/engineTransaction.mjs +398 -0
- package/dist/engine/database/fence.cjs +156 -0
- package/dist/engine/database/fence.d.cts +41 -0
- package/dist/engine/database/fence.d.mts +41 -0
- package/dist/engine/database/fence.mjs +149 -0
- package/dist/engine/database/kv/kvAdapter.cjs +293 -0
- package/dist/engine/database/kv/kvAdapter.d.cts +116 -0
- package/dist/engine/database/kv/kvAdapter.d.mts +116 -0
- package/dist/engine/database/kv/kvAdapter.mjs +292 -0
- package/dist/engine/database/readMeter.cjs +80 -0
- package/dist/engine/database/readMeter.d.cts +34 -0
- package/dist/engine/database/readMeter.d.mts +34 -0
- package/dist/engine/database/readMeter.mjs +79 -0
- package/dist/engine/database/resolveSchema.cjs +197 -0
- package/dist/engine/database/resolveSchema.d.cts +35 -0
- package/dist/engine/database/resolveSchema.d.mts +35 -0
- package/dist/engine/database/resolveSchema.mjs +195 -0
- package/dist/engine/database/retention.cjs +100 -0
- package/dist/engine/database/retention.mjs +98 -0
- package/dist/engine/database/sql/sqlAdapter.cjs +290 -0
- package/dist/engine/database/sql/sqlAdapter.d.cts +45 -0
- package/dist/engine/database/sql/sqlAdapter.d.mts +45 -0
- package/dist/engine/database/sql/sqlAdapter.mjs +288 -0
- package/dist/engine/database/sql/sqlSchema.cjs +175 -0
- package/dist/engine/database/sql/sqlSchema.d.cts +45 -0
- package/dist/engine/database/sql/sqlSchema.d.mts +45 -0
- package/dist/engine/database/sql/sqlSchema.mjs +169 -0
- package/dist/engine/db/coreDatabase.cjs +94 -0
- package/dist/engine/db/coreDatabase.d.cts +78 -0
- package/dist/engine/db/coreDatabase.d.mts +78 -0
- package/dist/engine/db/coreDatabase.mjs +86 -0
- package/dist/engine/db/engineMigrator.cjs +53 -0
- package/dist/engine/db/engineMigrator.mjs +53 -0
- package/dist/engine/db/engineSql.cjs +26 -0
- package/dist/engine/db/engineSql.d.cts +16 -0
- package/dist/engine/db/engineSql.d.mts +16 -0
- package/dist/engine/db/engineSql.mjs +25 -0
- package/dist/engine/db/engineSqlMigrator.cjs +67 -0
- package/dist/engine/db/engineSqlMigrator.d.cts +21 -0
- package/dist/engine/db/engineSqlMigrator.d.mts +21 -0
- package/dist/engine/db/engineSqlMigrator.mjs +67 -0
- package/dist/engine/db/fixedMigratorShared.cjs +12 -0
- package/dist/engine/db/fixedMigratorShared.mjs +11 -0
- package/dist/engine/db/schemaSettings.cjs +63 -0
- package/dist/engine/db/schemaSettings.d.cts +7 -0
- package/dist/engine/db/schemaSettings.d.mts +7 -0
- package/dist/engine/db/schemaSettings.mjs +62 -0
- package/dist/engine/db/settingsMigrator.cjs +94 -0
- package/dist/engine/db/settingsMigrator.d.cts +25 -0
- package/dist/engine/db/settingsMigrator.d.mts +25 -0
- package/dist/engine/db/settingsMigrator.mjs +91 -0
- package/dist/engine/db/types.d.cts +78 -0
- package/dist/engine/db/types.d.mts +78 -0
- package/dist/index.cjs +97 -49
- package/dist/index.d.cts +46 -22
- package/dist/index.d.mts +46 -22
- package/dist/index.mjs +32 -17
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/comparison-DenM3wCn.cjs +0 -5
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/comparison-DenM3wCn.mjs +1 -5
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/range-DvX-Y6iv.cjs +8 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/range-DvX-Y6iv.mjs +9 -2
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/set-CC5YeoYX.cjs +4 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/set-CC5YeoYX.mjs +4 -1
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/version-CQ98ZBpL.cjs +0 -5
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/version-CQ98ZBpL.mjs +2 -6
- package/dist/releaseCatalogCompiler.cjs +27 -26
- package/dist/releaseCatalogCompiler.d.cts +1 -2
- package/dist/releaseCatalogCompiler.d.mts +2 -3
- package/dist/releaseCatalogCompiler.mjs +5 -9
- package/dist/releaseCatalogMutation.cjs +0 -292
- package/dist/releaseCatalogMutation.d.cts +4 -45
- package/dist/releaseCatalogMutation.d.mts +4 -45
- package/dist/releaseCatalogMutation.mjs +1 -288
- package/dist/releaseManagement.cjs +0 -221
- package/dist/releaseManagement.d.cts +4 -28
- package/dist/releaseManagement.d.mts +4 -28
- package/dist/releaseManagement.mjs +1 -216
- package/dist/remoteBundleSigning.d.cts +2 -2
- package/dist/remoteBundleSigning.d.mts +2 -2
- package/dist/serverPlugin/busy.cjs +36 -0
- package/dist/serverPlugin/busy.d.cts +12 -0
- package/dist/serverPlugin/busy.d.mts +12 -0
- package/dist/serverPlugin/busy.mjs +36 -0
- package/dist/serverPlugin/configError.cjs +7 -0
- package/dist/serverPlugin/configError.d.cts +7 -0
- package/dist/serverPlugin/configError.d.mts +7 -0
- package/dist/serverPlugin/configError.mjs +7 -0
- package/dist/serverPlugin/coreReads.d.cts +48 -0
- package/dist/serverPlugin/coreReads.d.mts +48 -0
- package/dist/serverPlugin/databaseHandle.d.cts +105 -0
- package/dist/serverPlugin/databaseHandle.d.mts +105 -0
- package/dist/serverPlugin/definePlugin.cjs +5 -0
- package/dist/serverPlugin/definePlugin.d.cts +130 -0
- package/dist/serverPlugin/definePlugin.d.mts +130 -0
- package/dist/serverPlugin/definePlugin.mjs +5 -0
- package/dist/serverPlugin/definitions.d.cts +76 -0
- package/dist/serverPlugin/definitions.d.mts +76 -0
- package/dist/serverPlugin/errors.cjs +37 -0
- package/dist/serverPlugin/errors.d.cts +29 -0
- package/dist/serverPlugin/errors.d.mts +29 -0
- package/dist/serverPlugin/errors.mjs +32 -0
- package/dist/serverPlugin/schema.cjs +24 -0
- package/dist/serverPlugin/schema.d.cts +90 -0
- package/dist/serverPlugin/schema.d.mts +90 -0
- package/dist/serverPlugin/schema.mjs +23 -0
- package/dist/types/databaseConfig.cjs +5 -0
- package/dist/types/databaseConfig.d.cts +68 -0
- package/dist/types/databaseConfig.d.mts +68 -0
- package/dist/types/databaseConfig.mjs +5 -0
- package/dist/types/databaseOperations.d.cts +5 -180
- package/dist/types/databaseOperations.d.mts +5 -180
- package/dist/types/databaseRows.d.cts +5 -56
- package/dist/types/databaseRows.d.mts +5 -56
- package/dist/types/index.cjs +2 -0
- package/dist/types/index.d.cts +31 -97
- package/dist/types/index.d.mts +31 -97
- package/dist/types/index.mjs +2 -1
- package/dist/types/models.d.cts +14 -0
- package/dist/types/models.d.mts +14 -0
- package/dist/types/public.d.cts +4 -3
- package/dist/types/public.d.mts +4 -3
- package/dist/uuidv7.cjs +3 -3
- package/dist/uuidv7.d.cts +1 -1
- package/dist/uuidv7.d.mts +1 -1
- package/dist/uuidv7.mjs +1 -1
- package/package.json +10 -7
- package/dist/calculatePagination.cjs +0 -25
- package/dist/calculatePagination.d.cts +0 -12
- package/dist/calculatePagination.d.mts +0 -12
- package/dist/calculatePagination.mjs +0 -25
- package/dist/compressionFormat.cjs +0 -62
- package/dist/compressionFormat.d.cts +0 -33
- package/dist/compressionFormat.d.mts +0 -33
- package/dist/compressionFormat.mjs +0 -58
- package/dist/createDatabasePlugin.cjs +0 -920
- package/dist/createDatabasePlugin.d.cts +0 -28
- package/dist/createDatabasePlugin.d.mts +0 -28
- package/dist/createDatabasePlugin.mjs +0 -916
- package/dist/createStoragePlugin.cjs +0 -8
- package/dist/createStoragePlugin.d.cts +0 -9
- package/dist/createStoragePlugin.d.mts +0 -9
- package/dist/createStoragePlugin.mjs +0 -7
- package/dist/databaseClient.cjs +0 -117
- package/dist/databaseClient.d.cts +0 -32
- package/dist/databaseClient.d.mts +0 -32
- package/dist/databaseClient.mjs +0 -114
- package/dist/databaseClientReads.cjs +0 -115
- package/dist/databaseClientReads.mjs +0 -113
- package/dist/databaseClientUpdates.cjs +0 -40
- package/dist/databaseClientUpdates.d.cts +0 -11
- package/dist/databaseClientUpdates.d.mts +0 -11
- package/dist/databaseClientUpdates.mjs +0 -38
- package/dist/databasePluginCrud.cjs +0 -88
- package/dist/databasePluginCrud.d.cts +0 -4
- package/dist/databasePluginCrud.d.mts +0 -4
- package/dist/databasePluginCrud.mjs +0 -87
- package/dist/databasePluginCrudValidation.d.cts +0 -6
- package/dist/databasePluginCrudValidation.d.mts +0 -6
- package/dist/databasePluginCrudValidationErrors.cjs +0 -11
- package/dist/databasePluginCrudValidationErrors.d.cts +0 -9
- package/dist/databasePluginCrudValidationErrors.d.mts +0 -9
- package/dist/databasePluginCrudValidationErrors.mjs +0 -11
- package/dist/databasePluginCrudValidationFields.cjs +0 -321
- package/dist/databasePluginCrudValidationFields.d.cts +0 -1
- package/dist/databasePluginCrudValidationFields.d.mts +0 -1
- package/dist/databasePluginCrudValidationFields.mjs +0 -309
- package/dist/databasePluginCrudValidationMutations.cjs +0 -107
- package/dist/databasePluginCrudValidationMutations.d.cts +0 -1
- package/dist/databasePluginCrudValidationMutations.d.mts +0 -1
- package/dist/databasePluginCrudValidationMutations.mjs +0 -100
- package/dist/databasePluginCrudValidationQueries.cjs +0 -103
- package/dist/databasePluginCrudValidationQueries.d.cts +0 -2
- package/dist/databasePluginCrudValidationQueries.d.mts +0 -2
- package/dist/databasePluginCrudValidationQueries.mjs +0 -97
- package/dist/databasePluginCrudValidationRows.cjs +0 -55
- package/dist/databasePluginCrudValidationRows.d.cts +0 -1
- package/dist/databasePluginCrudValidationRows.d.mts +0 -1
- package/dist/databasePluginCrudValidationRows.mjs +0 -53
- package/dist/databasePluginTransaction.cjs +0 -7
- package/dist/databasePluginTransaction.mjs +0 -7
- package/dist/insightsContract.cjs +0 -157
- package/dist/insightsContract.d.cts +0 -11
- package/dist/insightsContract.d.mts +0 -11
- package/dist/insightsContract.mjs +0 -153
- package/dist/internal.cjs +0 -6
- package/dist/internal.d.cts +0 -10
- package/dist/internal.d.mts +0 -10
- package/dist/internal.mjs +0 -3
- package/dist/paginateBundles.cjs +0 -53
- package/dist/paginateBundles.d.cts +0 -13
- package/dist/paginateBundles.d.mts +0 -13
- package/dist/paginateBundles.mjs +0 -53
- package/dist/queryBundles.cjs +0 -34
- package/dist/queryBundles.d.cts +0 -9
- package/dist/queryBundles.d.mts +0 -9
- package/dist/queryBundles.mjs +0 -32
- package/dist/requestBundleCache.cjs +0 -22
- package/dist/requestBundleCache.d.cts +0 -8
- package/dist/requestBundleCache.d.mts +0 -8
- package/dist/requestBundleCache.mjs +0 -22
- package/dist/types/database.d.cts +0 -5
- package/dist/types/database.d.mts +0 -5
- package/dist/types/databaseFields.cjs +0 -105
- package/dist/types/databaseFields.d.cts +0 -13
- package/dist/types/databaseFields.d.mts +0 -13
- package/dist/types/databaseFields.mjs +0 -105
- package/dist/types/databasePlugin.d.cts +0 -298
- package/dist/types/databasePlugin.d.mts +0 -298
- package/dist/types/databaseQuery.d.cts +0 -46
- package/dist/types/databaseQuery.d.mts +0 -46
- package/dist/types/internal.d.cts +0 -8
- package/dist/types/internal.d.mts +0 -8
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./types/index.cjs";
|
|
3
|
-
import { ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult } from "./releaseCatalogMutation.cjs";
|
|
1
|
+
import { ReleaseCatalogMutationResult } from "./releaseCatalogMutation.cjs";
|
|
4
2
|
//#region src/releaseManagement.d.ts
|
|
3
|
+
/** The release fields a policy change may set. */
|
|
5
4
|
interface ReleasePolicyPatch {
|
|
6
5
|
readonly enabled?: boolean;
|
|
7
6
|
readonly fingerprintHash?: string;
|
|
@@ -11,38 +10,15 @@ interface ReleasePolicyPatch {
|
|
|
11
10
|
readonly targetAppVersion?: string;
|
|
12
11
|
readonly targetCohorts?: readonly string[];
|
|
13
12
|
}
|
|
14
|
-
interface ReleaseMutationTarget {
|
|
15
|
-
readonly database: BundleRepository;
|
|
16
|
-
readonly expectedRevision?: number;
|
|
17
|
-
readonly releaseId: string;
|
|
18
|
-
readonly updatedAtMs?: number;
|
|
19
|
-
}
|
|
20
13
|
declare class ReleaseManagementError extends Error {
|
|
21
14
|
readonly code: "ENABLED_RELEASE" | "RELEASE_NOT_FOUND" | "SCOPE_MOVE_UNSUPPORTED" | "TARGET_RELEASE_INVALID" | "VERSION_CONFLICT";
|
|
22
15
|
readonly name = "ReleaseManagementError";
|
|
23
16
|
constructor(code: "ENABLED_RELEASE" | "RELEASE_NOT_FOUND" | "SCOPE_MOVE_UNSUPPORTED" | "TARGET_RELEASE_INVALID" | "VERSION_CONFLICT", message: string);
|
|
24
17
|
}
|
|
25
|
-
declare function updateReleasePolicy(input: ReleaseMutationTarget & {
|
|
26
|
-
readonly patch: ReleasePolicyPatch;
|
|
27
|
-
}): Promise<ReleaseCatalogMutationResult>;
|
|
28
|
-
declare function preflightReleasePolicy(input: ReleaseMutationTarget & {
|
|
29
|
-
readonly patch: ReleasePolicyPatch;
|
|
30
|
-
}): Promise<ReleaseCatalogMutationPreflight>;
|
|
31
|
-
declare function deleteRelease(input: ReleaseMutationTarget): Promise<ReleaseCatalogMutationResult>;
|
|
32
|
-
interface PromoteReleaseInput extends ReleaseMutationTarget {
|
|
33
|
-
readonly action?: "copy" | "move";
|
|
34
|
-
readonly targetChannel: string;
|
|
35
|
-
}
|
|
36
18
|
interface PromoteReleaseResult {
|
|
19
|
+
/** The source release after a move, or null for a copy. */
|
|
37
20
|
readonly source: ReleaseCatalogMutationResult | null;
|
|
38
21
|
readonly target: ReleaseCatalogMutationResult;
|
|
39
22
|
}
|
|
40
|
-
declare function promoteRelease(input: PromoteReleaseInput): Promise<PromoteReleaseResult>;
|
|
41
|
-
type RollbackReleaseInput = ReleaseMutationTarget;
|
|
42
|
-
declare function rollbackReleases(input: {
|
|
43
|
-
readonly database: BundleRepository;
|
|
44
|
-
readonly rollbacks: readonly Omit<RollbackReleaseInput, "database">[];
|
|
45
|
-
}): Promise<readonly ReleaseCatalogMutationResult[]>;
|
|
46
|
-
declare function rollbackRelease(input: RollbackReleaseInput): Promise<ReleaseCatalogMutationResult>;
|
|
47
23
|
//#endregion
|
|
48
|
-
export {
|
|
24
|
+
export { PromoteReleaseResult, ReleaseManagementError, ReleasePolicyPatch };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./types/index.mjs";
|
|
3
|
-
import { ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult } from "./releaseCatalogMutation.mjs";
|
|
1
|
+
import { ReleaseCatalogMutationResult } from "./releaseCatalogMutation.mjs";
|
|
4
2
|
//#region src/releaseManagement.d.ts
|
|
3
|
+
/** The release fields a policy change may set. */
|
|
5
4
|
interface ReleasePolicyPatch {
|
|
6
5
|
readonly enabled?: boolean;
|
|
7
6
|
readonly fingerprintHash?: string;
|
|
@@ -11,38 +10,15 @@ interface ReleasePolicyPatch {
|
|
|
11
10
|
readonly targetAppVersion?: string;
|
|
12
11
|
readonly targetCohorts?: readonly string[];
|
|
13
12
|
}
|
|
14
|
-
interface ReleaseMutationTarget {
|
|
15
|
-
readonly database: BundleRepository;
|
|
16
|
-
readonly expectedRevision?: number;
|
|
17
|
-
readonly releaseId: string;
|
|
18
|
-
readonly updatedAtMs?: number;
|
|
19
|
-
}
|
|
20
13
|
declare class ReleaseManagementError extends Error {
|
|
21
14
|
readonly code: "ENABLED_RELEASE" | "RELEASE_NOT_FOUND" | "SCOPE_MOVE_UNSUPPORTED" | "TARGET_RELEASE_INVALID" | "VERSION_CONFLICT";
|
|
22
15
|
readonly name = "ReleaseManagementError";
|
|
23
16
|
constructor(code: "ENABLED_RELEASE" | "RELEASE_NOT_FOUND" | "SCOPE_MOVE_UNSUPPORTED" | "TARGET_RELEASE_INVALID" | "VERSION_CONFLICT", message: string);
|
|
24
17
|
}
|
|
25
|
-
declare function updateReleasePolicy(input: ReleaseMutationTarget & {
|
|
26
|
-
readonly patch: ReleasePolicyPatch;
|
|
27
|
-
}): Promise<ReleaseCatalogMutationResult>;
|
|
28
|
-
declare function preflightReleasePolicy(input: ReleaseMutationTarget & {
|
|
29
|
-
readonly patch: ReleasePolicyPatch;
|
|
30
|
-
}): Promise<ReleaseCatalogMutationPreflight>;
|
|
31
|
-
declare function deleteRelease(input: ReleaseMutationTarget): Promise<ReleaseCatalogMutationResult>;
|
|
32
|
-
interface PromoteReleaseInput extends ReleaseMutationTarget {
|
|
33
|
-
readonly action?: "copy" | "move";
|
|
34
|
-
readonly targetChannel: string;
|
|
35
|
-
}
|
|
36
18
|
interface PromoteReleaseResult {
|
|
19
|
+
/** The source release after a move, or null for a copy. */
|
|
37
20
|
readonly source: ReleaseCatalogMutationResult | null;
|
|
38
21
|
readonly target: ReleaseCatalogMutationResult;
|
|
39
22
|
}
|
|
40
|
-
declare function promoteRelease(input: PromoteReleaseInput): Promise<PromoteReleaseResult>;
|
|
41
|
-
type RollbackReleaseInput = ReleaseMutationTarget;
|
|
42
|
-
declare function rollbackReleases(input: {
|
|
43
|
-
readonly database: BundleRepository;
|
|
44
|
-
readonly rollbacks: readonly Omit<RollbackReleaseInput, "database">[];
|
|
45
|
-
}): Promise<readonly ReleaseCatalogMutationResult[]>;
|
|
46
|
-
declare function rollbackRelease(input: RollbackReleaseInput): Promise<ReleaseCatalogMutationResult>;
|
|
47
23
|
//#endregion
|
|
48
|
-
export {
|
|
24
|
+
export { PromoteReleaseResult, ReleaseManagementError, ReleasePolicyPatch };
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { createUUIDv7After, isUUIDv7 as isUUIDv7$1 } from "./uuidv7.mjs";
|
|
2
|
-
import { ReleaseCatalogMutationError, commitReleaseCatalogMutation, commitReleaseCatalogMutations, preflightReleaseCatalogMutation } from "./releaseCatalogMutation.mjs";
|
|
3
|
-
import { createReleaseCatalogScopeKey, decodeChannelKey, encodeChannelKey } from "@hot-updater/core";
|
|
4
1
|
//#region src/releaseManagement.ts
|
|
5
|
-
const RELEASE_PAGE_SIZE = 1e3;
|
|
6
2
|
var ReleaseManagementError = class extends Error {
|
|
7
3
|
code;
|
|
8
4
|
name = "ReleaseManagementError";
|
|
@@ -11,216 +7,5 @@ var ReleaseManagementError = class extends Error {
|
|
|
11
7
|
this.code = code;
|
|
12
8
|
}
|
|
13
9
|
};
|
|
14
|
-
const readReleaseScope = async (database, scopeKey) => {
|
|
15
|
-
const rows = [];
|
|
16
|
-
let afterReleaseId;
|
|
17
|
-
for (;;) {
|
|
18
|
-
const page = await database.models.releases.findManyByScope({
|
|
19
|
-
scopeKey,
|
|
20
|
-
...afterReleaseId === void 0 ? {} : { afterReleaseId },
|
|
21
|
-
consistency: "strong",
|
|
22
|
-
limit: RELEASE_PAGE_SIZE
|
|
23
|
-
});
|
|
24
|
-
rows.push(...page);
|
|
25
|
-
if (page.length < RELEASE_PAGE_SIZE) return rows;
|
|
26
|
-
const nextCursor = page.at(-1)?.id;
|
|
27
|
-
if (nextCursor === void 0 || nextCursor === afterReleaseId) throw new ReleaseCatalogMutationError("INVALID_SCOPE", `Release paging did not advance for scope "${scopeKey}".`);
|
|
28
|
-
afterReleaseId = nextCursor;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
const createForwardReleaseId = (rows, candidates, nowMs) => {
|
|
32
|
-
const floor = [...candidates, rows.at(-1)?.id ?? null].filter((value) => value !== null && isUUIDv7$1(value)).sort().at(-1);
|
|
33
|
-
return createUUIDv7After(floor ?? null, nowMs);
|
|
34
|
-
};
|
|
35
|
-
const prepareTargetScope = async ({ channelName, database, fingerprintHash, platform, strategy }) => {
|
|
36
|
-
const channelKey = encodeChannelKey(channelName);
|
|
37
|
-
const channel = (await database.models.channels.list({})).channels.find(({ name }) => name === channelName) ?? (await database.models.channels.insert({
|
|
38
|
-
row: {
|
|
39
|
-
id: `channel:${channelKey}`,
|
|
40
|
-
name: channelName
|
|
41
|
-
},
|
|
42
|
-
onConflict: "returnExisting"
|
|
43
|
-
})).row;
|
|
44
|
-
const scopeKey = strategy === "APP_VERSION" ? createReleaseCatalogScopeKey({
|
|
45
|
-
channelKey,
|
|
46
|
-
platform,
|
|
47
|
-
strategy
|
|
48
|
-
}) : createReleaseCatalogScopeKey({
|
|
49
|
-
channelKey,
|
|
50
|
-
fingerprintHash: fingerprintHash ?? "",
|
|
51
|
-
platform,
|
|
52
|
-
strategy
|
|
53
|
-
});
|
|
54
|
-
return { scope: {
|
|
55
|
-
channelId: channel.id,
|
|
56
|
-
channelName,
|
|
57
|
-
fingerprintHash,
|
|
58
|
-
platform,
|
|
59
|
-
scopeKey,
|
|
60
|
-
strategy
|
|
61
|
-
} };
|
|
62
|
-
};
|
|
63
|
-
const loadReleaseTarget = async (input) => {
|
|
64
|
-
const release = await input.database.models.releases.findById(input.releaseId);
|
|
65
|
-
if (release === null) throw new ReleaseManagementError("RELEASE_NOT_FOUND", `Release "${input.releaseId}" was not found.`);
|
|
66
|
-
if (input.expectedRevision !== void 0 && input.expectedRevision !== release.revision) throw new ReleaseManagementError("VERSION_CONFLICT", `Release "${release.id}" is revision ${release.revision}; expected ${input.expectedRevision}.`);
|
|
67
|
-
const catalog = await input.database.models.releaseCatalogs.findByScopeKey(release.scope_key);
|
|
68
|
-
if (catalog === null) throw new ReleaseCatalogMutationError("INVALID_SCOPE", `Release "${release.id}" has no catalog projection.`);
|
|
69
|
-
return {
|
|
70
|
-
release,
|
|
71
|
-
scope: {
|
|
72
|
-
channelId: release.channel_id,
|
|
73
|
-
channelName: decodeChannelKey(catalog.channel_key),
|
|
74
|
-
fingerprintHash: release.fingerprint_hash,
|
|
75
|
-
platform: release.platform,
|
|
76
|
-
scopeKey: release.scope_key,
|
|
77
|
-
strategy: release.strategy
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
const releasePolicyUpdate = (release, patch, updatedAtMs) => {
|
|
82
|
-
if (patch.fingerprintHash !== void 0 && patch.fingerprintHash !== release.fingerprint_hash) throw new ReleaseManagementError("SCOPE_MOVE_UNSUPPORTED", "Changing a fingerprint target requires an atomic Release scope move.");
|
|
83
|
-
return {
|
|
84
|
-
...patch.enabled === void 0 ? {} : { enabled: patch.enabled },
|
|
85
|
-
...patch.message === void 0 ? {} : { message: patch.message },
|
|
86
|
-
...patch.rolloutCohortCount === void 0 ? {} : { rollout_cohort_count: patch.rolloutCohortCount },
|
|
87
|
-
...patch.shouldForceUpdate === void 0 ? {} : { should_force_update: patch.shouldForceUpdate },
|
|
88
|
-
...patch.targetAppVersion === void 0 ? {} : { target_app_version: patch.targetAppVersion },
|
|
89
|
-
...patch.targetCohorts === void 0 ? {} : { target_cohorts: [...patch.targetCohorts] },
|
|
90
|
-
updated_at_ms: updatedAtMs
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
async function updateReleasePolicy(input) {
|
|
94
|
-
const { release, scope } = await loadReleaseTarget(input);
|
|
95
|
-
const updatedAtMs = input.updatedAtMs ?? Date.now();
|
|
96
|
-
return commitReleaseCatalogMutation({
|
|
97
|
-
database: input.database,
|
|
98
|
-
mutation: {
|
|
99
|
-
id: release.id,
|
|
100
|
-
operation: "update",
|
|
101
|
-
update: releasePolicyUpdate(release, input.patch, updatedAtMs)
|
|
102
|
-
},
|
|
103
|
-
scope,
|
|
104
|
-
updatedAtMs
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
async function preflightReleasePolicy(input) {
|
|
108
|
-
const { release, scope } = await loadReleaseTarget(input);
|
|
109
|
-
const updatedAtMs = input.updatedAtMs ?? Date.now();
|
|
110
|
-
return preflightReleaseCatalogMutation({
|
|
111
|
-
database: input.database,
|
|
112
|
-
mutation: {
|
|
113
|
-
id: release.id,
|
|
114
|
-
operation: "update",
|
|
115
|
-
update: releasePolicyUpdate(release, input.patch, updatedAtMs)
|
|
116
|
-
},
|
|
117
|
-
scope,
|
|
118
|
-
updatedAtMs
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
async function deleteRelease(input) {
|
|
122
|
-
const { release, scope } = await loadReleaseTarget(input);
|
|
123
|
-
if (release.enabled) throw new ReleaseManagementError("ENABLED_RELEASE", `Disable Release "${release.id}" before hard deletion.`);
|
|
124
|
-
return commitReleaseCatalogMutation({
|
|
125
|
-
database: input.database,
|
|
126
|
-
mutation: {
|
|
127
|
-
id: release.id,
|
|
128
|
-
operation: "delete"
|
|
129
|
-
},
|
|
130
|
-
scope,
|
|
131
|
-
updatedAtMs: input.updatedAtMs
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
async function promoteRelease(input) {
|
|
135
|
-
const { release: source, scope: sourceScope } = await loadReleaseTarget(input);
|
|
136
|
-
if (source.kind !== "BUNDLE" || source.bundle_id === null) throw new ReleaseManagementError("TARGET_RELEASE_INVALID", "Only a Bundle Release can be promoted.");
|
|
137
|
-
const targetChannel = input.targetChannel.trim();
|
|
138
|
-
if (targetChannel.length === 0) throw new ReleaseManagementError("TARGET_RELEASE_INVALID", "Promotion requires a target channel.");
|
|
139
|
-
const { scope: targetScope } = await prepareTargetScope({
|
|
140
|
-
channelName: targetChannel,
|
|
141
|
-
database: input.database,
|
|
142
|
-
fingerprintHash: source.fingerprint_hash,
|
|
143
|
-
platform: source.platform,
|
|
144
|
-
strategy: source.strategy
|
|
145
|
-
});
|
|
146
|
-
if (targetScope.scopeKey === sourceScope.scopeKey) throw new ReleaseManagementError("TARGET_RELEASE_INVALID", "Source and target Release scopes are the same.");
|
|
147
|
-
const targetRows = await readReleaseScope(input.database, targetScope.scopeKey);
|
|
148
|
-
const updatedAtMs = input.updatedAtMs ?? Date.now();
|
|
149
|
-
const targetMutation = {
|
|
150
|
-
mutation: {
|
|
151
|
-
operation: "insert",
|
|
152
|
-
row: {
|
|
153
|
-
...source,
|
|
154
|
-
id: createForwardReleaseId(targetRows, [source.id, source.bundle_id], updatedAtMs),
|
|
155
|
-
revision: 1,
|
|
156
|
-
scope_key: targetScope.scopeKey,
|
|
157
|
-
channel_id: targetScope.channelId,
|
|
158
|
-
enabled: true,
|
|
159
|
-
rollout_cohort_count: 1e3,
|
|
160
|
-
target_cohorts: [],
|
|
161
|
-
operation: "PROMOTE",
|
|
162
|
-
source_release_id: source.id,
|
|
163
|
-
created_at_ms: updatedAtMs,
|
|
164
|
-
updated_at_ms: updatedAtMs
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
scope: targetScope,
|
|
168
|
-
updatedAtMs
|
|
169
|
-
};
|
|
170
|
-
const sourceMutation = input.action === "move" ? {
|
|
171
|
-
mutation: {
|
|
172
|
-
id: source.id,
|
|
173
|
-
operation: "update",
|
|
174
|
-
update: {
|
|
175
|
-
enabled: false,
|
|
176
|
-
updated_at_ms: updatedAtMs
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
scope: sourceScope,
|
|
180
|
-
updatedAtMs
|
|
181
|
-
} : null;
|
|
182
|
-
const results = await commitReleaseCatalogMutations({
|
|
183
|
-
database: input.database,
|
|
184
|
-
mutations: sourceMutation === null ? [targetMutation] : [sourceMutation, targetMutation]
|
|
185
|
-
});
|
|
186
|
-
return {
|
|
187
|
-
source: sourceMutation === null ? null : results[0],
|
|
188
|
-
target: results.at(-1)
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
const prepareRollbackRelease = async (input) => {
|
|
192
|
-
const { release: source, scope } = await loadReleaseTarget(input);
|
|
193
|
-
if (!source.enabled) throw new ReleaseManagementError("TARGET_RELEASE_INVALID", "Rollback requires an enabled Release.");
|
|
194
|
-
const updatedAtMs = input.updatedAtMs ?? Date.now();
|
|
195
|
-
return {
|
|
196
|
-
mutation: {
|
|
197
|
-
id: source.id,
|
|
198
|
-
operation: "update",
|
|
199
|
-
update: {
|
|
200
|
-
enabled: false,
|
|
201
|
-
updated_at_ms: updatedAtMs
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
scope,
|
|
205
|
-
updatedAtMs
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
|
-
async function rollbackReleases(input) {
|
|
209
|
-
const mutations = await Promise.all(input.rollbacks.map((rollback) => prepareRollbackRelease({
|
|
210
|
-
...rollback,
|
|
211
|
-
database: input.database
|
|
212
|
-
})));
|
|
213
|
-
return commitReleaseCatalogMutations({
|
|
214
|
-
database: input.database,
|
|
215
|
-
mutations
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
async function rollbackRelease(input) {
|
|
219
|
-
const [result] = await rollbackReleases({
|
|
220
|
-
database: input.database,
|
|
221
|
-
rollbacks: [input]
|
|
222
|
-
});
|
|
223
|
-
return result;
|
|
224
|
-
}
|
|
225
10
|
//#endregion
|
|
226
|
-
export { ReleaseManagementError
|
|
11
|
+
export { ReleaseManagementError };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BundleSigningAdapter } from "./types/index.cjs";
|
|
2
2
|
//#region src/remoteBundleSigning.d.ts
|
|
3
3
|
declare const REMOTE_BUNDLE_SIGNING_PATH = "/_hot-updater/signing";
|
|
4
4
|
declare const REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION: 1;
|
|
@@ -23,7 +23,7 @@ interface BundleSigningHandlerOptions {
|
|
|
23
23
|
readonly token: string;
|
|
24
24
|
}
|
|
25
25
|
/** Signs through a server implementing the Hot Updater signing protocol. */
|
|
26
|
-
declare const remoteSigning: ({ endpoint, fetch: fetchImplementation, signingToken }: RemoteSigningOptions) =>
|
|
26
|
+
declare const remoteSigning: ({ endpoint, fetch: fetchImplementation, signingToken }: RemoteSigningOptions) => BundleSigningAdapter;
|
|
27
27
|
/** Handles the portable managed signing protocol in Web API runtimes. */
|
|
28
28
|
declare const createBundleSigningHandler: ({ endpointPath, publicKey, request, sign, token }: BundleSigningHandlerOptions) => Promise<Response | null>;
|
|
29
29
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BundleSigningAdapter } from "./types/index.mjs";
|
|
2
2
|
//#region src/remoteBundleSigning.d.ts
|
|
3
3
|
declare const REMOTE_BUNDLE_SIGNING_PATH = "/_hot-updater/signing";
|
|
4
4
|
declare const REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION: 1;
|
|
@@ -23,7 +23,7 @@ interface BundleSigningHandlerOptions {
|
|
|
23
23
|
readonly token: string;
|
|
24
24
|
}
|
|
25
25
|
/** Signs through a server implementing the Hot Updater signing protocol. */
|
|
26
|
-
declare const remoteSigning: ({ endpoint, fetch: fetchImplementation, signingToken }: RemoteSigningOptions) =>
|
|
26
|
+
declare const remoteSigning: ({ endpoint, fetch: fetchImplementation, signingToken }: RemoteSigningOptions) => BundleSigningAdapter;
|
|
27
27
|
/** Handles the portable managed signing protocol in Web API runtimes. */
|
|
28
28
|
declare const createBundleSigningHandler: ({ endpointPath, publicKey, request, sign, token }: BundleSigningHandlerOptions) => Promise<Response | null>;
|
|
29
29
|
//#endregion
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const require_errors = require("./errors.cjs");
|
|
2
|
+
//#region src/serverPlugin/busy.ts
|
|
3
|
+
/** Error names the AWS SDKs give a throttled request, as their retry strategy classifies them. */
|
|
4
|
+
const THROTTLING_NAMES = /* @__PURE__ */ new Set([
|
|
5
|
+
"ProvisionedThroughputExceededException",
|
|
6
|
+
"RequestLimitExceeded",
|
|
7
|
+
"RequestThrottled",
|
|
8
|
+
"RequestThrottledException",
|
|
9
|
+
"SlowDown",
|
|
10
|
+
"ThrottledException",
|
|
11
|
+
"Throttling",
|
|
12
|
+
"ThrottlingException",
|
|
13
|
+
"TooManyRequestsException"
|
|
14
|
+
]);
|
|
15
|
+
/** gRPC's RESOURCE_EXHAUSTED, the status Firestore throttles a request with. */
|
|
16
|
+
const RESOURCE_EXHAUSTED = 8;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the database is busy rather than broken, so the same request can
|
|
19
|
+
* succeed later: a transaction ran out of retries, or the backend throttled
|
|
20
|
+
* a request. Writes already retry transient failures, throttled ones
|
|
21
|
+
* included, until the budget runs out. A throttled read throws the backend's
|
|
22
|
+
* own error, so it is recognized by what the backends call it: a name the
|
|
23
|
+
* AWS SDKs retry as throttling, HTTP 429, or gRPC's RESOURCE_EXHAUSTED.
|
|
24
|
+
*/
|
|
25
|
+
const isDatabaseBusyError = (error) => {
|
|
26
|
+
if (error instanceof require_errors.DatabaseConflictError) return true;
|
|
27
|
+
if (typeof error !== "object" || error === null) return false;
|
|
28
|
+
const { name, code, message, status, statusCode, $metadata } = error;
|
|
29
|
+
return typeof name === "string" && THROTTLING_NAMES.has(name) || [
|
|
30
|
+
status,
|
|
31
|
+
statusCode,
|
|
32
|
+
$metadata?.httpStatusCode
|
|
33
|
+
].includes(429) || code === RESOURCE_EXHAUSTED && typeof message === "string" && message.includes("RESOURCE_EXHAUSTED");
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.isDatabaseBusyError = isDatabaseBusyError;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/serverPlugin/busy.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Whether the database is busy rather than broken, so the same request can
|
|
4
|
+
* succeed later: a transaction ran out of retries, or the backend throttled
|
|
5
|
+
* a request. Writes already retry transient failures, throttled ones
|
|
6
|
+
* included, until the budget runs out. A throttled read throws the backend's
|
|
7
|
+
* own error, so it is recognized by what the backends call it: a name the
|
|
8
|
+
* AWS SDKs retry as throttling, HTTP 429, or gRPC's RESOURCE_EXHAUSTED.
|
|
9
|
+
*/
|
|
10
|
+
declare const isDatabaseBusyError: (error: unknown) => boolean;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { isDatabaseBusyError };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/serverPlugin/busy.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Whether the database is busy rather than broken, so the same request can
|
|
4
|
+
* succeed later: a transaction ran out of retries, or the backend throttled
|
|
5
|
+
* a request. Writes already retry transient failures, throttled ones
|
|
6
|
+
* included, until the budget runs out. A throttled read throws the backend's
|
|
7
|
+
* own error, so it is recognized by what the backends call it: a name the
|
|
8
|
+
* AWS SDKs retry as throttling, HTTP 429, or gRPC's RESOURCE_EXHAUSTED.
|
|
9
|
+
*/
|
|
10
|
+
declare const isDatabaseBusyError: (error: unknown) => boolean;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { isDatabaseBusyError };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { DatabaseConflictError } from "./errors.mjs";
|
|
2
|
+
//#region src/serverPlugin/busy.ts
|
|
3
|
+
/** Error names the AWS SDKs give a throttled request, as their retry strategy classifies them. */
|
|
4
|
+
const THROTTLING_NAMES = /* @__PURE__ */ new Set([
|
|
5
|
+
"ProvisionedThroughputExceededException",
|
|
6
|
+
"RequestLimitExceeded",
|
|
7
|
+
"RequestThrottled",
|
|
8
|
+
"RequestThrottledException",
|
|
9
|
+
"SlowDown",
|
|
10
|
+
"ThrottledException",
|
|
11
|
+
"Throttling",
|
|
12
|
+
"ThrottlingException",
|
|
13
|
+
"TooManyRequestsException"
|
|
14
|
+
]);
|
|
15
|
+
/** gRPC's RESOURCE_EXHAUSTED, the status Firestore throttles a request with. */
|
|
16
|
+
const RESOURCE_EXHAUSTED = 8;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the database is busy rather than broken, so the same request can
|
|
19
|
+
* succeed later: a transaction ran out of retries, or the backend throttled
|
|
20
|
+
* a request. Writes already retry transient failures, throttled ones
|
|
21
|
+
* included, until the budget runs out. A throttled read throws the backend's
|
|
22
|
+
* own error, so it is recognized by what the backends call it: a name the
|
|
23
|
+
* AWS SDKs retry as throttling, HTTP 429, or gRPC's RESOURCE_EXHAUSTED.
|
|
24
|
+
*/
|
|
25
|
+
const isDatabaseBusyError = (error) => {
|
|
26
|
+
if (error instanceof DatabaseConflictError) return true;
|
|
27
|
+
if (typeof error !== "object" || error === null) return false;
|
|
28
|
+
const { name, code, message, status, statusCode, $metadata } = error;
|
|
29
|
+
return typeof name === "string" && THROTTLING_NAMES.has(name) || [
|
|
30
|
+
status,
|
|
31
|
+
statusCode,
|
|
32
|
+
$metadata?.httpStatusCode
|
|
33
|
+
].includes(429) || code === RESOURCE_EXHAUSTED && typeof message === "string" && message.includes("RESOURCE_EXHAUSTED");
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { isDatabaseBusyError };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/serverPlugin/configError.ts
|
|
2
|
+
/** A misconfigured `createHotUpdater` call, reported at startup. */
|
|
3
|
+
var HotUpdaterConfigError = class extends Error {
|
|
4
|
+
name = "HotUpdaterConfigError";
|
|
5
|
+
};
|
|
6
|
+
//#endregion
|
|
7
|
+
exports.HotUpdaterConfigError = HotUpdaterConfigError;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { BundlePatchRow, ChannelRow, ReleaseCatalogRow, ReleaseRow } from "../types/databaseRows.cjs";
|
|
2
|
+
import { BundleDetail, KeysetInput, ReleaseFilter } from "../coreApi.cjs";
|
|
3
|
+
import { ArtifactInfo, ReleaseCatalog } from "@hot-updater/protocol";
|
|
4
|
+
//#region src/serverPlugin/coreReads.d.ts
|
|
5
|
+
/** The scope of a device's update check, by its update strategy. */
|
|
6
|
+
type ReleaseCatalogRequest = {
|
|
7
|
+
readonly strategy: "APP_VERSION";
|
|
8
|
+
readonly platform: "ios" | "android";
|
|
9
|
+
readonly channelKey: string;
|
|
10
|
+
readonly appVersion: string;
|
|
11
|
+
} | {
|
|
12
|
+
readonly strategy: "FINGERPRINT";
|
|
13
|
+
readonly platform: "ios" | "android";
|
|
14
|
+
readonly channelKey: string;
|
|
15
|
+
readonly fingerprintHash: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Core's reads: bundles, Releases, Catalogs, and channels, each through a
|
|
19
|
+
* declared index. A plugin gets them as `ctx.core` and never writes core.
|
|
20
|
+
*/
|
|
21
|
+
interface CoreReads {
|
|
22
|
+
/** The Release Catalog a device's update check receives, or null when its scope has none. */
|
|
23
|
+
getReleaseCatalog(input: ReleaseCatalogRequest): Promise<ReleaseCatalog | null>;
|
|
24
|
+
/** How a device on `currentBundleId` downloads `targetBundleId`. */
|
|
25
|
+
getArtifactInfo(targetBundleId: string, currentBundleId: string, artifactProtocolVersion: 1): Promise<ArtifactInfo | null>;
|
|
26
|
+
getBundle(id: string): Promise<BundleDetail | null>;
|
|
27
|
+
/** Each base bundle's reference counter: one batch read of the bundle rows, and no patches. */
|
|
28
|
+
countBundleChildren(baseBundleIds: readonly string[]): Promise<Record<string, number>>;
|
|
29
|
+
/** One page of the patches that start from a bundle, by target bundle id. */
|
|
30
|
+
listPatchesFromBase(baseBundleId: string, input: KeysetInput): Promise<BundlePatchRow[]>;
|
|
31
|
+
listBundles(input: KeysetInput & {
|
|
32
|
+
readonly platform?: "ios" | "android";
|
|
33
|
+
}): Promise<BundleDetail[]>;
|
|
34
|
+
countBundles(platform?: "ios" | "android"): Promise<number>;
|
|
35
|
+
findBaseBundleIds(candidateKey: string, bundleId: string, limit: number): Promise<string[]>;
|
|
36
|
+
getRelease(id: string): Promise<ReleaseRow | null>;
|
|
37
|
+
/** One page of releases through the index its filter names. */
|
|
38
|
+
listReleases(input: KeysetInput & {
|
|
39
|
+
readonly filter: ReleaseFilter;
|
|
40
|
+
}): Promise<ReleaseRow[]>;
|
|
41
|
+
latestReleaseId(scopeKey: string): Promise<string | null>;
|
|
42
|
+
getReleaseCatalogRow(scopeKey: string): Promise<ReleaseCatalogRow | null>;
|
|
43
|
+
listReleaseCatalogs(input: KeysetInput): Promise<ReleaseCatalogRow[]>;
|
|
44
|
+
listChannels(): Promise<ChannelRow[]>;
|
|
45
|
+
findChannelByName(name: string): Promise<ChannelRow | null>;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { CoreReads, ReleaseCatalogRequest };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { BundlePatchRow, ChannelRow, ReleaseCatalogRow, ReleaseRow } from "../types/databaseRows.mjs";
|
|
2
|
+
import { BundleDetail, KeysetInput, ReleaseFilter } from "../coreApi.mjs";
|
|
3
|
+
import { ArtifactInfo, ReleaseCatalog } from "@hot-updater/protocol";
|
|
4
|
+
//#region src/serverPlugin/coreReads.d.ts
|
|
5
|
+
/** The scope of a device's update check, by its update strategy. */
|
|
6
|
+
type ReleaseCatalogRequest = {
|
|
7
|
+
readonly strategy: "APP_VERSION";
|
|
8
|
+
readonly platform: "ios" | "android";
|
|
9
|
+
readonly channelKey: string;
|
|
10
|
+
readonly appVersion: string;
|
|
11
|
+
} | {
|
|
12
|
+
readonly strategy: "FINGERPRINT";
|
|
13
|
+
readonly platform: "ios" | "android";
|
|
14
|
+
readonly channelKey: string;
|
|
15
|
+
readonly fingerprintHash: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Core's reads: bundles, Releases, Catalogs, and channels, each through a
|
|
19
|
+
* declared index. A plugin gets them as `ctx.core` and never writes core.
|
|
20
|
+
*/
|
|
21
|
+
interface CoreReads {
|
|
22
|
+
/** The Release Catalog a device's update check receives, or null when its scope has none. */
|
|
23
|
+
getReleaseCatalog(input: ReleaseCatalogRequest): Promise<ReleaseCatalog | null>;
|
|
24
|
+
/** How a device on `currentBundleId` downloads `targetBundleId`. */
|
|
25
|
+
getArtifactInfo(targetBundleId: string, currentBundleId: string, artifactProtocolVersion: 1): Promise<ArtifactInfo | null>;
|
|
26
|
+
getBundle(id: string): Promise<BundleDetail | null>;
|
|
27
|
+
/** Each base bundle's reference counter: one batch read of the bundle rows, and no patches. */
|
|
28
|
+
countBundleChildren(baseBundleIds: readonly string[]): Promise<Record<string, number>>;
|
|
29
|
+
/** One page of the patches that start from a bundle, by target bundle id. */
|
|
30
|
+
listPatchesFromBase(baseBundleId: string, input: KeysetInput): Promise<BundlePatchRow[]>;
|
|
31
|
+
listBundles(input: KeysetInput & {
|
|
32
|
+
readonly platform?: "ios" | "android";
|
|
33
|
+
}): Promise<BundleDetail[]>;
|
|
34
|
+
countBundles(platform?: "ios" | "android"): Promise<number>;
|
|
35
|
+
findBaseBundleIds(candidateKey: string, bundleId: string, limit: number): Promise<string[]>;
|
|
36
|
+
getRelease(id: string): Promise<ReleaseRow | null>;
|
|
37
|
+
/** One page of releases through the index its filter names. */
|
|
38
|
+
listReleases(input: KeysetInput & {
|
|
39
|
+
readonly filter: ReleaseFilter;
|
|
40
|
+
}): Promise<ReleaseRow[]>;
|
|
41
|
+
latestReleaseId(scopeKey: string): Promise<string | null>;
|
|
42
|
+
getReleaseCatalogRow(scopeKey: string): Promise<ReleaseCatalogRow | null>;
|
|
43
|
+
listReleaseCatalogs(input: KeysetInput): Promise<ReleaseCatalogRow[]>;
|
|
44
|
+
listChannels(): Promise<ChannelRow[]>;
|
|
45
|
+
findChannelByName(name: string): Promise<ChannelRow | null>;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { CoreReads, ReleaseCatalogRequest };
|