edinburgh 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +322 -262
  2. package/build/src/datapack.d.ts +9 -9
  3. package/build/src/datapack.js +9 -9
  4. package/build/src/edinburgh.d.ts +18 -7
  5. package/build/src/edinburgh.js +30 -51
  6. package/build/src/edinburgh.js.map +1 -1
  7. package/build/src/indexes.d.ts +85 -205
  8. package/build/src/indexes.js +150 -503
  9. package/build/src/indexes.js.map +1 -1
  10. package/build/src/migrate.js +8 -10
  11. package/build/src/migrate.js.map +1 -1
  12. package/build/src/models.d.ts +152 -107
  13. package/build/src/models.js +433 -144
  14. package/build/src/models.js.map +1 -1
  15. package/build/src/types.d.ts +30 -48
  16. package/build/src/types.js +25 -24
  17. package/build/src/types.js.map +1 -1
  18. package/build/src/utils.d.ts +4 -4
  19. package/build/src/utils.js +4 -4
  20. package/package.json +1 -1
  21. package/skill/AnyModelClass.md +7 -0
  22. package/skill/FindOptions.md +37 -0
  23. package/skill/Lifecycle Hooks.md +24 -0
  24. package/skill/{Model_delete.md → Lifecycle Hooks_delete.md } +1 -1
  25. package/skill/{Model_getPrimaryKeyHash.md → Lifecycle Hooks_getPrimaryKeyHash.md } +1 -1
  26. package/skill/{Model_isValid.md → Lifecycle Hooks_isValid.md } +1 -1
  27. package/skill/Lifecycle Hooks_migrate.md +26 -0
  28. package/skill/{Model_preCommit.md → Lifecycle Hooks_preCommit.md } +2 -2
  29. package/skill/{Model_preventPersist.md → Lifecycle Hooks_preventPersist.md } +1 -1
  30. package/skill/{Model_validate.md → Lifecycle Hooks_validate.md } +2 -2
  31. package/skill/ModelBase.md +7 -0
  32. package/skill/ModelClass.md +8 -0
  33. package/skill/SKILL.md +180 -132
  34. package/skill/Schema Evolution.md +19 -0
  35. package/skill/TypeWrapper_containsNull.md +11 -0
  36. package/skill/TypeWrapper_deserialize.md +9 -0
  37. package/skill/TypeWrapper_getError.md +11 -0
  38. package/skill/TypeWrapper_serialize.md +10 -0
  39. package/skill/TypeWrapper_serializeType.md +9 -0
  40. package/skill/array.md +2 -2
  41. package/skill/defineModel.md +3 -2
  42. package/skill/deleteEverything.md +8 -0
  43. package/skill/field.md +3 -3
  44. package/skill/link.md +3 -3
  45. package/skill/literal.md +1 -1
  46. package/skill/opt.md +1 -1
  47. package/skill/or.md +1 -1
  48. package/skill/record.md +1 -1
  49. package/skill/set.md +2 -2
  50. package/skill/setOnSaveCallback.md +2 -2
  51. package/skill/transact.md +1 -1
  52. package/src/datapack.ts +9 -9
  53. package/src/edinburgh.ts +43 -52
  54. package/src/indexes.ts +251 -599
  55. package/src/migrate.ts +9 -10
  56. package/src/models.ts +528 -231
  57. package/src/types.ts +36 -34
  58. package/src/utils.ts +4 -4
  59. package/skill/BaseIndex.md +0 -16
  60. package/skill/BaseIndex_batchProcess.md +0 -10
  61. package/skill/BaseIndex_find.md +0 -7
  62. package/skill/BaseIndex_find_2.md +0 -7
  63. package/skill/BaseIndex_find_3.md +0 -7
  64. package/skill/BaseIndex_find_4.md +0 -7
  65. package/skill/Model.md +0 -20
  66. package/skill/Model_batchProcess.md +0 -8
  67. package/skill/Model_migrate.md +0 -32
  68. package/skill/Model_replaceInto.md +0 -16
  69. package/skill/NonPrimaryIndex.md +0 -10
  70. package/skill/SecondaryIndex.md +0 -9
  71. package/skill/UniqueIndex.md +0 -9
  72. package/skill/dump.md +0 -8
