@hot-updater/supabase 1.0.0-rc.30 → 1.0.0-rc.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/edge.d.cts +1 -1
- package/dist/edge.d.mts +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/{supabaseDatabase-D2ZXEuiO.d.cts → supabaseDatabase-DI1nx1KE.d.cts} +24 -116
- package/dist/{supabaseDatabase-D2ZXEuiO.d.mts → supabaseDatabase-DI1nx1KE.d.mts} +24 -116
- package/package.json +8 -8
- package/supabase/migrations/20260818000000_hot-updater_1.0.0.sql +2 -4
- package/supabase/migrations/20261003000000_hot-updater_1.0.0-rc.30.sql +0 -217
package/dist/edge.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as plugins, n as supabaseDatabase, t as SupabaseDatabaseConfig } from "./supabaseDatabase-
|
|
1
|
+
import { i as plugins, n as supabaseDatabase, t as SupabaseDatabaseConfig } from "./supabaseDatabase-DI1nx1KE.cjs";
|
|
2
2
|
import { StorageAdapterWith } from "@hot-updater/plugin-core";
|
|
3
3
|
//#region src/supabaseEdgeFunctionStorage.d.ts
|
|
4
4
|
interface SupabaseEdgeFunctionStorageConfig {
|
package/dist/edge.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as plugins, n as supabaseDatabase, t as SupabaseDatabaseConfig } from "./supabaseDatabase-
|
|
1
|
+
import { i as plugins, n as supabaseDatabase, t as SupabaseDatabaseConfig } from "./supabaseDatabase-DI1nx1KE.mjs";
|
|
2
2
|
import { StorageAdapterWith } from "@hot-updater/plugin-core";
|
|
3
3
|
//#region src/supabaseEdgeFunctionStorage.d.ts
|
|
4
4
|
interface SupabaseEdgeFunctionStorageConfig {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as plugins, r as SupabaseServiceRoleConfig, t as SupabaseDatabaseConfig } from "./supabaseDatabase-
|
|
1
|
+
import { i as plugins, r as SupabaseServiceRoleConfig, t as SupabaseDatabaseConfig } from "./supabaseDatabase-DI1nx1KE.cjs";
|
|
2
2
|
import { StorageAdapterWith, ToolingDatabase } from "@hot-updater/plugin-core";
|
|
3
3
|
//#region src/supabaseMigration.d.ts
|
|
4
4
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as plugins, r as SupabaseServiceRoleConfig, t as SupabaseDatabaseConfig } from "./supabaseDatabase-
|
|
1
|
+
import { i as plugins, r as SupabaseServiceRoleConfig, t as SupabaseDatabaseConfig } from "./supabaseDatabase-DI1nx1KE.mjs";
|
|
2
2
|
import { StorageAdapterWith, ToolingDatabase } from "@hot-updater/plugin-core";
|
|
3
3
|
//#region src/supabaseMigration.d.ts
|
|
4
4
|
/**
|
|
@@ -132,6 +132,19 @@ interface InsightsCountEventsInput {
|
|
|
132
132
|
readonly sinceMs: number;
|
|
133
133
|
readonly beforeReceivedAtMs: number;
|
|
134
134
|
}
|
|
135
|
+
/** One bundle filter's stored events in each interval of a time range. */
|
|
136
|
+
interface InsightsCountEventSeriesInput {
|
|
137
|
+
readonly filter: InsightsBundleEventFilter;
|
|
138
|
+
/** Whole UTC hours, at most 90 days, that a whole number of intervals fill. */
|
|
139
|
+
readonly timeRange: InsightsTimeRange;
|
|
140
|
+
/** Whole hours each point spans, from `timeRange.start`. */
|
|
141
|
+
readonly intervalMs: number;
|
|
142
|
+
}
|
|
143
|
+
/** Stored events in [startMs, startMs + intervalMs). */
|
|
144
|
+
interface InsightsEventSeriesPoint {
|
|
145
|
+
readonly startMs: number;
|
|
146
|
+
readonly events: number;
|
|
147
|
+
}
|
|
135
148
|
interface ReleaseReference {
|
|
136
149
|
readonly releaseId: string;
|
|
137
150
|
readonly platform: "ios" | "android";
|
|
@@ -150,44 +163,22 @@ type InsightsCoverage = {
|
|
|
150
163
|
readonly kind: "partial";
|
|
151
164
|
readonly sinceMs: number | null;
|
|
152
165
|
};
|
|
166
|
+
/**
|
|
167
|
+
* A release's counts since its first report, from its lifetime counters,
|
|
168
|
+
* which are kept.
|
|
169
|
+
*/
|
|
153
170
|
interface ReleaseActivityMetrics {
|
|
154
171
|
readonly downloads: number;
|
|
155
172
|
readonly launches: number;
|
|
156
173
|
readonly failedLaunches: number;
|
|
157
|
-
/** Omitted for lifetime-only bundle-row reads. */
|
|
158
|
-
readonly uniqueUsers?: number;
|
|
159
|
-
/**
|
|
160
|
-
* Points of each UTC day, or of each `intervalMs` from the period's start
|
|
161
|
-
* on a release read that asks for one; present only for period reads.
|
|
162
|
-
*/
|
|
163
|
-
readonly series?: readonly {
|
|
164
|
-
readonly startMs: number;
|
|
165
|
-
readonly downloads: number;
|
|
166
|
-
readonly launches: number;
|
|
167
|
-
readonly failedLaunches: number;
|
|
168
|
-
}[];
|
|
169
174
|
}
|
|
170
|
-
|
|
175
|
+
interface InsightsGetReleaseActivityInput {
|
|
176
|
+
/** 1 to 100 releases. */
|
|
171
177
|
readonly releases: readonly ReleaseReference[];
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Whole hours each series point spans, from `timeRange.start`, with
|
|
175
|
-
* every point present; omitted, the series has a point per UTC day
|
|
176
|
-
* with reports. Only with a `timeRange`.
|
|
177
|
-
*/
|
|
178
|
-
readonly intervalMs?: number;
|
|
179
|
-
readonly scope?: never;
|
|
180
|
-
} | {
|
|
181
|
-
readonly scope: InsightsScope;
|
|
182
|
-
readonly timeRange: InsightsTimeRange;
|
|
183
|
-
readonly intervalMs?: never;
|
|
184
|
-
readonly releases?: never;
|
|
185
|
-
};
|
|
178
|
+
}
|
|
186
179
|
interface InsightsGetReleaseActivityResult {
|
|
187
|
-
readonly coverage: InsightsCoverage;
|
|
188
180
|
readonly data: readonly {
|
|
189
|
-
readonly release
|
|
190
|
-
readonly scope?: InsightsScope;
|
|
181
|
+
readonly release: ReleaseReference;
|
|
191
182
|
readonly metrics: ReleaseActivityMetrics;
|
|
192
183
|
}[];
|
|
193
184
|
readonly measuredAtMs: number;
|
|
@@ -223,23 +214,6 @@ interface InsightsGetAppUsageResult {
|
|
|
223
214
|
}[];
|
|
224
215
|
readonly measuredAtMs: number;
|
|
225
216
|
}
|
|
226
|
-
/** Whole UTC days, at most 31, including the current unfinished day. */
|
|
227
|
-
interface InsightsGetDistributionHistoryInput extends InsightsScope {
|
|
228
|
-
readonly timeRange: InsightsTimeRange;
|
|
229
|
-
}
|
|
230
|
-
interface InsightsGetDistributionHistoryResult {
|
|
231
|
-
readonly coverage: InsightsCoverage;
|
|
232
|
-
readonly measuredAtMs: number;
|
|
233
|
-
readonly points: readonly {
|
|
234
|
-
readonly startMs: number;
|
|
235
|
-
readonly bundles: readonly {
|
|
236
|
-
readonly appVersion: string;
|
|
237
|
-
readonly releaseId: string | null;
|
|
238
|
-
readonly bundleKind: "release" | "builtin" | "unknown";
|
|
239
|
-
readonly installations: number;
|
|
240
|
-
}[];
|
|
241
|
-
}[];
|
|
242
|
-
}
|
|
243
217
|
//#endregion
|
|
244
218
|
//#region ../insights/dist/server/schema.d.mts
|
|
245
219
|
//#region src/server/schema.d.ts
|
|
@@ -393,10 +367,6 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
|
|
|
393
367
|
movement_install_id: "string";
|
|
394
368
|
bundle_ref: "string";
|
|
395
369
|
}, {
|
|
396
|
-
readonly recent: {
|
|
397
|
-
readonly eq: readonly ["channel", "platform", "day"];
|
|
398
|
-
readonly sort: readonly ["received_at_ms"];
|
|
399
|
-
};
|
|
400
370
|
readonly movementsByInstall: {
|
|
401
371
|
readonly eq: readonly ["movement_install_id"];
|
|
402
372
|
readonly sort: readonly ["received_at_ms"];
|
|
@@ -496,7 +466,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
|
|
|
496
466
|
readonly eq: readonly ["identity"];
|
|
497
467
|
readonly sort: readonly ["bucket_start_ms"];
|
|
498
468
|
};
|
|
499
|
-
}, "
|
|
469
|
+
}, "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
|
|
500
470
|
readonly insights_overview_daily: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
501
471
|
readonly identity: {
|
|
502
472
|
readonly type: "string";
|
|
@@ -524,7 +494,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
|
|
|
524
494
|
readonly eq: readonly ["identity"];
|
|
525
495
|
readonly sort: readonly ["bucket_start_ms"];
|
|
526
496
|
};
|
|
527
|
-
}, "
|
|
497
|
+
}, "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
|
|
528
498
|
readonly insights_overview_lifetime: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
529
499
|
readonly identity: {
|
|
530
500
|
readonly type: "string";
|
|
@@ -581,68 +551,6 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
|
|
|
581
551
|
readonly sort: readonly ["bucket_start_ms"];
|
|
582
552
|
};
|
|
583
553
|
}, never, readonly ["channel", "platform", "app_version", "release_id", "bucket_start_ms"]>;
|
|
584
|
-
readonly bundle_daily_heads: import("@hot-updater/plugin-core").TableDefinition<{
|
|
585
|
-
readonly install_id: {
|
|
586
|
-
readonly type: "string";
|
|
587
|
-
readonly maxLength: 255;
|
|
588
|
-
};
|
|
589
|
-
readonly bucket_start_ms: {
|
|
590
|
-
readonly type: "integer";
|
|
591
|
-
};
|
|
592
|
-
readonly id: {
|
|
593
|
-
readonly type: "string";
|
|
594
|
-
readonly maxLength: 36;
|
|
595
|
-
};
|
|
596
|
-
readonly received_at_ms: {
|
|
597
|
-
readonly type: "integer";
|
|
598
|
-
};
|
|
599
|
-
readonly channel: {
|
|
600
|
-
readonly type: "string";
|
|
601
|
-
};
|
|
602
|
-
readonly platform: {
|
|
603
|
-
readonly type: "string";
|
|
604
|
-
readonly maxLength: 16;
|
|
605
|
-
};
|
|
606
|
-
readonly app_version: {
|
|
607
|
-
readonly type: "string";
|
|
608
|
-
};
|
|
609
|
-
readonly release_id: {
|
|
610
|
-
readonly type: "string";
|
|
611
|
-
readonly maxLength: 36;
|
|
612
|
-
};
|
|
613
|
-
readonly bundle_kind: {
|
|
614
|
-
readonly type: "string";
|
|
615
|
-
readonly maxLength: 16;
|
|
616
|
-
};
|
|
617
|
-
}, Readonly<Record<string, import("@hot-updater/plugin-core").FieldType>>, {}, readonly ["install_id", "bucket_start_ms"]>;
|
|
618
|
-
readonly insights_distribution_history: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
619
|
-
readonly channel: {
|
|
620
|
-
readonly type: "string";
|
|
621
|
-
};
|
|
622
|
-
readonly platform: {
|
|
623
|
-
readonly type: "string";
|
|
624
|
-
readonly maxLength: 16;
|
|
625
|
-
};
|
|
626
|
-
readonly app_version: {
|
|
627
|
-
readonly type: "string";
|
|
628
|
-
};
|
|
629
|
-
readonly release_id: {
|
|
630
|
-
readonly type: "string";
|
|
631
|
-
readonly maxLength: 36;
|
|
632
|
-
};
|
|
633
|
-
readonly bundle_kind: {
|
|
634
|
-
readonly type: "string";
|
|
635
|
-
readonly maxLength: 16;
|
|
636
|
-
};
|
|
637
|
-
readonly bucket_start_ms: {
|
|
638
|
-
readonly type: "integer";
|
|
639
|
-
};
|
|
640
|
-
}, "installations", {
|
|
641
|
-
readonly byScope: {
|
|
642
|
-
readonly eq: readonly ["channel", "platform"];
|
|
643
|
-
readonly sort: readonly ["bucket_start_ms"];
|
|
644
|
-
};
|
|
645
|
-
}, never, readonly ["channel", "platform", "app_version", "release_id", "bundle_kind", "bucket_start_ms"]>;
|
|
646
554
|
readonly insights_latest_by_bundle: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
647
555
|
readonly platform: {
|
|
648
556
|
readonly type: "string";
|
|
@@ -738,8 +646,8 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
|
|
|
738
646
|
findLatestEvents: (input: InsightsFindLatestEventsInput) => Promise<readonly BundleEventRow[]>;
|
|
739
647
|
countLatestEvents: (input: InsightsCountLatestEventsInput) => Promise<number>;
|
|
740
648
|
countEvents: (input: InsightsCountEventsInput) => Promise<number>;
|
|
649
|
+
countEventSeries: (input: InsightsCountEventSeriesInput) => Promise<readonly InsightsEventSeriesPoint[]>;
|
|
741
650
|
getReleaseActivity: (input: InsightsGetReleaseActivityInput) => Promise<InsightsGetReleaseActivityResult>;
|
|
742
|
-
getDistributionHistory: (input: InsightsGetDistributionHistoryInput) => Promise<InsightsGetDistributionHistoryResult>;
|
|
743
651
|
getAppUsage: (input: InsightsGetAppUsageInput) => Promise<InsightsGetAppUsageResult>;
|
|
744
652
|
getUpdateFailures: (input: InsightsUpdateFailuresInput) => Promise<InsightsUpdateFailures>;
|
|
745
653
|
};
|
|
@@ -132,6 +132,19 @@ interface InsightsCountEventsInput {
|
|
|
132
132
|
readonly sinceMs: number;
|
|
133
133
|
readonly beforeReceivedAtMs: number;
|
|
134
134
|
}
|
|
135
|
+
/** One bundle filter's stored events in each interval of a time range. */
|
|
136
|
+
interface InsightsCountEventSeriesInput {
|
|
137
|
+
readonly filter: InsightsBundleEventFilter;
|
|
138
|
+
/** Whole UTC hours, at most 90 days, that a whole number of intervals fill. */
|
|
139
|
+
readonly timeRange: InsightsTimeRange;
|
|
140
|
+
/** Whole hours each point spans, from `timeRange.start`. */
|
|
141
|
+
readonly intervalMs: number;
|
|
142
|
+
}
|
|
143
|
+
/** Stored events in [startMs, startMs + intervalMs). */
|
|
144
|
+
interface InsightsEventSeriesPoint {
|
|
145
|
+
readonly startMs: number;
|
|
146
|
+
readonly events: number;
|
|
147
|
+
}
|
|
135
148
|
interface ReleaseReference {
|
|
136
149
|
readonly releaseId: string;
|
|
137
150
|
readonly platform: "ios" | "android";
|
|
@@ -150,44 +163,22 @@ type InsightsCoverage = {
|
|
|
150
163
|
readonly kind: "partial";
|
|
151
164
|
readonly sinceMs: number | null;
|
|
152
165
|
};
|
|
166
|
+
/**
|
|
167
|
+
* A release's counts since its first report, from its lifetime counters,
|
|
168
|
+
* which are kept.
|
|
169
|
+
*/
|
|
153
170
|
interface ReleaseActivityMetrics {
|
|
154
171
|
readonly downloads: number;
|
|
155
172
|
readonly launches: number;
|
|
156
173
|
readonly failedLaunches: number;
|
|
157
|
-
/** Omitted for lifetime-only bundle-row reads. */
|
|
158
|
-
readonly uniqueUsers?: number;
|
|
159
|
-
/**
|
|
160
|
-
* Points of each UTC day, or of each `intervalMs` from the period's start
|
|
161
|
-
* on a release read that asks for one; present only for period reads.
|
|
162
|
-
*/
|
|
163
|
-
readonly series?: readonly {
|
|
164
|
-
readonly startMs: number;
|
|
165
|
-
readonly downloads: number;
|
|
166
|
-
readonly launches: number;
|
|
167
|
-
readonly failedLaunches: number;
|
|
168
|
-
}[];
|
|
169
174
|
}
|
|
170
|
-
|
|
175
|
+
interface InsightsGetReleaseActivityInput {
|
|
176
|
+
/** 1 to 100 releases. */
|
|
171
177
|
readonly releases: readonly ReleaseReference[];
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Whole hours each series point spans, from `timeRange.start`, with
|
|
175
|
-
* every point present; omitted, the series has a point per UTC day
|
|
176
|
-
* with reports. Only with a `timeRange`.
|
|
177
|
-
*/
|
|
178
|
-
readonly intervalMs?: number;
|
|
179
|
-
readonly scope?: never;
|
|
180
|
-
} | {
|
|
181
|
-
readonly scope: InsightsScope;
|
|
182
|
-
readonly timeRange: InsightsTimeRange;
|
|
183
|
-
readonly intervalMs?: never;
|
|
184
|
-
readonly releases?: never;
|
|
185
|
-
};
|
|
178
|
+
}
|
|
186
179
|
interface InsightsGetReleaseActivityResult {
|
|
187
|
-
readonly coverage: InsightsCoverage;
|
|
188
180
|
readonly data: readonly {
|
|
189
|
-
readonly release
|
|
190
|
-
readonly scope?: InsightsScope;
|
|
181
|
+
readonly release: ReleaseReference;
|
|
191
182
|
readonly metrics: ReleaseActivityMetrics;
|
|
192
183
|
}[];
|
|
193
184
|
readonly measuredAtMs: number;
|
|
@@ -223,23 +214,6 @@ interface InsightsGetAppUsageResult {
|
|
|
223
214
|
}[];
|
|
224
215
|
readonly measuredAtMs: number;
|
|
225
216
|
}
|
|
226
|
-
/** Whole UTC days, at most 31, including the current unfinished day. */
|
|
227
|
-
interface InsightsGetDistributionHistoryInput extends InsightsScope {
|
|
228
|
-
readonly timeRange: InsightsTimeRange;
|
|
229
|
-
}
|
|
230
|
-
interface InsightsGetDistributionHistoryResult {
|
|
231
|
-
readonly coverage: InsightsCoverage;
|
|
232
|
-
readonly measuredAtMs: number;
|
|
233
|
-
readonly points: readonly {
|
|
234
|
-
readonly startMs: number;
|
|
235
|
-
readonly bundles: readonly {
|
|
236
|
-
readonly appVersion: string;
|
|
237
|
-
readonly releaseId: string | null;
|
|
238
|
-
readonly bundleKind: "release" | "builtin" | "unknown";
|
|
239
|
-
readonly installations: number;
|
|
240
|
-
}[];
|
|
241
|
-
}[];
|
|
242
|
-
}
|
|
243
217
|
//#endregion
|
|
244
218
|
//#region ../insights/dist/server/schema.d.mts
|
|
245
219
|
//#region src/server/schema.d.ts
|
|
@@ -393,10 +367,6 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
|
|
|
393
367
|
movement_install_id: "string";
|
|
394
368
|
bundle_ref: "string";
|
|
395
369
|
}, {
|
|
396
|
-
readonly recent: {
|
|
397
|
-
readonly eq: readonly ["channel", "platform", "day"];
|
|
398
|
-
readonly sort: readonly ["received_at_ms"];
|
|
399
|
-
};
|
|
400
370
|
readonly movementsByInstall: {
|
|
401
371
|
readonly eq: readonly ["movement_install_id"];
|
|
402
372
|
readonly sort: readonly ["received_at_ms"];
|
|
@@ -496,7 +466,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
|
|
|
496
466
|
readonly eq: readonly ["identity"];
|
|
497
467
|
readonly sort: readonly ["bucket_start_ms"];
|
|
498
468
|
};
|
|
499
|
-
}, "
|
|
469
|
+
}, "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
|
|
500
470
|
readonly insights_overview_daily: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
501
471
|
readonly identity: {
|
|
502
472
|
readonly type: "string";
|
|
@@ -524,7 +494,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
|
|
|
524
494
|
readonly eq: readonly ["identity"];
|
|
525
495
|
readonly sort: readonly ["bucket_start_ms"];
|
|
526
496
|
};
|
|
527
|
-
}, "
|
|
497
|
+
}, "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
|
|
528
498
|
readonly insights_overview_lifetime: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
529
499
|
readonly identity: {
|
|
530
500
|
readonly type: "string";
|
|
@@ -581,68 +551,6 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
|
|
|
581
551
|
readonly sort: readonly ["bucket_start_ms"];
|
|
582
552
|
};
|
|
583
553
|
}, never, readonly ["channel", "platform", "app_version", "release_id", "bucket_start_ms"]>;
|
|
584
|
-
readonly bundle_daily_heads: import("@hot-updater/plugin-core").TableDefinition<{
|
|
585
|
-
readonly install_id: {
|
|
586
|
-
readonly type: "string";
|
|
587
|
-
readonly maxLength: 255;
|
|
588
|
-
};
|
|
589
|
-
readonly bucket_start_ms: {
|
|
590
|
-
readonly type: "integer";
|
|
591
|
-
};
|
|
592
|
-
readonly id: {
|
|
593
|
-
readonly type: "string";
|
|
594
|
-
readonly maxLength: 36;
|
|
595
|
-
};
|
|
596
|
-
readonly received_at_ms: {
|
|
597
|
-
readonly type: "integer";
|
|
598
|
-
};
|
|
599
|
-
readonly channel: {
|
|
600
|
-
readonly type: "string";
|
|
601
|
-
};
|
|
602
|
-
readonly platform: {
|
|
603
|
-
readonly type: "string";
|
|
604
|
-
readonly maxLength: 16;
|
|
605
|
-
};
|
|
606
|
-
readonly app_version: {
|
|
607
|
-
readonly type: "string";
|
|
608
|
-
};
|
|
609
|
-
readonly release_id: {
|
|
610
|
-
readonly type: "string";
|
|
611
|
-
readonly maxLength: 36;
|
|
612
|
-
};
|
|
613
|
-
readonly bundle_kind: {
|
|
614
|
-
readonly type: "string";
|
|
615
|
-
readonly maxLength: 16;
|
|
616
|
-
};
|
|
617
|
-
}, Readonly<Record<string, import("@hot-updater/plugin-core").FieldType>>, {}, readonly ["install_id", "bucket_start_ms"]>;
|
|
618
|
-
readonly insights_distribution_history: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
619
|
-
readonly channel: {
|
|
620
|
-
readonly type: "string";
|
|
621
|
-
};
|
|
622
|
-
readonly platform: {
|
|
623
|
-
readonly type: "string";
|
|
624
|
-
readonly maxLength: 16;
|
|
625
|
-
};
|
|
626
|
-
readonly app_version: {
|
|
627
|
-
readonly type: "string";
|
|
628
|
-
};
|
|
629
|
-
readonly release_id: {
|
|
630
|
-
readonly type: "string";
|
|
631
|
-
readonly maxLength: 36;
|
|
632
|
-
};
|
|
633
|
-
readonly bundle_kind: {
|
|
634
|
-
readonly type: "string";
|
|
635
|
-
readonly maxLength: 16;
|
|
636
|
-
};
|
|
637
|
-
readonly bucket_start_ms: {
|
|
638
|
-
readonly type: "integer";
|
|
639
|
-
};
|
|
640
|
-
}, "installations", {
|
|
641
|
-
readonly byScope: {
|
|
642
|
-
readonly eq: readonly ["channel", "platform"];
|
|
643
|
-
readonly sort: readonly ["bucket_start_ms"];
|
|
644
|
-
};
|
|
645
|
-
}, never, readonly ["channel", "platform", "app_version", "release_id", "bundle_kind", "bucket_start_ms"]>;
|
|
646
554
|
readonly insights_latest_by_bundle: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
647
555
|
readonly platform: {
|
|
648
556
|
readonly type: "string";
|
|
@@ -738,8 +646,8 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
|
|
|
738
646
|
findLatestEvents: (input: InsightsFindLatestEventsInput) => Promise<readonly BundleEventRow[]>;
|
|
739
647
|
countLatestEvents: (input: InsightsCountLatestEventsInput) => Promise<number>;
|
|
740
648
|
countEvents: (input: InsightsCountEventsInput) => Promise<number>;
|
|
649
|
+
countEventSeries: (input: InsightsCountEventSeriesInput) => Promise<readonly InsightsEventSeriesPoint[]>;
|
|
741
650
|
getReleaseActivity: (input: InsightsGetReleaseActivityInput) => Promise<InsightsGetReleaseActivityResult>;
|
|
742
|
-
getDistributionHistory: (input: InsightsGetDistributionHistoryInput) => Promise<InsightsGetDistributionHistoryResult>;
|
|
743
651
|
getAppUsage: (input: InsightsGetAppUsageInput) => Promise<InsightsGetAppUsageResult>;
|
|
744
652
|
getUpdateFailures: (input: InsightsUpdateFailuresInput) => Promise<InsightsUpdateFailures>;
|
|
745
653
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/supabase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.32",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.mjs",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"@supabase/supabase-js": "2.76.1",
|
|
52
52
|
"hono": "4.12.34",
|
|
53
53
|
"uuidv7": "^1.0.2",
|
|
54
|
-
"@hot-updater/
|
|
55
|
-
"@hot-updater/
|
|
56
|
-
"@hot-updater/cli-tools": "1.0.0-rc.
|
|
57
|
-
"@hot-updater/
|
|
54
|
+
"@hot-updater/protocol": "1.0.0-rc.29",
|
|
55
|
+
"@hot-updater/plugin-core": "1.0.0-rc.29",
|
|
56
|
+
"@hot-updater/cli-tools": "1.0.0-rc.32",
|
|
57
|
+
"@hot-updater/server": "1.0.0-rc.32"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@electric-sql/pglite": "0.4.1",
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"execa": "9.5.2",
|
|
65
65
|
"@types/node": "^20",
|
|
66
66
|
"mime": "^4.0.4",
|
|
67
|
-
"@hot-updater/mock": "1.0.0-rc.
|
|
68
|
-
"@hot-updater/
|
|
69
|
-
"@hot-updater/
|
|
67
|
+
"@hot-updater/mock": "1.0.0-rc.29",
|
|
68
|
+
"@hot-updater/test-utils": "1.0.0-rc.30",
|
|
69
|
+
"@hot-updater/postgres": "1.0.0-rc.32"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
72
72
|
"build": "tsdown",
|
|
@@ -38,8 +38,6 @@ CREATE TABLE IF NOT EXISTS "hot_updater_v1_bundle_totals" ("platform_key" varcha
|
|
|
38
38
|
|
|
39
39
|
CREATE TABLE IF NOT EXISTS "hot_updater_v1_bundle_events" ("id" varchar(36) COLLATE "C" NOT NULL, "type" varchar(32) COLLATE "C" NOT NULL, "install_id" varchar(255) COLLATE "C" NOT NULL, "user_id" varchar(255) COLLATE "C", "from_release_id" varchar(36) COLLATE "C", "from_bundle_id" varchar(36) COLLATE "C", "to_release_id" varchar(36) COLLATE "C", "to_bundle_id" varchar(36) COLLATE "C" NOT NULL, "platform" varchar(16) COLLATE "C" NOT NULL, "app_version" text COLLATE "C" NOT NULL, "channel" text COLLATE "C" NOT NULL, "metadata" jsonb NOT NULL, "received_at_ms" bigint NOT NULL, "day" bigint, "movement_install_id" text COLLATE "C", "bundle_ref" jsonb, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("id"));
|
|
40
40
|
|
|
41
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_bundle_events_recent" ON "hot_updater_v1_bundle_events" ("channel", "platform", "day", "received_at_ms", "id");
|
|
42
|
-
|
|
43
41
|
CREATE INDEX IF NOT EXISTS "hot_updater_v1_bundle_events_movementsByInstall" ON "hot_updater_v1_bundle_events" ("movement_install_id", "received_at_ms", "id");
|
|
44
42
|
|
|
45
43
|
CREATE TABLE IF NOT EXISTS "hot_updater_v1_bundle_events__byBundle" ("platform" varchar(16) COLLATE "C" NOT NULL, "channel" text COLLATE "C" NOT NULL, "type" varchar(32) COLLATE "C" NOT NULL, "bundle_ref" text COLLATE "C" NOT NULL, "day" bigint NOT NULL, "received_at_ms" bigint NOT NULL, "id" varchar(36) COLLATE "C" NOT NULL, PRIMARY KEY ("platform", "channel", "type", "bundle_ref", "day", "received_at_ms", "id"));
|
|
@@ -56,7 +54,7 @@ CREATE TABLE IF NOT EXISTS "hot_updater_v1_insights_overview" ("identity" varcha
|
|
|
56
54
|
|
|
57
55
|
CREATE INDEX IF NOT EXISTS "hot_updater_v1_insights_overview__retention" ON "hot_updater_v1_insights_overview" ("bucket_start_ms", "identity", "_shard");
|
|
58
56
|
|
|
59
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_insights_sketches" ("identity" varchar(32) COLLATE "C" NOT NULL, "bucket_start_ms" bigint NOT NULL, "_shard" bigint NOT NULL, "
|
|
57
|
+
CREATE TABLE IF NOT EXISTS "hot_updater_v1_insights_sketches" ("identity" varchar(32) COLLATE "C" NOT NULL, "bucket_start_ms" bigint NOT NULL, "_shard" bigint NOT NULL, "activity_users" text COLLATE "C", "failed_users" text COLLATE "C", "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("identity", "bucket_start_ms", "_shard"));
|
|
60
58
|
|
|
61
59
|
CREATE INDEX IF NOT EXISTS "hot_updater_v1_insights_sketches__retention" ON "hot_updater_v1_insights_sketches" ("bucket_start_ms", "identity", "_shard");
|
|
62
60
|
|
|
@@ -64,7 +62,7 @@ CREATE TABLE IF NOT EXISTS "hot_updater_v1_insights_overview_daily" ("identity"
|
|
|
64
62
|
|
|
65
63
|
CREATE INDEX IF NOT EXISTS "hot_updater_v1_insights_overview_daily__retention" ON "hot_updater_v1_insights_overview_daily" ("bucket_start_ms", "identity", "_shard");
|
|
66
64
|
|
|
67
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_insights_sketches_daily" ("identity" varchar(32) COLLATE "C" NOT NULL, "bucket_start_ms" bigint NOT NULL, "_shard" bigint NOT NULL, "
|
|
65
|
+
CREATE TABLE IF NOT EXISTS "hot_updater_v1_insights_sketches_daily" ("identity" varchar(32) COLLATE "C" NOT NULL, "bucket_start_ms" bigint NOT NULL, "_shard" bigint NOT NULL, "activity_users" text COLLATE "C", "failed_users" text COLLATE "C", "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("identity", "bucket_start_ms", "_shard"));
|
|
68
66
|
|
|
69
67
|
CREATE INDEX IF NOT EXISTS "hot_updater_v1_insights_sketches_daily__retention" ON "hot_updater_v1_insights_sketches_daily" ("bucket_start_ms", "identity", "_shard");
|
|
70
68
|
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
-- HotUpdater.schema
|
|
2
|
-
|
|
3
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1__hu_write" ("id" varchar(36) COLLATE "C" NOT NULL, "failed_op" bigint, PRIMARY KEY ("id"));
|
|
4
|
-
|
|
5
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_bundles" ("id" varchar(36) COLLATE "C" NOT NULL, "platform" varchar(16) COLLATE "C" NOT NULL, "git_commit_hash" varchar(255) COLLATE "C", "metadata" jsonb NOT NULL, "manifest_storage_uri" text COLLATE "C" NOT NULL, "manifest_file_hash" text COLLATE "C" NOT NULL, "asset_base_storage_uri" text COLLATE "C" NOT NULL, "_refs_bundle_patches_bundle_id" bigint NOT NULL DEFAULT 0, "_refs_bundle_patches_base_bundle_id" bigint NOT NULL DEFAULT 0, "_refs_releases_bundle_id" bigint NOT NULL DEFAULT 0, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("id"));
|
|
6
|
-
|
|
7
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_bundles_byPlatform" ON "hot_updater_v1_bundles" ("platform", "id");
|
|
8
|
-
|
|
9
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_bundle_patches" ("id" varchar(255) COLLATE "C" NOT NULL, "bundle_id" varchar(36) COLLATE "C" NOT NULL, "base_bundle_id" varchar(36) COLLATE "C" NOT NULL, "base_file_hash" text COLLATE "C" NOT NULL, "patch_file_hash" text COLLATE "C" NOT NULL, "patch_storage_uri" text COLLATE "C" NOT NULL, "byte_size" bigint NOT NULL, "order_index" bigint NOT NULL, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("id"));
|
|
10
|
-
|
|
11
|
-
CREATE UNIQUE INDEX IF NOT EXISTS "hot_updater_v1_bundle_patches_pair" ON "hot_updater_v1_bundle_patches" ("bundle_id", "base_bundle_id");
|
|
12
|
-
|
|
13
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_bundle_patches_byBundle" ON "hot_updater_v1_bundle_patches" ("bundle_id", "order_index", "id");
|
|
14
|
-
|
|
15
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_bundle_patches_byBase" ON "hot_updater_v1_bundle_patches" ("base_bundle_id", "bundle_id", "id");
|
|
16
|
-
|
|
17
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_releases" ("id" varchar(36) COLLATE "C" NOT NULL, "revision" bigint NOT NULL, "scope_key" varchar(2048) COLLATE "C" NOT NULL, "channel_id" varchar(1408) COLLATE "C" NOT NULL, "platform" varchar(16) COLLATE "C" NOT NULL, "kind" varchar(16) COLLATE "C" NOT NULL, "bundle_id" varchar(36) COLLATE "C", "strategy" varchar(16) COLLATE "C" NOT NULL, "target_app_version" text COLLATE "C", "fingerprint_hash" varchar(255) COLLATE "C", "enabled" boolean NOT NULL, "should_force_update" boolean NOT NULL, "message" text COLLATE "C", "rollout_cohort_count" bigint NOT NULL, "target_cohorts" jsonb NOT NULL, "operation" varchar(16) COLLATE "C" NOT NULL, "source_release_id" varchar(36) COLLATE "C", "created_at_ms" bigint NOT NULL, "updated_at_ms" bigint NOT NULL, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("id"));
|
|
18
|
-
|
|
19
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_releases_byScope" ON "hot_updater_v1_releases" ("scope_key", "id");
|
|
20
|
-
|
|
21
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_releases_byScopeEnabled" ON "hot_updater_v1_releases" ("scope_key", "enabled", "id");
|
|
22
|
-
|
|
23
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_releases_byChannelPlatform" ON "hot_updater_v1_releases" ("channel_id", "platform", "id");
|
|
24
|
-
|
|
25
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_releases_byChannelPlatformEnabled" ON "hot_updater_v1_releases" ("channel_id", "platform", "enabled", "id");
|
|
26
|
-
|
|
27
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_releases_byBundle" ON "hot_updater_v1_releases" ("bundle_id", "id");
|
|
28
|
-
|
|
29
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_release_catalogs" ("scope_key" varchar(2048) COLLATE "C" NOT NULL, "catalog_id" varchar(255) COLLATE "C" NOT NULL, "strategy" varchar(16) COLLATE "C" NOT NULL, "channel_id" varchar(1408) COLLATE "C" NOT NULL, "channel_key" varchar(1400) COLLATE "C" NOT NULL, "platform" varchar(16) COLLATE "C" NOT NULL, "fingerprint_hash" varchar(255) COLLATE "C", "generation" bigint NOT NULL, "payload" text COLLATE "C" NOT NULL, "catalog_hash" varchar(71) COLLATE "C" NOT NULL, "byte_size" bigint NOT NULL, "is_tombstone" boolean NOT NULL, "updated_at_ms" bigint NOT NULL, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("scope_key"));
|
|
30
|
-
|
|
31
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_channels" ("id" varchar(1408) COLLATE "C" NOT NULL, "name" varchar(255) COLLATE "C" NOT NULL, "_refs_releases_channel_id" bigint NOT NULL DEFAULT 0, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("id"));
|
|
32
|
-
|
|
33
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_channels_all" ON "hot_updater_v1_channels" ("name", "id");
|
|
34
|
-
|
|
35
|
-
CREATE UNIQUE INDEX IF NOT EXISTS "hot_updater_v1_channels_name" ON "hot_updater_v1_channels" ("name");
|
|
36
|
-
|
|
37
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_bundle_totals" ("platform_key" varchar(16) COLLATE "C" NOT NULL, "_shard" bigint NOT NULL, "bundles" bigint NOT NULL, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("platform_key", "_shard"));
|
|
38
|
-
|
|
39
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_bundle_events" ("id" varchar(36) COLLATE "C" NOT NULL, "type" varchar(32) COLLATE "C" NOT NULL, "install_id" varchar(255) COLLATE "C" NOT NULL, "user_id" varchar(255) COLLATE "C", "from_release_id" varchar(36) COLLATE "C", "from_bundle_id" varchar(36) COLLATE "C", "to_release_id" varchar(36) COLLATE "C", "to_bundle_id" varchar(36) COLLATE "C" NOT NULL, "platform" varchar(16) COLLATE "C" NOT NULL, "app_version" text COLLATE "C" NOT NULL, "channel" text COLLATE "C" NOT NULL, "metadata" jsonb NOT NULL, "received_at_ms" bigint NOT NULL, "day" bigint, "movement_install_id" text COLLATE "C", "bundle_ref" jsonb, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("id"));
|
|
40
|
-
|
|
41
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_bundle_events_recent" ON "hot_updater_v1_bundle_events" ("channel", "platform", "day", "received_at_ms", "id");
|
|
42
|
-
|
|
43
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_bundle_events_movementsByInstall" ON "hot_updater_v1_bundle_events" ("movement_install_id", "received_at_ms", "id");
|
|
44
|
-
|
|
45
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_bundle_events__byBundle" ("platform" varchar(16) COLLATE "C" NOT NULL, "channel" text COLLATE "C" NOT NULL, "type" varchar(32) COLLATE "C" NOT NULL, "bundle_ref" text COLLATE "C" NOT NULL, "day" bigint NOT NULL, "received_at_ms" bigint NOT NULL, "id" varchar(36) COLLATE "C" NOT NULL, PRIMARY KEY ("platform", "channel", "type", "bundle_ref", "day", "received_at_ms", "id"));
|
|
46
|
-
|
|
47
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_bundle_events_byDay" ON "hot_updater_v1_bundle_events" ("day", "received_at_ms", "id");
|
|
48
|
-
|
|
49
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_bundle_event_heads" ("install_id" varchar(255) COLLATE "C" NOT NULL, "id" varchar(36) COLLATE "C" NOT NULL, "type" varchar(32) COLLATE "C" NOT NULL, "user_id" varchar(255) COLLATE "C", "from_release_id" varchar(36) COLLATE "C", "from_bundle_id" varchar(36) COLLATE "C", "to_release_id" varchar(36) COLLATE "C", "to_bundle_id" varchar(36) COLLATE "C" NOT NULL, "platform" varchar(16) COLLATE "C" NOT NULL, "app_version" text COLLATE "C" NOT NULL, "channel" text COLLATE "C" NOT NULL, "metadata" jsonb NOT NULL, "received_at_ms" bigint NOT NULL, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("install_id"));
|
|
50
|
-
|
|
51
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_bundle_event_heads_byUser" ON "hot_updater_v1_bundle_event_heads" ("user_id", "install_id");
|
|
52
|
-
|
|
53
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_bundle_event_heads__retention" ON "hot_updater_v1_bundle_event_heads" ("received_at_ms", "install_id");
|
|
54
|
-
|
|
55
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_insights_overview" ("identity" varchar(32) COLLATE "C" NOT NULL, "bucket_start_ms" bigint NOT NULL, "_shard" bigint NOT NULL, "downloads" bigint NOT NULL, "launches" bigint NOT NULL, "failed_launches" bigint NOT NULL, "failed_updates" bigint NOT NULL, "patch_downloads" bigint NOT NULL, "patch_fallbacks" bigint NOT NULL, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("identity", "bucket_start_ms", "_shard"));
|
|
56
|
-
|
|
57
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_insights_overview__retention" ON "hot_updater_v1_insights_overview" ("bucket_start_ms", "identity", "_shard");
|
|
58
|
-
|
|
59
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_insights_sketches" ("identity" varchar(32) COLLATE "C" NOT NULL, "bucket_start_ms" bigint NOT NULL, "_shard" bigint NOT NULL, "launch_users" text COLLATE "C", "activity_users" text COLLATE "C", "failed_users" text COLLATE "C", "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("identity", "bucket_start_ms", "_shard"));
|
|
60
|
-
|
|
61
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_insights_sketches__retention" ON "hot_updater_v1_insights_sketches" ("bucket_start_ms", "identity", "_shard");
|
|
62
|
-
|
|
63
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_insights_overview_daily" ("identity" varchar(32) COLLATE "C" NOT NULL, "bucket_start_ms" bigint NOT NULL, "_shard" bigint NOT NULL, "downloads" bigint NOT NULL, "launches" bigint NOT NULL, "failed_launches" bigint NOT NULL, "failed_updates" bigint NOT NULL, "patch_downloads" bigint NOT NULL, "patch_fallbacks" bigint NOT NULL, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("identity", "bucket_start_ms", "_shard"));
|
|
64
|
-
|
|
65
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_insights_overview_daily__retention" ON "hot_updater_v1_insights_overview_daily" ("bucket_start_ms", "identity", "_shard");
|
|
66
|
-
|
|
67
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_insights_sketches_daily" ("identity" varchar(32) COLLATE "C" NOT NULL, "bucket_start_ms" bigint NOT NULL, "_shard" bigint NOT NULL, "launch_users" text COLLATE "C", "activity_users" text COLLATE "C", "failed_users" text COLLATE "C", "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("identity", "bucket_start_ms", "_shard"));
|
|
68
|
-
|
|
69
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_insights_sketches_daily__retention" ON "hot_updater_v1_insights_sketches_daily" ("bucket_start_ms", "identity", "_shard");
|
|
70
|
-
|
|
71
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_insights_overview_lifetime" ("identity" varchar(32) COLLATE "C" NOT NULL, "bucket_start_ms" bigint NOT NULL, "_shard" bigint NOT NULL, "downloads" bigint NOT NULL, "launches" bigint NOT NULL, "failed_launches" bigint NOT NULL, "failed_updates" bigint NOT NULL, "patch_downloads" bigint NOT NULL, "patch_fallbacks" bigint NOT NULL, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("identity", "bucket_start_ms", "_shard"));
|
|
72
|
-
|
|
73
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_insights_sketches_lifetime" ("identity" varchar(32) COLLATE "C" NOT NULL, "bucket_start_ms" bigint NOT NULL, "_shard" bigint NOT NULL, "failed_users" text COLLATE "C", "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("identity", "bucket_start_ms", "_shard"));
|
|
74
|
-
|
|
75
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_insights_distribution" ("channel" text COLLATE "C" NOT NULL, "platform" varchar(16) COLLATE "C" NOT NULL, "app_version" text COLLATE "C" NOT NULL, "release_id" varchar(36) COLLATE "C" NOT NULL, "bucket_start_ms" bigint NOT NULL, "_shard" bigint NOT NULL, "latest_installations" bigint NOT NULL, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("channel", "platform", "app_version", "release_id", "bucket_start_ms", "_shard"));
|
|
76
|
-
|
|
77
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_insights_distribution_byScope" ON "hot_updater_v1_insights_distribution" ("channel", "platform", "bucket_start_ms", "app_version", "release_id", "_shard");
|
|
78
|
-
|
|
79
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_insights_distribution_byVersion" ON "hot_updater_v1_insights_distribution" ("channel", "platform", "app_version", "bucket_start_ms", "release_id", "_shard");
|
|
80
|
-
|
|
81
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_insights_distribution__retention" ON "hot_updater_v1_insights_distribution" ("bucket_start_ms", "channel", "platform", "app_version", "release_id", "_shard");
|
|
82
|
-
|
|
83
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_bundle_daily_heads" ("install_id" varchar(255) COLLATE "C" NOT NULL, "bucket_start_ms" bigint NOT NULL, "id" varchar(36) COLLATE "C" NOT NULL, "received_at_ms" bigint NOT NULL, "channel" text COLLATE "C" NOT NULL, "platform" varchar(16) COLLATE "C" NOT NULL, "app_version" text COLLATE "C" NOT NULL, "release_id" varchar(36) COLLATE "C" NOT NULL, "bundle_kind" varchar(16) COLLATE "C" NOT NULL, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("install_id", "bucket_start_ms"));
|
|
84
|
-
|
|
85
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_bundle_daily_heads__retention" ON "hot_updater_v1_bundle_daily_heads" ("bucket_start_ms", "install_id");
|
|
86
|
-
|
|
87
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_insights_distribution_history" ("channel" text COLLATE "C" NOT NULL, "platform" varchar(16) COLLATE "C" NOT NULL, "app_version" text COLLATE "C" NOT NULL, "release_id" varchar(36) COLLATE "C" NOT NULL, "bundle_kind" varchar(16) COLLATE "C" NOT NULL, "bucket_start_ms" bigint NOT NULL, "_shard" bigint NOT NULL, "installations" bigint NOT NULL, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("channel", "platform", "app_version", "release_id", "bundle_kind", "bucket_start_ms", "_shard"));
|
|
88
|
-
|
|
89
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_insights_distribution_history_byScope" ON "hot_updater_v1_insights_distribution_history" ("channel", "platform", "bucket_start_ms", "app_version", "release_id", "bundle_kind", "_shard");
|
|
90
|
-
|
|
91
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_insights_distribution_history__retention" ON "hot_updater_v1_insights_distribution_history" ("bucket_start_ms", "channel", "platform", "app_version", "release_id", "bundle_kind", "_shard");
|
|
92
|
-
|
|
93
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_insights_latest_by_bundle" ("platform" varchar(16) COLLATE "C" NOT NULL, "channel" text COLLATE "C" NOT NULL, "bundle_field" varchar(16) COLLATE "C" NOT NULL, "bundle_id" varchar(36) COLLATE "C" NOT NULL, "type" varchar(32) COLLATE "C" NOT NULL, "bucket_start_ms" bigint NOT NULL, "_shard" bigint NOT NULL, "installations" bigint NOT NULL, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("platform", "channel", "bundle_field", "bundle_id", "type", "bucket_start_ms", "_shard"));
|
|
94
|
-
|
|
95
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_insights_latest_by_bundle__retention" ON "hot_updater_v1_insights_latest_by_bundle" ("bucket_start_ms", "platform", "channel", "bundle_field", "bundle_id", "type", "_shard");
|
|
96
|
-
|
|
97
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_insights_outcomes" ("platform" varchar(16) COLLATE "C" NOT NULL, "channel" text COLLATE "C" NOT NULL, "type" varchar(32) COLLATE "C" NOT NULL, "bundle_ref" varchar(41) COLLATE "C" NOT NULL, "bucket_start_ms" bigint NOT NULL, "_shard" bigint NOT NULL, "events" bigint NOT NULL, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("platform", "channel", "type", "bundle_ref", "bucket_start_ms", "_shard"));
|
|
98
|
-
|
|
99
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_insights_outcomes__retention" ON "hot_updater_v1_insights_outcomes" ("bucket_start_ms", "platform", "channel", "type", "bundle_ref", "_shard");
|
|
100
|
-
|
|
101
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_insights_failures" ("platform" varchar(16) COLLATE "C" NOT NULL, "channel" text COLLATE "C" NOT NULL, "bucket_start_ms" bigint NOT NULL, "release_id" varchar(36) COLLATE "C" NOT NULL, "stage" varchar(16) COLLATE "C" NOT NULL, "reason" varchar(64) COLLATE "C" NOT NULL, "detail" varchar(160) COLLATE "C" NOT NULL, "_shard" bigint NOT NULL, "events" bigint NOT NULL, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("platform", "channel", "bucket_start_ms", "release_id", "stage", "reason", "detail", "_shard"));
|
|
102
|
-
|
|
103
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_insights_failures__retention" ON "hot_updater_v1_insights_failures" ("bucket_start_ms", "platform", "channel", "release_id", "stage", "reason", "detail", "_shard");
|
|
104
|
-
|
|
105
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_api_keys" ("id" varchar(255) COLLATE "C" NOT NULL, "hash" varchar(64) COLLATE "C" NOT NULL, "name" varchar(64) COLLATE "C" NOT NULL, "prefix" varchar(16) COLLATE "C" NOT NULL, "role" varchar(16) COLLATE "C" NOT NULL, "created_at_ms" bigint NOT NULL, "revoked_at_ms" bigint, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("id"));
|
|
106
|
-
|
|
107
|
-
CREATE INDEX IF NOT EXISTS "hot_updater_v1_api_keys_byCreated" ON "hot_updater_v1_api_keys" ("created_at_ms", "id");
|
|
108
|
-
|
|
109
|
-
CREATE UNIQUE INDEX IF NOT EXISTS "hot_updater_v1_api_keys_hash" ON "hot_updater_v1_api_keys" ("hash");
|
|
110
|
-
|
|
111
|
-
CREATE TABLE IF NOT EXISTS "hot_updater_v1_private_hot_updater_settings" ("key" varchar(255) COLLATE "C" NOT NULL, "value" varchar(255) COLLATE "C" NOT NULL, "_v" bigint NOT NULL DEFAULT 0, PRIMARY KEY ("key"));
|
|
112
|
-
|
|
113
|
-
ALTER TABLE "hot_updater_v1_bundles" ENABLE ROW LEVEL SECURITY;
|
|
114
|
-
|
|
115
|
-
ALTER TABLE "hot_updater_v1_bundle_patches" ENABLE ROW LEVEL SECURITY;
|
|
116
|
-
|
|
117
|
-
ALTER TABLE "hot_updater_v1_releases" ENABLE ROW LEVEL SECURITY;
|
|
118
|
-
|
|
119
|
-
ALTER TABLE "hot_updater_v1_release_catalogs" ENABLE ROW LEVEL SECURITY;
|
|
120
|
-
|
|
121
|
-
ALTER TABLE "hot_updater_v1_channels" ENABLE ROW LEVEL SECURITY;
|
|
122
|
-
|
|
123
|
-
ALTER TABLE "hot_updater_v1_bundle_totals" ENABLE ROW LEVEL SECURITY;
|
|
124
|
-
|
|
125
|
-
ALTER TABLE "hot_updater_v1_bundle_events" ENABLE ROW LEVEL SECURITY;
|
|
126
|
-
|
|
127
|
-
ALTER TABLE "hot_updater_v1_bundle_events__byBundle" ENABLE ROW LEVEL SECURITY;
|
|
128
|
-
|
|
129
|
-
ALTER TABLE "hot_updater_v1_bundle_event_heads" ENABLE ROW LEVEL SECURITY;
|
|
130
|
-
|
|
131
|
-
ALTER TABLE "hot_updater_v1_insights_overview" ENABLE ROW LEVEL SECURITY;
|
|
132
|
-
|
|
133
|
-
ALTER TABLE "hot_updater_v1_insights_sketches" ENABLE ROW LEVEL SECURITY;
|
|
134
|
-
|
|
135
|
-
ALTER TABLE "hot_updater_v1_insights_overview_daily" ENABLE ROW LEVEL SECURITY;
|
|
136
|
-
|
|
137
|
-
ALTER TABLE "hot_updater_v1_insights_sketches_daily" ENABLE ROW LEVEL SECURITY;
|
|
138
|
-
|
|
139
|
-
ALTER TABLE "hot_updater_v1_insights_overview_lifetime" ENABLE ROW LEVEL SECURITY;
|
|
140
|
-
|
|
141
|
-
ALTER TABLE "hot_updater_v1_insights_sketches_lifetime" ENABLE ROW LEVEL SECURITY;
|
|
142
|
-
|
|
143
|
-
ALTER TABLE "hot_updater_v1_insights_distribution" ENABLE ROW LEVEL SECURITY;
|
|
144
|
-
|
|
145
|
-
ALTER TABLE "hot_updater_v1_bundle_daily_heads" ENABLE ROW LEVEL SECURITY;
|
|
146
|
-
|
|
147
|
-
ALTER TABLE "hot_updater_v1_insights_distribution_history" ENABLE ROW LEVEL SECURITY;
|
|
148
|
-
|
|
149
|
-
ALTER TABLE "hot_updater_v1_insights_latest_by_bundle" ENABLE ROW LEVEL SECURITY;
|
|
150
|
-
|
|
151
|
-
ALTER TABLE "hot_updater_v1_insights_outcomes" ENABLE ROW LEVEL SECURITY;
|
|
152
|
-
|
|
153
|
-
ALTER TABLE "hot_updater_v1_insights_failures" ENABLE ROW LEVEL SECURITY;
|
|
154
|
-
|
|
155
|
-
ALTER TABLE "hot_updater_v1_api_keys" ENABLE ROW LEVEL SECURITY;
|
|
156
|
-
|
|
157
|
-
ALTER TABLE "hot_updater_v1_private_hot_updater_settings" ENABLE ROW LEVEL SECURITY;
|
|
158
|
-
|
|
159
|
-
ALTER TABLE "hot_updater_v1__hu_write" ENABLE ROW LEVEL SECURITY;
|
|
160
|
-
|
|
161
|
-
CREATE OR REPLACE FUNCTION public.hot_updater_v1_apply(p_statements jsonb)
|
|
162
|
-
RETURNS jsonb
|
|
163
|
-
LANGUAGE plpgsql
|
|
164
|
-
SECURITY INVOKER
|
|
165
|
-
SET search_path = public, pg_temp
|
|
166
|
-
AS $apply$
|
|
167
|
-
DECLARE
|
|
168
|
-
item jsonb;
|
|
169
|
-
statement text;
|
|
170
|
-
shape text;
|
|
171
|
-
target text;
|
|
172
|
-
found record;
|
|
173
|
-
rows jsonb;
|
|
174
|
-
changed bigint;
|
|
175
|
-
results jsonb := '[]'::jsonb;
|
|
176
|
-
BEGIN
|
|
177
|
-
FOR item IN SELECT value FROM jsonb_array_elements(p_statements) LOOP
|
|
178
|
-
statement := item->>'sql';
|
|
179
|
-
FOR target IN SELECT (regexp_matches(statement, '(?:FROM|INTO|UPDATE|JOIN) "([^"]+)"', 'g'))[1] LOOP
|
|
180
|
-
IF NOT target = ANY (ARRAY['hot_updater_v1_bundles', 'hot_updater_v1_bundle_patches', 'hot_updater_v1_releases', 'hot_updater_v1_release_catalogs', 'hot_updater_v1_channels', 'hot_updater_v1_bundle_totals', 'hot_updater_v1_bundle_events', 'hot_updater_v1_bundle_events__byBundle', 'hot_updater_v1_bundle_event_heads', 'hot_updater_v1_insights_overview', 'hot_updater_v1_insights_sketches', 'hot_updater_v1_insights_overview_daily', 'hot_updater_v1_insights_sketches_daily', 'hot_updater_v1_insights_overview_lifetime', 'hot_updater_v1_insights_sketches_lifetime', 'hot_updater_v1_insights_distribution', 'hot_updater_v1_bundle_daily_heads', 'hot_updater_v1_insights_distribution_history', 'hot_updater_v1_insights_latest_by_bundle', 'hot_updater_v1_insights_outcomes', 'hot_updater_v1_insights_failures', 'hot_updater_v1_api_keys', 'hot_updater_v1_private_hot_updater_settings', 'hot_updater_v1__hu_write']) THEN
|
|
181
|
-
RAISE EXCEPTION 'hot_updater_v1_apply: % is not a Hot Updater table', target USING ERRCODE = '42501';
|
|
182
|
-
END IF;
|
|
183
|
-
END LOOP;
|
|
184
|
-
shape := regexp_replace(regexp_replace(statement, '^INSERT INTO "[^"]+" \(', 'INSERT INTO ('), '"[^"]*"', '"', 'g');
|
|
185
|
-
IF shape !~ '^(SELECT|INSERT INTO|UPDATE|DELETE FROM) '
|
|
186
|
-
OR shape ~ '"[[:space:]]*\('
|
|
187
|
-
OR shape ~ '[;''\\]|--|/\*'
|
|
188
|
-
OR regexp_replace(shape, '\m(SELECT|FROM|WHERE|AND|OR|NOT|EXISTS|INSERT|INTO|VALUES|UPDATE|SET|DELETE|ORDER|BY|ASC|DESC|LIMIT|IS|NULL|ON|CONFLICT|DO|JOIN|FOR|bigint|double|precision|boolean|jsonb|i|b)\M', '', 'gi') !~ '^[[:space:]"(),.*=<>+0-9$:-]*$' THEN
|
|
189
|
-
RAISE EXCEPTION 'hot_updater_v1_apply: statement not allowed' USING ERRCODE = '42501';
|
|
190
|
-
END IF;
|
|
191
|
-
IF statement ~ '^SELECT ' THEN
|
|
192
|
-
rows := '[]'::jsonb;
|
|
193
|
-
FOR found IN EXECUTE statement USING item->'params' LOOP
|
|
194
|
-
rows := rows || jsonb_build_array(to_jsonb(found));
|
|
195
|
-
END LOOP;
|
|
196
|
-
results := results || jsonb_build_array(jsonb_build_object('rows', rows, 'changes', 0));
|
|
197
|
-
ELSE
|
|
198
|
-
EXECUTE statement USING item->'params';
|
|
199
|
-
GET DIAGNOSTICS changed = ROW_COUNT;
|
|
200
|
-
results := results || jsonb_build_array(jsonb_build_object('rows', '[]'::jsonb, 'changes', changed));
|
|
201
|
-
END IF;
|
|
202
|
-
END LOOP;
|
|
203
|
-
RETURN results;
|
|
204
|
-
END;
|
|
205
|
-
$apply$;
|
|
206
|
-
|
|
207
|
-
REVOKE EXECUTE ON FUNCTION public.hot_updater_v1_apply(jsonb) FROM PUBLIC, anon, authenticated;
|
|
208
|
-
|
|
209
|
-
GRANT EXECUTE ON FUNCTION public.hot_updater_v1_apply(jsonb) TO service_role;
|
|
210
|
-
|
|
211
|
-
INSERT INTO "hot_updater_v1_private_hot_updater_settings" ("key", "value", "_v") VALUES ('schema.engine', '1', 0) ON CONFLICT ("key") DO UPDATE SET "value" = excluded."value";
|
|
212
|
-
|
|
213
|
-
INSERT INTO "hot_updater_v1_private_hot_updater_settings" ("key", "value", "_v") VALUES ('schema.core', '1.0.0', 0) ON CONFLICT ("key") DO UPDATE SET "value" = excluded."value";
|
|
214
|
-
|
|
215
|
-
INSERT INTO "hot_updater_v1_private_hot_updater_settings" ("key", "value", "_v") VALUES ('schema.insights', '1.3.0', 0) ON CONFLICT ("key") DO UPDATE SET "value" = excluded."value";
|
|
216
|
-
|
|
217
|
-
INSERT INTO "hot_updater_v1_private_hot_updater_settings" ("key", "value", "_v") VALUES ('schema.apiKeys', '1.0.0', 0) ON CONFLICT ("key") DO UPDATE SET "value" = excluded."value";
|