@hot-updater/plugin-core 1.0.0-rc.0 → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.cjs +1 -1
- package/dist/assetStorageLayout.cjs +4 -2
- package/dist/assetStorageLayout.d.cts +5 -24
- package/dist/assetStorageLayout.d.mts +5 -24
- package/dist/assetStorageLayout.mjs +4 -2
- package/dist/calculatePagination.d.cts +0 -1
- package/dist/calculatePagination.d.mts +0 -1
- package/dist/compressionFormat.cjs +12 -5
- package/dist/compressionFormat.d.cts +1 -1
- package/dist/compressionFormat.d.mts +1 -1
- package/dist/compressionFormat.mjs +11 -4
- package/dist/contentAddressedAssets.d.cts +1 -4
- package/dist/contentAddressedAssets.d.mts +1 -4
- package/dist/createDatabasePlugin.cjs +162 -41
- package/dist/createDatabasePlugin.d.cts +3 -1
- package/dist/createDatabasePlugin.d.mts +3 -1
- package/dist/createDatabasePlugin.mjs +162 -42
- package/dist/createStoragePlugin.d.cts +0 -1
- package/dist/createStoragePlugin.d.mts +0 -1
- package/dist/databaseClient.cjs +6 -1
- package/dist/databaseClient.d.cts +1 -2
- package/dist/databaseClient.d.mts +1 -2
- package/dist/databaseClient.mjs +6 -2
- package/dist/databaseClientReads.cjs +3 -1
- package/dist/databaseClientReads.mjs +3 -2
- package/dist/databaseClientUpdates.cjs +2 -1
- package/dist/databaseClientUpdates.d.cts +1 -1
- package/dist/databaseClientUpdates.d.mts +1 -1
- package/dist/databaseClientUpdates.mjs +2 -0
- package/dist/databaseJsonValue.cjs +2 -0
- package/dist/databaseJsonValue.d.cts +1 -0
- package/dist/databaseJsonValue.d.mts +1 -0
- package/dist/databaseJsonValue.mjs +1 -1
- package/dist/databaseMetadata.cjs +0 -1
- package/dist/databasePluginCrud.cjs +3 -1
- package/dist/databasePluginCrud.d.cts +4 -1
- package/dist/databasePluginCrud.d.mts +4 -1
- package/dist/databasePluginCrud.mjs +4 -3
- package/dist/databasePluginCrudValidation.d.cts +6 -1
- package/dist/databasePluginCrudValidation.d.mts +6 -1
- package/dist/databasePluginCrudValidationErrors.cjs +1 -0
- package/dist/databasePluginCrudValidationErrors.mjs +1 -0
- package/dist/databasePluginCrudValidationFields.cjs +43 -13
- package/dist/databasePluginCrudValidationFields.d.cts +1 -1
- package/dist/databasePluginCrudValidationFields.d.mts +1 -1
- package/dist/databasePluginCrudValidationFields.mjs +41 -13
- package/dist/databasePluginCrudValidationMutations.cjs +20 -1
- package/dist/databasePluginCrudValidationMutations.d.cts +1 -1
- package/dist/databasePluginCrudValidationMutations.d.mts +1 -1
- package/dist/databasePluginCrudValidationMutations.mjs +20 -2
- package/dist/databasePluginCrudValidationQueries.d.cts +2 -1
- package/dist/databasePluginCrudValidationQueries.d.mts +2 -1
- package/dist/databasePluginCrudValidationRows.d.cts +1 -1
- package/dist/databasePluginCrudValidationRows.d.mts +1 -1
- package/dist/databaseRows.cjs +0 -1
- package/dist/databaseRows.d.cts +2 -6
- package/dist/databaseRows.d.mts +2 -6
- package/dist/index.cjs +4 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +2 -1
- package/dist/insightsContract.cjs +157 -0
- package/dist/insightsContract.d.cts +11 -0
- package/dist/insightsContract.d.mts +11 -0
- package/dist/insightsContract.mjs +153 -0
- package/dist/internal.d.cts +5 -4
- package/dist/internal.d.mts +5 -4
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/comparison-DenM3wCn.cjs +136 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/comparison-DenM3wCn.mjs +116 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/range-DvX-Y6iv.cjs +167 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/range-DvX-Y6iv.mjs +165 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/set-CC5YeoYX.cjs +42 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/set-CC5YeoYX.mjs +39 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/version-CQ98ZBpL.cjs +39 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/version-CQ98ZBpL.mjs +37 -0
- package/dist/paginateBundles.d.cts +1 -8
- package/dist/paginateBundles.d.mts +1 -8
- package/dist/parseStorageUri.d.cts +1 -5
- package/dist/parseStorageUri.d.mts +1 -5
- package/dist/queryBundles.d.cts +0 -1
- package/dist/queryBundles.d.mts +0 -1
- package/dist/releaseCatalogCompiler.cjs +15 -12
- package/dist/releaseCatalogCompiler.d.cts +0 -1
- package/dist/releaseCatalogCompiler.d.mts +0 -1
- package/dist/releaseCatalogCompiler.mjs +11 -7
- package/dist/releaseCatalogMutation.cjs +1 -1
- package/dist/releaseCatalogMutation.d.cts +1 -1
- package/dist/releaseCatalogMutation.d.mts +1 -1
- package/dist/releaseCatalogMutation.mjs +1 -0
- package/dist/releaseManagement.cjs +3 -2
- package/dist/releaseManagement.d.cts +1 -1
- package/dist/releaseManagement.d.mts +1 -1
- package/dist/releaseManagement.mjs +3 -1
- package/dist/remoteBundleSigning.cjs +5 -7
- package/dist/remoteBundleSigning.d.cts +2 -15
- package/dist/remoteBundleSigning.d.mts +2 -15
- package/dist/remoteBundleSigning.mjs +5 -7
- package/dist/requestBundleCache.d.cts +1 -2
- package/dist/requestBundleCache.d.mts +1 -2
- package/dist/semverSatisfies.cjs +4 -3
- package/dist/semverSatisfies.mjs +2 -1
- package/dist/storageDownloadPath.cjs +2 -1
- package/dist/storageDownloadPath.d.cts +1 -3
- package/dist/storageDownloadPath.d.mts +1 -3
- package/dist/storageDownloadPath.mjs +2 -1
- package/dist/types/database.d.cts +4 -3
- package/dist/types/database.d.mts +4 -3
- package/dist/types/databaseFields.cjs +13 -0
- package/dist/types/databaseFields.d.cts +1 -0
- package/dist/types/databaseFields.d.mts +1 -0
- package/dist/types/databaseFields.mjs +13 -0
- package/dist/types/databaseOperations.d.cts +26 -15
- package/dist/types/databaseOperations.d.mts +26 -15
- package/dist/types/databasePlugin.d.cts +72 -14
- package/dist/types/databasePlugin.d.mts +72 -14
- package/dist/types/databaseQuery.d.cts +2 -3
- package/dist/types/databaseQuery.d.mts +2 -3
- package/dist/types/databaseRows.d.cts +3 -2
- package/dist/types/databaseRows.d.mts +3 -2
- package/dist/types/index.d.cts +15 -11
- package/dist/types/index.d.mts +15 -11
- package/dist/types/internal.d.cts +5 -4
- package/dist/types/internal.d.mts +5 -4
- package/dist/types/public.d.cts +4 -3
- package/dist/types/public.d.mts +4 -3
- package/dist/types/utils.d.cts +1 -1
- package/dist/types/utils.d.mts +1 -1
- package/dist/uuidv7.cjs +7 -2
- package/dist/uuidv7.d.cts +0 -1
- package/dist/uuidv7.d.mts +0 -1
- package/dist/uuidv7.mjs +1 -1
- package/package.json +3 -3
- package/dist/node_modules/.pnpm/verkit@0.3.2/node_modules/verkit/dist/index.cjs +0 -345
- package/dist/node_modules/.pnpm/verkit@0.3.2/node_modules/verkit/dist/index.mjs +0 -341
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ApiKeyRow, BundleRow, DatabaseModel, DatabaseRow, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.cjs";
|
|
2
|
-
import { ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, DatabaseCommit, DatabaseCommitResult } from "./databasePlugin.cjs";
|
|
1
|
+
import { ApiKeyRow, BundleRow, DatabaseModel, DatabaseRow, InsightsInstallationRow, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.cjs";
|
|
2
|
+
import { ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, DatabaseCommit, DatabaseCommitResult, InsightsRecordInput } from "./databasePlugin.cjs";
|
|
3
3
|
import { DatabaseDistinctFields, DatabaseDistinctOn, DatabaseOrderBy, DatabaseSelect, DatabaseWhere, SelectedDatabaseRow } from "./databaseQuery.cjs";
|
|
4
|
-
|
|
5
4
|
//#region src/types/databaseOperations.d.ts
|
|
6
5
|
type DatabaseCapability = "create" | "update" | "delete" | "count" | "findOne" | "findMany";
|
|
7
6
|
type DatabaseModelCapabilities = {
|
|
@@ -49,10 +48,18 @@ type DatabaseModelCapabilities = {
|
|
|
49
48
|
readonly create: true;
|
|
50
49
|
readonly update: false;
|
|
51
50
|
readonly delete: false;
|
|
52
|
-
readonly count:
|
|
51
|
+
readonly count: true;
|
|
53
52
|
readonly findOne: false;
|
|
54
53
|
readonly findMany: true;
|
|
55
54
|
};
|
|
55
|
+
readonly bundle_installations: {
|
|
56
|
+
readonly create: true;
|
|
57
|
+
readonly update: true;
|
|
58
|
+
readonly delete: false;
|
|
59
|
+
readonly count: true;
|
|
60
|
+
readonly findOne: true;
|
|
61
|
+
readonly findMany: true;
|
|
62
|
+
};
|
|
56
63
|
readonly api_keys: {
|
|
57
64
|
readonly create: true;
|
|
58
65
|
readonly update: true;
|
|
@@ -62,7 +69,7 @@ type DatabaseModelCapabilities = {
|
|
|
62
69
|
readonly findMany: true;
|
|
63
70
|
};
|
|
64
71
|
};
|
|
65
|
-
type DatabaseModelsWithCapability<TCapability extends DatabaseCapability> = { readonly [TModel in DatabaseModel]: DatabaseModelCapabilities[TModel][TCapability] extends true ? TModel : never }[DatabaseModel];
|
|
72
|
+
type DatabaseModelsWithCapability<TCapability extends DatabaseCapability> = { readonly [TModel in DatabaseModel]: DatabaseModelCapabilities[TModel][TCapability] extends true ? TModel : never; }[DatabaseModel];
|
|
66
73
|
type CreateDatabaseModel = DatabaseModelsWithCapability<"create">;
|
|
67
74
|
type UpdateDatabaseModel = DatabaseModelsWithCapability<"update">;
|
|
68
75
|
type DeleteDatabaseModel = DatabaseModelsWithCapability<"delete">;
|
|
@@ -76,7 +83,7 @@ type CreateDatabaseInputBase<TModel extends CreateDatabaseModel, TSelect extends
|
|
|
76
83
|
readonly data: DatabaseRow<TModel>;
|
|
77
84
|
readonly select?: TSelect;
|
|
78
85
|
};
|
|
79
|
-
type CreateDatabaseInput<TModel extends CreateDatabaseModel, TSelect extends DatabaseSelect<TModel> | undefined = undefined> = CreateDatabaseInputBase<TModel, TSelect> & (TModel extends "channels" | "api_keys" ? {
|
|
86
|
+
type CreateDatabaseInput<TModel extends CreateDatabaseModel, TSelect extends DatabaseSelect<TModel> | undefined = undefined> = CreateDatabaseInputBase<TModel, TSelect> & (TModel extends "channels" | "api_keys" | "bundle_installations" ? {
|
|
80
87
|
readonly onConflict?: "ignore";
|
|
81
88
|
} : {
|
|
82
89
|
readonly onConflict?: never;
|
|
@@ -86,10 +93,12 @@ type ReleaseRowUpdate = Partial<Pick<ReleaseRow, "revision" | "scope_key" | "tar
|
|
|
86
93
|
type ReleaseCatalogRowUpdate = Omit<ReleaseCatalogRow, "scope_key">;
|
|
87
94
|
type BundleRowUpdate = BundleRowUpdateFields;
|
|
88
95
|
type ApiKeyRowUpdate = Pick<ApiKeyRow, "revoked_at_ms">;
|
|
96
|
+
type InsightsInstallationRowUpdate = Omit<InsightsInstallationRow, "install_id">;
|
|
89
97
|
type DatabaseRowUpdate<TModel extends UpdateDatabaseModel> = {
|
|
90
98
|
readonly bundles: BundleRowUpdate;
|
|
91
99
|
readonly releases: ReleaseRowUpdate;
|
|
92
100
|
readonly release_catalogs: ReleaseCatalogRowUpdate;
|
|
101
|
+
readonly bundle_installations: InsightsInstallationRowUpdate;
|
|
93
102
|
readonly api_keys: ApiKeyRowUpdate;
|
|
94
103
|
}[TModel];
|
|
95
104
|
type UpdateDatabaseInput<TModel extends UpdateDatabaseModel, TSelect extends DatabaseSelect<TModel> | undefined = undefined> = {
|
|
@@ -135,19 +144,19 @@ interface DatabasePluginCrud {
|
|
|
135
144
|
findOne<TInput extends FindOneDatabaseImplementationInput>(input: TInput): Promise<SelectedDatabaseInputRow<TInput> | null>;
|
|
136
145
|
findMany<TInput extends FindManyDatabasePluginInput>(input: TInput): Promise<SelectedDatabaseInputRow<TInput>[]>;
|
|
137
146
|
}
|
|
138
|
-
type DatabaseImplementationResult = { readonly [TModel in DatabaseModel]: Partial<DatabaseRow<TModel
|
|
139
|
-
type CreateDatabaseImplementationInput = { readonly [TModel in CreateDatabaseModel]: CreateDatabaseInput<TModel, DatabaseSelect<TModel> | undefined
|
|
140
|
-
type UpdateDatabaseImplementationInput = { readonly [TModel in UpdateDatabaseModel]: UpdateDatabaseInput<TModel, DatabaseSelect<TModel> | undefined
|
|
141
|
-
type DeleteDatabaseImplementationInput = { readonly [TModel in DeleteDatabaseModel]: DeleteDatabaseInput<TModel
|
|
142
|
-
type CountDatabaseImplementationInput = { readonly [TModel in CountDatabaseModel]: CountDatabaseInput<TModel
|
|
147
|
+
type DatabaseImplementationResult = { readonly [TModel in DatabaseModel]: Partial<DatabaseRow<TModel>>; }[DatabaseModel];
|
|
148
|
+
type CreateDatabaseImplementationInput = { readonly [TModel in CreateDatabaseModel]: CreateDatabaseInput<TModel, DatabaseSelect<TModel> | undefined>; }[CreateDatabaseModel];
|
|
149
|
+
type UpdateDatabaseImplementationInput = { readonly [TModel in UpdateDatabaseModel]: UpdateDatabaseInput<TModel, DatabaseSelect<TModel> | undefined>; }[UpdateDatabaseModel];
|
|
150
|
+
type DeleteDatabaseImplementationInput = { readonly [TModel in DeleteDatabaseModel]: DeleteDatabaseInput<TModel>; }[DeleteDatabaseModel];
|
|
151
|
+
type CountDatabaseImplementationInput = { readonly [TModel in CountDatabaseModel]: CountDatabaseInput<TModel>; }[CountDatabaseModel];
|
|
143
152
|
type UpdateBundleDatabaseImplementationInput = UpdateDatabaseInput<"bundles", DatabaseSelect<"bundles"> | undefined>;
|
|
144
153
|
type CountBundlesDatabaseImplementationInput = CountDatabaseInput<"bundles">;
|
|
145
|
-
type FindOneDatabaseImplementationInput = { readonly [TModel in FindOneDatabaseModel]: FindOneDatabaseInput<TModel, DatabaseSelect<TModel> | undefined
|
|
154
|
+
type FindOneDatabaseImplementationInput = { readonly [TModel in FindOneDatabaseModel]: FindOneDatabaseInput<TModel, DatabaseSelect<TModel> | undefined>; }[FindOneDatabaseModel];
|
|
146
155
|
type FindManyDatabaseImplementationInput = { readonly [TModel in FindManyDatabaseModel]: Omit<FindManyDatabaseInput<TModel, DatabaseSelect<TModel> | undefined>, "limit" | "offset"> & {
|
|
147
156
|
readonly limit: number;
|
|
148
157
|
readonly offset: number;
|
|
149
|
-
} }[FindManyDatabaseModel];
|
|
150
|
-
type FindManyDatabasePluginInput = { readonly [TModel in FindManyDatabaseModel]: FindManyDatabaseInput<TModel, DatabaseSelect<TModel> | undefined
|
|
158
|
+
}; }[FindManyDatabaseModel];
|
|
159
|
+
type FindManyDatabasePluginInput = { readonly [TModel in FindManyDatabaseModel]: FindManyDatabaseInput<TModel, DatabaseSelect<TModel> | undefined>; }[FindManyDatabaseModel];
|
|
151
160
|
interface TransactionDatabasePluginImplementation {
|
|
152
161
|
create(input: CreateDatabaseImplementationInput): Promise<DatabaseImplementationResult>;
|
|
153
162
|
update(input: UpdateDatabaseImplementationInput): Promise<DatabaseImplementationResult | null>;
|
|
@@ -157,6 +166,8 @@ interface TransactionDatabasePluginImplementation {
|
|
|
157
166
|
findMany(input: FindManyDatabaseImplementationInput): Promise<readonly DatabaseImplementationResult[]>;
|
|
158
167
|
}
|
|
159
168
|
interface DatabasePluginImplementation {
|
|
169
|
+
/** Native atomic event insert and monotonic installation update. */
|
|
170
|
+
recordInsights(input: InsightsRecordInput): Promise<void>;
|
|
160
171
|
create(input: CreateDatabaseImplementationInput): Promise<DatabaseImplementationResult>;
|
|
161
172
|
update(input: UpdateDatabaseImplementationInput): Promise<DatabaseImplementationResult | null>;
|
|
162
173
|
delete(input: DeleteDatabaseImplementationInput): Promise<void>;
|
|
@@ -170,4 +181,4 @@ interface DatabasePluginImplementation {
|
|
|
170
181
|
dispose?: () => Promise<void>;
|
|
171
182
|
}
|
|
172
183
|
//#endregion
|
|
173
|
-
export { ApiKeyRowUpdate, BundleRowUpdate, CountBundlesDatabaseImplementationInput, CountBundlesDatabaseInput, CountDatabaseImplementationInput, CountDatabaseInput, CountDatabaseModel, CreateDatabaseImplementationInput, CreateDatabaseInput, CreateDatabaseModel, DatabaseCapability, DatabaseDeleteModel, DatabaseFindOneModel, DatabaseImplementationResult, DatabaseModelCapabilities, DatabaseModelsWithCapability, DatabasePluginCrud, DatabasePluginImplementation, DatabaseRowUpdate, DeleteDatabaseImplementationInput, DeleteDatabaseInput, DeleteDatabaseModel, FindManyDatabaseImplementationInput, FindManyDatabaseInput, FindManyDatabaseModel, FindManyDatabasePluginInput, FindOneDatabaseImplementationInput, FindOneDatabaseInput, FindOneDatabaseModel, ReleaseCatalogRowUpdate, ReleaseRowUpdate, SelectedDatabaseInputRow, TransactionDatabasePluginImplementation, UpdateBundleDatabaseImplementationInput, UpdateBundleDatabaseInput, UpdateDatabaseImplementationInput, UpdateDatabaseInput, UpdateDatabaseModel };
|
|
184
|
+
export { ApiKeyRowUpdate, BundleRowUpdate, CountBundlesDatabaseImplementationInput, CountBundlesDatabaseInput, CountDatabaseImplementationInput, CountDatabaseInput, CountDatabaseModel, CreateDatabaseImplementationInput, CreateDatabaseInput, CreateDatabaseModel, DatabaseCapability, DatabaseDeleteModel, DatabaseFindOneModel, DatabaseImplementationResult, DatabaseModelCapabilities, DatabaseModelsWithCapability, DatabasePluginCrud, DatabasePluginImplementation, DatabaseRowUpdate, DeleteDatabaseImplementationInput, DeleteDatabaseInput, DeleteDatabaseModel, FindManyDatabaseImplementationInput, FindManyDatabaseInput, FindManyDatabaseModel, FindManyDatabasePluginInput, FindOneDatabaseImplementationInput, FindOneDatabaseInput, FindOneDatabaseModel, InsightsInstallationRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate, SelectedDatabaseInputRow, TransactionDatabasePluginImplementation, UpdateBundleDatabaseImplementationInput, UpdateBundleDatabaseInput, UpdateDatabaseImplementationInput, UpdateDatabaseInput, UpdateDatabaseModel };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ApiKeyRow, BundleRow, DatabaseModel, DatabaseRow, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.mjs";
|
|
2
|
-
import { ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, DatabaseCommit, DatabaseCommitResult } from "./databasePlugin.mjs";
|
|
1
|
+
import { ApiKeyRow, BundleRow, DatabaseModel, DatabaseRow, InsightsInstallationRow, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.mjs";
|
|
2
|
+
import { ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, DatabaseCommit, DatabaseCommitResult, InsightsRecordInput } from "./databasePlugin.mjs";
|
|
3
3
|
import { DatabaseDistinctFields, DatabaseDistinctOn, DatabaseOrderBy, DatabaseSelect, DatabaseWhere, SelectedDatabaseRow } from "./databaseQuery.mjs";
|
|
4
|
-
|
|
5
4
|
//#region src/types/databaseOperations.d.ts
|
|
6
5
|
type DatabaseCapability = "create" | "update" | "delete" | "count" | "findOne" | "findMany";
|
|
7
6
|
type DatabaseModelCapabilities = {
|
|
@@ -49,10 +48,18 @@ type DatabaseModelCapabilities = {
|
|
|
49
48
|
readonly create: true;
|
|
50
49
|
readonly update: false;
|
|
51
50
|
readonly delete: false;
|
|
52
|
-
readonly count:
|
|
51
|
+
readonly count: true;
|
|
53
52
|
readonly findOne: false;
|
|
54
53
|
readonly findMany: true;
|
|
55
54
|
};
|
|
55
|
+
readonly bundle_installations: {
|
|
56
|
+
readonly create: true;
|
|
57
|
+
readonly update: true;
|
|
58
|
+
readonly delete: false;
|
|
59
|
+
readonly count: true;
|
|
60
|
+
readonly findOne: true;
|
|
61
|
+
readonly findMany: true;
|
|
62
|
+
};
|
|
56
63
|
readonly api_keys: {
|
|
57
64
|
readonly create: true;
|
|
58
65
|
readonly update: true;
|
|
@@ -62,7 +69,7 @@ type DatabaseModelCapabilities = {
|
|
|
62
69
|
readonly findMany: true;
|
|
63
70
|
};
|
|
64
71
|
};
|
|
65
|
-
type DatabaseModelsWithCapability<TCapability extends DatabaseCapability> = { readonly [TModel in DatabaseModel]: DatabaseModelCapabilities[TModel][TCapability] extends true ? TModel : never }[DatabaseModel];
|
|
72
|
+
type DatabaseModelsWithCapability<TCapability extends DatabaseCapability> = { readonly [TModel in DatabaseModel]: DatabaseModelCapabilities[TModel][TCapability] extends true ? TModel : never; }[DatabaseModel];
|
|
66
73
|
type CreateDatabaseModel = DatabaseModelsWithCapability<"create">;
|
|
67
74
|
type UpdateDatabaseModel = DatabaseModelsWithCapability<"update">;
|
|
68
75
|
type DeleteDatabaseModel = DatabaseModelsWithCapability<"delete">;
|
|
@@ -76,7 +83,7 @@ type CreateDatabaseInputBase<TModel extends CreateDatabaseModel, TSelect extends
|
|
|
76
83
|
readonly data: DatabaseRow<TModel>;
|
|
77
84
|
readonly select?: TSelect;
|
|
78
85
|
};
|
|
79
|
-
type CreateDatabaseInput<TModel extends CreateDatabaseModel, TSelect extends DatabaseSelect<TModel> | undefined = undefined> = CreateDatabaseInputBase<TModel, TSelect> & (TModel extends "channels" | "api_keys" ? {
|
|
86
|
+
type CreateDatabaseInput<TModel extends CreateDatabaseModel, TSelect extends DatabaseSelect<TModel> | undefined = undefined> = CreateDatabaseInputBase<TModel, TSelect> & (TModel extends "channels" | "api_keys" | "bundle_installations" ? {
|
|
80
87
|
readonly onConflict?: "ignore";
|
|
81
88
|
} : {
|
|
82
89
|
readonly onConflict?: never;
|
|
@@ -86,10 +93,12 @@ type ReleaseRowUpdate = Partial<Pick<ReleaseRow, "revision" | "scope_key" | "tar
|
|
|
86
93
|
type ReleaseCatalogRowUpdate = Omit<ReleaseCatalogRow, "scope_key">;
|
|
87
94
|
type BundleRowUpdate = BundleRowUpdateFields;
|
|
88
95
|
type ApiKeyRowUpdate = Pick<ApiKeyRow, "revoked_at_ms">;
|
|
96
|
+
type InsightsInstallationRowUpdate = Omit<InsightsInstallationRow, "install_id">;
|
|
89
97
|
type DatabaseRowUpdate<TModel extends UpdateDatabaseModel> = {
|
|
90
98
|
readonly bundles: BundleRowUpdate;
|
|
91
99
|
readonly releases: ReleaseRowUpdate;
|
|
92
100
|
readonly release_catalogs: ReleaseCatalogRowUpdate;
|
|
101
|
+
readonly bundle_installations: InsightsInstallationRowUpdate;
|
|
93
102
|
readonly api_keys: ApiKeyRowUpdate;
|
|
94
103
|
}[TModel];
|
|
95
104
|
type UpdateDatabaseInput<TModel extends UpdateDatabaseModel, TSelect extends DatabaseSelect<TModel> | undefined = undefined> = {
|
|
@@ -135,19 +144,19 @@ interface DatabasePluginCrud {
|
|
|
135
144
|
findOne<TInput extends FindOneDatabaseImplementationInput>(input: TInput): Promise<SelectedDatabaseInputRow<TInput> | null>;
|
|
136
145
|
findMany<TInput extends FindManyDatabasePluginInput>(input: TInput): Promise<SelectedDatabaseInputRow<TInput>[]>;
|
|
137
146
|
}
|
|
138
|
-
type DatabaseImplementationResult = { readonly [TModel in DatabaseModel]: Partial<DatabaseRow<TModel
|
|
139
|
-
type CreateDatabaseImplementationInput = { readonly [TModel in CreateDatabaseModel]: CreateDatabaseInput<TModel, DatabaseSelect<TModel> | undefined
|
|
140
|
-
type UpdateDatabaseImplementationInput = { readonly [TModel in UpdateDatabaseModel]: UpdateDatabaseInput<TModel, DatabaseSelect<TModel> | undefined
|
|
141
|
-
type DeleteDatabaseImplementationInput = { readonly [TModel in DeleteDatabaseModel]: DeleteDatabaseInput<TModel
|
|
142
|
-
type CountDatabaseImplementationInput = { readonly [TModel in CountDatabaseModel]: CountDatabaseInput<TModel
|
|
147
|
+
type DatabaseImplementationResult = { readonly [TModel in DatabaseModel]: Partial<DatabaseRow<TModel>>; }[DatabaseModel];
|
|
148
|
+
type CreateDatabaseImplementationInput = { readonly [TModel in CreateDatabaseModel]: CreateDatabaseInput<TModel, DatabaseSelect<TModel> | undefined>; }[CreateDatabaseModel];
|
|
149
|
+
type UpdateDatabaseImplementationInput = { readonly [TModel in UpdateDatabaseModel]: UpdateDatabaseInput<TModel, DatabaseSelect<TModel> | undefined>; }[UpdateDatabaseModel];
|
|
150
|
+
type DeleteDatabaseImplementationInput = { readonly [TModel in DeleteDatabaseModel]: DeleteDatabaseInput<TModel>; }[DeleteDatabaseModel];
|
|
151
|
+
type CountDatabaseImplementationInput = { readonly [TModel in CountDatabaseModel]: CountDatabaseInput<TModel>; }[CountDatabaseModel];
|
|
143
152
|
type UpdateBundleDatabaseImplementationInput = UpdateDatabaseInput<"bundles", DatabaseSelect<"bundles"> | undefined>;
|
|
144
153
|
type CountBundlesDatabaseImplementationInput = CountDatabaseInput<"bundles">;
|
|
145
|
-
type FindOneDatabaseImplementationInput = { readonly [TModel in FindOneDatabaseModel]: FindOneDatabaseInput<TModel, DatabaseSelect<TModel> | undefined
|
|
154
|
+
type FindOneDatabaseImplementationInput = { readonly [TModel in FindOneDatabaseModel]: FindOneDatabaseInput<TModel, DatabaseSelect<TModel> | undefined>; }[FindOneDatabaseModel];
|
|
146
155
|
type FindManyDatabaseImplementationInput = { readonly [TModel in FindManyDatabaseModel]: Omit<FindManyDatabaseInput<TModel, DatabaseSelect<TModel> | undefined>, "limit" | "offset"> & {
|
|
147
156
|
readonly limit: number;
|
|
148
157
|
readonly offset: number;
|
|
149
|
-
} }[FindManyDatabaseModel];
|
|
150
|
-
type FindManyDatabasePluginInput = { readonly [TModel in FindManyDatabaseModel]: FindManyDatabaseInput<TModel, DatabaseSelect<TModel> | undefined
|
|
158
|
+
}; }[FindManyDatabaseModel];
|
|
159
|
+
type FindManyDatabasePluginInput = { readonly [TModel in FindManyDatabaseModel]: FindManyDatabaseInput<TModel, DatabaseSelect<TModel> | undefined>; }[FindManyDatabaseModel];
|
|
151
160
|
interface TransactionDatabasePluginImplementation {
|
|
152
161
|
create(input: CreateDatabaseImplementationInput): Promise<DatabaseImplementationResult>;
|
|
153
162
|
update(input: UpdateDatabaseImplementationInput): Promise<DatabaseImplementationResult | null>;
|
|
@@ -157,6 +166,8 @@ interface TransactionDatabasePluginImplementation {
|
|
|
157
166
|
findMany(input: FindManyDatabaseImplementationInput): Promise<readonly DatabaseImplementationResult[]>;
|
|
158
167
|
}
|
|
159
168
|
interface DatabasePluginImplementation {
|
|
169
|
+
/** Native atomic event insert and monotonic installation update. */
|
|
170
|
+
recordInsights(input: InsightsRecordInput): Promise<void>;
|
|
160
171
|
create(input: CreateDatabaseImplementationInput): Promise<DatabaseImplementationResult>;
|
|
161
172
|
update(input: UpdateDatabaseImplementationInput): Promise<DatabaseImplementationResult | null>;
|
|
162
173
|
delete(input: DeleteDatabaseImplementationInput): Promise<void>;
|
|
@@ -170,4 +181,4 @@ interface DatabasePluginImplementation {
|
|
|
170
181
|
dispose?: () => Promise<void>;
|
|
171
182
|
}
|
|
172
183
|
//#endregion
|
|
173
|
-
export { ApiKeyRowUpdate, BundleRowUpdate, CountBundlesDatabaseImplementationInput, CountBundlesDatabaseInput, CountDatabaseImplementationInput, CountDatabaseInput, CountDatabaseModel, CreateDatabaseImplementationInput, CreateDatabaseInput, CreateDatabaseModel, DatabaseCapability, DatabaseDeleteModel, DatabaseFindOneModel, DatabaseImplementationResult, DatabaseModelCapabilities, DatabaseModelsWithCapability, DatabasePluginCrud, DatabasePluginImplementation, DatabaseRowUpdate, DeleteDatabaseImplementationInput, DeleteDatabaseInput, DeleteDatabaseModel, FindManyDatabaseImplementationInput, FindManyDatabaseInput, FindManyDatabaseModel, FindManyDatabasePluginInput, FindOneDatabaseImplementationInput, FindOneDatabaseInput, FindOneDatabaseModel, ReleaseCatalogRowUpdate, ReleaseRowUpdate, SelectedDatabaseInputRow, TransactionDatabasePluginImplementation, UpdateBundleDatabaseImplementationInput, UpdateBundleDatabaseInput, UpdateDatabaseImplementationInput, UpdateDatabaseInput, UpdateDatabaseModel };
|
|
184
|
+
export { ApiKeyRowUpdate, BundleRowUpdate, CountBundlesDatabaseImplementationInput, CountBundlesDatabaseInput, CountDatabaseImplementationInput, CountDatabaseInput, CountDatabaseModel, CreateDatabaseImplementationInput, CreateDatabaseInput, CreateDatabaseModel, DatabaseCapability, DatabaseDeleteModel, DatabaseFindOneModel, DatabaseImplementationResult, DatabaseModelCapabilities, DatabaseModelsWithCapability, DatabasePluginCrud, DatabasePluginImplementation, DatabaseRowUpdate, DeleteDatabaseImplementationInput, DeleteDatabaseInput, DeleteDatabaseModel, FindManyDatabaseImplementationInput, FindManyDatabaseInput, FindManyDatabaseModel, FindManyDatabasePluginInput, FindOneDatabaseImplementationInput, FindOneDatabaseInput, FindOneDatabaseModel, InsightsInstallationRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate, SelectedDatabaseInputRow, TransactionDatabasePluginImplementation, UpdateBundleDatabaseImplementationInput, UpdateBundleDatabaseInput, UpdateDatabaseImplementationInput, UpdateDatabaseInput, UpdateDatabaseModel };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ApiKeyRow, BundleEventRow, BundlePatchRow, BundleRow, ChannelRow, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.cjs";
|
|
1
|
+
import { ApiKeyRow, BundleEventRow, BundlePatchRow, BundleRow, ChannelRow, InsightsInstallationRow, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.cjs";
|
|
2
2
|
import { BundleRowUpdate, ReleaseRowUpdate } from "./databaseOperations.cjs";
|
|
3
3
|
import { DatabaseBundleQueryOrder, DatabaseBundleQueryWhere } from "./index.cjs";
|
|
4
|
-
|
|
5
4
|
//#region src/types/databasePlugin.d.ts
|
|
6
5
|
interface BundleModelQuery {
|
|
7
6
|
readonly where?: DatabaseBundleQueryWhere;
|
|
@@ -43,18 +42,81 @@ interface ReleaseCatalogModel {
|
|
|
43
42
|
readonly limit: number;
|
|
44
43
|
}): Promise<readonly ReleaseCatalogRow[]>;
|
|
45
44
|
}
|
|
46
|
-
interface
|
|
45
|
+
interface InsightsEventCursor {
|
|
47
46
|
readonly receivedAtMs: number;
|
|
48
47
|
readonly id: string;
|
|
49
48
|
}
|
|
50
|
-
interface
|
|
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;
|
|
51
76
|
readonly beforeReceivedAtMs: number;
|
|
52
|
-
readonly after?:
|
|
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;
|
|
53
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;
|
|
54
95
|
}
|
|
55
|
-
interface
|
|
56
|
-
|
|
57
|
-
|
|
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>;
|
|
58
120
|
}
|
|
59
121
|
interface ApiKeyModel {
|
|
60
122
|
create(row: ApiKeyRow): Promise<"created" | "existing">;
|
|
@@ -148,10 +210,6 @@ type DatabaseChange = {
|
|
|
148
210
|
readonly where: {
|
|
149
211
|
readonly id: string;
|
|
150
212
|
};
|
|
151
|
-
} | {
|
|
152
|
-
readonly model: "analytics";
|
|
153
|
-
readonly operation: "insert";
|
|
154
|
-
readonly row: BundleEventRow;
|
|
155
213
|
} | {
|
|
156
214
|
readonly model: "apiKeys";
|
|
157
215
|
readonly operation: "insert";
|
|
@@ -221,7 +279,7 @@ interface DatabaseModels {
|
|
|
221
279
|
readonly releases: ReleaseModel;
|
|
222
280
|
readonly releaseCatalogs: ReleaseCatalogModel;
|
|
223
281
|
readonly channels: ChannelModel;
|
|
224
|
-
readonly
|
|
282
|
+
readonly insights: InsightsModel;
|
|
225
283
|
readonly apiKeys: ApiKeyModel;
|
|
226
284
|
}
|
|
227
285
|
interface BundleRepository {
|
|
@@ -237,4 +295,4 @@ interface DatabasePlugin {
|
|
|
237
295
|
dispose?: () => Promise<void>;
|
|
238
296
|
}
|
|
239
297
|
//#endregion
|
|
240
|
-
export {
|
|
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,7 +1,6 @@
|
|
|
1
|
-
import { ApiKeyRow, BundleEventRow, BundlePatchRow, BundleRow, ChannelRow, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.mjs";
|
|
1
|
+
import { ApiKeyRow, BundleEventRow, BundlePatchRow, BundleRow, ChannelRow, InsightsInstallationRow, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.mjs";
|
|
2
2
|
import { BundleRowUpdate, ReleaseRowUpdate } from "./databaseOperations.mjs";
|
|
3
3
|
import { DatabaseBundleQueryOrder, DatabaseBundleQueryWhere } from "./index.mjs";
|
|
4
|
-
|
|
5
4
|
//#region src/types/databasePlugin.d.ts
|
|
6
5
|
interface BundleModelQuery {
|
|
7
6
|
readonly where?: DatabaseBundleQueryWhere;
|
|
@@ -43,18 +42,81 @@ interface ReleaseCatalogModel {
|
|
|
43
42
|
readonly limit: number;
|
|
44
43
|
}): Promise<readonly ReleaseCatalogRow[]>;
|
|
45
44
|
}
|
|
46
|
-
interface
|
|
45
|
+
interface InsightsEventCursor {
|
|
47
46
|
readonly receivedAtMs: number;
|
|
48
47
|
readonly id: string;
|
|
49
48
|
}
|
|
50
|
-
interface
|
|
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;
|
|
51
76
|
readonly beforeReceivedAtMs: number;
|
|
52
|
-
readonly after?:
|
|
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;
|
|
53
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;
|
|
54
95
|
}
|
|
55
|
-
interface
|
|
56
|
-
|
|
57
|
-
|
|
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>;
|
|
58
120
|
}
|
|
59
121
|
interface ApiKeyModel {
|
|
60
122
|
create(row: ApiKeyRow): Promise<"created" | "existing">;
|
|
@@ -148,10 +210,6 @@ type DatabaseChange = {
|
|
|
148
210
|
readonly where: {
|
|
149
211
|
readonly id: string;
|
|
150
212
|
};
|
|
151
|
-
} | {
|
|
152
|
-
readonly model: "analytics";
|
|
153
|
-
readonly operation: "insert";
|
|
154
|
-
readonly row: BundleEventRow;
|
|
155
213
|
} | {
|
|
156
214
|
readonly model: "apiKeys";
|
|
157
215
|
readonly operation: "insert";
|
|
@@ -221,7 +279,7 @@ interface DatabaseModels {
|
|
|
221
279
|
readonly releases: ReleaseModel;
|
|
222
280
|
readonly releaseCatalogs: ReleaseCatalogModel;
|
|
223
281
|
readonly channels: ChannelModel;
|
|
224
|
-
readonly
|
|
282
|
+
readonly insights: InsightsModel;
|
|
225
283
|
readonly apiKeys: ApiKeyModel;
|
|
226
284
|
}
|
|
227
285
|
interface BundleRepository {
|
|
@@ -237,4 +295,4 @@ interface DatabasePlugin {
|
|
|
237
295
|
dispose?: () => Promise<void>;
|
|
238
296
|
}
|
|
239
297
|
//#endregion
|
|
240
|
-
export {
|
|
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,5 +1,4 @@
|
|
|
1
1
|
import { DatabaseField, DatabaseModel, DatabaseRow } from "./databaseRows.cjs";
|
|
2
|
-
|
|
3
2
|
//#region src/types/databaseQuery.d.ts
|
|
4
3
|
type DatabaseWhereOperator = "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with";
|
|
5
4
|
type DatabaseWhereConnector = "AND" | "OR";
|
|
@@ -28,10 +27,10 @@ type SetWhere<TField extends string, TValue extends boolean | number | string> =
|
|
|
28
27
|
};
|
|
29
28
|
type ScalarWhereValue<TValue> = unknown extends TValue ? never : Extract<TValue, readonly unknown[] | object> extends never ? Extract<TValue, boolean | number | string | null> : never;
|
|
30
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>>);
|
|
31
|
-
type DatabaseWhere<TModel extends DatabaseModel> = { readonly [TField in DatabaseField<TModel>]: FieldWhere<TField, DatabaseRow<TModel>[TField]
|
|
30
|
+
type DatabaseWhere<TModel extends DatabaseModel> = { readonly [TField in DatabaseField<TModel>]: FieldWhere<TField, DatabaseRow<TModel>[TField]>; }[DatabaseField<TModel>];
|
|
32
31
|
type DatabaseSelect<TModel extends DatabaseModel> = readonly DatabaseField<TModel>[];
|
|
33
32
|
type SelectedDatabaseRow<TModel extends DatabaseModel, TSelect extends DatabaseSelect<TModel> | undefined> = TSelect extends DatabaseSelect<TModel> ? Pick<DatabaseRow<TModel>, TSelect[number]> : DatabaseRow<TModel>;
|
|
34
|
-
type DatabaseSortableField<TModel extends DatabaseModel> = { readonly [TField in DatabaseField<TModel>]: Exclude<DatabaseRow<TModel>[TField], null> extends number | string ? TField : never }[DatabaseField<TModel>];
|
|
33
|
+
type DatabaseSortableField<TModel extends DatabaseModel> = { readonly [TField in DatabaseField<TModel>]: Exclude<DatabaseRow<TModel>[TField], null> extends number | string ? TField : never; }[DatabaseField<TModel>];
|
|
35
34
|
interface DatabaseSortClause<TModel extends DatabaseModel> {
|
|
36
35
|
readonly field: DatabaseSortableField<TModel>;
|
|
37
36
|
readonly direction: "asc" | "desc";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DatabaseField, DatabaseModel, DatabaseRow } from "./databaseRows.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/types/databaseQuery.d.ts
|
|
4
3
|
type DatabaseWhereOperator = "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "not_in" | "contains" | "starts_with" | "ends_with";
|
|
5
4
|
type DatabaseWhereConnector = "AND" | "OR";
|
|
@@ -28,10 +27,10 @@ type SetWhere<TField extends string, TValue extends boolean | number | string> =
|
|
|
28
27
|
};
|
|
29
28
|
type ScalarWhereValue<TValue> = unknown extends TValue ? never : Extract<TValue, readonly unknown[] | object> extends never ? Extract<TValue, boolean | number | string | null> : never;
|
|
30
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>>);
|
|
31
|
-
type DatabaseWhere<TModel extends DatabaseModel> = { readonly [TField in DatabaseField<TModel>]: FieldWhere<TField, DatabaseRow<TModel>[TField]
|
|
30
|
+
type DatabaseWhere<TModel extends DatabaseModel> = { readonly [TField in DatabaseField<TModel>]: FieldWhere<TField, DatabaseRow<TModel>[TField]>; }[DatabaseField<TModel>];
|
|
32
31
|
type DatabaseSelect<TModel extends DatabaseModel> = readonly DatabaseField<TModel>[];
|
|
33
32
|
type SelectedDatabaseRow<TModel extends DatabaseModel, TSelect extends DatabaseSelect<TModel> | undefined> = TSelect extends DatabaseSelect<TModel> ? Pick<DatabaseRow<TModel>, TSelect[number]> : DatabaseRow<TModel>;
|
|
34
|
-
type DatabaseSortableField<TModel extends DatabaseModel> = { readonly [TField in DatabaseField<TModel>]: Exclude<DatabaseRow<TModel>[TField], null> extends number | string ? TField : never }[DatabaseField<TModel>];
|
|
33
|
+
type DatabaseSortableField<TModel extends DatabaseModel> = { readonly [TField in DatabaseField<TModel>]: Exclude<DatabaseRow<TModel>[TField], null> extends number | string ? TField : never; }[DatabaseField<TModel>];
|
|
35
34
|
interface DatabaseSortClause<TModel extends DatabaseModel> {
|
|
36
35
|
readonly field: DatabaseSortableField<TModel>;
|
|
37
36
|
readonly direction: "asc" | "desc";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Platform } from "@hot-updater/core";
|
|
2
|
-
|
|
3
2
|
//#region src/types/databaseRows.d.ts
|
|
4
3
|
type DatabaseJsonValue = boolean | number | string | null | readonly DatabaseJsonValue[] | DatabaseJsonObject;
|
|
5
4
|
type DatabaseJsonObject = {
|
|
@@ -95,6 +94,7 @@ type BundleEventRow = (BundleEventRowBase & {
|
|
|
95
94
|
readonly from_bundle_id: null;
|
|
96
95
|
readonly update_strategy: null;
|
|
97
96
|
});
|
|
97
|
+
type InsightsInstallationRow = Pick<BundleEventRow, "id" | "install_id" | "user_id" | "username" | "to_bundle_id" | "type" | "platform" | "app_version" | "channel" | "cohort" | "received_at_ms">;
|
|
98
98
|
interface ApiKeyRow {
|
|
99
99
|
readonly id: string;
|
|
100
100
|
readonly hash: string;
|
|
@@ -111,10 +111,11 @@ interface DatabaseModelMap {
|
|
|
111
111
|
readonly release_catalogs: ReleaseCatalogRow;
|
|
112
112
|
readonly channels: ChannelRow;
|
|
113
113
|
readonly bundle_events: BundleEventRow;
|
|
114
|
+
readonly bundle_installations: InsightsInstallationRow;
|
|
114
115
|
readonly api_keys: ApiKeyRow;
|
|
115
116
|
}
|
|
116
117
|
type DatabaseModel = keyof DatabaseModelMap;
|
|
117
118
|
type DatabaseRow<TModel extends DatabaseModel> = DatabaseModelMap[TModel];
|
|
118
119
|
type DatabaseField<TModel extends DatabaseModel> = Extract<keyof DatabaseRow<TModel>, string>;
|
|
119
120
|
//#endregion
|
|
120
|
-
export { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseField, DatabaseJsonObject, DatabaseJsonValue, DatabaseModel, DatabaseModelMap, DatabaseRow, ReleaseCatalogRow, ReleaseRow };
|
|
121
|
+
export { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseField, DatabaseJsonObject, DatabaseJsonValue, DatabaseModel, DatabaseModelMap, DatabaseRow, InsightsInstallationRow, ReleaseCatalogRow, ReleaseRow };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Platform } from "@hot-updater/core";
|
|
2
|
-
|
|
3
2
|
//#region src/types/databaseRows.d.ts
|
|
4
3
|
type DatabaseJsonValue = boolean | number | string | null | readonly DatabaseJsonValue[] | DatabaseJsonObject;
|
|
5
4
|
type DatabaseJsonObject = {
|
|
@@ -95,6 +94,7 @@ type BundleEventRow = (BundleEventRowBase & {
|
|
|
95
94
|
readonly from_bundle_id: null;
|
|
96
95
|
readonly update_strategy: null;
|
|
97
96
|
});
|
|
97
|
+
type InsightsInstallationRow = Pick<BundleEventRow, "id" | "install_id" | "user_id" | "username" | "to_bundle_id" | "type" | "platform" | "app_version" | "channel" | "cohort" | "received_at_ms">;
|
|
98
98
|
interface ApiKeyRow {
|
|
99
99
|
readonly id: string;
|
|
100
100
|
readonly hash: string;
|
|
@@ -111,10 +111,11 @@ interface DatabaseModelMap {
|
|
|
111
111
|
readonly release_catalogs: ReleaseCatalogRow;
|
|
112
112
|
readonly channels: ChannelRow;
|
|
113
113
|
readonly bundle_events: BundleEventRow;
|
|
114
|
+
readonly bundle_installations: InsightsInstallationRow;
|
|
114
115
|
readonly api_keys: ApiKeyRow;
|
|
115
116
|
}
|
|
116
117
|
type DatabaseModel = keyof DatabaseModelMap;
|
|
117
118
|
type DatabaseRow<TModel extends DatabaseModel> = DatabaseModelMap[TModel];
|
|
118
119
|
type DatabaseField<TModel extends DatabaseModel> = Extract<keyof DatabaseRow<TModel>, string>;
|
|
119
120
|
//#endregion
|
|
120
|
-
export { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseField, DatabaseJsonObject, DatabaseJsonValue, DatabaseModel, DatabaseModelMap, DatabaseRow, ReleaseCatalogRow, ReleaseRow };
|
|
121
|
+
export { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseField, DatabaseJsonObject, DatabaseJsonValue, DatabaseModel, DatabaseModelMap, DatabaseRow, InsightsInstallationRow, ReleaseCatalogRow, ReleaseRow };
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.cjs";
|
|
2
|
-
import {
|
|
1
|
+
import { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, InsightsInstallationRow, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.cjs";
|
|
2
|
+
import { 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 } from "./databasePlugin.cjs";
|
|
3
3
|
import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./databaseOperations.cjs";
|
|
4
|
+
import "./database.cjs";
|
|
4
5
|
import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./utils.cjs";
|
|
6
|
+
import "./public.cjs";
|
|
5
7
|
import { Bundle, Bundle as Bundle$1, Platform, Platform as Platform$1 } from "@hot-updater/core";
|
|
6
|
-
|
|
7
8
|
//#region src/types/index.d.ts
|
|
8
9
|
interface BasePluginArgs {
|
|
9
10
|
cwd: string;
|
|
@@ -80,6 +81,12 @@ interface BuildPluginConfig {
|
|
|
80
81
|
}
|
|
81
82
|
interface BuildPlugin {
|
|
82
83
|
nativeBuild?: {
|
|
84
|
+
/** Resolves the public key embedded by the native build configuration. */
|
|
85
|
+
getBundleSigningPublicKey?: () => Promise<{
|
|
86
|
+
readonly publicKey: string;
|
|
87
|
+
} | null>;
|
|
88
|
+
/** Resolves native configuration files that must affect the fingerprint. */
|
|
89
|
+
getFingerprintExtraSources?: () => Promise<readonly string[]>;
|
|
83
90
|
prebuild?: (args: {
|
|
84
91
|
platform: Platform;
|
|
85
92
|
}) => Promise<void>;
|
|
@@ -329,8 +336,6 @@ interface StoragePlugin {
|
|
|
329
336
|
}
|
|
330
337
|
interface BundleSigningPlugin {
|
|
331
338
|
readonly name: string;
|
|
332
|
-
/** Path to the pinned RSA public key embedded in native builds. */
|
|
333
|
-
readonly publicKeyPath: string;
|
|
334
339
|
/** Returns the RSA public key used by this provider in SPKI PEM format. */
|
|
335
340
|
readonly getPublicKey: (input?: {
|
|
336
341
|
readonly cwd?: string;
|
|
@@ -351,16 +356,15 @@ interface BundleSigningPlugin {
|
|
|
351
356
|
readonly signature: Uint8Array;
|
|
352
357
|
}>;
|
|
353
358
|
}
|
|
354
|
-
/** Built-in local PEM signing
|
|
359
|
+
/** Built-in local PEM signing. */
|
|
355
360
|
type LocalSigningConfig = {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
readonly enabled: true; /** Path to an RSA private key in PEM format. */
|
|
361
|
+
readonly enabled: true;
|
|
362
|
+
/** Path to an RSA private key in PEM format. */
|
|
359
363
|
readonly privateKeyPath: string;
|
|
360
364
|
} | {
|
|
361
365
|
readonly enabled: false;
|
|
362
366
|
readonly privateKeyPath?: string;
|
|
363
|
-
}
|
|
367
|
+
};
|
|
364
368
|
/** Local config or signing plugin. Signing is disabled when omitted. */
|
|
365
369
|
type SigningConfig = BundleSigningPlugin | LocalSigningConfig;
|
|
366
370
|
/**
|
|
@@ -493,4 +497,4 @@ interface NativeBuildOptions {
|
|
|
493
497
|
scheme?: string;
|
|
494
498
|
}
|
|
495
499
|
//#endregion
|
|
496
|
-
export { ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, type Bundle$1 as Bundle, BundleSigningPlugin, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, FingerprintExtraSources, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, type Platform$1 as Platform, PlatformConfig, SigningConfig, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePlugin, StoragePutInput, StoragePutResult, supportedIosPlatforms };
|
|
500
|
+
export { type ApiKeyModel, type ApiKeyRow, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, BuiltIns, type Bundle$1 as Bundle, type BundleEventRow, type BundleEventRowBase, type BundleModel, type BundleModelQuery, type BundlePatchModel, type BundlePatchRow, type BundleRepository, type BundleRepositoryChange, type BundleRepositoryCommit, type BundleRow, type BundleRowUpdate, BundleSigningPlugin, type ChannelDeleteInput, type ChannelDeleteResult, type ChannelInsertInput, type ChannelInsertResult, type ChannelModel, type ChannelRow, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, type DatabaseBundleMetadata, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, type DatabaseChange, type DatabaseCommit, type DatabaseCommitExpectation, type DatabaseCommitResult, type DatabaseJsonObject, type DatabaseJsonValue, type DatabaseModels, type DatabasePlugin, FingerprintExtraSources, HasMultipleCallSignatures, type InsightsBundleEventFilter, type InsightsCountEventsInput, type InsightsCountInstallationsInput, type InsightsEventCursor, type InsightsEventFilter, type InsightsFindInstallationsInput, type InsightsInstallationRow, type InsightsListEventsInput, type InsightsModel, type InsightsRecordInput, type InsightsScope, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, type Platform$1 as Platform, PlatformConfig, Primitive, type ReleaseCatalogModel, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, type ReleaseModel, type ReleaseRow, type ReleaseRowUpdate, RequiredDeep, SigningConfig, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePlugin, StoragePutInput, StoragePutResult, supportedIosPlatforms };
|