@matter/general 0.13.1-alpha.0-20250517-99a1e848a → 0.14.0-alpha.0-20250521-979eda05d

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 (44) hide show
  1. package/dist/cjs/crypto/Crypto.d.ts +1 -1
  2. package/dist/cjs/polyfills/index.d.ts +1 -0
  3. package/dist/cjs/polyfills/index.d.ts.map +1 -1
  4. package/dist/cjs/polyfills/index.js +1 -0
  5. package/dist/cjs/polyfills/index.js.map +1 -1
  6. package/dist/cjs/polyfills/suppressed-error.d.ts +7 -0
  7. package/dist/cjs/polyfills/suppressed-error.d.ts.map +1 -0
  8. package/dist/cjs/polyfills/suppressed-error.js +21 -0
  9. package/dist/cjs/polyfills/suppressed-error.js.map +6 -0
  10. package/dist/cjs/transaction/Transaction.d.ts +49 -22
  11. package/dist/cjs/transaction/Transaction.d.ts.map +1 -1
  12. package/dist/cjs/transaction/Transaction.js +22 -3
  13. package/dist/cjs/transaction/Transaction.js.map +1 -1
  14. package/dist/cjs/transaction/Tx.d.ts +9 -4
  15. package/dist/cjs/transaction/Tx.d.ts.map +1 -1
  16. package/dist/cjs/transaction/Tx.js +152 -122
  17. package/dist/cjs/transaction/Tx.js.map +2 -2
  18. package/dist/cjs/util/Observable.js +1 -1
  19. package/dist/cjs/util/Observable.js.map +1 -1
  20. package/dist/esm/crypto/Crypto.d.ts +1 -1
  21. package/dist/esm/polyfills/index.d.ts +1 -0
  22. package/dist/esm/polyfills/index.d.ts.map +1 -1
  23. package/dist/esm/polyfills/index.js +1 -0
  24. package/dist/esm/polyfills/index.js.map +1 -1
  25. package/dist/esm/polyfills/suppressed-error.d.ts +7 -0
  26. package/dist/esm/polyfills/suppressed-error.d.ts.map +1 -0
  27. package/dist/esm/polyfills/suppressed-error.js +20 -0
  28. package/dist/esm/polyfills/suppressed-error.js.map +6 -0
  29. package/dist/esm/transaction/Transaction.d.ts +49 -22
  30. package/dist/esm/transaction/Transaction.d.ts.map +1 -1
  31. package/dist/esm/transaction/Transaction.js +23 -4
  32. package/dist/esm/transaction/Transaction.js.map +1 -1
  33. package/dist/esm/transaction/Tx.d.ts +9 -4
  34. package/dist/esm/transaction/Tx.d.ts.map +1 -1
  35. package/dist/esm/transaction/Tx.js +152 -122
  36. package/dist/esm/transaction/Tx.js.map +2 -2
  37. package/dist/esm/util/Observable.js +1 -1
  38. package/dist/esm/util/Observable.js.map +1 -1
  39. package/package.json +3 -3
  40. package/src/polyfills/index.ts +1 -0
  41. package/src/polyfills/suppressed-error.ts +27 -0
  42. package/src/transaction/Transaction.ts +42 -4
  43. package/src/transaction/Tx.ts +202 -165
  44. package/src/util/Observable.ts +1 -1
