@aidc-toolkit/app-extension 1.0.28-beta → 1.0.32-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.
Files changed (41) hide show
  1. package/dist/index.cjs +3463 -630
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +575 -300
  4. package/dist/index.d.ts +575 -300
  5. package/dist/index.js +3452 -613
  6. package/dist/index.js.map +1 -1
  7. package/package.json +8 -9
  8. package/src/app-data.ts +94 -0
  9. package/src/app-extension.ts +162 -93
  10. package/src/app-utility-proxy.ts +154 -103
  11. package/src/descriptor.ts +33 -6
  12. package/src/generator/generator.ts +13 -12
  13. package/src/generator/locale-resources-generator.ts +30 -28
  14. package/src/gs1/character-set-proxy.ts +8 -8
  15. package/src/gs1/check-proxy.ts +14 -14
  16. package/src/gs1/gtin-creator-proxy.ts +12 -25
  17. package/src/gs1/gtin-descriptor.ts +0 -21
  18. package/src/gs1/gtin-validator-proxy.ts +34 -35
  19. package/src/gs1/identifier-creator-proxy.ts +44 -32
  20. package/src/gs1/identifier-descriptor.ts +15 -0
  21. package/src/gs1/identifier-type.ts +37 -0
  22. package/src/gs1/identifier-validator-proxy.ts +52 -19
  23. package/src/gs1/index.ts +8 -0
  24. package/src/gs1/non-gtin-creator-proxy.ts +22 -22
  25. package/src/gs1/non-gtin-validator-proxy.ts +22 -22
  26. package/src/gs1/prefix-manager-proxy.ts +199 -4
  27. package/src/gs1/service-proxy.ts +56 -0
  28. package/src/gs1/variable-measure-proxy.ts +61 -0
  29. package/src/index.ts +6 -0
  30. package/src/lib-proxy.ts +112 -70
  31. package/src/locale/en/locale-resources.ts +147 -34
  32. package/src/locale/fr/locale-resources.ts +147 -34
  33. package/src/locale/i18n.ts +2 -5
  34. package/src/proxy.ts +93 -100
  35. package/src/streaming.ts +13 -0
  36. package/src/type.ts +8 -7
  37. package/src/utility/character-set-proxy.ts +33 -32
  38. package/src/utility/reg-exp-proxy.ts +7 -6
  39. package/src/utility/string-proxy.ts +3 -7
  40. package/src/utility/transformer-proxy.ts +19 -13
  41. package/tsconfig.json +1 -0
@@ -1,11 +1,11 @@
1
- import { isNullish, type NonNullishable, type Nullishable } from "@aidc-toolkit/core";
1
+ import { isNullish, type LogLevel, logLevelOf, type NonNullishable, type Nullishable } from "@aidc-toolkit/core";
2
2
  import { type ExtendsParameterDescriptor, type ParameterDescriptor, Types } from "./descriptor.js";
3
3
  import { LibProxy } from "./lib-proxy.js";
4
4
  import { i18nextAppExtension } from "./locale/i18n.js";
5
5
  import { proxy } from "./proxy.js";
6
- import type { ErrorExtends, Matrix } from "./type.js";
6
+ import type { ErrorExtends, Matrix, MatrixResult } from "./type.js";
7
7
 