@@ -17,21 +17,21 @@ export default class DataPack {
17
17
  get _buffer(): Uint8Array;
18
18
  /**
19
19
  * Create a new DataPack instance.
20
- * @param data - Optional initial data as Uint8Array or buffer size as number.
20
+ * @param data Optional initial data as Uint8Array or buffer size as number.
21
21
  */
22
22
  constructor(data?: Uint8Array | number);
23
23
  /**
24
24
  * Helper function to write a multi-byte integer with length prefix
25
- * @param value - The value to write
26
- * @param headerType - The type bits (0-7) for the header
27
- * @param invertBytes - Whether to invert bytes (for negative numbers)
28
- * @param invertByteCount - Whether to invert the byte count (for type 0)
25
+ * @param value The value to write
26
+ * @param headerType The type bits (0-7) for the header
27
+ * @param invertBytes Whether to invert bytes (for negative numbers)
28
+ * @param invertByteCount Whether to invert the byte count (for type 0)
29
29
  */
30
30
  private writeMultiByteNumber;
31
31
  /**
32
32
  * Helper function to read a multi-byte integer with length prefix
33
- * @param byteCount - Number of bytes to read
34
- * @param invertBytes - Whether to invert bytes (for negative numbers)
33
+ * @param byteCount Number of bytes to read
34
+ * @param invertBytes Whether to invert bytes (for negative numbers)
35
35
  * @returns The read value
36
36
  */
37
37
  private readMultiByteNumber;
@@ -69,7 +69,7 @@ export default class DataPack {
69
69
  } | undefined): any;
70
70
  /**
71
71
  * Ensure the buffer has capacity for additional bytes.
72
- * @param bytesNeeded - Number of additional bytes needed.
72
+ * @param bytesNeeded Number of additional bytes needed.
73
73
  */
74
74
  private ensureCapacity;
75
75
  readNumber(): number;
