@aidc-toolkit/app-extension 1.0.28-beta → 1.0.31-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 CHANGED
@@ -1748,6 +1748,8 @@ var Proxy2 = class _Proxy {
1748
1748
  /**
1749
1749
  * Logger.
1750
1750
  */
1751
+ // TODO Add configuration parameter to output JSON.
1752
+ // TODO Change this to LogLevels.Trace when configuration available.
1751
1753
  #logger = (0, import_core2.getLogger)(import_core2.LogLevels.Info);
1752
1754
  /**
1753
1755
  * Abstract class descriptors map, keyed on declaration class name. Abstract classes are not used directly by target
@@ -1925,9 +1927,9 @@ var Proxy2 = class _Proxy {
1925
1927
  /**
1926
1928
  * @inheritDoc
1927
1929
  */
1928
- log(methodName, args, result) {
1930
+ log(logLevel, methodName, args, result) {
1929
1931
  const methodDescriptor = methodDescriptorsMap.get(methodName);
1930
- logger.info(JSON.stringify({
1932
+ logger.log(logLevel, "", JSON.stringify({
1931
1933
  namespace: decoratorClassDescriptor.namespace,
1932
1934
  className: name,
1933
1935
  methodName,
@@ -1976,8 +1978,15 @@ var Proxy2 = class _Proxy {
1976
1978
  parameterDescriptors
1977
1979
  });
1978
1980
  return function methodProxy(...args) {
1979
- const result = target.call(this, ...args);
1980
- this.log(name, args, result);
1981
+ const targetLogger = this;
1982
+ let result;
1983
+ try {
1984
+ result = target.call(this, ...args);
1985
+ targetLogger.log(import_core2.LogLevels.Info, name, args, result);
1986
+ } catch (e) {
1987
+ targetLogger.log(import_core2.LogLevels.Error, name, args, e instanceof Error ? `${e.name}: ${e.message}` : `Unknown exception: ${String(e)}`);
1988
+ throw e;
1989
+ }
1981
1990
  return result;
1982
1991
  };
1983
1992
  };
@@ -3618,19 +3627,22 @@ var Generator = class _Generator {
3618
3627
  * @param localizedKeyPrefix
3619
3628
  * Localized key prefix.
3620
3629
  *
3630
+ * @param namespacePrefix
3631
+ * Namespace prefix to be appended to name.
3632
+ *
3621
3633
  * @param localizationCallback
3622
3634
  * Callback to finalize localization.
3623
3635
  *
3624
3636
  * @returns
3625
3637
  * Localization.
3626
3638
  */
3627
- #generateLocalization(locale, localizedKeyPrefix, localizationCallback) {
3639
+ #generateLocalization(locale, localizedKeyPrefix, namespacePrefix, localizationCallback) {
3628
3640
  const lngOption = {
3629
3641
  lng: locale
3630
3642
  };
3631
3643
  return localizationCallback(locale, {
3632
3644
  // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists.
3633
- name: i18nextAppExtension.t(`${localizedKeyPrefix}name`, lngOption),
3645
+ name: `${namespacePrefix}${i18nextAppExtension.t(`${localizedKeyPrefix}name`, lngOption)}`,
3634
3646
  // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists.
3635
3647
  description: i18nextAppExtension.t(`${localizedKeyPrefix}description`, lngOption)
3636
3648
  });
@@ -3645,17 +3657,19 @@ var Generator = class _Generator {
3645
3657
  try {
3646
3658
  for (const [_namespaceClassName, classDescriptor] of proxy.classDescriptorsMap.entries()) {
3647
3659
  const namespace = classDescriptor.namespace;
3660
+ const namespacePrefix = namespace === void 0 ? "" : `${namespace}.`;
3661
+ const namespacePath = namespace === void 0 ? "" : `${namespace}/`;
3648
3662
  this.createProxyObject(classDescriptor);
3649
3663
  for (const methodDescriptor of classDescriptor.methodDescriptors) {
3650
3664
  const namespaceFunctionName = methodDescriptor.namespaceFunctionName;
3651
3665
  const functionLocalizationsMap = new Map(this.#locales.map(
3652
- (locale) => [locale, this.#generateLocalization(locale, `Functions.${namespaceFunctionName}.`, (locale2, localization) => ({
3666
+ (locale) => [locale, this.#generateLocalization(locale, `Functions.${namespaceFunctionName}.`, namespacePrefix, (locale2, localization) => ({
3653
3667
  ...localization,
3654
- documentationURL: `${_Generator.#DOCUMENTATION_BASE_URL}${locale2 === this.defaultLocale ? "" : `${locale2}/`}${_Generator.#DOCUMENTATION_PATH}${namespace === void 0 ? "" : `${namespace}/`}${localization.name}.html`,
3668
+ documentationURL: `${_Generator.#DOCUMENTATION_BASE_URL}${locale2 === this.defaultLocale ? "" : `${locale2}/`}${_Generator.#DOCUMENTATION_PATH}${namespacePath}${localization.name}.html`,
3655
3669
  parametersMap: new Map(methodDescriptor.parameterDescriptors.map(
3656
3670
  (parameterDescriptor) => (
3657
3671
  // eslint-disable-next-line max-nested-callbacks -- Callback is empty.
3658
- [parameterDescriptor.name, this.#generateLocalization(locale2, `Parameters.${parameterDescriptor.name}.`, (_locale, localization2) => localization2)]
3672
+ [parameterDescriptor.name, this.#generateLocalization(locale2, `Parameters.${parameterDescriptor.name}.`, "", (_locale, localization2) => localization2)]
3659
3673
  )
3660
3674
  ))
3661
3675
  }))]