@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,88 +0,0 @@
|
|
|
1
|
-
const require_databasePluginCrudValidationErrors = require("./databasePluginCrudValidationErrors.cjs");
|
|
2
|
-
const require_databasePluginCrudValidationFields = require("./databasePluginCrudValidationFields.cjs");
|
|
3
|
-
const require_databasePluginCrudValidationRows = require("./databasePluginCrudValidationRows.cjs");
|
|
4
|
-
const require_databasePluginCrudValidationMutations = require("./databasePluginCrudValidationMutations.cjs");
|
|
5
|
-
const require_databasePluginCrudValidationQueries = require("./databasePluginCrudValidationQueries.cjs");
|
|
6
|
-
//#region src/databasePluginCrud.ts
|
|
7
|
-
const createDatabasePluginCrud = (implementation) => {
|
|
8
|
-
async function create(input) {
|
|
9
|
-
require_databasePluginCrudValidationFields.validateModel(input.model);
|
|
10
|
-
require_databasePluginCrudValidationRows.validateCreateData(input.model, input.data);
|
|
11
|
-
if (input.onConflict !== void 0 && !(input.onConflict === "ignore" && (input.model === "channels" || input.model === "api_keys" || input.model === "bundle_installations"))) throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-operation");
|
|
12
|
-
require_databasePluginCrudValidationQueries.validateSelect(input.model, input.select);
|
|
13
|
-
const row = await implementation.create(input);
|
|
14
|
-
require_databasePluginCrudValidationRows.validateResult(input.model, row, input.select);
|
|
15
|
-
return require_databasePluginCrudValidationRows.selectRow(row, input);
|
|
16
|
-
}
|
|
17
|
-
async function update(input) {
|
|
18
|
-
require_databasePluginCrudValidationFields.validateModel(input.model);
|
|
19
|
-
require_databasePluginCrudValidationQueries.validateWhere(input.model, input.where);
|
|
20
|
-
require_databasePluginCrudValidationMutations.validateMutationWhere(input.where);
|
|
21
|
-
require_databasePluginCrudValidationMutations.validateUpdateWhere(input.model, input.where);
|
|
22
|
-
if (input.model === "bundles") require_databasePluginCrudValidationMutations.validateBundleUpdateData(input.update);
|
|
23
|
-
else if (input.model === "releases") require_databasePluginCrudValidationMutations.validateReleaseUpdateData(input.update);
|
|
24
|
-
else if (input.model === "release_catalogs") require_databasePluginCrudValidationMutations.validateReleaseCatalogUpdateData(input.update);
|
|
25
|
-
else if (input.model === "bundle_installations") require_databasePluginCrudValidationMutations.validateInsightsInstallationUpdateData(input.update);
|
|
26
|
-
else if (input.model === "api_keys") require_databasePluginCrudValidationMutations.validateApiKeyUpdateData(input.update);
|
|
27
|
-
else throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-operation");
|
|
28
|
-
require_databasePluginCrudValidationQueries.validateSelect(input.model, input.select);
|
|
29
|
-
if (input.model === "bundles") {} else if (input.model === "releases") await require_databasePluginCrudValidationMutations.validateReleaseTargetUpdate(implementation, input);
|
|
30
|
-
const row = await implementation.update(input);
|
|
31
|
-
if (row === null) return null;
|
|
32
|
-
require_databasePluginCrudValidationRows.validateResult(input.model, row, input.select);
|
|
33
|
-
return require_databasePluginCrudValidationRows.selectRow(row, input);
|
|
34
|
-
}
|
|
35
|
-
async function deleteRows(input) {
|
|
36
|
-
require_databasePluginCrudValidationFields.validateModel(input.model);
|
|
37
|
-
if (input.model !== "bundles" && input.model !== "bundle_patches" && input.model !== "releases" && input.model !== "channels") throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-operation");
|
|
38
|
-
require_databasePluginCrudValidationQueries.validateWhere(input.model, input.where);
|
|
39
|
-
require_databasePluginCrudValidationMutations.validateMutationWhere(input.where);
|
|
40
|
-
await implementation.delete(input);
|
|
41
|
-
}
|
|
42
|
-
async function count(input) {
|
|
43
|
-
require_databasePluginCrudValidationFields.validateModel(input.model);
|
|
44
|
-
require_databasePluginCrudValidationQueries.validateWhere(input.model, input.where);
|
|
45
|
-
require_databasePluginCrudValidationQueries.validateDistinctFields(input.model, input.distinct);
|
|
46
|
-
const value = await implementation.count(input);
|
|
47
|
-
if (!Number.isSafeInteger(value) || value < 0) throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-result");
|
|
48
|
-
return value;
|
|
49
|
-
}
|
|
50
|
-
async function findOne(input) {
|
|
51
|
-
require_databasePluginCrudValidationFields.validateModel(input.model);
|
|
52
|
-
require_databasePluginCrudValidationQueries.validateWhere(input.model, input.where);
|
|
53
|
-
require_databasePluginCrudValidationQueries.validateSelect(input.model, input.select);
|
|
54
|
-
const row = await implementation.findOne(input);
|
|
55
|
-
if (row === null) return null;
|
|
56
|
-
require_databasePluginCrudValidationRows.validateResult(input.model, row, input.select);
|
|
57
|
-
return require_databasePluginCrudValidationRows.selectRow(row, input);
|
|
58
|
-
}
|
|
59
|
-
async function findMany(input) {
|
|
60
|
-
require_databasePluginCrudValidationFields.validateModel(input.model);
|
|
61
|
-
require_databasePluginCrudValidationQueries.validateWhere(input.model, input.where);
|
|
62
|
-
require_databasePluginCrudValidationQueries.validatePagination(input.limit, input.offset);
|
|
63
|
-
require_databasePluginCrudValidationQueries.validateSelect(input.model, input.select);
|
|
64
|
-
const validatedOrderBy = require_databasePluginCrudValidationQueries.validateOrderBy(input.model, input.orderBy);
|
|
65
|
-
require_databasePluginCrudValidationQueries.validateDistinctOn(input.model, input.distinctOn, validatedOrderBy);
|
|
66
|
-
const normalizedInput = {
|
|
67
|
-
...input,
|
|
68
|
-
orderBy: input.orderBy,
|
|
69
|
-
limit: input.limit ?? 100,
|
|
70
|
-
offset: input.offset ?? 0
|
|
71
|
-
};
|
|
72
|
-
const rows = await implementation.findMany(normalizedInput);
|
|
73
|
-
if (!Array.isArray(rows)) throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-result");
|
|
74
|
-
rows.forEach((row) => require_databasePluginCrudValidationRows.validateResult(input.model, row, input.select));
|
|
75
|
-
return rows.map((row) => require_databasePluginCrudValidationRows.selectRow(row, input));
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
create,
|
|
79
|
-
update,
|
|
80
|
-
delete: deleteRows,
|
|
81
|
-
count,
|
|
82
|
-
findOne,
|
|
83
|
-
findMany
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
//#endregion
|
|
87
|
-
exports.DatabasePluginInputError = require_databasePluginCrudValidationErrors.DatabasePluginInputError;
|
|
88
|
-
exports.createDatabasePluginCrud = createDatabasePluginCrud;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { DatabasePluginInputError } from "./databasePluginCrudValidationErrors.mjs";
|
|
2
|
-
import { validateModel } from "./databasePluginCrudValidationFields.mjs";
|
|
3
|
-
import { selectRow, validateCreateData, validateResult } from "./databasePluginCrudValidationRows.mjs";
|
|
4
|
-
import { validateApiKeyUpdateData, validateBundleUpdateData, validateInsightsInstallationUpdateData, validateMutationWhere, validateReleaseCatalogUpdateData, validateReleaseTargetUpdate, validateReleaseUpdateData, validateUpdateWhere } from "./databasePluginCrudValidationMutations.mjs";
|
|
5
|
-
import { validateDistinctFields, validateDistinctOn, validateOrderBy, validatePagination, validateSelect, validateWhere } from "./databasePluginCrudValidationQueries.mjs";
|
|
6
|
-
//#region src/databasePluginCrud.ts
|
|
7
|
-
const createDatabasePluginCrud = (implementation) => {
|
|
8
|
-
async function create(input) {
|
|
9
|
-
validateModel(input.model);
|
|
10
|
-
validateCreateData(input.model, input.data);
|
|
11
|
-
if (input.onConflict !== void 0 && !(input.onConflict === "ignore" && (input.model === "channels" || input.model === "api_keys" || input.model === "bundle_installations"))) throw new DatabasePluginInputError("invalid-operation");
|
|
12
|
-
validateSelect(input.model, input.select);
|
|
13
|
-
const row = await implementation.create(input);
|
|
14
|
-
validateResult(input.model, row, input.select);
|
|
15
|
-
return selectRow(row, input);
|
|
16
|
-
}
|
|
17
|
-
async function update(input) {
|
|
18
|
-
validateModel(input.model);
|
|
19
|
-
validateWhere(input.model, input.where);
|
|
20
|
-
validateMutationWhere(input.where);
|
|
21
|
-
validateUpdateWhere(input.model, input.where);
|
|
22
|
-
if (input.model === "bundles") validateBundleUpdateData(input.update);
|
|
23
|
-
else if (input.model === "releases") validateReleaseUpdateData(input.update);
|
|
24
|
-
else if (input.model === "release_catalogs") validateReleaseCatalogUpdateData(input.update);
|
|
25
|
-
else if (input.model === "bundle_installations") validateInsightsInstallationUpdateData(input.update);
|
|
26
|
-
else if (input.model === "api_keys") validateApiKeyUpdateData(input.update);
|
|
27
|
-
else throw new DatabasePluginInputError("invalid-operation");
|
|
28
|
-
validateSelect(input.model, input.select);
|
|
29
|
-
if (input.model === "bundles") {} else if (input.model === "releases") await validateReleaseTargetUpdate(implementation, input);
|
|
30
|
-
const row = await implementation.update(input);
|
|
31
|
-
if (row === null) return null;
|
|
32
|
-
validateResult(input.model, row, input.select);
|
|
33
|
-
return selectRow(row, input);
|
|
34
|
-
}
|
|
35
|
-
async function deleteRows(input) {
|
|
36
|
-
validateModel(input.model);
|
|
37
|
-
if (input.model !== "bundles" && input.model !== "bundle_patches" && input.model !== "releases" && input.model !== "channels") throw new DatabasePluginInputError("invalid-operation");
|
|
38
|
-
validateWhere(input.model, input.where);
|
|
39
|
-
validateMutationWhere(input.where);
|
|
40
|
-
await implementation.delete(input);
|
|
41
|
-
}
|
|
42
|
-
async function count(input) {
|
|
43
|
-
validateModel(input.model);
|
|
44
|
-
validateWhere(input.model, input.where);
|
|
45
|
-
validateDistinctFields(input.model, input.distinct);
|
|
46
|
-
const value = await implementation.count(input);
|
|
47
|
-
if (!Number.isSafeInteger(value) || value < 0) throw new DatabasePluginInputError("invalid-result");
|
|
48
|
-
return value;
|
|
49
|
-
}
|
|
50
|
-
async function findOne(input) {
|
|
51
|
-
validateModel(input.model);
|
|
52
|
-
validateWhere(input.model, input.where);
|
|
53
|
-
validateSelect(input.model, input.select);
|
|
54
|
-
const row = await implementation.findOne(input);
|
|
55
|
-
if (row === null) return null;
|
|
56
|
-
validateResult(input.model, row, input.select);
|
|
57
|
-
return selectRow(row, input);
|
|
58
|
-
}
|
|
59
|
-
async function findMany(input) {
|
|
60
|
-
validateModel(input.model);
|
|
61
|
-
validateWhere(input.model, input.where);
|
|
62
|
-
validatePagination(input.limit, input.offset);
|
|
63
|
-
validateSelect(input.model, input.select);
|
|
64
|
-
const validatedOrderBy = validateOrderBy(input.model, input.orderBy);
|
|
65
|
-
validateDistinctOn(input.model, input.distinctOn, validatedOrderBy);
|
|
66
|
-
const normalizedInput = {
|
|
67
|
-
...input,
|
|
68
|
-
orderBy: input.orderBy,
|
|
69
|
-
limit: input.limit ?? 100,
|
|
70
|
-
offset: input.offset ?? 0
|
|
71
|
-
};
|
|
72
|
-
const rows = await implementation.findMany(normalizedInput);
|
|
73
|
-
if (!Array.isArray(rows)) throw new DatabasePluginInputError("invalid-result");
|
|
74
|
-
rows.forEach((row) => validateResult(input.model, row, input.select));
|
|
75
|
-
return rows.map((row) => selectRow(row, input));
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
create,
|
|
79
|
-
update,
|
|
80
|
-
delete: deleteRows,
|
|
81
|
-
count,
|
|
82
|
-
findOne,
|
|
83
|
-
findMany
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
//#endregion
|
|
87
|
-
export { DatabasePluginInputError, createDatabasePluginCrud };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { DatabasePluginInputError, DatabasePluginInputErrorCode } from "./databasePluginCrudValidationErrors.cjs";
|
|
2
|
-
import "./databasePluginCrudValidationFields.cjs";
|
|
3
|
-
import "./databasePluginCrudValidationMutations.cjs";
|
|
4
|
-
import "./databasePluginCrudValidationQueries.cjs";
|
|
5
|
-
import "./databasePluginCrudValidationRows.cjs";
|
|
6
|
-
export { DatabasePluginInputError, type DatabasePluginInputErrorCode };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { DatabasePluginInputError, DatabasePluginInputErrorCode } from "./databasePluginCrudValidationErrors.mjs";
|
|
2
|
-
import "./databasePluginCrudValidationFields.mjs";
|
|
3
|
-
import "./databasePluginCrudValidationMutations.mjs";
|
|
4
|
-
import "./databasePluginCrudValidationQueries.mjs";
|
|
5
|
-
import "./databasePluginCrudValidationRows.mjs";
|
|
6
|
-
export { DatabasePluginInputError, type DatabasePluginInputErrorCode };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//#region src/databasePluginCrudValidationErrors.ts
|
|
2
|
-
var DatabasePluginInputError = class extends Error {
|
|
3
|
-
code;
|
|
4
|
-
name = "DatabasePluginInputError";
|
|
5
|
-
constructor(code) {
|
|
6
|
-
super(`Invalid database plugin input: ${code}`);
|
|
7
|
-
this.code = code;
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
//#endregion
|
|
11
|
-
exports.DatabasePluginInputError = DatabasePluginInputError;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
//#region src/databasePluginCrudValidationErrors.d.ts
|
|
2
|
-
type DatabasePluginInputErrorCode = "empty-mutation-where" | "empty-select" | "invalid-data" | "invalid-distinct" | "invalid-field" | "invalid-model" | "invalid-operation" | "invalid-query" | "invalid-result" | "invalid-pagination" | "invalid-update-selector";
|
|
3
|
-
declare class DatabasePluginInputError extends Error {
|
|
4
|
-
readonly code: DatabasePluginInputErrorCode;
|
|
5
|
-
readonly name = "DatabasePluginInputError";
|
|
6
|
-
constructor(code: DatabasePluginInputErrorCode);
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
export { DatabasePluginInputError, DatabasePluginInputErrorCode };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
//#region src/databasePluginCrudValidationErrors.d.ts
|
|
2
|
-
type DatabasePluginInputErrorCode = "empty-mutation-where" | "empty-select" | "invalid-data" | "invalid-distinct" | "invalid-field" | "invalid-model" | "invalid-operation" | "invalid-query" | "invalid-result" | "invalid-pagination" | "invalid-update-selector";
|
|
3
|
-
declare class DatabasePluginInputError extends Error {
|
|
4
|
-
readonly code: DatabasePluginInputErrorCode;
|
|
5
|
-
readonly name = "DatabasePluginInputError";
|
|
6
|
-
constructor(code: DatabasePluginInputErrorCode);
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
export { DatabasePluginInputError, DatabasePluginInputErrorCode };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//#region src/databasePluginCrudValidationErrors.ts
|
|
2
|
-
var DatabasePluginInputError = class extends Error {
|
|
3
|
-
code;
|
|
4
|
-
name = "DatabasePluginInputError";
|
|
5
|
-
constructor(code) {
|
|
6
|
-
super(`Invalid database plugin input: ${code}`);
|
|
7
|
-
this.code = code;
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
//#endregion
|
|
11
|
-
export { DatabasePluginInputError };
|
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
const require_databasePluginCrudValidationErrors = require("./databasePluginCrudValidationErrors.cjs");
|
|
2
|
-
const require_databaseJsonValue = require("./databaseJsonValue.cjs");
|
|
3
|
-
const require_databaseFields = require("./types/databaseFields.cjs");
|
|
4
|
-
let _hot_updater_core = require("@hot-updater/core");
|
|
5
|
-
//#region src/databasePluginCrudValidationFields.ts
|
|
6
|
-
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7
|
-
const isChannelText = (value) => {
|
|
8
|
-
if (typeof value !== "string" || value.length === 0) return false;
|
|
9
|
-
let codePointCount = 0;
|
|
10
|
-
for (const _codePoint of value) {
|
|
11
|
-
codePointCount += 1;
|
|
12
|
-
if (codePointCount > 255) return false;
|
|
13
|
-
}
|
|
14
|
-
return true;
|
|
15
|
-
};
|
|
16
|
-
const isInsightsIdentityText = (value) => typeof value === "string" && value.length > 0 && value.length <= 255;
|
|
17
|
-
const isNullableInsightsIdentityText = (value) => value === null || isInsightsIdentityText(value);
|
|
18
|
-
const modelValidators = {
|
|
19
|
-
bundles: {
|
|
20
|
-
id: (value) => typeof value === "string",
|
|
21
|
-
platform: (value) => value === "ios" || value === "android",
|
|
22
|
-
should_force_update: (value) => typeof value === "boolean",
|
|
23
|
-
enabled: (value) => typeof value === "boolean",
|
|
24
|
-
file_hash: (value) => typeof value === "string",
|
|
25
|
-
git_commit_hash: (value) => value === null || typeof value === "string",
|
|
26
|
-
message: (value) => value === null || typeof value === "string",
|
|
27
|
-
channel: isChannelText,
|
|
28
|
-
channel_id: isChannelText,
|
|
29
|
-
storage_uri: (value) => typeof value === "string",
|
|
30
|
-
archive_byte_size: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0,
|
|
31
|
-
target_app_version: (value) => value === null || typeof value === "string",
|
|
32
|
-
fingerprint_hash: (value) => value === null || typeof value === "string",
|
|
33
|
-
metadata: require_databaseJsonValue.isDatabaseMetadataObject,
|
|
34
|
-
rollout_cohort_count: (value) => typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 1e3,
|
|
35
|
-
target_cohorts: (value) => value === null || Array.isArray(value) && value.every((item) => typeof item === "string"),
|
|
36
|
-
manifest_storage_uri: (value) => value === null || typeof value === "string",
|
|
37
|
-
manifest_file_hash: (value) => value === null || typeof value === "string",
|
|
38
|
-
asset_base_storage_uri: (value) => value === null || typeof value === "string"
|
|
39
|
-
},
|
|
40
|
-
bundle_patches: {
|
|
41
|
-
id: (value) => typeof value === "string",
|
|
42
|
-
bundle_id: (value) => typeof value === "string",
|
|
43
|
-
base_bundle_id: (value) => typeof value === "string",
|
|
44
|
-
base_file_hash: (value) => typeof value === "string",
|
|
45
|
-
patch_file_hash: (value) => typeof value === "string",
|
|
46
|
-
patch_storage_uri: (value) => typeof value === "string",
|
|
47
|
-
byte_size: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0,
|
|
48
|
-
order_index: (value) => typeof value === "number" && Number.isInteger(value) && value >= 0
|
|
49
|
-
},
|
|
50
|
-
releases: {
|
|
51
|
-
id: _hot_updater_core.isUUIDv7,
|
|
52
|
-
revision: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 1,
|
|
53
|
-
scope_key: (value) => typeof value === "string" && value.length > 0,
|
|
54
|
-
channel_id: isChannelText,
|
|
55
|
-
platform: (value) => value === "ios" || value === "android",
|
|
56
|
-
kind: (value) => value === "BUNDLE" || value === "EMBEDDED",
|
|
57
|
-
bundle_id: (value) => value === null || typeof value === "string",
|
|
58
|
-
strategy: (value) => value === "APP_VERSION" || value === "FINGERPRINT",
|
|
59
|
-
target_app_version: (value) => value === null || typeof value === "string",
|
|
60
|
-
fingerprint_hash: (value) => value === null || typeof value === "string",
|
|
61
|
-
enabled: (value) => typeof value === "boolean",
|
|
62
|
-
should_force_update: (value) => typeof value === "boolean",
|
|
63
|
-
message: (value) => value === null || typeof value === "string",
|
|
64
|
-
rollout_cohort_count: (value) => typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 1e3,
|
|
65
|
-
target_cohorts: (value) => Array.isArray(value) && value.every((item) => typeof item === "string"),
|
|
66
|
-
operation: (value) => value === "DEPLOY" || value === "PROMOTE" || value === "ROLLBACK",
|
|
67
|
-
source_release_id: (value) => value === null || (0, _hot_updater_core.isUUIDv7)(value),
|
|
68
|
-
created_at_ms: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0,
|
|
69
|
-
updated_at_ms: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0
|
|
70
|
-
},
|
|
71
|
-
release_catalogs: {
|
|
72
|
-
scope_key: (value) => typeof value === "string" && value.length > 0,
|
|
73
|
-
catalog_id: (value) => typeof value === "string" && value.length > 0,
|
|
74
|
-
strategy: (value) => value === "APP_VERSION" || value === "FINGERPRINT",
|
|
75
|
-
channel_id: isChannelText,
|
|
76
|
-
channel_key: (value) => typeof value === "string" && value.length > 0,
|
|
77
|
-
platform: (value) => value === "ios" || value === "android",
|
|
78
|
-
fingerprint_hash: (value) => value === null || typeof value === "string",
|
|
79
|
-
generation: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 1,
|
|
80
|
-
payload: (value) => typeof value === "string",
|
|
81
|
-
catalog_hash: (value) => typeof value === "string" && value.length > 0,
|
|
82
|
-
byte_size: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0,
|
|
83
|
-
is_tombstone: (value) => typeof value === "boolean",
|
|
84
|
-
updated_at_ms: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0
|
|
85
|
-
},
|
|
86
|
-
channels: {
|
|
87
|
-
id: isChannelText,
|
|
88
|
-
name: isChannelText
|
|
89
|
-
},
|
|
90
|
-
bundle_events: {
|
|
91
|
-
id: (value) => typeof value === "string",
|
|
92
|
-
type: (value) => value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "RELEASE_ADOPTED" || value === "UNCHANGED",
|
|
93
|
-
install_id: isInsightsIdentityText,
|
|
94
|
-
user_id: isNullableInsightsIdentityText,
|
|
95
|
-
username: (value) => value === null || typeof value === "string",
|
|
96
|
-
from_bundle_id: (value) => value === null || typeof value === "string",
|
|
97
|
-
from_release_id: (value) => value === null || typeof value === "string",
|
|
98
|
-
to_release_id: (value) => value === null || typeof value === "string",
|
|
99
|
-
to_bundle_id: (value) => typeof value === "string",
|
|
100
|
-
platform: (value) => value === "ios" || value === "android",
|
|
101
|
-
app_version: (value) => typeof value === "string",
|
|
102
|
-
channel: (value) => typeof value === "string",
|
|
103
|
-
cohort: (value) => typeof value === "string",
|
|
104
|
-
update_strategy: (value) => value === null || value === "fingerprint" || value === "appVersion",
|
|
105
|
-
fingerprint_hash: (value) => value === null || typeof value === "string",
|
|
106
|
-
sdk_version: (value) => value === null || typeof value === "string",
|
|
107
|
-
received_at_ms: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0
|
|
108
|
-
},
|
|
109
|
-
bundle_installations: {
|
|
110
|
-
id: (value) => typeof value === "string",
|
|
111
|
-
install_id: isInsightsIdentityText,
|
|
112
|
-
user_id: isNullableInsightsIdentityText,
|
|
113
|
-
username: (value) => value === null || typeof value === "string",
|
|
114
|
-
to_bundle_id: (value) => typeof value === "string",
|
|
115
|
-
type: (value) => value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "RELEASE_ADOPTED" || value === "UNCHANGED",
|
|
116
|
-
platform: (value) => value === "ios" || value === "android",
|
|
117
|
-
app_version: (value) => typeof value === "string",
|
|
118
|
-
channel: (value) => typeof value === "string",
|
|
119
|
-
cohort: (value) => typeof value === "string",
|
|
120
|
-
received_at_ms: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0
|
|
121
|
-
},
|
|
122
|
-
api_keys: {
|
|
123
|
-
id: (value) => typeof value === "string",
|
|
124
|
-
hash: (value) => typeof value === "string",
|
|
125
|
-
name: (value) => typeof value === "string",
|
|
126
|
-
prefix: (value) => typeof value === "string",
|
|
127
|
-
role: (value) => value === "client",
|
|
128
|
-
created_at_ms: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0,
|
|
129
|
-
revoked_at_ms: (value) => value === null || typeof value === "number" && Number.isSafeInteger(value) && value >= 0
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
const stringFields = /* @__PURE__ */ new Set([
|
|
133
|
-
"id",
|
|
134
|
-
"platform",
|
|
135
|
-
"file_hash",
|
|
136
|
-
"git_commit_hash",
|
|
137
|
-
"message",
|
|
138
|
-
"channel",
|
|
139
|
-
"channel_id",
|
|
140
|
-
"storage_uri",
|
|
141
|
-
"target_app_version",
|
|
142
|
-
"fingerprint_hash",
|
|
143
|
-
"bundle_id",
|
|
144
|
-
"base_bundle_id",
|
|
145
|
-
"base_file_hash",
|
|
146
|
-
"patch_file_hash",
|
|
147
|
-
"patch_storage_uri",
|
|
148
|
-
"scope_key",
|
|
149
|
-
"catalog_id",
|
|
150
|
-
"channel_key",
|
|
151
|
-
"kind",
|
|
152
|
-
"bundle_id",
|
|
153
|
-
"strategy",
|
|
154
|
-
"operation",
|
|
155
|
-
"source_release_id",
|
|
156
|
-
"payload",
|
|
157
|
-
"catalog_hash",
|
|
158
|
-
"type",
|
|
159
|
-
"install_id",
|
|
160
|
-
"user_id",
|
|
161
|
-
"username",
|
|
162
|
-
"from_bundle_id",
|
|
163
|
-
"to_bundle_id",
|
|
164
|
-
"app_version",
|
|
165
|
-
"cohort",
|
|
166
|
-
"update_strategy",
|
|
167
|
-
"sdk_version",
|
|
168
|
-
"hash",
|
|
169
|
-
"name",
|
|
170
|
-
"prefix",
|
|
171
|
-
"role"
|
|
172
|
-
]);
|
|
173
|
-
const numberFields = /* @__PURE__ */ new Set([
|
|
174
|
-
"archive_byte_size",
|
|
175
|
-
"byte_size",
|
|
176
|
-
"rollout_cohort_count",
|
|
177
|
-
"order_index",
|
|
178
|
-
"revision",
|
|
179
|
-
"generation",
|
|
180
|
-
"byte_size",
|
|
181
|
-
"updated_at_ms",
|
|
182
|
-
"received_at_ms",
|
|
183
|
-
"created_at_ms",
|
|
184
|
-
"revoked_at_ms"
|
|
185
|
-
]);
|
|
186
|
-
const booleanFields = /* @__PURE__ */ new Set([
|
|
187
|
-
"should_force_update",
|
|
188
|
-
"enabled",
|
|
189
|
-
"is_tombstone"
|
|
190
|
-
]);
|
|
191
|
-
const sortableFields = {
|
|
192
|
-
bundles: /* @__PURE__ */ new Set([
|
|
193
|
-
"id",
|
|
194
|
-
"platform",
|
|
195
|
-
"file_hash",
|
|
196
|
-
"git_commit_hash",
|
|
197
|
-
"message",
|
|
198
|
-
"channel",
|
|
199
|
-
"channel_id",
|
|
200
|
-
"storage_uri",
|
|
201
|
-
"archive_byte_size",
|
|
202
|
-
"target_app_version",
|
|
203
|
-
"fingerprint_hash",
|
|
204
|
-
"rollout_cohort_count",
|
|
205
|
-
"manifest_storage_uri",
|
|
206
|
-
"manifest_file_hash",
|
|
207
|
-
"asset_base_storage_uri"
|
|
208
|
-
]),
|
|
209
|
-
bundle_patches: /* @__PURE__ */ new Set([
|
|
210
|
-
"id",
|
|
211
|
-
"bundle_id",
|
|
212
|
-
"base_bundle_id",
|
|
213
|
-
"base_file_hash",
|
|
214
|
-
"patch_file_hash",
|
|
215
|
-
"patch_storage_uri",
|
|
216
|
-
"byte_size",
|
|
217
|
-
"order_index"
|
|
218
|
-
]),
|
|
219
|
-
releases: /* @__PURE__ */ new Set([
|
|
220
|
-
"id",
|
|
221
|
-
"revision",
|
|
222
|
-
"scope_key",
|
|
223
|
-
"channel_id",
|
|
224
|
-
"platform",
|
|
225
|
-
"kind",
|
|
226
|
-
"bundle_id",
|
|
227
|
-
"strategy",
|
|
228
|
-
"target_app_version",
|
|
229
|
-
"fingerprint_hash",
|
|
230
|
-
"enabled",
|
|
231
|
-
"should_force_update",
|
|
232
|
-
"message",
|
|
233
|
-
"rollout_cohort_count",
|
|
234
|
-
"operation",
|
|
235
|
-
"source_release_id",
|
|
236
|
-
"created_at_ms",
|
|
237
|
-
"updated_at_ms"
|
|
238
|
-
]),
|
|
239
|
-
release_catalogs: /* @__PURE__ */ new Set([
|
|
240
|
-
"scope_key",
|
|
241
|
-
"catalog_id",
|
|
242
|
-
"strategy",
|
|
243
|
-
"channel_id",
|
|
244
|
-
"channel_key",
|
|
245
|
-
"platform",
|
|
246
|
-
"fingerprint_hash",
|
|
247
|
-
"generation",
|
|
248
|
-
"catalog_hash",
|
|
249
|
-
"byte_size",
|
|
250
|
-
"is_tombstone",
|
|
251
|
-
"updated_at_ms"
|
|
252
|
-
]),
|
|
253
|
-
channels: /* @__PURE__ */ new Set(["id", "name"]),
|
|
254
|
-
bundle_events: /* @__PURE__ */ new Set([
|
|
255
|
-
"id",
|
|
256
|
-
"type",
|
|
257
|
-
"install_id",
|
|
258
|
-
"user_id",
|
|
259
|
-
"username",
|
|
260
|
-
"from_bundle_id",
|
|
261
|
-
"from_release_id",
|
|
262
|
-
"to_release_id",
|
|
263
|
-
"to_bundle_id",
|
|
264
|
-
"platform",
|
|
265
|
-
"app_version",
|
|
266
|
-
"channel",
|
|
267
|
-
"cohort",
|
|
268
|
-
"update_strategy",
|
|
269
|
-
"fingerprint_hash",
|
|
270
|
-
"sdk_version",
|
|
271
|
-
"received_at_ms"
|
|
272
|
-
]),
|
|
273
|
-
bundle_installations: /* @__PURE__ */ new Set([
|
|
274
|
-
"id",
|
|
275
|
-
"install_id",
|
|
276
|
-
"user_id",
|
|
277
|
-
"username",
|
|
278
|
-
"to_bundle_id",
|
|
279
|
-
"type",
|
|
280
|
-
"platform",
|
|
281
|
-
"app_version",
|
|
282
|
-
"channel",
|
|
283
|
-
"cohort",
|
|
284
|
-
"received_at_ms"
|
|
285
|
-
]),
|
|
286
|
-
api_keys: /* @__PURE__ */ new Set([
|
|
287
|
-
"id",
|
|
288
|
-
"hash",
|
|
289
|
-
"name",
|
|
290
|
-
"prefix",
|
|
291
|
-
"role",
|
|
292
|
-
"created_at_ms",
|
|
293
|
-
"revoked_at_ms"
|
|
294
|
-
])
|
|
295
|
-
};
|
|
296
|
-
const validateModel = (model) => {
|
|
297
|
-
if (typeof model !== "string" || !Object.hasOwn(require_databaseFields.databaseFields, model)) throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-model");
|
|
298
|
-
};
|
|
299
|
-
const validateField = (model, field) => {
|
|
300
|
-
if (!require_databaseFields.databaseFields[model].includes(field)) throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-field");
|
|
301
|
-
};
|
|
302
|
-
const validateFields = (model, fields) => {
|
|
303
|
-
for (const field of fields) validateField(model, field);
|
|
304
|
-
};
|
|
305
|
-
const isStringField = (field) => stringFields.has(field);
|
|
306
|
-
const isNumberField = (field) => numberFields.has(field);
|
|
307
|
-
const isBooleanField = (field) => booleanFields.has(field);
|
|
308
|
-
//#endregion
|
|
309
|
-
exports.booleanFields = booleanFields;
|
|
310
|
-
exports.isBooleanField = isBooleanField;
|
|
311
|
-
exports.isChannelText = isChannelText;
|
|
312
|
-
exports.isNumberField = isNumberField;
|
|
313
|
-
exports.isRecord = isRecord;
|
|
314
|
-
exports.isStringField = isStringField;
|
|
315
|
-
exports.modelValidators = modelValidators;
|
|
316
|
-
exports.numberFields = numberFields;
|
|
317
|
-
exports.sortableFields = sortableFields;
|
|
318
|
-
exports.stringFields = stringFields;
|
|
319
|
-
exports.validateField = validateField;
|
|
320
|
-
exports.validateFields = validateFields;
|
|
321
|
-
exports.validateModel = validateModel;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./types/internal.cjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./types/internal.mjs";
|