libmodulor 0.4.0 → 0.5.0

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 (204) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/README.md +3 -3
  3. package/dist/esm/app/workers/AppSrcFilePathBuilder.d.ts +16 -0
  4. package/dist/esm/app/workers/AppSrcFilePathBuilder.js +6 -4
  5. package/dist/esm/apps/Helper/index.js +1 -0
  6. package/dist/esm/apps/Helper/src/ucds/GenerateAppsTestsUCD.js +3 -2
  7. package/dist/esm/bundlers/vite/StripUCDLifecycleServerPlugin.js +3 -0
  8. package/dist/esm/convention.d.ts +1 -0
  9. package/dist/esm/convention.js +17 -4
  10. package/dist/esm/dt/Validation.d.ts +8 -0
  11. package/dist/esm/dt/Validation.js +8 -0
  12. package/dist/esm/dt/base/TBase.d.ts +2 -1
  13. package/dist/esm/dt/base/TBoolean.js +2 -0
  14. package/dist/esm/dt/base/TInt.js +3 -0
  15. package/dist/esm/dt/base/TNumber.js +2 -0
  16. package/dist/esm/dt/base/TObject.d.ts +15 -0
  17. package/dist/esm/dt/base/TObject.js +14 -0
  18. package/dist/esm/dt/base/TString.js +1 -1
  19. package/dist/esm/dt/final/TAmount.js +1 -0
  20. package/dist/esm/dt/final/TCountryISO3166Alpha2.js +1 -0
  21. package/dist/esm/dt/final/TCurrencyISO4217.js +1 -0
  22. package/dist/esm/dt/final/TDateTimeFormat.js +1 -0
  23. package/dist/esm/dt/final/TEmail.js +2 -0
  24. package/dist/esm/dt/final/TEmoji.js +4 -0
  25. package/dist/esm/dt/final/TFile.js +3 -0
  26. package/dist/esm/dt/final/THostAddress.js +2 -0
  27. package/dist/esm/dt/final/TIPv6.js +1 -0
  28. package/dist/esm/dt/final/TJWT.js +8 -0
  29. package/dist/esm/dt/final/TPercentage.js +5 -0
  30. package/dist/esm/dt/final/TSQLQuery.js +1 -0
  31. package/dist/esm/dt/final/TSSHPrivateKey.js +3 -1
  32. package/dist/esm/dt/final/TSemVerVersion.js +1 -0
  33. package/dist/esm/dt/final/TShellCommand.js +1 -0
  34. package/dist/esm/dt/final/TURL.js +2 -0
  35. package/dist/esm/dt/final/TUUID.js +1 -0
  36. package/dist/esm/dt/final/TYesNo.js +1 -1
  37. package/dist/esm/i18n/WordingManager.d.ts +16 -0
  38. package/dist/esm/i18n/types.d.ts +5 -0
  39. package/dist/esm/icon/Icon.d.ts +7 -0
  40. package/dist/esm/index.d.ts +3 -0
  41. package/dist/esm/index.js +4 -0
  42. package/dist/esm/product/manifest.d.ts +15 -0
  43. package/dist/esm/products/Helper/index.js +3 -0
  44. package/dist/esm/products/Helper/manifest.d.ts +6 -1
  45. package/dist/esm/std/BufferManager.d.ts +18 -0
  46. package/dist/esm/std/ClockManager.d.ts +5 -0
  47. package/dist/esm/std/EnvironmentManager.d.ts +10 -0
  48. package/dist/esm/std/HTTPAPICaller.d.ts +6 -0
  49. package/dist/esm/std/I18nManager.d.ts +26 -0
  50. package/dist/esm/std/JWTManager.d.ts +26 -0
  51. package/dist/esm/std/JobManager.d.ts +6 -0
  52. package/dist/esm/std/LLMManager.d.ts +25 -0
  53. package/dist/esm/std/LLMManager.js +1 -0
  54. package/dist/esm/std/PromptManager.d.ts +8 -0
  55. package/dist/esm/std/SettingsManager.d.ts +19 -0
  56. package/dist/esm/std/SettingsManager.js +9 -0
  57. package/dist/esm/std/impl/ConsoleLogger.js +7 -1
  58. package/dist/esm/std/impl/FakeEmailManager.js +1 -0
  59. package/dist/esm/std/impl/FakeJobManager.js +1 -0
  60. package/dist/esm/std/impl/FetchHTTPAPICallExecutor.d.ts +9 -0
  61. package/dist/esm/std/impl/FetchHTTPAPICallExecutor.js +11 -0
  62. package/dist/esm/std/impl/MistralAILLMManager.d.ts +17 -0
  63. package/dist/esm/std/impl/MistralAILLMManager.js +56 -0
  64. package/dist/esm/std/impl/NodeCryptoManager.js +6 -1
  65. package/dist/esm/std/impl/NodeDeterministicCryptoManager.d.ts +14 -0
  66. package/dist/esm/std/impl/NodeDeterministicCryptoManager.js +17 -3
  67. package/dist/esm/std/impl/NodeFSManager.js +10 -0
  68. package/dist/esm/std/impl/NodeHTTPAPICallExecutorAgentBuilder.js +2 -0
  69. package/dist/esm/std/impl/NodePromptManager.js +3 -0
  70. package/dist/esm/std/impl/OllamaLLMManager.d.ts +20 -0
  71. package/dist/esm/std/impl/OllamaLLMManager.js +56 -0
  72. package/dist/esm/std/impl/OpenAILLMManager.d.ts +17 -0
  73. package/dist/esm/std/impl/OpenAILLMManager.js +51 -0
  74. package/dist/esm/std/impl/SimpleHTTPAPICaller.js +14 -0
  75. package/dist/esm/std/impl/SimpleMapI18nManager.js +4 -2
  76. package/dist/esm/std/impl/StdDateClockManager.js +3 -0
  77. package/dist/esm/std/impl/UCDataStoreExternalResourceManager.js +3 -0
  78. package/dist/esm/std/impl/WebCryptoManager.js +9 -0
  79. package/dist/esm/std/index.d.ts +1 -0
  80. package/dist/esm/std/index.js +1 -0
  81. package/dist/esm/target/lib/cli/renderer.js +3 -0
  82. package/dist/esm/target/lib/client/consts.d.ts +3 -0
  83. package/dist/esm/target/lib/client/consts.js +3 -0
  84. package/dist/esm/target/lib/mcp-server/MCPServerBooter.js +1 -0
  85. package/dist/esm/target/lib/react/UCContainer.js +1 -0
  86. package/dist/esm/target/lib/react/UCPanel.js +4 -0
  87. package/dist/esm/target/lib/react/useUC.d.ts +8 -0
  88. package/dist/esm/target/lib/react/useUC.js +22 -0
  89. package/dist/esm/target/lib/react/useUCOR.d.ts +15 -0
  90. package/dist/esm/target/lib/react/useUCOR.js +45 -0
  91. package/dist/esm/target/lib/rn/input.d.ts +7 -0
  92. package/dist/esm/target/lib/rn/input.js +2 -0
  93. package/dist/esm/target/lib/server/AuthenticationChecker.js +2 -1
  94. package/dist/esm/target/lib/server/BasicAuthenticationChecker.js +1 -0
  95. package/dist/esm/target/lib/server/CSPDirectivesBuilder.js +13 -0
  96. package/dist/esm/target/lib/server/CustomerFacingErrorBuilder.js +3 -0
  97. package/dist/esm/target/lib/server/PrivateApiKeyAuthenticationChecker.js +1 -0
  98. package/dist/esm/target/lib/server/PublicApiKeyChecker.js +1 -1
  99. package/dist/esm/target/lib/server/RequestChecker.js +5 -4
  100. package/dist/esm/target/lib/server/RequestHandler.d.ts +5 -0
  101. package/dist/esm/target/lib/server/RequestLogger.js +5 -0
  102. package/dist/esm/target/lib/server/ServerManager.d.ts +19 -0
  103. package/dist/esm/target/lib/server/consts.d.ts +3 -0
  104. package/dist/esm/target/lib/server/consts.js +3 -0
  105. package/dist/esm/target/lib/web/input.d.ts +21 -0
  106. package/dist/esm/target/lib/web/input.js +4 -0
  107. package/dist/esm/target/node-core-cli/NodeCoreCLIManager.js +2 -2
  108. package/dist/esm/target/node-express-server/NodeExpressServerManager.js +5 -0
  109. package/dist/esm/target/node-express-server/lib/AuthCookieCreator.js +1 -1
  110. package/dist/esm/target/node-express-server/middlewares/AuthenticationCheckerMiddlewareBuilder.js +1 -0
  111. package/dist/esm/target/node-express-server/middlewares/PublicApiKeyCheckerMiddlewareBuilder.js +1 -0
  112. package/dist/esm/target/node-express-server/middlewares/RequestCheckerMiddlewareBuilder.js +1 -0
  113. package/dist/esm/target/node-express-server/middlewares/RequestHandlerMiddlewareBuilder.js +8 -0
  114. package/dist/esm/target/node-express-server/middlewares/RequestLoggerMiddlewareBuilder.js +1 -0
  115. package/dist/esm/target/node-mcp-server/NodeLocalStdioMCPServerManager.d.ts +10 -0
  116. package/dist/esm/target/node-mcp-server/NodeLocalStdioMCPServerManager.js +14 -0
  117. package/dist/esm/target/react-native-pure/UCFormFieldControl.js +1 -0
  118. package/dist/esm/testing/AppTester.d.ts +4 -0
  119. package/dist/esm/testing/AppTester.js +16 -0
  120. package/dist/esm/testing/AppTesterConfigurator.d.ts +68 -0
  121. package/dist/esm/testing/UCDataStoreTester.d.ts +9 -0
  122. package/dist/esm/testing/UCDataStoreTester.js +13 -0
  123. package/dist/esm/testing/impl/SimpleAppDocsEmitter.js +22 -2
  124. package/dist/esm/testing/impl/SimpleAppTesterConfigurator.js +1 -0
  125. package/dist/esm/testing/impl/SimpleHTMLAppTestReportEmitter.js +9 -3
  126. package/dist/esm/testing/impl/TypeScriptLibUCDefASTParser.js +12 -4
  127. package/dist/esm/testing/impl/VitestAppTestSuiteEmitter.js +6 -0
  128. package/dist/esm/testing/opts.d.ts +38 -0
  129. package/dist/esm/testing/opts.js +1 -1
  130. package/dist/esm/testing/uc-input.js +2 -0
  131. package/dist/esm/testing/workers/AppTesterCtxInitializer.js +7 -0
  132. package/dist/esm/testing/workers/UCExecutor.js +1 -0
  133. package/dist/esm/testing/workers/checkers/AppIndexChecker.js +1 -0
  134. package/dist/esm/testing/workers/checkers/UCDefSourcesChecker.js +4 -0
  135. package/dist/esm/uc/UC.js +19 -1
  136. package/dist/esm/uc/UCInputField.d.ts +28 -0
  137. package/dist/esm/uc/UCInputField.js +42 -0
  138. package/dist/esm/uc/data.d.ts +3 -0
  139. package/dist/esm/uc/def.d.ts +7 -0
  140. package/dist/esm/uc/exec.d.ts +39 -0
  141. package/dist/esm/uc/exec.js +29 -0
  142. package/dist/esm/uc/ext.d.ts +30 -1
  143. package/dist/esm/uc/helpers/UCOutputBuilder.js +5 -0
  144. package/dist/esm/uc/helpers/UCOutputReader.js +3 -1
  145. package/dist/esm/uc/impl/HTTPUCTransporter.js +4 -0
  146. package/dist/esm/uc/impl/InMemoryUCDataStore.js +7 -0
  147. package/dist/esm/uc/impl/KnexUCDataStore.d.ts +4 -0
  148. package/dist/esm/uc/impl/KnexUCDataStore.js +14 -0
  149. package/dist/esm/uc/impl/SimpleUCManager.js +6 -0
  150. package/dist/esm/uc/input-field.d.ts +60 -0
  151. package/dist/esm/uc/input-field.js +33 -0
  152. package/dist/esm/uc/input.d.ts +24 -0
  153. package/dist/esm/uc/lifecycle/client/IdleClientMain.js +1 -0
  154. package/dist/esm/uc/lifecycle/server/IdleServerMain.js +2 -0
  155. package/dist/esm/uc/manager.d.ts +11 -0
  156. package/dist/esm/uc/metadata.d.ts +10 -0
  157. package/dist/esm/uc/opi-layout.d.ts +3 -0
  158. package/dist/esm/uc/opi.d.ts +8 -0
  159. package/dist/esm/uc/output-field.d.ts +9 -0
  160. package/dist/esm/uc/output-part.d.ts +22 -0
  161. package/dist/esm/uc/output.d.ts +3 -0
  162. package/dist/esm/uc/policies/RoleRegularUCPolicy.js +1 -0
  163. package/dist/esm/uc/policies/funcs.js +1 -0
  164. package/dist/esm/uc/policy.d.ts +22 -0
  165. package/dist/esm/uc/sec.d.ts +9 -0
  166. package/dist/esm/uc/server.d.ts +10 -0
  167. package/dist/esm/uc/settings.d.ts +25 -0
  168. package/dist/esm/uc/side-effect.d.ts +16 -0
  169. package/dist/esm/uc/side-effect.js +16 -0
  170. package/dist/esm/uc/utils/rInput.d.ts +12 -0
  171. package/dist/esm/uc/utils/rInput.js +2 -0
  172. package/dist/esm/uc/utils/rVal.d.ts +25 -0
  173. package/dist/esm/uc/utils/rVal.js +27 -0
  174. package/dist/esm/uc/utils/recIs.d.ts +9 -0
  175. package/dist/esm/uc/utils/recIs.js +12 -1
  176. package/dist/esm/uc/utils/stripUCDLifecycleServer.d.ts +13 -0
  177. package/dist/esm/uc/utils/stripUCDLifecycleServer.js +17 -0
  178. package/dist/esm/uc/utils/ucifcoIsForArray.d.ts +6 -0
  179. package/dist/esm/uc/utils/ucifcoIsForArray.js +6 -0
  180. package/dist/esm/uc/workers/SimpleAggregateFinder.d.ts +12 -0
  181. package/dist/esm/uc/workers/SimpleAggregateFinder.js +12 -0
  182. package/dist/esm/uc/workers/UCBuilder.d.ts +7 -0
  183. package/dist/esm/uc/workers/UCBuilder.js +7 -0
  184. package/dist/esm/uc/workers/UCExecChecker.js +2 -0
  185. package/dist/esm/uc/workers/UCInputFilesProcessor.js +10 -4
  186. package/dist/esm/uc/workers/UCOutputFilesProcessor.js +6 -2
  187. package/dist/esm/utils/async/sleep.d.ts +10 -0
  188. package/dist/esm/utils/async/sleep.js +10 -0
  189. package/dist/esm/utils/http/appendData.js +5 -1
  190. package/dist/esm/utils/ioc/ContainerPrinter.js +2 -0
  191. package/dist/esm/utils/ioc/bindCommon.js +4 -0
  192. package/dist/esm/utils/ioc/bindNodeCLI.js +2 -0
  193. package/dist/esm/utils/ioc/bindNodeCore.js +1 -0
  194. package/dist/esm/utils/ioc/bindProduct.js +2 -0
  195. package/dist/esm/utils/ioc/bindRN.js +1 -0
  196. package/dist/esm/utils/ioc/bindServer.js +1 -0
  197. package/dist/esm/utils/ioc/bindWeb.js +2 -0
  198. package/dist/esm/utils/ioc/container.js +6 -0
  199. package/dist/esm/utils/numbers/units.js +3 -0
  200. package/dist/esm/utils/types/funcs.d.ts +35 -0
  201. package/dist/esm/utils/types/funcs.js +35 -0
  202. package/dist/esm/utils/types/utility-types.d.ts +17 -0
  203. package/dist/esm/utils/types/utility-types.js +1 -0
  204. package/package.json +9 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.5.0 (2025-02-24)
