@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.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,
|
|
@@ -2153,13 +2159,13 @@ var valueForSParameterDescriptor = {
|
|
|
2153
2159
|
name: "valueForS"
|
|
2154
2160
|
};
|
|
2155
2161
|
var CharacterSetValidatorProxy = class extends StringProxy {
|
|
2156
|
-
|
|
2162
|
+
#characterSetValidator;
|
|
2157
2163
|
constructor(appExtension, characterSetValidator) {
|
|
2158
2164
|
super(appExtension);
|
|
2159
|
-
this
|
|
2165
|
+
this.#characterSetValidator = characterSetValidator;
|
|
2160
2166
|
}
|
|
2161
2167
|
validate(matrixSs, exclusion) {
|
|
2162
|
-
return this.validateString(this
|
|
2168
|
+
return this.validateString(this.#characterSetValidator, matrixSs, {
|
|
2163
2169
|
exclusion: exclusion ?? void 0
|
|
2164
2170
|
});
|
|
2165
2171
|
}
|
|
@@ -2184,26 +2190,26 @@ __decorateClass([
|
|
|
2184
2190
|
__decorateParam(1, ProxyParameter(exclusionNoneParameterDescriptor))
|
|
2185
2191
|
], CharacterSetValidatorProxy.prototype, "isValid", 1);
|
|
2186
2192
|
var CharacterSetCreatorProxy = class extends CharacterSetValidatorProxy {
|
|
2187
|
-
|
|
2193
|
+
#characterSetCreator;
|
|
2188
2194
|
constructor(appExtension, characterSetCreator) {
|
|
2189
2195
|
super(appExtension, characterSetCreator);
|
|
2190
|
-
this
|
|
2196
|
+
this.#characterSetCreator = characterSetCreator;
|
|
2191
2197
|
}
|
|
2192
2198
|
create(length, matrixValues, exclusion, tweak) {
|
|
2193
2199
|
const exclusionOrUndefined = exclusion ?? void 0;
|
|
2194
2200
|
const tweakOrUndefined = tweak ?? void 0;
|
|
2195
|
-
return this.mapMatrix(matrixValues, (value) => this.
|
|
2201
|
+
return this.mapMatrix(matrixValues, (value) => this.#characterSetCreator.create(length, value, exclusionOrUndefined, tweakOrUndefined));
|
|
2196
2202
|
}
|
|
2197
2203
|
createSequence(length, startValue, count, exclusion, tweak) {
|
|
2198
2204
|
this.appExtension.validateSequenceCount(count);
|
|
2199
2205
|
const exclusionOrUndefined = exclusion ?? void 0;
|
|
2200
2206
|
const tweakOrUndefined = tweak ?? void 0;
|
|
2201
|
-
return LibProxy.matrixResult(this.
|
|
2207
|
+
return LibProxy.matrixResult(this.#characterSetCreator.create(length, new import_utility5.Sequence(startValue, count), exclusionOrUndefined, tweakOrUndefined));
|
|
2202
2208
|
}
|
|
2203
2209
|
valueFor(matrixSs, exclusion, tweak) {
|
|
2204
2210
|
const exclusionOrUndefined = exclusion ?? void 0;
|
|
2205
2211
|
const tweakOrUndefined = tweak ?? void 0;
|
|
2206
|
-
return this.mapMatrix(matrixSs, (s) => this.mapBigInt(this.
|
|
2212
|
+
return this.mapMatrix(matrixSs, (s) => this.mapBigInt(this.#characterSetCreator.valueFor(s, exclusionOrUndefined, tweakOrUndefined)));
|
|
2207
2213
|
}
|
|
2208
2214
|
};
|
|
2209
2215
|
__decorateClass([
|
|
@@ -2505,13 +2511,13 @@ var validateIdentifierParameterDescriptor = {
|
|
|
2505
2511
|
name: "validateIdentifier"
|
|
2506
2512
|
};
|
|
2507
2513
|
var IdentifierValidatorProxy = class extends StringProxy {
|
|
2508
|
-
|
|
2514
|
+
#validator;
|
|
2509
2515
|
constructor(appExtension, validator) {
|
|
2510
2516
|
super(appExtension);
|
|
2511
|
-
this
|
|
2517
|
+
this.#validator = validator;
|
|
2512
2518
|
}
|
|
2513
2519
|
get validator() {
|
|
2514
|
-
return this
|
|
2520
|
+
return this.#validator;
|
|
2515
2521
|
}
|
|
2516
2522
|
};
|
|
2517
2523
|
var NumericIdentifierValidatorProxy = class extends IdentifierValidatorProxy {
|
|
@@ -2530,6 +2536,8 @@ var GTINValidatorProxy = class extends NumericIdentifierValidatorProxy {
|
|
|
2530
2536
|
};
|
|
2531
2537
|
var NonGTINNumericIdentifierValidatorProxy = class extends NumericIdentifierValidatorProxy {
|
|
2532
2538
|
};
|
|
2539
|
+
var NonSerializableNumericIdentifierValidatorProxy = class extends NonGTINNumericIdentifierValidatorProxy {
|
|
2540
|
+
};
|
|
2533
2541
|
var SerializableNumericIdentifierValidatorProxy = class extends NonGTINNumericIdentifierValidatorProxy {
|
|
2534
2542
|
};
|
|
2535
2543
|
var NonNumericIdentifierValidatorProxy = class extends IdentifierValidatorProxy {
|
|
@@ -2549,7 +2557,7 @@ __decorateClass([
|
|
|
2549
2557
|
], NonNumericIdentifierValidatorProxy.prototype, "validate", 1);
|
|
2550
2558
|
var GTIN13ValidatorProxy = class extends GTINValidatorProxy {
|
|
2551
2559
|
constructor(appExtension) {
|
|
2552
|
-
super(appExtension, import_gs14.IdentifierValidators.GTIN[import_gs14.
|
|
2560
|
+
super(appExtension, import_gs14.IdentifierValidators.GTIN[import_gs14.GTINLengths.GTIN13]);
|
|
2553
2561
|
}
|
|
2554
2562
|
};
|
|
2555
2563
|
GTIN13ValidatorProxy = __decorateClass([
|
|
@@ -2560,7 +2568,7 @@ GTIN13ValidatorProxy = __decorateClass([
|
|
|
2560
2568
|
], GTIN13ValidatorProxy);
|
|
2561
2569
|
var GTIN12ValidatorProxy = class extends GTINValidatorProxy {
|
|
2562
2570
|
constructor(appExtension) {
|
|
2563
|
-
super(appExtension, import_gs14.IdentifierValidators.GTIN[import_gs14.
|
|
2571
|
+
super(appExtension, import_gs14.IdentifierValidators.GTIN[import_gs14.GTINLengths.GTIN12]);
|
|
2564
2572
|
}
|
|
2565
2573
|
};
|
|
2566
2574
|
GTIN12ValidatorProxy = __decorateClass([
|
|
@@ -2571,7 +2579,7 @@ GTIN12ValidatorProxy = __decorateClass([
|
|
|
2571
2579
|
], GTIN12ValidatorProxy);
|
|
2572
2580
|
var GTIN8ValidatorProxy = class extends GTINValidatorProxy {
|
|
2573
2581
|
constructor(appExtension) {
|
|
2574
|
-
super(appExtension, import_gs14.IdentifierValidators.GTIN[import_gs14.
|
|
2582
|
+
super(appExtension, import_gs14.IdentifierValidators.GTIN[import_gs14.GTINLengths.GTIN8]);
|
|
2575
2583
|
}
|
|
2576
2584
|
};
|
|
2577
2585
|
GTIN8ValidatorProxy = __decorateClass([
|
|
@@ -2728,7 +2736,7 @@ GTINValidatorStaticProxy = __decorateClass([
|
|
|
2728
2736
|
namespace: "GS1"
|
|
2729
2737
|
})
|
|
2730
2738
|
], GTINValidatorStaticProxy);
|
|
2731
|
-
var GLNValidatorProxy = class extends
|
|
2739
|
+
var GLNValidatorProxy = class extends NonSerializableNumericIdentifierValidatorProxy {
|
|
2732
2740
|
constructor(appExtension) {
|
|
2733
2741
|
super(appExtension, import_gs14.IdentifierValidators.GLN);
|
|
2734
2742
|
}
|
|
@@ -2739,7 +2747,7 @@ GLNValidatorProxy = __decorateClass([
|
|
|
2739
2747
|
methodInfix: "GLN"
|
|
2740
2748
|
})
|
|
2741
2749
|
], GLNValidatorProxy);
|
|
2742
|
-
var SSCCValidatorProxy = class extends
|
|
2750
|
+
var SSCCValidatorProxy = class extends NonSerializableNumericIdentifierValidatorProxy {
|
|
2743
2751
|
constructor(appExtension) {
|
|
2744
2752
|
super(appExtension, import_gs14.IdentifierValidators.SSCC);
|
|
2745
2753
|
}
|
|
@@ -2772,7 +2780,7 @@ GIAIValidatorProxy = __decorateClass([
|
|
|
2772
2780
|
methodInfix: "GIAI"
|
|
2773
2781
|
})
|
|
2774
2782
|
], GIAIValidatorProxy);
|
|
2775
|
-
var GSRNValidatorProxy = class extends
|
|
2783
|
+
var GSRNValidatorProxy = class extends NonSerializableNumericIdentifierValidatorProxy {
|
|
2776
2784
|
constructor(appExtension) {
|
|
2777
2785
|
super(appExtension, import_gs14.IdentifierValidators.GSRN);
|
|
2778
2786
|
}
|
|
@@ -2805,7 +2813,7 @@ GINCValidatorProxy = __decorateClass([
|
|
|
2805
2813
|
methodInfix: "GINC"
|
|
2806
2814
|
})
|
|
2807
2815
|
], GINCValidatorProxy);
|
|
2808
|
-
var GSINValidatorProxy = class extends
|
|
2816
|
+
var GSINValidatorProxy = class extends NonSerializableNumericIdentifierValidatorProxy {
|
|
2809
2817
|
constructor(appExtension) {
|
|
2810
2818
|
super(appExtension, import_gs14.IdentifierValidators.GSIN);
|
|
2811
2819
|
}
|
|
@@ -2901,11 +2909,11 @@ PrefixManagerProxy = __decorateClass([
|
|
|
2901
2909
|
})
|
|
2902
2910
|
], PrefixManagerProxy);
|
|
2903
2911
|
var IdentifierCreatorProxy = class _IdentifierCreatorProxy extends LibProxy {
|
|
2904
|
-
static PREFIX_TYPES = [import_gs14.PrefixTypes.GS1CompanyPrefix, import_gs14.PrefixTypes.UPCCompanyPrefix, import_gs14.PrefixTypes.GS18Prefix];
|
|
2905
|
-
|
|
2912
|
+
static #PREFIX_TYPES = [import_gs14.PrefixTypes.GS1CompanyPrefix, import_gs14.PrefixTypes.UPCCompanyPrefix, import_gs14.PrefixTypes.GS18Prefix];
|
|
2913
|
+
#getCreator;
|
|
2906
2914
|
constructor(appExtension, getCreator) {
|
|
2907
2915
|
super(appExtension);
|
|
2908
|
-
this
|
|
2916
|
+
this.#getCreator = getCreator;
|
|
2909
2917
|
}
|
|
2910
2918
|
getCreator(prefixDefinition) {
|
|
2911
2919
|
const reducedPrefixDefinition = prefixDefinition.length === 1 ? (
|
|
@@ -2928,12 +2936,12 @@ var IdentifierCreatorProxy = class _IdentifierCreatorProxy extends LibProxy {
|
|
|
2928
2936
|
throw new RangeError(i18nextAppExtension.t("IdentifierCreatorProxy.prefixMustBeString"));
|
|
2929
2937
|
}
|
|
2930
2938
|
const prefixTypeIndex = reducedPrefixDefinition[1] ?? 0;
|
|
2931
|
-
if (typeof prefixTypeIndex !== "number" || prefixTypeIndex < 0 || prefixTypeIndex >= _IdentifierCreatorProxy
|
|
2939
|
+
if (typeof prefixTypeIndex !== "number" || prefixTypeIndex < 0 || prefixTypeIndex >= _IdentifierCreatorProxy.#PREFIX_TYPES.length) {
|
|
2932
2940
|
throw new RangeError(i18nextAppExtension.t("IdentifierCreatorProxy.prefixTypeMustBeNumber", {
|
|
2933
|
-
maximumPrefixType: _IdentifierCreatorProxy
|
|
2941
|
+
maximumPrefixType: _IdentifierCreatorProxy.#PREFIX_TYPES.length - 1
|
|
2934
2942
|
}));
|
|
2935
2943
|
}
|
|
2936
|
-
const prefixType = _IdentifierCreatorProxy
|
|
2944
|
+
const prefixType = _IdentifierCreatorProxy.#PREFIX_TYPES[prefixTypeIndex];
|
|
2937
2945
|
if (prefixType === void 0) {
|
|
2938
2946
|
throw new RangeError(i18nextAppExtension.t("IdentifierCreatorProxy.invalidPrefixType"));
|
|
2939
2947
|
}
|
|
@@ -2947,7 +2955,7 @@ var IdentifierCreatorProxy = class _IdentifierCreatorProxy extends LibProxy {
|
|
|
2947
2955
|
} else {
|
|
2948
2956
|
prefixManager.resetTweakFactor();
|
|
2949
2957
|
}
|
|
2950
|
-
return this
|
|
2958
|
+
return this.#getCreator(prefixManager);
|
|
2951
2959
|
}
|
|
2952
2960
|
};
|
|
2953
2961
|
var sparseParameterDescriptor = {
|
|
@@ -3001,6 +3009,8 @@ __decorateClass([
|
|
|
3001
3009
|
], NumericIdentifierCreatorProxy.prototype, "createAll", 1);
|
|
3002
3010
|
var NonGTINNumericIdentifierCreatorProxy = class extends NumericIdentifierCreatorProxy {
|
|
3003
3011
|
};
|
|
3012
|
+
var NonSerializableNumericIdentifierCreatorProxy = class extends NonGTINNumericIdentifierCreatorProxy {
|
|
3013
|
+
};
|
|
3004
3014
|
var singleValueParameterDescriptor = {
|
|
3005
3015
|
extendsDescriptor: valueParameterDescriptor,
|
|
3006
3016
|
isMatrix: false
|
|
@@ -3111,7 +3121,7 @@ GTINCreatorProxy = __decorateClass([
|
|
|
3111
3121
|
]
|
|
3112
3122
|
})
|
|
3113
3123
|
], GTINCreatorProxy);
|
|
3114
|
-
var GLNCreatorProxy = class extends
|
|
3124
|
+
var GLNCreatorProxy = class extends NonSerializableNumericIdentifierCreatorProxy {
|
|
3115
3125
|
constructor(appExtension) {
|
|
3116
3126
|
super(appExtension, (prefixManager) => prefixManager.glnCreator);
|
|
3117
3127
|
}
|
|
@@ -3122,7 +3132,7 @@ GLNCreatorProxy = __decorateClass([
|
|
|
3122
3132
|
methodInfix: "GLN"
|
|
3123
3133
|
})
|
|
3124
3134
|
], GLNCreatorProxy);
|
|
3125
|
-
var SSCCCreatorProxy = class extends
|
|
3135
|
+
var SSCCCreatorProxy = class extends NonSerializableNumericIdentifierCreatorProxy {
|
|
3126
3136
|
constructor(appExtension) {
|
|
3127
3137
|
super(appExtension, (prefixManager) => prefixManager.ssccCreator);
|
|
3128
3138
|
}
|
|
@@ -3155,7 +3165,7 @@ GIAICreatorProxy = __decorateClass([
|
|
|
3155
3165
|
methodInfix: "GIAI"
|
|
3156
3166
|
})
|
|
3157
3167
|
], GIAICreatorProxy);
|
|
3158
|
-
var GSRNCreatorProxy = class extends
|
|
3168
|
+
var GSRNCreatorProxy = class extends NonSerializableNumericIdentifierCreatorProxy {
|
|
3159
3169
|
constructor(appExtension) {
|
|
3160
3170
|
super(appExtension, (prefixManager) => prefixManager.gsrnCreator);
|
|
3161
3171
|
}
|
|
@@ -3188,7 +3198,7 @@ GINCCreatorProxy = __decorateClass([
|
|
|
3188
3198
|
methodInfix: "GINC"
|
|
3189
3199
|
})
|
|
3190
3200
|
], GINCCreatorProxy);
|
|
3191
|
-
var GSINCreatorProxy = class extends
|
|
3201
|
+
var GSINCreatorProxy = class extends NonSerializableNumericIdentifierCreatorProxy {
|
|
3192
3202
|
constructor(appExtension) {
|
|
3193
3203
|
super(appExtension, (prefixManager) => prefixManager.gsinCreator);
|
|
3194
3204
|
}
|
|
@@ -3242,27 +3252,27 @@ var Generator = class _Generator {
|
|
|
3242
3252
|
/**
|
|
3243
3253
|
* Documentation base URL.
|
|
3244
3254
|
*/
|
|
3245
|
-
static DOCUMENTATION_BASE_URL = "https://aidc-toolkit.com/";
|
|
3255
|
+
static #DOCUMENTATION_BASE_URL = "https://aidc-toolkit.com/";
|
|
3246
3256
|
/**
|
|
3247
3257
|
* Documentation path, optionally preceded by locale.
|
|
3248
3258
|
*/
|
|
3249
|
-
static DOCUMENTATION_PATH = "app-extension/";
|
|
3259
|
+
static #DOCUMENTATION_PATH = "app-extension/";
|
|
3250
3260
|
/**
|
|
3251
3261
|
* Locales.
|
|
3252
3262
|
*/
|
|
3253
|
-
|
|
3263
|
+
#locales;
|
|
3254
3264
|
/**
|
|
3255
3265
|
* Default locale.
|
|
3256
3266
|
*/
|
|
3257
|
-
|
|
3267
|
+
#defaultLocale;
|
|
3258
3268
|
/**
|
|
3259
3269
|
* Map of function localizations maps by namespace function name.
|
|
3260
3270
|
*/
|
|
3261
|
-
|
|
3271
|
+
#functionLocalizationsMapsMap = /* @__PURE__ */ new Map();
|
|
3262
3272
|
/**
|
|
3263
3273
|
* Map of parameter localizations maps by namespace function parameter name.
|
|
3264
3274
|
*/
|
|
3265
|
-
|
|
3275
|
+
#parameterLocalizationsMapsMap = /* @__PURE__ */ new Map();
|
|
3266
3276
|
/**
|
|
3267
3277
|
*
|
|
3268
3278
|
*/
|
|
@@ -3273,20 +3283,20 @@ var Generator = class _Generator {
|
|
|
3273
3283
|
* Include localizations if true.
|
|
3274
3284
|
*/
|
|
3275
3285
|
constructor(includeLocalizations = true) {
|
|
3276
|
-
this
|
|
3277
|
-
this
|
|
3286
|
+
this.#locales = includeLocalizations ? Object.keys(appExtensionResources) : [];
|
|
3287
|
+
this.#defaultLocale = this.#locales[0] ?? "";
|
|
3278
3288
|
}
|
|
3279
3289
|
/**
|
|
3280
3290
|
* Get the locales.
|
|
3281
3291
|
*/
|
|
3282
3292
|
get locales() {
|
|
3283
|
-
return this
|
|
3293
|
+
return this.#locales;
|
|
3284
3294
|
}
|
|
3285
3295
|
/**
|
|
3286
3296
|
* Get the default locale.
|
|
3287
3297
|
*/
|
|
3288
3298
|
get defaultLocale() {
|
|
3289
|
-
return this
|
|
3299
|
+
return this.#defaultLocale;
|
|
3290
3300
|
}
|
|
3291
3301
|
/**
|
|
3292
3302
|
* Get function localization.
|
|
@@ -3301,7 +3311,7 @@ var Generator = class _Generator {
|
|
|
3301
3311
|
* Function localization.
|
|
3302
3312
|
*/
|
|
3303
3313
|
getFunctionLocalization(namespaceFunctionName, locale) {
|
|
3304
|
-
const functionLocalization = this.
|
|
3314
|
+
const functionLocalization = this.#functionLocalizationsMapsMap.get(namespaceFunctionName)?.get(locale);
|
|
3305
3315
|
if (functionLocalization === void 0) {
|
|
3306
3316
|
throw new Error(`${locale} localization for function ${namespaceFunctionName} not found`);
|
|
3307
3317
|
}
|
|
@@ -3323,7 +3333,7 @@ var Generator = class _Generator {
|
|
|
3323
3333
|
* Function localization.
|
|
3324
3334
|
*/
|
|
3325
3335
|
getParameterLocalization(namespaceFunctionName, parameterName, locale) {
|
|
3326
|
-
const parameterLocalization = this.
|
|
3336
|
+
const parameterLocalization = this.#parameterLocalizationsMapsMap.get(`${namespaceFunctionName}.${parameterName}`)?.get(locale);
|
|
3327
3337
|
if (parameterLocalization === void 0) {
|
|
3328
3338
|
throw new Error(`${locale} localization for function ${namespaceFunctionName} parameter ${parameterName} not found`);
|
|
3329
3339
|
}
|
|
@@ -3332,6 +3342,9 @@ var Generator = class _Generator {
|
|
|
3332
3342
|
/**
|
|
3333
3343
|
* Generate localizations map.
|
|
3334
3344
|
*
|
|
3345
|
+
* @template TLocalization
|
|
3346
|
+
* Localization type.
|
|
3347
|
+
*
|
|
3335
3348
|
* @param localizedKeyPrefix
|
|
3336
3349
|
* Localized key prefix.
|
|
3337
3350
|
*
|
|
@@ -3341,8 +3354,8 @@ var Generator = class _Generator {
|
|
|
3341
3354
|
* @returns
|
|
3342
3355
|
* Localization map.
|
|
3343
3356
|
*/
|
|
3344
|
-
generateLocalizationsMap(localizedKeyPrefix, localizationCallback) {
|
|
3345
|
-
return new Map(this.
|
|
3357
|
+
#generateLocalizationsMap(localizedKeyPrefix, localizationCallback) {
|
|
3358
|
+
return new Map(this.#locales.map((locale) => {
|
|
3346
3359
|
const lngOption = {
|
|
3347
3360
|
lng: locale
|
|
3348
3361
|
};
|
|
@@ -3396,11 +3409,11 @@ var Generator = class _Generator {
|
|
|
3396
3409
|
functionName = `${methodName.substring(0, insertIndex)}${methodInfix}${methodName.substring(insertIndex)}`;
|
|
3397
3410
|
}
|
|
3398
3411
|
const namespaceFunctionName = `${namespacePrefix}${functionName}`;
|
|
3399
|
-
const functionLocalizationsMap = this
|
|
3412
|
+
const functionLocalizationsMap = this.#generateLocalizationsMap(`Functions.${namespaceFunctionName}.`, (locale, localization) => ({
|
|
3400
3413
|
...localization,
|
|
3401
|
-
documentationURL: `${_Generator
|
|
3414
|
+
documentationURL: `${_Generator.#DOCUMENTATION_BASE_URL}${locale === this.defaultLocale ? "" : `${locale}/`}${_Generator.#DOCUMENTATION_PATH}${namespace === void 0 ? "" : `${namespace}/`}${localization.name}.html`
|
|
3402
3415
|
}));
|
|
3403
|
-
this.
|
|
3416
|
+
this.#functionLocalizationsMapsMap.set(namespaceFunctionName, functionLocalizationsMap);
|
|
3404
3417
|
this.createProxyFunction({
|
|
3405
3418
|
...proxyObjectDescriptor,
|
|
3406
3419
|
functionName,
|
|
@@ -3409,8 +3422,8 @@ var Generator = class _Generator {
|
|
|
3409
3422
|
proxyParameterDescriptors: methodDescriptor.parameterDescriptors.map((parameterDescriptor) => {
|
|
3410
3423
|
const expandedParameterDescriptor = expandParameterDescriptor(parameterDescriptor);
|
|
3411
3424
|
const parameterName = expandedParameterDescriptor.name;
|
|
3412
|
-
const parameterLocalizationsMap = this
|
|
3413
|
-
this.
|
|
3425
|
+
const parameterLocalizationsMap = this.#generateLocalizationsMap(`Parameters.${parameterName}.`, (_locale, localization) => localization);
|
|
3426
|
+
this.#parameterLocalizationsMapsMap.set(`${namespaceFunctionName}.${parameterName}`, parameterLocalizationsMap);
|
|
3414
3427
|
return {
|
|
3415
3428
|
namespace,
|
|
3416
3429
|
parameterName,
|