@hot-updater/plugin-core 1.0.0-rc.15 → 1.0.0-rc.16

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.
Files changed (145) hide show
  1. package/dist/bundleEventRow.cjs +42 -0
  2. package/dist/bundleEventRow.mjs +41 -0
  3. package/dist/coreApi.d.cts +131 -0
  4. package/dist/coreApi.d.mts +131 -0
  5. package/dist/database/adapter.cjs +37 -0
  6. package/dist/database/adapter.d.cts +150 -0
  7. package/dist/database/adapter.d.mts +150 -0
  8. package/dist/database/adapter.mjs +30 -0
  9. package/dist/database/memoryAdapter.cjs +102 -0
  10. package/dist/database/memoryAdapter.d.cts +16 -0
  11. package/dist/database/memoryAdapter.d.mts +16 -0
  12. package/dist/database/memoryAdapter.mjs +102 -0
  13. package/dist/database/values.cjs +110 -0
  14. package/dist/database/values.d.cts +30 -0
  15. package/dist/database/values.d.mts +30 -0
  16. package/dist/database/values.mjs +100 -0
  17. package/dist/database/verifyAdapter.cjs +129 -0
  18. package/dist/database/verifyAdapter.d.cts +29 -0
  19. package/dist/database/verifyAdapter.d.mts +29 -0
  20. package/dist/database/verifyAdapter.mjs +128 -0
  21. package/dist/databaseErrors.cjs +30 -0
  22. package/dist/databaseErrors.d.cts +21 -0
  23. package/dist/databaseErrors.d.mts +21 -0
  24. package/dist/databaseErrors.mjs +28 -0
  25. package/dist/databaseMetadata.cjs +2 -2
  26. package/dist/databaseMetadata.mjs +1 -1
  27. package/dist/index.cjs +10 -36
  28. package/dist/index.d.cts +13 -17
  29. package/dist/index.d.mts +13 -17
  30. package/dist/index.mjs +8 -14
  31. package/dist/insightsContract.cjs +26 -24
  32. package/dist/insightsContract.d.cts +6 -1
  33. package/dist/insightsContract.d.mts +6 -1
  34. package/dist/insightsContract.mjs +6 -5
  35. package/dist/insightsDistinctSummary.cjs +2 -1
  36. package/dist/insightsDistinctSummary.mjs +2 -1
  37. package/dist/insightsOverview.cjs +4 -4
  38. package/dist/insightsOverview.d.cts +3 -1
  39. package/dist/insightsOverview.d.mts +3 -1
  40. package/dist/insightsOverview.mjs +4 -5
  41. package/dist/internal.cjs +32 -8
  42. package/dist/internal.d.cts +11 -10
  43. package/dist/internal.d.mts +11 -10
  44. package/dist/internal.mjs +8 -5
  45. package/dist/releaseCatalogCompiler.cjs +1 -1
  46. package/dist/releaseCatalogCompiler.mjs +2 -2
  47. package/dist/releaseCatalogMutation.cjs +0 -292
  48. package/dist/releaseCatalogMutation.d.cts +4 -45
  49. package/dist/releaseCatalogMutation.d.mts +4 -45
  50. package/dist/releaseCatalogMutation.mjs +1 -288
  51. package/dist/releaseManagement.cjs +0 -221
  52. package/dist/releaseManagement.d.cts +4 -28
  53. package/dist/releaseManagement.d.mts +4 -28
  54. package/dist/releaseManagement.mjs +1 -216
  55. package/dist/types/databaseConfig.cjs +5 -0
  56. package/dist/types/databaseConfig.d.cts +33 -0
  57. package/dist/types/databaseConfig.d.mts +33 -0
  58. package/dist/types/databaseConfig.mjs +5 -0
  59. package/dist/types/databaseOperations.d.cts +5 -174
  60. package/dist/types/databaseOperations.d.mts +5 -174
  61. package/dist/types/index.cjs +2 -0
  62. package/dist/types/index.d.cts +8 -73
  63. package/dist/types/index.d.mts +8 -73
  64. package/dist/types/index.mjs +2 -1
  65. package/dist/types/insights.d.cts +172 -0
  66. package/dist/types/insights.d.mts +172 -0
  67. package/dist/types/internal.d.cts +4 -7
  68. package/dist/types/internal.d.mts +4 -7
  69. package/dist/types/models.d.cts +24 -0
  70. package/dist/types/models.d.mts +24 -0
  71. package/dist/types/public.d.cts +4 -2
  72. package/dist/types/public.d.mts +4 -2
  73. package/package.json +1 -1
  74. package/dist/calculatePagination.cjs +0 -25
  75. package/dist/calculatePagination.d.cts +0 -12
  76. package/dist/calculatePagination.d.mts +0 -12
  77. package/dist/calculatePagination.mjs +0 -25
  78. package/dist/createDatabasePlugin.cjs +0 -875
  79. package/dist/createDatabasePlugin.d.cts +0 -28
  80. package/dist/createDatabasePlugin.d.mts +0 -28
  81. package/dist/createDatabasePlugin.mjs +0 -871
  82. package/dist/databaseClient.cjs +0 -117
  83. package/dist/databaseClient.d.cts +0 -32
  84. package/dist/databaseClient.d.mts +0 -32
  85. package/dist/databaseClient.mjs +0 -114
  86. package/dist/databaseClientReads.cjs +0 -115
  87. package/dist/databaseClientReads.mjs +0 -113
  88. package/dist/databaseClientUpdates.cjs +0 -37
  89. package/dist/databaseClientUpdates.d.cts +0 -11
  90. package/dist/databaseClientUpdates.d.mts +0 -11
  91. package/dist/databaseClientUpdates.mjs +0 -35
  92. package/dist/databasePluginCrud.cjs +0 -87
  93. package/dist/databasePluginCrud.d.cts +0 -4
  94. package/dist/databasePluginCrud.d.mts +0 -4
  95. package/dist/databasePluginCrud.mjs +0 -86
  96. package/dist/databasePluginCrudValidation.d.cts +0 -6
  97. package/dist/databasePluginCrudValidation.d.mts +0 -6
  98. package/dist/databasePluginCrudValidationErrors.cjs +0 -11
  99. package/dist/databasePluginCrudValidationErrors.d.cts +0 -9
  100. package/dist/databasePluginCrudValidationErrors.d.mts +0 -9
  101. package/dist/databasePluginCrudValidationErrors.mjs +0 -11
  102. package/dist/databasePluginCrudValidationFields.cjs +0 -284
  103. package/dist/databasePluginCrudValidationFields.d.cts +0 -1
  104. package/dist/databasePluginCrudValidationFields.d.mts +0 -1
  105. package/dist/databasePluginCrudValidationFields.mjs +0 -272
  106. package/dist/databasePluginCrudValidationMutations.cjs +0 -88
  107. package/dist/databasePluginCrudValidationMutations.d.cts +0 -1
  108. package/dist/databasePluginCrudValidationMutations.d.mts +0 -1
  109. package/dist/databasePluginCrudValidationMutations.mjs +0 -82
  110. package/dist/databasePluginCrudValidationQueries.cjs +0 -103
  111. package/dist/databasePluginCrudValidationQueries.d.cts +0 -2
  112. package/dist/databasePluginCrudValidationQueries.d.mts +0 -2
  113. package/dist/databasePluginCrudValidationQueries.mjs +0 -97
  114. package/dist/databasePluginCrudValidationRows.cjs +0 -55
  115. package/dist/databasePluginCrudValidationRows.d.cts +0 -1
  116. package/dist/databasePluginCrudValidationRows.d.mts +0 -1
  117. package/dist/databasePluginCrudValidationRows.mjs +0 -53
  118. package/dist/databasePluginTransaction.cjs +0 -7
  119. package/dist/databasePluginTransaction.mjs +0 -7
  120. package/dist/insightsLatestQueries.cjs +0 -53
  121. package/dist/insightsLatestQueries.d.cts +0 -13
  122. package/dist/insightsLatestQueries.d.mts +0 -13
  123. package/dist/insightsLatestQueries.mjs +0 -52
  124. package/dist/paginateBundles.cjs +0 -53
  125. package/dist/paginateBundles.d.cts +0 -13
  126. package/dist/paginateBundles.d.mts +0 -13
  127. package/dist/paginateBundles.mjs +0 -53
  128. package/dist/queryBundles.cjs +0 -34
  129. package/dist/queryBundles.d.cts +0 -9
  130. package/dist/queryBundles.d.mts +0 -9
  131. package/dist/queryBundles.mjs +0 -32
  132. package/dist/requestBundleCache.cjs +0 -22
  133. package/dist/requestBundleCache.d.cts +0 -8
  134. package/dist/requestBundleCache.d.mts +0 -8
  135. package/dist/requestBundleCache.mjs +0 -22
  136. package/dist/types/database.d.cts +0 -5
  137. package/dist/types/database.d.mts +0 -5
  138. package/dist/types/databaseFields.cjs +0 -85
  139. package/dist/types/databaseFields.d.cts +0 -12
  140. package/dist/types/databaseFields.d.mts +0 -12
  141. package/dist/types/databaseFields.mjs +0 -85
  142. package/dist/types/databasePlugin.d.cts +0 -388
  143. package/dist/types/databasePlugin.d.mts +0 -388
  144. package/dist/types/databaseQuery.d.cts +0 -46
  145. package/dist/types/databaseQuery.d.mts +0 -46