4
+
5
+ **BREAKING**
6
+
7
+ - Replace `.js` by `.ts` for `ProductManifest`
8
+
9
+ **Added**
10
+
11
+ - Introduce a 3<sup>rd</sup> implementation of `LLMManager` (`OllamaLLMManager`) to run models locally
12
+ - Introduce `LLMManager` with 2 implementations (`MistralAILLMManager` and `OpenAILLMManager`)
13
+
14
+ **Misc**
15
+
16
+ - Simplify the signature of `UCDef.ext.http.transform` removing the generic `T` return
17
+ - Add JSDocs and comments for a better in-place documentation (i.e. in .d.ts files)
18
+ - Add the Tutorial code in the repo at `examples/libmodulor-tuto` and add a new "Expose a rn Target" step
19
+
3
20
  ## v0.4.0 (2025-01-31)
4
21
 
5
22
  **feat(target): introduce react-native-pure**
@@ -15,7 +32,7 @@ To help with the creation of specific targets, we've added a new one : `react-na
15
32
 
16
33
  **feat(uc): introduce alternate mounting point**
17
34
 
18
- Added a new property `UcDef.ext.http.mountAlsoAt` to be able to define path aliases. See the comment below to understand why.
35
+ Added a new property `UCDef.ext.http.mountAlsoAt` to be able to define path aliases. See the comment below to understand why.
19
36
 
