@aidc-toolkit/app-extension 1.0.25-beta → 1.0.27-beta
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/index.cjs +146 -117
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +123 -139
- package/dist/index.d.ts +123 -139
- package/dist/index.js +147 -118
- package/dist/index.js.map +1 -1
- package/package.json +14 -9
- package/src/app-extension.ts +30 -21
- package/src/app-utility-proxy.ts +19 -7
- package/src/descriptor.ts +64 -4
- package/src/generator/descriptor.ts +6 -3
- package/src/generator/generator.ts +46 -25
- package/src/generator/index.ts +2 -2
- package/src/generator/locale-resources-generator.ts +35 -35
- package/src/gs1/character-set-proxy.ts +5 -5
- package/src/gs1/check-proxy.ts +3 -3
- package/src/gs1/identifier-proxy.ts +45 -44
- package/src/gs1/index.ts +3 -3
- package/src/index.ts +9 -9
- package/src/lib-proxy.ts +24 -21
- package/src/locale/i18n.ts +3 -3
- package/src/locale/i18next.d.ts +1 -1
- package/src/utility/character-set-descriptor.ts +1 -1
- package/src/utility/character-set-proxy.ts +16 -16
- package/src/utility/index.ts +3 -3
- package/src/utility/reg-exp-proxy.ts +4 -4
- package/src/utility/string-descriptor.ts +1 -1
- package/src/utility/string-proxy.ts +2 -2
- package/src/utility/transformer-descriptor.ts +1 -1
- package/src/utility/transformer-proxy.ts +4 -4
- package/tsconfig-config.json +4 -0
- package/tsconfig-src.json +11 -0
- package/tsconfig.json +9 -4
- package/tsup.config.ts +3 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __typeError = (msg) => {
|
|
4
|
+
throw TypeError(msg);
|
|
5
|
+
};
|
|
3
6
|
var __export = (target, all) => {
|
|
4
7
|
for (var name in all)
|
|
5
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -13,6 +16,9 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
13
16
|
return result;
|
|
14
17
|
};
|
|
15
18
|
var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
19
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
20
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
21
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
16
22
|
|
|
17
23
|
// src/locale/i18n.ts
|
|
18
24
|
import { i18nCoreInit } from "@aidc-toolkit/core";
|
|
@@ -1294,23 +1300,23 @@ var AppExtension = class {
|
|
|
1294
1300
|
/**
|
|
1295
1301
|
* Application version.
|
|
1296
1302
|
*/
|
|
1297
|
-
|
|
1303
|
+
#version;
|
|
1298
1304
|
/**
|
|
1299
1305
|
* Maximum sequence count supported by application.
|
|
1300
1306
|
*/
|
|
1301
|
-
|
|
1307
|
+
#maximumSequenceCount;
|
|
1302
1308
|
/**
|
|
1303
1309
|
* If true, errors are reported through the throw/catch mechanism.
|
|
1304
1310
|
*/
|
|
1305
|
-
|
|
1311
|
+
#throwError;
|
|
1306
1312
|
/**
|
|
1307
1313
|
* Maximum width supported by application.
|
|
1308
1314
|
*/
|
|
1309
|
-
|
|
1315
|
+
#maximumWidth;
|
|
1310
1316
|
/**
|
|
1311
1317
|
* Maximum height supported by application.
|
|
1312
1318
|
*/
|
|
1313
|
-
|
|
1319
|
+
#maximumHeight;
|
|
1314
1320
|
/**
|
|
1315
1321
|
* Constructor.
|
|
1316
1322
|
*
|
|
@@ -1324,9 +1330,9 @@ var AppExtension = class {
|
|
|
1324
1330
|
* If true, errors are reported through the throw/catch mechanism.
|
|
1325
1331
|
*/
|
|
1326
1332
|
constructor(version, maximumSequenceCount, throwError) {
|
|
1327
|
-
this
|
|
1328
|
-
this
|
|
1329
|
-
this
|
|
1333
|
+
this.#version = version;
|
|
1334
|
+
this.#maximumSequenceCount = maximumSequenceCount;
|
|
1335
|
+
this.#throwError = throwError;
|
|
1330
1336
|
}
|
|
1331
1337
|
/**
|
|
1332
1338
|
* Get the version.
|
|
@@ -1335,13 +1341,13 @@ var AppExtension = class {
|
|
|
1335
1341
|
* Version.
|
|
1336
1342
|
*/
|
|
1337
1343
|
get version() {
|
|
1338
|
-
return this
|
|
1344
|
+
return this.#version;
|
|
1339
1345
|
}
|
|
1340
1346
|
/**
|
|
1341
1347
|
* Determine if errors are reported through the throw/catch mechanism.
|
|
1342
1348
|
*/
|
|
1343
1349
|
get throwError() {
|
|
1344
|
-
return this
|
|
1350
|
+
return this.#throwError;
|
|
1345
1351
|
}
|
|
1346
1352
|
/**
|
|
1347
1353
|
* Get the maximum width supported by the application.
|
|
@@ -1350,8 +1356,8 @@ var AppExtension = class {
|
|
|
1350
1356
|
* Maximum width supported by the application.
|
|
1351
1357
|
*/
|
|
1352
1358
|
async maximumWidth() {
|
|
1353
|
-
this
|
|
1354
|
-
return this
|
|
1359
|
+
this.#maximumWidth ??= await this.getMaximumWidth();
|
|
1360
|
+
return this.#maximumWidth;
|
|
1355
1361
|
}
|
|
1356
1362
|
/**
|
|
1357
1363
|
* Get the maximum height supported by the application.
|
|
@@ -1360,8 +1366,8 @@ var AppExtension = class {
|
|
|
1360
1366
|
* Maximum height supported by the application.
|
|
1361
1367
|
*/
|
|
1362
1368
|
async maximumHeight() {
|
|
1363
|
-
this
|
|
1364
|
-
return this
|
|
1369
|
+
this.#maximumHeight ??= await this.getMaximumHeight();
|
|
1370
|
+
return this.#maximumHeight;
|
|
1365
1371
|
}
|
|
1366
1372
|
/**
|
|
1367
1373
|
* Validate a sequence count against the maximum supported by application.
|
|
@@ -1371,16 +1377,19 @@ var AppExtension = class {
|
|
|
1371
1377
|
*/
|
|
1372
1378
|
validateSequenceCount(sequenceCount) {
|
|
1373
1379
|
const absoluteSequenceCount = Math.abs(sequenceCount);
|
|
1374
|
-
if (absoluteSequenceCount > this
|
|
1380
|
+
if (absoluteSequenceCount > this.#maximumSequenceCount) {
|
|
1375
1381
|
throw new RangeError(i18nextAppExtension.t("AppExtension.sequenceCountMustBeLessThanOrEqualTo", {
|
|
1376
1382
|
sequenceCount: absoluteSequenceCount,
|
|
1377
|
-
maximumSequenceCount: this
|
|
1383
|
+
maximumSequenceCount: this.#maximumSequenceCount
|
|
1378
1384
|
}));
|
|
1379
1385
|
}
|
|
1380
1386
|
}
|
|
1381
1387
|
/**
|
|
1382
1388
|
* Bind a synchronous method and wrap it in a try/catch for comprehensive error handling.
|
|
1383
1389
|
*
|
|
1390
|
+
* @template TMethod
|
|
1391
|
+
* Method type.
|
|
1392
|
+
*
|
|
1384
1393
|
* @param thisArg
|
|
1385
1394
|
* The value to be passed as the `this` parameter to the method.
|
|
1386
1395
|
*
|
|
@@ -1404,6 +1413,9 @@ var AppExtension = class {
|
|
|
1404
1413
|
/**
|
|
1405
1414
|
* Bind an asynchronous method and wrap it in a try/catch for comprehensive error handling.
|
|
1406
1415
|
*
|
|
1416
|
+
* @template TMethod
|
|
1417
|
+
* Method type.
|
|
1418
|
+
*
|
|
1407
1419
|
* @param thisArg
|
|
1408
1420
|
* The value to be passed as the `this` parameter to the method.
|
|
1409
1421
|
*
|
|
@@ -1428,7 +1440,7 @@ var LibProxy = class {
|
|
|
1428
1440
|
/**
|
|
1429
1441
|
* Application extension.
|
|
1430
1442
|
*/
|
|
1431
|
-
|
|
1443
|
+
#appExtension;
|
|
1432
1444
|
/**
|
|
1433
1445
|
* Constructor.
|
|
1434
1446
|
*
|
|
@@ -1436,13 +1448,13 @@ var LibProxy = class {
|
|
|
1436
1448
|
* Application extension.
|
|
1437
1449
|
*/
|
|
1438
1450
|
constructor(appExtension) {
|
|
1439
|
-
this
|
|
1451
|
+
this.#appExtension = appExtension;
|
|
1440
1452
|
}
|
|
1441
1453
|
/**
|
|
1442
1454
|
* Get the application extension.
|
|
1443
1455
|
*/
|
|
1444
1456
|
get appExtension() {
|
|
1445
|
-
return this
|
|
1457
|
+
return this.#appExtension;
|
|
1446
1458
|
}
|
|
1447
1459
|
/**
|
|
1448
1460
|
* Map big integer to another type if necessary.
|
|
@@ -1454,7 +1466,7 @@ var LibProxy = class {
|
|
|
1454
1466
|
* Mapped big integer value.
|
|
1455
1467
|
*/
|
|
1456
1468
|
mapBigInt(value) {
|
|
1457
|
-
return this.
|
|
1469
|
+
return this.#appExtension.mapBigInt(value);
|
|
1458
1470
|
}
|
|
1459
1471
|
/**
|
|
1460
1472
|
* Handle an error thrown by a function call.
|
|
@@ -1465,11 +1477,11 @@ var LibProxy = class {
|
|
|
1465
1477
|
* @returns
|
|
1466
1478
|
* Error if errors are not thrown.
|
|
1467
1479
|
*/
|
|
1468
|
-
handleError(e) {
|
|
1480
|
+
#handleError(e) {
|
|
1469
1481
|
let result;
|
|
1470
1482
|
if (e instanceof RangeError) {
|
|
1471
|
-
const error = this.
|
|
1472
|
-
if (this.
|
|
1483
|
+
const error = this.#appExtension.mapRangeError(e);
|
|
1484
|
+
if (this.#appExtension.throwError) {
|
|
1473
1485
|
throw error;
|
|
1474
1486
|
}
|
|
1475
1487
|
result = error;
|
|
@@ -1490,12 +1502,12 @@ var LibProxy = class {
|
|
|
1490
1502
|
* @returns
|
|
1491
1503
|
* Callback result or error if errors are not thrown.
|
|
1492
1504
|
*/
|
|
1493
|
-
doCallback(value, callback) {
|
|
1505
|
+
#doCallback(value, callback) {
|
|
1494
1506
|
let result;
|
|
1495
1507
|
try {
|
|
1496
1508
|
result = callback(value);
|
|
1497
1509
|
} catch (e) {
|
|
1498
|
-
result = this
|
|
1510
|
+
result = this.#handleError(e);
|
|
1499
1511
|
}
|
|
1500
1512
|
return result;
|
|
1501
1513
|
}
|
|
@@ -1512,7 +1524,7 @@ var LibProxy = class {
|
|
|
1512
1524
|
* Matrix of callback results and errors if errors are not thrown.
|
|
1513
1525
|
*/
|
|
1514
1526
|
mapMatrix(matrixValues, callback) {
|
|
1515
|
-
return matrixValues.map((rowValues) => rowValues.map((value) => this
|
|
1527
|
+
return matrixValues.map((rowValues) => rowValues.map((value) => this.#doCallback(value, callback)));
|
|
1516
1528
|
}
|
|
1517
1529
|
/**
|
|
1518
1530
|
* Do the callback for an array return.
|
|
@@ -1526,8 +1538,8 @@ var LibProxy = class {
|
|
|
1526
1538
|
* @returns
|
|
1527
1539
|
* Callback result or error as array if errors are not thrown.
|
|
1528
1540
|
*/
|
|
1529
|
-
doArrayCallback(value, callback) {
|
|
1530
|
-
const result = this
|
|
1541
|
+
#doArrayCallback(value, callback) {
|
|
1542
|
+
const result = this.#doCallback(value, callback);
|
|
1531
1543
|
return result instanceof Array ? result : [result];
|
|
1532
1544
|
}
|
|
1533
1545
|
/**
|
|
@@ -1549,7 +1561,7 @@ var LibProxy = class {
|
|
|
1549
1561
|
} else if (matrixValues.length === 1) {
|
|
1550
1562
|
matrixResultError = [];
|
|
1551
1563
|
matrixValues[0].forEach((value, columnIndex) => {
|
|
1552
|
-
const arrayResultError = this
|
|
1564
|
+
const arrayResultError = this.#doArrayCallback(value, callback);
|
|
1553
1565
|
arrayResultError.forEach((resultError, rowIndex) => {
|
|
1554
1566
|
if (matrixResultError.length <= rowIndex) {
|
|
1555
1567
|
matrixResultError.push([]);
|
|
@@ -1563,9 +1575,9 @@ var LibProxy = class {
|
|
|
1563
1575
|
if (rowValue.length === 0) {
|
|
1564
1576
|
arrayResultError = [];
|
|
1565
1577
|
} else if (rowValue.length === 1) {
|
|
1566
|
-
arrayResultError = this
|
|
1578
|
+
arrayResultError = this.#doArrayCallback(rowValue[0], callback);
|
|
1567
1579
|
} else {
|
|
1568
|
-
arrayResultError = [this
|
|
1580
|
+
arrayResultError = [this.#handleError(new RangeError(i18nextAppExtension.t("Proxy.matrixMustBeArray")))];
|
|
1569
1581
|
}
|
|
1570
1582
|
return arrayResultError;
|
|
1571
1583
|
});
|
|
@@ -1750,49 +1762,21 @@ var spillMaximumHeightParameterDescriptor = {
|
|
|
1750
1762
|
sortOrder: 1,
|
|
1751
1763
|
name: "spillMaximumHeight"
|
|
1752
1764
|
};
|
|
1765
|
+
var _AppUtilityProxy_instances, defaultMaximums_fn;
|
|
1753
1766
|
var AppUtilityProxy = class extends LibProxy {
|
|
1767
|
+
constructor() {
|
|
1768
|
+
super(...arguments);
|
|
1769
|
+
__privateAdd(this, _AppUtilityProxy_instances);
|
|
1770
|
+
}
|
|
1754
1771
|
version() {
|
|
1755
1772
|
return this.appExtension.version;
|
|
1756
1773
|
}
|
|
1757
|
-
/**
|
|
1758
|
-
* Provide default values for maximum width and height if required.
|
|
1759
|
-
*
|
|
1760
|
-
* @param maximumDimensions
|
|
1761
|
-
* Maximum dimensions provided to function.
|
|
1762
|
-
*
|
|
1763
|
-
* @param invocationContext
|
|
1764
|
-
* Invocation context.
|
|
1765
|
-
*
|
|
1766
|
-
* @returns
|
|
1767
|
-
* Array of maximum width and maximum height.
|
|
1768
|
-
*/
|
|
1769
|
-
async defaultMaximums(maximumDimensions, invocationContext) {
|
|
1770
|
-
if (isNullish(invocationContext)) {
|
|
1771
|
-
throw new Error("Invocation context not provided by application");
|
|
1772
|
-
}
|
|
1773
|
-
const maximumWidth = maximumDimensions.width;
|
|
1774
|
-
const maximumHeight = maximumDimensions.height;
|
|
1775
|
-
let definedMaximumWidth;
|
|
1776
|
-
let definedMaximumHeight;
|
|
1777
|
-
if (isNullish(maximumWidth) || isNullish(maximumHeight)) {
|
|
1778
|
-
const sheetAddress = await this.appExtension.getSheetAddress(invocationContext);
|
|
1779
|
-
definedMaximumWidth = maximumWidth ?? await this.appExtension.maximumWidth() - sheetAddress.columnIndex;
|
|
1780
|
-
definedMaximumHeight = maximumHeight ?? await this.appExtension.maximumHeight() - sheetAddress.rowIndex;
|
|
1781
|
-
} else {
|
|
1782
|
-
definedMaximumWidth = maximumWidth;
|
|
1783
|
-
definedMaximumHeight = maximumHeight;
|
|
1784
|
-
}
|
|
1785
|
-
return {
|
|
1786
|
-
width: definedMaximumWidth,
|
|
1787
|
-
height: definedMaximumHeight
|
|
1788
|
-
};
|
|
1789
|
-
}
|
|
1790
1774
|
async vSpill(hMatrixValues, maximumWidth, maximumHeight, invocationContext) {
|
|
1791
1775
|
let result;
|
|
1792
1776
|
if (hMatrixValues.length !== 1) {
|
|
1793
1777
|
throw new RangeError(i18nextAppExtension.t("Proxy.vSpillMustBeHorizontalArray"));
|
|
1794
1778
|
}
|
|
1795
|
-
const maximumDimensions = await this.
|
|
1779
|
+
const maximumDimensions = await __privateMethod(this, _AppUtilityProxy_instances, defaultMaximums_fn).call(this, {
|
|
1796
1780
|
width: maximumWidth,
|
|
1797
1781
|
height: maximumHeight
|
|
1798
1782
|
}, invocationContext);
|
|
@@ -1826,7 +1810,7 @@ var AppUtilityProxy = class extends LibProxy {
|
|
|
1826
1810
|
throw new RangeError(i18nextAppExtension.t("Proxy.hSpillMustBeVerticalArray"));
|
|
1827
1811
|
}
|
|
1828
1812
|
}
|
|
1829
|
-
const maximumDimensions = await this.
|
|
1813
|
+
const maximumDimensions = await __privateMethod(this, _AppUtilityProxy_instances, defaultMaximums_fn).call(this, {
|
|
1830
1814
|
width: maximumWidth,
|
|
1831
1815
|
height: maximumHeight
|
|
1832
1816
|
}, invocationContext);
|
|
@@ -1854,6 +1838,28 @@ var AppUtilityProxy = class extends LibProxy {
|
|
|
1854
1838
|
return result;
|
|
1855
1839
|
}
|
|
1856
1840
|
};
|
|
1841
|
+
_AppUtilityProxy_instances = new WeakSet();
|
|
1842
|
+
defaultMaximums_fn = async function(maximumDimensions, invocationContext) {
|
|
1843
|
+
if (isNullish(invocationContext)) {
|
|
1844
|
+
throw new Error("Invocation context not provided by application");
|
|
1845
|
+
}
|
|
1846
|
+
const maximumWidth = maximumDimensions.width;
|
|
1847
|
+
const maximumHeight = maximumDimensions.height;
|
|
1848
|
+
let definedMaximumWidth;
|
|
1849
|
+
let definedMaximumHeight;
|
|
1850
|
+
if (isNullish(maximumWidth) || isNullish(maximumHeight)) {
|
|
1851
|
+
const sheetAddress = await this.appExtension.getSheetAddress(invocationContext);
|
|
1852
|
+
definedMaximumWidth = maximumWidth ?? await this.appExtension.maximumWidth() - sheetAddress.columnIndex;
|
|
1853
|
+
definedMaximumHeight = maximumHeight ?? await this.appExtension.maximumHeight() - sheetAddress.rowIndex;
|
|
1854
|
+
} else {
|
|
1855
|
+
definedMaximumWidth = maximumWidth;
|
|
1856
|
+
definedMaximumHeight = maximumHeight;
|
|
1857
|
+
}
|
|
1858
|
+
return {
|
|
1859
|
+
width: definedMaximumWidth,
|
|
1860
|
+
height: definedMaximumHeight
|
|
1861
|
+
};
|
|
1862
|
+
};
|
|
1857
1863
|
__decorateClass([
|
|
1858
1864
|
ProxyMethod({
|
|
1859
1865
|
type: Types.String,
|
|
@@ -1884,6 +1890,19 @@ AppUtilityProxy = __decorateClass([
|
|
|
1884
1890
|
ProxyClass()
|
|
1885
1891
|
], AppUtilityProxy);
|
|
1886
1892
|
|
|
1893
|
+
// src/utility/index.ts
|
|
1894
|
+
var utility_exports = {};
|
|
1895
|
+
__export(utility_exports, {
|
|
1896
|
+
AlphabeticProxy: () => AlphabeticProxy,
|
|
1897
|
+
AlphanumericProxy: () => AlphanumericProxy,
|
|
1898
|
+
CharacterSetCreatorProxy: () => CharacterSetCreatorProxy,
|
|
1899
|
+
CharacterSetValidatorProxy: () => CharacterSetValidatorProxy,
|
|
1900
|
+
HexadecimalProxy: () => HexadecimalProxy,
|
|
1901
|
+
NumericProxy: () => NumericProxy,
|
|
1902
|
+
RegExpProxy: () => RegExpProxy,
|
|
1903
|
+
TransformerProxy: () => TransformerProxy
|
|
1904
|
+
});
|
|
1905
|
+
|
|
1887
1906
|
// src/utility/transformer-proxy.ts
|
|
1888
1907
|
import { mapIterable as mapIterable2, Sequence, Transformer } from "@aidc-toolkit/utility";
|
|
1889
1908
|
|
|
@@ -2095,13 +2114,13 @@ var valueForSParameterDescriptor = {
|
|
|
2095
2114
|
name: "valueForS"
|
|
2096
2115
|
};
|
|
2097
2116
|
var CharacterSetValidatorProxy = class extends StringProxy {
|
|
2098
|
-
|
|
2117
|
+
#characterSetValidator;
|
|
2099
2118
|
constructor(appExtension, characterSetValidator) {
|
|
2100
2119
|
super(appExtension);
|
|
2101
|
-
this
|
|
2120
|
+
this.#characterSetValidator = characterSetValidator;
|
|
2102
2121
|
}
|
|
2103
2122
|
validate(matrixSs, exclusion) {
|
|
2104
|
-
return this.validateString(this
|
|
2123
|
+
return this.validateString(this.#characterSetValidator, matrixSs, {
|
|
2105
2124
|
exclusion: exclusion ?? void 0
|
|
2106
2125
|
});
|
|
2107
2126
|
}
|
|
@@ -2126,26 +2145,26 @@ __decorateClass([
|
|
|
2126
2145
|
__decorateParam(1, ProxyParameter(exclusionNoneParameterDescriptor))
|
|
2127
2146
|
], CharacterSetValidatorProxy.prototype, "isValid", 1);
|
|
2128
2147
|
var CharacterSetCreatorProxy = class extends CharacterSetValidatorProxy {
|
|
2129
|
-
|
|
2148
|
+
#characterSetCreator;
|
|
2130
2149
|
constructor(appExtension, characterSetCreator) {
|
|
2131
2150
|
super(appExtension, characterSetCreator);
|
|
2132
|
-
this
|
|
2151
|
+
this.#characterSetCreator = characterSetCreator;
|
|
2133
2152
|
}
|
|
2134
2153
|
create(length, matrixValues, exclusion, tweak) {
|
|
2135
2154
|
const exclusionOrUndefined = exclusion ?? void 0;
|
|
2136
2155
|
const tweakOrUndefined = tweak ?? void 0;
|
|
2137
|
-
return this.mapMatrix(matrixValues, (value) => this.
|
|
2156
|
+
return this.mapMatrix(matrixValues, (value) => this.#characterSetCreator.create(length, value, exclusionOrUndefined, tweakOrUndefined));
|
|
2138
2157
|
}
|
|
2139
2158
|
createSequence(length, startValue, count, exclusion, tweak) {
|
|
2140
2159
|
this.appExtension.validateSequenceCount(count);
|
|
2141
2160
|
const exclusionOrUndefined = exclusion ?? void 0;
|
|
2142
2161
|
const tweakOrUndefined = tweak ?? void 0;
|
|
2143
|
-
return LibProxy.matrixResult(this.
|
|
2162
|
+
return LibProxy.matrixResult(this.#characterSetCreator.create(length, new Sequence2(startValue, count), exclusionOrUndefined, tweakOrUndefined));
|
|
2144
2163
|
}
|
|
2145
2164
|
valueFor(matrixSs, exclusion, tweak) {
|
|
2146
2165
|
const exclusionOrUndefined = exclusion ?? void 0;
|
|
2147
2166
|
const tweakOrUndefined = tweak ?? void 0;
|
|
2148
|
-
return this.mapMatrix(matrixSs, (s) => this.mapBigInt(this.
|
|
2167
|
+
return this.mapMatrix(matrixSs, (s) => this.mapBigInt(this.#characterSetCreator.valueFor(s, exclusionOrUndefined, tweakOrUndefined)));
|
|
2149
2168
|
}
|
|
2150
2169
|
};
|
|
2151
2170
|
__decorateClass([
|
|
@@ -2442,7 +2461,7 @@ CheckProxy = __decorateClass([
|
|
|
2442
2461
|
import { isNullish as isNullish2 } from "@aidc-toolkit/core";
|
|
2443
2462
|
import {
|
|
2444
2463
|
GTINCreator,
|
|
2445
|
-
|
|
2464
|
+
GTINLengths,
|
|
2446
2465
|
GTINValidator,
|
|
2447
2466
|
IdentifierValidators,
|
|
2448
2467
|
PrefixManager,
|
|
@@ -2462,13 +2481,13 @@ var validateIdentifierParameterDescriptor = {
|
|
|
2462
2481
|
name: "validateIdentifier"
|
|
2463
2482
|
};
|
|
2464
2483
|
var IdentifierValidatorProxy = class extends StringProxy {
|
|
2465
|
-
|
|
2484
|
+
#validator;
|
|
2466
2485
|
constructor(appExtension, validator) {
|
|
2467
2486
|
super(appExtension);
|
|
2468
|
-
this
|
|
2487
|
+
this.#validator = validator;
|
|
2469
2488
|
}
|
|
2470
2489
|
get validator() {
|
|
2471
|
-
return this
|
|
2490
|
+
return this.#validator;
|
|
2472
2491
|
}
|
|
2473
2492
|
};
|
|
2474
2493
|
var NumericIdentifierValidatorProxy = class extends IdentifierValidatorProxy {
|
|
@@ -2487,6 +2506,8 @@ var GTINValidatorProxy = class extends NumericIdentifierValidatorProxy {
|
|
|
2487
2506
|
};
|
|
2488
2507
|
var NonGTINNumericIdentifierValidatorProxy = class extends NumericIdentifierValidatorProxy {
|
|
2489
2508
|
};
|
|
2509
|
+
var NonSerializableNumericIdentifierValidatorProxy = class extends NonGTINNumericIdentifierValidatorProxy {
|
|
2510
|
+
};
|
|
2490
2511
|
var SerializableNumericIdentifierValidatorProxy = class extends NonGTINNumericIdentifierValidatorProxy {
|
|
2491
2512
|
};
|
|
2492
2513
|
var NonNumericIdentifierValidatorProxy = class extends IdentifierValidatorProxy {
|
|
@@ -2506,7 +2527,7 @@ __decorateClass([
|
|
|
2506
2527
|
], NonNumericIdentifierValidatorProxy.prototype, "validate", 1);
|
|
2507
2528
|
var GTIN13ValidatorProxy = class extends GTINValidatorProxy {
|
|
2508
2529
|
constructor(appExtension) {
|
|
2509
|
-
super(appExtension, IdentifierValidators.GTIN[
|
|
2530
|
+
super(appExtension, IdentifierValidators.GTIN[GTINLengths.GTIN13]);
|
|
2510
2531
|
}
|
|
2511
2532
|
};
|
|
2512
2533
|
GTIN13ValidatorProxy = __decorateClass([
|
|
@@ -2517,7 +2538,7 @@ GTIN13ValidatorProxy = __decorateClass([
|
|
|
2517
2538
|
], GTIN13ValidatorProxy);
|
|
2518
2539
|
var GTIN12ValidatorProxy = class extends GTINValidatorProxy {
|
|
2519
2540
|
constructor(appExtension) {
|
|
2520
|
-
super(appExtension, IdentifierValidators.GTIN[
|
|
2541
|
+
super(appExtension, IdentifierValidators.GTIN[GTINLengths.GTIN12]);
|
|
2521
2542
|
}
|
|
2522
2543
|
};
|
|
2523
2544
|
GTIN12ValidatorProxy = __decorateClass([
|
|
@@ -2528,7 +2549,7 @@ GTIN12ValidatorProxy = __decorateClass([
|
|
|
2528
2549
|
], GTIN12ValidatorProxy);
|
|
2529
2550
|
var GTIN8ValidatorProxy = class extends GTINValidatorProxy {
|
|
2530
2551
|
constructor(appExtension) {
|
|
2531
|
-
super(appExtension, IdentifierValidators.GTIN[
|
|
2552
|
+
super(appExtension, IdentifierValidators.GTIN[GTINLengths.GTIN8]);
|
|
2532
2553
|
}
|
|
2533
2554
|
};
|
|
2534
2555
|
GTIN8ValidatorProxy = __decorateClass([
|
|
@@ -2685,7 +2706,7 @@ GTINValidatorStaticProxy = __decorateClass([
|
|
|
2685
2706
|
namespace: "GS1"
|
|
2686
2707
|
})
|
|
2687
2708
|
], GTINValidatorStaticProxy);
|
|
2688
|
-
var GLNValidatorProxy = class extends
|
|
2709
|
+
var GLNValidatorProxy = class extends NonSerializableNumericIdentifierValidatorProxy {
|
|
2689
2710
|
constructor(appExtension) {
|
|
2690
2711
|
super(appExtension, IdentifierValidators.GLN);
|
|
2691
2712
|
}
|
|
@@ -2696,7 +2717,7 @@ GLNValidatorProxy = __decorateClass([
|
|
|
2696
2717
|
methodInfix: "GLN"
|
|
2697
2718
|
})
|
|
2698
2719
|
], GLNValidatorProxy);
|
|
2699
|
-
var SSCCValidatorProxy = class extends
|
|
2720
|
+
var SSCCValidatorProxy = class extends NonSerializableNumericIdentifierValidatorProxy {
|
|
2700
2721
|
constructor(appExtension) {
|
|
2701
2722
|
super(appExtension, IdentifierValidators.SSCC);
|
|
2702
2723
|
}
|
|
@@ -2729,7 +2750,7 @@ GIAIValidatorProxy = __decorateClass([
|
|
|
2729
2750
|
methodInfix: "GIAI"
|
|
2730
2751
|
})
|
|
2731
2752
|
], GIAIValidatorProxy);
|
|
2732
|
-
var GSRNValidatorProxy = class extends
|
|
2753
|
+
var GSRNValidatorProxy = class extends NonSerializableNumericIdentifierValidatorProxy {
|
|
2733
2754
|
constructor(appExtension) {
|
|
2734
2755
|
super(appExtension, IdentifierValidators.GSRN);
|
|
2735
2756
|
}
|
|
@@ -2762,7 +2783,7 @@ GINCValidatorProxy = __decorateClass([
|
|
|
2762
2783
|
methodInfix: "GINC"
|
|
2763
2784
|
})
|
|
2764
2785
|
], GINCValidatorProxy);
|
|
2765
|
-
var GSINValidatorProxy = class extends
|
|
2786
|
+
var GSINValidatorProxy = class extends NonSerializableNumericIdentifierValidatorProxy {
|
|
2766
2787
|
constructor(appExtension) {
|
|
2767
2788
|
super(appExtension, IdentifierValidators.GSIN);
|
|
2768
2789
|
}
|
|
@@ -2858,11 +2879,11 @@ PrefixManagerProxy = __decorateClass([
|
|
|
2858
2879
|
})
|
|
2859
2880
|
], PrefixManagerProxy);
|
|
2860
2881
|
var IdentifierCreatorProxy = class _IdentifierCreatorProxy extends LibProxy {
|
|
2861
|
-
static PREFIX_TYPES = [PrefixTypes.GS1CompanyPrefix, PrefixTypes.UPCCompanyPrefix, PrefixTypes.GS18Prefix];
|
|
2862
|
-
|
|
2882
|
+
static #PREFIX_TYPES = [PrefixTypes.GS1CompanyPrefix, PrefixTypes.UPCCompanyPrefix, PrefixTypes.GS18Prefix];
|
|
2883
|
+
#getCreator;
|
|
2863
2884
|
constructor(appExtension, getCreator) {
|
|
2864
2885
|
super(appExtension);
|
|
2865
|
-
this
|
|
2886
|
+
this.#getCreator = getCreator;
|
|
2866
2887
|
}
|
|
2867
2888
|
getCreator(prefixDefinition) {
|
|
2868
2889
|
const reducedPrefixDefinition = prefixDefinition.length === 1 ? (
|
|
@@ -2885,12 +2906,12 @@ var IdentifierCreatorProxy = class _IdentifierCreatorProxy extends LibProxy {
|
|
|
2885
2906
|
throw new RangeError(i18nextAppExtension.t("IdentifierCreatorProxy.prefixMustBeString"));
|
|
2886
2907
|
}
|
|
2887
2908
|
const prefixTypeIndex = reducedPrefixDefinition[1] ?? 0;
|
|
2888
|
-
if (typeof prefixTypeIndex !== "number" || prefixTypeIndex < 0 || prefixTypeIndex >= _IdentifierCreatorProxy
|
|
2909
|
+
if (typeof prefixTypeIndex !== "number" || prefixTypeIndex < 0 || prefixTypeIndex >= _IdentifierCreatorProxy.#PREFIX_TYPES.length) {
|
|
2889
2910
|
throw new RangeError(i18nextAppExtension.t("IdentifierCreatorProxy.prefixTypeMustBeNumber", {
|
|
2890
|
-
maximumPrefixType: _IdentifierCreatorProxy
|
|
2911
|
+
maximumPrefixType: _IdentifierCreatorProxy.#PREFIX_TYPES.length - 1
|
|
2891
2912
|
}));
|
|
2892
2913
|
}
|
|
2893
|
-
const prefixType = _IdentifierCreatorProxy
|
|
2914
|
+
const prefixType = _IdentifierCreatorProxy.#PREFIX_TYPES[prefixTypeIndex];
|
|
2894
2915
|
if (prefixType === void 0) {
|
|
2895
2916
|
throw new RangeError(i18nextAppExtension.t("IdentifierCreatorProxy.invalidPrefixType"));
|
|
2896
2917
|
}
|
|
@@ -2904,7 +2925,7 @@ var IdentifierCreatorProxy = class _IdentifierCreatorProxy extends LibProxy {
|
|
|
2904
2925
|
} else {
|
|
2905
2926
|
prefixManager.resetTweakFactor();
|
|
2906
2927
|
}
|
|
2907
|
-
return this
|
|
2928
|
+
return this.#getCreator(prefixManager);
|
|
2908
2929
|
}
|
|
2909
2930
|
};
|
|
2910
2931
|
var sparseParameterDescriptor = {
|
|
@@ -2958,6 +2979,8 @@ __decorateClass([
|
|
|
2958
2979
|
], NumericIdentifierCreatorProxy.prototype, "createAll", 1);
|
|
2959
2980
|
var NonGTINNumericIdentifierCreatorProxy = class extends NumericIdentifierCreatorProxy {
|
|
2960
2981
|
};
|
|
2982
|
+
var NonSerializableNumericIdentifierCreatorProxy = class extends NonGTINNumericIdentifierCreatorProxy {
|
|
2983
|
+
};
|
|
2961
2984
|
var singleValueParameterDescriptor = {
|
|
2962
2985
|
extendsDescriptor: valueParameterDescriptor,
|
|
2963
2986
|
isMatrix: false
|
|
@@ -3068,7 +3091,7 @@ GTINCreatorProxy = __decorateClass([
|
|
|
3068
3091
|
]
|
|
3069
3092
|
})
|
|
3070
3093
|
], GTINCreatorProxy);
|
|
3071
|
-
var GLNCreatorProxy = class extends
|
|
3094
|
+
var GLNCreatorProxy = class extends NonSerializableNumericIdentifierCreatorProxy {
|
|
3072
3095
|
constructor(appExtension) {
|
|
3073
3096
|
super(appExtension, (prefixManager) => prefixManager.glnCreator);
|
|
3074
3097
|
}
|
|
@@ -3079,7 +3102,7 @@ GLNCreatorProxy = __decorateClass([
|
|
|
3079
3102
|
methodInfix: "GLN"
|
|
3080
3103
|
})
|
|
3081
3104
|
], GLNCreatorProxy);
|
|
3082
|
-
var SSCCCreatorProxy = class extends
|
|
3105
|
+
var SSCCCreatorProxy = class extends NonSerializableNumericIdentifierCreatorProxy {
|
|
3083
3106
|
constructor(appExtension) {
|
|
3084
3107
|
super(appExtension, (prefixManager) => prefixManager.ssccCreator);
|
|
3085
3108
|
}
|
|
@@ -3112,7 +3135,7 @@ GIAICreatorProxy = __decorateClass([
|
|
|
3112
3135
|
methodInfix: "GIAI"
|
|
3113
3136
|
})
|
|
3114
3137
|
], GIAICreatorProxy);
|
|
3115
|
-
var GSRNCreatorProxy = class extends
|
|
3138
|
+
var GSRNCreatorProxy = class extends NonSerializableNumericIdentifierCreatorProxy {
|
|
3116
3139
|
constructor(appExtension) {
|
|
3117
3140
|
super(appExtension, (prefixManager) => prefixManager.gsrnCreator);
|
|
3118
3141
|
}
|
|
@@ -3145,7 +3168,7 @@ GINCCreatorProxy = __decorateClass([
|
|
|
3145
3168
|
methodInfix: "GINC"
|
|
3146
3169
|
})
|
|
3147
3170
|
], GINCCreatorProxy);
|
|
3148
|
-
var GSINCreatorProxy = class extends
|
|
3171
|
+
var GSINCreatorProxy = class extends NonSerializableNumericIdentifierCreatorProxy {
|
|
3149
3172
|
constructor(appExtension) {
|
|
3150
3173
|
super(appExtension, (prefixManager) => prefixManager.gsinCreator);
|
|
3151
3174
|
}
|
|
@@ -3192,31 +3215,34 @@ GMNCreatorProxy = __decorateClass([
|
|
|
3192
3215
|
|
|
3193
3216
|
// src/generator/generator.ts
|
|
3194
3217
|
import { I18nEnvironments } from "@aidc-toolkit/core";
|
|
3218
|
+
function registerProxies(..._proxies) {
|
|
3219
|
+
}
|
|
3220
|
+
registerProxies(AppUtilityProxy, utility_exports, gs1_exports);
|
|
3195
3221
|
var Generator = class _Generator {
|
|
3196
3222
|
/**
|
|
3197
3223
|
* Documentation base URL.
|
|
3198
3224
|
*/
|
|
3199
|
-
static DOCUMENTATION_BASE_URL = "https://aidc-toolkit.com/";
|
|
3225
|
+
static #DOCUMENTATION_BASE_URL = "https://aidc-toolkit.com/";
|
|
3200
3226
|
/**
|
|
3201
3227
|
* Documentation path, optionally preceded by locale.
|
|
3202
3228
|
*/
|
|
3203
|
-
static DOCUMENTATION_PATH = "app-extension/";
|
|
3229
|
+
static #DOCUMENTATION_PATH = "app-extension/";
|
|
3204
3230
|
/**
|
|
3205
3231
|
* Locales.
|
|
3206
3232
|
*/
|
|
3207
|
-
|
|
3233
|
+
#locales;
|
|
3208
3234
|
/**
|
|
3209
3235
|
* Default locale.
|
|
3210
3236
|
*/
|
|
3211
|
-
|
|
3237
|
+
#defaultLocale;
|
|
3212
3238
|
/**
|
|
3213
3239
|
* Map of function localizations maps by namespace function name.
|
|
3214
3240
|
*/
|
|
3215
|
-
|
|
3241
|
+
#functionLocalizationsMapsMap = /* @__PURE__ */ new Map();
|
|
3216
3242
|
/**
|
|
3217
3243
|
* Map of parameter localizations maps by namespace function parameter name.
|
|
3218
3244
|
*/
|
|
3219
|
-
|
|
3245
|
+
#parameterLocalizationsMapsMap = /* @__PURE__ */ new Map();
|
|
3220
3246
|
/**
|
|
3221
3247
|
*
|
|
3222
3248
|
*/
|
|
@@ -3227,20 +3253,20 @@ var Generator = class _Generator {
|
|
|
3227
3253
|
* Include localizations if true.
|
|
3228
3254
|
*/
|
|
3229
3255
|
constructor(includeLocalizations = true) {
|
|
3230
|
-
this
|
|
3231
|
-
this
|
|
3256
|
+
this.#locales = includeLocalizations ? Object.keys(appExtensionResources) : [];
|
|
3257
|
+
this.#defaultLocale = this.#locales[0] ?? "";
|
|
3232
3258
|
}
|
|
3233
3259
|
/**
|
|
3234
3260
|
* Get the locales.
|
|
3235
3261
|
*/
|
|
3236
3262
|
get locales() {
|
|
3237
|
-
return this
|
|
3263
|
+
return this.#locales;
|
|
3238
3264
|
}
|
|
3239
3265
|
/**
|
|
3240
3266
|
* Get the default locale.
|
|
3241
3267
|
*/
|
|
3242
3268
|
get defaultLocale() {
|
|
3243
|
-
return this
|
|
3269
|
+
return this.#defaultLocale;
|
|
3244
3270
|
}
|
|
3245
3271
|
/**
|
|
3246
3272
|
* Get function localization.
|
|
@@ -3255,9 +3281,9 @@ var Generator = class _Generator {
|
|
|
3255
3281
|
* Function localization.
|
|
3256
3282
|
*/
|
|
3257
3283
|
getFunctionLocalization(namespaceFunctionName, locale) {
|
|
3258
|
-
const functionLocalization = this.
|
|
3284
|
+
const functionLocalization = this.#functionLocalizationsMapsMap.get(namespaceFunctionName)?.get(locale);
|
|
3259
3285
|
if (functionLocalization === void 0) {
|
|
3260
|
-
throw new Error(
|
|
3286
|
+
throw new Error(`${locale} localization for function ${namespaceFunctionName} not found`);
|
|
3261
3287
|
}
|
|
3262
3288
|
return functionLocalization;
|
|
3263
3289
|
}
|
|
@@ -3277,15 +3303,18 @@ var Generator = class _Generator {
|
|
|
3277
3303
|
* Function localization.
|
|
3278
3304
|
*/
|
|
3279
3305
|
getParameterLocalization(namespaceFunctionName, parameterName, locale) {
|
|
3280
|
-
const parameterLocalization = this.
|
|
3306
|
+
const parameterLocalization = this.#parameterLocalizationsMapsMap.get(`${namespaceFunctionName}.${parameterName}`)?.get(locale);
|
|
3281
3307
|
if (parameterLocalization === void 0) {
|
|
3282
|
-
throw new Error(
|
|
3308
|
+
throw new Error(`${locale} localization for function ${namespaceFunctionName} parameter ${parameterName} not found`);
|
|
3283
3309
|
}
|
|
3284
3310
|
return parameterLocalization;
|
|
3285
3311
|
}
|
|
3286
3312
|
/**
|
|
3287
3313
|
* Generate localizations map.
|
|
3288
3314
|
*
|
|
3315
|
+
* @template TLocalization
|
|
3316
|
+
* Localization type.
|
|
3317
|
+
*
|
|
3289
3318
|
* @param localizedKeyPrefix
|
|
3290
3319
|
* Localized key prefix.
|
|
3291
3320
|
*
|
|
@@ -3295,8 +3324,8 @@ var Generator = class _Generator {
|
|
|
3295
3324
|
* @returns
|
|
3296
3325
|
* Localization map.
|
|
3297
3326
|
*/
|
|
3298
|
-
generateLocalizationsMap(localizedKeyPrefix, localizationCallback) {
|
|
3299
|
-
return new Map(this.
|
|
3327
|
+
#generateLocalizationsMap(localizedKeyPrefix, localizationCallback) {
|
|
3328
|
+
return new Map(this.#locales.map((locale) => {
|
|
3300
3329
|
const lngOption = {
|
|
3301
3330
|
lng: locale
|
|
3302
3331
|
};
|
|
@@ -3345,16 +3374,16 @@ var Generator = class _Generator {
|
|
|
3345
3374
|
} else {
|
|
3346
3375
|
const insertIndex = methodName.indexOf(infixBefore);
|
|
3347
3376
|
if (insertIndex === -1) {
|
|
3348
|
-
throw new Error(`Cannot find "${infixBefore}" in method
|
|
3377
|
+
throw new Error(`Cannot find "${infixBefore}" in method ${methodName}`);
|
|
3349
3378
|
}
|
|
3350
3379
|
functionName = `${methodName.substring(0, insertIndex)}${methodInfix}${methodName.substring(insertIndex)}`;
|
|
3351
3380
|
}
|
|
3352
3381
|
const namespaceFunctionName = `${namespacePrefix}${functionName}`;
|
|
3353
|
-
const functionLocalizationsMap = this
|
|
3382
|
+
const functionLocalizationsMap = this.#generateLocalizationsMap(`Functions.${namespaceFunctionName}.`, (locale, localization) => ({
|
|
3354
3383
|
...localization,
|
|
3355
|
-
documentationURL: `${_Generator
|
|
3384
|
+
documentationURL: `${_Generator.#DOCUMENTATION_BASE_URL}${locale === this.defaultLocale ? "" : `${locale}/`}${_Generator.#DOCUMENTATION_PATH}${namespace === void 0 ? "" : `${namespace}/`}${localization.name}.html`
|
|
3356
3385
|
}));
|
|
3357
|
-
this.
|
|
3386
|
+
this.#functionLocalizationsMapsMap.set(namespaceFunctionName, functionLocalizationsMap);
|
|
3358
3387
|
this.createProxyFunction({
|
|
3359
3388
|
...proxyObjectDescriptor,
|
|
3360
3389
|
functionName,
|
|
@@ -3363,8 +3392,8 @@ var Generator = class _Generator {
|
|
|
3363
3392
|
proxyParameterDescriptors: methodDescriptor.parameterDescriptors.map((parameterDescriptor) => {
|
|
3364
3393
|
const expandedParameterDescriptor = expandParameterDescriptor(parameterDescriptor);
|
|
3365
3394
|
const parameterName = expandedParameterDescriptor.name;
|
|
3366
|
-
const parameterLocalizationsMap = this
|
|
3367
|
-
this.
|
|
3395
|
+
const parameterLocalizationsMap = this.#generateLocalizationsMap(`Parameters.${parameterName}.`, (_locale, localization) => localization);
|
|
3396
|
+
this.#parameterLocalizationsMapsMap.set(`${namespaceFunctionName}.${parameterName}`, parameterLocalizationsMap);
|
|
3368
3397
|
return {
|
|
3369
3398
|
namespace,
|
|
3370
3399
|
parameterName,
|