package/dist/index.d.cts CHANGED
@@ -1,33 +1,29 @@
1
- import { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleEventMetadata, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.cjs";
2
- import { ApiKeyModel, BundleModel, BundleModelQuery, BundlePatchModel, BundleRepository, BundleRepositoryChange, BundleRepositoryCommit, ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelModel, DatabaseChange, DatabaseCommit, DatabaseCommitExpectation, DatabaseCommitResult, DatabaseModels, DatabasePlugin, InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseCatalogModel, ReleaseModel, ReleaseReference } from "./types/databasePlugin.cjs";
3
- import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./types/databaseOperations.cjs";
4
- import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./types/utils.cjs";
5
- import { ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, BundleSigningPlugin, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, FingerprintExtraSources, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, Platform, PlatformConfig, SigningConfig, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePlugin, StoragePutInput, StoragePutResult, supportedIosPlatforms } from "./types/index.cjs";
6
- import { PaginationOptions, calculatePagination } from "./calculatePagination.cjs";
7
1
  import { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath, getBundleArchiveStorageUri } from "./bundleStorageLayout.cjs";
8
2
  import { createStorageUriWithRelativePath, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri } from "./assetStorageLayout.cjs";
9
3
  import { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath, isContentAddressedAssetFileHash } from "./contentAddressedAssets.cjs";
10
4
  import { getContentType } from "./contentType.cjs";
11
- import { DatabasePluginInputError, DatabasePluginInputErrorCode } from "./databasePluginCrudValidationErrors.cjs";
12
- import { CreateDatabasePluginOptions, DatabaseAtomicCommitUnsupportedError, createDatabasePlugin } from "./createDatabasePlugin.cjs";
5
+ import { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases } from "./releaseCatalogCompiler.cjs";
6
+ import { ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase } from "./types/databaseConfig.cjs";
7
+ import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./types/utils.cjs";
8
+ import { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleEventMetadata, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.cjs";
9
+ import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./types/databaseOperations.cjs";
10
+ import { InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseReference } from "./types/insights.cjs";
11
+ import { ApiKeyModel, ChannelDeleteResult, ChannelInsertResult } from "./types/models.cjs";
12
+ import { ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, BundleSigningPlugin, ConfigInput, FingerprintExtraSources, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Platform, PlatformConfig, SigningConfig, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePlugin, StoragePutInput, StoragePutResult, supportedIosPlatforms } from "./types/index.cjs";
13
+ import { ReleaseCatalogMutationError, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, ReleaseCatalogScope } from "./releaseCatalogMutation.cjs";
14
+ import { PromoteReleaseResult, ReleaseManagementError, ReleasePolicyPatch } from "./releaseManagement.cjs";
15
+ import { BundleDeployment, BundleDetail, DeployReleasePolicy, Deployment, HotUpdaterCoreApi, KeysetInput, ReleaseFilter, ReleaseTarget, StoredBundleDeployment } from "./coreApi.cjs";
16
+ import { DatabaseBundleNotFoundError, DatabasePluginInputError, DatabasePluginInputErrorCode, DatabaseRowReferencedError } from "./databaseErrors.cjs";
13
17
  import { createStorageKeyBuilder } from "./createStorageKeyBuilder.cjs";
14
18
  import { CreateStoragePluginOptions, StorageOperation, StoragePluginWith, assertStorageOperations, createStoragePlugin } from "./createStoragePlugin.cjs";
15
- import { DatabasePatchUpdateUnsupportedError } from "./databaseClientUpdates.cjs";
16
- import { DatabaseBundleNotFoundError, DatabaseClient, DatabaseMutationClient, DatabasePatchInsertUnsupportedError, createDatabaseClient } from "./databaseClient.cjs";
17
19
  import { isDatabaseBundleEventMetadata, isDatabaseMetadataObject } from "./databaseJsonValue.cjs";
18
20
  import { BundleRowHydrationError, BundleRowHydrationErrorReason, bundleToPatchRows, bundleToRow, releaseRowToRelease, releaseToRow, rowToBundle, rowsToBundles } from "./databaseRows.cjs";
19
21
  import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.cjs";
20
22
  import { generateMinBundleId } from "./generateMinBundleId.cjs";
21
23
  import { compareInsightsText, isInsightsMovementEvent } from "./insightsContract.cjs";
22
24
  import { CreateStorageUriInput, ParsedStorageUri, createStorageUri, parseStorageUri } from "./parseStorageUri.cjs";
23
- import { paginateBundles } from "./paginateBundles.cjs";
24
- import { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles } from "./queryBundles.cjs";
25
- import { createRequestBundleResolver } from "./requestBundleCache.cjs";
26
- import { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases } from "./releaseCatalogCompiler.cjs";
27
- import { ReleaseCatalogMutation, ReleaseCatalogMutationError, ReleaseCatalogMutationInput, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, ReleaseCatalogScope, commitReleaseCatalogMutation, commitReleaseCatalogMutations, preflightReleaseCatalogMutation, preflightReleaseCatalogRebuild, rebuildReleaseCatalog } from "./releaseCatalogMutation.cjs";
28
- import { PromoteReleaseInput, PromoteReleaseResult, ReleaseManagementError, ReleaseMutationTarget, ReleasePolicyPatch, RollbackReleaseInput, deleteRelease, preflightReleasePolicy, promoteRelease, rollbackRelease, rollbackReleases, updateReleasePolicy } from "./releaseManagement.cjs";
29
25
  import { BundleSigningHandlerOptions, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, RemoteSigningOptions, createBundleSigningHandler, remoteSigning } from "./remoteBundleSigning.cjs";
30
26
  import { semverSatisfies } from "./semverSatisfies.cjs";
31
27
  import { createStorageDownloadPath, createStorageDownloadUrl, parseStorageDownloadPath } from "./storageDownloadPath.cjs";
32
28
  import { createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7, isUUIDv7 } from "./uuidv7.cjs";
33
- export { type ApiKeyModel, type ApiKeyRow, ApplePlatform, BUNDLE_STORAGE_PREFIX, BasePluginArgs, BuildPlugin, BuildPluginConfig, BuiltIns, type Bundle, type BundleEventRow, type BundleEventRowBase, type BundleModel, type BundleModelQuery, type BundlePatchModel, type BundlePatchRow, type BundleRepository, type BundleRepositoryChange, type BundleRepositoryCommit, type BundleRow, BundleRowHydrationError, BundleRowHydrationErrorReason, type BundleRowUpdate, BundleSigningHandlerOptions, BundleSigningPlugin, CONTENT_ADDRESSED_ASSET_PREFIX, CatalogVersionBound, type ChannelDeleteInput, type ChannelDeleteResult, type ChannelInsertInput, type ChannelInsertResult, type ChannelModel, type ChannelRow, CompiledCatalogSegment, CompiledReleaseCatalog, ConfigInput, type CreateDatabasePluginOptions, CreateStoragePluginOptions, CreateStorageUriInput, DatabaseAtomicCommitUnsupportedError, DatabaseBundleCursor, type DatabaseBundleEventMetadata, DatabaseBundleIdFilter, type DatabaseBundleMetadata, DatabaseBundleNotFoundError, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, type DatabaseChange, DatabaseClient, type DatabaseCommit, type DatabaseCommitExpectation, type DatabaseCommitResult, type DatabaseJsonObject, type DatabaseJsonValue, type DatabaseModels, DatabaseMutationClient, DatabasePatchInsertUnsupportedError, DatabasePatchUpdateUnsupportedError, type DatabasePlugin, DatabasePluginInputError, type DatabasePluginInputErrorCode, FingerprintExtraSources, HasMultipleCallSignatures, type InsightsBundleEventFilter, type InsightsCountEventsInput, type InsightsCountLatestEventsInput, type InsightsCoverage, type InsightsEventCursor, type InsightsEventFilter, type InsightsFindLatestEventsInput, type InsightsGetAppUsageInput, type InsightsGetAppUsageResult, type InsightsGetReleaseActivityInput, type InsightsGetReleaseActivityResult, type InsightsListEventsInput, type InsightsModel, type InsightsRecordEventInput, type InsightsScope, type InsightsTimeRange, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, type Platform, PlatformConfig, Primitive, PromoteReleaseInput, PromoteReleaseResult, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, type ReleaseActivityMetrics, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, type ReleaseCatalogModel, ReleaseCatalogMutation, ReleaseCatalogMutationError, ReleaseCatalogMutationInput, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, ReleaseCatalogScope, ReleaseManagementError, type ReleaseModel, ReleaseMutationTarget, ReleasePolicyPatch, type ReleaseReference, type ReleaseRow, type ReleaseRowUpdate, RemoteSigningOptions, RequiredDeep, RollbackReleaseInput, SigningConfig, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StorageOperation, StoragePlugin, StoragePluginWith, StoragePutInput, StoragePutResult, assertStorageOperations, bundleIdMatchesFilter, bundleMatchesQueryWhere, bundleToPatchRows, bundleToRow, calculatePagination, canonicalizeAppVersion, commitReleaseCatalogMutation, commitReleaseCatalogMutations, compareInsightsText, compileReleaseCatalog, createBundleSigningHandler, createBundleStorageKey, createDatabaseClient, createDatabasePlugin, createRequestBundleResolver, createStorageDownloadPath, createStorageDownloadUrl, createStorageKeyBuilder, createStoragePlugin, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, deleteRelease, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBundleEventMetadata, isDatabaseMetadataObject, isInsightsMovementEvent, isUUIDv7, paginateBundles, parseStorageDownloadPath, parseStorageUri, preflightReleaseCatalogMutation, preflightReleaseCatalogRebuild, preflightReleasePolicy, projectCompiledCatalog, projectCompiledRollbackCatalog, promoteRelease, rebuildReleaseCatalog, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, remoteSigning, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rollbackRelease, rollbackReleases, rowToBundle, rowsToBundles, semverSatisfies, sortBundles, supportedIosPlatforms, updateReleasePolicy };
29
+ export { type ApiKeyModel, type ApiKeyRow, ApplePlatform, BUNDLE_STORAGE_PREFIX, BasePluginArgs, BuildPlugin, BuildPluginConfig, BuiltIns, type Bundle, type BundleDeployment, type BundleDetail, type BundleEventRow, type BundleEventRowBase, type BundlePatchRow, type BundleRow, BundleRowHydrationError, BundleRowHydrationErrorReason, type BundleRowUpdate, BundleSigningHandlerOptions, BundleSigningPlugin, CONTENT_ADDRESSED_ASSET_PREFIX, CatalogVersionBound, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, CompiledCatalogSegment, CompiledReleaseCatalog, ConfigInput, type ConfiguredDatabase, CreateStoragePluginOptions, CreateStorageUriInput, type DatabaseBundleEventMetadata, type DatabaseBundleMetadata, DatabaseBundleNotFoundError, type DatabaseJsonObject, type DatabaseJsonValue, DatabasePluginInputError, type DatabasePluginInputErrorCode, DatabaseRowReferencedError, type DeployReleasePolicy, type Deployment, type EngineDatabase, FingerprintExtraSources, HasMultipleCallSignatures, type HotUpdaterCoreApi, type InsightsBundleEventFilter, type InsightsCountEventsInput, type InsightsCountLatestEventsInput, type InsightsCoverage, type InsightsEventCursor, type InsightsEventFilter, type InsightsFindLatestEventsInput, type InsightsGetAppUsageInput, type InsightsGetAppUsageResult, type InsightsGetReleaseActivityInput, type InsightsGetReleaseActivityResult, type InsightsListEventsInput, type InsightsModel, type InsightsRecordEventInput, type InsightsScope, type InsightsTimeRange, IosBuildDestination, type KeysetInput, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, ParsedStorageUri, type Platform, PlatformConfig, Primitive, PromoteReleaseResult, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, type ReleaseActivityMetrics, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, ReleaseCatalogMutationError, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, ReleaseCatalogScope, type ReleaseFilter, ReleaseManagementError, ReleasePolicyPatch, type ReleaseReference, type ReleaseRow, type ReleaseRowUpdate, type ReleaseTarget, type RemoteDatabase, RemoteSigningOptions, RequiredDeep, SigningConfig, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StorageOperation, StoragePlugin, StoragePluginWith, StoragePutInput, StoragePutResult, type StoredBundleDeployment, assertStorageOperations, bundleToPatchRows, bundleToRow, canonicalizeAppVersion, compareInsightsText, compileReleaseCatalog, createBundleSigningHandler, createBundleStorageKey, createStorageDownloadPath, createStorageDownloadUrl, createStorageKeyBuilder, createStoragePlugin, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBundleEventMetadata, isDatabaseMetadataObject, isInsightsMovementEvent, isRemoteDatabase, isUUIDv7, parseStorageDownloadPath, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, remoteSigning, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowToBundle, rowsToBundles, semverSatisfies, supportedIosPlatforms };
package/dist/index.d.mts CHANGED
@@ -1,33 +1,29 @@
1
- import { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleEventMetadata, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.mjs";
2
- import { ApiKeyModel, BundleModel, BundleModelQuery, BundlePatchModel, BundleRepository, BundleRepositoryChange, BundleRepositoryCommit, ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelModel, DatabaseChange, DatabaseCommit, DatabaseCommitExpectation, DatabaseCommitResult, DatabaseModels, DatabasePlugin, InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseCatalogModel, ReleaseModel, ReleaseReference } from "./types/databasePlugin.mjs";
3
- import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./types/databaseOperations.mjs";
4
- import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./types/utils.mjs";
5
- import { ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, BundleSigningPlugin, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, FingerprintExtraSources, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, Platform, PlatformConfig, SigningConfig, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePlugin, StoragePutInput, StoragePutResult, supportedIosPlatforms } from "./types/index.mjs";
6
- import { PaginationOptions, calculatePagination } from "./calculatePagination.mjs";
7
1
  import { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath, getBundleArchiveStorageUri } from "./bundleStorageLayout.mjs";
8
2
  import { createStorageUriWithRelativePath, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri } from "./assetStorageLayout.mjs";
9
3
  import { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath, isContentAddressedAssetFileHash } from "./contentAddressedAssets.mjs";
10
4
  import { getContentType } from "./contentType.mjs";
11
- import { DatabasePluginInputError, DatabasePluginInputErrorCode } from "./databasePluginCrudValidationErrors.mjs";
12
- import { CreateDatabasePluginOptions, DatabaseAtomicCommitUnsupportedError, createDatabasePlugin } from "./createDatabasePlugin.mjs";
5
+ import { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases } from "./releaseCatalogCompiler.mjs";
6
+ import { ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase } from "./types/databaseConfig.mjs";
7
+ import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./types/utils.mjs";
8
+ import { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleEventMetadata, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.mjs";
9
+ import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./types/databaseOperations.mjs";
10
+ import { InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseReference } from "./types/insights.mjs";
11
+ import { ApiKeyModel, ChannelDeleteResult, ChannelInsertResult } from "./types/models.mjs";
12
+ import { ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, BundleSigningPlugin, ConfigInput, FingerprintExtraSources, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Platform, PlatformConfig, SigningConfig, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePlugin, StoragePutInput, StoragePutResult, supportedIosPlatforms } from "./types/index.mjs";
13
+ import { ReleaseCatalogMutationError, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, ReleaseCatalogScope } from "./releaseCatalogMutation.mjs";
14
+ import { PromoteReleaseResult, ReleaseManagementError, ReleasePolicyPatch } from "./releaseManagement.mjs";
15
+ import { BundleDeployment, BundleDetail, DeployReleasePolicy, Deployment, HotUpdaterCoreApi, KeysetInput, ReleaseFilter, ReleaseTarget, StoredBundleDeployment } from "./coreApi.mjs";
16
+ import { DatabaseBundleNotFoundError, DatabasePluginInputError, DatabasePluginInputErrorCode, DatabaseRowReferencedError } from "./databaseErrors.mjs";
13
17
  import { createStorageKeyBuilder } from "./createStorageKeyBuilder.mjs";
14
18
  import { CreateStoragePluginOptions, StorageOperation, StoragePluginWith, assertStorageOperations, createStoragePlugin } from "./createStoragePlugin.mjs";
15
- import { DatabasePatchUpdateUnsupportedError } from "./databaseClientUpdates.mjs";
16
- import { DatabaseBundleNotFoundError, DatabaseClient, DatabaseMutationClient, DatabasePatchInsertUnsupportedError, createDatabaseClient } from "./databaseClient.mjs";
17
19
  import { isDatabaseBundleEventMetadata, isDatabaseMetadataObject } from "./databaseJsonValue.mjs";
18
20
  import { BundleRowHydrationError, BundleRowHydrationErrorReason, bundleToPatchRows, bundleToRow, releaseRowToRelease, releaseToRow, rowToBundle, rowsToBundles } from "./databaseRows.mjs";
19
21
  import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.mjs";
20
22
  import { generateMinBundleId } from "./generateMinBundleId.mjs";
21
23
  import { compareInsightsText, isInsightsMovementEvent } from "./insightsContract.mjs";
22
24
  import { CreateStorageUriInput, ParsedStorageUri, createStorageUri, parseStorageUri } from "./parseStorageUri.mjs";
23
- import { paginateBundles } from "./paginateBundles.mjs";
24
- import { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles } from "./queryBundles.mjs";
25
- import { createRequestBundleResolver } from "./requestBundleCache.mjs";
26
- import { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases } from "./releaseCatalogCompiler.mjs";
27
- import { ReleaseCatalogMutation, ReleaseCatalogMutationError, ReleaseCatalogMutationInput, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, ReleaseCatalogScope, commitReleaseCatalogMutation, commitReleaseCatalogMutations, preflightReleaseCatalogMutation, preflightReleaseCatalogRebuild, rebuildReleaseCatalog } from "./releaseCatalogMutation.mjs";
28
- import { PromoteReleaseInput, PromoteReleaseResult, ReleaseManagementError, ReleaseMutationTarget, ReleasePolicyPatch, RollbackReleaseInput, deleteRelease, preflightReleasePolicy, promoteRelease, rollbackRelease, rollbackReleases, updateReleasePolicy } from "./releaseManagement.mjs";
29
25
  import { BundleSigningHandlerOptions, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, RemoteSigningOptions, createBundleSigningHandler, remoteSigning } from "./remoteBundleSigning.mjs";
30
26
  import { semverSatisfies } from "./semverSatisfies.mjs";
31
27
  import { createStorageDownloadPath, createStorageDownloadUrl, parseStorageDownloadPath } from "./storageDownloadPath.mjs";
32
28
  import { createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7, isUUIDv7 } from "./uuidv7.mjs";
33
- export { type ApiKeyModel, type ApiKeyRow, ApplePlatform, BUNDLE_STORAGE_PREFIX, BasePluginArgs, BuildPlugin, BuildPluginConfig, BuiltIns, type Bundle, type BundleEventRow, type BundleEventRowBase, type BundleModel, type BundleModelQuery, type BundlePatchModel, type BundlePatchRow, type BundleRepository, type BundleRepositoryChange, type BundleRepositoryCommit, type BundleRow, BundleRowHydrationError, BundleRowHydrationErrorReason, type BundleRowUpdate, BundleSigningHandlerOptions, BundleSigningPlugin, CONTENT_ADDRESSED_ASSET_PREFIX, CatalogVersionBound, type ChannelDeleteInput, type ChannelDeleteResult, type ChannelInsertInput, type ChannelInsertResult, type ChannelModel, type ChannelRow, CompiledCatalogSegment, CompiledReleaseCatalog, ConfigInput, type CreateDatabasePluginOptions, CreateStoragePluginOptions, CreateStorageUriInput, DatabaseAtomicCommitUnsupportedError, DatabaseBundleCursor, type DatabaseBundleEventMetadata, DatabaseBundleIdFilter, type DatabaseBundleMetadata, DatabaseBundleNotFoundError, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, type DatabaseChange, DatabaseClient, type DatabaseCommit, type DatabaseCommitExpectation, type DatabaseCommitResult, type DatabaseJsonObject, type DatabaseJsonValue, type DatabaseModels, DatabaseMutationClient, DatabasePatchInsertUnsupportedError, DatabasePatchUpdateUnsupportedError, type DatabasePlugin, DatabasePluginInputError, type DatabasePluginInputErrorCode, FingerprintExtraSources, HasMultipleCallSignatures, type InsightsBundleEventFilter, type InsightsCountEventsInput, type InsightsCountLatestEventsInput, type InsightsCoverage, type InsightsEventCursor, type InsightsEventFilter, type InsightsFindLatestEventsInput, type InsightsGetAppUsageInput, type InsightsGetAppUsageResult, type InsightsGetReleaseActivityInput, type InsightsGetReleaseActivityResult, type InsightsListEventsInput, type InsightsModel, type InsightsRecordEventInput, type InsightsScope, type InsightsTimeRange, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, type Platform, PlatformConfig, Primitive, PromoteReleaseInput, PromoteReleaseResult, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, type ReleaseActivityMetrics, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, type ReleaseCatalogModel, ReleaseCatalogMutation, ReleaseCatalogMutationError, ReleaseCatalogMutationInput, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, ReleaseCatalogScope, ReleaseManagementError, type ReleaseModel, ReleaseMutationTarget, ReleasePolicyPatch, type ReleaseReference, type ReleaseRow, type ReleaseRowUpdate, RemoteSigningOptions, RequiredDeep, RollbackReleaseInput, SigningConfig, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StorageOperation, StoragePlugin, StoragePluginWith, StoragePutInput, StoragePutResult, assertStorageOperations, bundleIdMatchesFilter, bundleMatchesQueryWhere, bundleToPatchRows, bundleToRow, calculatePagination, canonicalizeAppVersion, commitReleaseCatalogMutation, commitReleaseCatalogMutations, compareInsightsText, compileReleaseCatalog, createBundleSigningHandler, createBundleStorageKey, createDatabaseClient, createDatabasePlugin, createRequestBundleResolver, createStorageDownloadPath, createStorageDownloadUrl, createStorageKeyBuilder, createStoragePlugin, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, deleteRelease, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBundleEventMetadata, isDatabaseMetadataObject, isInsightsMovementEvent, isUUIDv7, paginateBundles, parseStorageDownloadPath, parseStorageUri, preflightReleaseCatalogMutation, preflightReleaseCatalogRebuild, preflightReleasePolicy, projectCompiledCatalog, projectCompiledRollbackCatalog, promoteRelease, rebuildReleaseCatalog, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, remoteSigning, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rollbackRelease, rollbackReleases, rowToBundle, rowsToBundles, semverSatisfies, sortBundles, supportedIosPlatforms, updateReleasePolicy };
29
+ export { type ApiKeyModel, type ApiKeyRow, ApplePlatform, BUNDLE_STORAGE_PREFIX, BasePluginArgs, BuildPlugin, BuildPluginConfig, BuiltIns, type Bundle, type BundleDeployment, type BundleDetail, type BundleEventRow, type BundleEventRowBase, type BundlePatchRow, type BundleRow, BundleRowHydrationError, BundleRowHydrationErrorReason, type BundleRowUpdate, BundleSigningHandlerOptions, BundleSigningPlugin, CONTENT_ADDRESSED_ASSET_PREFIX, CatalogVersionBound, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, CompiledCatalogSegment, CompiledReleaseCatalog, ConfigInput, type ConfiguredDatabase, CreateStoragePluginOptions, CreateStorageUriInput, type DatabaseBundleEventMetadata, type DatabaseBundleMetadata, DatabaseBundleNotFoundError, type DatabaseJsonObject, type DatabaseJsonValue, DatabasePluginInputError, type DatabasePluginInputErrorCode, DatabaseRowReferencedError, type DeployReleasePolicy, type Deployment, type EngineDatabase, FingerprintExtraSources, HasMultipleCallSignatures, type HotUpdaterCoreApi, type InsightsBundleEventFilter, type InsightsCountEventsInput, type InsightsCountLatestEventsInput, type InsightsCoverage, type InsightsEventCursor, type InsightsEventFilter, type InsightsFindLatestEventsInput, type InsightsGetAppUsageInput, type InsightsGetAppUsageResult, type InsightsGetReleaseActivityInput, type InsightsGetReleaseActivityResult, type InsightsListEventsInput, type InsightsModel, type InsightsRecordEventInput, type InsightsScope, type InsightsTimeRange, IosBuildDestination, type KeysetInput, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, ParsedStorageUri, type Platform, PlatformConfig, Primitive, PromoteReleaseResult, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, type ReleaseActivityMetrics, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, ReleaseCatalogMutationError, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, ReleaseCatalogScope, type ReleaseFilter, ReleaseManagementError, ReleasePolicyPatch, type ReleaseReference, type ReleaseRow, type ReleaseRowUpdate, type ReleaseTarget, type RemoteDatabase, RemoteSigningOptions, RequiredDeep, SigningConfig, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StorageOperation, StoragePlugin, StoragePluginWith, StoragePutInput, StoragePutResult, type StoredBundleDeployment, assertStorageOperations, bundleToPatchRows, bundleToRow, canonicalizeAppVersion, compareInsightsText, compileReleaseCatalog, createBundleSigningHandler, createBundleStorageKey, createStorageDownloadPath, createStorageDownloadUrl, createStorageKeyBuilder, createStoragePlugin, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBundleEventMetadata, isDatabaseMetadataObject, isInsightsMovementEvent, isRemoteDatabase, isUUIDv7, parseStorageDownloadPath, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, remoteSigning, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowToBundle, rowsToBundles, semverSatisfies, supportedIosPlatforms };
package/dist/index.mjs CHANGED
@@ -1,29 +1,23 @@
1
- import { calculatePagination } from "./calculatePagination.mjs";
2
1
  import { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath, isContentAddressedAssetFileHash } from "./contentAddressedAssets.mjs";
3
2
  import { createStorageKeyBuilder } from "./createStorageKeyBuilder.mjs";
4
3
  import { createStorageUri, parseStorageUri } from "./parseStorageUri.mjs";
5
4
  import { createStorageUriWithRelativePath, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri } from "./assetStorageLayout.mjs";
6
5
  import { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath, getBundleArchiveStorageUri } from "./bundleStorageLayout.mjs";
7
6
  import { getContentType } from "./contentType.mjs";
8
- import { DatabasePluginInputError } from "./databasePluginCrudValidationErrors.mjs";
9
- import { isDatabaseBundleEventMetadata, isDatabaseMetadataObject } from "./databaseJsonValue.mjs";
10
- import { createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7, isUUIDv7 } from "./uuidv7.mjs";
11
- import { compareInsightsText, isInsightsMovementEvent } from "./insightsContract.mjs";
12
- import { DatabaseAtomicCommitUnsupportedError, createDatabasePlugin } from "./createDatabasePlugin.mjs";
7
+ import { DatabaseBundleNotFoundError, DatabasePluginInputError, DatabaseRowReferencedError } from "./databaseErrors.mjs";
13
8
  import { assertStorageOperations, createStoragePlugin } from "./createStoragePlugin.mjs";
9
+ import { isDatabaseBundleEventMetadata, isDatabaseMetadataObject } from "./databaseJsonValue.mjs";
14
10
  import { BundleRowHydrationError, BundleRowHydrationErrorReason, bundleToPatchRows, bundleToRow, releaseRowToRelease, releaseToRow, rowToBundle, rowsToBundles } from "./databaseRows.mjs";
15
- import { DatabasePatchUpdateUnsupportedError } from "./databaseClientUpdates.mjs";
16
- import { DatabaseBundleNotFoundError, DatabasePatchInsertUnsupportedError, createDatabaseClient } from "./databaseClient.mjs";
17
11
  import { semverSatisfies } from "./semverSatisfies.mjs";
18
12
  import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.mjs";
19
13
  import { generateMinBundleId } from "./generateMinBundleId.mjs";
20
- import { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles } from "./queryBundles.mjs";
21
- import { paginateBundles } from "./paginateBundles.mjs";
22
- import { createRequestBundleResolver } from "./requestBundleCache.mjs";
14
+ import { createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7, isUUIDv7 } from "./uuidv7.mjs";
15
+ import { compareInsightsText, isInsightsMovementEvent } from "./insightsContract.mjs";
23
16
  import { ReleaseCatalogCompilationError, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases } from "./releaseCatalogCompiler.mjs";
24
- import { ReleaseCatalogMutationError, commitReleaseCatalogMutation, commitReleaseCatalogMutations, preflightReleaseCatalogMutation, preflightReleaseCatalogRebuild, rebuildReleaseCatalog } from "./releaseCatalogMutation.mjs";
25
- import { ReleaseManagementError, deleteRelease, preflightReleasePolicy, promoteRelease, rollbackRelease, rollbackReleases, updateReleasePolicy } from "./releaseManagement.mjs";
17
+ import { ReleaseManagementError } from "./releaseManagement.mjs";
18
+ import { ReleaseCatalogMutationError } from "./releaseCatalogMutation.mjs";
26
19
  import { REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, createBundleSigningHandler, remoteSigning } from "./remoteBundleSigning.mjs";
27
20
  import { createStorageDownloadPath, createStorageDownloadUrl, parseStorageDownloadPath } from "./storageDownloadPath.mjs";
21
+ import { isRemoteDatabase } from "./types/databaseConfig.mjs";
28
22
  import { supportedIosPlatforms } from "./types/index.mjs";
29
- export { BUNDLE_STORAGE_PREFIX, BundleRowHydrationError, BundleRowHydrationErrorReason, CONTENT_ADDRESSED_ASSET_PREFIX, DatabaseAtomicCommitUnsupportedError, DatabaseBundleNotFoundError, DatabasePatchInsertUnsupportedError, DatabasePatchUpdateUnsupportedError, DatabasePluginInputError, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, ReleaseCatalogCompilationError, ReleaseCatalogMutationError, ReleaseManagementError, assertStorageOperations, bundleIdMatchesFilter, bundleMatchesQueryWhere, bundleToPatchRows, bundleToRow, calculatePagination, canonicalizeAppVersion, commitReleaseCatalogMutation, commitReleaseCatalogMutations, compareInsightsText, compileReleaseCatalog, createBundleSigningHandler, createBundleStorageKey, createDatabaseClient, createDatabasePlugin, createRequestBundleResolver, createStorageDownloadPath, createStorageDownloadUrl, createStorageKeyBuilder, createStoragePlugin, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, deleteRelease, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBundleEventMetadata, isDatabaseMetadataObject, isInsightsMovementEvent, isUUIDv7, paginateBundles, parseStorageDownloadPath, parseStorageUri, preflightReleaseCatalogMutation, preflightReleaseCatalogRebuild, preflightReleasePolicy, projectCompiledCatalog, projectCompiledRollbackCatalog, promoteRelease, rebuildReleaseCatalog, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, remoteSigning, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rollbackRelease, rollbackReleases, rowToBundle, rowsToBundles, semverSatisfies, sortBundles, supportedIosPlatforms, updateReleasePolicy };
23
+ export { BUNDLE_STORAGE_PREFIX, BundleRowHydrationError, BundleRowHydrationErrorReason, CONTENT_ADDRESSED_ASSET_PREFIX, DatabaseBundleNotFoundError, DatabasePluginInputError, DatabaseRowReferencedError, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, ReleaseCatalogCompilationError, ReleaseCatalogMutationError, ReleaseManagementError, assertStorageOperations, bundleToPatchRows, bundleToRow, canonicalizeAppVersion, compareInsightsText, compileReleaseCatalog, createBundleSigningHandler, createBundleStorageKey, createStorageDownloadPath, createStorageDownloadUrl, createStorageKeyBuilder, createStoragePlugin, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBundleEventMetadata, isDatabaseMetadataObject, isInsightsMovementEvent, isRemoteDatabase, isUUIDv7, parseStorageDownloadPath, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, remoteSigning, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowToBundle, rowsToBundles, semverSatisfies, supportedIosPlatforms };
@@ -1,6 +1,5 @@
1
- const require_databasePluginCrudValidationErrors = require("./databasePluginCrudValidationErrors.cjs");
2
- const require_databasePluginCrudValidationFields = require("./databasePluginCrudValidationFields.cjs");
3
- const require_databasePluginCrudValidationRows = require("./databasePluginCrudValidationRows.cjs");
1
+ const require_databaseErrors = require("./databaseErrors.cjs");
2
+ const require_bundleEventRow = require("./bundleEventRow.cjs");
4
3
  let _hot_updater_core = require("@hot-updater/core");
5
4
  //#region src/insightsContract.ts
6
5
  const encoder = new TextEncoder();
@@ -25,7 +24,7 @@ const isLimit = (value) => isTimestamp(value) && value >= 1 && value <= 101;
25
24
  const hasOnlyKeys = (value, keys) => Object.keys(value).every((key) => keys.includes(key));
26
25
  const hasScope = (value) => (value.platform === "ios" || value.platform === "android") && isText(value.channel);
27
26
  const isBundleFilter = (value, withKind = false) => {
28
- if (!require_databasePluginCrudValidationFields.isRecord(value) || !hasScope(value)) return false;
27
+ if (!require_bundleEventRow.isRecord(value) || !hasScope(value)) return false;
29
28
  const keys = [
30
29
  "platform",
31
30
  "channel",
@@ -35,20 +34,22 @@ const isBundleFilter = (value, withKind = false) => {
35
34
  return value.type === "RECOVERED" ? isText(value.fromBundleId) && hasOnlyKeys(value, [...keys, "fromBundleId"]) : (value.type === "UPDATE_DOWNLOADED" || value.type === "UPDATE_APPLIED" || value.type === "UNCHANGED") && isText(value.toBundleId) && hasOnlyKeys(value, [...keys, "toBundleId"]);
36
35
  };
37
36
  const isEventFilter = (value) => {
38
- if (!require_databasePluginCrudValidationFields.isRecord(value)) return false;
37
+ if (!require_bundleEventRow.isRecord(value)) return false;
39
38
  if (value.kind === "all") return hasOnlyKeys(value, ["kind"]);
40
39
  if (value.kind === "installationMovement") return isIdentity(value.installId) && hasOnlyKeys(value, ["kind", "installId"]);
41
40
  return value.kind === "bundle" && isBundleFilter(value, true);
42
41
  };
43
42
  const validateRow = (model, row, result = false) => {
44
43
  try {
45
- require_databasePluginCrudValidationRows.validateCreateData(model, row);
46
- if (!require_databasePluginCrudValidationFields.isRecord(row) || typeof row.id !== "string" || !(0, _hot_updater_core.isUUIDv7)(row.id) || [...Object.values(row), ...require_databasePluginCrudValidationFields.isRecord(row.metadata) ? Object.values(row.metadata) : []].some((value) => typeof value === "string" && !isWellFormedText(value))) throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-data");
44
+ require_bundleEventRow.validateBundleEventFields(row);
45
+ if (!require_bundleEventRow.isRecord(row) || typeof row.id !== "string" || !(0, _hot_updater_core.isUUIDv7)(row.id) || [...Object.values(row), ...require_bundleEventRow.isRecord(row.metadata) ? Object.values(row.metadata) : []].some((value) => typeof value === "string" && !isWellFormedText(value))) throw new require_databaseErrors.DatabasePluginInputError("invalid-data");
47
46
  } catch (error) {
48
- if (result) throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-result");
47
+ if (result) throw new require_databaseErrors.DatabasePluginInputError("invalid-result");
49
48
  throw error;
50
49
  }
51
50
  };
51
+ /** Throws `invalid-data` unless `row` is a complete, well-formed bundle event row. */
52
+ const assertBundleEventRow = (row) => validateRow("bundle_events", row);
52
53
  /** Downloads and applied transitions belong in installation history. */
53
54
  const isInsightsMovementEvent = (event) => event.type === "UPDATE_DOWNLOADED" || event.type === "UPDATE_APPLIED" || event.type === "RECOVERED";
54
55
  const matchesInsightsEventFilter = (event, filter) => {
@@ -57,33 +58,33 @@ const matchesInsightsEventFilter = (event, filter) => {
57
58
  return event.type === filter.type && event.platform === filter.platform && event.channel === filter.channel && (filter.type === "RECOVERED" ? event.from_bundle_id === filter.fromBundleId : event.to_bundle_id === filter.toBundleId);
58
59
  };
59
60
  const invalidQuery = () => {
60
- throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-query");
61
+ throw new require_databaseErrors.DatabasePluginInputError("invalid-query");
61
62
  };
62
63
  const invalidResult = () => {
63
- throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-result");
64
+ throw new require_databaseErrors.DatabasePluginInputError("invalid-result");
64
65
  };
65
66
  const validateCount = (count) => isTimestamp(count) ? count : invalidResult();
66
- const isTimeRange = (value) => require_databasePluginCrudValidationFields.isRecord(value) && hasOnlyKeys(value, ["start", "end"]) && isTimestamp(value.start) && isTimestamp(value.end) && value.start < value.end;
67
- const isReleaseReference = (value) => require_databasePluginCrudValidationFields.isRecord(value) && hasOnlyKeys(value, [
67
+ const isTimeRange = (value) => require_bundleEventRow.isRecord(value) && hasOnlyKeys(value, ["start", "end"]) && isTimestamp(value.start) && isTimestamp(value.end) && value.start < value.end;
68
+ const isReleaseReference = (value) => require_bundleEventRow.isRecord(value) && hasOnlyKeys(value, [
68
69
  "releaseId",
69
70
  "platform",
70
71
  "channel"
71
72
  ]) && isIdentity(value.releaseId) && hasScope(value);
72
73
  const validateAggregateResult = (value) => {
73
- const result = require_databasePluginCrudValidationFields.isRecord(value) ? value : invalidResult();
74
+ const result = require_bundleEventRow.isRecord(value) ? value : invalidResult();
74
75
  if (!isTimestamp(result.measuredAtMs)) invalidResult();
75
76
  const coverage = result.coverage;
76
- if (!require_databasePluginCrudValidationFields.isRecord(coverage) || coverage.kind !== "complete" && coverage.kind !== "partial" || coverage.sinceMs !== null && !isTimestamp(coverage.sinceMs)) invalidResult();
77
+ if (!require_bundleEventRow.isRecord(coverage) || coverage.kind !== "complete" && coverage.kind !== "partial" || coverage.sinceMs !== null && !isTimestamp(coverage.sinceMs)) invalidResult();
77
78
  };
78
79
  /** Validate custom and bundled providers at the same public boundary. */
79
80
  const createValidatedInsightsModel = (model) => ({
80
81
  async recordEvent(input) {
81
- if (!require_databasePluginCrudValidationFields.isRecord(input) || !hasOnlyKeys(input, ["event"])) throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-data");
82
+ if (!require_bundleEventRow.isRecord(input) || !hasOnlyKeys(input, ["event"])) throw new require_databaseErrors.DatabasePluginInputError("invalid-data");
82
83
  validateRow("bundle_events", input.event);
83
84
  await model.recordEvent(input);
84
85
  },
85
86
  async listEvents(input) {
86
- if (!require_databasePluginCrudValidationFields.isRecord(input) || !hasOnlyKeys(input, [
87
+ if (!require_bundleEventRow.isRecord(input) || !hasOnlyKeys(input, [
87
88
  "filter",
88
89
  "sinceMs",
89
90
  "beforeReceivedAtMs",
@@ -91,7 +92,7 @@ const createValidatedInsightsModel = (model) => ({
91
92
  "limit"
92
93
  ]) || !isEventFilter(input.filter) || !isLimit(input.limit) || !isTimestamp(input.beforeReceivedAtMs) || input.sinceMs !== void 0 && !isTimestamp(input.sinceMs)) invalidQuery();
93
94
  const sinceMs = input.sinceMs ?? 0;
94
- if (sinceMs > input.beforeReceivedAtMs || input.after !== void 0 && (!require_databasePluginCrudValidationFields.isRecord(input.after) || !hasOnlyKeys(input.after, ["receivedAtMs", "id"]) || !isTimestamp(input.after.receivedAtMs) || typeof input.after.id !== "string" || !(0, _hot_updater_core.isUUIDv7)(input.after.id) || input.after.receivedAtMs < sinceMs || input.after.receivedAtMs >= input.beforeReceivedAtMs)) invalidQuery();
95
+ if (sinceMs > input.beforeReceivedAtMs || input.after !== void 0 && (!require_bundleEventRow.isRecord(input.after) || !hasOnlyKeys(input.after, ["receivedAtMs", "id"]) || !isTimestamp(input.after.receivedAtMs) || typeof input.after.id !== "string" || !(0, _hot_updater_core.isUUIDv7)(input.after.id) || input.after.receivedAtMs < sinceMs || input.after.receivedAtMs >= input.beforeReceivedAtMs)) invalidQuery();
95
96
  const rows = await model.listEvents(input);
96
97
  if (!Array.isArray(rows) || rows.length > input.limit) invalidResult();
97
98
  let previous = input.after;
@@ -106,7 +107,7 @@ const createValidatedInsightsModel = (model) => ({
106
107
  return rows;
107
108
  },
108
109
  async findLatestEvents(input) {
109
- if (!require_databasePluginCrudValidationFields.isRecord(input)) invalidQuery();
110
+ if (!require_bundleEventRow.isRecord(input)) invalidQuery();
110
111
  if ("installId" in input) {
111
112
  if (!hasOnlyKeys(input, ["installId"]) || !isIdentity(input.installId)) invalidQuery();
112
113
  } else if (!hasOnlyKeys(input, [
@@ -125,12 +126,12 @@ const createValidatedInsightsModel = (model) => ({
125
126
  return rows;
126
127
  },
127
128
  async countLatestEvents(input) {
128
- if (!require_databasePluginCrudValidationFields.isRecord(input) || !hasOnlyKeys(input, [
129
+ if (!require_bundleEventRow.isRecord(input) || !hasOnlyKeys(input, [
129
130
  "platform",
130
131
  "channel",
131
132
  "sinceMs",
132
133
  "bundle"
133
- ]) || !hasScope(input) || !isTimestamp(input.sinceMs) || input.bundle !== void 0 && (!Array.isArray(input.bundle) || input.bundle.length < 1 || input.bundle.length > 2 || input.bundle.some((bundle) => !require_databasePluginCrudValidationFields.isRecord(bundle) || !hasOnlyKeys(bundle, [
134
+ ]) || !hasScope(input) || !isTimestamp(input.sinceMs) || input.bundle !== void 0 && (!Array.isArray(input.bundle) || input.bundle.length < 1 || input.bundle.length > 2 || input.bundle.some((bundle) => !require_bundleEventRow.isRecord(bundle) || !hasOnlyKeys(bundle, [
134
135
  "field",
135
136
  "value",
136
137
  "types"
@@ -143,7 +144,7 @@ const createValidatedInsightsModel = (model) => ({
143
144
  return validateCount(await model.countLatestEvents(input));
144
145
  },
145
146
  async countEvents(input) {
146
- if (!require_databasePluginCrudValidationFields.isRecord(input) || !hasOnlyKeys(input, [
147
+ if (!require_bundleEventRow.isRecord(input) || !hasOnlyKeys(input, [
147
148
  "filter",
148
149
  "sinceMs",
149
150
  "beforeReceivedAtMs"
@@ -151,7 +152,7 @@ const createValidatedInsightsModel = (model) => ({
151
152
  return validateCount(await model.countEvents(input));
152
153
  },
153
154
  async getReleaseActivity(input) {
154
- if (!require_databasePluginCrudValidationFields.isRecord(input) || !hasOnlyKeys(input, [
155
+ if (!require_bundleEventRow.isRecord(input) || !hasOnlyKeys(input, [
155
156
  "releases",
156
157
  "scope",
157
158
  "timeRange"
@@ -160,7 +161,7 @@ const createValidatedInsightsModel = (model) => ({
160
161
  const scope = input.scope;
161
162
  const timeRange = input.timeRange;
162
163
  const releaseQuery = Array.isArray(releases) && releases.length > 0 && releases.length <= 100 && releases.every(isReleaseReference) && scope === void 0 && (timeRange === void 0 || isTimeRange(timeRange));
163
- const scopeQuery = releases === void 0 && require_databasePluginCrudValidationFields.isRecord(scope) && hasOnlyKeys(scope, ["platform", "channel"]) && hasScope(scope) && isTimeRange(timeRange);
164
+ const scopeQuery = releases === void 0 && require_bundleEventRow.isRecord(scope) && hasOnlyKeys(scope, ["platform", "channel"]) && hasScope(scope) && isTimeRange(timeRange);
164
165
  if (!releaseQuery && !scopeQuery) invalidQuery();
165
166
  const result = await model.getReleaseActivity(input);
166
167
  validateAggregateResult(result);
@@ -168,7 +169,7 @@ const createValidatedInsightsModel = (model) => ({
168
169
  return result;
169
170
  },
170
171
  async getAppUsage(input) {
171
- if (!require_databasePluginCrudValidationFields.isRecord(input) || !hasOnlyKeys(input, [
172
+ if (!require_bundleEventRow.isRecord(input) || !hasOnlyKeys(input, [
172
173
  "channel",
173
174
  "platform",
174
175
  "appVersion",
@@ -186,6 +187,7 @@ const createValidatedInsightsModel = (model) => ({
186
187
  }
187
188
  });
188
189
  //#endregion
190
+ exports.assertBundleEventRow = assertBundleEventRow;
189
191
  exports.compareInsightsText = compareInsightsText;
190
192
  exports.createValidatedInsightsModel = createValidatedInsightsModel;
191
193
  exports.isInsightsMovementEvent = isInsightsMovementEvent;
@@ -1,9 +1,14 @@
1
1
  import { BundleEventRow } from "./types/databaseRows.cjs";
2
+ import { InsightsModel } from "./types/insights.cjs";
2
3
  import "./types/index.cjs";
3
4
  //#region src/insightsContract.d.ts
4
5
  /** Exact UTF-8 byte ordering, without case folding or Unicode normalization. */
5
6
  declare const compareInsightsText: (left: string, right: string) => number;
7
+ /** Throws `invalid-data` unless `row` is a complete, well-formed bundle event row. */
8
+ declare const assertBundleEventRow: (row: unknown) => void;
6
9
  /** Downloads and applied transitions belong in installation history. */
7
10
  declare const isInsightsMovementEvent: (event: Pick<BundleEventRow, "type">) => boolean;
11
+ /** Validate custom and bundled providers at the same public boundary. */
12
+ declare const createValidatedInsightsModel: (model: InsightsModel) => InsightsModel;
8
13
  //#endregion
9
- export { compareInsightsText, isInsightsMovementEvent };
14
+ export { assertBundleEventRow, compareInsightsText, createValidatedInsightsModel, isInsightsMovementEvent };
@@ -1,9 +1,14 @@
1
1
  import { BundleEventRow } from "./types/databaseRows.mjs";
2
+ import { InsightsModel } from "./types/insights.mjs";
2
3
  import "./types/index.mjs";
3
4
  //#region src/insightsContract.d.ts
4
5
  /** Exact UTF-8 byte ordering, without case folding or Unicode normalization. */
5
6
  declare const compareInsightsText: (left: string, right: string) => number;
7
+ /** Throws `invalid-data` unless `row` is a complete, well-formed bundle event row. */
8
+ declare const assertBundleEventRow: (row: unknown) => void;
6
9
  /** Downloads and applied transitions belong in installation history. */
7
10
  declare const isInsightsMovementEvent: (event: Pick<BundleEventRow, "type">) => boolean;
11
+ /** Validate custom and bundled providers at the same public boundary. */
12
+ declare const createValidatedInsightsModel: (model: InsightsModel) => InsightsModel;
8
13
  //#endregion
9
- export { compareInsightsText, isInsightsMovementEvent };
14
+ export { assertBundleEventRow, compareInsightsText, createValidatedInsightsModel, isInsightsMovementEvent };
@@ -1,7 +1,6 @@
1
- import { DatabasePluginInputError } from "./databasePluginCrudValidationErrors.mjs";
1
+ import { DatabasePluginInputError } from "./databaseErrors.mjs";
2
+ import { isRecord, validateBundleEventFields } from "./bundleEventRow.mjs";
2
3
  import { isUUIDv7 } from "./uuidv7.mjs";
3
- import { isRecord } from "./databasePluginCrudValidationFields.mjs";
4
- import { validateCreateData } from "./databasePluginCrudValidationRows.mjs";
5
4
  //#region src/insightsContract.ts
6
5
  const encoder = new TextEncoder();
7
6
  /** Exact UTF-8 byte ordering, without case folding or Unicode normalization. */
@@ -42,13 +41,15 @@ const isEventFilter = (value) => {
42
41
  };
43
42
  const validateRow = (model, row, result = false) => {
44
43
  try {
45
- validateCreateData(model, row);
44
+ validateBundleEventFields(row);
46
45
  if (!isRecord(row) || typeof row.id !== "string" || !isUUIDv7(row.id) || [...Object.values(row), ...isRecord(row.metadata) ? Object.values(row.metadata) : []].some((value) => typeof value === "string" && !isWellFormedText(value))) throw new DatabasePluginInputError("invalid-data");
47
46
  } catch (error) {
48
47
  if (result) throw new DatabasePluginInputError("invalid-result");
49
48
  throw error;
50
49
  }
51
50
  };
51
+ /** Throws `invalid-data` unless `row` is a complete, well-formed bundle event row. */
52
+ const assertBundleEventRow = (row) => validateRow("bundle_events", row);
52
53
  /** Downloads and applied transitions belong in installation history. */
53
54
  const isInsightsMovementEvent = (event) => event.type === "UPDATE_DOWNLOADED" || event.type === "UPDATE_APPLIED" || event.type === "RECOVERED";
54
55
  const matchesInsightsEventFilter = (event, filter) => {
@@ -186,4 +187,4 @@ const createValidatedInsightsModel = (model) => ({
186
187
  }
187
188
  });
188
189
  //#endregion
189
- export { compareInsightsText, createValidatedInsightsModel, isInsightsMovementEvent, matchesInsightsEventFilter };
190
+ export { assertBundleEventRow, compareInsightsText, createValidatedInsightsModel, isInsightsMovementEvent, matchesInsightsEventFilter };
@@ -60,7 +60,8 @@ const countInsightsDistinct = (summary) => {
60
60
  inverseSum += 2 ** -register;
61
61
  if (register === 0) empty += 1;
62
62
  }
63
- const estimate = empty > 0 ? REGISTER_COUNT * Math.log(REGISTER_COUNT / empty) : .7213 / 1.0010537109375 * REGISTER_COUNT ** 2 / inverseSum;
63
+ const raw = .7213 / 1.0010537109375 * REGISTER_COUNT ** 2 / inverseSum;
64
+ const estimate = raw <= 2.5 * REGISTER_COUNT && empty > 0 ? REGISTER_COUNT * Math.log(REGISTER_COUNT / empty) : raw;
64
65
  return Math.max(0, Math.round(estimate));
65
66
  };
66
67
  const emptyInsightsDistinct = () => encode(new Uint8Array(REGISTER_COUNT));
@@ -60,7 +60,8 @@ const countInsightsDistinct = (summary) => {
60
60
  inverseSum += 2 ** -register;
61
61
  if (register === 0) empty += 1;
62
62
  }
63
- const estimate = empty > 0 ? REGISTER_COUNT * Math.log(REGISTER_COUNT / empty) : .7213 / 1.0010537109375 * REGISTER_COUNT ** 2 / inverseSum;
63
+ const raw = .7213 / 1.0010537109375 * REGISTER_COUNT ** 2 / inverseSum;
64
+ const estimate = raw <= 2.5 * REGISTER_COUNT && empty > 0 ? REGISTER_COUNT * Math.log(REGISTER_COUNT / empty) : raw;
64
65
  return Math.max(0, Math.round(estimate));
65
66
  };
66
67
  const emptyInsightsDistinct = () => encode(new Uint8Array(REGISTER_COUNT));
@@ -18,10 +18,9 @@ const fnv = (value, seed) => {
18
18
  }
19
19
  return result.toString(16).padStart(16, "0");
20
20
  };
21
- const insightsOverviewId = (identity) => {
22
- const value = encodeIdentity(identity);
23
- return `${fnv(value, 14695981039346656037n)}${fnv(value, 9521211207457086692n)}`;
24
- };
21
+ /** A 128-bit hex key for a string: two FNV-1a 64 hashes with different seeds. */
22
+ const insightsKey = (value) => `${fnv(value, 14695981039346656037n)}${fnv(value, 9521211207457086692n)}`;
23
+ const insightsOverviewId = (identity) => insightsKey(encodeIdentity(identity));
25
24
  const insightsOverviewValues = (identity) => ({
26
25
  id: insightsOverviewId(identity),
27
26
  scope_kind: identity.scopeKind,
@@ -134,6 +133,7 @@ const insightsOverviewDeltas = (event) => {
134
133
  //#endregion
135
134
  exports.currentInsightsReleaseId = currentInsightsReleaseId;
136
135
  exports.insightsDistributionIdentity = insightsDistributionIdentity;
136
+ exports.insightsKey = insightsKey;
137
137
  exports.insightsOverviewDeltas = insightsOverviewDeltas;
138
138
  exports.insightsOverviewId = insightsOverviewId;
139
139
  exports.insightsOverviewValues = insightsOverviewValues;
@@ -20,6 +20,8 @@ type InsightsOverviewDelta = {
20
20
  readonly launchIdentity?: string;
21
21
  readonly activityIdentity?: string;
22
22
  };
23
+ /** A 128-bit hex key for a string: two FNV-1a 64 hashes with different seeds. */
24
+ declare const insightsKey: (value: string) => string;
23
25
  declare const insightsOverviewId: (identity: InsightsOverviewIdentity) => string;
24
26
  declare const insightsOverviewValues: (identity: InsightsOverviewIdentity) => {
25
27
  id: string;
@@ -37,4 +39,4 @@ declare const currentInsightsReleaseId: (event: BundleEventRow) => string | null
37
39
  declare const insightsDistributionIdentity: (event: BundleEventRow) => InsightsOverviewIdentity;
38
40
  declare const insightsOverviewDeltas: (event: BundleEventRow) => readonly InsightsOverviewDelta[];
39
41
  //#endregion
40
- export { InsightsOverviewDelta, InsightsOverviewIdentity, currentInsightsReleaseId, insightsDistributionIdentity, insightsOverviewDeltas, insightsOverviewId, insightsOverviewValues };
42
+ export { InsightsOverviewDelta, InsightsOverviewIdentity, currentInsightsReleaseId, insightsDistributionIdentity, insightsKey, insightsOverviewDeltas, insightsOverviewId, insightsOverviewValues };
@@ -20,6 +20,8 @@ type InsightsOverviewDelta = {
20
20
  readonly launchIdentity?: string;
21
21
  readonly activityIdentity?: string;
22
22
  };
23
+ /** A 128-bit hex key for a string: two FNV-1a 64 hashes with different seeds. */
24
+ declare const insightsKey: (value: string) => string;
23
25
  declare const insightsOverviewId: (identity: InsightsOverviewIdentity) => string;
24
26
  declare const insightsOverviewValues: (identity: InsightsOverviewIdentity) => {
25
27
  id: string;
@@ -37,4 +39,4 @@ declare const currentInsightsReleaseId: (event: BundleEventRow) => string | null
37
39
  declare const insightsDistributionIdentity: (event: BundleEventRow) => InsightsOverviewIdentity;
38
40
  declare const insightsOverviewDeltas: (event: BundleEventRow) => readonly InsightsOverviewDelta[];
39
41
  //#endregion
40
- export { InsightsOverviewDelta, InsightsOverviewIdentity, currentInsightsReleaseId, insightsDistributionIdentity, insightsOverviewDeltas, insightsOverviewId, insightsOverviewValues };
42
+ export { InsightsOverviewDelta, InsightsOverviewIdentity, currentInsightsReleaseId, insightsDistributionIdentity, insightsKey, insightsOverviewDeltas, insightsOverviewId, insightsOverviewValues };
@@ -18,10 +18,9 @@ const fnv = (value, seed) => {
18
18
  }
19
19
  return result.toString(16).padStart(16, "0");
20
20
  };
21
- const insightsOverviewId = (identity) => {
22
- const value = encodeIdentity(identity);
23
- return `${fnv(value, 14695981039346656037n)}${fnv(value, 9521211207457086692n)}`;
24
- };
21
+ /** A 128-bit hex key for a string: two FNV-1a 64 hashes with different seeds. */
22
+ const insightsKey = (value) => `${fnv(value, 14695981039346656037n)}${fnv(value, 9521211207457086692n)}`;
23
+ const insightsOverviewId = (identity) => insightsKey(encodeIdentity(identity));
25
24
  const insightsOverviewValues = (identity) => ({
26
25
  id: insightsOverviewId(identity),
27
26
  scope_kind: identity.scopeKind,
@@ -132,4 +131,4 @@ const insightsOverviewDeltas = (event) => {
132
131
  return [...counters.values()];
133
132
  };
134
133
  //#endregion
135
- export { currentInsightsReleaseId, insightsDistributionIdentity, insightsOverviewDeltas, insightsOverviewId, insightsOverviewValues };
134
+ export { currentInsightsReleaseId, insightsDistributionIdentity, insightsKey, insightsOverviewDeltas, insightsOverviewId, insightsOverviewValues };
package/dist/internal.cjs CHANGED
@@ -1,21 +1,45 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_databaseFields = require("./types/databaseFields.cjs");
3
- const require_createDatabasePlugin = require("./createDatabasePlugin.cjs");
4
- const require_insightsLatestQueries = require("./insightsLatestQueries.cjs");
2
+ const require_databaseErrors = require("./databaseErrors.cjs");
3
+ const require_insightsContract = require("./insightsContract.cjs");
5
4
  const require_insightsDistinctSummary = require("./insightsDistinctSummary.cjs");
6
5
  const require_insightsOverview = require("./insightsOverview.cjs");
7
- exports.DatabaseRowReferencedError = require_createDatabasePlugin.DatabaseRowReferencedError;
6
+ const require_adapter = require("./database/adapter.cjs");
7
+ const require_values = require("./database/values.cjs");
8
+ const require_memoryAdapter = require("./database/memoryAdapter.cjs");
9
+ const require_verifyAdapter = require("./database/verifyAdapter.cjs");
10
+ exports.DATABASE_MAX_MULTI_VALUES = require_adapter.DATABASE_MAX_MULTI_VALUES;
11
+ exports.DATABASE_MAX_QUERY_LIMIT = require_adapter.DATABASE_MAX_QUERY_LIMIT;
12
+ exports.DATABASE_VERSION_COLUMN = require_adapter.DATABASE_VERSION_COLUMN;
13
+ exports.DatabaseAdapterContractError = require_verifyAdapter.DatabaseAdapterContractError;
14
+ exports.DatabaseRowReferencedError = require_databaseErrors.DatabaseRowReferencedError;
15
+ exports.DatabaseSchemaError = require_adapter.DatabaseSchemaError;
16
+ exports.DatabaseValueError = require_values.DatabaseValueError;
8
17
  exports.addInsightsDistinct = require_insightsDistinctSummary.addInsightsDistinct;
18
+ exports.assertBundleEventRow = require_insightsContract.assertBundleEventRow;
19
+ exports.canonicalJson = require_values.canonicalJson;
20
+ exports.compareKeyValues = require_values.compareKeyValues;
21
+ exports.compareTuples = require_values.compareTuples;
22
+ exports.compareUtf8 = require_values.compareUtf8;
9
23
  exports.countInsightsDistinct = require_insightsDistinctSummary.countInsightsDistinct;
10
- exports.createDatabasePluginAdapter = require_createDatabasePlugin.createDatabasePluginAdapter;
24
+ exports.createMemoryAdapter = require_memoryAdapter.createMemoryAdapter;
25
+ exports.createValidatedInsightsModel = require_insightsContract.createValidatedInsightsModel;
11
26
  exports.currentInsightsReleaseId = require_insightsOverview.currentInsightsReleaseId;
12
- exports.databaseFields = require_databaseFields.databaseFields;
13
27
  exports.emptyInsightsDistinct = require_insightsDistinctSummary.emptyInsightsDistinct;
28
+ exports.findPhysicalColumn = require_adapter.findPhysicalColumn;
29
+ exports.findPhysicalIndex = require_adapter.findPhysicalIndex;
14
30
  exports.getInsightsDistinctRegister = require_insightsDistinctSummary.getInsightsDistinctRegister;
31
+ exports.indexEntries = require_values.indexEntries;
32
+ exports.indexOrderColumns = require_adapter.indexOrderColumns;
33
+ exports.indexOrderTuple = require_values.indexOrderTuple;
15
34
  exports.insightsDistributionIdentity = require_insightsOverview.insightsDistributionIdentity;
35
+ exports.insightsKey = require_insightsOverview.insightsKey;
16
36
  exports.insightsOverviewDeltas = require_insightsOverview.insightsOverviewDeltas;
17
37
  exports.insightsOverviewId = require_insightsOverview.insightsOverviewId;
18
38
  exports.insightsOverviewValues = require_insightsOverview.insightsOverviewValues;
19
- exports.latestInsightsCountGroups = require_insightsLatestQueries.latestInsightsCountGroups;
20
- exports.latestInsightsWhere = require_insightsLatestQueries.latestInsightsWhere;
39
+ exports.isKeyValue = require_values.isKeyValue;
40
+ exports.matchesQuery = require_values.matchesQuery;
21
41
  exports.mergeInsightsDistinct = require_insightsDistinctSummary.mergeInsightsDistinct;
42
+ exports.normalizeStoredRow = require_values.normalizeStoredRow;
43
+ exports.normalizeStoredValue = require_values.normalizeStoredValue;
44
+ exports.rowKey = require_adapter.rowKey;
45
+ exports.verifyAdapter = require_verifyAdapter.verifyAdapter;