@aidc-toolkit/app-extension 1.0.26-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 +127 -114
- 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 +128 -115
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/app-extension.ts +28 -19
- package/src/app-utility-proxy.ts +15 -3
- package/src/descriptor.ts +61 -1
- package/src/generator/descriptor.ts +5 -2
- package/src/generator/generator.ts +22 -19
- package/src/generator/locale-resources-generator.ts +29 -29
- package/src/gs1/identifier-proxy.ts +37 -36
- package/src/lib-proxy.ts +21 -18
- package/src/utility/character-set-proxy.ts +8 -8
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,
|
|
@@ -2108,13 +2114,13 @@ var valueForSParameterDescriptor = {
|
|
|
2108
2114
|
name: "valueForS"
|
|
2109
2115
|
};
|
|
2110
2116
|
var CharacterSetValidatorProxy = class extends StringProxy {
|
|
2111
|
-
|
|
2117
|
+
#characterSetValidator;
|
|
2112
2118
|
constructor(appExtension, characterSetValidator) {
|
|
2113
2119
|
super(appExtension);
|
|
2114
|
-
this
|
|
2120
|
+
this.#characterSetValidator = characterSetValidator;
|
|
2115
2121
|
}
|
|
2116
2122
|
validate(matrixSs, exclusion) {
|
|
2117
|
-
return this.validateString(this
|
|
2123
|
+
return this.validateString(this.#characterSetValidator, matrixSs, {
|
|
2118
2124
|
exclusion: exclusion ?? void 0
|
|
2119
2125
|
});
|
|
2120
2126
|
}
|
|
@@ -2139,26 +2145,26 @@ __decorateClass([
|
|
|
2139
2145
|
__decorateParam(1, ProxyParameter(exclusionNoneParameterDescriptor))
|
|
2140
2146
|
], CharacterSetValidatorProxy.prototype, "isValid", 1);
|
|
2141
2147
|
var CharacterSetCreatorProxy = class extends CharacterSetValidatorProxy {
|
|
2142
|
-
|
|
2148
|
+
#characterSetCreator;
|
|
2143
2149
|
constructor(appExtension, characterSetCreator) {
|
|
2144
2150
|
super(appExtension, characterSetCreator);
|
|
2145
|
-
this
|
|
2151
|
+
this.#characterSetCreator = characterSetCreator;
|
|
2146
2152
|
}
|
|
2147
2153
|
create(length, matrixValues, exclusion, tweak) {
|
|
2148
2154
|
const exclusionOrUndefined = exclusion ?? void 0;
|
|
2149
2155
|
const tweakOrUndefined = tweak ?? void 0;
|
|
2150
|
-
return this.mapMatrix(matrixValues, (value) => this.
|
|
2156
|
+
return this.mapMatrix(matrixValues, (value) => this.#characterSetCreator.create(length, value, exclusionOrUndefined, tweakOrUndefined));
|
|
2151
2157
|
}
|
|
2152
2158
|
createSequence(length, startValue, count, exclusion, tweak) {
|
|
2153
2159
|
this.appExtension.validateSequenceCount(count);
|
|
2154
2160
|
const exclusionOrUndefined = exclusion ?? void 0;
|
|
2155
2161
|
const tweakOrUndefined = tweak ?? void 0;
|
|
2156
|
-
return LibProxy.matrixResult(this.
|
|
2162
|
+
return LibProxy.matrixResult(this.#characterSetCreator.create(length, new Sequence2(startValue, count), exclusionOrUndefined, tweakOrUndefined));
|
|
2157
2163
|
}
|
|
2158
2164
|
valueFor(matrixSs, exclusion, tweak) {
|
|
2159
2165
|
const exclusionOrUndefined = exclusion ?? void 0;
|
|
2160
2166
|
const tweakOrUndefined = tweak ?? void 0;
|
|
2161
|
-
return this.mapMatrix(matrixSs, (s) => this.mapBigInt(this.
|
|
2167
|
+
return this.mapMatrix(matrixSs, (s) => this.mapBigInt(this.#characterSetCreator.valueFor(s, exclusionOrUndefined, tweakOrUndefined)));
|
|
2162
2168
|
}
|
|
2163
2169
|
};
|
|
2164
2170
|
__decorateClass([
|
|
@@ -2455,7 +2461,7 @@ CheckProxy = __decorateClass([
|
|
|
2455
2461
|
import { isNullish as isNullish2 } from "@aidc-toolkit/core";
|
|
2456
2462
|
import {
|
|
2457
2463
|
GTINCreator,
|
|
2458
|
-
|
|
2464
|
+
GTINLengths,
|
|
2459
2465
|
GTINValidator,
|
|
2460
2466
|
IdentifierValidators,
|
|
2461
2467
|
PrefixManager,
|
|
@@ -2475,13 +2481,13 @@ var validateIdentifierParameterDescriptor = {
|
|
|
2475
2481
|
name: "validateIdentifier"
|
|
2476
2482
|
};
|
|
2477
2483
|
var IdentifierValidatorProxy = class extends StringProxy {
|
|
2478
|
-
|
|
2484
|
+
#validator;
|
|
2479
2485
|
constructor(appExtension, validator) {
|
|
2480
2486
|
super(appExtension);
|
|
2481
|
-
this
|
|
2487
|
+
this.#validator = validator;
|
|
2482
2488
|
}
|
|
2483
2489
|
get validator() {
|
|
2484
|
-
return this
|
|
2490
|
+
return this.#validator;
|
|
2485
2491
|
}
|
|
2486
2492
|
};
|
|
2487
2493
|
var NumericIdentifierValidatorProxy = class extends IdentifierValidatorProxy {
|
|
@@ -2500,6 +2506,8 @@ var GTINValidatorProxy = class extends NumericIdentifierValidatorProxy {
|
|
|
2500
2506
|
};
|
|
2501
2507
|
var NonGTINNumericIdentifierValidatorProxy = class extends NumericIdentifierValidatorProxy {
|
|
2502
2508
|
};
|
|
2509
|
+
var NonSerializableNumericIdentifierValidatorProxy = class extends NonGTINNumericIdentifierValidatorProxy {
|
|
2510
|
+
};
|
|
2503
2511
|
var SerializableNumericIdentifierValidatorProxy = class extends NonGTINNumericIdentifierValidatorProxy {
|
|
2504
2512
|
};
|
|
2505
2513
|
var NonNumericIdentifierValidatorProxy = class extends IdentifierValidatorProxy {
|
|
@@ -2519,7 +2527,7 @@ __decorateClass([
|
|
|
2519
2527
|
], NonNumericIdentifierValidatorProxy.prototype, "validate", 1);
|
|
2520
2528
|
var GTIN13ValidatorProxy = class extends GTINValidatorProxy {
|
|
2521
2529
|
constructor(appExtension) {
|
|
2522
|
-
super(appExtension, IdentifierValidators.GTIN[
|
|
2530
|
+
super(appExtension, IdentifierValidators.GTIN[GTINLengths.GTIN13]);
|
|
2523
2531
|
}
|
|
2524
2532
|
};
|
|
2525
2533
|
GTIN13ValidatorProxy = __decorateClass([
|
|
@@ -2530,7 +2538,7 @@ GTIN13ValidatorProxy = __decorateClass([
|
|
|
2530
2538
|
], GTIN13ValidatorProxy);
|
|
2531
2539
|
var GTIN12ValidatorProxy = class extends GTINValidatorProxy {
|
|
2532
2540
|
constructor(appExtension) {
|
|
2533
|
-
super(appExtension, IdentifierValidators.GTIN[
|
|
2541
|
+
super(appExtension, IdentifierValidators.GTIN[GTINLengths.GTIN12]);
|
|
2534
2542
|
}
|
|
2535
2543
|
};
|
|
2536
2544
|
GTIN12ValidatorProxy = __decorateClass([
|
|
@@ -2541,7 +2549,7 @@ GTIN12ValidatorProxy = __decorateClass([
|
|
|
2541
2549
|
], GTIN12ValidatorProxy);
|
|
2542
2550
|
var GTIN8ValidatorProxy = class extends GTINValidatorProxy {
|
|
2543
2551
|
constructor(appExtension) {
|
|
2544
|
-
super(appExtension, IdentifierValidators.GTIN[
|
|
2552
|
+
super(appExtension, IdentifierValidators.GTIN[GTINLengths.GTIN8]);
|
|
2545
2553
|
}
|
|
2546
2554
|
};
|
|
2547
2555
|
GTIN8ValidatorProxy = __decorateClass([
|
|
@@ -2698,7 +2706,7 @@ GTINValidatorStaticProxy = __decorateClass([
|
|
|
2698
2706
|
namespace: "GS1"
|
|
2699
2707
|
})
|
|
2700
2708
|
], GTINValidatorStaticProxy);
|
|
2701
|
-
var GLNValidatorProxy = class extends
|
|
2709
|
+
var GLNValidatorProxy = class extends NonSerializableNumericIdentifierValidatorProxy {
|
|
2702
2710
|
constructor(appExtension) {
|
|
2703
2711
|
super(appExtension, IdentifierValidators.GLN);
|
|
2704
2712
|
}
|
|
@@ -2709,7 +2717,7 @@ GLNValidatorProxy = __decorateClass([
|
|
|
2709
2717
|
methodInfix: "GLN"
|
|
2710
2718
|
})
|
|
2711
2719
|
], GLNValidatorProxy);
|
|
2712
|
-
var SSCCValidatorProxy = class extends
|
|
2720
|
+
var SSCCValidatorProxy = class extends NonSerializableNumericIdentifierValidatorProxy {
|
|
2713
2721
|
constructor(appExtension) {
|
|
2714
2722
|
super(appExtension, IdentifierValidators.SSCC);
|
|
2715
2723
|
}
|
|
@@ -2742,7 +2750,7 @@ GIAIValidatorProxy = __decorateClass([
|
|
|
2742
2750
|
methodInfix: "GIAI"
|
|
2743
2751
|
})
|
|
2744
2752
|
], GIAIValidatorProxy);
|
|
2745
|
-
var GSRNValidatorProxy = class extends
|
|
2753
|
+
var GSRNValidatorProxy = class extends NonSerializableNumericIdentifierValidatorProxy {
|
|
2746
2754
|
constructor(appExtension) {
|
|
2747
2755
|
super(appExtension, IdentifierValidators.GSRN);
|
|
2748
2756
|
}
|
|
@@ -2775,7 +2783,7 @@ GINCValidatorProxy = __decorateClass([
|
|
|
2775
2783
|
methodInfix: "GINC"
|
|
2776
2784
|
})
|
|
2777
2785
|
], GINCValidatorProxy);
|
|
2778
|
-
var GSINValidatorProxy = class extends
|
|
2786
|
+
var GSINValidatorProxy = class extends NonSerializableNumericIdentifierValidatorProxy {
|
|
2779
2787
|
constructor(appExtension) {
|
|
2780
2788
|
super(appExtension, IdentifierValidators.GSIN);
|
|
2781
2789
|
}
|
|
@@ -2871,11 +2879,11 @@ PrefixManagerProxy = __decorateClass([
|
|
|
2871
2879
|
})
|
|
2872
2880
|
], PrefixManagerProxy);
|
|
2873
2881
|
var IdentifierCreatorProxy = class _IdentifierCreatorProxy extends LibProxy {
|
|
2874
|
-
static PREFIX_TYPES = [PrefixTypes.GS1CompanyPrefix, PrefixTypes.UPCCompanyPrefix, PrefixTypes.GS18Prefix];
|
|
2875
|
-
|
|
2882
|
+
static #PREFIX_TYPES = [PrefixTypes.GS1CompanyPrefix, PrefixTypes.UPCCompanyPrefix, PrefixTypes.GS18Prefix];
|
|
2883
|
+
#getCreator;
|
|
2876
2884
|
constructor(appExtension, getCreator) {
|
|
2877
2885
|
super(appExtension);
|
|
2878
|
-
this
|
|
2886
|
+
this.#getCreator = getCreator;
|
|
2879
2887
|
}
|
|
2880
2888
|
getCreator(prefixDefinition) {
|
|
2881
2889
|
const reducedPrefixDefinition = prefixDefinition.length === 1 ? (
|
|
@@ -2898,12 +2906,12 @@ var IdentifierCreatorProxy = class _IdentifierCreatorProxy extends LibProxy {
|
|
|
2898
2906
|
throw new RangeError(i18nextAppExtension.t("IdentifierCreatorProxy.prefixMustBeString"));
|
|
2899
2907
|
}
|
|
2900
2908
|
const prefixTypeIndex = reducedPrefixDefinition[1] ?? 0;
|
|
2901
|
-
if (typeof prefixTypeIndex !== "number" || prefixTypeIndex < 0 || prefixTypeIndex >= _IdentifierCreatorProxy
|
|
2909
|
+
if (typeof prefixTypeIndex !== "number" || prefixTypeIndex < 0 || prefixTypeIndex >= _IdentifierCreatorProxy.#PREFIX_TYPES.length) {
|
|
2902
2910
|
throw new RangeError(i18nextAppExtension.t("IdentifierCreatorProxy.prefixTypeMustBeNumber", {
|
|
2903
|
-
maximumPrefixType: _IdentifierCreatorProxy
|
|
2911
|
+
maximumPrefixType: _IdentifierCreatorProxy.#PREFIX_TYPES.length - 1
|
|
2904
2912
|
}));
|
|
2905
2913
|
}
|
|
2906
|
-
const prefixType = _IdentifierCreatorProxy
|
|
2914
|
+
const prefixType = _IdentifierCreatorProxy.#PREFIX_TYPES[prefixTypeIndex];
|
|
2907
2915
|
if (prefixType === void 0) {
|
|
2908
2916
|
throw new RangeError(i18nextAppExtension.t("IdentifierCreatorProxy.invalidPrefixType"));
|
|
2909
2917
|
}
|
|
@@ -2917,7 +2925,7 @@ var IdentifierCreatorProxy = class _IdentifierCreatorProxy extends LibProxy {
|
|
|
2917
2925
|
} else {
|
|
2918
2926
|
prefixManager.resetTweakFactor();
|
|
2919
2927
|
}
|
|
2920
|
-
return this
|
|
2928
|
+
return this.#getCreator(prefixManager);
|
|
2921
2929
|
}
|
|
2922
2930
|
};
|
|
2923
2931
|
var sparseParameterDescriptor = {
|
|
@@ -2971,6 +2979,8 @@ __decorateClass([
|
|
|
2971
2979
|
], NumericIdentifierCreatorProxy.prototype, "createAll", 1);
|
|
2972
2980
|
var NonGTINNumericIdentifierCreatorProxy = class extends NumericIdentifierCreatorProxy {
|
|
2973
2981
|
};
|
|
2982
|
+
var NonSerializableNumericIdentifierCreatorProxy = class extends NonGTINNumericIdentifierCreatorProxy {
|
|
2983
|
+
};
|
|
2974
2984
|
var singleValueParameterDescriptor = {
|
|
2975
2985
|
extendsDescriptor: valueParameterDescriptor,
|
|
2976
2986
|
isMatrix: false
|
|
@@ -3081,7 +3091,7 @@ GTINCreatorProxy = __decorateClass([
|
|
|
3081
3091
|
]
|
|
3082
3092
|
})
|
|
3083
3093
|
], GTINCreatorProxy);
|
|
3084
|
-
var GLNCreatorProxy = class extends
|
|
3094
|
+
var GLNCreatorProxy = class extends NonSerializableNumericIdentifierCreatorProxy {
|
|
3085
3095
|
constructor(appExtension) {
|
|
3086
3096
|
super(appExtension, (prefixManager) => prefixManager.glnCreator);
|
|
3087
3097
|
}
|
|
@@ -3092,7 +3102,7 @@ GLNCreatorProxy = __decorateClass([
|
|
|
3092
3102
|
methodInfix: "GLN"
|
|
3093
3103
|
})
|
|
3094
3104
|
], GLNCreatorProxy);
|
|
3095
|
-
var SSCCCreatorProxy = class extends
|
|
3105
|
+
var SSCCCreatorProxy = class extends NonSerializableNumericIdentifierCreatorProxy {
|
|
3096
3106
|
constructor(appExtension) {
|
|
3097
3107
|
super(appExtension, (prefixManager) => prefixManager.ssccCreator);
|
|
3098
3108
|
}
|
|
@@ -3125,7 +3135,7 @@ GIAICreatorProxy = __decorateClass([
|
|
|
3125
3135
|
methodInfix: "GIAI"
|
|
3126
3136
|
})
|
|
3127
3137
|
], GIAICreatorProxy);
|
|
3128
|
-
var GSRNCreatorProxy = class extends
|
|
3138
|
+
var GSRNCreatorProxy = class extends NonSerializableNumericIdentifierCreatorProxy {
|
|
3129
3139
|
constructor(appExtension) {
|
|
3130
3140
|
super(appExtension, (prefixManager) => prefixManager.gsrnCreator);
|
|
3131
3141
|
}
|
|
@@ -3158,7 +3168,7 @@ GINCCreatorProxy = __decorateClass([
|
|
|
3158
3168
|
methodInfix: "GINC"
|
|
3159
3169
|
})
|
|
3160
3170
|
], GINCCreatorProxy);
|
|
3161
|
-
var GSINCreatorProxy = class extends
|
|
3171
|
+
var GSINCreatorProxy = class extends NonSerializableNumericIdentifierCreatorProxy {
|
|
3162
3172
|
constructor(appExtension) {
|
|
3163
3173
|
super(appExtension, (prefixManager) => prefixManager.gsinCreator);
|
|
3164
3174
|
}
|
|
@@ -3212,27 +3222,27 @@ var Generator = class _Generator {
|
|
|
3212
3222
|
/**
|
|
3213
3223
|
* Documentation base URL.
|
|
3214
3224
|
*/
|
|
3215
|
-
static DOCUMENTATION_BASE_URL = "https://aidc-toolkit.com/";
|
|
3225
|
+
static #DOCUMENTATION_BASE_URL = "https://aidc-toolkit.com/";
|
|
3216
3226
|
/**
|
|
3217
3227
|
* Documentation path, optionally preceded by locale.
|
|
3218
3228
|
*/
|
|
3219
|
-
static DOCUMENTATION_PATH = "app-extension/";
|
|
3229
|
+
static #DOCUMENTATION_PATH = "app-extension/";
|
|
3220
3230
|
/**
|
|
3221
3231
|
* Locales.
|
|
3222
3232
|
*/
|
|
3223
|
-
|
|
3233
|
+
#locales;
|
|
3224
3234
|
/**
|
|
3225
3235
|
* Default locale.
|
|
3226
3236
|
*/
|
|
3227
|
-
|
|
3237
|
+
#defaultLocale;
|
|
3228
3238
|
/**
|
|
3229
3239
|
* Map of function localizations maps by namespace function name.
|
|
3230
3240
|
*/
|
|
3231
|
-
|
|
3241
|
+
#functionLocalizationsMapsMap = /* @__PURE__ */ new Map();
|
|
3232
3242
|
/**
|
|
3233
3243
|
* Map of parameter localizations maps by namespace function parameter name.
|
|
3234
3244
|
*/
|
|
3235
|
-
|
|
3245
|
+
#parameterLocalizationsMapsMap = /* @__PURE__ */ new Map();
|
|
3236
3246
|
/**
|
|
3237
3247
|
*
|
|
3238
3248
|
*/
|
|
@@ -3243,20 +3253,20 @@ var Generator = class _Generator {
|
|
|
3243
3253
|
* Include localizations if true.
|
|
3244
3254
|
*/
|
|
3245
3255
|
constructor(includeLocalizations = true) {
|
|
3246
|
-
this
|
|
3247
|
-
this
|
|
3256
|
+
this.#locales = includeLocalizations ? Object.keys(appExtensionResources) : [];
|
|
3257
|
+
this.#defaultLocale = this.#locales[0] ?? "";
|
|
3248
3258
|
}
|
|
3249
3259
|
/**
|
|
3250
3260
|
* Get the locales.
|
|
3251
3261
|
*/
|
|
3252
3262
|
get locales() {
|
|
3253
|
-
return this
|
|
3263
|
+
return this.#locales;
|
|
3254
3264
|
}
|
|
3255
3265
|
/**
|
|
3256
3266
|
* Get the default locale.
|
|
3257
3267
|
*/
|
|
3258
3268
|
get defaultLocale() {
|
|
3259
|
-
return this
|
|
3269
|
+
return this.#defaultLocale;
|
|
3260
3270
|
}
|
|
3261
3271
|
/**
|
|
3262
3272
|
* Get function localization.
|
|
@@ -3271,7 +3281,7 @@ var Generator = class _Generator {
|
|
|
3271
3281
|
* Function localization.
|
|
3272
3282
|
*/
|
|
3273
3283
|
getFunctionLocalization(namespaceFunctionName, locale) {
|
|
3274
|
-
const functionLocalization = this.
|
|
3284
|
+
const functionLocalization = this.#functionLocalizationsMapsMap.get(namespaceFunctionName)?.get(locale);
|
|
3275
3285
|
if (functionLocalization === void 0) {
|
|
3276
3286
|
throw new Error(`${locale} localization for function ${namespaceFunctionName} not found`);
|
|
3277
3287
|
}
|
|
@@ -3293,7 +3303,7 @@ var Generator = class _Generator {
|
|
|
3293
3303
|
* Function localization.
|
|
3294
3304
|
*/
|
|
3295
3305
|
getParameterLocalization(namespaceFunctionName, parameterName, locale) {
|
|
3296
|
-
const parameterLocalization = this.
|
|
3306
|
+
const parameterLocalization = this.#parameterLocalizationsMapsMap.get(`${namespaceFunctionName}.${parameterName}`)?.get(locale);
|
|
3297
3307
|
if (parameterLocalization === void 0) {
|
|
3298
3308
|
throw new Error(`${locale} localization for function ${namespaceFunctionName} parameter ${parameterName} not found`);
|
|
3299
3309
|
}
|
|
@@ -3302,6 +3312,9 @@ var Generator = class _Generator {
|
|
|
3302
3312
|
/**
|
|
3303
3313
|
* Generate localizations map.
|
|
3304
3314
|
*
|
|
3315
|
+
* @template TLocalization
|
|
3316
|
+
* Localization type.
|
|
3317
|
+
*
|
|
3305
3318
|
* @param localizedKeyPrefix
|
|
3306
3319
|
* Localized key prefix.
|
|
3307
3320
|
*
|
|
@@ -3311,8 +3324,8 @@ var Generator = class _Generator {
|
|
|
3311
3324
|
* @returns
|
|
3312
3325
|
* Localization map.
|
|
3313
3326
|
*/
|
|
3314
|
-
generateLocalizationsMap(localizedKeyPrefix, localizationCallback) {
|
|
3315
|
-
return new Map(this.
|
|
3327
|
+
#generateLocalizationsMap(localizedKeyPrefix, localizationCallback) {
|
|
3328
|
+
return new Map(this.#locales.map((locale) => {
|
|
3316
3329
|
const lngOption = {
|
|
3317
3330
|
lng: locale
|
|
3318
3331
|
};
|
|
@@ -3366,11 +3379,11 @@ var Generator = class _Generator {
|
|
|
3366
3379
|
functionName = `${methodName.substring(0, insertIndex)}${methodInfix}${methodName.substring(insertIndex)}`;
|
|
3367
3380
|
}
|
|
3368
3381
|
const namespaceFunctionName = `${namespacePrefix}${functionName}`;
|
|
3369
|
-
const functionLocalizationsMap = this
|
|
3382
|
+
const functionLocalizationsMap = this.#generateLocalizationsMap(`Functions.${namespaceFunctionName}.`, (locale, localization) => ({
|
|
3370
3383
|
...localization,
|
|
3371
|
-
documentationURL: `${_Generator
|
|
3384
|
+
documentationURL: `${_Generator.#DOCUMENTATION_BASE_URL}${locale === this.defaultLocale ? "" : `${locale}/`}${_Generator.#DOCUMENTATION_PATH}${namespace === void 0 ? "" : `${namespace}/`}${localization.name}.html`
|
|
3372
3385
|
}));
|
|
3373
|
-
this.
|
|
3386
|
+
this.#functionLocalizationsMapsMap.set(namespaceFunctionName, functionLocalizationsMap);
|
|
3374
3387
|
this.createProxyFunction({
|
|
3375
3388
|
...proxyObjectDescriptor,
|
|
3376
3389
|
functionName,
|
|
@@ -3379,8 +3392,8 @@ var Generator = class _Generator {
|
|
|
3379
3392
|
proxyParameterDescriptors: methodDescriptor.parameterDescriptors.map((parameterDescriptor) => {
|
|
3380
3393
|
const expandedParameterDescriptor = expandParameterDescriptor(parameterDescriptor);
|
|
3381
3394
|
const parameterName = expandedParameterDescriptor.name;
|
|
3382
|
-
const parameterLocalizationsMap = this
|
|
3383
|
-
this.
|
|
3395
|
+
const parameterLocalizationsMap = this.#generateLocalizationsMap(`Parameters.${parameterName}.`, (_locale, localization) => localization);
|
|
3396
|
+
this.#parameterLocalizationsMapsMap.set(`${namespaceFunctionName}.${parameterName}`, parameterLocalizationsMap);
|
|
3384
3397
|
return {
|
|
3385
3398
|
namespace,
|
|
3386
3399
|
parameterName,
|