@hot-updater/plugin-core 1.0.0-rc.2 → 1.0.0-rc.3
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/databasePluginCrudValidationFields.cjs +2 -2
- package/dist/databasePluginCrudValidationFields.mjs +2 -2
- package/dist/databasePluginCrudValidationRows.cjs +1 -1
- package/dist/databasePluginCrudValidationRows.mjs +1 -1
- package/dist/insightsContract.cjs +2 -2
- package/dist/insightsContract.d.cts +1 -1
- package/dist/insightsContract.d.mts +1 -1
- package/dist/insightsContract.mjs +2 -2
- package/dist/types/databasePlugin.d.cts +1 -1
- package/dist/types/databasePlugin.d.mts +1 -1
- package/dist/types/databaseRows.d.cts +1 -1
- package/dist/types/databaseRows.d.mts +1 -1
- package/package.json +1 -1
|
@@ -89,7 +89,7 @@ const modelValidators = {
|
|
|
89
89
|
},
|
|
90
90
|
bundle_events: {
|
|
91
91
|
id: (value) => typeof value === "string",
|
|
92
|
-
type: (value) => value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "
|
|
92
|
+
type: (value) => value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "UNCHANGED",
|
|
93
93
|
install_id: isInsightsIdentityText,
|
|
94
94
|
user_id: isNullableInsightsIdentityText,
|
|
95
95
|
username: (value) => value === null || typeof value === "string",
|
|
@@ -112,7 +112,7 @@ const modelValidators = {
|
|
|
112
112
|
user_id: isNullableInsightsIdentityText,
|
|
113
113
|
username: (value) => value === null || typeof value === "string",
|
|
114
114
|
to_bundle_id: (value) => typeof value === "string",
|
|
115
|
-
type: (value) => value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "
|
|
115
|
+
type: (value) => value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "UNCHANGED",
|
|
116
116
|
platform: (value) => value === "ios" || value === "android",
|
|
117
117
|
app_version: (value) => typeof value === "string",
|
|
118
118
|
channel: (value) => typeof value === "string",
|
|
@@ -89,7 +89,7 @@ const modelValidators = {
|
|
|
89
89
|
},
|
|
90
90
|
bundle_events: {
|
|
91
91
|
id: (value) => typeof value === "string",
|
|
92
|
-
type: (value) => value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "
|
|
92
|
+
type: (value) => value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "UNCHANGED",
|
|
93
93
|
install_id: isInsightsIdentityText,
|
|
94
94
|
user_id: isNullableInsightsIdentityText,
|
|
95
95
|
username: (value) => value === null || typeof value === "string",
|
|
@@ -112,7 +112,7 @@ const modelValidators = {
|
|
|
112
112
|
user_id: isNullableInsightsIdentityText,
|
|
113
113
|
username: (value) => value === null || typeof value === "string",
|
|
114
114
|
to_bundle_id: (value) => typeof value === "string",
|
|
115
|
-
type: (value) => value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "
|
|
115
|
+
type: (value) => value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "UNCHANGED",
|
|
116
116
|
platform: (value) => value === "ios" || value === "android",
|
|
117
117
|
app_version: (value) => typeof value === "string",
|
|
118
118
|
channel: (value) => typeof value === "string",
|
|
@@ -10,7 +10,7 @@ const hasValidReleaseInvariants = (data) => {
|
|
|
10
10
|
const fingerprintHash = data.fingerprint_hash;
|
|
11
11
|
return (kind === "BUNDLE" && typeof bundleId === "string" || kind === "EMBEDDED" && bundleId === null) && (strategy === "APP_VERSION" && typeof targetAppVersion === "string" && fingerprintHash === null || strategy === "FINGERPRINT" && targetAppVersion === null && typeof fingerprintHash === "string");
|
|
12
12
|
};
|
|
13
|
-
const hasValidBundleEventInvariants = (data) => (data.type === "UPDATE_APPLIED" || data.type === "RECOVERED"
|
|
13
|
+
const hasValidBundleEventInvariants = (data) => (data.type === "UPDATE_APPLIED" || data.type === "RECOVERED") && typeof data.from_bundle_id === "string" && (data.update_strategy === "fingerprint" || data.update_strategy === "appVersion") || data.type === "UNCHANGED" && data.from_bundle_id === null && data.update_strategy === null;
|
|
14
14
|
const validateCreateData = (model, data) => {
|
|
15
15
|
if (!require_databasePluginCrudValidationFields.isRecord(data)) throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-data");
|
|
16
16
|
require_databasePluginCrudValidationFields.validateFields(model, Object.keys(data));
|
|
@@ -10,7 +10,7 @@ const hasValidReleaseInvariants = (data) => {
|
|
|
10
10
|
const fingerprintHash = data.fingerprint_hash;
|
|
11
11
|
return (kind === "BUNDLE" && typeof bundleId === "string" || kind === "EMBEDDED" && bundleId === null) && (strategy === "APP_VERSION" && typeof targetAppVersion === "string" && fingerprintHash === null || strategy === "FINGERPRINT" && targetAppVersion === null && typeof fingerprintHash === "string");
|
|
12
12
|
};
|
|
13
|
-
const hasValidBundleEventInvariants = (data) => (data.type === "UPDATE_APPLIED" || data.type === "RECOVERED"
|
|
13
|
+
const hasValidBundleEventInvariants = (data) => (data.type === "UPDATE_APPLIED" || data.type === "RECOVERED") && typeof data.from_bundle_id === "string" && (data.update_strategy === "fingerprint" || data.update_strategy === "appVersion") || data.type === "UNCHANGED" && data.from_bundle_id === null && data.update_strategy === null;
|
|
14
14
|
const validateCreateData = (model, data) => {
|
|
15
15
|
if (!isRecord(data)) throw new DatabasePluginInputError("invalid-data");
|
|
16
16
|
validateFields(model, Object.keys(data));
|
|
@@ -32,7 +32,7 @@ const isBundleFilter = (value, withKind = false) => {
|
|
|
32
32
|
"type",
|
|
33
33
|
...withKind ? ["kind"] : []
|
|
34
34
|
];
|
|
35
|
-
return value.type === "RECOVERED" ? isText(value.fromBundleId) && hasOnlyKeys(value, [...keys, "fromBundleId"]) : (value.type === "UPDATE_APPLIED" || value.type === "
|
|
35
|
+
return value.type === "RECOVERED" ? isText(value.fromBundleId) && hasOnlyKeys(value, [...keys, "fromBundleId"]) : (value.type === "UPDATE_APPLIED" || value.type === "UNCHANGED") && isText(value.toBundleId) && hasOnlyKeys(value, [...keys, "toBundleId"]);
|
|
36
36
|
};
|
|
37
37
|
const isEventFilter = (value) => {
|
|
38
38
|
if (!require_databasePluginCrudValidationFields.isRecord(value)) return false;
|
|
@@ -66,7 +66,7 @@ const toInsightsInstallationRow = (event) => {
|
|
|
66
66
|
received_at_ms: event.received_at_ms
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
|
-
/**
|
|
69
|
+
/** Unchanged reports are not bundle movements. */
|
|
70
70
|
const isInsightsMovementEvent = (event) => event.type === "UPDATE_APPLIED" || event.type === "RECOVERED";
|
|
71
71
|
const matchesInsightsEventFilter = (event, filter) => {
|
|
72
72
|
if (filter.kind === "all") return true;
|
|
@@ -5,7 +5,7 @@ import "./types/index.cjs";
|
|
|
5
5
|
declare const compareInsightsText: (left: string, right: string) => number;
|
|
6
6
|
/** Prepare the full latest-state candidate; the provider owns winning writes. */
|
|
7
7
|
declare const toInsightsInstallationRow: (event: BundleEventRow) => InsightsInstallationRow;
|
|
8
|
-
/**
|
|
8
|
+
/** Unchanged reports are not bundle movements. */
|
|
9
9
|
declare const isInsightsMovementEvent: (event: Pick<BundleEventRow, "type">) => boolean;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { compareInsightsText, isInsightsMovementEvent, toInsightsInstallationRow };
|
|
@@ -5,7 +5,7 @@ import "./types/index.mjs";
|
|
|
5
5
|
declare const compareInsightsText: (left: string, right: string) => number;
|
|
6
6
|
/** Prepare the full latest-state candidate; the provider owns winning writes. */
|
|
7
7
|
declare const toInsightsInstallationRow: (event: BundleEventRow) => InsightsInstallationRow;
|
|
8
|
-
/**
|
|
8
|
+
/** Unchanged reports are not bundle movements. */
|
|
9
9
|
declare const isInsightsMovementEvent: (event: Pick<BundleEventRow, "type">) => boolean;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { compareInsightsText, isInsightsMovementEvent, toInsightsInstallationRow };
|
|
@@ -32,7 +32,7 @@ const isBundleFilter = (value, withKind = false) => {
|
|
|
32
32
|
"type",
|
|
33
33
|
...withKind ? ["kind"] : []
|
|
34
34
|
];
|
|
35
|
-
return value.type === "RECOVERED" ? isText(value.fromBundleId) && hasOnlyKeys(value, [...keys, "fromBundleId"]) : (value.type === "UPDATE_APPLIED" || value.type === "
|
|
35
|
+
return value.type === "RECOVERED" ? isText(value.fromBundleId) && hasOnlyKeys(value, [...keys, "fromBundleId"]) : (value.type === "UPDATE_APPLIED" || value.type === "UNCHANGED") && isText(value.toBundleId) && hasOnlyKeys(value, [...keys, "toBundleId"]);
|
|
36
36
|
};
|
|
37
37
|
const isEventFilter = (value) => {
|
|
38
38
|
if (!isRecord(value)) return false;
|
|
@@ -66,7 +66,7 @@ const toInsightsInstallationRow = (event) => {
|
|
|
66
66
|
received_at_ms: event.received_at_ms
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
|
-
/**
|
|
69
|
+
/** Unchanged reports are not bundle movements. */
|
|
70
70
|
const isInsightsMovementEvent = (event) => event.type === "UPDATE_APPLIED" || event.type === "RECOVERED";
|
|
71
71
|
const matchesInsightsEventFilter = (event, filter) => {
|
|
72
72
|
if (filter.kind === "all") return true;
|
|
@@ -55,7 +55,7 @@ type InsightsBundleEventFilter = InsightsScope & ({
|
|
|
55
55
|
readonly type: "RECOVERED";
|
|
56
56
|
readonly fromBundleId: string;
|
|
57
57
|
} | {
|
|
58
|
-
readonly type: "UPDATE_APPLIED" | "
|
|
58
|
+
readonly type: "UPDATE_APPLIED" | "UNCHANGED";
|
|
59
59
|
readonly toBundleId: string;
|
|
60
60
|
});
|
|
61
61
|
type InsightsEventFilter = {
|
|
@@ -55,7 +55,7 @@ type InsightsBundleEventFilter = InsightsScope & ({
|
|
|
55
55
|
readonly type: "RECOVERED";
|
|
56
56
|
readonly fromBundleId: string;
|
|
57
57
|
} | {
|
|
58
|
-
readonly type: "UPDATE_APPLIED" | "
|
|
58
|
+
readonly type: "UPDATE_APPLIED" | "UNCHANGED";
|
|
59
59
|
readonly toBundleId: string;
|
|
60
60
|
});
|
|
61
61
|
type InsightsEventFilter = {
|
|
@@ -86,7 +86,7 @@ type BundleEventRowBase = {
|
|
|
86
86
|
readonly received_at_ms: number;
|
|
87
87
|
};
|
|
88
88
|
type BundleEventRow = (BundleEventRowBase & {
|
|
89
|
-
readonly type: "UPDATE_APPLIED" | "RECOVERED"
|
|
89
|
+
readonly type: "UPDATE_APPLIED" | "RECOVERED";
|
|
90
90
|
readonly from_bundle_id: string;
|
|
91
91
|
readonly update_strategy: "fingerprint" | "appVersion";
|
|
92
92
|
}) | (BundleEventRowBase & {
|
|
@@ -86,7 +86,7 @@ type BundleEventRowBase = {
|
|
|
86
86
|
readonly received_at_ms: number;
|
|
87
87
|
};
|
|
88
88
|
type BundleEventRow = (BundleEventRowBase & {
|
|
89
|
-
readonly type: "UPDATE_APPLIED" | "RECOVERED"
|
|
89
|
+
readonly type: "UPDATE_APPLIED" | "RECOVERED";
|
|
90
90
|
readonly from_bundle_id: string;
|
|
91
91
|
readonly update_strategy: "fingerprint" | "appVersion";
|
|
92
92
|
}) | (BundleEventRowBase & {
|