@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.cjs
CHANGED
|
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __typeError = (msg) => {
|
|
9
|
+
throw TypeError(msg);
|
|
10
|
+
};
|
|
8
11
|
var __export = (target, all) => {
|
|
9
12
|
for (var name in all)
|
|
10
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -35,6 +38,9 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
35
38
|
return result;
|
|
36
39
|
};
|
|
37
40
|
var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
41
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
42
|
+
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);
|
|
43
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
38
44
|
|
|
39
45
|
// src/index.ts
|
|
40
46
|
var index_exports = {};
|
|
@@ -1345,23 +1351,23 @@ var AppExtension = class {
|
|
|
1345
1351
|
/**
|
|
1346
1352
|
* Application version.
|
|
1347
1353
|
*/
|
|
1348
|
-
|
|
1354
|
+
#version;
|
|
1349
1355
|
/**
|
|
1350
1356
|
* Maximum sequence count supported by application.
|
|
1351
1357
|
*/
|
|
1352
|
-
|
|
1358
|
+
#maximumSequenceCount;
|
|
1353
1359
|
/**
|
|
1354
1360
|
* If true, errors are reported through the throw/catch mechanism.
|
|
1355
1361
|
*/
|
|
1356
|
-
|
|
1362
|
+
#throwError;
|
|
1357
1363
|
/**
|
|
1358
1364
|
* Maximum width supported by application.
|
|
1359
1365
|
*/
|
|
1360
|
-
|
|
1366
|
+
#maximumWidth;
|
|
1361
1367
|
/**
|
|
1362
1368
|
* Maximum height supported by application.
|
|
1363
1369
|
*/
|
|
1364
|
-
|
|
1370
|
+
#maximumHeight;
|
|
1365
1371
|
/**
|
|
1366
1372
|
* Constructor.
|
|
1367
1373
|
*
|
|
@@ -1375,9 +1381,9 @@ var AppExtension = class {
|
|
|
1375
1381
|
* If true, errors are reported through the throw/catch mechanism.
|
|
1376
1382
|
*/
|
|
1377
1383
|
constructor(version, maximumSequenceCount, throwError) {
|
|
1378
|
-
this
|
|
1379
|
-
this
|
|
1380
|
-
this
|
|
1384
|
+
this.#version = version;
|
|
1385
|
+
this.#maximumSequenceCount = maximumSequenceCount;
|
|
1386
|
+
this.#throwError = throwError;
|
|
1381
1387
|
}
|
|
1382
1388
|
/**
|
|
1383
1389
|
* Get the version.
|
|
@@ -1386,13 +1392,13 @@ var AppExtension = class {
|
|
|
1386
1392
|
* Version.
|
|
1387
1393
|
*/
|
|
1388
1394
|
get version() {
|
|
1389
|
-
return this
|
|
1395
|
+
return this.#version;
|
|
1390
1396
|
}
|
|
1391
1397
|
/**
|
|
1392
1398
|
* Determine if errors are reported through the throw/catch mechanism.
|
|
1393
1399
|
*/
|
|
1394
1400
|
get throwError() {
|
|
1395
|
-
return this
|
|
1401
|
+
return this.#throwError;
|
|
1396
1402
|
}
|
|
1397
1403
|
/**
|
|
1398
1404
|
* Get the maximum width supported by the application.
|
|
@@ -1401,8 +1407,8 @@ var AppExtension = class {
|
|
|
1401
1407
|
* Maximum width supported by the application.
|
|
1402
1408
|
*/
|
|
1403
1409
|
async maximumWidth() {
|
|
1404
|
-
this
|
|
1405
|
-
return this
|
|
1410
|
+
this.#maximumWidth ??= await this.getMaximumWidth();
|
|
1411
|
+
return this.#maximumWidth;
|
|
1406
1412
|
}
|
|
1407
1413
|
/**
|
|
1408
1414
|
* Get the maximum height supported by the application.
|
|
@@ -1411,8 +1417,8 @@ var AppExtension = class {
|
|
|
1411
1417
|
* Maximum height supported by the application.
|
|
1412
1418
|
*/
|
|
1413
1419
|
async maximumHeight() {
|
|
1414
|
-
this
|
|
1415
|
-
return this
|
|
1420
|
+
this.#maximumHeight ??= await this.getMaximumHeight();
|
|
1421
|
+
return this.#maximumHeight;
|
|
1416
1422
|
}
|
|
1417
1423
|
/**
|
|
1418
1424
|
* Validate a sequence count against the maximum supported by application.
|
|
@@ -1422,16 +1428,19 @@ var AppExtension = class {
|
|
|
1422
1428
|
*/
|
|
1423
1429
|
validateSequenceCount(sequenceCount) {
|
|
1424
1430
|
const absoluteSequenceCount = Math.abs(sequenceCount);
|
|
1425
|
-
if (absoluteSequenceCount > this
|
|
1431
|
+
if (absoluteSequenceCount > this.#maximumSequenceCount) {
|
|
1426
1432
|
throw new RangeError(i18nextAppExtension.t("AppExtension.sequenceCountMustBeLessThanOrEqualTo", {
|
|
1427
1433
|
sequenceCount: absoluteSequenceCount,
|
|
1428
|
-
maximumSequenceCount: this
|
|
1434
|
+
maximumSequenceCount: this.#maximumSequenceCount
|
|
1429
1435
|
}));
|
|
1430
1436
|
}
|
|
1431
1437
|
}
|
|
1432
1438
|
/**
|
|
1433
1439
|
* Bind a synchronous method and wrap it in a try/catch for comprehensive error handling.
|
|
1434
1440
|
*
|
|
1441
|
+
* @template TMethod
|
|
1442
|
+
* Method type.
|
|
1443
|
+
*
|
|
1435
1444
|
* @param thisArg
|
|
1436
1445
|
* The value to be passed as the `this` parameter to the method.
|
|
1437
1446
|
*
|
|
@@ -1455,6 +1464,9 @@ var AppExtension = class {
|
|
|
1455
1464
|
/**
|
|
1456
1465
|
* Bind an asynchronous method and wrap it in a try/catch for comprehensive error handling.
|
|
1457
1466
|
*
|
|
1467
|
+
* @template TMethod
|
|
1468
|
+
* Method type.
|
|
1469
|
+
*
|
|
1458
1470
|
* @param thisArg
|
|
1459
1471
|
* The value to be passed as the `this` parameter to the method.
|
|
1460
1472
|
*
|
|
@@ -1479,7 +1491,7 @@ var LibProxy = class {
|
|
|
1479
1491
|
/**
|
|
1480
1492
|
* Application extension.
|
|
1481
1493
|
*/
|
|
1482
|
-
|
|
1494
|
+
#appExtension;
|
|
1483
1495
|
/**
|
|
1484
1496
|
* Constructor.
|
|
1485
1497
|
*
|
|
@@ -1487,13 +1499,13 @@ var LibProxy = class {
|
|
|
1487
1499
|
* Application extension.
|
|
1488
1500
|
*/
|
|
1489
1501
|
constructor(appExtension) {
|
|
1490
|
-
this
|
|
1502
|
+
this.#appExtension = appExtension;
|
|
1491
1503
|
}
|
|
1492
1504
|
/**
|
|
1493
1505
|
* Get the application extension.
|
|
1494
1506
|
*/
|
|
1495
1507
|
get appExtension() {
|
|
1496
|
-
return this
|
|
1508
|
+
return this.#appExtension;
|
|
1497
1509
|
}
|
|
1498
1510
|
/**
|
|
1499
1511
|
* Map big integer to another type if necessary.
|
|
@@ -1505,7 +1517,7 @@ var LibProxy = class {
|
|
|
1505
1517
|
* Mapped big integer value.
|
|
1506
1518
|
*/
|
|
1507
1519
|
mapBigInt(value) {
|
|
1508
|
-
return this.
|
|
1520
|
+
return this.#appExtension.mapBigInt(value);
|
|
1509
1521
|
}
|
|
1510
1522
|
/**
|
|
1511
1523
|
* Handle an error thrown by a function call.
|
|
@@ -1516,11 +1528,11 @@ var LibProxy = class {
|
|
|
1516
1528
|
* @returns
|
|
1517
1529
|
* Error if errors are not thrown.
|
|
1518
1530
|
*/
|
|
1519
|
-
handleError(e) {
|
|
1531
|
+
#handleError(e) {
|
|
1520
1532
|
let result;
|
|
1521
1533
|
if (e instanceof RangeError) {
|
|
1522
|
-
const error = this.
|
|
1523
|
-
if (this.
|
|
1534
|
+
const error = this.#appExtension.mapRangeError(e);
|
|
1535
|
+
if (this.#appExtension.throwError) {
|
|
1524
1536
|
throw error;
|
|
1525
1537
|
}
|
|
1526
1538
|
result = error;
|
|
@@ -1541,12 +1553,12 @@ var LibProxy = class {
|
|
|
1541
1553
|
* @returns
|
|
1542
1554
|
* Callback result or error if errors are not thrown.
|
|
1543
1555
|
*/
|
|
1544
|
-
doCallback(value, callback) {
|
|
1556
|
+
#doCallback(value, callback) {
|
|
1545
1557
|
let result;
|
|
1546
1558
|
try {
|
|
1547
1559
|
result = callback(value);
|
|
1548
1560
|
} catch (e) {
|
|
1549
|
-
result = this
|
|
1561
|
+
result = this.#handleError(e);
|
|
1550
1562
|
}
|
|
1551
1563
|
return result;
|
|
1552
1564
|
}
|
|
@@ -1563,7 +1575,7 @@ var LibProxy = class {
|
|
|
1563
1575
|
* Matrix of callback results and errors if errors are not thrown.
|
|
1564
1576
|
*/
|
|
1565
1577
|
mapMatrix(matrixValues, callback) {
|
|
1566
|
-
return matrixValues.map((rowValues) => rowValues.map((value) => this
|
|
1578
|
+
return matrixValues.map((rowValues) => rowValues.map((value) => this.#doCallback(value, callback)));
|
|
1567
1579
|
}
|
|
1568
1580
|
/**
|
|
1569
1581
|
* Do the callback for an array return.
|
|
@@ -1577,8 +1589,8 @@ var LibProxy = class {
|
|
|
1577
1589
|
* @returns
|
|
1578
1590
|
* Callback result or error as array if errors are not thrown.
|
|
1579
1591
|
*/
|
|
1580
|
-
doArrayCallback(value, callback) {
|
|
1581
|
-
const result = this
|
|
1592
|
+
#doArrayCallback(value, callback) {
|
|
1593
|
+
const result = this.#doCallback(value, callback);
|
|
1582
1594
|
return result instanceof Array ? result : [result];
|
|
1583
1595
|
}
|
|
1584
1596
|
/**
|
|
@@ -1600,7 +1612,7 @@ var LibProxy = class {
|
|
|
1600
1612
|
} else if (matrixValues.length === 1) {
|
|
1601
1613
|
matrixResultError = [];
|
|
1602
1614
|
matrixValues[0].forEach((value, columnIndex) => {
|
|
1603
|
-
const arrayResultError = this
|
|
1615
|
+
const arrayResultError = this.#doArrayCallback(value, callback);
|
|
1604
1616
|
arrayResultError.forEach((resultError, rowIndex) => {
|
|
1605
1617
|
if (matrixResultError.length <= rowIndex) {
|
|
1606
1618
|
matrixResultError.push([]);
|
|
@@ -1614,9 +1626,9 @@ var LibProxy = class {
|
|
|
1614
1626
|
if (rowValue.length === 0) {
|
|
1615
1627
|
arrayResultError = [];
|
|
1616
1628
|
} else if (rowValue.length === 1) {
|
|
1617
|
-
arrayResultError = this
|
|
1629
|
+
arrayResultError = this.#doArrayCallback(rowValue[0], callback);
|
|
1618
1630
|
} else {
|
|
1619
|
-
arrayResultError = [this
|
|
1631
|
+
arrayResultError = [this.#handleError(new RangeError(i18nextAppExtension.t("Proxy.matrixMustBeArray")))];
|
|
1620
1632
|
}
|
|
1621
1633
|
return arrayResultError;
|
|
1622
1634
|
});
|
|
@@ -1801,49 +1813,21 @@ var spillMaximumHeightParameterDescriptor = {
|
|
|
1801
1813
|
sortOrder: 1,
|
|
1802
1814
|
name: "spillMaximumHeight"
|
|
1803
1815
|
};
|
|
1816
|
+
var _AppUtilityProxy_instances, defaultMaximums_fn;
|
|
1804
1817
|
var AppUtilityProxy = class extends LibProxy {
|
|
1818
|
+
constructor() {
|
|
1819
|
+
super(...arguments);
|
|
1820
|
+
__privateAdd(this, _AppUtilityProxy_instances);
|
|
1821
|
+
}
|
|
1805
1822
|
version() {
|
|
1806
1823
|
return this.appExtension.version;
|
|
1807
1824
|
}
|
|
1808
|
-
/**
|
|
1809
|
-
* Provide default values for maximum width and height if required.
|
|
1810
|
-
*
|
|
1811
|
-
* @param maximumDimensions
|
|
1812
|
-
* Maximum dimensions provided to function.
|
|
1813
|
-
*
|
|
1814
|
-
* @param invocationContext
|
|
1815
|
-
* Invocation context.
|
|
1816
|
-
*
|
|
1817
|
-
* @returns
|
|
1818
|
-
* Array of maximum width and maximum height.
|
|
1819
|
-
*/
|
|
1820
|
-
async defaultMaximums(maximumDimensions, invocationContext) {
|
|
1821
|
-
if ((0, import_core2.isNullish)(invocationContext)) {
|
|
1822
|
-
throw new Error("Invocation context not provided by application");
|
|
1823
|
-
}
|
|
1824
|
-
const maximumWidth = maximumDimensions.width;
|
|
1825
|
-
const maximumHeight = maximumDimensions.height;
|
|
1826
|
-
let definedMaximumWidth;
|
|
1827
|
-
let definedMaximumHeight;
|
|
1828
|
-
if ((0, import_core2.isNullish)(maximumWidth) || (0, import_core2.isNullish)(maximumHeight)) {
|
|
1829
|
-
const sheetAddress = await this.appExtension.getSheetAddress(invocationContext);
|
|
1830
|
-
definedMaximumWidth = maximumWidth ?? await this.appExtension.maximumWidth() - sheetAddress.columnIndex;
|
|
1831
|
-
definedMaximumHeight = maximumHeight ?? await this.appExtension.maximumHeight() - sheetAddress.rowIndex;
|
|
1832
|
-
} else {
|
|
1833
|
-
definedMaximumWidth = maximumWidth;
|
|
1834
|
-
definedMaximumHeight = maximumHeight;
|
|
1835
|
-
}
|
|
1836
|
-
return {
|
|
1837
|
-
width: definedMaximumWidth,
|
|
1838
|
-
height: definedMaximumHeight
|
|
1839
|
-
};
|
|
1840
|
-
}
|
|
1841
1825
|
async vSpill(hMatrixValues, maximumWidth, maximumHeight, invocationContext) {
|
|
1842
1826
|
let result;
|
|
1843
1827
|
if (hMatrixValues.length !== 1) {
|
|
1844
1828
|
throw new RangeError(i18nextAppExtension.t("Proxy.vSpillMustBeHorizontalArray"));
|
|
1845
1829
|
}
|
|
1846
|
-
const maximumDimensions = await this.
|
|
1830
|
+
const maximumDimensions = await __privateMethod(this, _AppUtilityProxy_instances, defaultMaximums_fn).call(this, {
|
|
1847
1831
|
width: maximumWidth,
|
|
1848
1832
|
height: maximumHeight
|
|
1849
1833
|
}, invocationContext);
|
|
@@ -1877,7 +1861,7 @@ var AppUtilityProxy = class extends LibProxy {
|
|
|
1877
1861
|
throw new RangeError(i18nextAppExtension.t("Proxy.hSpillMustBeVerticalArray"));
|
|
1878
1862
|
}
|
|
1879
1863
|
}
|
|
1880
|
-
const maximumDimensions = await this.
|
|
1864
|
+
const maximumDimensions = await __privateMethod(this, _AppUtilityProxy_instances, defaultMaximums_fn).call(this, {
|
|
1881
1865
|
width: maximumWidth,
|
|
1882
1866
|
height: maximumHeight
|
|
1883
1867
|
}, invocationContext);
|
|
@@ -1905,6 +1889,28 @@ var AppUtilityProxy = class extends LibProxy {
|
|
|
1905
1889
|
return result;
|
|
1906
1890
|
}
|
|
1907
1891
|
};
|
|
1892
|
+
_AppUtilityProxy_instances = new WeakSet();
|
|
1893
|
+
defaultMaximums_fn = async function(maximumDimensions, invocationContext) {
|
|
1894
|
+
if ((0, import_core2.isNullish)(invocationContext)) {
|
|
1895
|
+
throw new Error("Invocation context not provided by application");
|
|
1896
|
+
}
|
|
1897
|
+
const maximumWidth = maximumDimensions.width;
|
|
1898
|
+
const maximumHeight = maximumDimensions.height;
|
|
1899
|
+
let definedMaximumWidth;
|
|
1900
|
+
let definedMaximumHeight;
|
|
1901
|
+
if ((0, import_core2.isNullish)(maximumWidth) || (0, import_core2.isNullish)(maximumHeight)) {
|
|
1902
|
+
const sheetAddress = await this.appExtension.getSheetAddress(invocationContext);
|
|
1903
|
+
definedMaximumWidth = maximumWidth ?? await this.appExtension.maximumWidth() - sheetAddress.columnIndex;
|
|
1904
|
+
definedMaximumHeight = maximumHeight ?? await this.appExtension.maximumHeight() - sheetAddress.rowIndex;
|
|
1905
|
+
} else {
|
|
1906
|
+
definedMaximumWidth = maximumWidth;
|
|
1907
|
+
definedMaximumHeight = maximumHeight;
|
|
1908
|
+
}
|
|
1909
|
+
return {
|
|
1910
|
+
width: definedMaximumWidth,
|
|
1911
|
+
height: definedMaximumHeight
|
|
1912
|
+
};
|
|
1913
|
+
};
|
|
1908
1914
|
__decorateClass([
|
|
1909
1915
|
ProxyMethod({
|
|
1910
1916
|
type: Types.String,
|
|
@@ -1935,6 +1941,19 @@ AppUtilityProxy = __decorateClass([
|
|
|
1935
1941
|
ProxyClass()
|
|
1936
1942
|
], AppUtilityProxy);
|
|
1937
1943
|
|
|
1944
|
+
// src/utility/index.ts
|
|
1945
|
+
var utility_exports = {};
|
|
1946
|
+
__export(utility_exports, {
|
|
1947
|
+
AlphabeticProxy: () => AlphabeticProxy,
|
|
1948
|
+
AlphanumericProxy: () => AlphanumericProxy,
|
|
1949
|
+
CharacterSetCreatorProxy: () => CharacterSetCreatorProxy,
|
|
1950
|
+
CharacterSetValidatorProxy: () => CharacterSetValidatorProxy,
|
|
1951
|
+
HexadecimalProxy: () => HexadecimalProxy,
|
|
1952
|
+
NumericProxy: () => NumericProxy,
|
|
1953
|
+
RegExpProxy: () => RegExpProxy,
|
|
1954
|
+
TransformerProxy: () => TransformerProxy
|
|
1955
|
+
});
|
|
1956
|
+
|
|
1938
1957
|
// src/utility/transformer-proxy.ts
|
|
1939
1958
|
var import_utility3 = require("@aidc-toolkit/utility");
|
|
1940
1959
|
|
|
@@ -2140,13 +2159,13 @@ var valueForSParameterDescriptor = {
|
|
|
2140
2159
|
name: "valueForS"
|
|
2141
2160
|
};
|
|
2142
2161
|
var CharacterSetValidatorProxy = class extends StringProxy {
|
|
2143
|
-
|
|
2162
|
+
#characterSetValidator;
|
|
2144
2163
|
constructor(appExtension, characterSetValidator) {
|
|
2145
2164
|
super(appExtension);
|
|
2146
|
-
this
|
|
2165
|
+
this.#characterSetValidator = characterSetValidator;
|
|
2147
2166
|
}
|
|
2148
2167
|
validate(matrixSs, exclusion) {
|
|
2149
|
-
return this.validateString(this
|
|
2168
|
+
return this.validateString(this.#characterSetValidator, matrixSs, {
|
|
2150
2169
|
exclusion: exclusion ?? void 0
|
|
2151
2170
|
});
|
|
2152
2171
|
}
|
|
@@ -2171,26 +2190,26 @@ __decorateClass([
|
|
|
2171
2190
|
__decorateParam(1, ProxyParameter(exclusionNoneParameterDescriptor))
|
|
2172
2191
|
], CharacterSetValidatorProxy.prototype, "isValid", 1);
|
|
2173
2192
|
var CharacterSetCreatorProxy = class extends CharacterSetValidatorProxy {
|
|
2174
|
-
|
|
2193
|
+
#characterSetCreator;
|
|
2175
2194
|
constructor(appExtension, characterSetCreator) {
|
|
2176
2195
|
super(appExtension, characterSetCreator);
|
|
2177
|
-
this
|
|
2196
|
+
this.#characterSetCreator = characterSetCreator;
|
|
2178
2197
|
}
|
|
2179
2198
|
create(length, matrixValues, exclusion, tweak) {
|
|
2180
2199
|
const exclusionOrUndefined = exclusion ?? void 0;
|
|
2181
2200
|
const tweakOrUndefined = tweak ?? void 0;
|
|
2182
|
-
return this.mapMatrix(matrixValues, (value) => this.
|
|
2201
|
+
return this.mapMatrix(matrixValues, (value) => this.#characterSetCreator.create(length, value, exclusionOrUndefined, tweakOrUndefined));
|
|
2183
2202
|
}
|
|
2184
2203
|
createSequence(length, startValue, count, exclusion, tweak) {
|
|
2185
2204
|
this.appExtension.validateSequenceCount(count);
|
|
2186
2205
|
const exclusionOrUndefined = exclusion ?? void 0;
|
|
2187
2206
|
const tweakOrUndefined = tweak ?? void 0;
|
|
2188
|
-
return LibProxy.matrixResult(this.
|
|
2207
|
+
return LibProxy.matrixResult(this.#characterSetCreator.create(length, new import_utility5.Sequence(startValue, count), exclusionOrUndefined, tweakOrUndefined));
|
|
2189
2208
|
}
|
|
2190
2209
|
valueFor(matrixSs, exclusion, tweak) {
|
|
2191
2210
|
const exclusionOrUndefined = exclusion ?? void 0;
|
|
2192
2211
|
const tweakOrUndefined = tweak ?? void 0;
|
|
2193
|
-
return this.mapMatrix(matrixSs, (s) => this.mapBigInt(this.
|
|
2212
|
+
return this.mapMatrix(matrixSs, (s) => this.mapBigInt(this.#characterSetCreator.valueFor(s, exclusionOrUndefined, tweakOrUndefined)));
|
|
2194
2213
|
}
|
|
2195
2214
|
};
|
|
2196
2215
|
__decorateClass([
|
|
@@ -2492,13 +2511,13 @@ var validateIdentifierParameterDescriptor = {
|
|
|
2492
2511
|
name: "validateIdentifier"
|
|
2493
2512
|
};
|
|
2494
2513
|
var IdentifierValidatorProxy = class extends StringProxy {
|
|
2495
|
-
|
|
2514
|
+
#validator;
|
|
2496
2515
|
constructor(appExtension, validator) {
|
|
2497
2516
|
super(appExtension);
|
|
2498
|
-
this
|
|
2517
|
+
this.#validator = validator;
|
|
2499
2518
|
}
|
|
2500
2519
|
get validator() {
|
|
2501
|
-
return this
|
|
2520
|
+
return this.#validator;
|
|
2502
2521
|
}
|
|
2503
2522
|
};
|
|
2504
2523
|
var NumericIdentifierValidatorProxy = class extends IdentifierValidatorProxy {
|
|
@@ -2517,6 +2536,8 @@ var GTINValidatorProxy = class extends NumericIdentifierValidatorProxy {
|
|
|
2517
2536
|
};
|
|
2518
2537
|
var NonGTINNumericIdentifierValidatorProxy = class extends NumericIdentifierValidatorProxy {
|
|
2519
2538
|
};
|
|
2539
|
+
var NonSerializableNumericIdentifierValidatorProxy = class extends NonGTINNumericIdentifierValidatorProxy {
|
|
2540
|
+
};
|
|
2520
2541
|
var SerializableNumericIdentifierValidatorProxy = class extends NonGTINNumericIdentifierValidatorProxy {
|
|
2521
2542
|
};
|
|
2522
2543
|
var NonNumericIdentifierValidatorProxy = class extends IdentifierValidatorProxy {
|
|
@@ -2536,7 +2557,7 @@ __decorateClass([
|
|
|
2536
2557
|
], NonNumericIdentifierValidatorProxy.prototype, "validate", 1);
|
|
2537
2558
|
var GTIN13ValidatorProxy = class extends GTINValidatorProxy {
|
|
2538
2559
|
constructor(appExtension) {
|
|
2539
|
-
super(appExtension, import_gs14.IdentifierValidators.GTIN[import_gs14.
|
|
2560
|
+
super(appExtension, import_gs14.IdentifierValidators.GTIN[import_gs14.GTINLengths.GTIN13]);
|
|
2540
2561
|
}
|
|
2541
2562
|
};
|
|
2542
2563
|
GTIN13ValidatorProxy = __decorateClass([
|
|
@@ -2547,7 +2568,7 @@ GTIN13ValidatorProxy = __decorateClass([
|
|
|
2547
2568
|
], GTIN13ValidatorProxy);
|
|
2548
2569
|
var GTIN12ValidatorProxy = class extends GTINValidatorProxy {
|
|
2549
2570
|
constructor(appExtension) {
|
|
2550
|
-
super(appExtension, import_gs14.IdentifierValidators.GTIN[import_gs14.
|
|
2571
|
+
super(appExtension, import_gs14.IdentifierValidators.GTIN[import_gs14.GTINLengths.GTIN12]);
|
|
2551
2572
|
}
|
|
2552
2573
|
};
|
|
2553
2574
|
GTIN12ValidatorProxy = __decorateClass([
|
|
@@ -2558,7 +2579,7 @@ GTIN12ValidatorProxy = __decorateClass([
|
|
|
2558
2579
|
], GTIN12ValidatorProxy);
|
|
2559
2580
|
var GTIN8ValidatorProxy = class extends GTINValidatorProxy {
|
|
2560
2581
|
constructor(appExtension) {
|
|
2561
|
-
super(appExtension, import_gs14.IdentifierValidators.GTIN[import_gs14.
|
|
2582
|
+
super(appExtension, import_gs14.IdentifierValidators.GTIN[import_gs14.GTINLengths.GTIN8]);
|
|
2562
2583
|
}
|
|
2563
2584
|
};
|
|
2564
2585
|
GTIN8ValidatorProxy = __decorateClass([
|
|
@@ -2715,7 +2736,7 @@ GTINValidatorStaticProxy = __decorateClass([
|
|
|
2715
2736
|
namespace: "GS1"
|
|
2716
2737
|
})
|
|
2717
2738
|
], GTINValidatorStaticProxy);
|
|
2718
|
-
var GLNValidatorProxy = class extends
|
|
2739
|
+
var GLNValidatorProxy = class extends NonSerializableNumericIdentifierValidatorProxy {
|
|
2719
2740
|
constructor(appExtension) {
|
|
2720
2741
|
super(appExtension, import_gs14.IdentifierValidators.GLN);
|
|
2721
2742
|
}
|
|
@@ -2726,7 +2747,7 @@ GLNValidatorProxy = __decorateClass([
|
|
|
2726
2747
|
methodInfix: "GLN"
|
|
2727
2748
|
})
|
|
2728
2749
|
], GLNValidatorProxy);
|
|
2729
|
-
var SSCCValidatorProxy = class extends
|
|
2750
|
+
var SSCCValidatorProxy = class extends NonSerializableNumericIdentifierValidatorProxy {
|
|
2730
2751
|
constructor(appExtension) {
|
|
2731
2752
|
super(appExtension, import_gs14.IdentifierValidators.SSCC);
|
|
2732
2753
|
}
|
|
@@ -2759,7 +2780,7 @@ GIAIValidatorProxy = __decorateClass([
|
|
|
2759
2780
|
methodInfix: "GIAI"
|
|
2760
2781
|
})
|
|
2761
2782
|
], GIAIValidatorProxy);
|
|
2762
|
-
var GSRNValidatorProxy = class extends
|
|
2783
|
+
var GSRNValidatorProxy = class extends NonSerializableNumericIdentifierValidatorProxy {
|
|
2763
2784
|
constructor(appExtension) {
|
|
2764
2785
|
super(appExtension, import_gs14.IdentifierValidators.GSRN);
|
|
2765
2786
|
}
|
|
@@ -2792,7 +2813,7 @@ GINCValidatorProxy = __decorateClass([
|
|
|
2792
2813
|
methodInfix: "GINC"
|
|
2793
2814
|
})
|
|
2794
2815
|
], GINCValidatorProxy);
|
|
2795
|
-
var GSINValidatorProxy = class extends
|
|
2816
|
+
var GSINValidatorProxy = class extends NonSerializableNumericIdentifierValidatorProxy {
|
|
2796
2817
|
constructor(appExtension) {
|
|
2797
2818
|
super(appExtension, import_gs14.IdentifierValidators.GSIN);
|
|
2798
2819
|
}
|
|
@@ -2888,11 +2909,11 @@ PrefixManagerProxy = __decorateClass([
|
|
|
2888
2909
|
})
|
|
2889
2910
|
], PrefixManagerProxy);
|
|
2890
2911
|
var IdentifierCreatorProxy = class _IdentifierCreatorProxy extends LibProxy {
|
|
2891
|
-
static PREFIX_TYPES = [import_gs14.PrefixTypes.GS1CompanyPrefix, import_gs14.PrefixTypes.UPCCompanyPrefix, import_gs14.PrefixTypes.GS18Prefix];
|
|
2892
|
-
|
|
2912
|
+
static #PREFIX_TYPES = [import_gs14.PrefixTypes.GS1CompanyPrefix, import_gs14.PrefixTypes.UPCCompanyPrefix, import_gs14.PrefixTypes.GS18Prefix];
|
|
2913
|
+
#getCreator;
|
|
2893
2914
|
constructor(appExtension, getCreator) {
|
|
2894
2915
|
super(appExtension);
|
|
2895
|
-
this
|
|
2916
|
+
this.#getCreator = getCreator;
|
|
2896
2917
|
}
|
|
2897
2918
|
getCreator(prefixDefinition) {
|
|
2898
2919
|
const reducedPrefixDefinition = prefixDefinition.length === 1 ? (
|
|
@@ -2915,12 +2936,12 @@ var IdentifierCreatorProxy = class _IdentifierCreatorProxy extends LibProxy {
|
|
|
2915
2936
|
throw new RangeError(i18nextAppExtension.t("IdentifierCreatorProxy.prefixMustBeString"));
|
|
2916
2937
|
}
|
|
2917
2938
|
const prefixTypeIndex = reducedPrefixDefinition[1] ?? 0;
|
|
2918
|
-
if (typeof prefixTypeIndex !== "number" || prefixTypeIndex < 0 || prefixTypeIndex >= _IdentifierCreatorProxy
|
|
2939
|
+
if (typeof prefixTypeIndex !== "number" || prefixTypeIndex < 0 || prefixTypeIndex >= _IdentifierCreatorProxy.#PREFIX_TYPES.length) {
|
|
2919
2940
|
throw new RangeError(i18nextAppExtension.t("IdentifierCreatorProxy.prefixTypeMustBeNumber", {
|
|
2920
|
-
maximumPrefixType: _IdentifierCreatorProxy
|
|
2941
|
+
maximumPrefixType: _IdentifierCreatorProxy.#PREFIX_TYPES.length - 1
|
|
2921
2942
|
}));
|
|
2922
2943
|
}
|
|
2923
|
-
const prefixType = _IdentifierCreatorProxy
|
|
2944
|
+
const prefixType = _IdentifierCreatorProxy.#PREFIX_TYPES[prefixTypeIndex];
|
|
2924
2945
|
if (prefixType === void 0) {
|
|
2925
2946
|
throw new RangeError(i18nextAppExtension.t("IdentifierCreatorProxy.invalidPrefixType"));
|
|
2926
2947
|
}
|
|
@@ -2934,7 +2955,7 @@ var IdentifierCreatorProxy = class _IdentifierCreatorProxy extends LibProxy {
|
|
|
2934
2955
|
} else {
|
|
2935
2956
|
prefixManager.resetTweakFactor();
|
|
2936
2957
|
}
|
|
2937
|
-
return this
|
|
2958
|
+
return this.#getCreator(prefixManager);
|
|
2938
2959
|
}
|
|
2939
2960
|
};
|
|
2940
2961
|
var sparseParameterDescriptor = {
|
|
@@ -2988,6 +3009,8 @@ __decorateClass([
|
|
|
2988
3009
|
], NumericIdentifierCreatorProxy.prototype, "createAll", 1);
|
|
2989
3010
|
var NonGTINNumericIdentifierCreatorProxy = class extends NumericIdentifierCreatorProxy {
|
|
2990
3011
|
};
|
|
3012
|
+
var NonSerializableNumericIdentifierCreatorProxy = class extends NonGTINNumericIdentifierCreatorProxy {
|
|
3013
|
+
};
|
|
2991
3014
|
var singleValueParameterDescriptor = {
|
|
2992
3015
|
extendsDescriptor: valueParameterDescriptor,
|
|
2993
3016
|
isMatrix: false
|
|
@@ -3098,7 +3121,7 @@ GTINCreatorProxy = __decorateClass([
|
|
|
3098
3121
|
]
|
|
3099
3122
|
})
|
|
3100
3123
|
], GTINCreatorProxy);
|
|
3101
|
-
var GLNCreatorProxy = class extends
|
|
3124
|
+
var GLNCreatorProxy = class extends NonSerializableNumericIdentifierCreatorProxy {
|
|
3102
3125
|
constructor(appExtension) {
|
|
3103
3126
|
super(appExtension, (prefixManager) => prefixManager.glnCreator);
|
|
3104
3127
|
}
|
|
@@ -3109,7 +3132,7 @@ GLNCreatorProxy = __decorateClass([
|
|
|
3109
3132
|
methodInfix: "GLN"
|
|
3110
3133
|
})
|
|
3111
3134
|
], GLNCreatorProxy);
|
|
3112
|
-
var SSCCCreatorProxy = class extends
|
|
3135
|
+
var SSCCCreatorProxy = class extends NonSerializableNumericIdentifierCreatorProxy {
|
|
3113
3136
|
constructor(appExtension) {
|
|
3114
3137
|
super(appExtension, (prefixManager) => prefixManager.ssccCreator);
|
|
3115
3138
|
}
|
|
@@ -3142,7 +3165,7 @@ GIAICreatorProxy = __decorateClass([
|
|
|
3142
3165
|
methodInfix: "GIAI"
|
|
3143
3166
|
})
|
|
3144
3167
|
], GIAICreatorProxy);
|
|
3145
|
-
var GSRNCreatorProxy = class extends
|
|
3168
|
+
var GSRNCreatorProxy = class extends NonSerializableNumericIdentifierCreatorProxy {
|
|
3146
3169
|
constructor(appExtension) {
|
|
3147
3170
|
super(appExtension, (prefixManager) => prefixManager.gsrnCreator);
|
|
3148
3171
|
}
|
|
@@ -3175,7 +3198,7 @@ GINCCreatorProxy = __decorateClass([
|
|
|
3175
3198
|
methodInfix: "GINC"
|
|
3176
3199
|
})
|
|
3177
3200
|
], GINCCreatorProxy);
|
|
3178
|
-
var GSINCreatorProxy = class extends
|
|
3201
|
+
var GSINCreatorProxy = class extends NonSerializableNumericIdentifierCreatorProxy {
|
|
3179
3202
|
constructor(appExtension) {
|
|
3180
3203
|
super(appExtension, (prefixManager) => prefixManager.gsinCreator);
|
|
3181
3204
|
}
|
|
@@ -3222,31 +3245,34 @@ GMNCreatorProxy = __decorateClass([
|
|
|
3222
3245
|
|
|
3223
3246
|
// src/generator/generator.ts
|
|
3224
3247
|
var import_core4 = require("@aidc-toolkit/core");
|
|
3248
|
+
function registerProxies(..._proxies) {
|
|
3249
|
+
}
|
|
3250
|
+
registerProxies(AppUtilityProxy, utility_exports, gs1_exports);
|
|
3225
3251
|
var Generator = class _Generator {
|
|
3226
3252
|
/**
|
|
3227
3253
|
* Documentation base URL.
|
|
3228
3254
|
*/
|
|
3229
|
-
static DOCUMENTATION_BASE_URL = "https://aidc-toolkit.com/";
|
|
3255
|
+
static #DOCUMENTATION_BASE_URL = "https://aidc-toolkit.com/";
|
|
3230
3256
|
/**
|
|
3231
3257
|
* Documentation path, optionally preceded by locale.
|
|
3232
3258
|
*/
|
|
3233
|
-
static DOCUMENTATION_PATH = "app-extension/";
|
|
3259
|
+
static #DOCUMENTATION_PATH = "app-extension/";
|
|
3234
3260
|
/**
|
|
3235
3261
|
* Locales.
|
|
3236
3262
|
*/
|
|
3237
|
-
|
|
3263
|
+
#locales;
|
|
3238
3264
|
/**
|
|
3239
3265
|
* Default locale.
|
|
3240
3266
|
*/
|
|
3241
|
-
|
|
3267
|
+
#defaultLocale;
|
|
3242
3268
|
/**
|
|
3243
3269
|
* Map of function localizations maps by namespace function name.
|
|
3244
3270
|
*/
|
|
3245
|
-
|
|
3271
|
+
#functionLocalizationsMapsMap = /* @__PURE__ */ new Map();
|
|
3246
3272
|
/**
|
|
3247
3273
|
* Map of parameter localizations maps by namespace function parameter name.
|
|
3248
3274
|
*/
|
|
3249
|
-
|
|
3275
|
+
#parameterLocalizationsMapsMap = /* @__PURE__ */ new Map();
|
|
3250
3276
|
/**
|
|
3251
3277
|
*
|
|
3252
3278
|
*/
|
|
@@ -3257,20 +3283,20 @@ var Generator = class _Generator {
|
|
|
3257
3283
|
* Include localizations if true.
|
|
3258
3284
|
*/
|
|
3259
3285
|
constructor(includeLocalizations = true) {
|
|
3260
|
-
this
|
|
3261
|
-
this
|
|
3286
|
+
this.#locales = includeLocalizations ? Object.keys(appExtensionResources) : [];
|
|
3287
|
+
this.#defaultLocale = this.#locales[0] ?? "";
|
|
3262
3288
|
}
|
|
3263
3289
|
/**
|
|
3264
3290
|
* Get the locales.
|
|
3265
3291
|
*/
|
|
3266
3292
|
get locales() {
|
|
3267
|
-
return this
|
|
3293
|
+
return this.#locales;
|
|
3268
3294
|
}
|
|
3269
3295
|
/**
|
|
3270
3296
|
* Get the default locale.
|
|
3271
3297
|
*/
|
|
3272
3298
|
get defaultLocale() {
|
|
3273
|
-
return this
|
|
3299
|
+
return this.#defaultLocale;
|
|
3274
3300
|
}
|
|
3275
3301
|
/**
|
|
3276
3302
|
* Get function localization.
|
|
@@ -3285,9 +3311,9 @@ var Generator = class _Generator {
|
|
|
3285
3311
|
* Function localization.
|
|
3286
3312
|
*/
|
|
3287
3313
|
getFunctionLocalization(namespaceFunctionName, locale) {
|
|
3288
|
-
const functionLocalization = this.
|
|
3314
|
+
const functionLocalization = this.#functionLocalizationsMapsMap.get(namespaceFunctionName)?.get(locale);
|
|
3289
3315
|
if (functionLocalization === void 0) {
|
|
3290
|
-
throw new Error(
|
|
3316
|
+
throw new Error(`${locale} localization for function ${namespaceFunctionName} not found`);
|
|
3291
3317
|
}
|
|
3292
3318
|
return functionLocalization;
|
|
3293
3319
|
}
|
|
@@ -3307,15 +3333,18 @@ var Generator = class _Generator {
|
|
|
3307
3333
|
* Function localization.
|
|
3308
3334
|
*/
|
|
3309
3335
|
getParameterLocalization(namespaceFunctionName, parameterName, locale) {
|
|
3310
|
-
const parameterLocalization = this.
|
|
3336
|
+
const parameterLocalization = this.#parameterLocalizationsMapsMap.get(`${namespaceFunctionName}.${parameterName}`)?.get(locale);
|
|
3311
3337
|
if (parameterLocalization === void 0) {
|
|
3312
|
-
throw new Error(
|
|
3338
|
+
throw new Error(`${locale} localization for function ${namespaceFunctionName} parameter ${parameterName} not found`);
|
|
3313
3339
|
}
|
|
3314
3340
|
return parameterLocalization;
|
|
3315
3341
|
}
|
|
3316
3342
|
/**
|
|
3317
3343
|
* Generate localizations map.
|
|
3318
3344
|
*
|
|
3345
|
+
* @template TLocalization
|
|
3346
|
+
* Localization type.
|
|
3347
|
+
*
|
|
3319
3348
|
* @param localizedKeyPrefix
|
|
3320
3349
|
* Localized key prefix.
|
|
3321
3350
|
*
|
|
@@ -3325,8 +3354,8 @@ var Generator = class _Generator {
|
|
|
3325
3354
|
* @returns
|
|
3326
3355
|
* Localization map.
|
|
3327
3356
|
*/
|
|
3328
|
-
generateLocalizationsMap(localizedKeyPrefix, localizationCallback) {
|
|
3329
|
-
return new Map(this.
|
|
3357
|
+
#generateLocalizationsMap(localizedKeyPrefix, localizationCallback) {
|
|
3358
|
+
return new Map(this.#locales.map((locale) => {
|
|
3330
3359
|
const lngOption = {
|
|
3331
3360
|
lng: locale
|
|
3332
3361
|
};
|
|
@@ -3375,16 +3404,16 @@ var Generator = class _Generator {
|
|
|
3375
3404
|
} else {
|
|
3376
3405
|
const insertIndex = methodName.indexOf(infixBefore);
|
|
3377
3406
|
if (insertIndex === -1) {
|
|
3378
|
-
throw new Error(`Cannot find "${infixBefore}" in method
|
|
3407
|
+
throw new Error(`Cannot find "${infixBefore}" in method ${methodName}`);
|
|
3379
3408
|
}
|
|
3380
3409
|
functionName = `${methodName.substring(0, insertIndex)}${methodInfix}${methodName.substring(insertIndex)}`;
|
|
3381
3410
|
}
|
|
3382
3411
|
const namespaceFunctionName = `${namespacePrefix}${functionName}`;
|
|
3383
|
-
const functionLocalizationsMap = this
|
|
3412
|
+
const functionLocalizationsMap = this.#generateLocalizationsMap(`Functions.${namespaceFunctionName}.`, (locale, localization) => ({
|
|
3384
3413
|
...localization,
|
|
3385
|
-
documentationURL: `${_Generator
|
|
3414
|
+
documentationURL: `${_Generator.#DOCUMENTATION_BASE_URL}${locale === this.defaultLocale ? "" : `${locale}/`}${_Generator.#DOCUMENTATION_PATH}${namespace === void 0 ? "" : `${namespace}/`}${localization.name}.html`
|
|
3386
3415
|
}));
|
|
3387
|
-
this.
|
|
3416
|
+
this.#functionLocalizationsMapsMap.set(namespaceFunctionName, functionLocalizationsMap);
|
|
3388
3417
|
this.createProxyFunction({
|
|
3389
3418
|
...proxyObjectDescriptor,
|
|
3390
3419
|
functionName,
|
|
@@ -3393,8 +3422,8 @@ var Generator = class _Generator {
|
|
|
3393
3422
|
proxyParameterDescriptors: methodDescriptor.parameterDescriptors.map((parameterDescriptor) => {
|
|
3394
3423
|
const expandedParameterDescriptor = expandParameterDescriptor(parameterDescriptor);
|
|
3395
3424
|
const parameterName = expandedParameterDescriptor.name;
|
|
3396
|
-
const parameterLocalizationsMap = this
|
|
3397
|
-
this.
|
|
3425
|
+
const parameterLocalizationsMap = this.#generateLocalizationsMap(`Parameters.${parameterName}.`, (_locale, localization) => localization);
|
|
3426
|
+
this.#parameterLocalizationsMapsMap.set(`${namespaceFunctionName}.${parameterName}`, parameterLocalizationsMap);
|
|
3398
3427
|
return {
|
|
3399
3428
|
namespace,
|
|
3400
3429
|
parameterName,
|