@hot-updater/plugin-core 1.0.0-rc.2 → 1.0.0-rc.21
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,298 +0,0 @@
|
|
|
1
|
-
import { ApiKeyRow, BundleEventRow, BundlePatchRow, BundleRow, ChannelRow, InsightsInstallationRow, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.cjs";
|
|
2
|
-
import { BundleRowUpdate, ReleaseRowUpdate } from "./databaseOperations.cjs";
|
|
3
|
-
import { DatabaseBundleQueryOrder, DatabaseBundleQueryWhere } from "./index.cjs";
|
|
4
|
-
//#region src/types/databasePlugin.d.ts
|
|
5
|
-
interface BundleModelQuery {
|
|
6
|
-
readonly where?: DatabaseBundleQueryWhere;
|
|
7
|
-
readonly limit: number;
|
|
8
|
-
readonly offset: number;
|
|
9
|
-
readonly orderBy: DatabaseBundleQueryOrder;
|
|
10
|
-
}
|
|
11
|
-
interface BundleModel {
|
|
12
|
-
findById(id: string): Promise<BundleRow | null>;
|
|
13
|
-
findMany(query: BundleModelQuery): Promise<readonly BundleRow[]>;
|
|
14
|
-
count(where?: DatabaseBundleQueryWhere): Promise<number>;
|
|
15
|
-
}
|
|
16
|
-
interface BundlePatchModel {
|
|
17
|
-
findByBundleIds(bundleIds: readonly string[]): Promise<readonly BundlePatchRow[]>;
|
|
18
|
-
}
|
|
19
|
-
interface ReleaseModel {
|
|
20
|
-
findById(id: string): Promise<ReleaseRow | null>;
|
|
21
|
-
findMany(input: {
|
|
22
|
-
readonly afterReleaseId?: string;
|
|
23
|
-
readonly beforeReleaseId?: string;
|
|
24
|
-
readonly bundleId?: string;
|
|
25
|
-
readonly channelId?: string;
|
|
26
|
-
readonly enabled?: boolean;
|
|
27
|
-
readonly platform?: "ios" | "android";
|
|
28
|
-
readonly targetAppVersion?: string;
|
|
29
|
-
readonly limit: number;
|
|
30
|
-
}): Promise<readonly ReleaseRow[]>;
|
|
31
|
-
findManyByScope(input: {
|
|
32
|
-
readonly scopeKey: string;
|
|
33
|
-
readonly afterReleaseId?: string;
|
|
34
|
-
readonly limit: number;
|
|
35
|
-
readonly consistency: "strong";
|
|
36
|
-
}): Promise<readonly ReleaseRow[]>;
|
|
37
|
-
}
|
|
38
|
-
interface ReleaseCatalogModel {
|
|
39
|
-
findByScopeKey(scopeKey: string): Promise<ReleaseCatalogRow | null>;
|
|
40
|
-
findMany(input: {
|
|
41
|
-
readonly afterScopeKey?: string;
|
|
42
|
-
readonly limit: number;
|
|
43
|
-
}): Promise<readonly ReleaseCatalogRow[]>;
|
|
44
|
-
}
|
|
45
|
-
interface InsightsEventCursor {
|
|
46
|
-
readonly receivedAtMs: number;
|
|
47
|
-
readonly id: string;
|
|
48
|
-
}
|
|
49
|
-
interface InsightsScope {
|
|
50
|
-
readonly platform: "ios" | "android";
|
|
51
|
-
readonly channel: string;
|
|
52
|
-
}
|
|
53
|
-
/** Raw event predicates; recovery is attributed to the source bundle. */
|
|
54
|
-
type InsightsBundleEventFilter = InsightsScope & ({
|
|
55
|
-
readonly type: "RECOVERED";
|
|
56
|
-
readonly fromBundleId: string;
|
|
57
|
-
} | {
|
|
58
|
-
readonly type: "UPDATE_APPLIED" | "RELEASE_ADOPTED";
|
|
59
|
-
readonly toBundleId: string;
|
|
60
|
-
});
|
|
61
|
-
type InsightsEventFilter = {
|
|
62
|
-
readonly kind: "all";
|
|
63
|
-
} | {
|
|
64
|
-
readonly kind: "installationMovement";
|
|
65
|
-
readonly installId: string;
|
|
66
|
-
} | ({
|
|
67
|
-
readonly kind: "bundle";
|
|
68
|
-
} & InsightsBundleEventFilter);
|
|
69
|
-
interface InsightsRecordInput {
|
|
70
|
-
readonly event: BundleEventRow;
|
|
71
|
-
readonly installation: InsightsInstallationRow;
|
|
72
|
-
}
|
|
73
|
-
interface InsightsListEventsInput {
|
|
74
|
-
readonly filter: InsightsEventFilter;
|
|
75
|
-
readonly sinceMs?: number;
|
|
76
|
-
readonly beforeReceivedAtMs: number;
|
|
77
|
-
readonly after?: InsightsEventCursor;
|
|
78
|
-
readonly limit: number;
|
|
79
|
-
}
|
|
80
|
-
type InsightsFindInstallationsInput = {
|
|
81
|
-
readonly installId: string;
|
|
82
|
-
} | {
|
|
83
|
-
readonly userId: string;
|
|
84
|
-
readonly afterInstallId?: string;
|
|
85
|
-
readonly limit: number;
|
|
86
|
-
};
|
|
87
|
-
interface InsightsCountInstallationsInput extends InsightsScope {
|
|
88
|
-
readonly sinceMs: number;
|
|
89
|
-
readonly bundleId?: string;
|
|
90
|
-
}
|
|
91
|
-
interface InsightsCountEventsInput {
|
|
92
|
-
readonly filter: InsightsBundleEventFilter;
|
|
93
|
-
readonly sinceMs: number;
|
|
94
|
-
readonly beforeReceivedAtMs: number;
|
|
95
|
-
}
|
|
96
|
-
interface InsightsModel {
|
|
97
|
-
/**
|
|
98
|
-
* Atomically persist the immutable event and advance its installation only
|
|
99
|
-
* for a greater (received_at_ms, id). Duplicate event IDs are complete no-ops.
|
|
100
|
-
* Retry the identical prepared input after an ambiguous commit outcome.
|
|
101
|
-
*/
|
|
102
|
-
record(input: InsightsRecordInput): Promise<void>;
|
|
103
|
-
/**
|
|
104
|
-
* Descending (received_at_ms, id), in [sinceMs ?? 0, beforeReceivedAtMs).
|
|
105
|
-
* Apply filters and the exclusive cursor before limit (1..101). Return the
|
|
106
|
-
* complete matching prefix; native continuation pages must not truncate it.
|
|
107
|
-
*/
|
|
108
|
-
listEvents(input: InsightsListEventsInput): Promise<readonly BundleEventRow[]>;
|
|
109
|
-
/**
|
|
110
|
-
* Exact installation lookup returns zero or one canonical row. User lookup
|
|
111
|
-
* returns current membership ordered by UTF-8 installation ID, exclusive
|
|
112
|
-
* afterInstallId and limit 1..101. Check lagging index candidates against
|
|
113
|
-
* canonical state; newly indexed associations may temporarily be absent.
|
|
114
|
-
*/
|
|
115
|
-
findInstallations(input: InsightsFindInstallationsInput): Promise<readonly InsightsInstallationRow[]>;
|
|
116
|
-
/** Count latest rows in scope with received_at_ms >= sinceMs, once each. */
|
|
117
|
-
countInstallations(input: InsightsCountInstallationsInput): Promise<number>;
|
|
118
|
-
/** Count accepted reports in [sinceMs, beforeReceivedAtMs), across all pages. */
|
|
119
|
-
countEvents(input: InsightsCountEventsInput): Promise<number>;
|
|
120
|
-
}
|
|
121
|
-
interface ApiKeyModel {
|
|
122
|
-
create(row: ApiKeyRow): Promise<"created" | "existing">;
|
|
123
|
-
findByHash(hash: string): Promise<ApiKeyRow | null>;
|
|
124
|
-
list(): Promise<readonly ApiKeyRow[]>;
|
|
125
|
-
revoke(input: {
|
|
126
|
-
readonly id: string;
|
|
127
|
-
readonly revokedAtMs: number;
|
|
128
|
-
}): Promise<ApiKeyRow | null>;
|
|
129
|
-
}
|
|
130
|
-
interface ChannelInsertInput {
|
|
131
|
-
readonly row: ChannelRow;
|
|
132
|
-
readonly onConflict: "returnExisting";
|
|
133
|
-
}
|
|
134
|
-
interface ChannelInsertResult {
|
|
135
|
-
readonly row: ChannelRow;
|
|
136
|
-
readonly inserted: boolean;
|
|
137
|
-
}
|
|
138
|
-
interface ChannelDeleteInput {
|
|
139
|
-
readonly id: string;
|
|
140
|
-
}
|
|
141
|
-
type ChannelDeleteResult = {
|
|
142
|
-
readonly deleted: true;
|
|
143
|
-
} | {
|
|
144
|
-
readonly deleted: false;
|
|
145
|
-
readonly reason: "not_found" | "not_empty";
|
|
146
|
-
};
|
|
147
|
-
interface ChannelModel {
|
|
148
|
-
insert(input: ChannelInsertInput): Promise<ChannelInsertResult>;
|
|
149
|
-
list(input: {}): Promise<{
|
|
150
|
-
readonly channels: readonly ChannelRow[];
|
|
151
|
-
}>;
|
|
152
|
-
delete(input: ChannelDeleteInput): Promise<ChannelDeleteResult>;
|
|
153
|
-
}
|
|
154
|
-
type DatabaseChange = {
|
|
155
|
-
readonly model: "bundles";
|
|
156
|
-
readonly operation: "insert";
|
|
157
|
-
readonly row: BundleRow;
|
|
158
|
-
} | {
|
|
159
|
-
readonly model: "bundles";
|
|
160
|
-
readonly operation: "update";
|
|
161
|
-
readonly where: {
|
|
162
|
-
readonly id: string;
|
|
163
|
-
};
|
|
164
|
-
readonly update: BundleRowUpdate;
|
|
165
|
-
} | {
|
|
166
|
-
readonly model: "bundles";
|
|
167
|
-
readonly operation: "delete";
|
|
168
|
-
readonly where: {
|
|
169
|
-
readonly id: string;
|
|
170
|
-
};
|
|
171
|
-
} | {
|
|
172
|
-
readonly model: "bundlePatches";
|
|
173
|
-
readonly operation: "insert";
|
|
174
|
-
readonly row: BundlePatchRow;
|
|
175
|
-
} | {
|
|
176
|
-
readonly model: "bundlePatches";
|
|
177
|
-
readonly operation: "delete";
|
|
178
|
-
readonly where: {
|
|
179
|
-
readonly bundleId: string;
|
|
180
|
-
};
|
|
181
|
-
} | {
|
|
182
|
-
readonly model: "releases";
|
|
183
|
-
readonly operation: "insert";
|
|
184
|
-
readonly row: ReleaseRow;
|
|
185
|
-
} | {
|
|
186
|
-
readonly model: "releases";
|
|
187
|
-
readonly operation: "update";
|
|
188
|
-
readonly where: {
|
|
189
|
-
readonly id: string;
|
|
190
|
-
};
|
|
191
|
-
readonly update: ReleaseRowUpdate;
|
|
192
|
-
} | {
|
|
193
|
-
readonly model: "releases";
|
|
194
|
-
readonly operation: "delete";
|
|
195
|
-
readonly where: {
|
|
196
|
-
readonly id: string;
|
|
197
|
-
};
|
|
198
|
-
} | {
|
|
199
|
-
readonly model: "releaseCatalogs";
|
|
200
|
-
readonly operation: "put";
|
|
201
|
-
readonly row: ReleaseCatalogRow;
|
|
202
|
-
} | {
|
|
203
|
-
readonly model: "channels";
|
|
204
|
-
readonly operation: "insert";
|
|
205
|
-
readonly row: ChannelRow;
|
|
206
|
-
readonly onConflict: "ignore";
|
|
207
|
-
} | {
|
|
208
|
-
readonly model: "channels";
|
|
209
|
-
readonly operation: "delete";
|
|
210
|
-
readonly where: {
|
|
211
|
-
readonly id: string;
|
|
212
|
-
};
|
|
213
|
-
} | {
|
|
214
|
-
readonly model: "apiKeys";
|
|
215
|
-
readonly operation: "insert";
|
|
216
|
-
readonly row: ApiKeyRow;
|
|
217
|
-
readonly onConflict: "ignore";
|
|
218
|
-
} | {
|
|
219
|
-
readonly model: "apiKeys";
|
|
220
|
-
readonly operation: "update";
|
|
221
|
-
readonly where: {
|
|
222
|
-
readonly id: string;
|
|
223
|
-
};
|
|
224
|
-
readonly update: {
|
|
225
|
-
readonly revokedAtMs: number;
|
|
226
|
-
};
|
|
227
|
-
};
|
|
228
|
-
type DatabaseCommitExpectation = {
|
|
229
|
-
readonly model: "releases";
|
|
230
|
-
readonly id: string;
|
|
231
|
-
readonly revision: number | null;
|
|
232
|
-
} | {
|
|
233
|
-
readonly model: "releaseCatalogs";
|
|
234
|
-
readonly scopeKey: string;
|
|
235
|
-
readonly generation: number | null;
|
|
236
|
-
};
|
|
237
|
-
interface DatabaseCommit {
|
|
238
|
-
readonly changes: readonly DatabaseChange[];
|
|
239
|
-
readonly expectations?: readonly DatabaseCommitExpectation[];
|
|
240
|
-
}
|
|
241
|
-
type BundleRepositoryBundleChange = Extract<DatabaseChange, {
|
|
242
|
-
readonly model: "bundles" | "bundlePatches";
|
|
243
|
-
}>;
|
|
244
|
-
type BundleRepositoryChannelChange = Extract<DatabaseChange, {
|
|
245
|
-
readonly model: "channels";
|
|
246
|
-
}>;
|
|
247
|
-
type BundleRepositoryChange = BundleRepositoryBundleChange | BundleRepositoryChannelChange;
|
|
248
|
-
/**
|
|
249
|
-
* The atomic envelopes supported by a bundle-management repository.
|
|
250
|
-
*
|
|
251
|
-
* Bundle and patch changes form one aggregate commit. Channel lifecycle is a
|
|
252
|
-
* separate single-change commit because the standalone HTTP boundary cannot
|
|
253
|
-
* atomically combine a Channel write with a bundle aggregate write.
|
|
254
|
-
*/
|
|
255
|
-
type BundleRepositoryCommit = {
|
|
256
|
-
readonly changes: readonly BundleRepositoryBundleChange[];
|
|
257
|
-
} | {
|
|
258
|
-
readonly changes: readonly [BundleRepositoryChannelChange];
|
|
259
|
-
};
|
|
260
|
-
type DatabaseCommitResult = {
|
|
261
|
-
readonly committed: true;
|
|
262
|
-
} | {
|
|
263
|
-
readonly committed: false;
|
|
264
|
-
readonly conflict: {
|
|
265
|
-
readonly changeIndex: number;
|
|
266
|
-
readonly reason: "not_found" | "referenced";
|
|
267
|
-
} | {
|
|
268
|
-
readonly changeIndex: -1;
|
|
269
|
-
readonly reason: "version_conflict";
|
|
270
|
-
readonly model: "releases" | "releaseCatalogs";
|
|
271
|
-
readonly key: string;
|
|
272
|
-
readonly expectedVersion: number | null;
|
|
273
|
-
readonly actualVersion: number | null;
|
|
274
|
-
};
|
|
275
|
-
};
|
|
276
|
-
interface DatabaseModels {
|
|
277
|
-
readonly bundles: BundleModel;
|
|
278
|
-
readonly bundlePatches: BundlePatchModel;
|
|
279
|
-
readonly releases: ReleaseModel;
|
|
280
|
-
readonly releaseCatalogs: ReleaseCatalogModel;
|
|
281
|
-
readonly channels: ChannelModel;
|
|
282
|
-
readonly insights: InsightsModel;
|
|
283
|
-
readonly apiKeys: ApiKeyModel;
|
|
284
|
-
}
|
|
285
|
-
interface BundleRepository {
|
|
286
|
-
readonly name: string;
|
|
287
|
-
readonly models: Pick<DatabaseModels, "bundles" | "bundlePatches" | "channels" | "releaseCatalogs" | "releases">;
|
|
288
|
-
commit(input: DatabaseCommit): Promise<DatabaseCommitResult>;
|
|
289
|
-
dispose?: () => Promise<void>;
|
|
290
|
-
}
|
|
291
|
-
interface DatabasePlugin {
|
|
292
|
-
readonly name: string;
|
|
293
|
-
readonly models: DatabaseModels;
|
|
294
|
-
commit(input: DatabaseCommit): Promise<DatabaseCommitResult>;
|
|
295
|
-
dispose?: () => Promise<void>;
|
|
296
|
-
}
|
|
297
|
-
//#endregion
|
|
298
|
-
export { ApiKeyModel, BundleModel, BundleModelQuery, BundlePatchModel, BundleRepository, BundleRepositoryChange, BundleRepositoryCommit, ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelModel, DatabaseChange, DatabaseCommit, DatabaseCommitExpectation, DatabaseCommitResult, DatabaseModels, DatabasePlugin, InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountInstallationsInput, InsightsEventCursor, InsightsEventFilter, InsightsFindInstallationsInput, InsightsListEventsInput, InsightsModel, InsightsRecordInput, InsightsScope, ReleaseCatalogModel, ReleaseModel };
|
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
import { ApiKeyRow, BundleEventRow, BundlePatchRow, BundleRow, ChannelRow, InsightsInstallationRow, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.mjs";
|
|
2
|
-
import { BundleRowUpdate, ReleaseRowUpdate } from "./databaseOperations.mjs";
|
|
3
|
-
import { DatabaseBundleQueryOrder, DatabaseBundleQueryWhere } from "./index.mjs";
|
|
4
|
-
//#region src/types/databasePlugin.d.ts
|
|
5
|
-
interface BundleModelQuery {
|
|
6
|
-
readonly where?: DatabaseBundleQueryWhere;
|
|
7
|
-
readonly limit: number;
|
|
8
|
-
readonly offset: number;
|
|
9
|
-
readonly orderBy: DatabaseBundleQueryOrder;
|
|
10
|
-
}
|
|
11
|
-
interface BundleModel {
|
|
12
|
-
findById(id: string): Promise<BundleRow | null>;
|
|
13
|
-
findMany(query: BundleModelQuery): Promise<readonly BundleRow[]>;
|
|
14
|
-
count(where?: DatabaseBundleQueryWhere): Promise<number>;
|
|
15
|
-
}
|
|
16
|
-
interface BundlePatchModel {
|
|
17
|
-
findByBundleIds(bundleIds: readonly string[]): Promise<readonly BundlePatchRow[]>;
|
|
18
|
-
}
|
|
19
|
-
interface ReleaseModel {
|
|
20
|
-
findById(id: string): Promise<ReleaseRow | null>;
|
|
21
|
-
findMany(input: {
|
|
22
|
-
readonly afterReleaseId?: string;
|
|
23
|
-
readonly beforeReleaseId?: string;
|
|
24
|
-
readonly bundleId?: string;
|
|
25
|
-
readonly channelId?: string;
|
|
26
|
-
readonly enabled?: boolean;
|
|
27
|
-
readonly platform?: "ios" | "android";
|
|
28
|
-
readonly targetAppVersion?: string;
|
|
29
|
-
readonly limit: number;
|
|
30
|
-
}): Promise<readonly ReleaseRow[]>;
|
|
31
|
-
findManyByScope(input: {
|
|
32
|
-
readonly scopeKey: string;
|
|
33
|
-
readonly afterReleaseId?: string;
|
|
34
|
-
readonly limit: number;
|
|
35
|
-
readonly consistency: "strong";
|
|
36
|
-
}): Promise<readonly ReleaseRow[]>;
|
|
37
|
-
}
|
|
38
|
-
interface ReleaseCatalogModel {
|
|
39
|
-
findByScopeKey(scopeKey: string): Promise<ReleaseCatalogRow | null>;
|
|
40
|
-
findMany(input: {
|
|
41
|
-
readonly afterScopeKey?: string;
|
|
42
|
-
readonly limit: number;
|
|
43
|
-
}): Promise<readonly ReleaseCatalogRow[]>;
|
|
44
|
-
}
|
|
45
|
-
interface InsightsEventCursor {
|
|
46
|
-
readonly receivedAtMs: number;
|
|
47
|
-
readonly id: string;
|
|
48
|
-
}
|
|
49
|
-
interface InsightsScope {
|
|
50
|
-
readonly platform: "ios" | "android";
|
|
51
|
-
readonly channel: string;
|
|
52
|
-
}
|
|
53
|
-
/** Raw event predicates; recovery is attributed to the source bundle. */
|
|
54
|
-
type InsightsBundleEventFilter = InsightsScope & ({
|
|
55
|
-
readonly type: "RECOVERED";
|
|
56
|
-
readonly fromBundleId: string;
|
|
57
|
-
} | {
|
|
58
|
-
readonly type: "UPDATE_APPLIED" | "RELEASE_ADOPTED";
|
|
59
|
-
readonly toBundleId: string;
|
|
60
|
-
});
|
|
61
|
-
type InsightsEventFilter = {
|
|
62
|
-
readonly kind: "all";
|
|
63
|
-
} | {
|
|
64
|
-
readonly kind: "installationMovement";
|
|
65
|
-
readonly installId: string;
|
|
66
|
-
} | ({
|
|
67
|
-
readonly kind: "bundle";
|
|
68
|
-
} & InsightsBundleEventFilter);
|
|
69
|
-
interface InsightsRecordInput {
|
|
70
|
-
readonly event: BundleEventRow;
|
|
71
|
-
readonly installation: InsightsInstallationRow;
|
|
72
|
-
}
|
|
73
|
-
interface InsightsListEventsInput {
|
|
74
|
-
readonly filter: InsightsEventFilter;
|
|
75
|
-
readonly sinceMs?: number;
|
|
76
|
-
readonly beforeReceivedAtMs: number;
|
|
77
|
-
readonly after?: InsightsEventCursor;
|
|
78
|
-
readonly limit: number;
|
|
79
|
-
}
|
|
80
|
-
type InsightsFindInstallationsInput = {
|
|
81
|
-
readonly installId: string;
|
|
82
|
-
} | {
|
|
83
|
-
readonly userId: string;
|
|
84
|
-
readonly afterInstallId?: string;
|
|
85
|
-
readonly limit: number;
|
|
86
|
-
};
|
|
87
|
-
interface InsightsCountInstallationsInput extends InsightsScope {
|
|
88
|
-
readonly sinceMs: number;
|
|
89
|
-
readonly bundleId?: string;
|
|
90
|
-
}
|
|
91
|
-
interface InsightsCountEventsInput {
|
|
92
|
-
readonly filter: InsightsBundleEventFilter;
|
|
93
|
-
readonly sinceMs: number;
|
|
94
|
-
readonly beforeReceivedAtMs: number;
|
|
95
|
-
}
|
|
96
|
-
interface InsightsModel {
|
|
97
|
-
/**
|
|
98
|
-
* Atomically persist the immutable event and advance its installation only
|
|
99
|
-
* for a greater (received_at_ms, id). Duplicate event IDs are complete no-ops.
|
|
100
|
-
* Retry the identical prepared input after an ambiguous commit outcome.
|
|
101
|
-
*/
|
|
102
|
-
record(input: InsightsRecordInput): Promise<void>;
|
|
103
|
-
/**
|
|
104
|
-
* Descending (received_at_ms, id), in [sinceMs ?? 0, beforeReceivedAtMs).
|
|
105
|
-
* Apply filters and the exclusive cursor before limit (1..101). Return the
|
|
106
|
-
* complete matching prefix; native continuation pages must not truncate it.
|
|
107
|
-
*/
|
|
108
|
-
listEvents(input: InsightsListEventsInput): Promise<readonly BundleEventRow[]>;
|
|
109
|
-
/**
|
|
110
|
-
* Exact installation lookup returns zero or one canonical row. User lookup
|
|
111
|
-
* returns current membership ordered by UTF-8 installation ID, exclusive
|
|
112
|
-
* afterInstallId and limit 1..101. Check lagging index candidates against
|
|
113
|
-
* canonical state; newly indexed associations may temporarily be absent.
|
|
114
|
-
*/
|
|
115
|
-
findInstallations(input: InsightsFindInstallationsInput): Promise<readonly InsightsInstallationRow[]>;
|
|
116
|
-
/** Count latest rows in scope with received_at_ms >= sinceMs, once each. */
|
|
117
|
-
countInstallations(input: InsightsCountInstallationsInput): Promise<number>;
|
|
118
|
-
/** Count accepted reports in [sinceMs, beforeReceivedAtMs), across all pages. */
|
|
119
|
-
countEvents(input: InsightsCountEventsInput): Promise<number>;
|
|
120
|
-
}
|
|
121
|
-
interface ApiKeyModel {
|
|
122
|
-
create(row: ApiKeyRow): Promise<"created" | "existing">;
|
|
123
|
-
findByHash(hash: string): Promise<ApiKeyRow | null>;
|
|
124
|
-
list(): Promise<readonly ApiKeyRow[]>;
|
|
125
|
-
revoke(input: {
|
|
126
|
-
readonly id: string;
|
|
127
|
-
readonly revokedAtMs: number;
|
|
128
|
-
}): Promise<ApiKeyRow | null>;
|
|
129
|
-
}
|
|
130
|
-
interface ChannelInsertInput {
|
|
131
|
-
readonly row: ChannelRow;
|
|
132
|
-
readonly onConflict: "returnExisting";
|
|
133
|
-
}
|
|
134
|
-
interface ChannelInsertResult {
|
|
135
|
-
readonly row: ChannelRow;
|
|
136
|
-
readonly inserted: boolean;
|
|
137
|
-
}
|
|
138
|
-
interface ChannelDeleteInput {
|
|
139
|
-
readonly id: string;
|
|
140
|
-
}
|
|
141
|
-
type ChannelDeleteResult = {
|
|
142
|
-
readonly deleted: true;
|
|
143
|
-
} | {
|
|
144
|
-
readonly deleted: false;
|
|
145
|
-
readonly reason: "not_found" | "not_empty";
|
|
146
|
-
};
|
|
147
|
-
interface ChannelModel {
|
|
148
|
-
insert(input: ChannelInsertInput): Promise<ChannelInsertResult>;
|
|
149
|
-
list(input: {}): Promise<{
|
|
150
|
-
readonly channels: readonly ChannelRow[];
|
|
151
|
-
}>;
|
|
152
|
-
delete(input: ChannelDeleteInput): Promise<ChannelDeleteResult>;
|
|
153
|
-
}
|
|
154
|
-
type DatabaseChange = {
|
|
155
|
-
readonly model: "bundles";
|
|
156
|
-
readonly operation: "insert";
|
|
157
|
-
readonly row: BundleRow;
|
|
158
|
-
} | {
|
|
159
|
-
readonly model: "bundles";
|
|
160
|
-
readonly operation: "update";
|
|
161
|
-
readonly where: {
|
|
162
|
-
readonly id: string;
|
|
163
|
-
};
|
|
164
|
-
readonly update: BundleRowUpdate;
|
|
165
|
-
} | {
|
|
166
|
-
readonly model: "bundles";
|
|
167
|
-
readonly operation: "delete";
|
|
168
|
-
readonly where: {
|
|
169
|
-
readonly id: string;
|
|
170
|
-
};
|
|
171
|
-
} | {
|
|
172
|
-
readonly model: "bundlePatches";
|
|
173
|
-
readonly operation: "insert";
|
|
174
|
-
readonly row: BundlePatchRow;
|
|
175
|
-
} | {
|
|
176
|
-
readonly model: "bundlePatches";
|
|
177
|
-
readonly operation: "delete";
|
|
178
|
-
readonly where: {
|
|
179
|
-
readonly bundleId: string;
|
|
180
|
-
};
|
|
181
|
-
} | {
|
|
182
|
-
readonly model: "releases";
|
|
183
|
-
readonly operation: "insert";
|
|
184
|
-
readonly row: ReleaseRow;
|
|
185
|
-
} | {
|
|
186
|
-
readonly model: "releases";
|
|
187
|
-
readonly operation: "update";
|
|
188
|
-
readonly where: {
|
|
189
|
-
readonly id: string;
|
|
190
|
-
};
|
|
191
|
-
readonly update: ReleaseRowUpdate;
|
|
192
|
-
} | {
|
|
193
|
-
readonly model: "releases";
|
|
194
|
-
readonly operation: "delete";
|
|
195
|
-
readonly where: {
|
|
196
|
-
readonly id: string;
|
|
197
|
-
};
|
|
198
|
-
} | {
|
|
199
|
-
readonly model: "releaseCatalogs";
|
|
200
|
-
readonly operation: "put";
|
|
201
|
-
readonly row: ReleaseCatalogRow;
|
|
202
|
-
} | {
|
|
203
|
-
readonly model: "channels";
|
|
204
|
-
readonly operation: "insert";
|
|
205
|
-
readonly row: ChannelRow;
|
|
206
|
-
readonly onConflict: "ignore";
|
|
207
|
-
} | {
|
|
208
|
-
readonly model: "channels";
|
|
209
|
-
readonly operation: "delete";
|
|
210
|
-
readonly where: {
|
|
211
|
-
readonly id: string;
|
|
212
|
-
};
|
|
213
|
-
} | {
|
|
214
|
-
readonly model: "apiKeys";
|
|
215
|
-
readonly operation: "insert";
|
|
216
|
-
readonly row: ApiKeyRow;
|
|
217
|
-
readonly onConflict: "ignore";
|
|
218
|
-
} | {
|
|
219
|
-
readonly model: "apiKeys";
|
|
220
|
-
readonly operation: "update";
|
|
221
|
-
readonly where: {
|
|
222
|
-
readonly id: string;
|
|
223
|
-
};
|
|
224
|
-
readonly update: {
|
|
225
|
-
readonly revokedAtMs: number;
|
|
226
|
-
};
|
|
227
|
-
};
|
|
228
|
-
type DatabaseCommitExpectation = {
|
|
229
|
-
readonly model: "releases";
|
|
230
|
-
readonly id: string;
|
|
231
|
-
readonly revision: number | null;
|
|
232
|
-
} | {
|
|
233
|
-
readonly model: "releaseCatalogs";
|
|
234
|
-
readonly scopeKey: string;
|
|
235
|
-
readonly generation: number | null;
|
|
236
|
-
};
|
|
237
|
-
interface DatabaseCommit {
|
|
238
|
-
readonly changes: readonly DatabaseChange[];
|
|
239
|
-
readonly expectations?: readonly DatabaseCommitExpectation[];
|
|
240
|
-
}
|
|
241
|
-
type BundleRepositoryBundleChange = Extract<DatabaseChange, {
|
|
242
|
-
readonly model: "bundles" | "bundlePatches";
|
|
243
|
-
}>;
|
|
244
|
-
type BundleRepositoryChannelChange = Extract<DatabaseChange, {
|
|
245
|
-
readonly model: "channels";
|
|
246
|
-
}>;
|
|
247
|
-
type BundleRepositoryChange = BundleRepositoryBundleChange | BundleRepositoryChannelChange;
|
|
248
|
-
/**
|
|
249
|
-
* The atomic envelopes supported by a bundle-management repository.
|
|
250
|
-
*
|
|
251
|
-
* Bundle and patch changes form one aggregate commit. Channel lifecycle is a
|
|
252
|
-
* separate single-change commit because the standalone HTTP boundary cannot
|
|
253
|
-
* atomically combine a Channel write with a bundle aggregate write.
|
|
254
|
-
*/
|
|
255
|
-
type BundleRepositoryCommit = {
|
|
256
|
-
readonly changes: readonly BundleRepositoryBundleChange[];
|
|
257
|
-
} | {
|
|
258
|
-
readonly changes: readonly [BundleRepositoryChannelChange];
|
|
259
|
-
};
|
|
260
|
-
type DatabaseCommitResult = {
|
|
261
|
-
readonly committed: true;
|
|
262
|
-
} | {
|
|
263
|
-
readonly committed: false;
|
|
264
|
-
readonly conflict: {
|
|
265
|
-
readonly changeIndex: number;
|
|
266
|
-
readonly reason: "not_found" | "referenced";
|
|
267
|
-
} | {
|
|
268
|
-
readonly changeIndex: -1;
|
|
269
|
-
readonly reason: "version_conflict";
|
|
270
|
-
readonly model: "releases" | "releaseCatalogs";
|
|
271
|
-
readonly key: string;
|
|
272
|
-
readonly expectedVersion: number | null;
|
|
273
|
-
readonly actualVersion: number | null;
|
|
274
|
-
};
|
|
275
|
-
};
|
|
276
|
-
interface DatabaseModels {
|
|
277
|
-
readonly bundles: BundleModel;
|
|
278
|
-
readonly bundlePatches: BundlePatchModel;
|
|
279
|
-
readonly releases: ReleaseModel;
|
|
280
|
-
readonly releaseCatalogs: ReleaseCatalogModel;
|
|
281
|
-
readonly channels: ChannelModel;
|
|
282
|
-
readonly insights: InsightsModel;
|
|
283
|
-
readonly apiKeys: ApiKeyModel;
|
|
284
|
-
}
|
|
285
|
-
interface BundleRepository {
|
|
286
|
-
readonly name: string;
|
|
287
|
-
readonly models: Pick<DatabaseModels, "bundles" | "bundlePatches" | "channels" | "releaseCatalogs" | "releases">;
|
|
288
|
-
commit(input: DatabaseCommit): Promise<DatabaseCommitResult>;
|
|
289
|
-
dispose?: () => Promise<void>;
|
|
290
|
-
}
|
|
291
|
-
interface DatabasePlugin {
|
|
292
|
-
readonly name: string;
|
|
293
|
-
readonly models: DatabaseModels;
|
|
294
|
-
commit(input: DatabaseCommit): Promise<DatabaseCommitResult>;
|
|
295
|
-
dispose?: () => Promise<void>;
|
|
296
|
-
}
|
|
297
|
-
//#endregion
|
|
298
|
-
export { ApiKeyModel, BundleModel, BundleModelQuery, BundlePatchModel, BundleRepository, BundleRepositoryChange, BundleRepositoryCommit, ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelModel, DatabaseChange, DatabaseCommit, DatabaseCommitExpectation, DatabaseCommitResult, DatabaseModels, DatabasePlugin, InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountInstallationsInput, InsightsEventCursor, InsightsEventFilter, InsightsFindInstallationsInput, InsightsListEventsInput, InsightsModel, InsightsRecordInput, InsightsScope, ReleaseCatalogModel, ReleaseModel };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { DatabaseField, DatabaseModel, DatabaseRow } from "./databaseRows.cjs";
|
|
2
|
-
//#region src/types/databaseQuery.d.ts
|
|
3
|
-
type DatabaseWhereOperator = "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with";
|
|
4
|
-
type DatabaseWhereConnector = "AND" | "OR";
|
|
5
|
-
type DatabaseStringComparisonMode = "sensitive" | "insensitive";
|
|
6
|
-
type DatabaseSortNulls = "first" | "last";
|
|
7
|
-
type WhereBase<TField extends string> = {
|
|
8
|
-
readonly field: TField;
|
|
9
|
-
readonly connector?: DatabaseWhereConnector;
|
|
10
|
-
};
|
|
11
|
-
type EqualityWhere<TField extends string, TValue> = WhereBase<TField> & {
|
|
12
|
-
readonly operator?: "eq" | "ne";
|
|
13
|
-
readonly value: TValue;
|
|
14
|
-
};
|
|
15
|
-
type StringWhere<TField extends string> = WhereBase<TField> & {
|
|
16
|
-
readonly operator?: "eq" | "ne" | "contains" | "starts_with" | "ends_with";
|
|
17
|
-
readonly value: string;
|
|
18
|
-
readonly mode?: DatabaseStringComparisonMode;
|
|
19
|
-
};
|
|
20
|
-
type OrderedWhere<TField extends string, TValue extends number | string> = WhereBase<TField> & {
|
|
21
|
-
readonly operator: "gt" | "gte" | "lt" | "lte";
|
|
22
|
-
readonly value: TValue;
|
|
23
|
-
};
|
|
24
|
-
type SetWhere<TField extends string, TValue extends boolean | number | string> = WhereBase<TField> & {
|
|
25
|
-
readonly operator: "in" | "not_in";
|
|
26
|
-
readonly value: readonly TValue[];
|
|
27
|
-
};
|
|
28
|
-
type ScalarWhereValue<TValue> = unknown extends TValue ? never : Extract<TValue, readonly unknown[] | object> extends never ? Extract<TValue, boolean | number | string | null> : never;
|
|
29
|
-
type FieldWhere<TField extends string, TValue> = ([ScalarWhereValue<TValue>] extends [never] ? never : EqualityWhere<TField, ScalarWhereValue<TValue>>) | (Extract<TValue, string> extends never ? never : StringWhere<TField>) | (Extract<TValue, number | string> extends never ? never : OrderedWhere<TField, Extract<TValue, number | string>>) | (Extract<TValue, boolean | number | string> extends never ? never : SetWhere<TField, Extract<TValue, boolean | number | string>>);
|
|
30
|
-
type DatabaseWhere<TModel extends DatabaseModel> = { readonly [TField in DatabaseField<TModel>]: FieldWhere<TField, DatabaseRow<TModel>[TField]>; }[DatabaseField<TModel>];
|
|
31
|
-
type DatabaseSelect<TModel extends DatabaseModel> = readonly DatabaseField<TModel>[];
|
|
32
|
-
type SelectedDatabaseRow<TModel extends DatabaseModel, TSelect extends DatabaseSelect<TModel> | undefined> = TSelect extends DatabaseSelect<TModel> ? Pick<DatabaseRow<TModel>, TSelect[number]> : DatabaseRow<TModel>;
|
|
33
|
-
type DatabaseSortableField<TModel extends DatabaseModel> = { readonly [TField in DatabaseField<TModel>]: Exclude<DatabaseRow<TModel>[TField], null> extends number | string ? TField : never; }[DatabaseField<TModel>];
|
|
34
|
-
interface DatabaseSortClause<TModel extends DatabaseModel> {
|
|
35
|
-
readonly field: DatabaseSortableField<TModel>;
|
|
36
|
-
readonly direction: "asc" | "desc";
|
|
37
|
-
readonly nulls?: DatabaseSortNulls;
|
|
38
|
-
}
|
|
39
|
-
type DatabaseSortBy<TModel extends DatabaseModel> = DatabaseSortClause<TModel>;
|
|
40
|
-
type DatabaseOrderBy<TModel extends DatabaseModel> = readonly [DatabaseSortClause<TModel>, ...DatabaseSortClause<TModel>[]];
|
|
41
|
-
type DatabaseDistinctFields<TModel extends DatabaseModel> = readonly [DatabaseField<TModel>, ...DatabaseField<TModel>[]];
|
|
42
|
-
interface DatabaseDistinctOn<TModel extends DatabaseModel> {
|
|
43
|
-
readonly fields: DatabaseDistinctFields<TModel>;
|
|
44
|
-
}
|
|
45
|
-
//#endregion
|
|
46
|
-
export { DatabaseDistinctFields, DatabaseDistinctOn, DatabaseOrderBy, DatabaseSelect, DatabaseSortBy, DatabaseSortClause, DatabaseSortNulls, DatabaseStringComparisonMode, DatabaseWhere, DatabaseWhereConnector, DatabaseWhereOperator, SelectedDatabaseRow };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { DatabaseField, DatabaseModel, DatabaseRow } from "./databaseRows.mjs";
|
|
2
|
-
//#region src/types/databaseQuery.d.ts
|
|
3
|
-
type DatabaseWhereOperator = "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with";
|
|
4
|
-
type DatabaseWhereConnector = "AND" | "OR";
|
|
5
|
-
type DatabaseStringComparisonMode = "sensitive" | "insensitive";
|
|
6
|
-
type DatabaseSortNulls = "first" | "last";
|
|
7
|
-
type WhereBase<TField extends string> = {
|
|
8
|
-
readonly field: TField;
|
|
9
|
-
readonly connector?: DatabaseWhereConnector;
|
|
10
|
-
};
|
|
11
|
-
type EqualityWhere<TField extends string, TValue> = WhereBase<TField> & {
|
|
12
|
-
readonly operator?: "eq" | "ne";
|
|
13
|
-
readonly value: TValue;
|
|
14
|
-
};
|
|
15
|
-
type StringWhere<TField extends string> = WhereBase<TField> & {
|
|
16
|
-
readonly operator?: "eq" | "ne" | "contains" | "starts_with" | "ends_with";
|
|
17
|
-
readonly value: string;
|
|
18
|
-
readonly mode?: DatabaseStringComparisonMode;
|
|
19
|
-
};
|
|
20
|
-
type OrderedWhere<TField extends string, TValue extends number | string> = WhereBase<TField> & {
|
|
21
|
-
readonly operator: "gt" | "gte" | "lt" | "lte";
|
|
22
|
-
readonly value: TValue;
|
|
23
|
-
};
|
|
24
|
-
type SetWhere<TField extends string, TValue extends boolean | number | string> = WhereBase<TField> & {
|
|
25
|
-
readonly operator: "in" | "not_in";
|
|
26
|
-
readonly value: readonly TValue[];
|
|
27
|
-
};
|
|
28
|
-
type ScalarWhereValue<TValue> = unknown extends TValue ? never : Extract<TValue, readonly unknown[] | object> extends never ? Extract<TValue, boolean | number | string | null> : never;
|
|
29
|
-
type FieldWhere<TField extends string, TValue> = ([ScalarWhereValue<TValue>] extends [never] ? never : EqualityWhere<TField, ScalarWhereValue<TValue>>) | (Extract<TValue, string> extends never ? never : StringWhere<TField>) | (Extract<TValue, number | string> extends never ? never : OrderedWhere<TField, Extract<TValue, number | string>>) | (Extract<TValue, boolean | number | string> extends never ? never : SetWhere<TField, Extract<TValue, boolean | number | string>>);
|
|
30
|
-
type DatabaseWhere<TModel extends DatabaseModel> = { readonly [TField in DatabaseField<TModel>]: FieldWhere<TField, DatabaseRow<TModel>[TField]>; }[DatabaseField<TModel>];
|
|
31
|
-
type DatabaseSelect<TModel extends DatabaseModel> = readonly DatabaseField<TModel>[];
|
|
32
|
-
type SelectedDatabaseRow<TModel extends DatabaseModel, TSelect extends DatabaseSelect<TModel> | undefined> = TSelect extends DatabaseSelect<TModel> ? Pick<DatabaseRow<TModel>, TSelect[number]> : DatabaseRow<TModel>;
|
|
33
|
-
type DatabaseSortableField<TModel extends DatabaseModel> = { readonly [TField in DatabaseField<TModel>]: Exclude<DatabaseRow<TModel>[TField], null> extends number | string ? TField : never; }[DatabaseField<TModel>];
|
|
34
|
-
interface DatabaseSortClause<TModel extends DatabaseModel> {
|
|
35
|
-
readonly field: DatabaseSortableField<TModel>;
|
|
36
|
-
readonly direction: "asc" | "desc";
|
|
37
|
-
readonly nulls?: DatabaseSortNulls;
|
|
38
|
-
}
|
|
39
|
-
type DatabaseSortBy<TModel extends DatabaseModel> = DatabaseSortClause<TModel>;
|
|
40
|
-
type DatabaseOrderBy<TModel extends DatabaseModel> = readonly [DatabaseSortClause<TModel>, ...DatabaseSortClause<TModel>[]];
|
|
41
|
-
type DatabaseDistinctFields<TModel extends DatabaseModel> = readonly [DatabaseField<TModel>, ...DatabaseField<TModel>[]];
|
|
42
|
-
interface DatabaseDistinctOn<TModel extends DatabaseModel> {
|
|
43
|
-
readonly fields: DatabaseDistinctFields<TModel>;
|
|
44
|
-
}
|
|
45
|
-
//#endregion
|
|
46
|
-
export { DatabaseDistinctFields, DatabaseDistinctOn, DatabaseOrderBy, DatabaseSelect, DatabaseSortBy, DatabaseSortClause, DatabaseSortNulls, DatabaseStringComparisonMode, DatabaseWhere, DatabaseWhereConnector, DatabaseWhereOperator, SelectedDatabaseRow };
|