@axiom-core/internal-utils 0.1.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.
@@ -0,0 +1,16 @@
1
+ export declare class AxiomError extends Error {
2
+ engine: string;
3
+ context?: Record<string, unknown>;
4
+ constructor(engine: string, message: string, context?: Record<string, unknown>);
5
+ }
6
+ export declare class AxiomInvariantError extends AxiomError {
7
+ constructor(engine: string, message: string, context?: Record<string, unknown>);
8
+ }
9
+ export declare class AxiomResolutionError extends AxiomError {
10
+ constructor(engine: string, message: string, context?: Record<string, unknown>);
11
+ }
12
+ export declare class AxiomComposeError extends AxiomError {
13
+ constructor(engine: string, message: string, context?: Record<string, unknown>);
14
+ }
15
+ export default AxiomError;
16
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAW,SAAQ,KAAK;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAC7B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAM/E;AAED,qBAAa,mBAAoB,SAAQ,UAAU;gBACrC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/E;AAED,qBAAa,oBAAqB,SAAQ,UAAU;gBACtC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/E;AAED,qBAAa,iBAAkB,SAAQ,UAAU;gBACnC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/E;AAED,eAAe,UAAU,CAAC"}
package/dist/errors.js ADDED
@@ -0,0 +1,30 @@
1
+ export class AxiomError extends Error {
2
+ engine;
3
+ context;
4
+ constructor(engine, message, context) {
5
+ super(`[${engine}] ${message}`);
6
+ this.name = 'AxiomError';
7
+ this.engine = engine;
8
+ this.context = context;
9
+ }
10
+ }
11
+ export class AxiomInvariantError extends AxiomError {
12
+ constructor(engine, message, context) {
13
+ super(engine, message, context);
14
+ this.name = 'AxiomInvariantError';
15
+ }
16
+ }
17
+ export class AxiomResolutionError extends AxiomError {
18
+ constructor(engine, message, context) {
19
+ super(engine, message, context);
20
+ this.name = 'AxiomResolutionError';
21
+ }
22
+ }
23
+ export class AxiomComposeError extends AxiomError {
24
+ constructor(engine, message, context) {
25
+ super(engine, message, context);
26
+ this.name = 'AxiomComposeError';
27
+ }
28
+ }
29
+ export default AxiomError;
30
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,UAAW,SAAQ,KAAK;IAC5B,MAAM,CAAS;IACf,OAAO,CAA2B;IACzC,YAAY,MAAc,EAAE,OAAe,EAAE,OAAiC;QAC5E,KAAK,CAAC,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,UAAU;IACjD,YAAY,MAAc,EAAE,OAAe,EAAE,OAAiC;QAC5E,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IAClD,YAAY,MAAc,EAAE,OAAe,EAAE,OAAiC;QAC5E,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,UAAU;IAC/C,YAAY,MAAc,EAAE,OAAe,EAAE,OAAiC;QAC5E,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { AxiomError, AxiomInvariantError, AxiomResolutionError, AxiomComposeError } from './errors.js';
2
+ export declare function deepClonePlain<T>(input: T): T;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEvG,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CA4D7C"}
package/dist/index.js ADDED
@@ -0,0 +1,58 @@
1
+ import { AxiomInvariantError } from './errors.js';
2
+ export { AxiomError, AxiomInvariantError, AxiomResolutionError, AxiomComposeError } from './errors.js';
3
+ export function deepClonePlain(input) {
4
+ const seen = new Map();
5
+ function makeClonePlaceholder(src) {
6
+ return Array.isArray(src) ? [] : {};
7
+ }
8
+ if (input === null || typeof input !== 'object')
9
+ return input;
10
+ if (typeof input === 'function' || typeof input === 'symbol')
11
+ throw new AxiomInvariantError('internal-utils', 'deepClonePlain: unsupported type');
12
+ const rootClone = makeClonePlaceholder(input);
13
+ const stack = [];
14
+ seen.set(input, rootClone);
15
+ stack.push({ src: input, dst: rootClone, keys: Object.keys(input), idx: 0 });
16
+ while (stack.length) {
17
+ const frame = stack[stack.length - 1];
18
+ const { src, dst, keys } = frame;
19
+ if (frame.idx >= keys.length) {
20
+ stack.pop();
21
+ continue;
22
+ }
23
+ const key = keys[frame.idx++];
24
+ const val = src[key];
25
+ const t = typeof val;
26
+ if (val === null || t === 'string' || t === 'number' || t === 'boolean') {
27
+ dst[key] = val;
28
+ continue;
29
+ }
30
+ if (t === 'function' || t === 'symbol')
31
+ throw new AxiomInvariantError('internal-utils', 'deepClonePlain: unsupported type encountered');
32
+ if (Array.isArray(val)) {
33
+ if (seen.has(val))
34
+ throw new AxiomInvariantError('internal-utils', 'deepClonePlain: circular reference detected');
35
+ const arrClone = [];
36
+ dst[key] = arrClone;
37
+ seen.set(val, arrClone);
38
+ const arrKeys = Array.from({ length: val.length }, (_, i) => String(i));
39
+ stack.push({ src: val, dst: arrClone, keys: arrKeys, idx: 0 });
40
+ continue;
41
+ }
42
+ if (t === 'object') {
43
+ const proto = Object.getPrototypeOf(val);
44
+ if (proto !== Object.prototype && proto !== null)
45
+ throw new AxiomInvariantError('internal-utils', 'deepClonePlain: unsupported non-plain object');
46
+ if (seen.has(val))
47
+ throw new AxiomInvariantError('internal-utils', 'deepClonePlain: circular reference detected');
48
+ const objClone = {};
49
+ dst[key] = objClone;
50
+ seen.set(val, objClone);
51
+ stack.push({ src: val, dst: objClone, keys: Object.keys(val), idx: 0 });
52
+ continue;
53
+ }
54
+ throw new AxiomInvariantError('internal-utils', 'deepClonePlain: unsupported value type');
55
+ }
56
+ return rootClone;
57
+ }
58
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;A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gBAAgB,EAAE,8CAA8C,CAAC,CAAC;YAClJ,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,MAAM,IAAI,mBAAmB,CAAC,gBAAgB,EAAE,6CAA6C,CAAC,CAAC;YAClH,MAAM,QAAQ,GAAQ,EAAE,CAAC;YACzB,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;YACpB,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;YACxE,SAAS;QACX,CAAC;QAED,MAAM,IAAI,mBAAmB,CAAC,gBAAgB,EAAE,wCAAwC,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO,SAAc,CAAC;AACxB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@axiom-core/internal-utils",
3
+ "version": "0.1.0",
4
+ "description": "Axiom Core — shared internal utilities",
5
+ "private": false,
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "sideEffects": false,
21
+ "license": "MIT",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/Haneefe/Axiom-Core.git"
25
+ },
26
+ "homepage": "https://github.com/Haneefe/Axiom-Core",
27
+ "bugs": {
28
+ "url": "https://github.com/Haneefe/Axiom-Core/issues"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ }
33
+ }