@hot-updater/plugin-core 1.0.0-rc.14 → 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 (163) hide show
  1. package/dist/bundleEventRow.cjs +42 -0
  2. package/dist/bundleEventRow.mjs +41 -0
  3. package/dist/bundleStorageLayout.cjs +7 -0
  4. package/dist/bundleStorageLayout.d.cts +5 -1
  5. package/dist/bundleStorageLayout.d.mts +5 -1
  6. package/dist/bundleStorageLayout.mjs +7 -1
  7. package/dist/contentType.cjs +9 -0
  8. package/dist/contentType.d.cts +4 -0
  9. package/dist/contentType.d.mts +4 -0
  10. package/dist/contentType.mjs +7 -0
  11. package/dist/coreApi.d.cts +131 -0
  12. package/dist/coreApi.d.mts +131 -0
  13. package/dist/database/adapter.cjs +37 -0
  14. package/dist/database/adapter.d.cts +150 -0
  15. package/dist/database/adapter.d.mts +150 -0
  16. package/dist/database/adapter.mjs +30 -0
  17. package/dist/database/memoryAdapter.cjs +102 -0
  18. package/dist/database/memoryAdapter.d.cts +16 -0
  19. package/dist/database/memoryAdapter.d.mts +16 -0
  20. package/dist/database/memoryAdapter.mjs +102 -0
  21. package/dist/database/values.cjs +110 -0
  22. package/dist/database/values.d.cts +30 -0
  23. package/dist/database/values.d.mts +30 -0
  24. package/dist/database/values.mjs +100 -0
  25. package/dist/database/verifyAdapter.cjs +129 -0
  26. package/dist/database/verifyAdapter.d.cts +29 -0
  27. package/dist/database/verifyAdapter.d.mts +29 -0
  28. package/dist/database/verifyAdapter.mjs +128 -0
  29. package/dist/databaseErrors.cjs +30 -0
  30. package/dist/databaseErrors.d.cts +21 -0
  31. package/dist/databaseErrors.d.mts +21 -0
  32. package/dist/databaseErrors.mjs +28 -0
  33. package/dist/databaseMetadata.cjs +2 -2
  34. package/dist/databaseMetadata.mjs +1 -1
  35. package/dist/databaseRows.cjs +0 -6
  36. package/dist/databaseRows.mjs +0 -6
  37. package/dist/index.cjs +14 -41
  38. package/dist/index.d.cts +15 -19
  39. package/dist/index.d.mts +15 -19
  40. package/dist/index.mjs +10 -16
  41. package/dist/insightsContract.cjs +65 -17
  42. package/dist/insightsContract.d.cts +6 -1
  43. package/dist/insightsContract.d.mts +6 -1
  44. package/dist/insightsContract.mjs +52 -5
  45. package/dist/insightsDistinctSummary.cjs +73 -0
  46. package/dist/insightsDistinctSummary.d.cts +12 -0
  47. package/dist/insightsDistinctSummary.d.mts +12 -0
  48. package/dist/insightsDistinctSummary.mjs +69 -0
  49. package/dist/insightsOverview.cjs +139 -0
  50. package/dist/insightsOverview.d.cts +42 -0
  51. package/dist/insightsOverview.d.mts +42 -0
  52. package/dist/insightsOverview.mjs +134 -0
  53. package/dist/internal.cjs +44 -8
  54. package/dist/internal.d.cts +12 -9
  55. package/dist/internal.d.mts +12 -9
  56. package/dist/internal.mjs +9 -4
  57. package/dist/releaseCatalogCompiler.cjs +1 -1
  58. package/dist/releaseCatalogCompiler.mjs +2 -2
  59. package/dist/releaseCatalogMutation.cjs +0 -292
  60. package/dist/releaseCatalogMutation.d.cts +4 -45
  61. package/dist/releaseCatalogMutation.d.mts +4 -45
  62. package/dist/releaseCatalogMutation.mjs +1 -288
  63. package/dist/releaseManagement.cjs +0 -221
  64. package/dist/releaseManagement.d.cts +4 -28
  65. package/dist/releaseManagement.d.mts +4 -28
  66. package/dist/releaseManagement.mjs +1 -216
  67. package/dist/types/databaseConfig.cjs +5 -0
  68. package/dist/types/databaseConfig.d.cts +33 -0
  69. package/dist/types/databaseConfig.d.mts +33 -0
  70. package/dist/types/databaseConfig.mjs +5 -0
  71. package/dist/types/databaseOperations.d.cts +5 -172
  72. package/dist/types/databaseOperations.d.mts +5 -172
  73. package/dist/types/databaseRows.d.cts +3 -6
  74. package/dist/types/databaseRows.d.mts +3 -6
  75. package/dist/types/index.cjs +2 -0
  76. package/dist/types/index.d.cts +9 -86
  77. package/dist/types/index.d.mts +9 -86
  78. package/dist/types/index.mjs +2 -1
  79. package/dist/types/insights.d.cts +172 -0
  80. package/dist/types/insights.d.mts +172 -0
  81. package/dist/types/internal.d.cts +4 -7
  82. package/dist/types/internal.d.mts +4 -7
  83. package/dist/types/models.d.cts +24 -0
  84. package/dist/types/models.d.mts +24 -0
  85. package/dist/types/public.d.cts +4 -2
  86. package/dist/types/public.d.mts +4 -2
  87. package/package.json +2 -2
  88. package/dist/calculatePagination.cjs +0 -25
  89. package/dist/calculatePagination.d.cts +0 -12
  90. package/dist/calculatePagination.d.mts +0 -12
  91. package/dist/calculatePagination.mjs +0 -25
  92. package/dist/compressionFormat.cjs +0 -62
  93. package/dist/compressionFormat.d.cts +0 -33
  94. package/dist/compressionFormat.d.mts +0 -33
  95. package/dist/compressionFormat.mjs +0 -58
  96. package/dist/createDatabasePlugin.cjs +0 -873
  97. package/dist/createDatabasePlugin.d.cts +0 -28
  98. package/dist/createDatabasePlugin.d.mts +0 -28
  99. package/dist/createDatabasePlugin.mjs +0 -869
  100. package/dist/databaseClient.cjs +0 -117
  101. package/dist/databaseClient.d.cts +0 -32
  102. package/dist/databaseClient.d.mts +0 -32
  103. package/dist/databaseClient.mjs +0 -114
  104. package/dist/databaseClientReads.cjs +0 -115
  105. package/dist/databaseClientReads.mjs +0 -113
  106. package/dist/databaseClientUpdates.cjs +0 -40
  107. package/dist/databaseClientUpdates.d.cts +0 -11
  108. package/dist/databaseClientUpdates.d.mts +0 -11
  109. package/dist/databaseClientUpdates.mjs +0 -38
  110. package/dist/databasePluginCrud.cjs +0 -87
  111. package/dist/databasePluginCrud.d.cts +0 -4
  112. package/dist/databasePluginCrud.d.mts +0 -4
  113. package/dist/databasePluginCrud.mjs +0 -86
  114. package/dist/databasePluginCrudValidation.d.cts +0 -6
  115. package/dist/databasePluginCrudValidation.d.mts +0 -6
  116. package/dist/databasePluginCrudValidationErrors.cjs +0 -11
  117. package/dist/databasePluginCrudValidationErrors.d.cts +0 -9
  118. package/dist/databasePluginCrudValidationErrors.d.mts +0 -9
  119. package/dist/databasePluginCrudValidationErrors.mjs +0 -11
  120. package/dist/databasePluginCrudValidationFields.cjs +0 -293
  121. package/dist/databasePluginCrudValidationFields.d.cts +0 -1
  122. package/dist/databasePluginCrudValidationFields.d.mts +0 -1
  123. package/dist/databasePluginCrudValidationFields.mjs +0 -281
  124. package/dist/databasePluginCrudValidationMutations.cjs +0 -88
  125. package/dist/databasePluginCrudValidationMutations.d.cts +0 -1
  126. package/dist/databasePluginCrudValidationMutations.d.mts +0 -1
  127. package/dist/databasePluginCrudValidationMutations.mjs +0 -82
  128. package/dist/databasePluginCrudValidationQueries.cjs +0 -103
  129. package/dist/databasePluginCrudValidationQueries.d.cts +0 -2
  130. package/dist/databasePluginCrudValidationQueries.d.mts +0 -2
  131. package/dist/databasePluginCrudValidationQueries.mjs +0 -97
  132. package/dist/databasePluginCrudValidationRows.cjs +0 -55
  133. package/dist/databasePluginCrudValidationRows.d.cts +0 -1
  134. package/dist/databasePluginCrudValidationRows.d.mts +0 -1
  135. package/dist/databasePluginCrudValidationRows.mjs +0 -53
  136. package/dist/databasePluginTransaction.cjs +0 -7
  137. package/dist/databasePluginTransaction.mjs +0 -7
  138. package/dist/insightsLatestQueries.cjs +0 -53
  139. package/dist/insightsLatestQueries.d.cts +0 -13
  140. package/dist/insightsLatestQueries.d.mts +0 -13
  141. package/dist/insightsLatestQueries.mjs +0 -52
  142. package/dist/paginateBundles.cjs +0 -53
  143. package/dist/paginateBundles.d.cts +0 -13
  144. package/dist/paginateBundles.d.mts +0 -13
  145. package/dist/paginateBundles.mjs +0 -53
  146. package/dist/queryBundles.cjs +0 -34
  147. package/dist/queryBundles.d.cts +0 -9
  148. package/dist/queryBundles.d.mts +0 -9
  149. package/dist/queryBundles.mjs +0 -32
  150. package/dist/requestBundleCache.cjs +0 -22
  151. package/dist/requestBundleCache.d.cts +0 -8
  152. package/dist/requestBundleCache.d.mts +0 -8
  153. package/dist/requestBundleCache.mjs +0 -22
  154. package/dist/types/database.d.cts +0 -5
  155. package/dist/types/database.d.mts +0 -5
  156. package/dist/types/databaseFields.cjs +0 -88
  157. package/dist/types/databaseFields.d.cts +0 -12
  158. package/dist/types/databaseFields.d.mts +0 -12
  159. package/dist/types/databaseFields.mjs +0 -88
  160. package/dist/types/databasePlugin.d.cts +0 -304
  161. package/dist/types/databasePlugin.d.mts +0 -304
  162. package/dist/types/databaseQuery.d.cts +0 -46
  163. package/dist/types/databaseQuery.d.mts +0 -46
