@emdzej/ediabasx-core 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.
package/LICENSE ADDED
@@ -0,0 +1,131 @@
1
+ # PolyForm Noncommercial License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
4
+
5
+ ## Acceptance
6
+
7
+ In order to get any license under these terms, you must agree
8
+ to them as both strict obligations and conditions to all
9
+ your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the
14
+ software to do everything you might do with the software
15
+ that would otherwise infringe the licensor's copyright
16
+ in it for any permitted purpose. However, you may
17
+ only distribute the software according to [Distribution
18
+ License](#distribution-license) and make changes or new works
19
+ based on the software according to [Changes and New Works
20
+ License](#changes-and-new-works-license).
21
+
22
+ ## Distribution License
23
+
24
+ The licensor grants you an additional copyright license
25
+ to distribute copies of the software. Your license
26
+ to distribute covers distributing the software with
27
+ changes and new works permitted by [Changes and New Works
28
+ License](#changes-and-new-works-license).
29
+
30
+ ## Notices
31
+
32
+ You must ensure that anyone who gets a copy of any part of
33
+ the software from you also gets a copy of these terms or the
34
+ URL for them above, as well as copies of any plain-text lines
35
+ beginning with `Required Notice:` that the licensor provided
36
+ with the software. For example:
37
+
38
+ > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
39
+
40
+ ## Changes and New Works License
41
+
42
+ The licensor grants you an additional copyright license to
43
+ make changes and new works based on the software for any
44
+ permitted purpose.
45
+
46
+ ## Patent License
47
+
48
+ The licensor grants you a patent license for the software that
49
+ covers patent claims the licensor can license, or becomes able
50
+ to license, that you would infringe by using the software.
51
+
52
+ ## Noncommercial Purposes
53
+
54
+ Any noncommercial purpose is a permitted purpose.
55
+
56
+ ## Personal Uses
57
+
58
+ Personal use for research, experiment, and testing for
59
+ the benefit of public knowledge, personal study, private
60
+ entertainment, hobby projects, amateur pursuits, or religious
61
+ observance, without any anticipated commercial application,
62
+ is use for a permitted purpose.
63
+
64
+ ## Noncommercial Organizations
65
+
66
+ Use by any charitable organization, educational institution,
67
+ public research organization, public safety or health
68
+ organization, environmental protection organization,
69
+ or government institution is use for a permitted purpose
70
+ regardless of the source of funding or obligations resulting
71
+ from the funding.
72
+
73
+ ## Fair Use
74
+
75
+ You may have "fair use" rights for the software under the
76
+ law. These terms do not limit them.
77
+
78
+ ## No Other Rights
79
+
80
+ These terms do not allow you to sublicense or transfer any of
81
+ your licenses to anyone else, or prevent the licensor from
82
+ granting licenses to anyone else. These terms do not imply
83
+ any other licenses.
84
+
85
+ ## Patent Defense
86
+
87
+ If you make any written claim that the software infringes or
88
+ contributes to infringement of any patent, your patent license
89
+ for the software granted under these terms ends immediately. If
90
+ your company makes such a claim, your patent license ends
91
+ immediately for work on behalf of your company.
92
+
93
+ ## Violations
94
+
95
+ The first time you are notified in writing that you have
96
+ violated any of these terms, or done anything with the software
97
+ not covered by your licenses, your licenses can nonetheless
98
+ continue if you come into full compliance with these terms,
99
+ and take practical steps to correct past violations, within
100
+ 32 days of receiving notice. Otherwise, all your licenses
101
+ end immediately.
102
+
103
+ ## No Liability
104
+
105
+ ***As far as the law allows, the software comes as is, without
106
+ any warranty or condition, and the licensor will not be liable
107
+ to you for any damages arising out of these terms or the use
108
+ or nature of the software, under any kind of legal claim.***
109
+
110
+ ## Definitions
111
+
112
+ The **licensor** is the individual or entity offering these
113
+ terms, and the **software** is the software the licensor makes
114
+ available under these terms.
115
+
116
+ **You** refers to the individual or entity agreeing to these
117
+ terms.
118
+
119
+ **Your company** is any legal entity, sole proprietorship,
120
+ or other kind of organization that you work for, plus all
121
+ organizations that have control over, are under the control of,
122
+ or are under common control with that organization. **Control**
123
+ means ownership of substantially all the assets of an entity,
124
+ or the power to direct its management and policies by vote,
125
+ contract, or otherwise. Control can be direct or indirect.
126
+
127
+ **Your licenses** are all the licenses granted to you for the
128
+ software under these terms.
129
+
130
+ **Use** means anything you do with the software requiring one
131
+ of your licenses.
package/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # @emdzej/ediabasx-core
2
+
3
+ Shared primitives used across the [EdiabasX](https://github.com/emdzej/ediabasx) monorepo. No external dependencies.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @emdzej/ediabasx-core
9
+ ```
10
+
11
+ ## What's in here
12
+
13
+ | Export | Purpose |
14
+ |---|---|
15
+ | `cp1252ToUtf8(bytes)` / `utf8ToCp1252(str)` | Round-trip BMW's Windows-1252 strings to/from JS strings |
16
+ | `xorDecrypt(bytes, key)` / `xorEncrypt(bytes, key)` | PRG/GRP payload de/encryption (BEST2 uses key `0xF7`) |
17
+ | `EdiabasError`, `EdiabasErrorCodes` | Typed errors mirroring the C# `ErrorCodes` enum (`EDIABAS_IFH_*`, `EDIABAS_BIP_*`, `EDIABAS_SYS_*`, …) |
18
+ | Constants & type definitions | Stable shapes shared by parser, interpreter, transports |
19
+
20
+ ## Example
21
+
22
+ ```ts
23
+ import { cp1252ToUtf8, xorDecrypt, EdiabasError, EdiabasErrorCodes } from "@emdzej/ediabasx-core";
24
+
25
+ // Decode the encoded section of a PRG/GRP file (everything past 0xA0).
26
+ const decoded = xorDecrypt(encoded, new Uint8Array([0xf7]));
27
+
28
+ // Decode a CP1252 byte string (e.g. job comment, table cell).
29
+ const text = cp1252ToUtf8(decoded.subarray(0, 64));
30
+
31
+ throw new EdiabasError(EdiabasErrorCodes.EDIABAS_BIP_0001, "array overflow");
32
+ ```
33
+
34
+ ## License
35
+
36
+ [PolyForm Noncommercial 1.0.0](../../LICENSE).
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=crypto.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.spec.d.ts","sourceRoot":"","sources":["../../src/__tests__/crypto.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const crypto_1 = require("../crypto");
5
+ (0, vitest_1.describe)("xor crypto", () => {
6
+ (0, vitest_1.it)("encrypts and decrypts with a cyclic key", () => {
7
+ const data = Uint8Array.from([0xde, 0xad, 0xbe, 0xef, 0x01, 0x02]);
8
+ const key = Uint8Array.from([0xaa, 0xbb]);
9
+ const encrypted = (0, crypto_1.xorEncrypt)(data, key);
10
+ const decrypted = (0, crypto_1.xorDecrypt)(encrypted, key);
11
+ (0, vitest_1.expect)(Array.from(decrypted)).toEqual(Array.from(data));
12
+ (0, vitest_1.expect)(Array.from(encrypted)).toEqual([
13
+ 0xde ^ 0xaa,
14
+ 0xad ^ 0xbb,
15
+ 0xbe ^ 0xaa,
16
+ 0xef ^ 0xbb,
17
+ 0x01 ^ 0xaa,
18
+ 0x02 ^ 0xbb,
19
+ ]);
20
+ });
21
+ });
22
+ //# sourceMappingURL=crypto.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.spec.js","sourceRoot":"","sources":["../../src/__tests__/crypto.spec.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,sCAAmD;AAEnD,IAAA,iBAAQ,EAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,IAAA,WAAE,EAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QACnE,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAE1C,MAAM,SAAS,GAAG,IAAA,mBAAU,EAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACxC,MAAM,SAAS,GAAG,IAAA,mBAAU,EAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAE7C,IAAA,eAAM,EAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACxD,IAAA,eAAM,EAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;YACpC,IAAI,GAAG,IAAI;YACX,IAAI,GAAG,IAAI;YACX,IAAI,GAAG,IAAI;YACX,IAAI,GAAG,IAAI;YACX,IAAI,GAAG,IAAI;YACX,IAAI,GAAG,IAAI;SACZ,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=encoding.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoding.spec.d.ts","sourceRoot":"","sources":["../../src/__tests__/encoding.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const encoding_1 = require("../encoding");
5
+ (0, vitest_1.describe)("cp1252 encoding", () => {
6
+ (0, vitest_1.it)("decodes cp1252 bytes to utf8", () => {
7
+ const bytes = Uint8Array.from([0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x80, 0x20, 0x9f]);
8
+ (0, vitest_1.expect)((0, encoding_1.cp1252ToUtf8)(bytes)).toBe("Hello € Ÿ");
9
+ });
10
+ (0, vitest_1.it)("encodes utf8 to cp1252", () => {
11
+ const encoded = (0, encoding_1.utf8ToCp1252)("Price: €");
12
+ (0, vitest_1.expect)(Array.from(encoded)).toEqual([0x50, 0x72, 0x69, 0x63, 0x65, 0x3a, 0x20, 0x80]);
13
+ });
14
+ (0, vitest_1.it)("falls back for non-cp1252 polish characters", () => {
15
+ const encoded = (0, encoding_1.utf8ToCp1252)("Zażółć");
16
+ const decoded = (0, encoding_1.cp1252ToUtf8)(encoded);
17
+ (0, vitest_1.expect)(decoded).toBe("Za?ó??");
18
+ });
19
+ });
20
+ //# sourceMappingURL=encoding.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoding.spec.js","sourceRoot":"","sources":["../../src/__tests__/encoding.spec.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,0CAAyD;AAEzD,IAAA,iBAAQ,EAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAA,WAAE,EAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QACtF,IAAA,eAAM,EAAC,IAAA,uBAAY,EAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,wBAAwB,EAAE,GAAG,EAAE;QAChC,MAAM,OAAO,GAAG,IAAA,uBAAY,EAAC,UAAU,CAAC,CAAC;QACzC,IAAA,eAAM,EAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IACxF,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,OAAO,GAAG,IAAA,uBAAY,EAAC,QAAQ,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG,IAAA,uBAAY,EAAC,OAAO,CAAC,CAAC;QACtC,IAAA,eAAM,EAAC,OAAO,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,59 @@
1
+ export declare const BestOpcodes: {
2
+ readonly NOP: 0;
3
+ readonly PUSH_CONST: 1;
4
+ readonly PUSH_VAR: 2;
5
+ readonly POP: 3;
6
+ readonly ADD: 4;
7
+ readonly SUB: 5;
8
+ readonly MUL: 6;
9
+ readonly DIV: 7;
10
+ readonly MOD: 8;
11
+ readonly AND: 9;
12
+ readonly OR: 10;
13
+ readonly XOR: 11;
14
+ readonly NOT: 12;
15
+ readonly JUMP: 13;
16
+ readonly JUMP_IF_ZERO: 14;
17
+ readonly CALL: 15;
18
+ readonly RETURN: 16;
19
+ };
20
+ export type BestOpcode = (typeof BestOpcodes)[keyof typeof BestOpcodes];
21
+ export declare const BestDataTypeIds: {
22
+ readonly STRING: 1;
23
+ readonly INT: 2;
24
+ readonly LONG: 3;
25
+ readonly FLOAT: 4;
26
+ readonly DOUBLE: 5;
27
+ readonly BINARY: 6;
28
+ };
29
+ export type BestDataTypeId = (typeof BestDataTypeIds)[keyof typeof BestDataTypeIds];
30
+ export declare const IfhErrorCodes: {
31
+ readonly OK: 0;
32
+ readonly TIMEOUT: 1;
33
+ readonly INVALID_RESPONSE: 2;
34
+ readonly NOT_SUPPORTED: 3;
35
+ };
36
+ export type IfhErrorCode = (typeof IfhErrorCodes)[keyof typeof IfhErrorCodes];
37
+ export declare const BipErrorCodes: {
38
+ readonly OK: 0;
39
+ readonly INVALID_OPCODE: 1000;
40
+ readonly STACK_UNDERFLOW: 1001;
41
+ readonly STACK_OVERFLOW: 1002;
42
+ readonly DIVISION_BY_ZERO: 1003;
43
+ };
44
+ export type BipErrorCode = (typeof BipErrorCodes)[keyof typeof BipErrorCodes];
45
+ export declare const SysErrorCodes: {
46
+ readonly OK: 0;
47
+ readonly FILE_NOT_FOUND: 2000;
48
+ readonly IO_ERROR: 2001;
49
+ readonly PERMISSION_DENIED: 2002;
50
+ };
51
+ export type SysErrorCode = (typeof SysErrorCodes)[keyof typeof SysErrorCodes];
52
+ export declare const ApiErrorCodes: {
53
+ readonly OK: 0;
54
+ readonly NOT_INITIALIZED: 3000;
55
+ readonly INVALID_ARGUMENT: 3001;
56
+ readonly BUSY: 3002;
57
+ };
58
+ export type ApiErrorCode = (typeof ApiErrorCodes)[keyof typeof ApiErrorCodes];
59
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;CAkBd,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAGxE,eAAO,MAAM,eAAe;;;;;;;CAOlB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAGpF,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAG9E,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAG9E,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAG9E,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiErrorCodes = exports.SysErrorCodes = exports.BipErrorCodes = exports.IfhErrorCodes = exports.BestDataTypeIds = exports.BestOpcodes = void 0;
4
+ // BEST opcodes
5
+ exports.BestOpcodes = {
6
+ NOP: 0x00,
7
+ PUSH_CONST: 0x01,
8
+ PUSH_VAR: 0x02,
9
+ POP: 0x03,
10
+ ADD: 0x04,
11
+ SUB: 0x05,
12
+ MUL: 0x06,
13
+ DIV: 0x07,
14
+ MOD: 0x08,
15
+ AND: 0x09,
16
+ OR: 0x0a,
17
+ XOR: 0x0b,
18
+ NOT: 0x0c,
19
+ JUMP: 0x0d,
20
+ JUMP_IF_ZERO: 0x0e,
21
+ CALL: 0x0f,
22
+ RETURN: 0x10,
23
+ };
24
+ // BEST data types (numeric IDs for binary format)
25
+ exports.BestDataTypeIds = {
26
+ STRING: 0x01,
27
+ INT: 0x02,
28
+ LONG: 0x03,
29
+ FLOAT: 0x04,
30
+ DOUBLE: 0x05,
31
+ BINARY: 0x06,
32
+ };
33
+ // IFH (Interface Handler) error codes
34
+ exports.IfhErrorCodes = {
35
+ OK: 0,
36
+ TIMEOUT: 1,
37
+ INVALID_RESPONSE: 2,
38
+ NOT_SUPPORTED: 3,
39
+ };
40
+ // BIP (BEST Interpreter) error codes
41
+ exports.BipErrorCodes = {
42
+ OK: 0,
43
+ INVALID_OPCODE: 1000,
44
+ STACK_UNDERFLOW: 1001,
45
+ STACK_OVERFLOW: 1002,
46
+ DIVISION_BY_ZERO: 1003,
47
+ };
48
+ // System error codes
49
+ exports.SysErrorCodes = {
50
+ OK: 0,
51
+ FILE_NOT_FOUND: 2000,
52
+ IO_ERROR: 2001,
53
+ PERMISSION_DENIED: 2002,
54
+ };
55
+ // API error codes
56
+ exports.ApiErrorCodes = {
57
+ OK: 0,
58
+ NOT_INITIALIZED: 3000,
59
+ INVALID_ARGUMENT: 3001,
60
+ BUSY: 3002,
61
+ };
62
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA,eAAe;AACF,QAAA,WAAW,GAAG;IACzB,GAAG,EAAE,IAAI;IACT,UAAU,EAAE,IA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int8Array;
2
+ export declare function xorEncrypt(data: Uint8Array, key: Uint8Array): Uint8Array;
3
+ //# sourceMappingURL=crypto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAaA,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,UAAU,CAExE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,UAAU,CAExE"}
package/dist/crypto.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.xorDecrypt = xorDecrypt;
4
+ exports.xorEncrypt = xorEncrypt;
5
+ function xorTransform(data, key) {
6
+ if (key.length === 0) {
7
+ throw new Error("XOR key must not be empty.");
8
+ }
9
+ const result = new Uint8Array(data.length);
10
+ for (let index = 0; index < data.length; index += 1) {
11
+ result[index] = data[index] ^ key[index % key.length];
12
+ }
13
+ return result;
14
+ }
15
+ function xorDecrypt(data, key) {
16
+ return xorTransform(data, key);
17
+ }
18
+ function xorEncrypt(data, key) {
19
+ return xorTransform(data, key);
20
+ }
21
+ //# sourceMappingURL=crypto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":";;AAaA,gCAEC;AAED,gCAEC;AAnBD,SAAS,YAAY,CAAC,IAAgB,EAAE,GAAe;IACrD,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACpD,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,UAAU,CAAC,IAAgB,EAAE,GAAe;IAC1D,OAAO,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC;AAED,SAAgB,UAAU,CAAC,IAAgB,EAAE,GAAe;IAC1D,OAAO,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Windows CP1252 codec.
3
+ *
4
+ * Browser-safe — uses `TextDecoder("windows-1252")` for decode (part of the
5
+ * WHATWG Encoding standard, present in every browser and in Node ≥ 11) and
6
+ * derives the encode table from that same decoder so the mapping in both
7
+ * directions comes from one source of truth.
8
+ *
9
+ * `TextEncoder` is UTF-8 only by spec, so there's no symmetric encode path —
10
+ * we build the byte→char map from the decoder once, then invert it. Code
11
+ * points outside CP1252's repertoire encode as `?` (0x3F), matching the
12
+ * historical EDIABAS convention and the `iconv-lite` behaviour this used to
13
+ * delegate to.
14
+ */
15
+ /**
16
+ * Convert CP1252-encoded bytes to a JS string.
17
+ */
18
+ export declare function cp1252ToUtf8(bytes: Uint8Array): string;
19
+ /**
20
+ * Convert a JS string to a CP1252-encoded byte array.
21
+ *
22
+ * Code points outside CP1252's repertoire (including surrogate pairs / any
23
+ * char above U+FFFF) are replaced with `?` (0x3F).
24
+ */
25
+ export declare function utf8ToCp1252(str: string): Uint8Array;
26
+ //# sourceMappingURL=encoding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA4CH;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAYpD"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ /**
3
+ * Windows CP1252 codec.
4
+ *
5
+ * Browser-safe — uses `TextDecoder("windows-1252")` for decode (part of the
6
+ * WHATWG Encoding standard, present in every browser and in Node ≥ 11) and
7
+ * derives the encode table from that same decoder so the mapping in both
8
+ * directions comes from one source of truth.
9
+ *
10
+ * `TextEncoder` is UTF-8 only by spec, so there's no symmetric encode path —
11
+ * we build the byte→char map from the decoder once, then invert it. Code
12
+ * points outside CP1252's repertoire encode as `?` (0x3F), matching the
13
+ * historical EDIABAS convention and the `iconv-lite` behaviour this used to
14
+ * delegate to.
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.cp1252ToUtf8 = cp1252ToUtf8;
18
+ exports.utf8ToCp1252 = utf8ToCp1252;
19
+ const FALLBACK_BYTE = 0x3f; // '?'
20
+ // Lazy singleton — TextDecoder construction allocates a small object, no
21
+ // point doing it per call (`cp1252ToUtf8` is hot in the BEST2 parser).
22
+ let decoder = null;
23
+ function getDecoder() {
24
+ if (!decoder)
25
+ decoder = new TextDecoder("windows-1252");
26
+ return decoder;
27
+ }
28
+ let encodeTable = null;
29
+ /**
30
+ * Build (and memoise) the encode table by asking the decoder what every
31
+ * byte in 0x00–0xFF maps to. CP1252 is a single-byte codepage, so the
32
+ * result is a code-point → byte map with 256 entries (a handful collapse
33
+ * because the codepage has five undefined slots that the decoder maps to
34
+ * the same Unicode "private use" char).
35
+ */
36
+ function getEncodeTable() {
37
+ if (encodeTable)
38
+ return encodeTable;
39
+ const dec = getDecoder();
40
+ const table = new Map();
41
+ const singleByte = new Uint8Array(1);
42
+ for (let b = 0; b < 256; b++) {
43
+ singleByte[0] = b;
44
+ const decoded = dec.decode(singleByte);
45
+ if (decoded.length === 1) {
46
+ const cp = decoded.charCodeAt(0);
47
+ // CP1252's "undefined" slots (0x81, 0x8D, 0x8F, 0x90, 0x9D) all decode
48
+ // to control chars in the same code-point range as the byte itself —
49
+ // skip them so an attempt to encode e.g. U+0081 round-trips as the
50
+ // fallback rather than producing the undefined byte.
51
+ if ((b >= 0x80 && b <= 0x9f) && cp === b)
52
+ continue;
53
+ table.set(cp, b);
54
+ }
55
+ }
56
+ encodeTable = table;
57
+ return table;
58
+ }
59
+ /**
60
+ * Convert CP1252-encoded bytes to a JS string.
61
+ */
62
+ function cp1252ToUtf8(bytes) {
63
+ return getDecoder().decode(bytes);
64
+ }
65
+ /**
66
+ * Convert a JS string to a CP1252-encoded byte array.
67
+ *
68
+ * Code points outside CP1252's repertoire (including surrogate pairs / any
69
+ * char above U+FFFF) are replaced with `?` (0x3F).
70
+ */
71
+ function utf8ToCp1252(str) {
72
+ const table = getEncodeTable();
73
+ // Pre-size: CP1252 is single-byte, so output length == code-point count.
74
+ // `string.length` counts UTF-16 code units (a surrogate pair contributes
75
+ // one fallback byte); worst case bound = str.length and we trim after.
76
+ const out = new Uint8Array(str.length);
77
+ let i = 0;
78
+ for (const ch of str) {
79
+ const cp = ch.codePointAt(0);
80
+ out[i++] = table.get(cp) ?? FALLBACK_BYTE;
81
+ }
82
+ return i === out.length ? out : out.subarray(0, i);
83
+ }
84
+ //# sourceMappingURL=encoding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoding.js","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AA+CH,oCAEC;AAQD,oCAYC;AAnED,MAAM,aAAa,GAAG,IAAI,CAAC,CAAC,MAAM;AAElC,yEAAyE;AACzE,uEAAuE;AACvE,IAAI,OAAO,GAAuB,IAAI,CAAC;AAEvC,SAAS,UAAU;IACjB,IAAI,CAAC,OAAO;QAAE,OAAO,GAAG,IAAI,WAAW,CAAC,cAAc,CAAC,CAAC;IACxD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,IA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GAAG,CAAC,CAAC;IACV,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,MAAM,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,CAAE,CAAC;QAC9B,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,aAAa,CAAC;IAC5C,CAAC;IACD,OAAO,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * EDIABAS Error Base Class
3
+ *
4
+ * Base error class for all EDIABAS-related errors.
5
+ * Provides error codes and structured error information.
6
+ */
7
+ /**
8
+ * Error codes for EDIABAS errors.
9
+ */
10
+ export declare const EdiabasErrorCodes: {
11
+ /** Generic/unknown error */
12
+ readonly UNKNOWN: 0;
13
+ /** Stack overflow (too many nested calls) */
14
+ readonly STACK_OVERFLOW: 1;
15
+ /** Stack underflow (return without call) */
16
+ readonly STACK_UNDERFLOW: 2;
17
+ /** Invalid instruction or opcode */
18
+ readonly INVALID_INSTRUCTION: 3;
19
+ /** Register access error */
20
+ readonly REGISTER_ERROR: 4;
21
+ /** Memory access error */
22
+ readonly MEMORY_ERROR: 5;
23
+ readonly EDIABAS_BIP_0000: 60;
24
+ readonly EDIABAS_BIP_0001: 61;
25
+ readonly EDIABAS_BIP_0002: 62;
26
+ readonly EDIABAS_BIP_0003: 63;
27
+ readonly EDIABAS_BIP_0004: 64;
28
+ readonly EDIABAS_BIP_0005: 65;
29
+ readonly EDIABAS_BIP_0006: 66;
30
+ readonly EDIABAS_BIP_0007: 67;
31
+ readonly EDIABAS_BIP_0008: 68;
32
+ readonly EDIABAS_BIP_0009: 69;
33
+ readonly EDIABAS_BIP_0010: 70;
34
+ readonly EDIABAS_BIP_0011: 71;
35
+ readonly EDIABAS_BIP_0012: 72;
36
+ readonly EDIABAS_BIP_0013: 73;
37
+ readonly EDIABAS_BIP_0014: 74;
38
+ readonly EDIABAS_BIP_0015: 75;
39
+ readonly EDIABAS_BIP_0016: 76;
40
+ readonly EDIABAS_BIP_0017: 77;
41
+ readonly EDIABAS_BIP_0018: 78;
42
+ readonly EDIABAS_BIP_0019: 79;
43
+ readonly EDIABAS_BIP_0020: 80;
44
+ readonly EDIABAS_BIP_0021: 81;
45
+ readonly EDIABAS_BIP_0022: 82;
46
+ readonly EDIABAS_BIP_0023: 83;
47
+ readonly EDIABAS_BIP_0024: 84;
48
+ readonly EDIABAS_BIP_0025: 85;
49
+ readonly EDIABAS_BIP_0026: 86;
50
+ readonly EDIABAS_BIP_0027: 87;
51
+ readonly EDIABAS_BIP_0028: 88;
52
+ readonly EDIABAS_BIP_0029: 89;
53
+ readonly EDIABAS_IFH_0000: 10;
54
+ readonly EDIABAS_IFH_0001: 11;
55
+ readonly EDIABAS_IFH_0002: 12;
56
+ readonly EDIABAS_IFH_0003: 13;
57
+ readonly EDIABAS_IFH_0004: 14;
58
+ readonly EDIABAS_IFH_0005: 15;
59
+ readonly EDIABAS_IFH_0006: 16;
60
+ readonly EDIABAS_IFH_0007: 17;
61
+ readonly EDIABAS_IFH_0008: 18;
62
+ readonly EDIABAS_IFH_0009: 19;
63
+ readonly EDIABAS_IFH_0010: 20;
64
+ readonly EDIABAS_IFH_0011: 21;
65
+ readonly EDIABAS_IFH_0012: 22;
66
+ readonly EDIABAS_IFH_0013: 23;
67
+ readonly EDIABAS_IFH_0014: 24;
68
+ readonly EDIABAS_IFH_0015: 25;
69
+ readonly EDIABAS_IFH_0016: 26;
70
+ readonly EDIABAS_IFH_0017: 27;
71
+ readonly EDIABAS_IFH_0018: 28;
72
+ readonly EDIABAS_IFH_0019: 29;
73
+ readonly EDIABAS_IFH_0041: 51;
74
+ readonly EDIABAS_IFH_0056: 66;
75
+ readonly EDIABAS_IFH_0069: 219;
76
+ readonly EDIABAS_IFH_0074: 224;
77
+ };
78
+ export type EdiabasErrorCode = (typeof EdiabasErrorCodes)[keyof typeof EdiabasErrorCodes];
79
+ /**
80
+ * Base error class for EDIABAS-related errors.
81
+ *
82
+ * Extends the standard Error class with error codes and structured information.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * throw new EdiabasError(EdiabasErrorCodes.STACK_OVERFLOW, "Call stack exceeded maximum depth of 256");
87
+ * ```
88
+ */
89
+ export declare class EdiabasError extends Error {
90
+ /**
91
+ * The error code identifying the type of error.
92
+ */
93
+ readonly code: EdiabasErrorCode;
94
+ /**
95
+ * Creates a new EdiabasError.
96
+ *
97
+ * @param code - The error code
98
+ * @param message - Human-readable error message
99
+ */
100
+ constructor(code: EdiabasErrorCode, message: string);
101
+ }
102
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;IAC5B,4BAA4B;;IAG5B,6CAA6C;;IAG7C,4CAA4C;;IAG5C,oCAAoC;;IAGpC,4BAA4B;;IAG5B,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DlB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAE1F;;;;;;;;;GASG;AACH,qBAAa,YAAa,SAAQ,KAAK;IACrC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAEhC;;;;;OAKG;gBACS,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM;CAUpD"}
package/dist/errors.js ADDED
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ /**
3
+ * EDIABAS Error Base Class
4
+ *
5
+ * Base error class for all EDIABAS-related errors.
6
+ * Provides error codes and structured error information.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.EdiabasError = exports.EdiabasErrorCodes = void 0;
10
+ /**
11
+ * Error codes for EDIABAS errors.
12
+ */
13
+ exports.EdiabasErrorCodes = {
14
+ /** Generic/unknown error */
15
+ UNKNOWN: 0,
16
+ /** Stack overflow (too many nested calls) */
17
+ STACK_OVERFLOW: 1,
18
+ /** Stack underflow (return without call) */
19
+ STACK_UNDERFLOW: 2,
20
+ /** Invalid instruction or opcode */
21
+ INVALID_INSTRUCTION: 3,
22
+ /** Register access error */
23
+ REGISTER_ERROR: 4,
24
+ /** Memory access error */
25
+ MEMORY_ERROR: 5,
26
+ // --- BIP Error Codes (60-89) ---
27
+ EDIABAS_BIP_0000: 60,
28
+ EDIABAS_BIP_0001: 61,
29
+ EDIABAS_BIP_0002: 62,
30
+ EDIABAS_BIP_0003: 63,
31
+ EDIABAS_BIP_0004: 64,
32
+ EDIABAS_BIP_0005: 65,
33
+ EDIABAS_BIP_0006: 66,
34
+ EDIABAS_BIP_0007: 67,
35
+ EDIABAS_BIP_0008: 68,
36
+ EDIABAS_BIP_0009: 69,
37
+ EDIABAS_BIP_0010: 70,
38
+ EDIABAS_BIP_0011: 71,
39
+ EDIABAS_BIP_0012: 72,
40
+ EDIABAS_BIP_0013: 73,
41
+ EDIABAS_BIP_0014: 74,
42
+ EDIABAS_BIP_0015: 75,
43
+ EDIABAS_BIP_0016: 76,
44
+ EDIABAS_BIP_0017: 77,
45
+ EDIABAS_BIP_0018: 78,
46
+ EDIABAS_BIP_0019: 79,
47
+ EDIABAS_BIP_0020: 80,
48
+ EDIABAS_BIP_0021: 81,
49
+ EDIABAS_BIP_0022: 82,
50
+ EDIABAS_BIP_0023: 83,
51
+ EDIABAS_BIP_0024: 84,
52
+ EDIABAS_BIP_0025: 85,
53
+ EDIABAS_BIP_0026: 86,
54
+ EDIABAS_BIP_0027: 87,
55
+ EDIABAS_BIP_0028: 88,
56
+ EDIABAS_BIP_0029: 89,
57
+ // --- IFH Error Codes (200-249) ---
58
+ EDIABAS_IFH_0000: 10,
59
+ EDIABAS_IFH_0001: 11,
60
+ EDIABAS_IFH_0002: 12,
61
+ EDIABAS_IFH_0003: 13,
62
+ EDIABAS_IFH_0004: 14,
63
+ EDIABAS_IFH_0005: 15,
64
+ EDIABAS_IFH_0006: 16,
65
+ EDIABAS_IFH_0007: 17,
66
+ EDIABAS_IFH_0008: 18,
67
+ EDIABAS_IFH_0009: 19,
68
+ EDIABAS_IFH_0010: 20,
69
+ EDIABAS_IFH_0011: 21,
70
+ EDIABAS_IFH_0012: 22,
71
+ EDIABAS_IFH_0013: 23,
72
+ EDIABAS_IFH_0014: 24,
73
+ EDIABAS_IFH_0015: 25,
74
+ EDIABAS_IFH_0016: 26,
75
+ EDIABAS_IFH_0017: 27,
76
+ EDIABAS_IFH_0018: 28,
77
+ EDIABAS_IFH_0019: 29,
78
+ EDIABAS_IFH_0041: 51,
79
+ EDIABAS_IFH_0056: 66,
80
+ EDIABAS_IFH_0069: 219,
81
+ EDIABAS_IFH_0074: 224,
82
+ };
83
+ /**
84
+ * Base error class for EDIABAS-related errors.
85
+ *
86
+ * Extends the standard Error class with error codes and structured information.
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * throw new EdiabasError(EdiabasErrorCodes.STACK_OVERFLOW, "Call stack exceeded maximum depth of 256");
91
+ * ```
92
+ */
93
+ class EdiabasError extends Error {
94
+ /**
95
+ * The error code identifying the type of error.
96
+ */
97
+ code;
98
+ /**
99
+ * Creates a new EdiabasError.
100
+ *
101
+ * @param code - The error code
102
+ * @param message - Human-readable error message
103
+ */
104
+ constructor(code, message) {
105
+ super(message);
106
+ this.name = "EdiabasError";
107
+ this.code = code;
108
+ // Maintains proper stack trace for where our error was thrown (only available on V8)
109
+ if (Error.captureStackTrace) {
110
+ Error.captureStackTrace(this, EdiabasError);
111
+ }
112
+ }
113
+ }
114
+ exports.EdiabasError = EdiabasError;
115
+ //# sourceM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gB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,GAAG;IACrB,gBAAgB,EAAE,GAAG;CACb,CAAC;AAIX;;;;;;;;;GASG;AACH,MAAa,YAAa,SAAQ,KAAK;IACrC;;OAEG;IACM,IAAI,CAAmB;IAEhC;;;;;OAKG;IACH,YAAY,IAAsB,EAAE,OAAe;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,qFAAqF;QACrF,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;CACF;AAtBD,oCAsBC"}
@@ -0,0 +1,6 @@
1
+ export * from "./types";
2
+ export * from "./encoding";
3
+ export * from "./crypto";
4
+ export * from "./constants";
5
+ export * from "./errors";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
18
+ __exportStar(require("./encoding"), exports);
19
+ __exportStar(require("./crypto"), exports);
20
+ __exportStar(require("./constants"), exports);
21
+ __exportStar(require("./errors"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,6CAA2B;AAC3B,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB"}
@@ -0,0 +1,12 @@
1
+ export type BestDataType = "string" | "int" | "long" | "float" | "double" | "binary";
2
+ export type ResultValue = {
3
+ name: string;
4
+ type: BestDataType;
5
+ value: string | number | Uint8Array;
6
+ };
7
+ export type JobResult = {
8
+ name: string;
9
+ results: ResultValue[];
10
+ error?: string;
11
+ };
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAErF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@emdzej/ediabasx-core",
3
+ "version": "0.1.0",
4
+ "description": "EDIABAS / EdiabasX shared primitives: CP1252 encoding, XOR decryption (key 0xF7), error codes, type definitions.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "devDependencies": {
11
+ "@types/node": "^25.2.0"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/emdzej/ediabasx.git"
19
+ },
20
+ "scripts": {
21
+ "build": "tsc -p tsconfig.json",
22
+ "test": "vitest run --passWithNoTests",
23
+ "lint": "eslint .",
24
+ "typecheck": "tsc --noEmit",
25
+ "dev": "tsc -p tsconfig.json -w --preserveWatchOutput"
26
+ }
27
+ }