@hot-updater/plugin-core 1.0.0-rc.17 → 1.0.0-rc.21
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/README.md +33 -0
- package/dist/baseCandidateKey.cjs +50 -0
- package/dist/baseCandidateKey.d.cts +27 -0
- package/dist/baseCandidateKey.d.mts +27 -0
- package/dist/baseCandidateKey.mjs +49 -0
- package/dist/createStorageAdapter.cjs +8 -0
- package/dist/createStorageAdapter.d.cts +9 -0
- package/dist/createStorageAdapter.d.mts +9 -0
- package/dist/createStorageAdapter.mjs +7 -0
- package/dist/database/adapter.cjs +20 -5
- package/dist/database/adapter.d.cts +25 -8
- package/dist/database/adapter.d.mts +25 -8
- package/dist/database/adapter.mjs +21 -4
- package/dist/database/distinct.cjs +12 -6
- package/dist/database/distinct.d.cts +13 -11
- package/dist/database/distinct.d.mts +13 -11
- package/dist/database/distinct.mjs +13 -6
- package/dist/database/memoryAdapter.cjs +2 -10
- package/dist/database/memoryAdapter.d.cts +2 -4
- package/dist/database/memoryAdapter.d.mts +2 -4
- package/dist/database/memoryAdapter.mjs +2 -10
- package/dist/database/values.cjs +5 -1
- package/dist/database/values.d.cts +8 -21
- package/dist/database/values.d.mts +8 -21
- package/dist/database/values.mjs +5 -1
- package/dist/database/verifyAdapter.cjs +1 -0
- package/dist/database/verifyAdapter.d.cts +8 -0
- package/dist/database/verifyAdapter.d.mts +8 -0
- package/dist/database/verifyAdapter.mjs +1 -0
- package/dist/databaseErrors.cjs +4 -4
- package/dist/databaseErrors.d.cts +6 -6
- package/dist/databaseErrors.d.mts +6 -6
- package/dist/databaseErrors.mjs +4 -4
- package/dist/databaseJsonValue.cjs +6 -0
- package/dist/databaseJsonValue.d.cts +6 -0
- package/dist/databaseJsonValue.d.mts +6 -0
- package/dist/databaseJsonValue.mjs +6 -0
- package/dist/databaseMetadata.cjs +3 -3
- package/dist/databaseMetadata.mjs +3 -3
- package/dist/databaseRows.cjs +6 -6
- package/dist/databaseRows.d.cts +1 -1
- package/dist/databaseRows.d.mts +1 -1
- package/dist/databaseRows.mjs +1 -1
- package/dist/engine/core/schema.cjs +279 -0
- package/dist/engine/core/schema.d.cts +312 -0
- package/dist/engine/core/schema.d.mts +312 -0
- package/dist/engine/core/schema.mjs +277 -0
- package/dist/engine/createEngine.cjs +72 -0
- package/dist/engine/createEngine.d.cts +45 -0
- package/dist/engine/createEngine.d.mts +45 -0
- package/dist/engine/createEngine.mjs +72 -0
- package/dist/engine/database/aggregateBatching.cjs +627 -0
- package/dist/engine/database/aggregateBatching.mjs +626 -0
- package/dist/engine/database/cursor.cjs +42 -0
- package/dist/engine/database/cursor.mjs +38 -0
- package/dist/engine/database/database.cjs +68 -0
- package/dist/engine/database/database.mjs +68 -0
- package/dist/engine/database/engine.cjs +37 -0
- package/dist/engine/database/engine.mjs +37 -0
- package/dist/engine/database/engineAggregates.cjs +120 -0
- package/dist/engine/database/engineAggregates.mjs +117 -0
- package/dist/engine/database/engineReads.cjs +182 -0
- package/dist/engine/database/engineReads.d.cts +10 -0
- package/dist/engine/database/engineReads.d.mts +10 -0
- package/dist/engine/database/engineReads.mjs +181 -0
- package/dist/engine/database/engineTransaction.cjs +399 -0
- package/dist/engine/database/engineTransaction.d.cts +18 -0
- package/dist/engine/database/engineTransaction.d.mts +18 -0
- package/dist/engine/database/engineTransaction.mjs +398 -0
- package/dist/engine/database/fence.cjs +156 -0
- package/dist/engine/database/fence.d.cts +41 -0
- package/dist/engine/database/fence.d.mts +41 -0
- package/dist/engine/database/fence.mjs +149 -0
- package/dist/engine/database/kv/kvAdapter.cjs +293 -0
- package/dist/engine/database/kv/kvAdapter.d.cts +116 -0
- package/dist/engine/database/kv/kvAdapter.d.mts +116 -0
- package/dist/engine/database/kv/kvAdapter.mjs +292 -0
- package/dist/engine/database/readMeter.cjs +80 -0
- package/dist/engine/database/readMeter.d.cts +34 -0
- package/dist/engine/database/readMeter.d.mts +34 -0
- package/dist/engine/database/readMeter.mjs +79 -0
- package/dist/engine/database/resolveSchema.cjs +197 -0
- package/dist/engine/database/resolveSchema.d.cts +35 -0
- package/dist/engine/database/resolveSchema.d.mts +35 -0
- package/dist/engine/database/resolveSchema.mjs +195 -0
- package/dist/engine/database/retention.cjs +100 -0
- package/dist/engine/database/retention.mjs +98 -0
- package/dist/engine/database/sql/sqlAdapter.cjs +290 -0
- package/dist/engine/database/sql/sqlAdapter.d.cts +45 -0
- package/dist/engine/database/sql/sqlAdapter.d.mts +45 -0
- package/dist/engine/database/sql/sqlAdapter.mjs +288 -0
- package/dist/engine/database/sql/sqlSchema.cjs +175 -0
- package/dist/engine/database/sql/sqlSchema.d.cts +45 -0
- package/dist/engine/database/sql/sqlSchema.d.mts +45 -0
- package/dist/engine/database/sql/sqlSchema.mjs +169 -0
- package/dist/engine/db/coreDatabase.cjs +94 -0
- package/dist/engine/db/coreDatabase.d.cts +78 -0
- package/dist/engine/db/coreDatabase.d.mts +78 -0
- package/dist/engine/db/coreDatabase.mjs +86 -0
- package/dist/engine/db/engineMigrator.cjs +53 -0
- package/dist/engine/db/engineMigrator.mjs +53 -0
- package/dist/engine/db/engineSql.cjs +26 -0
- package/dist/engine/db/engineSql.d.cts +16 -0
- package/dist/engine/db/engineSql.d.mts +16 -0
- package/dist/engine/db/engineSql.mjs +25 -0
- package/dist/engine/db/engineSqlMigrator.cjs +67 -0
- package/dist/engine/db/engineSqlMigrator.d.cts +21 -0
- package/dist/engine/db/engineSqlMigrator.d.mts +21 -0
- package/dist/engine/db/engineSqlMigrator.mjs +67 -0
- package/dist/engine/db/fixedMigratorShared.cjs +12 -0
- package/dist/engine/db/fixedMigratorShared.mjs +11 -0
- package/dist/engine/db/schemaSettings.cjs +63 -0
- package/dist/engine/db/schemaSettings.d.cts +7 -0
- package/dist/engine/db/schemaSettings.d.mts +7 -0
- package/dist/engine/db/schemaSettings.mjs +62 -0
- package/dist/engine/db/settingsMigrator.cjs +94 -0
- package/dist/engine/db/settingsMigrator.d.cts +25 -0
- package/dist/engine/db/settingsMigrator.d.mts +25 -0
- package/dist/engine/db/settingsMigrator.mjs +91 -0
- package/dist/engine/db/types.d.cts +78 -0
- package/dist/engine/db/types.d.mts +78 -0
- package/dist/index.cjs +86 -7
- package/dist/index.d.cts +36 -6
- package/dist/index.d.mts +36 -6
- package/dist/index.mjs +26 -4
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/comparison-DenM3wCn.cjs +0 -5
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/comparison-DenM3wCn.mjs +1 -5
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/range-DvX-Y6iv.cjs +8 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/range-DvX-Y6iv.mjs +9 -2
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/set-CC5YeoYX.cjs +4 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/set-CC5YeoYX.mjs +4 -1
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/version-CQ98ZBpL.cjs +0 -5
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/version-CQ98ZBpL.mjs +2 -6
- package/dist/releaseCatalogCompiler.cjs +26 -25
- package/dist/releaseCatalogCompiler.d.cts +1 -2
- package/dist/releaseCatalogCompiler.d.mts +2 -3
- package/dist/releaseCatalogCompiler.mjs +3 -7
- package/dist/remoteBundleSigning.d.cts +2 -2
- package/dist/remoteBundleSigning.d.mts +2 -2
- package/dist/serverPlugin/busy.cjs +36 -0
- package/dist/serverPlugin/busy.d.cts +12 -0
- package/dist/serverPlugin/busy.d.mts +12 -0
- package/dist/serverPlugin/busy.mjs +36 -0
- package/dist/serverPlugin/configError.cjs +7 -0
- package/dist/serverPlugin/configError.d.cts +7 -0
- package/dist/serverPlugin/configError.d.mts +7 -0
- package/dist/serverPlugin/configError.mjs +7 -0
- package/dist/serverPlugin/coreReads.d.cts +48 -0
- package/dist/serverPlugin/coreReads.d.mts +48 -0
- package/dist/serverPlugin/databaseHandle.d.cts +105 -0
- package/dist/serverPlugin/databaseHandle.d.mts +105 -0
- package/dist/serverPlugin/definePlugin.cjs +5 -0
- package/dist/serverPlugin/definePlugin.d.cts +130 -0
- package/dist/serverPlugin/definePlugin.d.mts +130 -0
- package/dist/serverPlugin/definePlugin.mjs +5 -0
- package/dist/serverPlugin/definitions.d.cts +76 -0
- package/dist/serverPlugin/definitions.d.mts +76 -0
- package/dist/serverPlugin/errors.cjs +37 -0
- package/dist/serverPlugin/errors.d.cts +29 -0
- package/dist/serverPlugin/errors.d.mts +29 -0
- package/dist/serverPlugin/errors.mjs +32 -0
- package/dist/serverPlugin/schema.cjs +24 -0
- package/dist/serverPlugin/schema.d.cts +90 -0
- package/dist/serverPlugin/schema.d.mts +90 -0
- package/dist/serverPlugin/schema.mjs +23 -0
- package/dist/types/databaseConfig.cjs +1 -1
- package/dist/types/databaseConfig.d.cts +8 -1
- package/dist/types/databaseConfig.d.mts +8 -1
- package/dist/types/databaseConfig.mjs +1 -1
- package/dist/types/databaseRows.d.cts +1 -1
- package/dist/types/databaseRows.d.mts +1 -1
- package/dist/types/index.d.cts +26 -14
- package/dist/types/index.d.mts +26 -14
- package/dist/types/public.d.cts +1 -1
- package/dist/types/public.d.mts +1 -1
- package/dist/uuidv7.cjs +3 -3
- package/dist/uuidv7.d.cts +1 -1
- package/dist/uuidv7.d.mts +1 -1
- package/dist/uuidv7.mjs +1 -1
- package/package.json +10 -7
- package/dist/createStoragePlugin.cjs +0 -8
- package/dist/createStoragePlugin.d.cts +0 -9
- package/dist/createStoragePlugin.d.mts +0 -9
- package/dist/createStoragePlugin.mjs +0 -7
- package/dist/internal.cjs +0 -38
- package/dist/internal.d.cts +0 -12
- package/dist/internal.d.mts +0 -12
- package/dist/internal.mjs +0 -8
- package/dist/types/internal.d.cts +0 -4
- package/dist/types/internal.d.mts +0 -4
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { DatabaseJson } from "../database/adapter.mjs";
|
|
2
|
+
import { AggregateShape, FieldDefinition, FieldReference, FieldType, IndexDefinition, ReferenceAction, TableShape } from "./definitions.mjs";
|
|
3
|
+
//#region src/serverPlugin/schema.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* How long a model keeps its rows: `days` past the epoch milliseconds in
|
|
6
|
+
* `field`, an integer field (a table's derived one too, where null keeps
|
|
7
|
+
* the row). Expired rows are deleted without cascades, so a model with
|
|
8
|
+
* retention is in no reference and no rooted index.
|
|
9
|
+
*/
|
|
10
|
+
interface RetentionDefinition<TField extends string = string> {
|
|
11
|
+
readonly field: TField;
|
|
12
|
+
readonly days: number;
|
|
13
|
+
}
|
|
14
|
+
type FieldValue<TType extends FieldType> = TType extends "string" ? string : TType extends "integer" | "number" ? number : TType extends "boolean" ? boolean : DatabaseJson;
|
|
15
|
+
type Fields = Readonly<Record<string, FieldDefinition>>;
|
|
16
|
+
type RowOf<TFields extends Fields> = { -readonly [K in keyof TFields]: TFields[K] extends FieldDefinition<infer TType> ? TFields[K] extends {
|
|
17
|
+
readonly required: false;
|
|
18
|
+
} ? FieldValue<TType> | null : FieldValue<TType> : never; };
|
|
19
|
+
/** Computed on every write and stored as a real column. */
|
|
20
|
+
interface DerivedDefinition<TRow = never, TType extends FieldType = FieldType> {
|
|
21
|
+
readonly type: TType;
|
|
22
|
+
/** Up to 16 values; the row is indexed once per value. */
|
|
23
|
+
readonly multi?: true;
|
|
24
|
+
/** Null, or an empty list, leaves the row out of indexes on this field. */
|
|
25
|
+
compute(row: TRow): FieldValue<TType> | null | readonly FieldValue<TType>[];
|
|
26
|
+
}
|
|
27
|
+
type DerivedTypes = Readonly<Record<string, FieldType>>;
|
|
28
|
+
/** Derived fields over a table's row, by name. */
|
|
29
|
+
type DerivedFields<TFields extends Fields, TDerived extends DerivedTypes> = { readonly [K in keyof TDerived]: DerivedDefinition<RowOf<TFields>, TDerived[K]>; };
|
|
30
|
+
type Indexes = Readonly<Record<string, IndexDefinition>>;
|
|
31
|
+
/** The integer fields, declared or derived, that retention can count from. */
|
|
32
|
+
type IntegerFields<TFields extends Fields, TDerived extends DerivedTypes> = { [K in keyof TFields]: TFields[K] extends {
|
|
33
|
+
readonly type: "integer";
|
|
34
|
+
} ? K : never; }[keyof TFields] | { [K in keyof TDerived]: TDerived[K] extends "integer" ? K : never; }[keyof TDerived];
|
|
35
|
+
type MissingFields<TIndex, TNames extends string> = TIndex extends {
|
|
36
|
+
readonly eq: readonly (infer TEq)[];
|
|
37
|
+
readonly sort: readonly (infer TSort)[];
|
|
38
|
+
} ? Exclude<TEq | TSort, TNames> : never;
|
|
39
|
+
/** Maps an index to an error message when it names an undeclared field. */
|
|
40
|
+
type CheckIndex<TName extends PropertyKey, TIndex, TNames extends string> = [MissingFields<TIndex, TNames>] extends [never] ? TIndex : `Index "${TName & string}" names undeclared field "${MissingFields<TIndex, TNames> & string}"`;
|
|
41
|
+
type CheckIndexes<TIndexes, TNames extends string> = { readonly [K in keyof TIndexes]: CheckIndex<K, TIndexes[K], TNames>; };
|
|
42
|
+
interface TableDefinition<TFields extends Fields = Fields, TDerived extends DerivedTypes = DerivedTypes, TIndexes extends Indexes = Indexes, TKey extends readonly (keyof TFields & string)[] = readonly (keyof TFields & string)[]> extends TableShape {
|
|
43
|
+
readonly kind: "table";
|
|
44
|
+
readonly fields: TFields;
|
|
45
|
+
readonly key: TKey;
|
|
46
|
+
readonly derived: DerivedFields<TFields, TDerived>;
|
|
47
|
+
readonly indexes: TIndexes;
|
|
48
|
+
}
|
|
49
|
+
declare const defineTable: <const TFields extends Fields, const TKey extends readonly (keyof TFields & string)[], const TDerived extends DerivedTypes = {}, const TIndexes extends Indexes = {}>(fields: TFields, options: {
|
|
50
|
+
readonly key: TKey;
|
|
51
|
+
readonly derived?: DerivedFields<TFields, TDerived>;
|
|
52
|
+
readonly indexes?: TIndexes & CheckIndexes<TIndexes, (keyof TFields | keyof TDerived) & string>;
|
|
53
|
+
/** Rows expire `days` after the epoch milliseconds in `field`. */
|
|
54
|
+
readonly retention?: RetentionDefinition<IntegerFields<TFields, TDerived> & string>;
|
|
55
|
+
}) => TableDefinition<TFields, TDerived, TIndexes, TKey>;
|
|
56
|
+
interface AggregateDefinition<TFields extends Fields = Fields, TMetric extends string = string, TIndexes extends Indexes = Indexes, TSketch extends string = string, TKey extends readonly (keyof TFields & string)[] = readonly (keyof TFields & string)[]> extends AggregateShape {
|
|
57
|
+
readonly kind: "aggregate";
|
|
58
|
+
readonly fields: TFields;
|
|
59
|
+
readonly key: TKey;
|
|
60
|
+
readonly counters: readonly TMetric[];
|
|
61
|
+
readonly gauges: readonly TMetric[];
|
|
62
|
+
readonly distinct: readonly TSketch[];
|
|
63
|
+
readonly indexes: TIndexes;
|
|
64
|
+
/**
|
|
65
|
+
* On a database that batches aggregates, changes apply after their
|
|
66
|
+
* transaction commits, in one write per row with other transactions'
|
|
67
|
+
* changes, so reads may lag them. Elsewhere they commit with it.
|
|
68
|
+
*/
|
|
69
|
+
readonly batched?: true;
|
|
70
|
+
}
|
|
71
|
+
declare const defineAggregate: <const TFields extends Fields, const TKey extends readonly (keyof TFields & string)[], const TMetric extends string = never, const TIndexes extends Indexes = {}, const TSketch extends string = never>(fields: TFields, options: {
|
|
72
|
+
readonly key: TKey;
|
|
73
|
+
readonly counters?: readonly TMetric[];
|
|
74
|
+
readonly gauges?: readonly TMetric[];
|
|
75
|
+
readonly distinct?: readonly TSketch[];
|
|
76
|
+
readonly shards?: number;
|
|
77
|
+
readonly indexes?: TIndexes & CheckIndexes<TIndexes, keyof TFields & string>;
|
|
78
|
+
readonly batched?: true;
|
|
79
|
+
/**
|
|
80
|
+
* Rows expire `days` after the epoch milliseconds in `field`, an
|
|
81
|
+
* identity field such as a bucket's start; a change to a row already
|
|
82
|
+
* past it is dropped, so a late gauge decrement never goes below zero.
|
|
83
|
+
*/
|
|
84
|
+
readonly retention?: RetentionDefinition<IntegerFields<TFields, {}> & string>;
|
|
85
|
+
}) => AggregateDefinition<TFields, TMetric, TIndexes, TSketch, TKey>;
|
|
86
|
+
type ModelDefinition = TableDefinition | AggregateDefinition;
|
|
87
|
+
/** A module's models by name: core, or one plugin. */
|
|
88
|
+
type ModuleSchema = Readonly<Record<string, ModelDefinition>>;
|
|
89
|
+
//#endregion
|
|
90
|
+
export { AggregateDefinition, CheckIndex, DerivedDefinition, DerivedFields, type FieldDefinition, type FieldReference, type FieldType, FieldValue, type IndexDefinition, ModelDefinition, ModuleSchema, type ReferenceAction, RetentionDefinition, RowOf, TableDefinition, defineAggregate, defineTable };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/serverPlugin/schema.ts
|
|
2
|
+
const defineTable = (fields, options) => ({
|
|
3
|
+
kind: "table",
|
|
4
|
+
fields,
|
|
5
|
+
key: options.key,
|
|
6
|
+
derived: options.derived ?? {},
|
|
7
|
+
indexes: options.indexes ?? {},
|
|
8
|
+
...options.retention === void 0 ? {} : { retention: options.retention }
|
|
9
|
+
});
|
|
10
|
+
const defineAggregate = (fields, options) => ({
|
|
11
|
+
kind: "aggregate",
|
|
12
|
+
fields,
|
|
13
|
+
key: options.key,
|
|
14
|
+
counters: options.counters ?? [],
|
|
15
|
+
gauges: options.gauges ?? [],
|
|
16
|
+
distinct: options.distinct ?? [],
|
|
17
|
+
shards: options.shards ?? 1,
|
|
18
|
+
indexes: options.indexes ?? {},
|
|
19
|
+
...options.batched ? { batched: true } : {},
|
|
20
|
+
...options.retention === void 0 ? {} : { retention: options.retention }
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
export { defineAggregate, defineTable };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/types/databaseConfig.ts
|
|
2
2
|
/** Whether a configured database is a self-hosted server's. */
|
|
3
|
-
const isRemoteDatabase = (
|
|
3
|
+
const isRemoteDatabase = (value) => typeof value === "object" && value !== null && "core" in value && "fetchAdmin" in value;
|
|
4
4
|
//#endregion
|
|
5
5
|
exports.isRemoteDatabase = isRemoteDatabase;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DatabaseAdapter } from "../database/adapter.cjs";
|
|
2
|
+
import { RetryOptions } from "../engine/database/engineTransaction.cjs";
|
|
2
3
|
import { HotUpdaterCoreApi } from "../coreApi.cjs";
|
|
3
4
|
//#region src/types/databaseConfig.d.ts
|
|
4
5
|
/**
|
|
@@ -42,6 +43,12 @@ interface EngineDatabase {
|
|
|
42
43
|
readonly onCachedRoutesChange?: () => Promise<void>;
|
|
43
44
|
/** Batches aggregates declared `batched`; absent, they commit with each transaction. */
|
|
44
45
|
readonly aggregateBatching?: AggregateBatching;
|
|
46
|
+
/**
|
|
47
|
+
* How a transaction that conflicts with another write runs again. A store
|
|
48
|
+
* many writers contend on, such as DynamoDB under a burst of events, can
|
|
49
|
+
* take more attempts; `onRetry` observes each rerun.
|
|
50
|
+
*/
|
|
51
|
+
readonly retry?: RetryOptions;
|
|
45
52
|
dispose?(): Promise<void>;
|
|
46
53
|
}
|
|
47
54
|
/** A self-hosted server's database, reached through its admin API. */
|
|
@@ -56,6 +63,6 @@ interface RemoteDatabase {
|
|
|
56
63
|
/** The database a config names: one the CLI opens itself, or a self-hosted server's. */
|
|
57
64
|
type ConfiguredDatabase = EngineDatabase | RemoteDatabase;
|
|
58
65
|
/** Whether a configured database is a self-hosted server's. */
|
|
59
|
-
declare const isRemoteDatabase: (
|
|
66
|
+
declare const isRemoteDatabase: (value: unknown) => value is RemoteDatabase;
|
|
60
67
|
//#endregion
|
|
61
68
|
export { AggregateBatching, ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DatabaseAdapter } from "../database/adapter.mjs";
|
|
2
|
+
import { RetryOptions } from "../engine/database/engineTransaction.mjs";
|
|
2
3
|
import { HotUpdaterCoreApi } from "../coreApi.mjs";
|
|
3
4
|
//#region src/types/databaseConfig.d.ts
|
|
4
5
|
/**
|
|
@@ -42,6 +43,12 @@ interface EngineDatabase {
|
|
|
42
43
|
readonly onCachedRoutesChange?: () => Promise<void>;
|
|
43
44
|
/** Batches aggregates declared `batched`; absent, they commit with each transaction. */
|
|
44
45
|
readonly aggregateBatching?: AggregateBatching;
|
|
46
|
+
/**
|
|
47
|
+
* How a transaction that conflicts with another write runs again. A store
|
|
48
|
+
* many writers contend on, such as DynamoDB under a burst of events, can
|
|
49
|
+
* take more attempts; `onRetry` observes each rerun.
|
|
50
|
+
*/
|
|
51
|
+
readonly retry?: RetryOptions;
|
|
45
52
|
dispose?(): Promise<void>;
|
|
46
53
|
}
|
|
47
54
|
/** A self-hosted server's database, reached through its admin API. */
|
|
@@ -56,6 +63,6 @@ interface RemoteDatabase {
|
|
|
56
63
|
/** The database a config names: one the CLI opens itself, or a self-hosted server's. */
|
|
57
64
|
type ConfiguredDatabase = EngineDatabase | RemoteDatabase;
|
|
58
65
|
/** Whether a configured database is a self-hosted server's. */
|
|
59
|
-
declare const isRemoteDatabase: (
|
|
66
|
+
declare const isRemoteDatabase: (value: unknown) => value is RemoteDatabase;
|
|
60
67
|
//#endregion
|
|
61
68
|
export { AggregateBatching, ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/types/databaseConfig.ts
|
|
2
2
|
/** Whether a configured database is a self-hosted server's. */
|
|
3
|
-
const isRemoteDatabase = (
|
|
3
|
+
const isRemoteDatabase = (value) => typeof value === "object" && value !== null && "core" in value && "fetchAdmin" in value;
|
|
4
4
|
//#endregion
|
|
5
5
|
export { isRemoteDatabase };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Platform } from "@hot-updater/
|
|
1
|
+
import { Platform } from "@hot-updater/protocol";
|
|
2
2
|
//#region src/types/databaseRows.d.ts
|
|
3
3
|
type DatabaseJsonValue = boolean | number | string | null | readonly DatabaseJsonValue[] | DatabaseJsonObject;
|
|
4
4
|
type DatabaseJsonObject = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Platform } from "@hot-updater/
|
|
1
|
+
import { Platform } from "@hot-updater/protocol";
|
|
2
2
|
//#region src/types/databaseRows.d.ts
|
|
3
3
|
type DatabaseJsonValue = boolean | number | string | null | readonly DatabaseJsonValue[] | DatabaseJsonObject;
|
|
4
4
|
type DatabaseJsonObject = {
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
+
import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.cjs";
|
|
2
|
+
import { AnyHotUpdaterPlugin } from "../serverPlugin/definePlugin.cjs";
|
|
1
3
|
import { AggregateBatching, ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase } from "./databaseConfig.cjs";
|
|
2
4
|
import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./utils.cjs";
|
|
3
|
-
import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.cjs";
|
|
4
5
|
import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./databaseOperations.cjs";
|
|
5
6
|
import { ChannelDeleteResult, ChannelInsertResult } from "./models.cjs";
|
|
6
7
|
import "./public.cjs";
|
|
7
|
-
import { Bundle as Bundle$1, Platform, Platform as Platform$1 } from "@hot-updater/
|
|
8
|
+
import { Bundle as Bundle$1, Platform, Platform as Platform$1 } from "@hot-updater/protocol";
|
|
8
9
|
//#region src/types/index.d.ts
|
|
9
|
-
interface
|
|
10
|
+
interface BuildAdapterArgs {
|
|
10
11
|
cwd: string;
|
|
11
12
|
}
|
|
12
|
-
interface
|
|
13
|
+
interface BuildAdapterConfig {
|
|
13
14
|
outDir?: string;
|
|
14
15
|
}
|
|
15
|
-
interface
|
|
16
|
+
interface BuildAdapter {
|
|
16
17
|
nativeBuild?: {
|
|
17
18
|
/** Resolves the public key embedded by the native build configuration. */
|
|
18
19
|
getBundleSigningPublicKey?: () => Promise<{
|
|
@@ -223,7 +224,7 @@ interface StorageDeleteResult {
|
|
|
223
224
|
readonly deleted: true;
|
|
224
225
|
}
|
|
225
226
|
interface StorageObject {
|
|
226
|
-
/** Object key relative to the storage
|
|
227
|
+
/** Object key relative to the storage adapter's configured base path. */
|
|
227
228
|
readonly key: string;
|
|
228
229
|
readonly storageUri: string;
|
|
229
230
|
readonly size: number;
|
|
@@ -244,7 +245,7 @@ interface StorageGetDownloadUrlResult {
|
|
|
244
245
|
* SDK clients, platform bindings, credentials, and local file I/O belong to
|
|
245
246
|
* provider implementations and consumers, never to this interface.
|
|
246
247
|
*/
|
|
247
|
-
interface
|
|
248
|
+
interface StorageAdapter {
|
|
248
249
|
readonly name: string;
|
|
249
250
|
/**
|
|
250
251
|
* Protocol this plugin resolves and stores in database storage URIs.
|
|
@@ -267,7 +268,7 @@ interface StoragePlugin {
|
|
|
267
268
|
/** Deletes only the exact base-path-relative keys supplied by the caller. */
|
|
268
269
|
readonly deleteObjects?: (keys: readonly string[]) => Promise<void>;
|
|
269
270
|
}
|
|
270
|
-
interface
|
|
271
|
+
interface BundleSigningAdapter {
|
|
271
272
|
readonly name: string;
|
|
272
273
|
/** Returns the RSA public key used by this provider in SPKI PEM format. */
|
|
273
274
|
readonly getPublicKey: (input?: {
|
|
@@ -298,8 +299,8 @@ type LocalSigningConfig = {
|
|
|
298
299
|
readonly enabled: false;
|
|
299
300
|
readonly privateKeyPath?: string;
|
|
300
301
|
};
|
|
301
|
-
/** Local config or signing
|
|
302
|
-
type SigningConfig =
|
|
302
|
+
/** Local config or signing adapter. Signing is disabled when omitted. */
|
|
303
|
+
type SigningConfig = BundleSigningAdapter | LocalSigningConfig;
|
|
303
304
|
/**
|
|
304
305
|
* Extra fingerprint sources.
|
|
305
306
|
*
|
|
@@ -407,10 +408,21 @@ type ConfigInput = {
|
|
|
407
408
|
* ```
|
|
408
409
|
*/
|
|
409
410
|
signing?: SigningConfig;
|
|
410
|
-
build: (args:
|
|
411
|
-
|
|
412
|
-
|
|
411
|
+
build: (args: BuildAdapterArgs) => Promise<BuildAdapter> | BuildAdapter;
|
|
412
|
+
/** Where the CLI uploads bundles: the same adapter the server lists in its storage. */
|
|
413
|
+
storage: StorageAdapter;
|
|
414
|
+
/**
|
|
415
|
+
* The server's database, which the CLI opens itself, or
|
|
416
|
+
* `standaloneRepository(...)`, which reaches a self-hosted server through
|
|
417
|
+
* its admin API.
|
|
418
|
+
*/
|
|
413
419
|
database: ConfiguredDatabase;
|
|
420
|
+
/**
|
|
421
|
+
* The plugins the server runs, as its definition lists them. Over the
|
|
422
|
+
* server's database the CLI runs them as the server does; with
|
|
423
|
+
* `standaloneRepository`, they run on the server.
|
|
424
|
+
*/
|
|
425
|
+
plugins?: readonly AnyHotUpdaterPlugin[];
|
|
414
426
|
};
|
|
415
427
|
interface NativeBuildOptions {
|
|
416
428
|
outputPath?: string;
|
|
@@ -419,4 +431,4 @@ interface NativeBuildOptions {
|
|
|
419
431
|
scheme?: string;
|
|
420
432
|
}
|
|
421
433
|
//#endregion
|
|
422
|
-
export { type AggregateBatching, ApplePlatform,
|
|
434
|
+
export { type AggregateBatching, ApplePlatform, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, BuiltIns, type Bundle$1 as Bundle, type BundlePatchRow, type BundleRow, type BundleRowUpdate, BundleSigningAdapter, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, ConfigInput, type ConfiguredDatabase, type DatabaseBundleMetadata, type DatabaseJsonObject, type DatabaseJsonValue, type EngineDatabase, FingerprintExtraSources, HasMultipleCallSignatures, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, type Platform$1 as Platform, PlatformConfig, Primitive, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, type ReleaseRow, type ReleaseRowUpdate, type RemoteDatabase, RequiredDeep, SigningConfig, StorageAdapter, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePutInput, StoragePutResult, isRemoteDatabase, supportedIosPlatforms };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
+
import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.mjs";
|
|
2
|
+
import { AnyHotUpdaterPlugin } from "../serverPlugin/definePlugin.mjs";
|
|
1
3
|
import { AggregateBatching, ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase } from "./databaseConfig.mjs";
|
|
2
4
|
import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./utils.mjs";
|
|
3
|
-
import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.mjs";
|
|
4
5
|
import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./databaseOperations.mjs";
|
|
5
6
|
import { ChannelDeleteResult, ChannelInsertResult } from "./models.mjs";
|
|
6
7
|
import "./public.mjs";
|
|
7
|
-
import { Bundle as Bundle$1, Platform, Platform as Platform$1 } from "@hot-updater/
|
|
8
|
+
import { Bundle as Bundle$1, Platform, Platform as Platform$1 } from "@hot-updater/protocol";
|
|
8
9
|
//#region src/types/index.d.ts
|
|
9
|
-
interface
|
|
10
|
+
interface BuildAdapterArgs {
|
|
10
11
|
cwd: string;
|
|
11
12
|
}
|
|
12
|
-
interface
|
|
13
|
+
interface BuildAdapterConfig {
|
|
13
14
|
outDir?: string;
|
|
14
15
|
}
|
|
15
|
-
interface
|
|
16
|
+
interface BuildAdapter {
|
|
16
17
|
nativeBuild?: {
|
|
17
18
|
/** Resolves the public key embedded by the native build configuration. */
|
|
18
19
|
getBundleSigningPublicKey?: () => Promise<{
|
|
@@ -223,7 +224,7 @@ interface StorageDeleteResult {
|
|
|
223
224
|
readonly deleted: true;
|
|
224
225
|
}
|
|
225
226
|
interface StorageObject {
|
|
226
|
-
/** Object key relative to the storage
|
|
227
|
+
/** Object key relative to the storage adapter's configured base path. */
|
|
227
228
|
readonly key: string;
|
|
228
229
|
readonly storageUri: string;
|
|
229
230
|
readonly size: number;
|
|
@@ -244,7 +245,7 @@ interface StorageGetDownloadUrlResult {
|
|
|
244
245
|
* SDK clients, platform bindings, credentials, and local file I/O belong to
|
|
245
246
|
* provider implementations and consumers, never to this interface.
|
|
246
247
|
*/
|
|
247
|
-
interface
|
|
248
|
+
interface StorageAdapter {
|
|
248
249
|
readonly name: string;
|
|
249
250
|
/**
|
|
250
251
|
* Protocol this plugin resolves and stores in database storage URIs.
|
|
@@ -267,7 +268,7 @@ interface StoragePlugin {
|
|
|
267
268
|
/** Deletes only the exact base-path-relative keys supplied by the caller. */
|
|
268
269
|
readonly deleteObjects?: (keys: readonly string[]) => Promise<void>;
|
|
269
270
|
}
|
|
270
|
-
interface
|
|
271
|
+
interface BundleSigningAdapter {
|
|
271
272
|
readonly name: string;
|
|
272
273
|
/** Returns the RSA public key used by this provider in SPKI PEM format. */
|
|
273
274
|
readonly getPublicKey: (input?: {
|
|
@@ -298,8 +299,8 @@ type LocalSigningConfig = {
|
|
|
298
299
|
readonly enabled: false;
|
|
299
300
|
readonly privateKeyPath?: string;
|
|
300
301
|
};
|
|
301
|
-
/** Local config or signing
|
|
302
|
-
type SigningConfig =
|
|
302
|
+
/** Local config or signing adapter. Signing is disabled when omitted. */
|
|
303
|
+
type SigningConfig = BundleSigningAdapter | LocalSigningConfig;
|
|
303
304
|
/**
|
|
304
305
|
* Extra fingerprint sources.
|
|
305
306
|
*
|
|
@@ -407,10 +408,21 @@ type ConfigInput = {
|
|
|
407
408
|
* ```
|
|
408
409
|
*/
|
|
409
410
|
signing?: SigningConfig;
|
|
410
|
-
build: (args:
|
|
411
|
-
|
|
412
|
-
|
|
411
|
+
build: (args: BuildAdapterArgs) => Promise<BuildAdapter> | BuildAdapter;
|
|
412
|
+
/** Where the CLI uploads bundles: the same adapter the server lists in its storage. */
|
|
413
|
+
storage: StorageAdapter;
|
|
414
|
+
/**
|
|
415
|
+
* The server's database, which the CLI opens itself, or
|
|
416
|
+
* `standaloneRepository(...)`, which reaches a self-hosted server through
|
|
417
|
+
* its admin API.
|
|
418
|
+
*/
|
|
413
419
|
database: ConfiguredDatabase;
|
|
420
|
+
/**
|
|
421
|
+
* The plugins the server runs, as its definition lists them. Over the
|
|
422
|
+
* server's database the CLI runs them as the server does; with
|
|
423
|
+
* `standaloneRepository`, they run on the server.
|
|
424
|
+
*/
|
|
425
|
+
plugins?: readonly AnyHotUpdaterPlugin[];
|
|
414
426
|
};
|
|
415
427
|
interface NativeBuildOptions {
|
|
416
428
|
outputPath?: string;
|
|
@@ -419,4 +431,4 @@ interface NativeBuildOptions {
|
|
|
419
431
|
scheme?: string;
|
|
420
432
|
}
|
|
421
433
|
//#endregion
|
|
422
|
-
export { type AggregateBatching, ApplePlatform,
|
|
434
|
+
export { type AggregateBatching, ApplePlatform, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, BuiltIns, type Bundle$1 as Bundle, type BundlePatchRow, type BundleRow, type BundleRowUpdate, BundleSigningAdapter, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, ConfigInput, type ConfiguredDatabase, type DatabaseBundleMetadata, type DatabaseJsonObject, type DatabaseJsonValue, type EngineDatabase, FingerprintExtraSources, HasMultipleCallSignatures, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, type Platform$1 as Platform, PlatformConfig, Primitive, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, type ReleaseRow, type ReleaseRowUpdate, type RemoteDatabase, RequiredDeep, SigningConfig, StorageAdapter, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePutInput, StoragePutResult, isRemoteDatabase, supportedIosPlatforms };
|
package/dist/types/public.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AggregateBatching, ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase } from "./databaseConfig.cjs";
|
|
2
1
|
import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.cjs";
|
|
2
|
+
import { AggregateBatching, ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase } from "./databaseConfig.cjs";
|
|
3
3
|
import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./databaseOperations.cjs";
|
|
4
4
|
import { ChannelDeleteResult, ChannelInsertResult } from "./models.cjs";
|
|
5
5
|
export { type AggregateBatching, type BundlePatchRow, type BundleRow, type BundleRowUpdate, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, type ConfiguredDatabase, type DatabaseBundleMetadata, type DatabaseJsonObject, type DatabaseJsonValue, type EngineDatabase, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, type ReleaseRow, type ReleaseRowUpdate, type RemoteDatabase, isRemoteDatabase };
|
package/dist/types/public.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AggregateBatching, ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase } from "./databaseConfig.mjs";
|
|
2
1
|
import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.mjs";
|
|
2
|
+
import { AggregateBatching, ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase } from "./databaseConfig.mjs";
|
|
3
3
|
import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./databaseOperations.mjs";
|
|
4
4
|
import { ChannelDeleteResult, ChannelInsertResult } from "./models.mjs";
|
|
5
5
|
export { type AggregateBatching, type BundlePatchRow, type BundleRow, type BundleRowUpdate, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, type ConfiguredDatabase, type DatabaseBundleMetadata, type DatabaseJsonObject, type DatabaseJsonValue, type EngineDatabase, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, type ReleaseRow, type ReleaseRowUpdate, type RemoteDatabase, isRemoteDatabase };
|
package/dist/uuidv7.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
let
|
|
1
|
+
let _hot_updater_protocol = require("@hot-updater/protocol");
|
|
2
2
|
//#region src/uuidv7.ts
|
|
3
3
|
const extractTimestampFromUUIDv7 = (uuid) => {
|
|
4
|
-
if (!(0,
|
|
4
|
+
if (!(0, _hot_updater_protocol.isUUIDv7)(uuid)) throw new TypeError("Expected a canonical lowercase UUIDv7");
|
|
5
5
|
const timestampHex = uuid.split("-").join("").slice(0, 12);
|
|
6
6
|
return Number.parseInt(timestampHex, 16);
|
|
7
7
|
};
|
|
@@ -38,6 +38,6 @@ exports.extractTimestampFromUUIDv7 = extractTimestampFromUUIDv7;
|
|
|
38
38
|
Object.defineProperty(exports, "isUUIDv7", {
|
|
39
39
|
enumerable: true,
|
|
40
40
|
get: function() {
|
|
41
|
-
return
|
|
41
|
+
return _hot_updater_protocol.isUUIDv7;
|
|
42
42
|
}
|
|
43
43
|
});
|
package/dist/uuidv7.d.cts
CHANGED
package/dist/uuidv7.d.mts
CHANGED
package/dist/uuidv7.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isUUIDv7, isUUIDv7 as isUUIDv7$1 } from "@hot-updater/
|
|
1
|
+
import { isUUIDv7, isUUIDv7 as isUUIDv7$1 } from "@hot-updater/protocol";
|
|
2
2
|
//#region src/uuidv7.ts
|
|
3
3
|
const extractTimestampFromUUIDv7 = (uuid) => {
|
|
4
4
|
if (!isUUIDv7(uuid)) throw new TypeError("Expected a canonical lowercase UUIDv7");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/plugin-core",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -12,10 +12,6 @@
|
|
|
12
12
|
"import": "./dist/index.mjs",
|
|
13
13
|
"require": "./dist/index.cjs"
|
|
14
14
|
},
|
|
15
|
-
"./internal": {
|
|
16
|
-
"import": "./dist/internal.mjs",
|
|
17
|
-
"require": "./dist/internal.cjs"
|
|
18
|
-
},
|
|
19
15
|
"./package.json": "./package.json"
|
|
20
16
|
},
|
|
21
17
|
"files": [
|
|
@@ -49,12 +45,19 @@
|
|
|
49
45
|
"es-toolkit": "^1.32.0",
|
|
50
46
|
"mime": "^4.0.4",
|
|
51
47
|
"verkit": "0.4.0",
|
|
52
|
-
"@hot-updater/
|
|
48
|
+
"@hot-updater/protocol": "1.0.0-rc.21"
|
|
53
49
|
},
|
|
54
50
|
"devDependencies": {
|
|
51
|
+
"@electric-sql/pglite": "0.4.1",
|
|
55
52
|
"@types/node": "^20",
|
|
56
53
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
57
|
-
"typescript": "npm:@typescript/typescript6@6.0.2"
|
|
54
|
+
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
55
|
+
"@hot-updater/test-utils": "1.0.0-rc.21"
|
|
56
|
+
},
|
|
57
|
+
"nx": {
|
|
58
|
+
"implicitDependencies": [
|
|
59
|
+
"!@hot-updater/test-utils"
|
|
60
|
+
]
|
|
58
61
|
},
|
|
59
62
|
"inlinedDependencies": {
|
|
60
63
|
"verkit": "0.4.0"
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
//#region src/createStoragePlugin.ts
|
|
2
|
-
const createStoragePlugin = (options) => ({ ...options });
|
|
3
|
-
function assertStorageOperations(plugin, operations) {
|
|
4
|
-
for (const operation of operations) if (typeof plugin[operation] !== "function") throw new Error(`Storage plugin "${plugin.name}" does not implement ${operation}.`);
|
|
5
|
-
}
|
|
6
|
-
//#endregion
|
|
7
|
-
exports.assertStorageOperations = assertStorageOperations;
|
|
8
|
-
exports.createStoragePlugin = createStoragePlugin;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StoragePlugin } from "./types/index.cjs";
|
|
2
|
-
//#region src/createStoragePlugin.d.ts
|
|
3
|
-
type CreateStoragePluginOptions = StoragePlugin;
|
|
4
|
-
type StorageOperation = Exclude<keyof StoragePlugin, "name" | "protocol">;
|
|
5
|
-
type StoragePluginWith<TOperation extends StorageOperation> = StoragePlugin & Required<Pick<StoragePlugin, TOperation>>;
|
|
6
|
-
declare const createStoragePlugin: <const TOptions extends CreateStoragePluginOptions>(options: TOptions) => TOptions;
|
|
7
|
-
declare function assertStorageOperations<const TOperations extends readonly StorageOperation[]>(plugin: StoragePlugin, operations: TOperations): asserts plugin is StoragePluginWith<TOperations[number]>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { CreateStoragePluginOptions, StorageOperation, StoragePluginWith, assertStorageOperations, createStoragePlugin };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StoragePlugin } from "./types/index.mjs";
|
|
2
|
-
//#region src/createStoragePlugin.d.ts
|
|
3
|
-
type CreateStoragePluginOptions = StoragePlugin;
|
|
4
|
-
type StorageOperation = Exclude<keyof StoragePlugin, "name" | "protocol">;
|
|
5
|
-
type StoragePluginWith<TOperation extends StorageOperation> = StoragePlugin & Required<Pick<StoragePlugin, TOperation>>;
|
|
6
|
-
declare const createStoragePlugin: <const TOptions extends CreateStoragePluginOptions>(options: TOptions) => TOptions;
|
|
7
|
-
declare function assertStorageOperations<const TOperations extends readonly StorageOperation[]>(plugin: StoragePlugin, operations: TOperations): asserts plugin is StoragePluginWith<TOperations[number]>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { CreateStoragePluginOptions, StorageOperation, StoragePluginWith, assertStorageOperations, createStoragePlugin };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
//#region src/createStoragePlugin.ts
|
|
2
|
-
const createStoragePlugin = (options) => ({ ...options });
|
|
3
|
-
function assertStorageOperations(plugin, operations) {
|
|
4
|
-
for (const operation of operations) if (typeof plugin[operation] !== "function") throw new Error(`Storage plugin "${plugin.name}" does not implement ${operation}.`);
|
|
5
|
-
}
|
|
6
|
-
//#endregion
|
|
7
|
-
export { assertStorageOperations, createStoragePlugin };
|
package/dist/internal.cjs
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_databaseErrors = require("./databaseErrors.cjs");
|
|
3
|
-
const require_databaseJsonValue = require("./databaseJsonValue.cjs");
|
|
4
|
-
const require_adapter = require("./database/adapter.cjs");
|
|
5
|
-
const require_distinct = require("./database/distinct.cjs");
|
|
6
|
-
const require_values = require("./database/values.cjs");
|
|
7
|
-
const require_memoryAdapter = require("./database/memoryAdapter.cjs");
|
|
8
|
-
const require_verifyAdapter = require("./database/verifyAdapter.cjs");
|
|
9
|
-
exports.DATABASE_MAX_MULTI_VALUES = require_adapter.DATABASE_MAX_MULTI_VALUES;
|
|
10
|
-
exports.DATABASE_MAX_QUERY_LIMIT = require_adapter.DATABASE_MAX_QUERY_LIMIT;
|
|
11
|
-
exports.DATABASE_VERSION_COLUMN = require_adapter.DATABASE_VERSION_COLUMN;
|
|
12
|
-
exports.DatabaseAdapterContractError = require_verifyAdapter.DatabaseAdapterContractError;
|
|
13
|
-
exports.DatabaseRowReferencedError = require_databaseErrors.DatabaseRowReferencedError;
|
|
14
|
-
exports.DatabaseSchemaError = require_adapter.DatabaseSchemaError;
|
|
15
|
-
exports.DatabaseValueError = require_values.DatabaseValueError;
|
|
16
|
-
exports.addDistinct = require_distinct.addDistinct;
|
|
17
|
-
exports.canonicalJson = require_values.canonicalJson;
|
|
18
|
-
exports.compareKeyValues = require_values.compareKeyValues;
|
|
19
|
-
exports.compareTuples = require_values.compareTuples;
|
|
20
|
-
exports.compareUtf8 = require_values.compareUtf8;
|
|
21
|
-
exports.countDistinct = require_distinct.countDistinct;
|
|
22
|
-
exports.createMemoryAdapter = require_memoryAdapter.createMemoryAdapter;
|
|
23
|
-
exports.distinctRegister = require_distinct.distinctRegister;
|
|
24
|
-
exports.emptyDistinct = require_distinct.emptyDistinct;
|
|
25
|
-
exports.expiresAt = require_adapter.expiresAt;
|
|
26
|
-
exports.findPhysicalColumn = require_adapter.findPhysicalColumn;
|
|
27
|
-
exports.findPhysicalIndex = require_adapter.findPhysicalIndex;
|
|
28
|
-
exports.indexEntries = require_values.indexEntries;
|
|
29
|
-
exports.indexOrderColumns = require_adapter.indexOrderColumns;
|
|
30
|
-
exports.indexOrderTuple = require_values.indexOrderTuple;
|
|
31
|
-
exports.isDatabaseJsonObject = require_databaseJsonValue.isDatabaseJsonObject;
|
|
32
|
-
exports.isKeyValue = require_values.isKeyValue;
|
|
33
|
-
exports.matchesQuery = require_values.matchesQuery;
|
|
34
|
-
exports.mergeDistinct = require_distinct.mergeDistinct;
|
|
35
|
-
exports.normalizeStoredRow = require_values.normalizeStoredRow;
|
|
36
|
-
exports.normalizeStoredValue = require_values.normalizeStoredValue;
|
|
37
|
-
exports.rowKey = require_adapter.rowKey;
|
|
38
|
-
exports.verifyAdapter = require_verifyAdapter.verifyAdapter;
|
package/dist/internal.d.cts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { DATABASE_MAX_MULTI_VALUES, DATABASE_MAX_QUERY_LIMIT, DATABASE_VERSION_COLUMN, DatabaseAdapter, DatabaseJson, DatabaseKey, DatabaseKeyValue, DatabaseSchemaError, DatabaseValue, PhysicalColumn, PhysicalColumnType, PhysicalIndex, PhysicalRetention, PhysicalTable, QueryBound, QueryRequest, StoredRow, WriteGuard, WriteOp, WriteResult, expiresAt, findPhysicalColumn, findPhysicalIndex, indexOrderColumns, rowKey } from "./database/adapter.cjs";
|
|
2
|
-
import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.cjs";
|
|
3
|
-
import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./types/databaseOperations.cjs";
|
|
4
|
-
import { ChannelDeleteResult, ChannelInsertResult } from "./types/models.cjs";
|
|
5
|
-
import { DatabaseRowReferencedError } from "./databaseErrors.cjs";
|
|
6
|
-
import { isDatabaseJsonObject } from "./databaseJsonValue.cjs";
|
|
7
|
-
import "./types/internal.cjs";
|
|
8
|
-
import { addDistinct, countDistinct, distinctRegister, emptyDistinct, mergeDistinct } from "./database/distinct.cjs";
|
|
9
|
-
import { MemoryAdapterOptions, createMemoryAdapter } from "./database/memoryAdapter.cjs";
|
|
10
|
-
import { DatabaseValueError, NormalizeOptions, canonicalJson, compareKeyValues, compareTuples, compareUtf8, indexEntries, indexOrderTuple, isKeyValue, matchesQuery, normalizeStoredRow, normalizeStoredValue } from "./database/values.cjs";
|
|
11
|
-
import { DatabaseAdapterContractError, DatabaseReadCount, DatabaseReadMeter, VerifiedDatabaseAdapter, VerifyAdapterOptions, verifyAdapter } from "./database/verifyAdapter.cjs";
|
|
12
|
-
export { type BundlePatchRow, type BundleRow, type BundleRowUpdate, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, DATABASE_MAX_MULTI_VALUES, DATABASE_MAX_QUERY_LIMIT, DATABASE_VERSION_COLUMN, DatabaseAdapter, DatabaseAdapterContractError, type DatabaseBundleMetadata, DatabaseJson, type DatabaseJsonObject, type DatabaseJsonValue, DatabaseKey, DatabaseKeyValue, DatabaseReadCount, DatabaseReadMeter, DatabaseRowReferencedError, DatabaseSchemaError, DatabaseValue, DatabaseValueError, MemoryAdapterOptions, NormalizeOptions, PhysicalColumn, PhysicalColumnType, PhysicalIndex, PhysicalRetention, PhysicalTable, QueryBound, QueryRequest, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, type ReleaseRow, type ReleaseRowUpdate, StoredRow, VerifiedDatabaseAdapter, VerifyAdapterOptions, WriteGuard, WriteOp, WriteResult, addDistinct, canonicalJson, compareKeyValues, compareTuples, compareUtf8, countDistinct, createMemoryAdapter, distinctRegister, emptyDistinct, expiresAt, findPhysicalColumn, findPhysicalIndex, indexEntries, indexOrderColumns, indexOrderTuple, isDatabaseJsonObject, isKeyValue, matchesQuery, mergeDistinct, normalizeStoredRow, normalizeStoredValue, rowKey, verifyAdapter };
|
package/dist/internal.d.mts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { DATABASE_MAX_MULTI_VALUES, DATABASE_MAX_QUERY_LIMIT, DATABASE_VERSION_COLUMN, DatabaseAdapter, DatabaseJson, DatabaseKey, DatabaseKeyValue, DatabaseSchemaError, DatabaseValue, PhysicalColumn, PhysicalColumnType, PhysicalIndex, PhysicalRetention, PhysicalTable, QueryBound, QueryRequest, StoredRow, WriteGuard, WriteOp, WriteResult, expiresAt, findPhysicalColumn, findPhysicalIndex, indexOrderColumns, rowKey } from "./database/adapter.mjs";
|
|
2
|
-
import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.mjs";
|
|
3
|
-
import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./types/databaseOperations.mjs";
|
|
4
|
-
import { ChannelDeleteResult, ChannelInsertResult } from "./types/models.mjs";
|
|
5
|
-
import { DatabaseRowReferencedError } from "./databaseErrors.mjs";
|
|
6
|
-
import { isDatabaseJsonObject } from "./databaseJsonValue.mjs";
|
|
7
|
-
import "./types/internal.mjs";
|
|
8
|
-
import { addDistinct, countDistinct, distinctRegister, emptyDistinct, mergeDistinct } from "./database/distinct.mjs";
|
|
9
|
-
import { MemoryAdapterOptions, createMemoryAdapter } from "./database/memoryAdapter.mjs";
|
|
10
|
-
import { DatabaseValueError, NormalizeOptions, canonicalJson, compareKeyValues, compareTuples, compareUtf8, indexEntries, indexOrderTuple, isKeyValue, matchesQuery, normalizeStoredRow, normalizeStoredValue } from "./database/values.mjs";
|
|
11
|
-
import { DatabaseAdapterContractError, DatabaseReadCount, DatabaseReadMeter, VerifiedDatabaseAdapter, VerifyAdapterOptions, verifyAdapter } from "./database/verifyAdapter.mjs";
|
|
12
|
-
export { type BundlePatchRow, type BundleRow, type BundleRowUpdate, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, DATABASE_MAX_MULTI_VALUES, DATABASE_MAX_QUERY_LIMIT, DATABASE_VERSION_COLUMN, DatabaseAdapter, DatabaseAdapterContractError, type DatabaseBundleMetadata, DatabaseJson, type DatabaseJsonObject, type DatabaseJsonValue, DatabaseKey, DatabaseKeyValue, DatabaseReadCount, DatabaseReadMeter, DatabaseRowReferencedError, DatabaseSchemaError, DatabaseValue, DatabaseValueError, MemoryAdapterOptions, NormalizeOptions, PhysicalColumn, PhysicalColumnType, PhysicalIndex, PhysicalRetention, PhysicalTable, QueryBound, QueryRequest, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, type ReleaseRow, type ReleaseRowUpdate, StoredRow, VerifiedDatabaseAdapter, VerifyAdapterOptions, WriteGuard, WriteOp, WriteResult, addDistinct, canonicalJson, compareKeyValues, compareTuples, compareUtf8, countDistinct, createMemoryAdapter, distinctRegister, emptyDistinct, expiresAt, findPhysicalColumn, findPhysicalIndex, indexEntries, indexOrderColumns, indexOrderTuple, isDatabaseJsonObject, isKeyValue, matchesQuery, mergeDistinct, normalizeStoredRow, normalizeStoredValue, rowKey, verifyAdapter };
|
package/dist/internal.mjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DatabaseRowReferencedError } from "./databaseErrors.mjs";
|
|
2
|
-
import { isDatabaseJsonObject } from "./databaseJsonValue.mjs";
|
|
3
|
-
import { DATABASE_MAX_MULTI_VALUES, DATABASE_MAX_QUERY_LIMIT, DATABASE_VERSION_COLUMN, DatabaseSchemaError, expiresAt, findPhysicalColumn, findPhysicalIndex, indexOrderColumns, rowKey } from "./database/adapter.mjs";
|
|
4
|
-
import { addDistinct, countDistinct, distinctRegister, emptyDistinct, mergeDistinct } from "./database/distinct.mjs";
|
|
5
|
-
import { DatabaseValueError, canonicalJson, compareKeyValues, compareTuples, compareUtf8, indexEntries, indexOrderTuple, isKeyValue, matchesQuery, normalizeStoredRow, normalizeStoredValue } from "./database/values.mjs";
|
|
6
|
-
import { createMemoryAdapter } from "./database/memoryAdapter.mjs";
|
|
7
|
-
import { DatabaseAdapterContractError, verifyAdapter } from "./database/verifyAdapter.mjs";
|
|
8
|
-
export { DATABASE_MAX_MULTI_VALUES, DATABASE_MAX_QUERY_LIMIT, DATABASE_VERSION_COLUMN, DatabaseAdapterContractError, DatabaseRowReferencedError, DatabaseSchemaError, DatabaseValueError, addDistinct, canonicalJson, compareKeyValues, compareTuples, compareUtf8, countDistinct, createMemoryAdapter, distinctRegister, emptyDistinct, expiresAt, findPhysicalColumn, findPhysicalIndex, indexEntries, indexOrderColumns, indexOrderTuple, isDatabaseJsonObject, isKeyValue, matchesQuery, mergeDistinct, normalizeStoredRow, normalizeStoredValue, rowKey, verifyAdapter };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./databaseRows.cjs";
|
|
2
|
-
import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./databaseOperations.cjs";
|
|
3
|
-
import { ChannelDeleteResult, ChannelInsertResult } from "./models.cjs";
|
|
4
|
-
export { BundlePatchRow, BundleRow, BundleRowUpdate, ChannelDeleteResult, ChannelInsertResult, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseCatalogRowUpdate, ReleaseRow, ReleaseRowUpdate };
|