@@ -0,0 +1,172 @@
1
+ import { BundleEventRow } from "./databaseRows.cjs";
2
+ //#region src/types/insights.d.ts
3
+ interface InsightsEventCursor {
4
+ readonly receivedAtMs: number;
5
+ readonly id: string;
6
+ }
7
+ interface InsightsScope {
8
+ readonly platform: "ios" | "android";
9
+ readonly channel: string;
10
+ }
11
+ /** Raw event predicates; recovery is attributed to the source bundle. */
12
+ type InsightsBundleEventFilter = InsightsScope & ({
13
+ readonly type: "RECOVERED";
14
+ readonly fromBundleId: string;
15
+ } | {
16
+ readonly type: "UPDATE_DOWNLOADED" | "UPDATE_APPLIED" | "UNCHANGED";
17
+ readonly toBundleId: string;
18
+ });
19
+ type InsightsEventFilter = {
20
+ readonly kind: "all";
21
+ } | {
22
+ readonly kind: "installationMovement";
23
+ readonly installId: string;
24
+ } | ({
25
+ readonly kind: "bundle";
26
+ } & InsightsBundleEventFilter);
27
+ interface InsightsRecordEventInput {
28
+ readonly event: BundleEventRow;
29
+ }
30
+ interface InsightsListEventsInput {
31
+ readonly filter: InsightsEventFilter;
32
+ readonly sinceMs?: number;
33
+ readonly beforeReceivedAtMs: number;
34
+ readonly after?: InsightsEventCursor;
35
+ readonly limit: number;
36
+ }
37
+ type InsightsFindLatestEventsInput = {
38
+ readonly installId: string;
39
+ } | {
40
+ readonly userId: string;
41
+ readonly afterInstallId?: string;
42
+ readonly limit: number;
43
+ };
44
+ interface InsightsCountLatestEventsInput extends InsightsScope {
45
+ readonly sinceMs: number;
46
+ /** Optional OR of one or two fixed predicates; count a matching event once. */
47
+ readonly bundle?: readonly {
48
+ readonly field: "from_bundle_id" | "to_bundle_id";
49
+ readonly value: string;
50
+ readonly types: readonly BundleEventRow["type"][];
51
+ }[];
52
+ }
53
+ interface InsightsCountEventsInput {
54
+ readonly filter: InsightsBundleEventFilter;
55
+ readonly sinceMs: number;
56
+ readonly beforeReceivedAtMs: number;
57
+ }
58
+ interface ReleaseReference {
59
+ readonly releaseId: string;
60
+ readonly platform: "ios" | "android";
61
+ readonly channel: string;
62
+ }
63
+ interface InsightsTimeRange {
64
+ /** Inclusive UTC Unix timestamp in milliseconds. */
65
+ readonly start: number;
66
+ /** Exclusive UTC Unix timestamp in milliseconds. */
67
+ readonly end: number;
68
+ }
69
+ type InsightsCoverage = {
70
+ readonly kind: "complete";
71
+ readonly sinceMs: number;
72
+ } | {
73
+ readonly kind: "partial";
74
+ readonly sinceMs: number | null;
75
+ };
76
+ interface ReleaseActivityMetrics {
77
+ readonly downloads: number;
78
+ readonly launches: number;
79
+ readonly failedLaunches: number;
80
+ /** Omitted for lifetime-only bundle-row reads. */
81
+ readonly uniqueUsers?: number;
82
+ /** Daily points, present only for period reads. */
83
+ readonly series?: readonly {
84
+ readonly startMs: number;
85
+ readonly launches: number;
86
+ readonly failedLaunches: number;
87
+ }[];
88
+ }
89
+ type InsightsGetReleaseActivityInput = {
90
+ readonly releases: readonly ReleaseReference[];
91
+ readonly timeRange?: InsightsTimeRange;
92
+ readonly scope?: never;
93
+ } | {
94
+ readonly scope: InsightsScope;
95
+ readonly timeRange: InsightsTimeRange;
96
+ readonly releases?: never;
97
+ };
98
+ interface InsightsGetReleaseActivityResult {
99
+ readonly coverage: InsightsCoverage;
100
+ readonly data: readonly {
101
+ readonly release?: ReleaseReference;
102
+ readonly scope?: InsightsScope;
103
+ readonly metrics: ReleaseActivityMetrics;
104
+ }[];
105
+ readonly measuredAtMs: number;
106
+ }
107
+ interface InsightsGetAppUsageInput {
108
+ readonly channel: string;
109
+ readonly platform: "all" | "ios" | "android";
110
+ readonly appVersion?: string;
111
+ readonly timeRange: InsightsTimeRange;
112
+ readonly intervalMs: number;
113
+ }
114
+ interface InsightsGetAppUsageResult {
115
+ readonly coverage: InsightsCoverage;
116
+ readonly activeInstallations: number;
117
+ readonly points: readonly {
118
+ readonly startMs: number;
119
+ readonly installations: number;
120
+ }[];
121
+ readonly appVersions: readonly string[];
122
+ readonly versions: readonly {
123
+ readonly name: string;
124
+ readonly installations: number;
125
+ }[];
126
+ readonly platforms: readonly {
127
+ readonly name: string;
128
+ readonly installations: number;
129
+ }[];
130
+ readonly bundleDistribution: readonly {
131
+ readonly appVersion: string;
132
+ readonly platform: "ios" | "android";
133
+ readonly releaseId: string | null;
134
+ readonly installations: number;
135
+ }[];
136
+ readonly measuredAtMs: number;
137
+ }
138
+ interface InsightsModel {
139
+ /**
140
+ * Persist the immutable event once. A private latest-event index, if used,
141
+ * advances atomically for a greater (received_at_ms, id). Duplicate event
142
+ * IDs are complete no-ops, whichever installation sends them.
143
+ * Retry the identical prepared input after an ambiguous commit outcome.
144
+ */
145
+ recordEvent(input: InsightsRecordEventInput): Promise<void>;
146
+ /**
147
+ * Descending (received_at_ms, id), in [sinceMs ?? 0, beforeReceivedAtMs).
148
+ * Apply filters and the exclusive cursor before limit (1..101). Return the
149
+ * complete matching prefix; native continuation pages must not truncate it.
150
+ * A global or bundle list may reject a range longer than 90 × 24 hours;
151
+ * the server asks for older events with an earlier range instead.
152
+ */
153
+ listEvents(input: InsightsListEventsInput): Promise<readonly BundleEventRow[]>;
154
+ /**
155
+ * Choose each installation's greatest (received_at_ms, id) before filtering.
156
+ * Exact installation lookup returns zero or one canonical event. User lookup
157
+ * returns current membership ordered by UTF-8 installation ID, exclusive
158
+ * afterInstallId and limit 1..101. Check lagging index candidates against
159
+ * canonical state; newly indexed associations may temporarily be absent.
160
+ */
161
+ findLatestEvents(input: InsightsFindLatestEventsInput): Promise<readonly BundleEventRow[]>;
162
+ /** Count latest events once per installation, then apply the supplied predicates. */
163
+ countLatestEvents(input: InsightsCountLatestEventsInput): Promise<number>;
164
+ /** Count accepted reports in [sinceMs, beforeReceivedAtMs), across all pages. */
165
+ countEvents(input: InsightsCountEventsInput): Promise<number>;
166
+ /** Read maintained release/scope summaries without scanning raw events. */
167
+ getReleaseActivity(input: InsightsGetReleaseActivityInput): Promise<InsightsGetReleaseActivityResult>;
168
+ /** Read maintained App usage summaries and latest-report distribution. */
169
+ getAppUsage(input: InsightsGetAppUsageInput): Promise<InsightsGetAppUsageResult>;
170
+ }
171
+ //#endregion
172
+ export { InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseReference };
@@ -0,0 +1,172 @@
1
+ import { BundleEventRow } from "./databaseRows.mjs";
2
+ //#region src/types/insights.d.ts
3
+ interface InsightsEventCursor {
4
+ readonly receivedAtMs: number;
5
+ readonly id: string;
6
+ }
7
+ interface InsightsScope {
8
+ readonly platform: "ios" | "android";
9
+ readonly channel: string;
10
+ }
11
+ /** Raw event predicates; recovery is attributed to the source bundle. */
12
+ type InsightsBundleEventFilter = InsightsScope & ({
13
+ readonly type: "RECOVERED";
14
+ readonly fromBundleId: string;
15
+ } | {
16
+ readonly type: "UPDATE_DOWNLOADED" | "UPDATE_APPLIED" | "UNCHANGED";
17
+ readonly toBundleId: string;
18
+ });
19
+ type InsightsEventFilter = {
20
+ readonly kind: "all";
21
+ } | {
22
+ readonly kind: "installationMovement";
23
+ readonly installId: string;
24
+ } | ({
25
+ readonly kind: "bundle";
26
+ } & InsightsBundleEventFilter);
27
+ interface InsightsRecordEventInput {
28
+ readonly event: BundleEventRow;
29
+ }
30
+ interface InsightsListEventsInput {
31
+ readonly filter: InsightsEventFilter;
32
+ readonly sinceMs?: number;
33
+ readonly beforeReceivedAtMs: number;
34
+ readonly after?: InsightsEventCursor;
35
+ readonly limit: number;
36
+ }
37
+ type InsightsFindLatestEventsInput = {
38
+ readonly installId: string;
39
+ } | {
40
+ readonly userId: string;
41
+ readonly afterInstallId?: string;
42
+ readonly limit: number;
43
+ };
44
+ interface InsightsCountLatestEventsInput extends InsightsScope {
45
+ readonly sinceMs: number;
46
+ /** Optional OR of one or two fixed predicates; count a matching event once. */
47
+ readonly bundle?: readonly {
48
+ readonly field: "from_bundle_id" | "to_bundle_id";
49
+ readonly value: string;
50
+ readonly types: readonly BundleEventRow["type"][];
51
+ }[];
52
+ }
53
+ interface InsightsCountEventsInput {
54
+ readonly filter: InsightsBundleEventFilter;
55
+ readonly sinceMs: number;
56
+ readonly beforeReceivedAtMs: number;
57
+ }
58
+ interface ReleaseReference {
59
+ readonly releaseId: string;
60
+ readonly platform: "ios" | "android";
61
+ readonly channel: string;
62
+ }
63
+ interface InsightsTimeRange {
64
+ /** Inclusive UTC Unix timestamp in milliseconds. */
65
+ readonly start: number;
66
+ /** Exclusive UTC Unix timestamp in milliseconds. */
67
+ readonly end: number;
68
+ }
69
+ type InsightsCoverage = {
70
+ readonly kind: "complete";
71
+ readonly sinceMs: number;
72
+ } | {
73
+ readonly kind: "partial";
74
+ readonly sinceMs: number | null;
75
+ };
76
+ interface ReleaseActivityMetrics {
77
+ readonly downloads: number;
78
+ readonly launches: number;
79
+ readonly failedLaunches: number;
80
+ /** Omitted for lifetime-only bundle-row reads. */
81
+ readonly uniqueUsers?: number;
82
+ /** Daily points, present only for period reads. */
83
+ readonly series?: readonly {
84
+ readonly startMs: number;
85
+ readonly launches: number;
86
+ readonly failedLaunches: number;
87
+ }[];
88
+ }
89
+ type InsightsGetReleaseActivityInput = {
90
+ readonly releases: readonly ReleaseReference[];
91
+ readonly timeRange?: InsightsTimeRange;
92
+ readonly scope?: never;
93
+ } | {
94
+ readonly scope: InsightsScope;
95
+ readonly timeRange: InsightsTimeRange;
96
+ readonly releases?: never;
97
+ };
98
+ interface InsightsGetReleaseActivityResult {
99
+ readonly coverage: InsightsCoverage;
100
+ readonly data: readonly {
101
+ readonly release?: ReleaseReference;
102
+ readonly scope?: InsightsScope;
103
+ readonly metrics: ReleaseActivityMetrics;
104
+ }[];
105
+ readonly measuredAtMs: number;
106
+ }
107
+ interface InsightsGetAppUsageInput {
108
+ readonly channel: string;
109
+ readonly platform: "all" | "ios" | "android";
110
+ readonly appVersion?: string;
111
+ readonly timeRange: InsightsTimeRange;
112
+ readonly intervalMs: number;
113
+ }
114
+ interface InsightsGetAppUsageResult {
115
+ readonly coverage: InsightsCoverage;
116
+ readonly activeInstallations: number;
117
+ readonly points: readonly {
118
+ readonly startMs: number;
119
+ readonly installations: number;
120
+ }[];
121
+ readonly appVersions: readonly string[];
122
+ readonly versions: readonly {
123
+ readonly name: string;
124
+ readonly installations: number;
125
+ }[];
126
+ readonly platforms: readonly {
127
+ readonly name: string;
128
+ readonly installations: number;
129
+ }[];
130
+ readonly bundleDistribution: readonly {
131
+ readonly appVersion: string;
132
+ readonly platform: "ios" | "android";
133
+ readonly releaseId: string | null;
134
+ readonly installations: number;
135
+ }[];
136
+ readonly measuredAtMs: number;
137
+ }
138
+ interface InsightsModel {
139
+ /**
140
+ * Persist the immutable event once. A private latest-event index, if used,
141
+ * advances atomically for a greater (received_at_ms, id). Duplicate event
142
+ * IDs are complete no-ops, whichever installation sends them.
143
+ * Retry the identical prepared input after an ambiguous commit outcome.
144
+ */
145
+ recordEvent(input: InsightsRecordEventInput): Promise<void>;
146
+ /**
147
+ * Descending (received_at_ms, id), in [sinceMs ?? 0, beforeReceivedAtMs).
148
+ * Apply filters and the exclusive cursor before limit (1..101). Return the
149
+ * complete matching prefix; native continuation pages must not truncate it.
150
+ * A global or bundle list may reject a range longer than 90 × 24 hours;
151
+ * the server asks for older events with an earlier range instead.
152
+ */
153
+ listEvents(input: InsightsListEventsInput): Promise<readonly BundleEventRow[]>;
154
+ /**
155
+ * Choose each installation's greatest (received_at_ms, id) before filtering.
156
+ * Exact installation lookup returns zero or one canonical event. User lookup
157
+ * returns current membership ordered by UTF-8 installation ID, exclusive
158
+ * afterInstallId and limit 1..101. Check lagging index candidates against
159
+ * canonical state; newly indexed associations may temporarily be absent.
160
+ */
161
+ findLatestEvents(input: InsightsFindLatestEventsInput): Promise<readonly BundleEventRow[]>;
162
+ /** Count latest events once per installation, then apply the supplied predicates. */
163
+ countLatestEvents(input: InsightsCountLatestEventsInput): Promise<number>;
164
+ /** Count accepted reports in [sinceMs, beforeReceivedAtMs), across all pages. */
165
+ countEvents(input: InsightsCountEventsInput): Promise<number>;
166
+ /** Read maintained release/scope summaries without scanning raw events. */
167
+ getReleaseActivity(input: InsightsGetReleaseActivityInput): Promise<InsightsGetReleaseActivityResult>;
168
+ /** Read maintained App usage summaries and latest-report distribution. */
169
+ getAppUsage(input: InsightsGetAppUsageInput): Promise<InsightsGetAppUsageResult>;
170
+ }
171
+ //#endregion
172
+ export { InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseReference };
@@ -1,8 +1,5 @@
1
1
  import { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleEventMetadata, DatabaseBundleMetadata, DatabaseField, DatabaseJsonObject, DatabaseJsonValue, DatabaseModel, DatabaseModelMap, DatabaseRow, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.cjs";
2
- import { ApiKeyModel, BundleModel, BundleModelQuery, BundlePatchModel, BundleRepository, BundleRepositoryChange, BundleRepositoryCommit, ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelModel, DatabaseChange, DatabaseCommit, DatabaseCommitExpectation, DatabaseCommitResult, DatabaseModels, DatabasePlugin, InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, ReleaseCatalogModel, ReleaseModel } from "./databasePlugin.cjs";
3
- import { DatabaseDistinctFields, DatabaseDistinctOn, DatabaseOrderBy, DatabaseSelect, DatabaseSortBy, DatabaseSortClause, DatabaseSortNulls, DatabaseStringComparisonMode, DatabaseWhere, DatabaseWhereConnector, DatabaseWhereOperator, SelectedDatabaseRow } from "./databaseQuery.cjs";
4
- import { ApiKeyRowUpdate, BundleRowUpdate, CountBundlesDatabaseImplementationInput, CountBundlesDatabaseInput, CountDatabaseImplementationInput, CountDatabaseInput, CountDatabaseModel, CreateDatabaseImplementationInput, CreateDatabaseInput, CreateDatabaseModel, DatabaseCapability, DatabaseDeleteModel, DatabaseFindOneModel, DatabaseImplementationResult, DatabaseModelCapabilities, DatabaseModelsWithCapability, DatabasePluginCrud, DatabasePluginImplementation, DatabaseRowUpdate, DeleteDatabaseImplementationInput, DeleteDatabaseInput, DeleteDatabaseModel, FindManyDatabaseImplementationInput, FindManyDatabaseInput, FindManyDatabaseModel, FindManyDatabasePluginInput, FindOneDatabaseImplementationInput, FindOneDatabaseInput, FindOneDatabaseModel, ReleaseCatalogRowUpdate, ReleaseRowUpdate, SelectedDatabaseInputRow, TransactionDatabasePluginImplementation, UpdateBundleDatabaseImplementationInput, UpdateBundleDatabaseInput, UpdateDatabaseImplementationInput, UpdateDatabaseInput, UpdateDatabaseModel } from "./databaseOperations.cjs";
5
- import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./utils.cjs";
6
- 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 "./index.cjs";
7
- import { databaseFields } from "./databaseFields.cjs";
8
- export { ApiKeyModel, ApiKeyRow, ApiKeyRowUpdate, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, BuiltIns, type Bundle, BundleEventRow, BundleEventRowBase, BundleModel, BundleModelQuery, BundlePatchModel, BundlePatchRow, BundleRepository, BundleRepositoryChange, BundleRepositoryCommit, BundleRow, BundleRowUpdate, BundleSigningPlugin, ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelModel, ChannelRow, ConfigInput, CountBundlesDatabaseImplementationInput, CountBundlesDatabaseInput, CountDatabaseImplementationInput, CountDatabaseInput, CountDatabaseModel, CreateDatabaseImplementationInput, CreateDatabaseInput, CreateDatabaseModel, DatabaseBundleCursor, DatabaseBundleEventMetadata, DatabaseBundleIdFilter, DatabaseBundleMetadata, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabaseCapability, DatabaseChange, DatabaseCommit, DatabaseCommitExpectation, DatabaseCommitResult, DatabaseDeleteModel, DatabaseDistinctFields, DatabaseDistinctOn, DatabaseField, DatabaseFindOneModel, DatabaseImplementationResult, DatabaseJsonObject, DatabaseJsonValue, DatabaseModel, DatabaseModelCapabilities, DatabaseModelMap, DatabaseModels, DatabaseModelsWithCapability, DatabaseOrderBy, DatabasePlugin, DatabasePluginCrud, DatabasePluginImplementation, DatabaseRow, DatabaseRowUpdate, DatabaseSelect, DatabaseSortBy, DatabaseSortClause, DatabaseSortNulls, DatabaseStringComparisonMode, DatabaseWhere, DatabaseWhereConnector, DatabaseWhereOperator, DeleteDatabaseImplementationInput, DeleteDatabaseInput, DeleteDatabaseModel, FindManyDatabaseImplementationInput, FindManyDatabaseInput, FindManyDatabaseModel, FindManyDatabasePluginInput, FindOneDatabaseImplementationInput, FindOneDatabaseInput, FindOneDatabaseModel, FingerprintExtraSources, HasMultipleCallSignatures, InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, type Platform, PlatformConfig, Primitive, ReleaseCatalogModel, ReleaseCatalogRow, ReleaseCatalogRowUpdate, ReleaseModel, ReleaseRow, ReleaseRowUpdate, RequiredDeep, SelectedDatabaseInputRow, SelectedDatabaseRow, SigningConfig, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePlugin, StoragePutInput, StoragePutResult, TransactionDatabasePluginImplementation, UpdateBundleDatabaseImplementationInput, UpdateBundleDatabaseInput, UpdateDatabaseImplementationInput, UpdateDatabaseInput, UpdateDatabaseModel, databaseFields, supportedIosPlatforms };
2
+ import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./databaseOperations.cjs";
3
+ import { InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseReference } from "./insights.cjs";
4
+ import { ApiKeyModel, ChannelDeleteResult, ChannelInsertResult } from "./models.cjs";
5
+ export { ApiKeyModel, ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, BundleRowUpdate, ChannelDeleteResult, ChannelInsertResult, ChannelRow, DatabaseBundleEventMetadata, DatabaseBundleMetadata, DatabaseField, DatabaseJsonObject, DatabaseJsonValue, DatabaseModel, DatabaseModelMap, DatabaseRow, InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseCatalogRow, ReleaseCatalogRowUpdate, ReleaseReference, ReleaseRow, ReleaseRowUpdate };
@@ -1,8 +1,5 @@
1
1
  import { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleEventMetadata, DatabaseBundleMetadata, DatabaseField, DatabaseJsonObject, DatabaseJsonValue, DatabaseModel, DatabaseModelMap, DatabaseRow, ReleaseCatalogRow, ReleaseRow } from "./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, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, ReleaseCatalogModel, ReleaseModel } from "./databasePlugin.mjs";
3
- import { DatabaseDistinctFields, DatabaseDistinctOn, DatabaseOrderBy, DatabaseSelect, DatabaseSortBy, DatabaseSortClause, DatabaseSortNulls, DatabaseStringComparisonMode, DatabaseWhere, DatabaseWhereConnector, DatabaseWhereOperator, SelectedDatabaseRow } from "./databaseQuery.mjs";
4
- import { ApiKeyRowUpdate, BundleRowUpdate, CountBundlesDatabaseImplementationInput, CountBundlesDatabaseInput, CountDatabaseImplementationInput, CountDatabaseInput, CountDatabaseModel, CreateDatabaseImplementationInput, CreateDatabaseInput, CreateDatabaseModel, DatabaseCapability, DatabaseDeleteModel, DatabaseFindOneModel, DatabaseImplementationResult, DatabaseModelCapabilities, DatabaseModelsWithCapability, DatabasePluginCrud, DatabasePluginImplementation, DatabaseRowUpdate, DeleteDatabaseImplementationInput, DeleteDatabaseInput, DeleteDatabaseModel, FindManyDatabaseImplementationInput, FindManyDatabaseInput, FindManyDatabaseModel, FindManyDatabasePluginInput, FindOneDatabaseImplementationInput, FindOneDatabaseInput, FindOneDatabaseModel, ReleaseCatalogRowUpdate, ReleaseRowUpdate, SelectedDatabaseInputRow, TransactionDatabasePluginImplementation, UpdateBundleDatabaseImplementationInput, UpdateBundleDatabaseInput, UpdateDatabaseImplementationInput, UpdateDatabaseInput, UpdateDatabaseModel } from "./databaseOperations.mjs";
5
- import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./utils.mjs";
6
- 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 "./index.mjs";
7
- import { databaseFields } from "./databaseFields.mjs";
8
- export { ApiKeyModel, ApiKeyRow, ApiKeyRowUpdate, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, BuiltIns, type Bundle, BundleEventRow, BundleEventRowBase, BundleModel, BundleModelQuery, BundlePatchModel, BundlePatchRow, BundleRepository, BundleRepositoryChange, BundleRepositoryCommit, BundleRow, BundleRowUpdate, BundleSigningPlugin, ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelModel, ChannelRow, ConfigInput, CountBundlesDatabaseImplementationInput, CountBundlesDatabaseInput, CountDatabaseImplementationInput, CountDatabaseInput, CountDatabaseModel, CreateDatabaseImplementationInput, CreateDatabaseInput, CreateDatabaseModel, DatabaseBundleCursor, DatabaseBundleEventMetadata, DatabaseBundleIdFilter, DatabaseBundleMetadata, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabaseCapability, DatabaseChange, DatabaseCommit, DatabaseCommitExpectation, DatabaseCommitResult, DatabaseDeleteModel, DatabaseDistinctFields, DatabaseDistinctOn, DatabaseField, DatabaseFindOneModel, DatabaseImplementationResult, DatabaseJsonObject, DatabaseJsonValue, DatabaseModel, DatabaseModelCapabilities, DatabaseModelMap, DatabaseModels, DatabaseModelsWithCapability, DatabaseOrderBy, DatabasePlugin, DatabasePluginCrud, DatabasePluginImplementation, DatabaseRow, DatabaseRowUpdate, DatabaseSelect, DatabaseSortBy, DatabaseSortClause, DatabaseSortNulls, DatabaseStringComparisonMode, DatabaseWhere, DatabaseWhereConnector, DatabaseWhereOperator, DeleteDatabaseImplementationInput, DeleteDatabaseInput, DeleteDatabaseModel, FindManyDatabaseImplementationInput, FindManyDatabaseInput, FindManyDatabaseModel, FindManyDatabasePluginInput, FindOneDatabaseImplementationInput, FindOneDatabaseInput, FindOneDatabaseModel, FingerprintExtraSources, HasMultipleCallSignatures, InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, type Platform, PlatformConfig, Primitive, ReleaseCatalogModel, ReleaseCatalogRow, ReleaseCatalogRowUpdate, ReleaseModel, ReleaseRow, ReleaseRowUpdate, RequiredDeep, SelectedDatabaseInputRow, SelectedDatabaseRow, SigningConfig, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePlugin, StoragePutInput, StoragePutResult, TransactionDatabasePluginImplementation, UpdateBundleDatabaseImplementationInput, UpdateBundleDatabaseInput, UpdateDatabaseImplementationInput, UpdateDatabaseInput, UpdateDatabaseModel, databaseFields, supportedIosPlatforms };
2
+ import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./databaseOperations.mjs";
3
+ import { InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseReference } from "./insights.mjs";
4
+ import { ApiKeyModel, ChannelDeleteResult, ChannelInsertResult } from "./models.mjs";
5
+ export { ApiKeyModel, ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, BundleRowUpdate, ChannelDeleteResult, ChannelInsertResult, ChannelRow, DatabaseBundleEventMetadata, DatabaseBundleMetadata, DatabaseField, DatabaseJsonObject, DatabaseJsonValue, DatabaseModel, DatabaseModelMap, DatabaseRow, InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseCatalogRow, ReleaseCatalogRowUpdate, ReleaseReference, ReleaseRow, ReleaseRowUpdate };
@@ -0,0 +1,24 @@
1
+ import { ApiKeyRow, ChannelRow } from "./databaseRows.cjs";
2
+ //#region src/types/models.d.ts
3
+ /** The api-keys plugin's storage: key rows by id and by hash. */
4
+ interface ApiKeyModel {
5
+ create(row: ApiKeyRow): Promise<"created" | "existing">;
6
+ findByHash(hash: string): Promise<ApiKeyRow | null>;
7
+ list(): Promise<readonly ApiKeyRow[]>;
8
+ revoke(input: {
9
+ readonly id: string;
10
+ readonly revokedAtMs: number;
11
+ }): Promise<ApiKeyRow | null>;
12
+ }
13
+ interface ChannelInsertResult {
14
+ readonly row: ChannelRow;
15
+ readonly inserted: boolean;
16
+ }
17
+ type ChannelDeleteResult = {
18
+ readonly deleted: true;
19
+ } | {
20
+ readonly deleted: false;
21
+ readonly reason: "not_found" | "not_empty";
22
+ };
23
+ //#endregion
24
+ export { ApiKeyModel, ChannelDeleteResult, ChannelInsertResult };
@@ -0,0 +1,24 @@
1
+ import { ApiKeyRow, ChannelRow } from "./databaseRows.mjs";
2
+ //#region src/types/models.d.ts
3
+ /** The api-keys plugin's storage: key rows by id and by hash. */
4
+ interface ApiKeyModel {
5
+ create(row: ApiKeyRow): Promise<"created" | "existing">;
6
+ findByHash(hash: string): Promise<ApiKeyRow | null>;
7
+ list(): Promise<readonly ApiKeyRow[]>;
8
+ revoke(input: {
9
+ readonly id: string;
10
+ readonly revokedAtMs: number;
11
+ }): Promise<ApiKeyRow | null>;
12
+ }
13
+ interface ChannelInsertResult {
14
+ readonly row: ChannelRow;
15
+ readonly inserted: boolean;
16
+ }
17
+ type ChannelDeleteResult = {
18
+ readonly deleted: true;
19
+ } | {
20
+ readonly deleted: false;
21
+ readonly reason: "not_found" | "not_empty";
22
+ };
23
+ //#endregion
24
+ export { ApiKeyModel, ChannelDeleteResult, ChannelInsertResult };
@@ -1,4 +1,6 @@
1
+ import { ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase } from "./databaseConfig.cjs";
1
2
  import { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleEventMetadata, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.cjs";
2
- import { ApiKeyModel, BundleModel, BundleModelQuery, BundlePatchModel, BundleRepository, BundleRepositoryChange, BundleRepositoryCommit, ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelModel, DatabaseChange, DatabaseCommit, DatabaseCommitExpectation, DatabaseCommitResult, DatabaseModels, DatabasePlugin, InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, ReleaseCatalogModel, ReleaseModel } from "./databasePlugin.cjs";
3
3
  import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./databaseOperations.cjs";
4
- export type { ApiKeyModel, ApiKeyRow, BundleEventRow, BundleEventRowBase, BundleModel, BundleModelQuery, BundlePatchModel, BundlePatchRow, BundleRepository, BundleRepositoryChange, BundleRepositoryCommit, BundleRow, BundleRowUpdate, ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelModel, ChannelRow, DatabaseBundleEventMetadata, DatabaseBundleMetadata, DatabaseChange, DatabaseCommit, DatabaseCommitExpectation, DatabaseCommitResult, DatabaseJsonObject, DatabaseJsonValue, DatabaseModels, DatabasePlugin, InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, ReleaseCatalogModel, ReleaseCatalogRow, ReleaseCatalogRowUpdate, ReleaseModel, ReleaseRow, ReleaseRowUpdate };
4
+ import { InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseReference } from "./insights.cjs";
5
+ import { ApiKeyModel, ChannelDeleteResult, ChannelInsertResult } from "./models.cjs";
6
+ export { type ApiKeyModel, type ApiKeyRow, type BundleEventRow, type BundleEventRowBase, type BundlePatchRow, type BundleRow, type BundleRowUpdate, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, type ConfiguredDatabase, type DatabaseBundleEventMetadata, type DatabaseBundleMetadata, type DatabaseJsonObject, type DatabaseJsonValue, type EngineDatabase, 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, type ReleaseActivityMetrics, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, type ReleaseReference, type ReleaseRow, type ReleaseRowUpdate, type RemoteDatabase, isRemoteDatabase };
@@ -1,4 +1,6 @@
1
+ import { ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase } from "./databaseConfig.mjs";
1
2
  import { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleEventMetadata, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./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, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, ReleaseCatalogModel, ReleaseModel } from "./databasePlugin.mjs";
3
3
  import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./databaseOperations.mjs";
4
- export type { ApiKeyModel, ApiKeyRow, BundleEventRow, BundleEventRowBase, BundleModel, BundleModelQuery, BundlePatchModel, BundlePatchRow, BundleRepository, BundleRepositoryChange, BundleRepositoryCommit, BundleRow, BundleRowUpdate, ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelModel, ChannelRow, DatabaseBundleEventMetadata, DatabaseBundleMetadata, DatabaseChange, DatabaseCommit, DatabaseCommitExpectation, DatabaseCommitResult, DatabaseJsonObject, DatabaseJsonValue, DatabaseModels, DatabasePlugin, InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, ReleaseCatalogModel, ReleaseCatalogRow, ReleaseCatalogRowUpdate, ReleaseModel, ReleaseRow, ReleaseRowUpdate };
4
+ import { InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseReference } from "./insights.mjs";
5
+ import { ApiKeyModel, ChannelDeleteResult, ChannelInsertResult } from "./models.mjs";
6
+ export { type ApiKeyModel, type ApiKeyRow, type BundleEventRow, type BundleEventRowBase, type BundlePatchRow, type BundleRow, type BundleRowUpdate, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, type ConfiguredDatabase, type DatabaseBundleEventMetadata, type DatabaseBundleMetadata, type DatabaseJsonObject, type DatabaseJsonValue, type EngineDatabase, 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, type ReleaseActivityMetrics, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, type ReleaseReference, type ReleaseRow, type ReleaseRowUpdate, type RemoteDatabase, isRemoteDatabase };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/plugin-core",
3
- "version": "1.0.0-rc.14",
3
+ "version": "1.0.0-rc.16",
4
4
  "type": "module",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "sideEffects": false,
@@ -49,7 +49,7 @@
49
49
  "es-toolkit": "^1.32.0",
50
50
  "mime": "^4.0.4",
51
51
  "verkit": "0.4.0",
52
- "@hot-updater/core": "1.0.0-rc.14"
52
+ "@hot-updater/core": "1.0.0-rc.15"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/node": "^20",
@@ -1,25 +0,0 @@
1
- //#region src/calculatePagination.ts
2
- /**
3
- * Calculate pagination information based on total count, limit, and offset
4
- */
5
- function calculatePagination(total, options) {
6
- const { limit, offset } = options;
7
- if (total === 0) return {
8
- total: 0,
9
- hasNextPage: false,
10
- hasPreviousPage: false,
11
- currentPage: 1,
12
- totalPages: 0
13
- };
14
- const currentPage = Math.floor(offset / limit) + 1;
15
- const totalPages = Math.ceil(total / limit);
16
- return {
17
- total,
18
- hasNextPage: offset + limit < total,
19
- hasPreviousPage: offset > 0,
20
- currentPage,
21
- totalPages
22
- };
23
- }
24
- //#endregion
25
- exports.calculatePagination = calculatePagination;
@@ -1,12 +0,0 @@
1
- import { PaginationInfo } from "./types/index.cjs";
2
- //#region src/calculatePagination.d.ts
3
- interface PaginationOptions {
4
- limit: number;
5
- offset: number;
6
- }
7
- /**
8
- * Calculate pagination information based on total count, limit, and offset
9
- */
10
- declare function calculatePagination(total: number, options: PaginationOptions): PaginationInfo;
11
- //#endregion
12
- export { PaginationOptions, calculatePagination };
@@ -1,12 +0,0 @@
1
- import { PaginationInfo } from "./types/index.mjs";
2
- //#region src/calculatePagination.d.ts
3
- interface PaginationOptions {
4
- limit: number;
5
- offset: number;
6
- }
7
- /**
8
- * Calculate pagination information based on total count, limit, and offset
9
- */
10
- declare function calculatePagination(total: number, options: PaginationOptions): PaginationInfo;
11
- //#endregion
12
- export { PaginationOptions, calculatePagination };
@@ -1,25 +0,0 @@
1
- //#region src/calculatePagination.ts
2
- /**
3
- * Calculate pagination information based on total count, limit, and offset
4
- */
5
- function calculatePagination(total, options) {
6
- const { limit, offset } = options;
7
- if (total === 0) return {
8
- total: 0,
9
- hasNextPage: false,
10
- hasPreviousPage: false,
11
- currentPage: 1,
12
- totalPages: 0
13
- };
14
- const currentPage = Math.floor(offset / limit) + 1;
15
- const totalPages = Math.ceil(total / limit);
16
- return {
17
- total,
18
- hasNextPage: offset + limit < total,
19
- hasPreviousPage: offset > 0,
20
- currentPage,
21
- totalPages
22
- };
23
- }
24
- //#endregion
25
- export { calculatePagination };
@@ -1,62 +0,0 @@
1
- const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
2
- let mime = require("mime");
3
- mime = require_runtime.__toESM(mime, 1);
4
- //#region src/compressionFormat.ts
5
- /**
6
- * Compression formats registry
7
- * Add new formats here to support additional compression types
8
- */
9
- const COMPRESSION_FORMATS = {
10
- zip: {
11
- format: "zip",
12
- fileExtension: ".zip",
13
- mimeType: "application/zip"
14
- },
15
- "tar.br": {
16
- format: "tar.br",
17
- fileExtension: ".tar.br",
18
- mimeType: "application/x-tar"
19
- },
20
- "tar.gz": {
21
- format: "tar.gz",
22
- fileExtension: ".tar.gz",
23
- mimeType: "application/x-tar"
24
- }
25
- };
26
- /**
27
- * Finds the compression format matching a filename extension
28
- * @param filename The filename to match
29
- * @returns Compression format information, or undefined when nothing matches
30
- */
31
- function findCompressionFormat(filename) {
32
- return Object.values(COMPRESSION_FORMATS).find((info) => filename.endsWith(info.fileExtension));
33
- }
34
- /**
35
- * Detects compression format from filename
36
- * @param filename The filename to detect format from
37
- * @returns Compression format information
38
- */
39
- function detectCompressionFormat(filename) {
40
- return findCompressionFormat(filename) ?? COMPRESSION_FORMATS.zip;
41
- }
42
- /**
43
- * Gets MIME type for a filename
44
- * @param filename The filename to get MIME type for
45
- * @returns MIME type string, or undefined when the filename is not an archive
46
- */
47
- function getCompressionMimeType(filename) {
48
- return findCompressionFormat(filename)?.mimeType;
49
- }
50
- /**
51
- * Gets Content-Type for a bundle file with 3-tier fallback
52
- * @param bundlePath The bundle file path
53
- * @returns Content-Type string (never undefined, falls back to application/octet-stream)
54
- */
55
- function getContentType(bundlePath) {
56
- const filename = bundlePath.replace(/[\\/]+$/, "").split(/[\\/]/).pop();
57
- return mime.default.getType(bundlePath) ?? getCompressionMimeType(filename ?? "") ?? "application/octet-stream";
58
- }
59
- //#endregion
60
- exports.detectCompressionFormat = detectCompressionFormat;
61
- exports.getCompressionMimeType = getCompressionMimeType;
62
- exports.getContentType = getContentType;