@hot-updater/plugin-core 1.0.0-rc.15 → 1.0.0-rc.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundleEventRow.cjs +42 -0
- package/dist/bundleEventRow.mjs +41 -0
- package/dist/coreApi.d.cts +131 -0
- package/dist/coreApi.d.mts +131 -0
- package/dist/database/adapter.cjs +37 -0
- package/dist/database/adapter.d.cts +150 -0
- package/dist/database/adapter.d.mts +150 -0
- package/dist/database/adapter.mjs +30 -0
- package/dist/database/memoryAdapter.cjs +102 -0
- package/dist/database/memoryAdapter.d.cts +16 -0
- package/dist/database/memoryAdapter.d.mts +16 -0
- package/dist/database/memoryAdapter.mjs +102 -0
- package/dist/database/values.cjs +110 -0
- package/dist/database/values.d.cts +30 -0
- package/dist/database/values.d.mts +30 -0
- package/dist/database/values.mjs +100 -0
- package/dist/database/verifyAdapter.cjs +129 -0
- package/dist/database/verifyAdapter.d.cts +29 -0
- package/dist/database/verifyAdapter.d.mts +29 -0
- package/dist/database/verifyAdapter.mjs +128 -0
- package/dist/databaseErrors.cjs +30 -0
- package/dist/databaseErrors.d.cts +21 -0
- package/dist/databaseErrors.d.mts +21 -0
- package/dist/databaseErrors.mjs +28 -0
- package/dist/databaseMetadata.cjs +2 -2
- package/dist/databaseMetadata.mjs +1 -1
- package/dist/index.cjs +10 -36
- package/dist/index.d.cts +13 -17
- package/dist/index.d.mts +13 -17
- package/dist/index.mjs +8 -14
- package/dist/insightsContract.cjs +26 -24
- package/dist/insightsContract.d.cts +6 -1
- package/dist/insightsContract.d.mts +6 -1
- package/dist/insightsContract.mjs +6 -5
- package/dist/insightsDistinctSummary.cjs +2 -1
- package/dist/insightsDistinctSummary.mjs +2 -1
- package/dist/insightsOverview.cjs +4 -4
- package/dist/insightsOverview.d.cts +3 -1
- package/dist/insightsOverview.d.mts +3 -1
- package/dist/insightsOverview.mjs +4 -5
- package/dist/internal.cjs +32 -8
- package/dist/internal.d.cts +11 -10
- package/dist/internal.d.mts +11 -10
- package/dist/internal.mjs +8 -5
- package/dist/releaseCatalogCompiler.cjs +1 -1
- package/dist/releaseCatalogCompiler.mjs +2 -2
- package/dist/releaseCatalogMutation.cjs +0 -292
- package/dist/releaseCatalogMutation.d.cts +4 -45
- package/dist/releaseCatalogMutation.d.mts +4 -45
- package/dist/releaseCatalogMutation.mjs +1 -288
- package/dist/releaseManagement.cjs +0 -221
- package/dist/releaseManagement.d.cts +4 -28
- package/dist/releaseManagement.d.mts +4 -28
- package/dist/releaseManagement.mjs +1 -216
- package/dist/types/databaseConfig.cjs +5 -0
- package/dist/types/databaseConfig.d.cts +33 -0
- package/dist/types/databaseConfig.d.mts +33 -0
- package/dist/types/databaseConfig.mjs +5 -0
- package/dist/types/databaseOperations.d.cts +5 -174
- package/dist/types/databaseOperations.d.mts +5 -174
- package/dist/types/index.cjs +2 -0
- package/dist/types/index.d.cts +8 -73
- package/dist/types/index.d.mts +8 -73
- package/dist/types/index.mjs +2 -1
- package/dist/types/insights.d.cts +172 -0
- package/dist/types/insights.d.mts +172 -0
- package/dist/types/internal.d.cts +4 -7
- package/dist/types/internal.d.mts +4 -7
- package/dist/types/models.d.cts +24 -0
- package/dist/types/models.d.mts +24 -0
- package/dist/types/public.d.cts +4 -2
- package/dist/types/public.d.mts +4 -2
- package/package.json +1 -1
- package/dist/calculatePagination.cjs +0 -25
- package/dist/calculatePagination.d.cts +0 -12
- package/dist/calculatePagination.d.mts +0 -12
- package/dist/calculatePagination.mjs +0 -25
- package/dist/createDatabasePlugin.cjs +0 -875
- package/dist/createDatabasePlugin.d.cts +0 -28
- package/dist/createDatabasePlugin.d.mts +0 -28
- package/dist/createDatabasePlugin.mjs +0 -871
- package/dist/databaseClient.cjs +0 -117
- package/dist/databaseClient.d.cts +0 -32
- package/dist/databaseClient.d.mts +0 -32
- package/dist/databaseClient.mjs +0 -114
- package/dist/databaseClientReads.cjs +0 -115
- package/dist/databaseClientReads.mjs +0 -113
- package/dist/databaseClientUpdates.cjs +0 -37
- package/dist/databaseClientUpdates.d.cts +0 -11
- package/dist/databaseClientUpdates.d.mts +0 -11
- package/dist/databaseClientUpdates.mjs +0 -35
- package/dist/databasePluginCrud.cjs +0 -87
- package/dist/databasePluginCrud.d.cts +0 -4
- package/dist/databasePluginCrud.d.mts +0 -4
- package/dist/databasePluginCrud.mjs +0 -86
- package/dist/databasePluginCrudValidation.d.cts +0 -6
- package/dist/databasePluginCrudValidation.d.mts +0 -6
- package/dist/databasePluginCrudValidationErrors.cjs +0 -11
- package/dist/databasePluginCrudValidationErrors.d.cts +0 -9
- package/dist/databasePluginCrudValidationErrors.d.mts +0 -9
- package/dist/databasePluginCrudValidationErrors.mjs +0 -11
- package/dist/databasePluginCrudValidationFields.cjs +0 -284
- package/dist/databasePluginCrudValidationFields.d.cts +0 -1
- package/dist/databasePluginCrudValidationFields.d.mts +0 -1
- package/dist/databasePluginCrudValidationFields.mjs +0 -272
- package/dist/databasePluginCrudValidationMutations.cjs +0 -88
- package/dist/databasePluginCrudValidationMutations.d.cts +0 -1
- package/dist/databasePluginCrudValidationMutations.d.mts +0 -1
- package/dist/databasePluginCrudValidationMutations.mjs +0 -82
- package/dist/databasePluginCrudValidationQueries.cjs +0 -103
- package/dist/databasePluginCrudValidationQueries.d.cts +0 -2
- package/dist/databasePluginCrudValidationQueries.d.mts +0 -2
- package/dist/databasePluginCrudValidationQueries.mjs +0 -97
- package/dist/databasePluginCrudValidationRows.cjs +0 -55
- package/dist/databasePluginCrudValidationRows.d.cts +0 -1
- package/dist/databasePluginCrudValidationRows.d.mts +0 -1
- package/dist/databasePluginCrudValidationRows.mjs +0 -53
- package/dist/databasePluginTransaction.cjs +0 -7
- package/dist/databasePluginTransaction.mjs +0 -7
- package/dist/insightsLatestQueries.cjs +0 -53
- package/dist/insightsLatestQueries.d.cts +0 -13
- package/dist/insightsLatestQueries.d.mts +0 -13
- package/dist/insightsLatestQueries.mjs +0 -52
- package/dist/paginateBundles.cjs +0 -53
- package/dist/paginateBundles.d.cts +0 -13
- package/dist/paginateBundles.d.mts +0 -13
- package/dist/paginateBundles.mjs +0 -53
- package/dist/queryBundles.cjs +0 -34
- package/dist/queryBundles.d.cts +0 -9
- package/dist/queryBundles.d.mts +0 -9
- package/dist/queryBundles.mjs +0 -32
- package/dist/requestBundleCache.cjs +0 -22
- package/dist/requestBundleCache.d.cts +0 -8
- package/dist/requestBundleCache.d.mts +0 -8
- package/dist/requestBundleCache.mjs +0 -22
- package/dist/types/database.d.cts +0 -5
- package/dist/types/database.d.mts +0 -5
- package/dist/types/databaseFields.cjs +0 -85
- package/dist/types/databaseFields.d.cts +0 -12
- package/dist/types/databaseFields.d.mts +0 -12
- package/dist/types/databaseFields.mjs +0 -85
- package/dist/types/databasePlugin.d.cts +0 -388
- package/dist/types/databasePlugin.d.mts +0 -388
- package/dist/types/databaseQuery.d.cts +0 -46
- package/dist/types/databaseQuery.d.mts +0 -46
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { findPhysicalColumn, indexOrderColumns } from "./adapter.mjs";
|
|
2
|
+
//#region src/database/values.ts
|
|
3
|
+
var DatabaseValueError = class extends Error {
|
|
4
|
+
name = "DatabaseValueError";
|
|
5
|
+
};
|
|
6
|
+
/** Compares strings in UTF-8 byte order, which is Unicode code point order. */
|
|
7
|
+
const compareUtf8 = (left, right) => {
|
|
8
|
+
let leftIndex = 0;
|
|
9
|
+
let rightIndex = 0;
|
|
10
|
+
while (leftIndex < left.length && rightIndex < right.length) {
|
|
11
|
+
const leftPoint = left.codePointAt(leftIndex);
|
|
12
|
+
const rightPoint = right.codePointAt(rightIndex);
|
|
13
|
+
if (leftPoint !== rightPoint) return leftPoint < rightPoint ? -1 : 1;
|
|
14
|
+
leftIndex += leftPoint > 65535 ? 2 : 1;
|
|
15
|
+
rightIndex += rightPoint > 65535 ? 2 : 1;
|
|
16
|
+
}
|
|
17
|
+
const leftDone = leftIndex >= left.length;
|
|
18
|
+
return leftDone === rightIndex >= right.length ? 0 : leftDone ? -1 : 1;
|
|
19
|
+
};
|
|
20
|
+
/** Orders strings by UTF-8 bytes, numbers numerically, and false before true. */
|
|
21
|
+
const compareKeyValues = (left, right) => {
|
|
22
|
+
if (typeof left === "string" && typeof right === "string") return compareUtf8(left, right);
|
|
23
|
+
if (typeof left === "number" && typeof right === "number") return left < right ? -1 : left > right ? 1 : 0;
|
|
24
|
+
if (typeof left === "boolean" && typeof right === "boolean") return Number(left) - Number(right);
|
|
25
|
+
throw new DatabaseValueError(`Cannot compare ${typeof left} with ${typeof right}.`);
|
|
26
|
+
};
|
|
27
|
+
/** Compares tuples element by element; a shorter equal prefix sorts first. */
|
|
28
|
+
const compareTuples = (left, right) => {
|
|
29
|
+
for (let index = 0; index < Math.min(left.length, right.length); index += 1) {
|
|
30
|
+
const result = compareKeyValues(left[index], right[index]);
|
|
31
|
+
if (result !== 0) return result;
|
|
32
|
+
}
|
|
33
|
+
return left.length - right.length;
|
|
34
|
+
};
|
|
35
|
+
/** JSON text with object keys sorted, so a value compares equal after a store reorders map keys. */
|
|
36
|
+
const canonicalJson = (value) => JSON.stringify(value ?? null, (_, inner) => inner !== null && typeof inner === "object" && !Array.isArray(inner) ? Object.fromEntries(Object.entries(inner).sort(([left], [right]) => compareUtf8(left, right))) : inner);
|
|
37
|
+
const isKeyValue = (value) => typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value);
|
|
38
|
+
/** Every `eq` tuple a row is indexed under; none when an index field is null. */
|
|
39
|
+
const indexEntries = (table, index, row) => {
|
|
40
|
+
if (index.sort.some((column) => !isKeyValue(row[column]))) return [];
|
|
41
|
+
let entries = [[]];
|
|
42
|
+
for (const column of index.eq) {
|
|
43
|
+
const value = row[column];
|
|
44
|
+
const values = findPhysicalColumn(table, column).multi ? Array.isArray(value) ? value.filter(isKeyValue) : [] : isKeyValue(value) ? [value] : [];
|
|
45
|
+
if (values.length === 0) return [];
|
|
46
|
+
entries = entries.flatMap((entry) => [...new Set(values)].map((item) => [...entry, item]));
|
|
47
|
+
}
|
|
48
|
+
return entries;
|
|
49
|
+
};
|
|
50
|
+
/** The row's position in an index read, following `indexOrderColumns`. */
|
|
51
|
+
const indexOrderTuple = (table, index, row) => indexOrderColumns(table, index).map((column) => {
|
|
52
|
+
const value = row[column];
|
|
53
|
+
if (!isKeyValue(value)) throw new DatabaseValueError(`${table.name}.${column} is not orderable for index ${index.name}.`);
|
|
54
|
+
return value;
|
|
55
|
+
});
|
|
56
|
+
const satisfiesBound = (tuple, bound, side) => {
|
|
57
|
+
if (bound === void 0) return true;
|
|
58
|
+
const result = compareTuples(tuple.slice(0, bound.values.length), bound.values);
|
|
59
|
+
if (result === 0) return bound.inclusive;
|
|
60
|
+
return side === "lower" ? result > 0 : result < 0;
|
|
61
|
+
};
|
|
62
|
+
/** Whether a stored row belongs to the result range of a query. */
|
|
63
|
+
const matchesQuery = (table, index, request, row) => indexEntries(table, index, row).some((entry) => compareTuples(entry, request.eq) === 0) && satisfiesBound(indexOrderTuple(table, index, row), request.lower, "lower") && satisfiesBound(indexOrderTuple(table, index, row), request.upper, "upper");
|
|
64
|
+
const INTEGER_TEXT = /^-?\d+$/u;
|
|
65
|
+
const NUMBER_TEXT = /^-?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/iu;
|
|
66
|
+
const toNumber = (raw, integer) => {
|
|
67
|
+
const text = typeof raw === "bigint" ? raw.toString() : typeof raw === "string" ? raw : typeof raw === "object" && raw !== null && "toString" in raw ? String(raw) : void 0;
|
|
68
|
+
const value = typeof raw === "number" ? raw : text !== void 0 && (integer ? INTEGER_TEXT : NUMBER_TEXT).test(text) ? Number(text) : NaN;
|
|
69
|
+
if (integer ? !Number.isSafeInteger(value) : !Number.isFinite(value)) throw new DatabaseValueError(`Expected a ${integer ? "safe integer" : "finite number"}.`);
|
|
70
|
+
return value;
|
|
71
|
+
};
|
|
72
|
+
const toBoolean = (raw) => {
|
|
73
|
+
if (raw === true || raw === 1 || raw === 1n || raw === "1" || raw === "t") return true;
|
|
74
|
+
if (raw === false || raw === 0 || raw === 0n || raw === "0" || raw === "f") return false;
|
|
75
|
+
if (raw === "true" || raw === "false") return raw === "true";
|
|
76
|
+
throw new DatabaseValueError("Expected a boolean.");
|
|
77
|
+
};
|
|
78
|
+
const toScalar = (column, raw) => {
|
|
79
|
+
switch (column.type) {
|
|
80
|
+
case "string":
|
|
81
|
+
if (typeof raw !== "string") throw new DatabaseValueError(`Expected a string in ${column.name}.`);
|
|
82
|
+
return raw;
|
|
83
|
+
case "integer":
|
|
84
|
+
case "number": return toNumber(raw, column.type === "integer");
|
|
85
|
+
case "boolean": return toBoolean(raw);
|
|
86
|
+
case "json": return raw;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
/** Converts a backend value (int8 text, BigInt, Decimal, 0/1, JSON text) to a stored value. */
|
|
90
|
+
const normalizeStoredValue = (column, raw, options) => {
|
|
91
|
+
if (raw === null || raw === void 0) return null;
|
|
92
|
+
const parsed = options.jsonText && (column.multi || column.type === "json") && typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
93
|
+
if (!column.multi) return toScalar(column, parsed);
|
|
94
|
+
if (!Array.isArray(parsed) || parsed.length > 16) throw new DatabaseValueError(`Expected at most 16 values in ${column.name}.`);
|
|
95
|
+
return parsed.map((item) => toScalar(column, item));
|
|
96
|
+
};
|
|
97
|
+
/** Converts every column of a backend row; unknown backend columns are dropped. */
|
|
98
|
+
const normalizeStoredRow = (table, raw, options) => Object.fromEntries(table.columns.map((column) => [column.name, normalizeStoredValue(column, raw[column.name], options)]));
|
|
99
|
+
//#endregion
|
|
100
|
+
export { DatabaseValueError, canonicalJson, compareKeyValues, compareTuples, compareUtf8, indexEntries, indexOrderTuple, isKeyValue, matchesQuery, normalizeStoredRow, normalizeStoredValue };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
const require_adapter = require("./adapter.cjs");
|
|
2
|
+
const require_values = require("./values.cjs");
|
|
3
|
+
//#region src/database/verifyAdapter.ts
|
|
4
|
+
var DatabaseAdapterContractError = class extends Error {
|
|
5
|
+
name = "DatabaseAdapterContractError";
|
|
6
|
+
};
|
|
7
|
+
const EMPTY = {
|
|
8
|
+
gets: 0,
|
|
9
|
+
keys: 0,
|
|
10
|
+
queries: 0,
|
|
11
|
+
rows: 0
|
|
12
|
+
};
|
|
13
|
+
const createReadMeter = () => {
|
|
14
|
+
const tables = /* @__PURE__ */ new Map();
|
|
15
|
+
const add = (table, count) => {
|
|
16
|
+
const current = tables.get(table) ?? EMPTY;
|
|
17
|
+
tables.set(table, {
|
|
18
|
+
gets: current.gets + (count.gets ?? 0),
|
|
19
|
+
keys: current.keys + (count.keys ?? 0),
|
|
20
|
+
queries: current.queries + (count.queries ?? 0),
|
|
21
|
+
rows: current.rows + (count.rows ?? 0)
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
add,
|
|
26
|
+
meter: {
|
|
27
|
+
total: () => [...tables.values()].reduce((sum, count) => ({
|
|
28
|
+
gets: sum.gets + count.gets,
|
|
29
|
+
keys: sum.keys + count.keys,
|
|
30
|
+
queries: sum.queries + count.queries,
|
|
31
|
+
rows: sum.rows + count.rows
|
|
32
|
+
}), EMPTY),
|
|
33
|
+
byTable: (table) => tables.get(table) ?? EMPTY,
|
|
34
|
+
reset: () => tables.clear()
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
const fail = (message) => {
|
|
39
|
+
throw new DatabaseAdapterContractError(message);
|
|
40
|
+
};
|
|
41
|
+
const sameKey = (left, right) => left.length === right.length && require_values.compareTuples(left, right) === 0;
|
|
42
|
+
const verifyRequest = (table, request) => {
|
|
43
|
+
const index = require_adapter.findPhysicalIndex(table, request.index);
|
|
44
|
+
if (!Number.isSafeInteger(request.limit) || request.limit < 1 || request.limit > 500) fail(`query limit must be 1–500.`);
|
|
45
|
+
if (request.eq.length !== index.eq.length || !request.eq.every(require_values.isKeyValue)) fail(`query on ${table.name}.${index.name} must bind every eq column.`);
|
|
46
|
+
return index;
|
|
47
|
+
};
|
|
48
|
+
const verifyRows = (table, request, rows) => {
|
|
49
|
+
const index = require_adapter.findPhysicalIndex(table, request.index);
|
|
50
|
+
if (rows.length > request.limit) fail(`${table.name}.${index.name} returned more than ${request.limit} rows.`);
|
|
51
|
+
let previous;
|
|
52
|
+
for (const row of rows) {
|
|
53
|
+
if (!require_values.matchesQuery(table, index, request, row)) fail(`${table.name}.${index.name} returned a row outside the request.`);
|
|
54
|
+
const tuple = require_values.indexOrderTuple(table, index, row);
|
|
55
|
+
if (previous !== void 0) {
|
|
56
|
+
const order = require_values.compareTuples(previous, tuple);
|
|
57
|
+
if (request.order === "asc" ? order >= 0 : order <= 0) fail(`${table.name}.${index.name} returned rows out of order.`);
|
|
58
|
+
}
|
|
59
|
+
previous = tuple;
|
|
60
|
+
}
|
|
61
|
+
return previous;
|
|
62
|
+
};
|
|
63
|
+
const verifyWrite = (adapter, ops) => {
|
|
64
|
+
if (ops.length === 0) fail("write needs at least one op.");
|
|
65
|
+
const seen = /* @__PURE__ */ new Set();
|
|
66
|
+
for (const op of ops) {
|
|
67
|
+
const key = op.type === "insert" ? require_adapter.rowKey(op.table, op.row) : op.key;
|
|
68
|
+
const id = JSON.stringify([op.table.name, key]);
|
|
69
|
+
if (seen.has(id)) fail(`write touches ${op.table.name} ${id} twice.`);
|
|
70
|
+
seen.add(id);
|
|
71
|
+
if (op.type === "insert" && typeof op.row["_v"] !== "number") fail(`insert into ${op.table.name} must set _v.`);
|
|
72
|
+
if (op.type === "patch" && Object.keys(op.set).some((column) => column === "_v" || op.table.key.includes(column))) fail(`patch of ${op.table.name} may not set key columns or _v.`);
|
|
73
|
+
}
|
|
74
|
+
if (!adapter.fits(ops)) fail("write does not fit in one atomic write.");
|
|
75
|
+
};
|
|
76
|
+
/** Wraps an adapter to check the contract at its boundary and count reads. */
|
|
77
|
+
const verifyAdapter = (adapter, options = {}) => {
|
|
78
|
+
const { add, meter } = createReadMeter();
|
|
79
|
+
return {
|
|
80
|
+
...adapter,
|
|
81
|
+
id: adapter.id,
|
|
82
|
+
reads: meter,
|
|
83
|
+
fits: (ops) => adapter.fits(ops),
|
|
84
|
+
async get(table, keys) {
|
|
85
|
+
const rows = await adapter.get(table, keys);
|
|
86
|
+
add(table.name, {
|
|
87
|
+
gets: 1,
|
|
88
|
+
keys: keys.length
|
|
89
|
+
});
|
|
90
|
+
if (rows.length !== keys.length) fail(`${table.name} get returned ${rows.length} rows for ${keys.length} keys.`);
|
|
91
|
+
rows.forEach((row, position) => {
|
|
92
|
+
if (row !== null && !sameKey(require_adapter.rowKey(table, row), keys[position])) fail(`${table.name} get returned a row for another key.`);
|
|
93
|
+
});
|
|
94
|
+
return rows;
|
|
95
|
+
},
|
|
96
|
+
async query(table, request) {
|
|
97
|
+
const index = verifyRequest(table, request);
|
|
98
|
+
const rows = await adapter.query(table, request);
|
|
99
|
+
add(table.name, {
|
|
100
|
+
queries: 1,
|
|
101
|
+
rows: rows.length
|
|
102
|
+
});
|
|
103
|
+
const last = verifyRows(table, request, rows);
|
|
104
|
+
if (options.probeShortPages && last !== void 0 && rows.length < request.limit) {
|
|
105
|
+
const bound = {
|
|
106
|
+
values: last,
|
|
107
|
+
inclusive: false
|
|
108
|
+
};
|
|
109
|
+
if ((await adapter.query(table, {
|
|
110
|
+
...request,
|
|
111
|
+
limit: 1,
|
|
112
|
+
...request.order === "asc" ? { lower: bound } : { upper: bound }
|
|
113
|
+
})).length > 0) fail(`${table.name}.${index.name} returned a short page before the range ended.`);
|
|
114
|
+
}
|
|
115
|
+
return rows;
|
|
116
|
+
},
|
|
117
|
+
async write(ops) {
|
|
118
|
+
verifyWrite(adapter, ops);
|
|
119
|
+
const result = await adapter.write(ops);
|
|
120
|
+
if (!result.ok && "failedOp" in result) {
|
|
121
|
+
if (!Number.isSafeInteger(result.failedOp) || result.failedOp < 0 || result.failedOp >= ops.length) fail(`write reported failedOp ${result.failedOp} for ${ops.length} ops.`);
|
|
122
|
+
}
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
//#endregion
|
|
128
|
+
exports.DatabaseAdapterContractError = DatabaseAdapterContractError;
|
|
129
|
+
exports.verifyAdapter = verifyAdapter;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DatabaseAdapter } from "./adapter.cjs";
|
|
2
|
+
//#region src/database/verifyAdapter.d.ts
|
|
3
|
+
declare class DatabaseAdapterContractError extends Error {
|
|
4
|
+
readonly name = "DatabaseAdapterContractError";
|
|
5
|
+
}
|
|
6
|
+
interface DatabaseReadCount {
|
|
7
|
+
/** `get` calls and the keys they asked for, found or not. */
|
|
8
|
+
readonly gets: number;
|
|
9
|
+
readonly keys: number;
|
|
10
|
+
/** `query` calls, zero-row calls included, and the rows they returned. */
|
|
11
|
+
readonly queries: number;
|
|
12
|
+
readonly rows: number;
|
|
13
|
+
}
|
|
14
|
+
interface DatabaseReadMeter {
|
|
15
|
+
total(): DatabaseReadCount;
|
|
16
|
+
byTable(table: string): DatabaseReadCount;
|
|
17
|
+
reset(): void;
|
|
18
|
+
}
|
|
19
|
+
interface VerifiedDatabaseAdapter extends DatabaseAdapter {
|
|
20
|
+
readonly reads: DatabaseReadMeter;
|
|
21
|
+
}
|
|
22
|
+
interface VerifyAdapterOptions {
|
|
23
|
+
/** After a short page, probe once past its last row to prove the range ended. */
|
|
24
|
+
readonly probeShortPages?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** Wraps an adapter to check the contract at its boundary and count reads. */
|
|
27
|
+
declare const verifyAdapter: (adapter: DatabaseAdapter, options?: VerifyAdapterOptions) => VerifiedDatabaseAdapter;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { DatabaseAdapterContractError, DatabaseReadCount, DatabaseReadMeter, VerifiedDatabaseAdapter, VerifyAdapterOptions, verifyAdapter };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DatabaseAdapter } from "./adapter.mjs";
|
|
2
|
+
//#region src/database/verifyAdapter.d.ts
|
|
3
|
+
declare class DatabaseAdapterContractError extends Error {
|
|
4
|
+
readonly name = "DatabaseAdapterContractError";
|
|
5
|
+
}
|
|
6
|
+
interface DatabaseReadCount {
|
|
7
|
+
/** `get` calls and the keys they asked for, found or not. */
|
|
8
|
+
readonly gets: number;
|
|
9
|
+
readonly keys: number;
|
|
10
|
+
/** `query` calls, zero-row calls included, and the rows they returned. */
|
|
11
|
+
readonly queries: number;
|
|
12
|
+
readonly rows: number;
|
|
13
|
+
}
|
|
14
|
+
interface DatabaseReadMeter {
|
|
15
|
+
total(): DatabaseReadCount;
|
|
16
|
+
byTable(table: string): DatabaseReadCount;
|
|
17
|
+
reset(): void;
|
|
18
|
+
}
|
|
19
|
+
interface VerifiedDatabaseAdapter extends DatabaseAdapter {
|
|
20
|
+
readonly reads: DatabaseReadMeter;
|
|
21
|
+
}
|
|
22
|
+
interface VerifyAdapterOptions {
|
|
23
|
+
/** After a short page, probe once past its last row to prove the range ended. */
|
|
24
|
+
readonly probeShortPages?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** Wraps an adapter to check the contract at its boundary and count reads. */
|
|
27
|
+
declare const verifyAdapter: (adapter: DatabaseAdapter, options?: VerifyAdapterOptions) => VerifiedDatabaseAdapter;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { DatabaseAdapterContractError, DatabaseReadCount, DatabaseReadMeter, VerifiedDatabaseAdapter, VerifyAdapterOptions, verifyAdapter };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { findPhysicalIndex, rowKey } from "./adapter.mjs";
|
|
2
|
+
import { compareTuples, indexOrderTuple, isKeyValue, matchesQuery } from "./values.mjs";
|
|
3
|
+
//#region src/database/verifyAdapter.ts
|
|
4
|
+
var DatabaseAdapterContractError = class extends Error {
|
|
5
|
+
name = "DatabaseAdapterContractError";
|
|
6
|
+
};
|
|
7
|
+
const EMPTY = {
|
|
8
|
+
gets: 0,
|
|
9
|
+
keys: 0,
|
|
10
|
+
queries: 0,
|
|
11
|
+
rows: 0
|
|
12
|
+
};
|
|
13
|
+
const createReadMeter = () => {
|
|
14
|
+
const tables = /* @__PURE__ */ new Map();
|
|
15
|
+
const add = (table, count) => {
|
|
16
|
+
const current = tables.get(table) ?? EMPTY;
|
|
17
|
+
tables.set(table, {
|
|
18
|
+
gets: current.gets + (count.gets ?? 0),
|
|
19
|
+
keys: current.keys + (count.keys ?? 0),
|
|
20
|
+
queries: current.queries + (count.queries ?? 0),
|
|
21
|
+
rows: current.rows + (count.rows ?? 0)
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
add,
|
|
26
|
+
meter: {
|
|
27
|
+
total: () => [...tables.values()].reduce((sum, count) => ({
|
|
28
|
+
gets: sum.gets + count.gets,
|
|
29
|
+
keys: sum.keys + count.keys,
|
|
30
|
+
queries: sum.queries + count.queries,
|
|
31
|
+
rows: sum.rows + count.rows
|
|
32
|
+
}), EMPTY),
|
|
33
|
+
byTable: (table) => tables.get(table) ?? EMPTY,
|
|
34
|
+
reset: () => tables.clear()
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
const fail = (message) => {
|
|
39
|
+
throw new DatabaseAdapterContractError(message);
|
|
40
|
+
};
|
|
41
|
+
const sameKey = (left, right) => left.length === right.length && compareTuples(left, right) === 0;
|
|
42
|
+
const verifyRequest = (table, request) => {
|
|
43
|
+
const index = findPhysicalIndex(table, request.index);
|
|
44
|
+
if (!Number.isSafeInteger(request.limit) || request.limit < 1 || request.limit > 500) fail(`query limit must be 1–500.`);
|
|
45
|
+
if (request.eq.length !== index.eq.length || !request.eq.every(isKeyValue)) fail(`query on ${table.name}.${index.name} must bind every eq column.`);
|
|
46
|
+
return index;
|
|
47
|
+
};
|
|
48
|
+
const verifyRows = (table, request, rows) => {
|
|
49
|
+
const index = findPhysicalIndex(table, request.index);
|
|
50
|
+
if (rows.length > request.limit) fail(`${table.name}.${index.name} returned more than ${request.limit} rows.`);
|
|
51
|
+
let previous;
|
|
52
|
+
for (const row of rows) {
|
|
53
|
+
if (!matchesQuery(table, index, request, row)) fail(`${table.name}.${index.name} returned a row outside the request.`);
|
|
54
|
+
const tuple = indexOrderTuple(table, index, row);
|
|
55
|
+
if (previous !== void 0) {
|
|
56
|
+
const order = compareTuples(previous, tuple);
|
|
57
|
+
if (request.order === "asc" ? order >= 0 : order <= 0) fail(`${table.name}.${index.name} returned rows out of order.`);
|
|
58
|
+
}
|
|
59
|
+
previous = tuple;
|
|
60
|
+
}
|
|
61
|
+
return previous;
|
|
62
|
+
};
|
|
63
|
+
const verifyWrite = (adapter, ops) => {
|
|
64
|
+
if (ops.length === 0) fail("write needs at least one op.");
|
|
65
|
+
const seen = /* @__PURE__ */ new Set();
|
|
66
|
+
for (const op of ops) {
|
|
67
|
+
const key = op.type === "insert" ? rowKey(op.table, op.row) : op.key;
|
|
68
|
+
const id = JSON.stringify([op.table.name, key]);
|
|
69
|
+
if (seen.has(id)) fail(`write touches ${op.table.name} ${id} twice.`);
|
|
70
|
+
seen.add(id);
|
|
71
|
+
if (op.type === "insert" && typeof op.row["_v"] !== "number") fail(`insert into ${op.table.name} must set _v.`);
|
|
72
|
+
if (op.type === "patch" && Object.keys(op.set).some((column) => column === "_v" || op.table.key.includes(column))) fail(`patch of ${op.table.name} may not set key columns or _v.`);
|
|
73
|
+
}
|
|
74
|
+
if (!adapter.fits(ops)) fail("write does not fit in one atomic write.");
|
|
75
|
+
};
|
|
76
|
+
/** Wraps an adapter to check the contract at its boundary and count reads. */
|
|
77
|
+
const verifyAdapter = (adapter, options = {}) => {
|
|
78
|
+
const { add, meter } = createReadMeter();
|
|
79
|
+
return {
|
|
80
|
+
...adapter,
|
|
81
|
+
id: adapter.id,
|
|
82
|
+
reads: meter,
|
|
83
|
+
fits: (ops) => adapter.fits(ops),
|
|
84
|
+
async get(table, keys) {
|
|
85
|
+
const rows = await adapter.get(table, keys);
|
|
86
|
+
add(table.name, {
|
|
87
|
+
gets: 1,
|
|
88
|
+
keys: keys.length
|
|
89
|
+
});
|
|
90
|
+
if (rows.length !== keys.length) fail(`${table.name} get returned ${rows.length} rows for ${keys.length} keys.`);
|
|
91
|
+
rows.forEach((row, position) => {
|
|
92
|
+
if (row !== null && !sameKey(rowKey(table, row), keys[position])) fail(`${table.name} get returned a row for another key.`);
|
|
93
|
+
});
|
|
94
|
+
return rows;
|
|
95
|
+
},
|
|
96
|
+
async query(table, request) {
|
|
97
|
+
const index = verifyRequest(table, request);
|
|
98
|
+
const rows = await adapter.query(table, request);
|
|
99
|
+
add(table.name, {
|
|
100
|
+
queries: 1,
|
|
101
|
+
rows: rows.length
|
|
102
|
+
});
|
|
103
|
+
const last = verifyRows(table, request, rows);
|
|
104
|
+
if (options.probeShortPages && last !== void 0 && rows.length < request.limit) {
|
|
105
|
+
const bound = {
|
|
106
|
+
values: last,
|
|
107
|
+
inclusive: false
|
|
108
|
+
};
|
|
109
|
+
if ((await adapter.query(table, {
|
|
110
|
+
...request,
|
|
111
|
+
limit: 1,
|
|
112
|
+
...request.order === "asc" ? { lower: bound } : { upper: bound }
|
|
113
|
+
})).length > 0) fail(`${table.name}.${index.name} returned a short page before the range ended.`);
|
|
114
|
+
}
|
|
115
|
+
return rows;
|
|
116
|
+
},
|
|
117
|
+
async write(ops) {
|
|
118
|
+
verifyWrite(adapter, ops);
|
|
119
|
+
const result = await adapter.write(ops);
|
|
120
|
+
if (!result.ok && "failedOp" in result) {
|
|
121
|
+
if (!Number.isSafeInteger(result.failedOp) || result.failedOp < 0 || result.failedOp >= ops.length) fail(`write reported failedOp ${result.failedOp} for ${ops.length} ops.`);
|
|
122
|
+
}
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
//#endregion
|
|
128
|
+
export { DatabaseAdapterContractError, verifyAdapter };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/databaseErrors.ts
|
|
2
|
+
/** A bundle an operation names is not stored. */
|
|
3
|
+
var DatabaseBundleNotFoundError = class extends Error {
|
|
4
|
+
bundleId;
|
|
5
|
+
name = "DatabaseBundleNotFoundError";
|
|
6
|
+
constructor(bundleId) {
|
|
7
|
+
super(`Bundle "${bundleId}" was not found.`);
|
|
8
|
+
this.bundleId = bundleId;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
/** A row a delete names is still referenced, such as a bundle a release uses. */
|
|
12
|
+
var DatabaseRowReferencedError = class extends Error {
|
|
13
|
+
name = "DatabaseRowReferencedError";
|
|
14
|
+
constructor() {
|
|
15
|
+
super("The database row is still referenced.");
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
/** Input a database operation refuses before touching storage. */
|
|
19
|
+
var DatabasePluginInputError = class extends Error {
|
|
20
|
+
code;
|
|
21
|
+
name = "DatabasePluginInputError";
|
|
22
|
+
constructor(code) {
|
|
23
|
+
super(`Invalid database plugin input: ${code}`);
|
|
24
|
+
this.code = code;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.DatabaseBundleNotFoundError = DatabaseBundleNotFoundError;
|
|
29
|
+
exports.DatabasePluginInputError = DatabasePluginInputError;
|
|
30
|
+
exports.DatabaseRowReferencedError = DatabaseRowReferencedError;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/databaseErrors.d.ts
|
|
2
|
+
/** A bundle an operation names is not stored. */
|
|
3
|
+
declare class DatabaseBundleNotFoundError extends Error {
|
|
4
|
+
readonly bundleId: string;
|
|
5
|
+
readonly name = "DatabaseBundleNotFoundError";
|
|
6
|
+
constructor(bundleId: string);
|
|
7
|
+
}
|
|
8
|
+
/** A row a delete names is still referenced, such as a bundle a release uses. */
|
|
9
|
+
declare class DatabaseRowReferencedError extends Error {
|
|
10
|
+
readonly name = "DatabaseRowReferencedError";
|
|
11
|
+
constructor();
|
|
12
|
+
}
|
|
13
|
+
type DatabasePluginInputErrorCode = "invalid-data" | "invalid-field" | "invalid-pagination" | "invalid-query" | "invalid-result";
|
|
14
|
+
/** Input a database operation refuses before touching storage. */
|
|
15
|
+
declare class DatabasePluginInputError extends Error {
|
|
16
|
+
readonly code: DatabasePluginInputErrorCode;
|
|
17
|
+
readonly name = "DatabasePluginInputError";
|
|
18
|
+
constructor(code: DatabasePluginInputErrorCode);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { DatabaseBundleNotFoundError, DatabasePluginInputError, DatabasePluginInputErrorCode, DatabaseRowReferencedError };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/databaseErrors.d.ts
|
|
2
|
+
/** A bundle an operation names is not stored. */
|
|
3
|
+
declare class DatabaseBundleNotFoundError extends Error {
|
|
4
|
+
readonly bundleId: string;
|
|
5
|
+
readonly name = "DatabaseBundleNotFoundError";
|
|
6
|
+
constructor(bundleId: string);
|
|
7
|
+
}
|
|
8
|
+
/** A row a delete names is still referenced, such as a bundle a release uses. */
|
|
9
|
+
declare class DatabaseRowReferencedError extends Error {
|
|
10
|
+
readonly name = "DatabaseRowReferencedError";
|
|
11
|
+
constructor();
|
|
12
|
+
}
|
|
13
|
+
type DatabasePluginInputErrorCode = "invalid-data" | "invalid-field" | "invalid-pagination" | "invalid-query" | "invalid-result";
|
|
14
|
+
/** Input a database operation refuses before touching storage. */
|
|
15
|
+
declare class DatabasePluginInputError extends Error {
|
|
16
|
+
readonly code: DatabasePluginInputErrorCode;
|
|
17
|
+
readonly name = "DatabasePluginInputError";
|
|
18
|
+
constructor(code: DatabasePluginInputErrorCode);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { DatabaseBundleNotFoundError, DatabasePluginInputError, DatabasePluginInputErrorCode, DatabaseRowReferencedError };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/databaseErrors.ts
|
|
2
|
+
/** A bundle an operation names is not stored. */
|
|
3
|
+
var DatabaseBundleNotFoundError = class extends Error {
|
|
4
|
+
bundleId;
|
|
5
|
+
name = "DatabaseBundleNotFoundError";
|
|
6
|
+
constructor(bundleId) {
|
|
7
|
+
super(`Bundle "${bundleId}" was not found.`);
|
|
8
|
+
this.bundleId = bundleId;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
/** A row a delete names is still referenced, such as a bundle a release uses. */
|
|
12
|
+
var DatabaseRowReferencedError = class extends Error {
|
|
13
|
+
name = "DatabaseRowReferencedError";
|
|
14
|
+
constructor() {
|
|
15
|
+
super("The database row is still referenced.");
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
/** Input a database operation refuses before touching storage. */
|
|
19
|
+
var DatabasePluginInputError = class extends Error {
|
|
20
|
+
code;
|
|
21
|
+
name = "DatabasePluginInputError";
|
|
22
|
+
constructor(code) {
|
|
23
|
+
super(`Invalid database plugin input: ${code}`);
|
|
24
|
+
this.code = code;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { DatabaseBundleNotFoundError, DatabasePluginInputError, DatabaseRowReferencedError };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_databaseErrors = require("./databaseErrors.cjs");
|
|
2
2
|
const require_databaseJsonValue = require("./databaseJsonValue.cjs");
|
|
3
3
|
let _hot_updater_core = require("@hot-updater/core");
|
|
4
4
|
//#region src/databaseMetadata.ts
|
|
5
5
|
const bundleMetadataToRow = (metadata) => {
|
|
6
6
|
const value = (0, _hot_updater_core.stripBundleArtifactMetadata)(metadata);
|
|
7
7
|
if (value === void 0) return {};
|
|
8
|
-
if (!require_databaseJsonValue.isDatabaseMetadataObject(value)) throw new
|
|
8
|
+
if (!require_databaseJsonValue.isDatabaseMetadataObject(value)) throw new require_databaseErrors.DatabasePluginInputError("invalid-data");
|
|
9
9
|
return value;
|
|
10
10
|
};
|
|
11
11
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DatabasePluginInputError } from "./
|
|
1
|
+
import { DatabasePluginInputError } from "./databaseErrors.mjs";
|
|
2
2
|
import { isDatabaseMetadataObject } from "./databaseJsonValue.mjs";
|
|
3
3
|
import { stripBundleArtifactMetadata } from "@hot-updater/core";
|
|
4
4
|
//#region src/databaseMetadata.ts
|
package/dist/index.cjs
CHANGED
|
@@ -1,42 +1,34 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_calculatePagination = require("./calculatePagination.cjs");
|
|
3
2
|
const require_contentAddressedAssets = require("./contentAddressedAssets.cjs");
|
|
4
3
|
const require_createStorageKeyBuilder = require("./createStorageKeyBuilder.cjs");
|
|
5
4
|
const require_parseStorageUri = require("./parseStorageUri.cjs");
|
|
6
5
|
const require_assetStorageLayout = require("./assetStorageLayout.cjs");
|
|
7
6
|
const require_bundleStorageLayout = require("./bundleStorageLayout.cjs");
|
|
8
7
|
const require_contentType = require("./contentType.cjs");
|
|
9
|
-
const
|
|
10
|
-
const require_databaseJsonValue = require("./databaseJsonValue.cjs");
|
|
11
|
-
const require_uuidv7 = require("./uuidv7.cjs");
|
|
12
|
-
const require_insightsContract = require("./insightsContract.cjs");
|
|
13
|
-
const require_createDatabasePlugin = require("./createDatabasePlugin.cjs");
|
|
8
|
+
const require_databaseErrors = require("./databaseErrors.cjs");
|
|
14
9
|
const require_createStoragePlugin = require("./createStoragePlugin.cjs");
|
|
10
|
+
const require_databaseJsonValue = require("./databaseJsonValue.cjs");
|
|
15
11
|
const require_databaseRows = require("./databaseRows.cjs");
|
|
16
|
-
const require_databaseClientUpdates = require("./databaseClientUpdates.cjs");
|
|
17
|
-
const require_databaseClient = require("./databaseClient.cjs");
|
|
18
12
|
const require_semverSatisfies = require("./semverSatisfies.cjs");
|
|
19
13
|
const require_filterCompatibleAppVersions = require("./filterCompatibleAppVersions.cjs");
|
|
20
14
|
const require_generateMinBundleId = require("./generateMinBundleId.cjs");
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const require_requestBundleCache = require("./requestBundleCache.cjs");
|
|
15
|
+
const require_uuidv7 = require("./uuidv7.cjs");
|
|
16
|
+
const require_insightsContract = require("./insightsContract.cjs");
|
|
24
17
|
const require_releaseCatalogCompiler = require("./releaseCatalogCompiler.cjs");
|
|
25
|
-
const require_releaseCatalogMutation = require("./releaseCatalogMutation.cjs");
|
|
26
18
|
const require_releaseManagement = require("./releaseManagement.cjs");
|
|
19
|
+
const require_releaseCatalogMutation = require("./releaseCatalogMutation.cjs");
|
|
27
20
|
const require_remoteBundleSigning = require("./remoteBundleSigning.cjs");
|
|
28
21
|
const require_storageDownloadPath = require("./storageDownloadPath.cjs");
|
|
22
|
+
const require_databaseConfig = require("./types/databaseConfig.cjs");
|
|
29
23
|
const require_index = require("./types/index.cjs");
|
|
30
24
|
let _hot_updater_core = require("@hot-updater/core");
|
|
31
25
|
exports.BUNDLE_STORAGE_PREFIX = require_bundleStorageLayout.BUNDLE_STORAGE_PREFIX;
|
|
32
26
|
exports.BundleRowHydrationError = require_databaseRows.BundleRowHydrationError;
|
|
33
27
|
exports.BundleRowHydrationErrorReason = require_databaseRows.BundleRowHydrationErrorReason;
|
|
34
28
|
exports.CONTENT_ADDRESSED_ASSET_PREFIX = require_contentAddressedAssets.CONTENT_ADDRESSED_ASSET_PREFIX;
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.DatabasePatchUpdateUnsupportedError = require_databaseClientUpdates.DatabasePatchUpdateUnsupportedError;
|
|
39
|
-
exports.DatabasePluginInputError = require_databasePluginCrudValidationErrors.DatabasePluginInputError;
|
|
29
|
+
exports.DatabaseBundleNotFoundError = require_databaseErrors.DatabaseBundleNotFoundError;
|
|
30
|
+
exports.DatabasePluginInputError = require_databaseErrors.DatabasePluginInputError;
|
|
31
|
+
exports.DatabaseRowReferencedError = require_databaseErrors.DatabaseRowReferencedError;
|
|
40
32
|
exports.REMOTE_BUNDLE_SIGNING_ALGORITHM = require_remoteBundleSigning.REMOTE_BUNDLE_SIGNING_ALGORITHM;
|
|
41
33
|
exports.REMOTE_BUNDLE_SIGNING_PATH = require_remoteBundleSigning.REMOTE_BUNDLE_SIGNING_PATH;
|
|
42
34
|
exports.REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION = require_remoteBundleSigning.REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION;
|
|
@@ -45,21 +37,13 @@ exports.ReleaseCatalogCompilationError = require_releaseCatalogCompiler.ReleaseC
|
|
|
45
37
|
exports.ReleaseCatalogMutationError = require_releaseCatalogMutation.ReleaseCatalogMutationError;
|
|
46
38
|
exports.ReleaseManagementError = require_releaseManagement.ReleaseManagementError;
|
|
47
39
|
exports.assertStorageOperations = require_createStoragePlugin.assertStorageOperations;
|
|
48
|
-
exports.bundleIdMatchesFilter = require_queryBundles.bundleIdMatchesFilter;
|
|
49
|
-
exports.bundleMatchesQueryWhere = require_queryBundles.bundleMatchesQueryWhere;
|
|
50
40
|
exports.bundleToPatchRows = require_databaseRows.bundleToPatchRows;
|
|
51
41
|
exports.bundleToRow = require_databaseRows.bundleToRow;
|
|
52
|
-
exports.calculatePagination = require_calculatePagination.calculatePagination;
|
|
53
42
|
exports.canonicalizeAppVersion = require_releaseCatalogCompiler.canonicalizeAppVersion;
|
|
54
|
-
exports.commitReleaseCatalogMutation = require_releaseCatalogMutation.commitReleaseCatalogMutation;
|
|
55
|
-
exports.commitReleaseCatalogMutations = require_releaseCatalogMutation.commitReleaseCatalogMutations;
|
|
56
43
|
exports.compareInsightsText = require_insightsContract.compareInsightsText;
|
|
57
44
|
exports.compileReleaseCatalog = require_releaseCatalogCompiler.compileReleaseCatalog;
|
|
58
45
|
exports.createBundleSigningHandler = require_remoteBundleSigning.createBundleSigningHandler;
|
|
59
46
|
exports.createBundleStorageKey = require_bundleStorageLayout.createBundleStorageKey;
|
|
60
|
-
exports.createDatabaseClient = require_databaseClient.createDatabaseClient;
|
|
61
|
-
exports.createDatabasePlugin = require_createDatabasePlugin.createDatabasePlugin;
|
|
62
|
-
exports.createRequestBundleResolver = require_requestBundleCache.createRequestBundleResolver;
|
|
63
47
|
exports.createStorageDownloadPath = require_storageDownloadPath.createStorageDownloadPath;
|
|
64
48
|
exports.createStorageDownloadUrl = require_storageDownloadPath.createStorageDownloadUrl;
|
|
65
49
|
exports.createStorageKeyBuilder = require_createStorageKeyBuilder.createStorageKeyBuilder;
|
|
@@ -70,7 +54,6 @@ exports.createStorageUriWithRelativePath = require_assetStorageLayout.createStor
|
|
|
70
54
|
exports.createUUIDv7 = require_uuidv7.createUUIDv7;
|
|
71
55
|
exports.createUUIDv7After = require_uuidv7.createUUIDv7After;
|
|
72
56
|
exports.createUUIDv7WithSameTimestamp = require_uuidv7.createUUIDv7WithSameTimestamp;
|
|
73
|
-
exports.deleteRelease = require_releaseManagement.deleteRelease;
|
|
74
57
|
exports.extractTimestampFromUUIDv7 = require_uuidv7.extractTimestampFromUUIDv7;
|
|
75
58
|
exports.filterCompatibleAppVersions = require_filterCompatibleAppVersions.filterCompatibleAppVersions;
|
|
76
59
|
exports.generateMinBundleId = require_generateMinBundleId.generateMinBundleId;
|
|
@@ -84,22 +67,17 @@ exports.isContentAddressedAssetFileHash = require_contentAddressedAssets.isConte
|
|
|
84
67
|
exports.isDatabaseBundleEventMetadata = require_databaseJsonValue.isDatabaseBundleEventMetadata;
|
|
85
68
|
exports.isDatabaseMetadataObject = require_databaseJsonValue.isDatabaseMetadataObject;
|
|
86
69
|
exports.isInsightsMovementEvent = require_insightsContract.isInsightsMovementEvent;
|
|
70
|
+
exports.isRemoteDatabase = require_databaseConfig.isRemoteDatabase;
|
|
87
71
|
Object.defineProperty(exports, "isUUIDv7", {
|
|
88
72
|
enumerable: true,
|
|
89
73
|
get: function() {
|
|
90
74
|
return _hot_updater_core.isUUIDv7;
|
|
91
75
|
}
|
|
92
76
|
});
|
|
93
|
-
exports.paginateBundles = require_paginateBundles.paginateBundles;
|
|
94
77
|
exports.parseStorageDownloadPath = require_storageDownloadPath.parseStorageDownloadPath;
|
|
95
78
|
exports.parseStorageUri = require_parseStorageUri.parseStorageUri;
|
|
96
|
-
exports.preflightReleaseCatalogMutation = require_releaseCatalogMutation.preflightReleaseCatalogMutation;
|
|
97
|
-
exports.preflightReleaseCatalogRebuild = require_releaseCatalogMutation.preflightReleaseCatalogRebuild;
|
|
98
|
-
exports.preflightReleasePolicy = require_releaseManagement.preflightReleasePolicy;
|
|
99
79
|
exports.projectCompiledCatalog = require_releaseCatalogCompiler.projectCompiledCatalog;
|
|
100
80
|
exports.projectCompiledRollbackCatalog = require_releaseCatalogCompiler.projectCompiledRollbackCatalog;
|
|
101
|
-
exports.promoteRelease = require_releaseManagement.promoteRelease;
|
|
102
|
-
exports.rebuildReleaseCatalog = require_releaseCatalogMutation.rebuildReleaseCatalog;
|
|
103
81
|
exports.referenceCompatibleReleases = require_releaseCatalogCompiler.referenceCompatibleReleases;
|
|
104
82
|
exports.releaseRowToRelease = require_databaseRows.releaseRowToRelease;
|
|
105
83
|
exports.releaseToRow = require_databaseRows.releaseToRow;
|
|
@@ -107,11 +85,7 @@ exports.remoteSigning = require_remoteBundleSigning.remoteSigning;
|
|
|
107
85
|
exports.replaceStorageUriKeySuffix = require_assetStorageLayout.replaceStorageUriKeySuffix;
|
|
108
86
|
exports.resolveManifestAssetStorageFileHash = require_assetStorageLayout.resolveManifestAssetStorageFileHash;
|
|
109
87
|
exports.resolveManifestAssetStorageUri = require_assetStorageLayout.resolveManifestAssetStorageUri;
|
|
110
|
-
exports.rollbackRelease = require_releaseManagement.rollbackRelease;
|
|
111
|
-
exports.rollbackReleases = require_releaseManagement.rollbackReleases;
|
|
112
88
|
exports.rowToBundle = require_databaseRows.rowToBundle;
|
|
113
89
|
exports.rowsToBundles = require_databaseRows.rowsToBundles;
|
|
114
90
|
exports.semverSatisfies = require_semverSatisfies.semverSatisfies;
|
|
115
|
-
exports.sortBundles = require_queryBundles.sortBundles;
|
|
116
91
|
exports.supportedIosPlatforms = require_index.supportedIosPlatforms;
|
|
117
|
-
exports.updateReleasePolicy = require_releaseManagement.updateReleasePolicy;
|