8
- const spillMatrix: ParameterDescriptor = {
8
+ const spillMatrixParameterDescriptor: ParameterDescriptor = {
9
9
  name: "spillMatrix",
10
10
  type: Types.Any,
11
11
  isMatrix: true,
@@ -49,7 +49,7 @@ interface MaximumDimensions {
49
49
  /**
50
50
  * Application utilities.
51
51
  *
52
- *@template ThrowError
52
+ * @template ThrowError
53
53
  * If true, errors are reported through the throw/catch mechanism.
54
54
  *
55
55
  * @template TError
@@ -58,11 +58,14 @@ interface MaximumDimensions {
58
58
  * @template TInvocationContext
59
59
  * Application-specific invocation context type.
60
60
  *
61
+ * @template TStreamingInvocationContext
62
+ * Application-specific streaming invocation context type.
63
+ *
61
64
  * @template TBigInt
62
65
  * Type to which big integer is mapped.
63
66
  */
64
67
  @proxy.describeClass(false)
65
- export class AppUtilityProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends LibProxy<ThrowError, TError, TInvocationContext, TBigInt> {
68
+ export class AppUtilityProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends LibProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
66
69
  /**
67
70
  * Get the version.
68
71
  *
@@ -106,8 +109,8 @@ export class AppUtilityProxy<ThrowError extends boolean, TError extends ErrorExt
106
109
  if (isNullish(maximumWidth) || isNullish(maximumHeight)) {
107
110
  const sheetAddress = await this.appExtension.getSheetAddress(invocationContext);
108
111
 
109
- definedMaximumWidth = maximumWidth ?? await this.appExtension.maximumWidth() - sheetAddress.columnIndex;
110
- definedMaximumHeight = maximumHeight ?? await this.appExtension.maximumHeight() - sheetAddress.rowIndex;
112
+ definedMaximumWidth = maximumWidth ?? this.appExtension.maximumWidth - sheetAddress.columnIndex;
113
+ definedMaximumHeight = maximumHeight ?? this.appExtension.maximumHeight - sheetAddress.rowIndex;
111
114
  } else {
112
115
  definedMaximumWidth = maximumWidth;
113
116
  definedMaximumHeight = maximumHeight;
@@ -120,154 +123,202 @@ export class AppUtilityProxy<ThrowError extends boolean, TError extends ErrorExt
120
123
  }
121
124
 
122
125
  /**
123
- * Spill a horizontal matrix vertically to fit within a maximum width and height.
126
+ * Spill a one-dimensional matrix to fit a rectangle within a given maximum height and width.
124
127
  *
125
- * @param hMatrixValues
126
- * Horizontal matrix values. Matrix has length 1 and contains a single array with the values.
127
- *
128
- * @param maximumWidth
129
- * Maximum width.
128
+ * @param matrixValues
129
+ * Matrix values. Matrix is length 1 or contains arrays of length 1 with the values.
130
130
  *
131
131
  * @param maximumHeight
132
132
  * Maximum height.
133
133
  *
134
+ * @param maximumWidth
135
+ * Maximum width.
136
+ *
134
137
  * @param invocationContext
135
138
  * Invocation context.
136
139
  *
137
140
  * @returns
138
- * Matrix spilled within maximum width and maximum height.
141
+ * Matrix spilled within maximum height and maximum width.
139
142
  */
140
143
  @proxy.describeMethod({
141
144
  requiresContext: true,
142
145
  type: Types.Any,
143
146
  isMatrix: true,
144
- parameterDescriptors: [spillMatrix, spillMaximumWidthParameterDescriptor, spillMaximumHeightParameterDescriptor]
147
+ parameterDescriptors: [spillMatrixParameterDescriptor, spillMaximumHeightParameterDescriptor, spillMaximumWidthParameterDescriptor]
145
148
  })
146
- async vSpill(hMatrixValues: Matrix<unknown>, maximumWidth: Nullishable<number>, maximumHeight: Nullishable<number>, invocationContext: Nullishable<TInvocationContext>): Promise<Matrix<unknown>> {
147
- let result: Matrix<unknown>;
149
+ async spill(matrixValues: Matrix<unknown>, maximumHeight: Nullishable<number>, maximumWidth: Nullishable<number>, invocationContext: Nullishable<TInvocationContext>): Promise<MatrixResult<unknown, ThrowError, TError>> {
150
+ let result: MatrixResult<unknown, ThrowError, TError>;
148
151
 
149
- if (hMatrixValues.length !== 1) {
150
- throw new RangeError(i18nextAppExtension.t("Proxy.vSpillMustBeHorizontalArray"));
151
- }
152
+ // Assume matrix is uniformly two-dimensional.
153
+ const height = matrixValues.length;
154
+ const width = height !== 0 ? matrixValues[0].length : 0;
152
155
 
153
- const maximumDimensions = await this.#defaultMaximums({
154
- width: maximumWidth,
155
- height: maximumHeight
156
- }, invocationContext);
156
+ const isArrayOrError = this.singletonResult(() => {
157
+ if (height > 1 && width > 1) {
158
+ throw new RangeError(i18nextAppExtension.t("Proxy.matrixMustBeArray"));
159
+ }
157
160
 
158
- const hArrayValues = hMatrixValues[0];
159
- const hLength = hArrayValues.length;
160
- const maximumArea = maximumDimensions.width * maximumDimensions.height;
161
+ return true;
162
+ });
163
+
164
+ if (isArrayOrError === true) {
165
+ const maximumDimensions = await this.#defaultMaximums({
166
+ width: maximumWidth,
167
+ height: maximumHeight
168
+ }, invocationContext);
169
+
170
+ const isHorizontal = height === 1;
171
+ const length = isHorizontal ? width : height;
172
+ const maximumParallel = isHorizontal ? maximumDimensions.width : maximumDimensions.height;
173
+ const maximumPerpendicular = isHorizontal ? maximumDimensions.height : maximumDimensions.width;
174
+ const maximumArea = maximumParallel * maximumPerpendicular;
175
+
176
+ // Lengths 0 and 1 are valid and require no special processing.
177
+ if (length > 1 && length <= maximumArea) {
178
+ const lengthSquareRoot = Math.sqrt(length);
179
+
180
+ let spillParallel: number | undefined = undefined;
181
+
182
+ // Array that has a length of a power of 10 is treated specially.
183
+ if (Number.isInteger(Math.log10(length))) {
184
+ // Try spill that is a power of 10, favouring the parallel direction.
185
+ let spillParallel10 = 10 ** Math.ceil(Math.log10(lengthSquareRoot));
186
+
187
+ // Favour the perpendicular direction if not enough parallel space.
188
+ if (spillParallel10 > maximumParallel) {
189
+ spillParallel10 /= 10;
190
+ }
191
+
192
+ // Take result as the spill parallel if it fits.
193
+ if (spillParallel10 <= maximumParallel && length / spillParallel10 <= maximumPerpendicular) {
194
+ spillParallel = spillParallel10;
195
+ }
196
+ }
161
197
 
162
- // Lengths 0 and 1 are valid and require no special processing.
163
- if (hLength > 1 && hLength <= maximumArea) {
164
- // Make spill as square as possible.
165
- let spillWidth = Math.min(Math.ceil(Math.sqrt(maximumArea)), maximumDimensions.width);
198
+ // Make spill as square as possible, favouring the parallel direction.
199
+ spillParallel ??= Math.max(Math.min(Math.ceil(lengthSquareRoot), maximumParallel), Math.floor(length / maximumPerpendicular));
166
200
 
167
- // Array that has a length of a power of 10 is treated specially.
168
- if (Number.isInteger(Math.log10(hLength))) {
169
- // Try spill width that is a power of 10.
170
- const spillWidth10 = 10 ** Math.floor(Math.log10(spillWidth));
201
+ const spillPerpendicular = Math.ceil(length / spillParallel);
171
202
 
172
- // Keep default if not enough space for power of 10 matrix.
173
- if (hLength / spillWidth10 <= maximumDimensions.height) {
174
- spillWidth = spillWidth10;
175
- }
176
- }
203
+ result = [];
204
+
205
+ if (isHorizontal) {
206
+ let startIndex = 0;
207
+
208
+ do {
209
+ const endIndex = startIndex + spillParallel;
210
+
211
+ // Each row is a slice of the original single row.
212
+ const row = matrixValues[0].slice(startIndex, endIndex);
213
+
214
+ // Row length will be anywhere from 1 to spillParallel.
215
+ if (row.length < spillParallel) {
216
+ const rowLength = row.length;
217
+
218
+ row.length = spillParallel;
177
219
 
178
- result = [];
220
+ // Fill empty cells with empty string.
221
+ row.fill("", rowLength, spillParallel);
222
+ }
179
223
 
180
- let hStartIndex = 0;
224
+ result.push(row);
181
225
 
182
- do {
183
- const hEndIndex = hStartIndex + spillWidth;
226
+ startIndex = endIndex;
227
+ } while (startIndex < length);
228
+ } else {
229
+ for (let rowIndex = 0; rowIndex < spillParallel; rowIndex++) {
230
+ const row: unknown[] = [];
184
231
 
185
- result.push(hArrayValues.slice(hStartIndex, hEndIndex));
232
+ // Each column is a slice of the original single column.
233
+ for (let valueIndex = rowIndex; valueIndex < length; valueIndex += spillParallel) {
234
+ row.push(matrixValues[valueIndex][0]);
235
+ }
186
236
 
187
- hStartIndex = hEndIndex;
188
- } while (hStartIndex < hLength);
237
+ // Row length will always be spillPerpendicular or spillPerpendicular - 1.
238
+ if (row.length < spillPerpendicular) {
239
+ row[spillPerpendicular - 1] = "";
240
+ }
241
+
242
+ result.push(row);
243
+ }
244
+ }
245
+ } else {
246
+ // Return matrix unmodified and let application handle spill error if any.
247
+ result = matrixValues;
248
+ }
189
249
  } else {
190
- // Return matrix unmodified and let application handle spill error if any.
191
- result = hMatrixValues;
250
+ // Return error as only element in matrix.
251
+ result = [[isArrayOrError]];
192
252
  }
193
253
 
194
254
  return result;
195
255
  }
196
256
 
197
257
  /**
198
- * Spill a vertical matrix horizontally to fit within a maximum width and height.
258
+ * Get the logger messages as a stream.
199
259
  *
200
- * @param vMatrixValues
201
- * Vertical matrix values. Matrix contains arrays of length 1 with the values.
260
+ * @param logLevelString
261
+ * Log level as string.
202
262
  *
203
- * @param maximumHeight
204
- * Maximum height.
205
- *
206
- * @param maximumWidth
207
- * Maximum width.
208
- *
209
- * @param invocationContext
210
- * Invocation context.
211
- *
212
- * @returns
213
- * Matrix spilled within maximum height and maximum width.
263
+ * @param streamingInvocationContext
264
+ * Streaming invocation context.
214
265
  */
215
266
  @proxy.describeMethod({
216
- requiresContext: true,
217
- type: Types.Any,
267
+ type: Types.String,
268
+ isHidden: true,
269
+ isStream: true,
218
270
  isMatrix: true,
219
- parameterDescriptors: [spillMatrix, spillMaximumHeightParameterDescriptor, spillMaximumWidthParameterDescriptor]
271
+ parameterDescriptors: [{
272
+ name: "logLevel",
273
+ type: Types.String,
274
+ isMatrix: false,
275
+ isRequired: false
276
+ }]
220
277
  })
221
- async hSpill(vMatrixValues: Matrix<unknown>, maximumHeight: Nullishable<number>, maximumWidth: Nullishable<number>, invocationContext: Nullishable<TInvocationContext>): Promise<Matrix<unknown>> {
222
- let result: Matrix<unknown>;
223
-
224
- for (const hArrayValues of vMatrixValues) {
225
- // This test should be necessary only once but account for zero-size matrix and misuse of method.
226
- if (hArrayValues.length !== 1) {
227
- throw new RangeError(i18nextAppExtension.t("Proxy.hSpillMustBeVerticalArray"));
228
- }
278
+ loggerMessages(logLevelString: Nullishable<string>, streamingInvocationContext: Nullishable<TStreamingInvocationContext>): void {
279
+ if (isNullish(streamingInvocationContext)) {
280
+ // Application error; no localization necessary.
281
+ throw new Error("Streaming invocation context not provided by application");
229
282
  }
230
283
 
231
- const maximumDimensions = await this.#defaultMaximums({
232
- width: maximumWidth,
233
- height: maximumHeight
234
- }, invocationContext);
235
-
236
- const vLength = vMatrixValues.length;
237
- const maximumArea = maximumDimensions.width * maximumDimensions.height;
284
+ const appExtension = this.appExtension;
238
285
 
239
- // Lengths 0 and 1 are valid and require no special processing.
240
- if (vLength > 1 && vLength <= maximumArea) {
241
- // Make spill as square as possible.
242
- let spillHeight = Math.min(Math.ceil(Math.sqrt(maximumArea)), maximumDimensions.height);
286
+ let notificationCallbackAdded = false;
287
+ let previousLogLevel: number | undefined = undefined;
243
288
 
244
- // Array that has a length of a power of 10 is treated specially.
245
- if (Number.isInteger(Math.log10(vLength))) {
246
- // Try spill height that is a power of 10.
247
- const spillHeight10 = 10 ** Math.floor(Math.log10(spillHeight));
289
+ const streamingConsumerCallback = appExtension.setUpStreaming<string>(streamingInvocationContext, () => {
290
+ if (notificationCallbackAdded) {
291
+ appExtension.memoryTransport.removeNotificationCallback("loggerMessages");
292
+ }
248
293
 
249
- // Keep default if not enough space for power of 10 matrix.
250
- if (vLength / spillHeight10 <= maximumDimensions.width) {
251
- spillHeight = spillHeight10;
252
- }
294
+ if (previousLogLevel !== undefined) {
295
+ appExtension.logger.settings.minLevel = previousLogLevel;
253
296
  }
297
+ });
254
298
 
255
- result = [];
299
+ if (appExtension.memoryTransport.addNotificationCallback("loggerMessages", (_message, messages) => {
300
+ streamingConsumerCallback(this.iterableResult(() => messages));
301
+ })) {
302
+ notificationCallbackAdded = true;
256
303
 
257
- for (let rowIndex = 0; rowIndex < spillHeight; rowIndex++) {
258
- const row = new Array<unknown>();
304
+ let logLevel: LogLevel | undefined = undefined;
259
305
 
260
- for (let cellIndex = rowIndex; cellIndex < vLength; cellIndex++) {
261
- row.push(vMatrixValues[cellIndex][0]);
306
+ if (!isNullish(logLevelString)) {
307
+ try {
308
+ logLevel = logLevelOf(logLevelString);
309
+ } catch {
310
+ // Ignore error.
262
311
  }
312
+ }
263
313
 
264
- result.push(row);
314
+ // Set log level if required.
315
+ if (logLevel !== undefined) {
316
+ previousLogLevel = appExtension.logger.settings.minLevel;
317
+ appExtension.logger.settings.minLevel = logLevel;
265
318
  }
266
319
  } else {
267
- // Return matrix unmodified and let application handle spill error if any.
268
- result = vMatrixValues;
320
+ // Diagnostic tool; localization not required.
321
+ streamingConsumerCallback([["Only one logger messages call allowable per workbook"]]);
269
322
  }
270
-
271
- return result;
272
323
  }
273
324
  }
package/src/descriptor.ts CHANGED
@@ -53,7 +53,7 @@ interface TypeDescriptor extends Descriptor {
53
53
  readonly type: Type;
54
54
 
55
55
  /**
56
- * True if type is a matrix (method accepts or returns a two-dimensional array).
56
+ * True if type is a matrix (method accepts or returns, or parameter is, a two-dimensional array).
57
57
  */
58
58
  readonly isMatrix: boolean;
59
59
  }
@@ -83,6 +83,21 @@ export interface ExtendsParameterDescriptor extends Partial<ParameterDescriptor>
83
83
  readonly sortOrder?: number;
84
84
  }
85
85
 
86
+ /**
87
+ * Replacement parameter descriptor.
88
+ */
89
+ export interface ReplacementParameterDescriptor {
90
+ /**
91
+ * Name to replace.
92
+ */
93
+ readonly name: string;
94
+
95
+ /**
96
+ * Replacement parameter descriptor.
97
+ */
98
+ readonly replacement: ParameterDescriptor;
99
+ }
100
+
86
101
  /**
87
102
  * Method descriptor.
88
103
  */
@@ -92,6 +107,21 @@ export interface MethodDescriptor extends TypeDescriptor {
92
107
  */
93
108
  readonly requiresContext?: boolean;
94
109
 
110
+ /**
111
+ * If true, function is hidden from user interface.
112
+ */
113
+ readonly isHidden?: boolean;
114
+
115
+ /**
116
+ * If true, function is volatile and should be reevaluated regularly.
117
+ */
118
+ readonly isVolatile?: boolean;
119
+
120
+ /**
121
+ * If true, function opens a stream that updates asynchronously.
122
+ */
123
+ readonly isStream?: boolean;
124
+
95
125
  /**
96
126
  * If true, method infix is ignored.
97
127
  */
@@ -134,12 +164,9 @@ export interface ClassDescriptor extends Descriptor {
134
164
  readonly methodInfix?: string | undefined;
135
165
 
136
166
  /**
137
- * Replace parameter descriptors for class hierarchies where enumeration parameter descriptors can change.
167
+ * Replacement parameter descriptors for class hierarchies where parameter types can narrow
138
168
  */
139
- readonly replaceParameterDescriptors?: ReadonlyArray<{
140
- readonly name: string;
141
- readonly replacement: ParameterDescriptor;
142
- }>;
169
+ readonly replacementParameterDescriptors?: ReplacementParameterDescriptor[];
143
170
 
144
171
  /**
145
172
  * Class name in optional namespace.
@@ -1,4 +1,4 @@
1
- import { I18nEnvironments } from "@aidc-toolkit/core";
1
+ import { I18nEnvironments, type Promisable } from "@aidc-toolkit/core";
2
2
  import type { ParseKeys } from "i18next";
3
3
  import { AppUtilityProxy } from "../app-utility-proxy.js";
4
4
  import type { ClassDescriptor, MethodDescriptor } from "../descriptor.js";
@@ -17,6 +17,7 @@ function registerProxies(..._proxies: unknown[]): void {
17
17
  }
18
18
 
19
19
  registerProxies(AppUtilityProxy, Utility, GS1);
20
+
20
21
  /**
21
22
  * Localization.
22
23
  */
@@ -181,7 +182,7 @@ export abstract class Generator {
181
182
  * @param success
182
183
  * True if successful.
183
184
  */
184
- protected abstract finalize(success: boolean): void | Promise<void>;
185
+ protected abstract finalize(success: boolean): Promisable<void>;
185
186
 
186
187
  /**
187
188
  * Generate a localization.
@@ -195,20 +196,23 @@ export abstract class Generator {
195
196
  * @param localizedKeyPrefix
196
197
  * Localized key prefix.
197
198
  *
199
+ * @param namespacePrefix
200
+ * Namespace prefix to be appended to name.
201
+ *
198
202
  * @param localizationCallback
199
203
  * Callback to finalize localization.
200
204
  *
201
205
  * @returns
202
206
  * Localization.
203
207
  */
204
- #generateLocalization<TLocalization extends Localization>(locale: string, localizedKeyPrefix: string, localizationCallback: (locale: string, localization: Localization) => TLocalization): TLocalization {
208
+ #generateLocalization<TLocalization extends Localization>(locale: string, localizedKeyPrefix: string, namespacePrefix: string, localizationCallback: (locale: string, localization: Localization) => TLocalization): TLocalization {
205
209
  const lngOption = {
206
210
  lng: locale
207
211
  };
208
212
 
209
213
  return localizationCallback(locale, {
210
214
  // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists.
211
- name: i18nextAppExtension.t(`${localizedKeyPrefix}name` as ParseKeys, lngOption),
215
+ name: `${namespacePrefix}${i18nextAppExtension.t(`${localizedKeyPrefix}name` as ParseKeys, lngOption)}`,
212
216
  // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists.
213
217
  description: i18nextAppExtension.t(`${localizedKeyPrefix}description` as ParseKeys, lngOption)
214
218
  });
@@ -222,28 +226,25 @@ export abstract class Generator {
222
226
 
223
227
  await i18nAppExtensionInit(I18nEnvironments.CLI);
224
228
 
225
- // const LocaleResourcesSource = path.resolve(LocaleResourcesGenerator.IMPORT_PATH, entry.name, "locale-resources.ts");
226
- //
227
- // await import(LocaleResourcesSource).then((module) => {
228
-
229
229
  this.initialize();
230
230
 
231
231
  try {
232
232
  for (const [_namespaceClassName, classDescriptor] of proxy.classDescriptorsMap.entries()) {
233
233
  const namespace = classDescriptor.namespace;
234
+ const namespacePrefix = namespace === undefined ? "" : `${namespace}.`;
235
+ const namespacePath = namespace === undefined ? "" : `${namespace}/`;
234
236
 
235
237
  this.createProxyObject(classDescriptor);
236
238
 
237
239
  for (const methodDescriptor of classDescriptor.methodDescriptors) {
238
240
  const namespaceFunctionName = methodDescriptor.namespaceFunctionName;
239
-
240
241
  const functionLocalizationsMap = new Map(this.#locales.map(locale =>
241
- [locale, this.#generateLocalization<FunctionLocalization>(locale, `Functions.${namespaceFunctionName}.`, (locale, localization) => ({
242
+ [locale, this.#generateLocalization<FunctionLocalization>(locale, `Functions.${namespaceFunctionName}.`, namespacePrefix, (locale, localization) => ({
242
243
  ...localization,
243
- documentationURL: `${Generator.#DOCUMENTATION_BASE_URL}${locale === this.defaultLocale ? "" : `${locale}/`}${Generator.#DOCUMENTATION_PATH}${namespace === undefined ? "" : `${namespace}/`}${localization.name}.html`,
244
+ documentationURL: `${Generator.#DOCUMENTATION_BASE_URL}${locale === this.defaultLocale ? "" : `${locale}/`}${Generator.#DOCUMENTATION_PATH}${namespacePath}${localization.name}.html`,
244
245
  parametersMap: new Map(methodDescriptor.parameterDescriptors.map(parameterDescriptor =>
245
246
  // eslint-disable-next-line max-nested-callbacks -- Callback is empty.
246
- [parameterDescriptor.name, this.#generateLocalization(locale, `Parameters.${parameterDescriptor.name}.`, (_locale, localization) => localization)]
247
+ [parameterDescriptor.name, this.#generateLocalization(locale, `Parameters.${parameterDescriptor.name}.`, "", (_locale, localization) => localization)]
247
248
  ))
248
249
  }))]
249
250
  ));
@@ -14,7 +14,7 @@ import { Generator } from "./generator.js";
14
14
  */
15
15
  interface ParametersSequencerEntry {
16
16
  /**
17
- * Parameters sequence or null if automatic.
17
+ * Parameters sequencer or null if automatic.
18
18
  */
19
19
  parametersSequencerOrNull: ParametersSequencer | null;
20
20
 
@@ -42,7 +42,6 @@ interface ParametersSequencerEntry {
42
42
  /**
43
43
  * Parameters sequencer for keeping similar (extended) parameters together.
44
44
  */
45
- // TODO Replace with map.
46
45
  type ParametersSequencer = Record<string, ParametersSequencerEntry>;
47
46
 
48
47
  /**
@@ -187,40 +186,43 @@ class LocaleResourcesGenerator extends Generator {
187
186
  * @inheritDoc
188
187
  */
189
188
  protected createProxyFunction(classDescriptor: ClassDescriptor, methodDescriptor: MethodDescriptor): void {
190
- // Add any parameters that are not already known.
191
- for (const parameterDescriptor of methodDescriptor.parameterDescriptors) {
192
- this.#saveParameterSequence(parameterDescriptor, true);
193
- }
189
+ // Hidden functions aren't localized.
190
+ if (!(methodDescriptor.isHidden ?? false)) {
191
+ // Add any parameters that are not already known.
192
+ for (const parameterDescriptor of methodDescriptor.parameterDescriptors) {
193
+ this.#saveParameterSequence(parameterDescriptor, true);
194
+ }
194
195
 
195
- let functionsLocaleResources = this.#functionsLocaleResources;
196
+ let functionsLocaleResources = this.#functionsLocaleResources;
196
197
 
197
- const namespace = classDescriptor.namespace;
198
+ const namespace = classDescriptor.namespace;
198
199
 
199
- if (namespace !== undefined) {
200
- if (!(namespace in functionsLocaleResources)) {
201
- const namespaceFunctionsLocaleResources: LocaleResources = {};
200
+ if (namespace !== undefined) {
201
+ if (!(namespace in functionsLocaleResources)) {
202
+ const namespaceFunctionsLocaleResources: LocaleResources = {};
202
203
 
203
- // Add namespace and navigate to it.
204
- functionsLocaleResources[namespace] = namespaceFunctionsLocaleResources;
205
- functionsLocaleResources = namespaceFunctionsLocaleResources;
206
- } else {
207
- // Navigate to namespace.
208
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Entry is never a string.
209
- functionsLocaleResources = functionsLocaleResources[namespace] as LocaleResources;
204
+ // Add namespace and navigate to it.
205
+ functionsLocaleResources[namespace] = namespaceFunctionsLocaleResources;
206
+ functionsLocaleResources = namespaceFunctionsLocaleResources;
207
+ } else {
208
+ // Navigate to namespace.
209
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Entry is never a string.
210
+ functionsLocaleResources = functionsLocaleResources[namespace] as LocaleResources;
211
+ }
210
212
  }
211
- }
212
213
 
213
- const functionName = methodDescriptor.functionName;
214
+ const functionName = methodDescriptor.functionName;
214
215
 
215
- if (functionName in functionsLocaleResources) {
216
- throw new Error(`Duplicate function ${functionName}`);
217
- }
216
+ if (functionName in functionsLocaleResources) {
217
+ throw new Error(`Duplicate function ${functionName}`);
218
+ }
218
219
 
219
- // Add function.
220
- functionsLocaleResources[functionName] = {
221
- name: functionName,
222
- description: "*** LOCALIZATION REQUIRED ***"
223
- };
220
+ // Add function.
221
+ functionsLocaleResources[functionName] = {
222
+ name: functionName,
223
+ description: "*** LOCALIZATION REQUIRED ***"
224
+ };
225
+ }
224
226
  }
225
227
 
226
228
  /**
@@ -11,15 +11,15 @@ import { CharacterSetCreatorProxy, CharacterSetValidatorProxy } from "../utility
11
11
  @proxy.describeClass(false, {
12
12
  namespace: "GS1",
13
13
  methodInfix: "AI82",
14
- replaceParameterDescriptors: [
14
+ replacementParameterDescriptors: [
15
15
  {
16
16
  name: expandParameterDescriptor(exclusionNoneParameterDescriptor).name,
17
17
  replacement: exclusionAllNumericParameterDescriptor
18
18
  }
19
19
  ]
20
20
  })
21
- export class AI82Proxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
22
- constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
21
+ export class AI82Proxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
22
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt>) {
23
23
  super(appExtension, AI82_CREATOR);
24
24
  }
25
25
  }
@@ -27,15 +27,15 @@ export class AI82Proxy<ThrowError extends boolean, TError extends ErrorExtends<T
27
27
  @proxy.describeClass(false, {
28
28
  namespace: "GS1",
29
29
  methodInfix: "AI39",
30
- replaceParameterDescriptors: [
30
+ replacementParameterDescriptors: [
31
31
  {
32
32
  name: expandParameterDescriptor(exclusionNoneParameterDescriptor).name,
33
33
  replacement: exclusionAllNumericParameterDescriptor
34
34
  }
35
35
  ]
36
36
  })
37
- export class AI39Proxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
38
- constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
37
+ export class AI39Proxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
38
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt>) {
39
39
  super(appExtension, AI39_CREATOR);
40
40
  }
41
41
  }
@@ -44,8 +44,8 @@ export class AI39Proxy<ThrowError extends boolean, TError extends ErrorExtends<T
44
44
  namespace: "GS1",
45
45
  methodInfix: "AI64"
46
46
  })
47
- export class AI64Proxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
48
- constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
47
+ export class AI64Proxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends CharacterSetValidatorProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
48
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt>) {
49
49
  super(appExtension, AI64_VALIDATOR);
50
50
  }
51
51
  }