@matter/general 0.16.0-alpha.0-20251018-dd1ea6a8a → 0.16.0-alpha.0-20251020-3f6e46245
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/cjs/math/Verhoeff.d.ts.map +1 -1
- package/dist/cjs/math/Verhoeff.js +4 -0
- package/dist/cjs/math/Verhoeff.js.map +1 -1
- package/dist/cjs/polyfills/index.d.ts +1 -0
- package/dist/cjs/polyfills/index.d.ts.map +1 -1
- package/dist/cjs/polyfills/index.js +1 -0
- package/dist/cjs/polyfills/index.js.map +1 -1
- package/dist/cjs/polyfills/metadata.d.ts +20 -0
- package/dist/cjs/polyfills/metadata.d.ts.map +1 -0
- package/dist/cjs/polyfills/metadata.js +10 -0
- package/dist/cjs/polyfills/metadata.js.map +6 -0
- package/dist/cjs/util/Decorator.d.ts +52 -0
- package/dist/cjs/util/Decorator.d.ts.map +1 -0
- package/dist/cjs/util/Decorator.js +40 -0
- package/dist/cjs/util/Decorator.js.map +6 -0
- package/dist/cjs/util/index.d.ts +1 -0
- package/dist/cjs/util/index.d.ts.map +1 -1
- package/dist/cjs/util/index.js +1 -0
- package/dist/cjs/util/index.js.map +1 -1
- package/dist/esm/math/Verhoeff.d.ts.map +1 -1
- package/dist/esm/math/Verhoeff.js +4 -0
- package/dist/esm/math/Verhoeff.js.map +1 -1
- package/dist/esm/polyfills/index.d.ts +1 -0
- package/dist/esm/polyfills/index.d.ts.map +1 -1
- package/dist/esm/polyfills/index.js +1 -0
- package/dist/esm/polyfills/index.js.map +1 -1
- package/dist/esm/polyfills/metadata.d.ts +20 -0
- package/dist/esm/polyfills/metadata.d.ts.map +1 -0
- package/dist/esm/polyfills/metadata.js +9 -0
- package/dist/esm/polyfills/metadata.js.map +6 -0
- package/dist/esm/util/Decorator.d.ts +52 -0
- package/dist/esm/util/Decorator.d.ts.map +1 -0
- package/dist/esm/util/Decorator.js +20 -0
- package/dist/esm/util/Decorator.js.map +6 -0
- package/dist/esm/util/index.d.ts +1 -0
- package/dist/esm/util/index.d.ts.map +1 -1
- package/dist/esm/util/index.js +1 -0
- package/dist/esm/util/index.js.map +1 -1
- package/package.json +2 -2
- package/src/math/Verhoeff.ts +5 -0
- package/src/polyfills/index.ts +1 -0
- package/src/polyfills/metadata.ts +24 -0
- package/src/util/Decorator.ts +87 -0
- package/src/util/Promises.ts +1 -1
- package/src/util/index.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Verhoeff.d.ts","sourceRoot":"","sources":["../../../src/math/Verhoeff.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"Verhoeff.d.ts","sourceRoot":"","sources":["../../../src/math/Verhoeff.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;GAIG;AACH,qBAAa,QAAQ;IAEjB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAWvB;IACF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAStB;IAEF,eAAe,CAAC,MAAM,EAAE,MAAM;CAYjC"}
|
|
@@ -21,6 +21,7 @@ __export(Verhoeff_exports, {
|
|
|
21
21
|
Verhoeff: () => Verhoeff
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(Verhoeff_exports);
|
|
24
|
+
var import_MatterError = require("#MatterError.js");
|
|
24
25
|
/**
|
|
25
26
|
* @license
|
|
26
27
|
* Copyright 2022-2025 Matter.js Authors
|
|
@@ -56,6 +57,9 @@ class Verhoeff {
|
|
|
56
57
|
let checksum = 0;
|
|
57
58
|
for (let i = 1; i <= length; i++) {
|
|
58
59
|
const digit = Number.parseInt(digits[length - i]);
|
|
60
|
+
if (Number.isNaN(digit)) {
|
|
61
|
+
throw new import_MatterError.ImplementationError("Invalid verhoeff checksum digit");
|
|
62
|
+
}
|
|
59
63
|
checksum = this.multiply[checksum][this.permute[i % 8][digit]];
|
|
60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;;;GAIG;AAEH,OAAO,iBAAiB,CAAC;AACzB,OAAO,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/polyfills/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,iBAAiB,CAAC;AACzB,OAAO,eAAe,CAAC;AACvB,OAAO,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2025 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
declare global {
|
|
7
|
+
interface SymbolConstructor {
|
|
8
|
+
/**
|
|
9
|
+
* The standard "metadata" symbol.
|
|
10
|
+
*
|
|
11
|
+
* Strangely, TypeScript monkeypatches Symbol.metadata, but not the types.
|
|
12
|
+
*/
|
|
13
|
+
readonly metadata: unique symbol;
|
|
14
|
+
}
|
|
15
|
+
interface NewableFunction {
|
|
16
|
+
[Symbol.metadata]?: undefined | DecoratorMetadataObject;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/polyfills/metadata.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,iBAAiB;QACvB;;;;WAIG;QACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,MAAM,CAAC;KACpC;IAED,UAAU,eAAe;QACrB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,SAAS,GAAG,uBAAuB,CAAC;KAC3D;CACJ"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2025 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Mark a function as a decorator.
|
|
8
|
+
*/
|
|
9
|
+
export declare function Decorator<T extends Function>(decorate: T): T;
|
|
10
|
+
/**
|
|
11
|
+
* A function that may act as a tc39 decorator.
|
|
12
|
+
*/
|
|
13
|
+
export type Decorator = Decorator.Class<any> | Decorator.Property<any, any>;
|
|
14
|
+
export declare namespace Decorator {
|
|
15
|
+
/**
|
|
16
|
+
* Determine if a function is marked as a decorator.
|
|
17
|
+
*/
|
|
18
|
+
function is(fn: Function): fn is Decorator;
|
|
19
|
+
interface Class<T extends abstract new (...args: any) => any = abstract new (...args: any) => any> {
|
|
20
|
+
(target: T, context: ClassDecoratorContext<T>): T | void;
|
|
21
|
+
}
|
|
22
|
+
interface ClassMethod<This = unknown, T extends (this: This, ...args: any) => any = (this: This, ...args: any) => any> {
|
|
23
|
+
(target: T, context: ClassMethodDecoratorContext): T | void;
|
|
24
|
+
}
|
|
25
|
+
interface ClassGetter<This = unknown, Value = unknown, T = (this: This, value: Value) => void> {
|
|
26
|
+
(target: T, context: ClassGetterDecoratorContext<This, Value>): T | void;
|
|
27
|
+
}
|
|
28
|
+
interface ClassSetter<This = unknown, Value = unknown, T = (this: This) => Value> {
|
|
29
|
+
(target: T, context: ClassSetterDecoratorContext): T | void;
|
|
30
|
+
}
|
|
31
|
+
interface ClassField<This = unknown, Value = unknown> {
|
|
32
|
+
(target: undefined, context: ClassFieldDecoratorContext<This, Value>): ((initialValue: Value) => Value) | void;
|
|
33
|
+
}
|
|
34
|
+
type ClassAccessor<This = unknown, Value = unknown> = {
|
|
35
|
+
(target: ClassAccessorDecoratorTarget<This, Value>, context: ClassAccessorDecoratorContext<This, Value>): ClassAccessorDecoratorResult<{}, unknown>;
|
|
36
|
+
};
|
|
37
|
+
type Property<This = unknown, Value = unknown> = ClassGetter<This, Value> | ClassSetter<This, Value> | ClassField<This, Value> | ClassAccessor<This, Value>;
|
|
38
|
+
type PropertyContext<This = unknown, Value = unknown> = ClassGetterDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value> | ClassFieldDecoratorContext<This, Value> | ClassAccessorDecoratorContext<This, Value>;
|
|
39
|
+
interface ClassCollector {
|
|
40
|
+
(target: NewableFunction, context: ClassDecoratorContext): void;
|
|
41
|
+
}
|
|
42
|
+
interface MethodCollector {
|
|
43
|
+
(target: CallableFunction, context: ClassMethodDecoratorContext<any, any>): void;
|
|
44
|
+
}
|
|
45
|
+
interface PropertyCollector {
|
|
46
|
+
(target: CallableFunction | undefined, context: PropertyContext<any, any>): void;
|
|
47
|
+
}
|
|
48
|
+
interface Collector {
|
|
49
|
+
(target: NewableFunction | CallableFunction | undefined, context: DecoratorContext): void;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=Decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Decorator.d.ts","sourceRoot":"","sources":["../../../src/util/Decorator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,QAAQ,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAG5D;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAE5E,yBAAiB,SAAS,CAAC;IACvB;;OAEG;IACH,SAAgB,EAAE,CAAC,EAAE,EAAE,QAAQ,GAAG,EAAE,IAAI,SAAS,CAEhD;IAED,UAAiB,KAAK,CAAC,CAAC,SAAS,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,GAAG,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG;QACpG,CAAC,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,CAA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|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var Decorator_exports = {};
|
|
20
|
+
__export(Decorator_exports, {
|
|
21
|
+
Decorator: () => Decorator
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(Decorator_exports);
|
|
24
|
+
/**
|
|
25
|
+
* @license
|
|
26
|
+
* Copyright 2022-2025 Matter.js Authors
|
|
27
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
28
|
+
*/
|
|
29
|
+
const isDecorator = Symbol("isDecorator");
|
|
30
|
+
function Decorator(decorate) {
|
|
31
|
+
decorate[isDecorator] = true;
|
|
32
|
+
return decorate;
|
|
33
|
+
}
|
|
34
|
+
((Decorator2) => {
|
|
35
|
+
function is(fn) {
|
|
36
|
+
return !!fn[isDecorator];
|
|
37
|
+
}
|
|
38
|
+
Decorator2.is = is;
|
|
39
|
+
})(Decorator || (Decorator = {}));
|
|
40
|
+
//# sourceMappingURL=Decorator.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/util/Decorator.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,MAAM,cAAc,OAAO,aAAa;AAKjC,SAAS,UAA8B,UAAgB;AAC1D,EAAC,SAAiB,WAAW,IAAI;AACjC,SAAO;AACX;AAAA,CAOO,CAAUA,eAAV;AAII,WAAS,GAAG,IAA+B;AAC9C,WAAO,CAAC,CAAE,GAAW,WAAW;AAAA,EACpC;AAFO,EAAAA,WAAS;AAAA,GAJH;",
|
|
5
|
+
"names": ["Decorator"]
|
|
6
|
+
}
|
package/dist/cjs/util/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./Construction.js";
|
|
|
13
13
|
export * from "./DataReader.js";
|
|
14
14
|
export * from "./DataReadQueue.js";
|
|
15
15
|
export * from "./DataWriter.js";
|
|
16
|
+
export * from "./Decorator.js";
|
|
16
17
|
export * from "./DeepCopy.js";
|
|
17
18
|
export * from "./DeepEqual.js";
|
|
18
19
|
export * from "./Error.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/util/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/util/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
package/dist/cjs/util/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __reExport(util_exports, require("./Construction.js"), module.exports);
|
|
|
25
25
|
__reExport(util_exports, require("./DataReader.js"), module.exports);
|
|
26
26
|
__reExport(util_exports, require("./DataReadQueue.js"), module.exports);
|
|
27
27
|
__reExport(util_exports, require("./DataWriter.js"), module.exports);
|
|
28
|
+
__reExport(util_exports, require("./Decorator.js"), module.exports);
|
|
28
29
|
__reExport(util_exports, require("./DeepCopy.js"), module.exports);
|
|
29
30
|
__reExport(util_exports, require("./DeepEqual.js"), module.exports);
|
|
30
31
|
__reExport(util_exports, require("./Error.js"), module.exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/util/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAMA,yBAAc,uBANd;AAOA,yBAAc,uBAPd;AAQA,yBAAc,sBARd;AASA,yBAAc,uBATd;AAUA,yBAAc,uBAVd;AAWA,yBAAc,4BAXd;AAYA,yBAAc,8BAZd;AAaA,yBAAc,4BAbd;AAcA,yBAAc,+BAdd;AAeA,yBAAc,4BAfd;AAgBA,yBAAc,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAMA,yBAAc,uBANd;AAOA,yBAAc,uBAPd;AAQA,yBAAc,sBARd;AASA,yBAAc,uBATd;AAUA,yBAAc,uBAVd;AAWA,yBAAc,4BAXd;AAYA,yBAAc,8BAZd;AAaA,yBAAc,4BAbd;AAcA,yBAAc,+BAdd;AAeA,yBAAc,4BAfd;AAgBA,yBAAc,2BAhBd;AAiBA,yBAAc,0BAjBd;AAkBA,yBAAc,2BAlBd;AAmBA,yBAAc,uBAnBd;AAoBA,yBAAc,+BApBd;AAqBA,yBAAc,gCArBd;AAsBA,yBAAc,oBAtBd;AAuBA,yBAAc,2BAvBd;AAwBA,yBAAc,qBAxBd;AAyBA,yBAAc,2BAzBd;AA0BA,yBAAc,uBA1Bd;AA2BA,yBAAc,8BA3Bd;AA4BA,yBAAc,wBA5Bd;AA6BA,yBAAc,4BA7Bd;AA8BA,yBAAc,8BA9Bd;AA+BA,yBAAc,0BA/Bd;AAgCA,yBAAc,qBAhCd;AAiCA,yBAAc,2BAjCd;AAkCA,yBAAc,yBAlCd;AAmCA,yBAAc,wBAnCd;AAoCA,yBAAc,sBApCd;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Verhoeff.d.ts","sourceRoot":"","sources":["../../../src/math/Verhoeff.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"Verhoeff.d.ts","sourceRoot":"","sources":["../../../src/math/Verhoeff.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;GAIG;AACH,qBAAa,QAAQ;IAEjB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAWvB;IACF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAStB;IAEF,eAAe,CAAC,MAAM,EAAE,MAAM;CAYjC"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright 2022-2025 Matter.js Authors
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { ImplementationError } from "#MatterError.js";
|
|
6
7
|
class Verhoeff {
|
|
7
8
|
// This is rarely used so no need to keep those constants in memory
|
|
8
9
|
multiply = [
|
|
@@ -33,6 +34,9 @@ class Verhoeff {
|
|
|
33
34
|
let checksum = 0;
|
|
34
35
|
for (let i = 1; i <= length; i++) {
|
|
35
36
|
const digit = Number.parseInt(digits[length - i]);
|
|
37
|
+
if (Number.isNaN(digit)) {
|
|
38
|
+
throw new ImplementationError("Invalid verhoeff checksum digit");
|
|
39
|
+
}
|
|
36
40
|
checksum = this.multiply[checksum][this.permute[i % 8][digit]];
|
|
37
41
|
}
|
|
38
42
|
return this.inverse[checksum];
|
|
@@ -1,6 +1,6 @@
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,IAC7B,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAAA,IAC7B,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAAA,IAC7B,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAAA,IAC7B,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAAA,IAC7B,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAAA,IAC7B,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAAA,IAC7B,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAAA,EACjC;AAAA,EAEA,gBAAgB,QAAgB;AAC5B,UAAM,EAAE,OAAO,IAAI;AACnB,QAAI,WAAW;AACf,aAAS,IAAI,GAAG,KAAK,QAAQ,KAAK;AAC9B,YAAM,QAAQ,OAAO,SAAS,OAAO,SAAS,CAAC,CAAC;AAChD,UAAI,OAAO,MAAM,KAAK,GAAG;AACrB,cAAM,IAAI,oBAAoB,iCAAiC;AAAA,MACnE;AACA,iBAAW,KAAK,SAAS,QAAQ,EAAE,KAAK,QAAQ,IAAI,CAAC,EAAE,KAAK,CAAC;AAAA,IACjE;AACA,WAAO,KAAK,QAAQ,QAAQ;AAAA,EAChC;AACJ;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
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
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/polyfills/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,iBAAiB,CAAC;AACzB,OAAO,eAAe,CAAC;AACvB,OAAO,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2025 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
declare global {
|
|
7
|
+
interface SymbolConstructor {
|
|
8
|
+
/**
|
|
9
|
+
* The standard "metadata" symbol.
|
|
10
|
+
*
|
|
11
|
+
* Strangely, TypeScript monkeypatches Symbol.metadata, but not the types.
|
|
12
|
+
*/
|
|
13
|
+
readonly metadata: unique symbol;
|
|
14
|
+
}
|
|
15
|
+
interface NewableFunction {
|
|
16
|
+
[Symbol.metadata]?: undefined | DecoratorMetadataObject;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/polyfills/metadata.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,iBAAiB;QACvB;;;;WAIG;QACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,MAAM,CAAC;KACpC;IAED,UAAU,eAAe;QACrB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,SAAS,GAAG,uBAAuB,CAAC;KAC3D;CACJ"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2025 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Mark a function as a decorator.
|
|
8
|
+
*/
|
|
9
|
+
export declare function Decorator<T extends Function>(decorate: T): T;
|
|
10
|
+
/**
|
|
11
|
+
* A function that may act as a tc39 decorator.
|
|
12
|
+
*/
|
|
13
|
+
export type Decorator = Decorator.Class<any> | Decorator.Property<any, any>;
|
|
14
|
+
export declare namespace Decorator {
|
|
15
|
+
/**
|
|
16
|
+
* Determine if a function is marked as a decorator.
|
|
17
|
+
*/
|
|
18
|
+
function is(fn: Function): fn is Decorator;
|
|
19
|
+
interface Class<T extends abstract new (...args: any) => any = abstract new (...args: any) => any> {
|
|
20
|
+
(target: T, context: ClassDecoratorContext<T>): T | void;
|
|
21
|
+
}
|
|
22
|
+
interface ClassMethod<This = unknown, T extends (this: This, ...args: any) => any = (this: This, ...args: any) => any> {
|
|
23
|
+
(target: T, context: ClassMethodDecoratorContext): T | void;
|
|
24
|
+
}
|
|
25
|
+
interface ClassGetter<This = unknown, Value = unknown, T = (this: This, value: Value) => void> {
|
|
26
|
+
(target: T, context: ClassGetterDecoratorContext<This, Value>): T | void;
|
|
27
|
+
}
|
|
28
|
+
interface ClassSetter<This = unknown, Value = unknown, T = (this: This) => Value> {
|
|
29
|
+
(target: T, context: ClassSetterDecoratorContext): T | void;
|
|
30
|
+
}
|
|
31
|
+
interface ClassField<This = unknown, Value = unknown> {
|
|
32
|
+
(target: undefined, context: ClassFieldDecoratorContext<This, Value>): ((initialValue: Value) => Value) | void;
|
|
33
|
+
}
|
|
34
|
+
type ClassAccessor<This = unknown, Value = unknown> = {
|
|
35
|
+
(target: ClassAccessorDecoratorTarget<This, Value>, context: ClassAccessorDecoratorContext<This, Value>): ClassAccessorDecoratorResult<{}, unknown>;
|
|
36
|
+
};
|
|
37
|
+
type Property<This = unknown, Value = unknown> = ClassGetter<This, Value> | ClassSetter<This, Value> | ClassField<This, Value> | ClassAccessor<This, Value>;
|
|
38
|
+
type PropertyContext<This = unknown, Value = unknown> = ClassGetterDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value> | ClassFieldDecoratorContext<This, Value> | ClassAccessorDecoratorContext<This, Value>;
|
|
39
|
+
interface ClassCollector {
|
|
40
|
+
(target: NewableFunction, context: ClassDecoratorContext): void;
|
|
41
|
+
}
|
|
42
|
+
interface MethodCollector {
|
|
43
|
+
(target: CallableFunction, context: ClassMethodDecoratorContext<any, any>): void;
|
|
44
|
+
}
|
|
45
|
+
interface PropertyCollector {
|
|
46
|
+
(target: CallableFunction | undefined, context: PropertyContext<any, any>): void;
|
|
47
|
+
}
|
|
48
|
+
interface Collector {
|
|
49
|
+
(target: NewableFunction | CallableFunction | undefined, context: DecoratorContext): void;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=Decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Decorator.d.ts","sourceRoot":"","sources":["../../../src/util/Decorator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,QAAQ,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAG5D;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAE5E,yBAAiB,SAAS,CAAC;IACvB;;OAEG;IACH,SAAgB,EAAE,CAAC,EAAE,EAAE,QAAQ,GAAG,EAAE,IAAI,SAAS,CAEhD;IAED,UAAiB,KAAK,CAAC,CAAC,SAAS,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,GAAG,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG;QACpG,CAAC,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;KAC5D;IAED,UAAiB,WAAW,CACxB,IAAI,GAAG,OAAO,EACd,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IA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C,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,GACxB,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,GACxB,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,GACvB,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAEjC,KAAY,eAAe,CAAC,IAAI,GAAG,OAAO,EAAE,KAAK,GAAG,OAAO,IACrD,2BAA2B,CAAC,IAAI,EAAE,KAAK,CAAC,GACxC,2BAA2B,CAAC,IAAI,EAAE,KAAK,CAAC,GACxC,0BAA0B,CAAC,IAAI,EAAE,KAAK,CAAC,GACvC,6BAA6B,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAEjD,UAAiB,cAAc;QAC3B,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAAC;KACnE;IAED,UAAiB,eAAe;QAC5B,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,2BAA2B,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;KACpF;IAED,UAAiB,iBAAiB;QAC9B,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,EAAE,OAAO,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;KACpF;IAED,UAAiB,SAAS;QACtB,CAAC,MAAM,EAAE,eAAe,GAAG,gBAAgB,GAAG,SAAS,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;KAC7F;CACJ"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2025 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
const isDecorator = Symbol("isDecorator");
|
|
7
|
+
function Decorator(decorate) {
|
|
8
|
+
decorate[isDecorator] = true;
|
|
9
|
+
return decorate;
|
|
10
|
+
}
|
|
11
|
+
((Decorator2) => {
|
|
12
|
+
function is(fn) {
|
|
13
|
+
return !!fn[isDecorator];
|
|
14
|
+
}
|
|
15
|
+
Decorator2.is = is;
|
|
16
|
+
})(Decorator || (Decorator = {}));
|
|
17
|
+
export {
|
|
18
|
+
Decorator
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=Decorator.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/util/Decorator.ts"],
|
|
4
|
+
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,MAAM,cAAc,OAAO,aAAa;AAKjC,SAAS,UAA8B,UAAgB;AAC1D,EAAC,SAAiB,WAAW,IAAI;AACjC,SAAO;AACX;AAAA,CAOO,CAAUA,eAAV;AAII,WAAS,GAAG,IAA+B;AAC9C,WAAO,CAAC,CAAE,GAAW,WAAW;AAAA,EACpC;AAFO,EAAAA,WAAS;AAAA,GAJH;",
|
|
5
|
+
"names": ["Decorator"]
|
|
6
|
+
}
|
package/dist/esm/util/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./Construction.js";
|
|
|
13
13
|
export * from "./DataReader.js";
|
|
14
14
|
export * from "./DataReadQueue.js";
|
|
15
15
|
export * from "./DataWriter.js";
|
|
16
|
+
export * from "./Decorator.js";
|
|
16
17
|
export * from "./DeepCopy.js";
|
|
17
18
|
export * from "./DeepEqual.js";
|
|
18
19
|
export * from "./Error.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/util/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC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AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
package/dist/esm/util/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./Construction.js";
|
|
|
13
13
|
export * from "./DataReader.js";
|
|
14
14
|
export * from "./DataReadQueue.js";
|
|
15
15
|
export * from "./DataWriter.js";
|
|
16
|
+
export * from "./Decorator.js";
|
|
16
17
|
export * from "./DeepCopy.js";
|
|
17
18
|
export * from "./DeepEqual.js";
|
|
18
19
|
export * from "./Error.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/util/index.ts"],
|
|
4
|
-
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
4
|
+
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matter/general",
|
|
3
|
-
"version": "0.16.0-alpha.0-
|
|
3
|
+
"version": "0.16.0-alpha.0-20251020-3f6e46245",
|
|
4
4
|
"description": "Non-Matter support for Matter.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"iot",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@noble/curves": "^2.0.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@matter/testing": "0.16.0-alpha.0-
|
|
39
|
+
"@matter/testing": "0.16.0-alpha.0-20251020-3f6e46245"
|
|
40
40
|
},
|
|
41
41
|
"files": [
|
|
42
42
|
"dist/**/*",
|
package/src/math/Verhoeff.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { ImplementationError } from "#MatterError.js";
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
10
|
* Verhoeff algorithm to compute a checksum.
|
|
9
11
|
*
|
|
@@ -40,6 +42,9 @@ export class Verhoeff {
|
|
|
40
42
|
let checksum = 0;
|
|
41
43
|
for (let i = 1; i <= length; i++) {
|
|
42
44
|
const digit = Number.parseInt(digits[length - i]);
|
|
45
|
+
if (Number.isNaN(digit)) {
|
|
46
|
+
throw new ImplementationError("Invalid verhoeff checksum digit");
|
|
47
|
+
}
|
|
43
48
|
checksum = this.multiply[checksum][this.permute[i % 8][digit]];
|
|
44
49
|
}
|
|
45
50
|
return this.inverse[checksum];
|
package/src/polyfills/index.ts
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2025 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
interface SymbolConstructor {
|
|
9
|
+
/**
|
|
10
|
+
* The standard "metadata" symbol.
|
|
11
|
+
*
|
|
12
|
+
* Strangely, TypeScript monkeypatches Symbol.metadata, but not the types.
|
|
13
|
+
*/
|
|
14
|
+
readonly metadata: unique symbol;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface NewableFunction {
|
|
18
|
+
[Symbol.metadata]?: undefined | DecoratorMetadataObject;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (!(("metadata" in Symbol) as any)) {
|
|
23
|
+
(Symbol as { metadata: symbol }).metadata = Symbol.for("Symbol.metadata");
|
|
24
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2025 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const isDecorator = Symbol("isDecorator");
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Mark a function as a decorator.
|
|
11
|
+
*/
|
|
12
|
+
export function Decorator<T extends Function>(decorate: T): T {
|
|
13
|
+
(decorate as any)[isDecorator] = true;
|
|
14
|
+
return decorate;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A function that may act as a tc39 decorator.
|
|
19
|
+
*/
|
|
20
|
+
export type Decorator = Decorator.Class<any> | Decorator.Property<any, any>;
|
|
21
|
+
|
|
22
|
+
export namespace Decorator {
|
|
23
|
+
/**
|
|
24
|
+
* Determine if a function is marked as a decorator.
|
|
25
|
+
*/
|
|
26
|
+
export function is(fn: Function): fn is Decorator {
|
|
27
|
+
return !!(fn as any)[isDecorator];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface Class<T extends abstract new (...args: any) => any = abstract new (...args: any) => any> {
|
|
31
|
+
(target: T, context: ClassDecoratorContext<T>): T | void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface ClassMethod<
|
|
35
|
+
This = unknown,
|
|
36
|
+
T extends (this: This, ...args: any) => any = (this: This, ...args: any) => any,
|
|
37
|
+
> {
|
|
38
|
+
(target: T, context: ClassMethodDecoratorContext): T | void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface ClassGetter<This = unknown, Value = unknown, T = (this: This, value: Value) => void> {
|
|
42
|
+
(target: T, context: ClassGetterDecoratorContext<This, Value>): T | void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface ClassSetter<This = unknown, Value = unknown, T = (this: This) => Value> {
|
|
46
|
+
(target: T, context: ClassSetterDecoratorContext): T | void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface ClassField<This = unknown, Value = unknown> {
|
|
50
|
+
(target: undefined, context: ClassFieldDecoratorContext<This, Value>): ((initialValue: Value) => Value) | void;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type ClassAccessor<This = unknown, Value = unknown> = {
|
|
54
|
+
(
|
|
55
|
+
target: ClassAccessorDecoratorTarget<This, Value>,
|
|
56
|
+
context: ClassAccessorDecoratorContext<This, Value>,
|
|
57
|
+
): ClassAccessorDecoratorResult<{}, unknown>;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type Property<This = unknown, Value = unknown> =
|
|
61
|
+
| ClassGetter<This, Value>
|
|
62
|
+
| ClassSetter<This, Value>
|
|
63
|
+
| ClassField<This, Value>
|
|
64
|
+
| ClassAccessor<This, Value>;
|
|
65
|
+
|
|
66
|
+
export type PropertyContext<This = unknown, Value = unknown> =
|
|
67
|
+
| ClassGetterDecoratorContext<This, Value>
|
|
68
|
+
| ClassSetterDecoratorContext<This, Value>
|
|
69
|
+
| ClassFieldDecoratorContext<This, Value>
|
|
70
|
+
| ClassAccessorDecoratorContext<This, Value>;
|
|
71
|
+
|
|
72
|
+
export interface ClassCollector {
|
|
73
|
+
(target: NewableFunction, context: ClassDecoratorContext): void;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface MethodCollector {
|
|
77
|
+
(target: CallableFunction, context: ClassMethodDecoratorContext<any, any>): void;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface PropertyCollector {
|
|
81
|
+
(target: CallableFunction | undefined, context: PropertyContext<any, any>): void;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface Collector {
|
|
85
|
+
(target: NewableFunction | CallableFunction | undefined, context: DecoratorContext): void;
|
|
86
|
+
}
|
|
87
|
+
}
|
package/src/util/Promises.ts
CHANGED
|
@@ -252,7 +252,7 @@ export const MaybePromise = {
|
|
|
252
252
|
//
|
|
253
253
|
// https://github.com/typescript-eslint/typescript-eslint/issues/7276
|
|
254
254
|
//
|
|
255
|
-
// eslint
|
|
255
|
+
// seems to be ok as of eslint 9.37.0
|
|
256
256
|
result = (result as Promise<T>).finally(onfinally);
|
|
257
257
|
} else {
|
|
258
258
|
result = result.then(
|
package/src/util/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from "./Construction.js";
|
|
|
14
14
|
export * from "./DataReader.js";
|
|
15
15
|
export * from "./DataReadQueue.js";
|
|
16
16
|
export * from "./DataWriter.js";
|
|
17
|
+
export * from "./Decorator.js";
|
|
17
18
|
export * from "./DeepCopy.js";
|
|
18
19
|
export * from "./DeepEqual.js";
|
|
19
20
|
export * from "./Error.js";
|