@@ -84,7 +84,7 @@ export default class DataPack {
84
84
  /**
85
85
  * Like writeString but writes without a length prefix and with a null terminator, for ordered storage.
86
86
  * Can be read with {@link read} or {@link readString} just like any other string.
87
- * @param str - The string to write. May not contain null characters.
87
+ * @param str The string to write. May not contain null characters.
88
88
  */
89
89
  writeOrderedString(str: string): DataPack;
90
90
  toUint8Array(copyBuffer?: boolean, startPos?: number, endPos?: number): Uint8Array;
@@ -34,7 +34,7 @@ export default class DataPack {
34
34
  }
35
35
  /**
36
36
  * Create a new DataPack instance.
37
- * @param data - Optional initial data as Uint8Array or buffer size as number.
37
+ * @param data Optional initial data as Uint8Array or buffer size as number.
38
38
  */
39
39
  constructor(data = 1900) {
40
40
  if (data instanceof Uint8Array) {
@@ -47,10 +47,10 @@ export default class DataPack {
47
47
  }
48
48
  /**
49
49
  * Helper function to write a multi-byte integer with length prefix
50
- * @param value - The value to write
51
- * @param headerType - The type bits (0-7) for the header
52
- * @param invertBytes - Whether to invert bytes (for negative numbers)
53
- * @param invertByteCount - Whether to invert the byte count (for type 0)
50
+ * @param value The value to write
51
+ * @param headerType The type bits (0-7) for the header
52
+ * @param invertBytes Whether to invert bytes (for negative numbers)
53
+ * @param invertByteCount Whether to invert the byte count (for type 0)
54
54
  */
55
55
  writeMultiByteNumber(value, headerType, invertBytes = false, invertByteCount = false) {
56
56
  let byteCount = 0;
@@ -74,8 +74,8 @@ export default class DataPack {
74
74
  }
75
75
  /**
76
76
  * Helper function to read a multi-byte integer with length prefix
77
- * @param byteCount - Number of bytes to read
78
- * @param invertBytes - Whether to invert bytes (for negative numbers)
77
+ * @param byteCount Number of bytes to read
78
+ * @param invertBytes Whether to invert bytes (for negative numbers)
79
79
  * @returns The read value
80
80
  */
81
81
  readMultiByteNumber(byteCount, invertBytes = false) {
@@ -386,7 +386,7 @@ export default class DataPack {
386
386
  }
387
387
  /**
388
388
  * Ensure the buffer has capacity for additional bytes.
389
- * @param bytesNeeded - Number of additional bytes needed.
389
+ * @param bytesNeeded Number of additional bytes needed.
390
390
  */
391
391
  ensureCapacity(bytesNeeded) {
392
392
  const needed = this.writePos + bytesNeeded;
@@ -498,7 +498,7 @@ export default class DataPack {
498
498
  /**
499
499
  * Like writeString but writes without a length prefix and with a null terminator, for ordered storage.
500
500
  * Can be read with {@link read} or {@link readString} just like any other string.
501
- * @param str - The string to write. May not contain null characters.
501
+ * @param str The string to write. May not contain null characters.
502
502
  */
503
503
  writeOrderedString(str) {
504
504
  const utf8Bytes = new TextEncoder().encode(str);
@@ -1,14 +1,26 @@
1
- export declare function scheduleInit(): void;
2
- export { Model, defineModel, field, currentTxn, } from "./models.js";
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ export { Model, type ModelClass, type AnyModelClass, type ModelBase, defineModel, deleteEverything, field, } from "./models.js";
3
3
  import type { Change, Model } from "./models.js";
4
4
  export { string, orderedString, number, dateTime, boolean, identifier, undef, opt, or, array, set, record, literal, link, } from "./types.js";
5
5
  export { dump, } from "./indexes.js";
6
- export { BaseIndex, NonPrimaryIndex, UniqueIndex, SecondaryIndex } from './indexes.js';
6
+ export type { FindOptions, IndexRangeIterator } from './indexes.js';
7
7
  export { type Change } from './models.js';
8
- export type { Transaction } from './models.js';
8
+ export type { FieldConfig } from './models.js';
9
+ export { TypeWrapper } from './types.js';
9
10
  export { DatabaseError } from "olmdb/lowlevel";
10
11
  export { runMigration } from './migrate.js';
11
12
  export type { MigrationOptions, MigrationResult } from './migrate.js';
13
+ export interface Transaction {
14
+ id: number;
15
+ instances: Map<number, Model<unknown>>;
16
+ }
17
+ export declare const txnStorage: AsyncLocalStorage<Transaction>;
18
+ /**
19
+ * Returns the current transaction from AsyncLocalStorage.
20
+ * Throws if called outside a transact() callback.
21
+ * @internal
22
+ */
23
+ export declare function currentTxn(): Transaction;
12
24
  /**
13
25
  * Initialize the database with the specified directory path.
14
26
  * This function may be called multiple times with the same parameters. If it is not called before the first transact(),
@@ -32,7 +44,7 @@ export declare function init(dbDir: string): void;
32
44
  * times.
33
45
  *
34
46
  * @template T - The return type of the transaction function.
35
- * @param fn - The function to execute within the transaction context. Receives a Transaction instance.
47
+ * @param fn The function to execute within the transaction context. Receives a Transaction instance.
36
48
  * @returns A promise that resolves with the function's return value.
37
49
  * @throws {DatabaseError} With code "RACING_TRANSACTION" if the transaction fails after retries due to conflicts.
38
50
  * @throws {DatabaseError} With code "TXN_LIMIT" if maximum number of transactions is reached.
@@ -73,5 +85,4 @@ export declare function setMaxRetryCount(count: number): void;
73
85
  * - A sequential number. Higher numbers have been committed after lower numbers.
74
86
  * - A map of model instances to their changes. The change can be "created", "deleted", or an object containing the old values.
75
87
  */
76
- export declare function setOnSaveCallback(callback: ((commitId: number, items: Map<Model<any>, Change>) => void) | undefined): void;
77
- export declare function deleteEverything(): Promise<void>;
88
+ export declare function setOnSaveCallback(callback: ((commitId: number, items: Map<Model<unknown>, Change>) => void) | undefined): void;
@@ -1,10 +1,9 @@
1
1
  import * as lowlevel from "olmdb/lowlevel";
2
2
  import { init as olmdbInit, DatabaseError } from "olmdb/lowlevel";
3
- import { modelRegistry, txnStorage, currentTxn } from "./models.js";
4
- let initNeeded = true;
5
- export function scheduleInit() { initNeeded = true; }
3
+ import { AsyncLocalStorage } from "node:async_hooks";
4
+ import { pendingModelInits } from "./models.js";
6
5
  // Re-export public API from models
7
- export { Model, defineModel, field, currentTxn, } from "./models.js";
6
+ export { Model, defineModel, deleteEverything, field, } from "./models.js";
8
7
  // Re-export public API from types (only factory functions and instances)
9
8
  export {
10
9
  // Pre-defined type instances
@@ -13,9 +12,21 @@ string, orderedString, number, dateTime, boolean, identifier, undef,
13
12
  opt, or, array, set, record, literal, link, } from "./types.js";
14
13
  // Re-export public API from indexes
15
14
  export { dump, } from "./indexes.js";
16
- export { BaseIndex, NonPrimaryIndex, UniqueIndex, SecondaryIndex } from './indexes.js';
15
+ export { TypeWrapper } from './types.js';
17
16
  export { DatabaseError } from "olmdb/lowlevel";
18
17
  export { runMigration } from './migrate.js';
18
+ export const txnStorage = new AsyncLocalStorage();
19
+ /**
20
+ * Returns the current transaction from AsyncLocalStorage.
21
+ * Throws if called outside a transact() callback.
22
+ * @internal
23
+ */
24
+ export function currentTxn() {
25
+ const txn = txnStorage.getStore();
26
+ if (!txn)
27
+ throw new DatabaseError("No active transaction. Operations must be performed within a transact() callback.", 'NO_TRANSACTION');
28
+ return txn;
29
+ }
19
30
  let olmdbReady = false;
20
31
  let maxRetryCount = 6;
21
32
  /**
@@ -50,7 +61,7 @@ const STALE_INSTANCE_DESCRIPTOR = {
50
61
  * times.
51
62
  *
52
63
  * @template T - The return type of the transaction function.
53
- * @param fn - The function to execute within the transaction context. Receives a Transaction instance.
64
+ * @param fn The function to execute within the transaction context. Receives a Transaction instance.
54
65
  * @returns A promise that resolves with the function's return value.
55
66
  * @throws {DatabaseError} With code "RACING_TRANSACTION" if the transaction fails after retries due to conflicts.
56
67
  * @throws {DatabaseError} With code "TXN_LIMIT" if maximum number of transactions is reached.
@@ -76,8 +87,7 @@ const STALE_INSTANCE_DESCRIPTOR = {
76
87
  * ```
77
88
  */
78
89
  export async function transact(fn) {
79
- while (initNeeded || pendingInit) {
80
- // Make sure only one async task is doing the inits, the rest should wait for it
90
+ while (pendingModelInits.size || pendingInit) {
81
91
  if (pendingInit) {
82
92
  await pendingInit;
83
93
  }
@@ -86,9 +96,10 @@ export async function transact(fn) {
86
96
  if (!olmdbReady)
87
97
  olmdbInit('.edinburgh');
88
98
  olmdbReady = true;
89
- initNeeded = false;
90
- for (const model of Object.values(modelRegistry)) {
91
- await model._loadCreateIndexes();
99
+ const models = [...pendingModelInits];
100
+ pendingModelInits.clear();
101
+ for (const model of models) {
102
+ await model._initialize();
92
103
  }
93
104
  })();
94
105
  await pendingInit;
@@ -98,22 +109,23 @@ export async function transact(fn) {
98
109
  // try {
99
110
  for (let retryCount = 0; retryCount < maxRetryCount; retryCount++) {
100
111
  const txnId = lowlevel.startTransaction();
101
- const txn = { id: txnId, instances: new Set(), instancesByPk: new Map() };
112
+ const txn = { id: txnId, instances: new Map() };
102
113
  const onSaveItems = onSaveCallback ? new Map() : undefined;
103
114
  let result;
104
115
  try {
105
116
  await txnStorage.run(txn, async function () {
106
117
  result = await fn();
107
118
  // Call preCommit() on all instances before writing.
108
- // Note: Set iteration visits newly added items, so preCommit() creating
119
+ // Note: Map iteration visits newly added items, so preCommit() creating
109
120
  // new instances is handled correctly.
110
- for (const instance of txn.instances) {
111
- instance.preCommit?.();
121
+ for (const instance of txn.instances.values()) {
122
+ if (instance._oldValues !== false)
123
+ instance.preCommit?.();
112
124
  }
113
125
  // Save all modified instances before committing
114
126
  // This needs to happen inside txnStorage.run, because resolving default values
115
127
  // for identifiers requires database access.
116
- for (const instance of txn.instances) {
128
+ for (const instance of txn.instances.values()) {
117
129
  const change = instance._write(txn);
118
130
  if (onSaveItems && change) {
119
131
  onSaveItems.set(instance, change);
@@ -130,14 +142,14 @@ export async function transact(fn) {
130
142
  }
131
143
  finally {
132
144
  // Make the instances read-only to make it clear that their transaction has ended.
133
- for (const instance of txn.instances) {
145
+ for (const instance of txn.instances.values()) {
134
146
  delete instance._oldValues;
135
147
  Object.defineProperty(instance, "_txn", STALE_INSTANCE_DESCRIPTOR);
136
148
  Object.freeze(instance);
137
149
  }
138
150
  // Destroy the transaction object, to make sure things crash if they are used after
139
151
  // this point, and to help the GC reclaim memory.
140
- txn.id = txn.instances = txn.instancesByPk = undefined;
152
+ txn.id = txn.instances = undefined;
141
153
  }
142
154
  const commitResult = lowlevel.commitTransaction(txnId);
143
155
  const commitSeq = typeof commitResult === 'number' ? commitResult : await commitResult;
@@ -179,37 +191,4 @@ let onSaveCallback;
179
191
  export function setOnSaveCallback(callback) {
180
192
  onSaveCallback = callback;
181
193
  }
182
- export async function deleteEverything() {
183
- let done = false;
184
- while (!done) {
185
- await transact(() => {
186
- const txn = currentTxn();
187
- const iteratorId = lowlevel.createIterator(txn.id, undefined, undefined, false);
188
- const deadline = Date.now() + 150;
189
- let count = 0;
190
- try {
191
- while (true) {
192
- const raw = lowlevel.readIterator(iteratorId);
193
- if (!raw) {
194
- done = true;
195
- break;
196
- }
197
- lowlevel.del(txn.id, raw.key);
198
- if (++count >= 4096 || Date.now() >= deadline)
199
- break;
200
- }
201
- }
202
- finally {
203
- lowlevel.closeIterator(iteratorId);
204
- }
205
- });
206
- }
207
- // Re-init indexes since metadata was deleted
208
- for (const model of Object.values(modelRegistry)) {
209
- if (!model.fields)
210
- continue;
211
- model._resetIndexes();
212
- await model._loadCreateIndexes();
213
- }
214
- }
215
194
  //# sourceMappingURL=edinburgh.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"edinburgh.js","sourceRoot":"","sources":["../../src/edinburgh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEpE,IAAI,UAAU,GAAG,IAA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