@@ -19,7 +19,7 @@ export declare const ec: {
19
19
  FpPow<T>(Fp: mod.IField<T>, num: T, power: bigint): T;
20
20
  FpInvertBatch<T>(Fp: mod.IField<T>, nums: T[], passZero?: boolean): T[];
21
21
  FpDiv<T>(Fp: mod.IField<T>, lhs: T, rhs: T | bigint): T;
22
- FpLegendre<T>(Fp: mod.IField<T>, n: T): number;
22
+ FpLegendre<T>(Fp: mod.IField<T>, n: T): -1 | 0 | 1;
23
23
  FpIsSquare<T>(Fp: mod.IField<T>, n: T): boolean;
24
24
  nLength(n: bigint, nBitLength?: number): {
25
25
  nBitLength: number;
@@ -4,4 +4,5 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import "./disposable.js";
7
+ import "./suppressed-error.js";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/polyfills/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/polyfills/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,iBAAiB,CAAC;AACzB,OAAO,uBAAuB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  var import_disposable = require("./disposable.js");
3
+ var import_suppressed_error = require("./suppressed-error.js");
3
4
  /**
4
5
  * @license
5
6
  * Copyright 2022-2025 Matter.js Authors
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/polyfills/index.ts"],
4
- "mappings": ";AAMA,wBAAO;AANP;AAAA;AAAA;AAAA;AAAA;",
4
+ "mappings": ";AAMA,wBAAO;AACP,8BAAO;AAPP;AAAA;AAAA;AAAA;AAAA;",
5
5
  "names": []
6
6
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Project CHIP Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=suppressed-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suppressed-error.d.ts","sourceRoot":"","sources":["../../../src/polyfills/suppressed-error.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright 2022-2025 Project CHIP Authors
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ */
7
+ if (globalThis.SuppressedError === void 0) {
8
+ class SuppressedError extends Error {
9
+ error;
10
+ suppressed;
11
+ constructor(error, suppressed, message) {
12
+ super(message);
13
+ this.error = error;
14
+ this.suppressed = suppressed;
15
+ }
16
+ }
17
+ const factory = (error, suppressed, message) => new SuppressedError(error, suppressed, message);
18
+ factory.prototype = SuppressedError.prototype;
19
+ globalThis.SuppressedError = factory;
20
+ }
21
+ //# sourceMappingURL=suppressed-error.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/polyfills/suppressed-error.ts"],
4
+ "mappings": ";AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,IAAI,WAAW,oBAAoB,QAAW;AAAA,EAI1C,MAAM,wBAAwB,MAAM;AAAA,IAChC;AAAA,IACA;AAAA,IAEA,YAAY,OAAY,YAAiB,SAAkB;AACvD,YAAM,OAAO;AAEb,WAAK,QAAQ;AACb,WAAK,aAAa;AAAA,IACtB;AAAA,EACJ;AAEA,QAAM,UAAU,CAAC,OAAY,YAAiB,YAAqB,IAAI,gBAAgB,OAAO,YAAY,OAAO;AACjH,UAAQ,YAAY,gBAAgB;AAEpC,aAAW,kBAAkB;AACjC;",
5
+ "names": []
6
+ }
@@ -134,7 +134,9 @@ type ResourceSetType = ResourceSet;
134
134
  type ParticipantType = Participant;
135
135
  export declare const Transaction: {
136
136
  /**
137
- * Perform a transactional operation. This is the only way to obtain a read/write transaction.
137
+ * Perform a transactional operation.
138
+ *
139
+ * This creates a read/write transaction scoped to the life of an optionally async function call.
138
140
  *
139
141
  * The transaction will commit automatically if it is exclusive (write mode) after the actor returns.
140
142
  *
@@ -142,18 +144,25 @@ export declare const Transaction: {
142
144
  * destroyed.
143
145
  */
144
146
  act<T>(via: string, actor: (transaction: Transaction) => MaybePromise<T>): MaybePromise<T>;
147
+ /**
148
+ * Create a transaction.
149
+ *
150
+ * Transactions must be closed using {@link Finalization#resolve} or {@link Finalization#reject}.
151
+ *
152
+ * When closed the transaction commits automatically if exclusive.
153
+ */
154
+ open(via: string): Transaction & Transaction.Finalization;
145
155
  ReadOnly: {
146
- "__#15456@#participants": Set<Participant>;
147
- "__#15456@#roles": Map<{}, Participant>;
148
- "__#15456@#resources": Set<Resource>;
149
- "__#15456@#status": Status;
150
- "__#15456@#waitingOn"?: Iterable<Transaction>;
151
- "__#15456@#via": string;
152
- "__#15456@#shared"?: import("../index.js").Observable<[]>;
153
- "__#15456@#closed"?: import("../index.js").Observable<[]>;
154
- "__#15456@#isAsync": boolean;
155
- "__#15456@#reportingLocks": boolean;
156
- close(): void;
156
+ "__#15458@#participants": Set<Participant>;
157
+ "__#15458@#roles": Map<{}, Participant>;
158
+ "__#15458@#resources": Set<Resource>;
159
+ "__#15458@#status": Status;
160
+ "__#15458@#waitingOn"?: Iterable<Transaction>;
161
+ "__#15458@#via": string;
162
+ "__#15458@#shared"?: import("../index.js").Observable<[]>;
163
+ "__#15458@#closed"?: import("../index.js").Observable<[]>;
164
+ "__#15458@#isAsync": boolean;
165
+ "__#15458@#reportingLocks": boolean;
157
166
  readonly via: string;
158
167
  readonly status: Status;
159
168
  readonly participants: Set<Participant>;
@@ -169,20 +178,25 @@ export declare const Transaction: {
169
178
  beginSync(): void;
170
179
  addParticipants(...participants: Participant[]): void;
171
180
  getParticipant(role: {}): Participant | undefined;
172
- commit(): MaybePromise;
181
+ commit(): MaybePromise<void>;
182
+ resolve<T>(result: T): MaybePromise<Awaited<T>>;
173
183
  rollback(): Promise<void> | undefined;
184
+ reject(cause: unknown): MaybePromise<never>;
185
+ "__#15458@#executeCommitCycle"(count: number): MaybePromise<void>;
174
186
  waitFor(others: Set<Transaction>): Promise<void>;
175
187
  toString(): string;
176
188
  treatAsSlow(): void;
177
- "__#15456@#finalize"(status: Status, why: string, finalizer: () => MaybePromise): Promise<void> | undefined;
178
- "__#15456@#executePreCommit"(): MaybePromise<void>;
179
- "__#15456@#executeCommit"(): MaybePromise;
180
- "__#15456@#executeCommit1"(): MaybePromise;
181
- "__#15456@#executeCommit2"(): Promise<void> | undefined;
182
- "__#15456@#executePostCommit"(participants: Participant[]): MaybePromise;
183
- "__#15456@#executeRollback"(): Promise<void> | undefined;
184
- "__#15456@#locksChanged"(resources: Set<Resource>, how?: string): void;
185
- "__#15456@#assertAvailable"(): void;
189
+ "__#15458@#finalize"(status: Status, why: string, finalizer: () => MaybePromise): Promise<void> | undefined;
190
+ "__#15458@#reset"(why: string): void;
191
+ "__#15458@#createPreCommitExecutor"(): () => MaybePromise<void>;
192
+ "__#15458@#executeCommit"(): MaybePromise;
193
+ "__#15458@#executeCommit1"(): MaybePromise;
194
+ "__#15458@#executeCommit2"(): Promise<void> | undefined;
195
+ "__#15458@#createPostCommitExecutor"(participants: Participant[]): () => MaybePromise;
196
+ "__#15458@#executeRollback"(): Promise<void> | undefined;
197
+ "__#15458@#locksChanged"(resources: Set<Resource>, how?: string): void;
198
+ "__#15458@#assertAvailable"(): void;
199
+ [Symbol.dispose](): void;
186
200
  };
187
201
  Status: typeof Status;
188
202
  Resource: typeof Resource;
@@ -193,6 +207,19 @@ export declare namespace Transaction {
193
207
  type Resource = ResourceType;
194
208
  type ResourceSet = ResourceSetType;
195
209
  type Participant = ParticipantType;
210
+ interface Disposable extends Transaction, AsyncDisposable {
211
+ close(): MaybePromise<void>;
212
+ }
213
+ interface Finalization {
214
+ /**
215
+ * Finish the transaction. If {@link result} is a promise this may result on commit or rollback.
216
+ */
217
+ resolve<T>(result: T): MaybePromise<Awaited<T>>;
218
+ /**
219
+ * Roll back, close the transaction and throw an error.
220
+ */
221
+ reject(cause: unknown): MaybePromise<never>;
222
+ }
196
223
  }
197
224
  export {};
198
225
  //# sourceMappingURL=Transaction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Transaction.d.ts","sourceRoot":"","sources":["../../../src/transaction/Transaction.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,WAAW;IACxB;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IAExC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,CA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AAC;IAE1C,UAAiB,UAAW,SAAQ,WAAW,EAAE,eAAe;QAC5D,KAAK,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;KAC/B;IAED,UAAiB,YAAY;QACzB;;WAEG;QACH,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QAEhD;;WAEG;QACH,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;KAC/C;CACJ"}
@@ -31,7 +31,9 @@ var import_Tx = require("./Tx.js");
31
31
  */
32
32
  const Transaction = {
33
33
  /**
34
- * Perform a transactional operation. This is the only way to obtain a read/write transaction.
34
+ * Perform a transactional operation.
35
+ *
36
+ * This creates a read/write transaction scoped to the life of an optionally async function call.
35
37
  *
36
38
  * The transaction will commit automatically if it is exclusive (write mode) after the actor returns.
37
39
  *
@@ -39,12 +41,29 @@ const Transaction = {
39
41
  * destroyed.
40
42
  */
41
43
  act(via, actor) {
42
- return (0, import_Tx.act)(via, actor);
44
+ const tx = (0, import_Tx.open)(via);
45
+ let result;
46
+ try {
47
+ result = actor(tx);
48
+ } catch (e) {
49
+ return tx.reject(e);
50
+ }
51
+ return tx.resolve(result);
52
+ },
53
+ /**
54
+ * Create a transaction.
55
+ *
56
+ * Transactions must be closed using {@link Finalization#resolve} or {@link Finalization#reject}.
57
+ *
58
+ * When closed the transaction commits automatically if exclusive.
59
+ */
60
+ open(via) {
61
+ return (0, import_Tx.open)(via);
43
62
  },
44
63
  ReadOnly: import_Tx.ReadOnlyTransaction,
45
64
  Status: import_Status.Status,
46
65
  Resource: import_Resource.Resource,
47
66
  [Symbol.toStringTag]: "Transaction"
48
67
  };
49
- Transaction.act = import_Tx.act;
68
+ Transaction.open = import_Tx.open;
50
69
  //# sourceMappingURL=Transaction.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/transaction/Transaction.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,sBAAyB;AAEzB,oBAAuB;AACvB,gBAAyC;AAXzC;AAAA;AAAA;AAAA;AAAA;AA0JO,MAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASvB,IAAO,KAAa,OAAuE;AAEvF,eAAO,eAAI,KAAK,KAAK;AAAA,EACzB;AAAA,EAEA,UAAU;AAAA,EAEV;AAAA,EAEA;AAAA,EAEA,CAAC,OAAO,WAAW,GAAG;AAC1B;AAGA,YAAY,MAAM;",
4
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,sBAAyB;AAEzB,oBAAuB;AACvB,gBAA0C;AAX1C;AAAA;AAAA;AAAA;AAAA;AA0JO,MAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWvB,IAAO,KAAa,OAAuE;AACvF,UAAM,SAAK,gBAAK,GAAG;AAEnB,QAAI;AACJ,QAAI;AACA,eAAS,MAAM,EAAE;AAAA,IACrB,SAAS,GAAG;AACR,aAAO,GAAG,OAAO,CAAC;AAAA,IACtB;AAEA,WAAO,GAAG,QAAQ,MAAM;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,KAAK,KAAa;AAEd,eAAO,gBAAK,GAAG;AAAA,EACnB;AAAA,EAEA,UAAU;AAAA,EAEV;AAAA,EAEA;AAAA,EAEA,CAAC,OAAO,WAAW,GAAG;AAC1B;AAGA,YAAY,OAAO;",
5
5
  "names": []
6
6
  }
@@ -11,20 +11,23 @@ import type { Transaction } from "./Transaction.js";
11
11
  /**
12
12
  * This is the only public interface to this file.
13
13
  */
14
- export declare function act<T>(via: string, actor: (transaction: Transaction) => T): T;
14
+ export declare function open(via: string): Transaction & Transaction.Finalization;
15
15
  /**
16
16
  * The concrete implementation of the Transaction interface.
17
17
  */
18
- declare class Tx implements Transaction {
18
+ declare class Tx implements Transaction, Transaction.Finalization {
19
19
  #private;
20
20
  constructor(via: string, readonly?: boolean);
21
- close(): void;
21
+ [Symbol.dispose](): void;
22
22
  get via(): string;
23
23
  get status(): Status;
24
24
  get participants(): Set<Participant>;
25
25
  get resources(): Set<Resource>;
26
26
  get waitingOn(): Iterable<Transaction> | undefined;
27
27
  get isAsync(): boolean;
28
+ /**
29
+ * We set this during async processing. This enables the lock reporting when too much time ellapses.
30
+ */
28
31
  set isAsync(isAsync: true);
29
32
  onShared(listener: () => void, once?: boolean): void;
30
33
  onClose(listener: () => void): void;
@@ -34,8 +37,10 @@ declare class Tx implements Transaction {
34
37
  beginSync(): void;
35
38
  addParticipants(...participants: Participant[]): void;
36
39
  getParticipant(role: {}): Participant | undefined;
37
- commit(): MaybePromise;
40
+ commit(): MaybePromise<void>;
41
+ resolve<T>(result: T): MaybePromise<Awaited<T>>;
38
42
  rollback(): Promise<void> | undefined;
43
+ reject(cause: unknown): MaybePromise<never>;
39
44
  waitFor(others: Set<Transaction>): Promise<void>;
40
45
  toString(): string;
41
46
  treatAsSlow(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"Tx.d.ts","sourceRoot":"","sources":["../../../src/transaction/Tx.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAUpD;;GAEG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,WAAW,EAAE,WAAW,KAA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