20
37
  ```typescript
21
38
  /**
package/README.md CHANGED
@@ -27,11 +27,11 @@ Applications created with `libmodulor` have **6 main properties** :
27
27
 
28
28
  ## 🚀 Getting Started
29
29
 
30
- To get started, we recommend reading the [📖 Introduction](https://github.com/c100k/libmodulor/blob/v0.4.0/docs/Introduction.md) first. It will give you an overview of what `libmodulor` is and how it works.
30
+ To get started, we recommend reading the [📖 Introduction](https://github.com/c100k/libmodulor/blob/v0.5.0/docs/Introduction.md) first. It will give you an overview of what `libmodulor` is and how it works.
31
31
 
32
- Then, you can follow the [🚀 Tutorial](https://github.com/c100k/libmodulor/blob/v0.4.0/docs/Tutorial.md) that will show you all the main notions by building something real.
32
+ Then, you can follow the [🚀 Tutorial](https://github.com/c100k/libmodulor/blob/v0.5.0/docs/Tutorial.md) that will show you all the main notions by building something real. We'll build a small Trading app that will allow us to buy an asset from a web page, a Terminal, Claude Desktop, Android and iOS ! All within a single, simple codebase.
33
33
 
34
- Finally, for more advanced usages, go to the [📜 Guides](https://github.com/c100k/libmodulor/blob/v0.4.0/docs/Guides.md).
34
+ Finally, for more advanced usages, go to the [📜 Guides](https://github.com/c100k/libmodulor/blob/v0.5.0/docs/Guides.md).
35
35
 
36
36
  ## 👨‍💻 Contribute
37
37
 
@@ -3,10 +3,26 @@ import type { FSManager, Logger, Worker } from '../../std/index.js';
3
3
  import type { AppName } from '../manifest.js';
4
4
  export interface Input {
5
5
  appName: AppName;
6
+ /**
7
+ * If set, it uses this value to build the path. Otherwise, it fallbacks on {@link appsRootPath}.
8
+ * @see {@link APPS_ROOT_ALIAS}
9
+ */
6
10
  appsRootAlias?: FilePath | undefined;
11
+ /**
12
+ * If `true`, it uses {@link APPS_ROOT_ALIAS} to build the path. Otherwise, it checks {@link appsRootAlias}.
13
+ */
7
14
  appsRootAliasUseDefault?: boolean | undefined;
15
+ /**
16
+ * @defaultValue {@link APPS_ROOT_DIR_NAME}
17
+ */
8
18
  appsRootPath?: FilePath | undefined;
9
19
  ext?: 'js' | 'ts' | undefined;
20
+ /**
21
+ * For example, it can be `[APP_MANIFEST_NAME]`.
22
+ *
23
+ * Do not include the extension. This must be passed by the caller via {@link ext}.
24
+ * Indeed, depending on the context, the extension is not needed (e.g. in tests).
25
+ */
10
26
  filePathParts: FilePath[];
11
27
  }
12
28
  type Output = FilePath;
@@ -23,16 +23,18 @@ let AppSrcFilePathBuilder = class AppSrcFilePathBuilder {
23
23
  const appPath = this.fsManager.path(appsRootPath ?? APPS_ROOT_DIR_NAME, appName);
24
24
  let importPath = '';
25
25
  if (appsRootAliasUseDefault) {
26
- importPath = this.fsManager.path(APPS_ROOT_ALIAS, appName);
26
+ importPath = this.fsManager.path(APPS_ROOT_ALIAS, appName); // @apps/MyApp
27
27
  }
28
28
  else if (appsRootAlias) {
29
- importPath = this.fsManager.path(appsRootAlias, appName);
29
+ importPath = this.fsManager.path(appsRootAlias, appName); // @myapps/MyApp
30
30
  }
31
31
  else {
32
- importPath = this.fsManager.path(appPath);
33
- importPath = `./${importPath}`;
32
+ importPath = this.fsManager.path(appPath); // src/apps/MyApp
33
+ importPath = `./${importPath}`; // ./src/apps/MyApp
34
34
  }
35
35
  const filePath = this.fsManager.path(APP_SRC_DIR_NAME, ...filePathParts);
36
+ // NOTE 1 : We don't check if the path exists because it wouldn't work when using an alias. So we let the caller do it. For example when using `import` it will fail by itself.
37
+ // NOTE 2 : Not using `path()` to join in order to avoid the initial `./` to be removed (this is the default behavior of node's join function).
36
38
  const suffix = ext ? `.${ext}` : '';
37
39
  const path = `${importPath}/${filePath}${suffix}`;
38
40
  this.logger.trace('Resolving app src', { path });
@@ -1,2 +1,3 @@
1
+ // Expose only what's necessary
1
2
  export { I18n } from './src/i18n.js';
2
3
  export { Manifest } from './src/manifest.js';
@@ -36,6 +36,7 @@ let GenerateAppsTestsClientMain = class GenerateAppsTestsClientMain {
36
36
  const { apps } = await this.appSrcBrowser.exec({
37
37
  appsPath,
38
38
  });
39
+ // Keeping it simple without any defensive programming. Be responsible !
39
40
  const depsMappingParsed = new Map((depsMapping || []).map((dm) => dm.split(DEP_MAPPING_SEP)));
40
41
  let idx = 0;
41
42
  for await (const [appPath] of apps) {
@@ -70,7 +71,7 @@ export const GenerateAppsTestsUCD = {
70
71
  ...AppInputFieldsDef,
71
72
  depsMapping: {
72
73
  cardinality: {
73
- max: 20,
74
+ max: 20, // A totally arbitrary number
74
75
  min: 0,
75
76
  },
76
77
  type: new TDepMapping().setExamples([
@@ -91,7 +92,7 @@ export const GenerateAppsTestsUCD = {
91
92
  },
92
93
  type: new THostPort()
93
94
  .setDefaultValue(14_000)
94
- .setExamples([14_000]),
95
+ .setExamples([14_000]), // "Calvados ❤️"
95
96
  },
96
97
  },
97
98
  },
@@ -1,6 +1,9 @@
1
1
  import { UC_DEF_FILE_NAME_SUFFIX } from '../../convention.js';
2
2
  import { stripUCDLifecycleServer } from '../../uc/index.js';
3
3
  export const StripUCDLifecycleServerPlugin = {
4
+ // Why enforce ?
5
+ // Otherwise Rollup parses the file and strips trailing commas.
6
+ // We need them to strip correctly (although the implementation will be made more robust).
4
7
  enforce: 'pre',
5
8
  name: 'strip-ucd-lifecycle-server',
6
9
  transform: (src, id) => {
@@ -23,6 +23,7 @@ export declare const APP_TEST_REPORTS_DIR_NAME: string;
23
23
  export declare const PRODUCTS_ROOT_ALIAS: string;
24
24
  export declare const PRODUCTS_ROOT_PATH: string[];
25
25
  export declare const PRODUCT_MANIFEST_NAME: string;
26
+ export declare const PRODUCT_MANIFEST_FILE_EXT: string;
26
27
  export declare const PRODUCT_MANIFEST_FILE_NAME: string;
27
28
  export declare const PRODUCT_NAME_PLACEHOLDER: ProductName;
28
29
  export declare const UC_DEF_SUFFIX: string;
@@ -1,4 +1,10 @@
1
+ /*
2
+ * Common
3
+ */
1
4
  export const SRC_DIR_NAME = 'src';
5
+ /*
6
+ * App
7
+ */
2
8
  export const APPS_ROOT_DIR_NAME = 'apps';
3
9
  export const APPS_ROOT_ALIAS = `@${APPS_ROOT_DIR_NAME}`;
4
10
  export const APPS_ROOT_PATH = [SRC_DIR_NAME, APPS_ROOT_DIR_NAME];
@@ -7,22 +13,29 @@ export const APP_I18N_NAME = 'I18n';
7
13
  export const APP_I18N_FILE_NAME = `${APP_I18N_NAME.toLowerCase()}.ts`;
8
14
  export const APP_INDEX_NAME = 'index';
9
15
  export const APP_INDEX_FILE_NAME = `${APP_INDEX_NAME}.ts`;
10
- export const APP_INDEX_FILE_NAME_FOR_IMPORT = 'index.js';
16
+ export const APP_INDEX_FILE_NAME_FOR_IMPORT = 'index.js'; // ESM
11
17
  export const APP_MANIFEST_NAME = 'Manifest';
12
18
  export const APP_MANIFEST_FILE_EXT = '.ts';
13
- export const APP_MANIFEST_FILE_NAME = `${APP_MANIFEST_NAME.toLowerCase()}.ts`;
19
+ export const APP_MANIFEST_FILE_NAME = `${APP_MANIFEST_NAME.toLowerCase()}${APP_MANIFEST_FILE_EXT}`;
14
20
  export const APP_NAME_PLACEHOLDER = 'AppX';
15
- export const APP_ROOT_FROM_UCD = ['..', '..', '..'];
21
+ export const APP_ROOT_FROM_UCD = ['..', '..', '..']; // $root/src/ucds/XyzUCD.ts
16
22
  export const APP_SRC_DIR_NAME = SRC_DIR_NAME;
17
23
  export const APP_SRC_UCDS_DIR_NAME = 'ucds';
18
24
  export const APP_TEST_DIR_NAME = 'test';
19
25
  export const APP_TEST_MAIN_FILE_NAME = 'App.test.ts';
20
26
  export const APP_TEST_REPORTS_DIR_NAME = 'reports';
27
+ /*
28
+ * Product
29
+ */
21
30
  export const PRODUCTS_ROOT_ALIAS = '@p';
22
31
  export const PRODUCTS_ROOT_PATH = [SRC_DIR_NAME, 'products'];
23
32
  export const PRODUCT_MANIFEST_NAME = 'Manifest';
24
- export const PRODUCT_MANIFEST_FILE_NAME = `${PRODUCT_MANIFEST_NAME.toLowerCase()}.js`;
33
+ export const PRODUCT_MANIFEST_FILE_EXT = '.ts';
34
+ export const PRODUCT_MANIFEST_FILE_NAME = `${PRODUCT_MANIFEST_NAME.toLowerCase()}${PRODUCT_MANIFEST_FILE_EXT}`;
25
35
  export const PRODUCT_NAME_PLACEHOLDER = 'ProductX';
36
+ /*
37
+ * Use Case
38
+ */
26
39
  export const UC_DEF_SUFFIX = 'UCD';
27
40
  export const UC_DEF_FILE_NAME_EXT = '.ts';
28
41
  export const UC_DEF_FILE_NAME_SUFFIX = `${UC_DEF_SUFFIX}${UC_DEF_FILE_NAME_EXT}`;
@@ -19,6 +19,14 @@ export declare class Validation {
19
19
  get(idx?: NumIndex): [ViolationI18nable, string] | null;
20
20
  getViolations(): Violation[];
21
21
  getViolationsAsI18nables(): ViolationI18nable[];
22
+ /**
23
+ * Check whether the validation has succeeded or not
24
+ *
25
+ * If you want to get a violation, use directly {@link get} and check if it's null.
26
+ * No need to check if `!validation.isOK()` and then call `validation.get()`.
27
+ *
28
+ * @returns
29
+ */
22
30
  isOK(): boolean;
23
31
  private violationAsI18nable;
24
32
  }
@@ -24,6 +24,14 @@ export class Validation {
24
24
  getViolationsAsI18nables() {
25
25
  return this.violations.map((v) => this.violationAsI18nable(v));
26
26
  }
27
+ /**
28
+ * Check whether the validation has succeeded or not
29
+ *
30
+ * If you want to get a violation, use directly {@link get} and check if it's null.
31
+ * No need to check if `!validation.isOK()` and then call `validation.get()`.
32
+ *
33
+ * @returns
34
+ */
27
35
  isOK() {
28
36
  return this.violations.length === 0;
29
37
  }
@@ -19,7 +19,8 @@ export interface SemanticsValue {
19
19
  color?: Color;
20
20
  variant?: SemanticsVariant;
21
21
  }
22
- export type SemanticsMapping = Record<string, SemanticsValue>;
22
+ export type SemanticsMapping = Record<string, // corresponds to T.toString()
23
+ SemanticsValue>;
23
24
  export type SemanticsPredicate<T> = (value: T) => SemanticsValue;
24
25
  export interface OptionsOpts {
25
26
  shouldTranslateLabels?: boolean;
@@ -4,10 +4,12 @@ export class TBoolean extends TBase {
4
4
  return 'Boolean';
5
5
  }
6
6
  assign(raw) {
7
+ // It's not a string at all
7
8
  if (typeof raw !== 'string') {
8
9
  super.assign(raw);
9
10
  return this;
10
11
  }
12
+ // It's a string, let's try to parse it
11
13
  if (raw === 'true') {
12
14
  super.assign(true);
13
15
  return this;
@@ -9,15 +9,18 @@ export class TInt extends TNumber {
9
9
  return 'Int';
10
10
  }
11
11
  assign(raw) {
12
+ // It's not a string at all
12
13
  if (typeof raw !== 'string') {
13
14
  super.assign(raw);
14
15
  return this;
15
16
  }
17
+ // It's a string, let's try to parse it
16
18
  const parsed = Number.parseInt(raw, 10);
17
19
  if (Number.isNaN(parsed)) {
18
20
  super.assign(raw);
19
21
  return this;
20
22
  }
23
+ // It's been parsed correctly, let's make sure it's not a float that has been "truncated" into an int
21
24
  if (parsed.toString() !== raw) {
22
25
  super.assign(raw);
23
26
  return this;
@@ -18,10 +18,12 @@ export class TNumber extends TBase {
18
18
  return 'Number';
19
19
  }
20
20
  assign(raw) {
21
+ // It's not a string at all
21
22
  if (typeof raw !== 'string') {
22
23
  super.assign(raw);
23
24
  return this;
24
25
  }
26
+ // It's a string, let's try to parse it
25
27
  const parsed = Number.parseFloat(raw);
26
28
  super.assign(parsed);
27
29
  return this;
@@ -1,10 +1,25 @@
1
1
  import type { Validation } from '../Validation.js';
2
2
  import { TBase, type TName } from './TBase.js';
3
3
  export declare enum TObjectShapeValidationStrategy {
4
+ /**
5
+ * No shape validation is performed
6
+ *
7
+ * To be used when the object can have multiple shapes or that its shape is not important.
8
+ *
9
+ * Otherwise, you can still override {@link validate} in the `T*` class and do your own validation.
10
+ */
4
11
  NONE = "NONE",
12
+ /**
13
+ * Validate against the {@link TObject.example()}
14
+ *
15
+ * It checks that the keys of the value, sorted alphabetically, are the same as the example's keys.
16
+ */
5
17
  SAME_AS_EXAMPLE = "SAME_AS_EXAMPLE"
6
18
  }
7
19
  export interface TObjectConstraints {
20
+ /**
21
+ * @defaultValue {@link TObjectShapeValidationStrategy.SAME_AS_EXAMPLE}
22
+ */
8
23
  shapeValidationStrategy: TObjectShapeValidationStrategy;
9
24
  }
10
25
  export declare class TObject<T extends object> extends TBase<T> {
@@ -1,7 +1,19 @@
1
1
  import { TBase } from './TBase.js';
2
2
  export var TObjectShapeValidationStrategy;
3
3
  (function (TObjectShapeValidationStrategy) {
4
+ /**
5
+ * No shape validation is performed
6
+ *
7
+ * To be used when the object can have multiple shapes or that its shape is not important.
8
+ *
9
+ * Otherwise, you can still override {@link validate} in the `T*` class and do your own validation.
10
+ */
4
11
  TObjectShapeValidationStrategy["NONE"] = "NONE";
12
+ /**
13
+ * Validate against the {@link TObject.example()}
14
+ *
15
+ * It checks that the keys of the value, sorted alphabetically, are the same as the example's keys.
16
+ */
5
17
  TObjectShapeValidationStrategy["SAME_AS_EXAMPLE"] = "SAME_AS_EXAMPLE";
6
18
  })(TObjectShapeValidationStrategy || (TObjectShapeValidationStrategy = {}));
7
19
  export class TObject extends TBase {
@@ -19,6 +31,7 @@ export class TObject extends TBase {
19
31
  return {};
20
32
  }
21
33
  fmt(ifNullOrUndefined) {
34
+ // typeof this.raw is 'object', hence the check for nullity
22
35
  if (this.raw === null || typeof this.raw !== 'object') {
23
36
  return super.fmt(ifNullOrUndefined);
24
37
  }
@@ -26,6 +39,7 @@ export class TObject extends TBase {
26
39
  }
27
40
  validate() {
28
41
  const validation = super.validate();
42
+ // typeof this.raw is 'object', hence the check for nullity
29
43
  if (this.raw === null || typeof this.raw !== 'object') {
30
44
  validation.add({
31
45
  constraint: 'type',
@@ -1,7 +1,7 @@
1
1
  import { TBase } from './TBase.js';
2
2
  export class TString extends TBase {
3
3
  constraints;
4
- static DEFAULT_MAX_LENGTH = 999_999;
4
+ static DEFAULT_MAX_LENGTH = 999_999; // This is totally arbitrary and will probably be changed
5
5
  static DEFAULT_MIN_LENGTH = 0;
6
6
  constructor(constraints) {
7
7
  super();
@@ -1,4 +1,5 @@
1
1
  import { TNumber } from '../base/TNumber.js';
2
+ // NOTE : We accept negative values (used for example in accounting)
2
3
  export class TAmount extends TNumber {
3
4
  currencyCode;
4
5
  constructor(currencyCode, constraints, decimalsCount) {
@@ -1,5 +1,6 @@
1
1
  import { TString } from '../base/TString.js';
2
2
  export class TCountryISO3166Alpha2 extends TString {
3
+ // From https://www.iban.com/country-codes
3
4
  static OPTIONS = [
4
5
  ['Afghanistan', 'AF'],
5
6
  ['Albania', 'AL'],
@@ -1,5 +1,6 @@
1
1
  import { TString } from '../base/TString.js';
2
2
  export class TCurrencyISO4217 extends TString {
3
+ // From https://www.iban.com/currency-codes
3
4
  static OPTIONS = [
4
5
  ['Euro', 'EUR', '€'],
5
6
  ['Pound Sterling', 'GBP', '£'],
@@ -1,4 +1,5 @@
1
1
  import { TString } from '../base/TString.js';
2
+ // TODO : Validate this model with some simple heuristics. Do not make it too complicated, it's not really worth it.
2
3
  export class TDateTimeFormat extends TString {
3
4
  tName() {
4
5
  return 'DateTimeFormat';
@@ -1,5 +1,7 @@
1
1
  import { TString } from '../base/TString.js';
2
2
  export class TEmail extends TString {
3
+ // Inspired by https://github.com/jquense/yup/blob/master/src/string.ts#L19
4
+ // Which is inspired by https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
3
5
  static FORMAT = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
4
6
  constructor(constraints) {
5
7
  super({
@@ -1,4 +1,8 @@
1
1
  import { TString } from '../base/TString.js';
2
+ // It is too difficult to validate safely an emoji
3
+ // See : https://stackoverflow.com/questions/18862256/how-to-detect-emoji-using-javascript
4
+ // Plus it does not bring much
5
+ // At first, I used maxLength/minLength == 1 but it was naive. Composite ones' length is greater than 1.
2
6
  export class TEmoji extends TString {
3
7
  tName() {
4
8
  return 'Emoji';
@@ -6,6 +6,8 @@ export class TFile extends TObject {
6
6
  fileConstraints;
7
7
  constructor(fileConstraints) {
8
8
  super({
9
+ // We usually process instances of https://developer.mozilla.org/fr/docs/Web/API/File
10
+ // Therefore, it's not strictly the same as the example, with some extra fields that we don't control.
9
11
  shapeValidationStrategy: TObjectShapeValidationStrategy.NONE,
10
12
  });
11
13
  this.fileConstraints = fileConstraints;
@@ -36,6 +38,7 @@ export class TFile extends TObject {
36
38
  validation.concat(new TFileMimeType(this.fileConstraints.type)
37
39
  .assign(val.type)
38
40
  .validate());
41
+ // TODO : Add validation on file size
39
42
  return validation;
40
43
  }
41
44
  }
@@ -1,4 +1,6 @@
1
1
  import { TString } from '../base/TString.js';
2
+ // TODO : Validate using IPv4, DomainName, etc. rules
3
+ // But watch out, hostname can be as simple as "localhost" as well
2
4
  export class THostAddress extends TString {
3
5
  tName() {
4
6
  return 'HostAddress';
@@ -1,5 +1,6 @@
1
1
  import { TString } from '../base/TString.js';
2
2
  export class TIPv6 extends TString {
3
+ // Inspired by https://community.fortra.com/forums/intermapper/miscellaneous-topics/5acc4fcf-fa83-e511-80cf-0050568460e4?_ga=2.113564423.1432958022.1523882681-2146416484.1523557976
3
4
  static FORMAT = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/;
4
5
  constructor(constraints) {
5
6
  super({
@@ -23,12 +23,20 @@ export class TJWT extends TString {
23
23
  });
24
24
  }
25
25
  const [header, payload, _signature] = parts;
26
+ // Using atob on Node.js platforms triggers the following deprecation message :
27
+ //
28
+ // This function is only provided for compatibility with legacy web platform APIs and should never be used in new code,
29
+ // because they use strings to represent binary data and predate the introduction of typed arrays in JavaScript.
30
+ // For code running using Node.js APIs, converting between base64-encoded strings and binary data should be performed using Buffer.from(str, 'base64') andbuf.toString('base64').
31
+ //
32
+ // However this code must be executable everywhere (including and especially browsers) so we need to use it, for portability reasons
26
33
  if (header) {
27
34
  JSON.parse(atob(header));
28
35
  }
29
36
  if (payload) {
30
37
  JSON.parse(atob(payload));
31
38
  }
39
+ // signature is ignored for now
32
40
  }
33
41
  catch (err) {
34
42
  validation.add({
@@ -1,4 +1,6 @@
1
1
  import { TNumber } from '../base/TNumber.js';
2
+ // TODO : Add some constraints (e.g. between 0 and 1, etc.)
3
+ // Not forgetting that a percentage can be higher hein ! 1.25 is a valid value for 125% !
2
4
  export class TPercentage extends TNumber {
3
5
  constructor(constraints, decimalsCount) {
4
6
  super(constraints, decimalsCount, 'percent');
@@ -13,6 +15,9 @@ export class TPercentage extends TNumber {
13
15
  if (typeof this.raw !== 'number') {
14
16
  return super.fmt(ifNullOrUndefined);
15
17
  }
18
+ // Although it works on web, using fmtNumber and setting the unit to 'percent' does not work on React Native (Hermes)
19
+ // Instead of displaying '89%', it displays '89 percent'
20
+ // Hence the usage here of style: 'percent' directly
16
21
  return new Intl.NumberFormat(undefined, {
17
22
  maximumFractionDigits: this.decimalsCount,
18
23
  style: 'percent',
@@ -1,4 +1,5 @@
1
1
  import { TString } from '../base/TString.js';
2
+ // TODO : Add basic syntax validation (without adding any dependencies)
2
3
  export class TSQLQuery extends TString {
3
4
  tName() {
4
5
  return 'SQLQuery';
@@ -1,7 +1,9 @@
1
1
  import { TString } from '../base/TString.js';
2
2
  export const SSHPrivatekKeyTypes = ['OPENSSH', 'RSA'];
3
3
  export class TSSHPrivateKey extends TString {
4
- static FORMAT = /^-----BEGIN (OPENSSH|RSA) PRIVATE KEY-----\n(.+)?\n-----END (OPENSSH|RSA) PRIVATE KEY-----$/is;
4
+ static FORMAT =
5
+ // @ts-ignore
6
+ /^-----BEGIN (OPENSSH|RSA) PRIVATE KEY-----\n(.+)?\n-----END (OPENSSH|RSA) PRIVATE KEY-----$/is;
5
7
  constructor(constraints) {
6
8
  super({
7
9
  ...constraints,
@@ -1,4 +1,5 @@
1
1
  import { TString } from '../base/TString.js';
2
+ // TODO : Add basic syntax validation (without adding any dependencies)
2
3
  export class TSemVerVersion extends TString {
3
4
  static FORMAT = /^([0-9]+)\.([0-9]+)\.([0-9]+)$/;
4
5
  constructor(constraints) {
@@ -1,4 +1,5 @@
1
1
  import { TString } from '../base/TString.js';
2
+ // TODO : Add basic syntax validation (without adding any dependencies)
2
3
  export class TShellCommand extends TString {
3
4
  tName() {
4
5
  return 'ShellCommand';
@@ -1,5 +1,6 @@
1
1
  import { TString } from '../base/TString.js';
2
2
  export class TURL extends TString {
3
+ // Inspired by https://github.com/jquense/yup/blob/master/src/string.ts#L24
3
4
  static FORMAT = /^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i;
4
5
  constructor(constraints) {
5
6
  super({
@@ -20,6 +21,7 @@ export class TURL extends TString {
20
21
  return 'url';
21
22
  }
22
23
  validate() {
24
+ // Workaround for https://github.com/jquense/yup/issues/224
23
25
  if (this.isLocalhost()) {
24
26
  this.removeFormatConstraint();
25
27
  }
@@ -1,5 +1,6 @@
1
1
  import { TString } from '../base/TString.js';
2
2
  export class TUUID extends TString {
3
+ // Inspired by https://github.com/jquense/yup/blob/master/src/string.ts#L29
3
4
  static FORMAT = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
4
5
  constructor(constraints) {
5
6
  super({
@@ -15,6 +15,6 @@ export class TYesNo extends TString {
15
15
  return 'YesNo';
16
16
  }
17
17
  example() {
18
- return 'Y';
18
+ return 'Y'; // Yes Man !
19
19
  }
20
20
  }
@@ -2,6 +2,22 @@ import type { DataType, TBase, TName } from '../dt/index.js';
2
2
  import type { ProductWording } from '../product/index.js';
3
3
  import type { I18nManager } from '../std/index.js';
4
4
  import type { UCClientConfirmConfig, UCDef, UCExecState, UCFieldKey, UCInput, UCInputField, UCName, UCOPIBase, UCOutputPartIdx, UCOutputPartWording, UCWording } from '../uc/index.js';
5
+ /**
6
+ * A key to translate
7
+ *
8
+ * - uc_CreateX_desc, uc_CreateX_label
9
+ * - ucif_name_desc, uc_name_label, uc_isEnabled_desc, uc_isEnabled_label
10
+ *
11
+ * NOTE : The choice has been made to consider the input fields as "global".
12
+ * Which means, their key is not prefixed by the use case name (e.g. ucif_CreateX_ucif_name_desc).
13
+ * This has multiple advantages :
14
+ *
15
+ * - The same field present in multiple use cases will be automatically translated
16
+ * - It gives more consistency through the app with the same thing always named the same way
17
+ *
18
+ * One might argue that a label can be different for "name" in "CreateX" and "CreateY".
19
+ * In this case, we consider that the input field shouldn't be named "name" in both places.
20
+ */
5
21
  export type WordingManagerKey = `dt_${TName}_${string}_${keyof UCWording}` | `p_${keyof ProductWording}` | `uc_${UCName}_${keyof UCWording}` | `uc_${UCName}_client_confirm_${keyof UCClientConfirmConfig}` | `uc_${UCName}_i_submit_${UCExecState}` | `uc_${UCName}_op_${UCOutputPartIdx}_${keyof UCOutputPartWording}` | `ucif_${UCFieldKey}_${keyof UCWording}` | `ucof_${UCFieldKey}_${keyof UCWording}`;
6
22
  export declare class WordingManager {
7
23
  private i18nManager;
@@ -1,6 +1,11 @@
1
1
  import type { ViolationI18nable, YesNo } from '../dt/index.js';
2
2
  import type { UCClientConfirmConfig, UCExecState, UCWording } from '../uc/index.js';
3
3
  export type I18nLanguageCode = 'en' | 'fr';
4
+ /**
5
+ * A translation value
6
+ *
7
+ * It can contain `{{placeholders}}`.
8
+ */
4
9
  export type I18nTranslation = string;
5
10
  export type I18nTranslationKey = string;
6
11
  export type I18nCoreKey = ViolationI18nable | `dt_YesNo_${YesNo}_${keyof UCWording}` | `uc_client_confirm_${keyof UCClientConfirmConfig}` | `uc_i_submit_${UCExecState}`;
@@ -1 +1,8 @@
1
+ /**
2
+ * The icon code (e.g. https://fontawesome.com/v6/search?o=s&m=free)
3
+ *
4
+ * There are thousands of them so we voluntarily keep it a simple string and not a union type that would become unmaintainable.
5
+ *
6
+ * You can naturally use a different icon library as long as the renderer handles it.
7
+ */
1
8
  export type IconCode = string;
@@ -11,8 +11,11 @@ export * from './std/impl/FakeFSManager.js';
11
11
  export * from './std/impl/FakeHTTPAPICallExecutor.js';
12
12
  export * from './std/impl/FakeJobManager.js';
13
13
  export * from './std/impl/FetchHTTPAPICallExecutor.js';
14
+ export * from './std/impl/MistralAILLMManager.js';
14
15
  export * from './std/impl/NoopHTTPAPICallExecutorAgentBuilder.js';
15
16
  export * from './std/impl/NoopXMLManager.js';
17
+ export * from './std/impl/OllamaLLMManager.js';
18
+ export * from './std/impl/OpenAILLMManager.js';
16
19
  export * from './std/impl/SettingsServerClientManager.js';
17
20
  export * from './std/impl/SimpleFormDataBuilder.js';
18
21
  export * from './std/impl/SimpleHTTPAPICaller.js';
package/dist/esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ // Export only the implementations that have no external dependencies (Otherwise, export them in index.x.ts)
1
2
  export * from './app/index.js';
2
3
  export * from './dt/index.js';
3
4
  export * from './error/index.js';
@@ -11,8 +12,11 @@ export * from './std/impl/FakeFSManager.js';
11
12
  export * from './std/impl/FakeHTTPAPICallExecutor.js';
12
13
  export * from './std/impl/FakeJobManager.js';
13
14
  export * from './std/impl/FetchHTTPAPICallExecutor.js';
15
+ export * from './std/impl/MistralAILLMManager.js';
14
16
  export * from './std/impl/NoopHTTPAPICallExecutorAgentBuilder.js';
15
17
  export * from './std/impl/NoopXMLManager.js';
18
+ export * from './std/impl/OllamaLLMManager.js';
19
+ export * from './std/impl/OpenAILLMManager.js';
16
20
  export * from './std/impl/SettingsServerClientManager.js';
17
21
  export * from './std/impl/SimpleFormDataBuilder.js';
18
22
  export * from './std/impl/SimpleHTTPAPICaller.js';