libmodulor 0.19.0 → 0.21.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 (60) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +1 -1
  3. package/dist/esm/apps/Helper/src/lib/project.js +7 -7
  4. package/dist/esm/convention.d.ts +2 -0
  5. package/dist/esm/convention.js +2 -0
  6. package/dist/esm/dt/Validation.js +1 -1
  7. package/dist/esm/dt/final/TGitSSHURL.d.ts +4 -3
  8. package/dist/esm/dt/final/TGitSSHURL.js +1 -1
  9. package/dist/esm/dt/final/TSSHPrivateKey.js +1 -3
  10. package/dist/esm/std/ShellCommandExecutor.d.ts +1 -0
  11. package/dist/esm/std/impl/ConsoleLogger.js +2 -2
  12. package/dist/esm/std/impl/FetchHTTPAPICallExecutor.js +1 -1
  13. package/dist/esm/std/impl/NodeFormDataBuilder.js +3 -1
  14. package/dist/esm/std/impl/NodeSpawnShellCommandExecutor.js +6 -0
  15. package/dist/esm/std/impl/SimpleHTTPAPICaller.js +1 -1
  16. package/dist/esm/target/lib/cli/CommandExecutor.js +2 -2
  17. package/dist/esm/target/lib/react/UCContainer.js +1 -1
  18. package/dist/esm/target/lib/react/UCPanel.js +0 -4
  19. package/dist/esm/target/lib/react/form.d.ts +5 -6
  20. package/dist/esm/target/lib/react/form.js +7 -10
  21. package/dist/esm/target/lib/react/useUC.d.ts +4 -4
  22. package/dist/esm/target/node-mcp-server/NodeLocalStdioMCPServerManager.js +1 -0
  23. package/dist/esm/target/react-native-pure/UCForm.d.ts +1 -1
  24. package/dist/esm/target/react-native-pure/UCForm.js +2 -2
  25. package/dist/esm/target/react-native-pure/UCFormField.d.ts +1 -1
  26. package/dist/esm/target/react-native-pure/UCFormField.js +3 -4
  27. package/dist/esm/target/react-native-pure/UCFormFieldControl.js +13 -7
  28. package/dist/esm/target/react-web-pure/UCForm.d.ts +1 -1
  29. package/dist/esm/target/react-web-pure/UCForm.js +2 -2
  30. package/dist/esm/target/react-web-pure/UCFormField.d.ts +1 -1
  31. package/dist/esm/target/react-web-pure/UCFormField.js +3 -4
  32. package/dist/esm/target/react-web-pure/UCFormFieldControl.js +7 -4
  33. package/dist/esm/testing/AppTester.d.ts +6 -3
  34. package/dist/esm/testing/AppTester.js +20 -6
  35. package/dist/esm/testing/impl/SimpleHTMLAppTestReportEmitter.js +1 -1
  36. package/dist/esm/testing/impl/TypeScriptLibUCDefASTParser.js +2 -2
  37. package/dist/esm/testing/impl/VitestAppTestSuiteEmitter.js +135 -115
  38. package/dist/esm/testing/impl/VitestAppTestSuiteRunner.d.ts +2 -3
  39. package/dist/esm/testing/impl/VitestAppTestSuiteRunner.js +6 -8
  40. package/dist/esm/testing/uc-input.js +13 -12
  41. package/dist/esm/testing/workers/UCExecutor.js +2 -2
  42. package/dist/esm/testing/workers/checkers/UCDefChecker.d.ts +2 -0
  43. package/dist/esm/testing/workers/checkers/UCDefChecker.js +4 -1
  44. package/dist/esm/uc/UC.d.ts +7 -7
  45. package/dist/esm/uc/UC.js +4 -3
  46. package/dist/esm/uc/UCInputField.d.ts +6 -3
  47. package/dist/esm/uc/UCInputField.js +39 -29
  48. package/dist/esm/uc/index.d.ts +0 -1
  49. package/dist/esm/uc/index.js +0 -1
  50. package/dist/esm/uc/input-field.d.ts +2 -19
  51. package/dist/esm/uc/input-field.js +0 -19
  52. package/dist/esm/uc/input.d.ts +13 -7
  53. package/dist/esm/uc/utils/rInput.js +4 -3
  54. package/dist/esm/uc/utils/rVal.d.ts +5 -5
  55. package/dist/esm/uc/utils/rVal.js +1 -12
  56. package/dist/esm/uc/value.d.ts +1 -2
  57. package/dist/esm/uc/workers/UCInputFilesProcessor.js +3 -3
  58. package/package.json +16 -16
  59. package/pnpm-workspace.yaml +1 -1
  60. package/tsconfig.json +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.21.0 (2025-08-19)
4
+
5
+ **BREAKING**
6
+
7
+ - Infer UC input field type without explicit generic when using `UC` methods like `inputField`, `reqVal0`, `rVal0`, `rValArr` : simply fix the TypeScript errors by removing the generic (e.g `uc.reqVal<DateISO8601>('from')` => `uc.reqVal('from')`)
8
+ - Change `UCInputField.setValue` to `UCInputField.setVal`, `UCInputField.addVal`, `UCInputField.rmVal` : simply fix the TypeScript errors by replacing `setValue` to the appropriate method. Also, `UCInputFieldChangeOperator` has been removed as it became useless. If you created custom `UCForm` field controls, you need to call the appropriate method to set the value in the field.
9
+
10
+ **Added**
11
+
12
+ - Add overrides to `rVal0` to avoid non null assertion
13
+
14
+ **Fixed**
15
+
16
+ - Display expected falsy values in violation
17
+
18
+ **Misc**
19
+
20
+ - Expose `TGitSSHURLConstraints`
21
+
22
+ ## v0.20.0 (2025-07-26)
23
+
24
+ **Added**
25
+
26
+ - Add ability to stream data in `ShellCommandExecutor`
27
+ - Stream output with color when using the `TestApp` command
28
+ - Check app sources before executing the test in `TestApp` : this allows to spot errors earlier and avoid cryptic exec errors when the sources are not valid (don't forget to re-generate the tests with `pnpm libmodulor GenerateAppsTests` and use `--updateSnapshots` the next time you call `TestApp --appName YourApp`)
29
+
30
+ **Misc**
31
+
32
+ - Add the `Toolbox` app to `examples` (for docs)
33
+ - Expose `UC_POLICY_FILE_NAME_EXT` and `UC_POLICY_FILE_NAME_SUFFIX` in the convention
34
+ - Move `examples/embedded` to `examples/standalone`
35
+ - Add the `GeocodeAddress` UCD to `Toolbox` (for docs)
36
+ - Add the `MyRunningMap` app to `examples` (for docs)
37
+ - Harmonize `examples` apps testing
38
+
3
39
  ## v0.19.0 (2025-06-20)
4
40
 
5
41
  **BREAKING**
package/README.md CHANGED
@@ -17,4 +17,4 @@ If you think you can help in any way, feel free to contact me (cf. `author` in `
17
17
 
18
18
  ## ⚖️ License
19
19
 
20
- [LGPL-3.0](https://github.com/c100k/libmodulor/blob/v0.19.0/LICENSE)
20
+ [LGPL-3.0](https://github.com/c100k/libmodulor/blob/v0.21.0/LICENSE)
@@ -81,22 +81,22 @@ export const PACKAGE_JSON = (name) => `{
81
81
  "test": "tsc && vitest run --passWithNoTests"
82
82
  },
83
83
  "dependencies": {
84
- "inversify": "^7.5.2",
84
+ "inversify": "^7.8.1",
85
85
  "libmodulor": "latest",
86
86
  "reflect-metadata": "^0.2.2"
87
87
  },
88
88
  "devDependencies": {
89
- "@biomejs/biome": "^2.0.0",
90
- "@types/node": "^22.15.32",
89
+ "@biomejs/biome": "^2.2.0",
90
+ "@types/node": "^22.17.2",
91
91
  "@vitest/coverage-v8": "^3.2.4",
92
92
  "buffer": "^6.0.3",
93
93
  "cookie-parser": "^1.4.7",
94
94
  "express": "^5.1.0",
95
- "express-fileupload": "^1.5.1",
96
- "fast-check": "^4.1.1",
95
+ "express-fileupload": "^1.5.2",
96
+ "fast-check": "^4.2.0",
97
97
  "helmet": "^8.1.0",
98
- "jose": "^6.0.11",
99
- "typescript": "^5.8.3",
98
+ "jose": "^6.0.12",
99
+ "typescript": "^5.9.2",
100
100
  "vite": "^6.3.5",
101
101
  "vitest": "^3.2.4"
102
102
  }
@@ -44,3 +44,5 @@ export declare const UC_OPI_BASE: string;
44
44
  export declare const UC_OPI_SUFFIX: string;
45
45
  export declare const UC_POLICY_SUFFIX: string;
46
46
  export declare const UC_POLICY_SUFFIX_FULL: string;
47
+ export declare const UC_POLICY_FILE_NAME_EXT: string;
48
+ export declare const UC_POLICY_FILE_NAME_SUFFIX: string;
@@ -54,3 +54,5 @@ export const UC_OPI_BASE = 'UCOPIBase';
54
54
  export const UC_OPI_SUFFIX = 'OPI';
55
55
  export const UC_POLICY_SUFFIX = 'Policy';
56
56
  export const UC_POLICY_SUFFIX_FULL = `UC${UC_POLICY_SUFFIX}`;
57
+ export const UC_POLICY_FILE_NAME_EXT = '.ts';
58
+ export const UC_POLICY_FILE_NAME_SUFFIX = `${UC_POLICY_SUFFIX_FULL}${UC_POLICY_FILE_NAME_EXT}`;
@@ -15,7 +15,7 @@ export class Validation {
15
15
  return null;
16
16
  }
17
17
  const key = this.violationAsI18nable(violation);
18
- const expected = (violation.expected || '').toString();
18
+ const expected = (violation.expected ?? '').toString();
19
19
  return [key, expected];
20
20
  }
21
21
  getViolations() {
@@ -1,11 +1,12 @@
1
1
  import type { TName } from '../base/TBase.js';
2
2
  import { TString, type TStringConstraints } from '../base/TString.js';
3
3
  export type GitSSHURL = string;
4
+ export interface TGitSSHURLConstraints extends TStringConstraints<'GitSSHURL'> {
5
+ domainName?: string | undefined;
6
+ }
4
7
  export declare class TGitSSHURL extends TString<GitSSHURL> {
5
8
  private static DEFAULT_DOMAIN_NAME;
6
- constructor(constraints?: TStringConstraints & {
7
- domainName: string;
8
- });
9
+ constructor(constraints?: TGitSSHURLConstraints);
9
10
  tName(): TName;
10
11
  example(): GitSSHURL;
11
12
  }
@@ -2,7 +2,7 @@ import { TString } from '../base/TString.js';
2
2
  export class TGitSSHURL extends TString {
3
3
  static DEFAULT_DOMAIN_NAME = 'github.com';
4
4
  constructor(constraints) {
5
- const format = new RegExp(`^git@${constraints?.domainName ?? TGitSSHURL.DEFAULT_DOMAIN_NAME}:([A-Za-z0-9-_]+)\/([A-Za-z0-9-_]+)\.git$`);
5
+ const format = new RegExp(`^git@${constraints?.domainName ?? TGitSSHURL.DEFAULT_DOMAIN_NAME}:([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+).git$`);
6
6
  super({
7
7
  ...constraints,
8
8
  format: { f: 'GitSSHURL', regexp: format },
@@ -1,9 +1,7 @@
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 =
5
- // @ts-ignore
6
- /^-----BEGIN (OPENSSH|RSA) PRIVATE KEY-----\n(.+)?\n-----END (OPENSSH|RSA) PRIVATE KEY-----$/is;
4
+ static FORMAT = /^-----BEGIN (OPENSSH|RSA) PRIVATE KEY-----\n(.+)?\n-----END (OPENSSH|RSA) PRIVATE KEY-----$/is;
7
5
  constructor(constraints) {
8
6
  super({
9
7
  ...constraints,
@@ -12,6 +12,7 @@ export interface ShellCommandExecutorInput {
12
12
  args?: ShellCommandExecutorCommandArg[];
13
13
  cwd?: FilePath;
14
14
  env?: ShellCommandExecutorEnv;
15
+ streamData?: boolean;
15
16
  };
16
17
  }
17
18
  export type ShellCommandExecutorOutput = string;
@@ -68,8 +68,8 @@ let ConsoleLogger = class ConsoleLogger {
68
68
  console.warn(`${this.t()} [warn] ${message}`, ...meta);
69
69
  }
70
70
  shouldLog(level) {
71
- const configLevelIndex = ConsoleLogger_1.LEVELS.findIndex((l) => l === this.s().logger_level);
72
- const levelIndex = ConsoleLogger_1.LEVELS.findIndex((l) => l === level);
71
+ const configLevelIndex = ConsoleLogger_1.LEVELS.indexOf(this.s().logger_level);
72
+ const levelIndex = ConsoleLogger_1.LEVELS.indexOf(level);
73
73
  return levelIndex >= configLevelIndex;
74
74
  }
75
75
  t() {
@@ -17,7 +17,7 @@ import { injectable } from 'inversify';
17
17
  let FetchHTTPAPICallExecutor = class FetchHTTPAPICallExecutor {
18
18
  fn() {
19
19
  // The generalization in HTTPAPICallExecutor is not exactly the same as the actual implementation
20
- // @ts-ignore
20
+ // @ts-expect-error
21
21
  return fetch;
22
22
  }
23
23
  };
@@ -19,7 +19,9 @@ let NodeFormDataBuilder = class NodeFormDataBuilder {
19
19
  chunks.push(chunk);
20
20
  });
21
21
  rs.on('end', () => {
22
- fd.append(key, new Blob(chunks, { type: val.type }), basename(val.uri));
22
+ fd.append(key,
23
+ // @ts-expect-error
24
+ new Blob(chunks, { type: val.type }), basename(val.uri));
23
25
  resolve(null);
24
26
  });
25
27
  rs.on('error', (err) => {
@@ -17,9 +17,15 @@ let NodeSpawnShellCommandExecutor = class NodeSpawnShellCommandExecutor {
17
17
  });
18
18
  proc.stderr.on('data', (chunk) => {
19
19
  stderr += chunk;
20
+ if (opts?.streamData) {
21
+ process.stderr.write(chunk);
22
+ }
20
23
  });
21
24
  proc.stdout.on('data', (chunk) => {
22
25
  stdout += chunk;
26
+ if (opts?.streamData) {
27
+ process.stdout.write(chunk);
28
+ }
23
29
  });
24
30
  proc.on('error', (err) => {
25
31
  reject(err);
@@ -177,7 +177,7 @@ let SimpleHTTPAPICaller = class SimpleHTTPAPICaller {
177
177
  payload = {};
178
178
  // TODO : Find a better way to do this (without adding any external dependency because the code must be portable)
179
179
  new URL(`http://localhost?${asText}`).searchParams.forEach((v, k) => {
180
- // @ts-ignore
180
+ // @ts-expect-error
181
181
  payload[k] = v;
182
182
  });
183
183
  }
@@ -14,7 +14,7 @@ var CommandExecutor_1;
14
14
  import { inject, injectable } from 'inversify';
15
15
  import { WordingManager } from '../../../i18n/index.js';
16
16
  import { FSManagerItemInfoType, } from '../../../std/index.js';
17
- import { UCInputFieldChangeOperator, ucifMustBeFilledManually, } from '../../../uc/index.js';
17
+ import { ucifMustBeFilledManually, } from '../../../uc/index.js';
18
18
  import { print, printError } from './renderer.js';
19
19
  let CommandExecutor = class CommandExecutor {
20
20
  static { CommandExecutor_1 = this; }
@@ -89,7 +89,7 @@ let CommandExecutor = class CommandExecutor {
89
89
  const invite = `${label}${help}`;
90
90
  await this.promptManager.prompt(invite, {
91
91
  validate: async (v) => {
92
- f.setValue(UCInputFieldChangeOperator.SET, v);
92
+ f.setVal(v);
93
93
  const validation = f.validate();
94
94
  const violation = validation.get();
95
95
  if (!violation) {
@@ -17,7 +17,7 @@ export function UCContainer({ children, uc, }) {
17
17
  }, [uc, ucExecChecker]);
18
18
  if (isAllowed === undefined) {
19
19
  // TODO : Add some loader while we check if can do
20
- return _jsx(_Fragment, {});
20
+ return null;
21
21
  }
22
22
  if (isAllowed === false) {
23
23
  return null;
@@ -27,9 +27,6 @@ export function UCPanel({ autoExec = false, clearAfterExec = true, onDone, onErr
27
27
  },
28
28
  sleepInMs,
29
29
  });
30
- const onChange = (f, op, v) => {
31
- f.setValue(op, v);
32
- };
33
30
  const clear = () => {
34
31
  if (!clearAfterExec) {
35
32
  return;
@@ -46,7 +43,6 @@ export function UCPanel({ autoExec = false, clearAfterExec = true, onDone, onErr
46
43
  return (_jsxs(UCContainer, { uc: uc, children: [autoExec && ctx.disabled && renderAutoExecLoader(), !autoExec && (_jsxs(_Fragment, { children: [needsInputFilling &&
47
44
  renderForm({
48
45
  ...ctx,
49
- onChange,
50
46
  onSubmit: exec,
51
47
  }), !needsInputFilling &&
52
48
  renderExecTouchable({
@@ -1,13 +1,13 @@
1
1
  import type { ReactElement } from 'react';
2
2
  import type { DataType, ErrorMessage } from '../../../dt/index.js';
3
3
  import type { I18nManager } from '../../../std/index.js';
4
- import type { UCInput, UCInputField, UCInputFieldChangeOperator, UCInputFieldValue, UCOPIBase } from '../../../uc/index.js';
4
+ import type { UCInput, UCInputField, UCOPIBase } from '../../../uc/index.js';
5
5
  import type { UCPanelCtx, UCPanelOnSubmit, UCPanelState } from './panel.js';
6
- export type UCFormFieldControlOnChange<T extends DataType = DataType> = (f: UCInputField<T>, op: UCInputFieldChangeOperator, v: UCInputFieldValue<T>) => void;
6
+ export type UCFormFieldControlOnChange = () => void;
7
7
  export type UCFormFieldControlProps<T extends DataType> = UCPanelState & {
8
8
  errMsg?: ErrorMessage | null;
9
9
  f: UCInputField<T>;
10
- onChange: UCFormFieldControlOnChange<T>;
10
+ onChange: UCFormFieldControlOnChange;
11
11
  };
12
12
  export interface UCFormFieldDescProps<T extends DataType> {
13
13
  f: UCInputField<T>;
@@ -20,15 +20,14 @@ export interface UCFormFieldLabelProps<T extends DataType> {
20
20
  }
21
21
  export declare const UC_FORM_FIELD_ELEMENTS: readonly ["control", "desc", "err", "label"];
22
22
  export type UCFormFieldElement = (typeof UC_FORM_FIELD_ELEMENTS)[number];
23
- export type UCFormFieldProps<T extends DataType> = UCFormFieldControlProps<T> & {
23
+ export type UCFormFieldProps<T extends DataType> = Omit<UCFormFieldControlProps<T>, 'onChange'> & {
24
24
  only?: UCFormFieldElement[];
25
25
  };
26
26
  export type UCFormProps<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined> = UCPanelCtx<I, OPI0, OPI1> & {
27
- onChange: UCFormFieldControlOnChange;
28
27
  onSubmit: UCPanelOnSubmit;
29
28
  };
30
29
  export type UCFormSubmitControlProps<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined> = UCPanelCtx<I, OPI0, OPI1> & {
31
30
  onPress?: () => Promise<void>;
32
31
  };
33
32
  export type RenderUCForm<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined> = (props: UCFormProps<I, OPI0, OPI1>) => ReactElement;
34
- export declare function validateFormField<T extends DataType = DataType>(i18nManager: I18nManager, f: UCInputField<T>, v: UCInputFieldValue<T>): ErrorMessage | null;
33
+ export declare function validateFormField<T extends DataType = DataType>(i18nManager: I18nManager, f: UCInputField<T>): ErrorMessage | null;
@@ -5,18 +5,15 @@ export const UC_FORM_FIELD_ELEMENTS = [
5
5
  'err',
6
6
  'label',
7
7
  ];
8
- export function validateFormField(i18nManager, f, v) {
9
- if (isBlank(v)) {
8
+ export function validateFormField(i18nManager, f) {
9
+ if (isBlank(f.getValue())) {
10
10
  return null;
11
11
  }
12
- const vArr = Array.isArray(v) ? v : [v];
13
- for (const vv of vArr) {
14
- const validation = f.def.type.assign(vv).validate();
15
- const violation = validation.get();
16
- if (violation) {
17
- const [key, expected] = violation;
18
- return i18nManager.t(key, { vars: { expected } });
19
- }
12
+ const validation = f.validate();
13
+ const violation = validation.get();
14
+ if (violation) {
15
+ const [key, expected] = violation;
16
+ return i18nManager.t(key, { vars: { expected } });
20
17
  }
21
18
  return null;
22
19
  }
@@ -1,7 +1,7 @@
1
- import { type ArgsRecord, UC, type UCDef, type UCInput, type UCOPIBase } from '../../../uc/index.js';
2
- export type CloneFunc<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined> = (i: Partial<I>) => UC<I, OPI0, OPI1>;
1
+ import { type ArgsRecord, UC, type UCDef, type UCInput, type UCInputPartial, type UCOPIBase } from '../../../uc/index.js';
2
+ export type CloneFunc<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined> = (i: UCInputPartial<I>) => UC<I, OPI0, OPI1>;
3
3
  export type DivertFunc<II extends UCInput | undefined = undefined, OOPI0 extends UCOPIBase | undefined = undefined, OOPI1 extends UCOPIBase | undefined = undefined> = (siblingUCD: UCDef) => UC<II, OOPI0, OOPI1>;
4
- export type RefillFunc<I extends UCInput | undefined = undefined> = (i: Partial<I>) => void;
4
+ export type RefillFunc<I extends UCInput | undefined = undefined> = (i: UCInputPartial<I>) => void;
5
5
  /**
6
6
  * This hook provides utilities to init a use case and perform actions on it in a React way
7
7
  * @param appManifest
@@ -11,7 +11,7 @@ export type RefillFunc<I extends UCInput | undefined = undefined> = (i: Partial<
11
11
  * @returns
12
12
  */
13
13
  export declare function useUC<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>(appManifest: ArgsRecord<I, OPI0, OPI1>['appManifest'], def: ArgsRecord<I, OPI0, OPI1>['def'], auth: ArgsRecord<I, OPI0, OPI1>['auth'], opts?: {
14
- fillWith: Partial<I>;
14
+ fillWith: UCInputPartial<I>;
15
15
  }): [
16
16
  UC<I, OPI0, OPI1>,
17
17
  {
@@ -125,6 +125,7 @@ let NodeLocalStdioMCPServerManager = class NodeLocalStdioMCPServerManager {
125
125
  def: ucd,
126
126
  });
127
127
  if (args) {
128
+ // biome-ignore lint/suspicious/noExplicitAny: can be anything
128
129
  uc.fill(args);
129
130
  }
130
131
  const confirmed = await this.ucManager.confirmClient(uc);
@@ -1,4 +1,4 @@
1
1
  import type { ReactElement } from 'react';
2
2
  import type { UCInput, UCOPIBase } from '../../uc/index.js';
3
3
  import type { UCFormProps } from '../lib/react/form.js';
4
- export declare function UCForm<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>({ disabled, execState, onChange, onSubmit, uc, }: UCFormProps<I, OPI0, OPI1>): ReactElement;
4
+ export declare function UCForm<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>({ disabled, execState, onSubmit, uc, }: UCFormProps<I, OPI0, OPI1>): ReactElement;
@@ -3,10 +3,10 @@ import { View } from 'react-native';
3
3
  import { useStyleContext } from '../lib/react/StyleContextProvider.js';
4
4
  import { UCFormField } from './UCFormField.js';
5
5
  import { UCFormSubmitControl } from './UCFormSubmitControl.js';
6
- export function UCForm({ disabled, execState, onChange, onSubmit, uc, }) {
6
+ export function UCForm({ disabled, execState, onSubmit, uc, }) {
7
7
  const { form } = useStyleContext();
8
8
  const onPress = async () => {
9
9
  await onSubmit();
10
10
  };
11
- return (_jsxs(View, { style: form?.style, children: [uc.inputFieldsForForm().map((f) => (_jsx(UCFormField, { disabled: disabled, execState: execState, f: f, onChange: onChange }, f.key))), _jsx(UCFormSubmitControl, { disabled: disabled, execState: execState, onPress: onPress, uc: uc })] }));
11
+ return (_jsxs(View, { style: form?.style, children: [uc.inputFieldsForForm().map((f) => (_jsx(UCFormField, { disabled: disabled, execState: execState, f: f }, f.key))), _jsx(UCFormSubmitControl, { disabled: disabled, execState: execState, onPress: onPress, uc: uc })] }));
12
12
  }
@@ -1,4 +1,4 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { DataType } from '../../dt/index.js';
3
3
  import { type UCFormFieldProps } from '../lib/react/form.js';
4
- export declare function UCFormField<T extends DataType>({ disabled, execState, f, onChange: onChangeBase, only, }: UCFormFieldProps<T>): ReactElement;
4
+ export declare function UCFormField<T extends DataType>({ disabled, execState, f, only, }: UCFormFieldProps<T>): ReactElement;
@@ -8,13 +8,12 @@ import { UCFormFieldControl } from './UCFormFieldControl.js';
8
8
  import { UCFormFieldDesc } from './UCFormFieldDesc.js';
9
9
  import { UCFormFieldErr } from './UCFormFieldErr.js';
10
10
  import { UCFormFieldLabel } from './UCFormFieldLabel.js';
11
- export function UCFormField({ disabled, execState, f, onChange: onChangeBase, only, }) {
11
+ export function UCFormField({ disabled, execState, f, only, }) {
12
12
  const { i18nManager } = useDIContext();
13
13
  const { formField } = useStyleContext();
14
14
  const [errMsg, setErrMsg] = useState(null);
15
- const onChange = (f, op, v) => {
16
- setErrMsg(validateFormField(i18nManager, f, v));
17
- onChangeBase(f, op, v);
15
+ const onChange = () => {
16
+ setErrMsg(validateFormField(i18nManager, f));
18
17
  };
19
18
  const elements = only ?? UC_FORM_FIELD_ELEMENTS;
20
19
  return (_jsxs(View, { style: formField?.style, children: [elements.includes('label') && _jsx(UCFormFieldLabel, { f: f }), elements.includes('control') && (_jsx(UCFormFieldControl, { disabled: disabled, execState: execState, f: f, onChange: onChange })), elements.includes('err') && errMsg && (_jsx(UCFormFieldErr, { errMsg: errMsg })), elements.includes('desc') && _jsx(UCFormFieldDesc, { f: f })] }));
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from 'react';
3
3
  import { FlatList, Pressable, StyleSheet, Switch, Text, TextInput, } from 'react-native';
4
4
  import { TBoolean } from '../../dt/index.js';
5
- import { UCInputFieldChangeOperator, ucifRepeatability, } from '../../uc/index.js';
5
+ import { ucifRepeatability } from '../../uc/index.js';
6
6
  import { isBlank } from '../../utils/index.js';
7
7
  import { styleDef, useStyleContext, } from '../lib/react/StyleContextProvider.js';
8
8
  import { rnInputDef } from '../lib/rn/input.js';
@@ -31,24 +31,30 @@ export function UCFormFieldControl({ disabled, errMsg = null, execState, f, onCh
31
31
  const valueArr = value
32
32
  .split(MULTIPLE_VALUES_SEPARATOR)
33
33
  .map((v) => v.trim());
34
- onChangeBase(f, UCInputFieldChangeOperator.SET, valueArr);
34
+ f.setVal(valueArr);
35
+ onChangeBase();
36
+ setInternalValue(valueArr);
35
37
  }
36
38
  else {
37
- onChangeBase(f, UCInputFieldChangeOperator.SET, value);
39
+ f.setVal(value);
40
+ onChangeBase();
41
+ setInternalValue(value);
38
42
  }
39
- setInternalValue(value);
40
43
  };
41
44
  const onSelect = (value) => {
42
45
  if (internalValue === value) {
43
- onChangeBase(f, UCInputFieldChangeOperator.RESET, null);
46
+ f.clear();
47
+ onChangeBase();
44
48
  setInternalValue(null);
45
49
  return;
46
50
  }
47
- onChangeBase(f, UCInputFieldChangeOperator.SET, value);
51
+ f.setVal(value);
52
+ onChangeBase();
48
53
  setInternalValue(value);
49
54
  };
50
55
  const onValueChange = (value) => {
51
- onChangeBase(f, UCInputFieldChangeOperator.SET, value);
56
+ f.setVal(value);
57
+ onChangeBase();
52
58
  setInternalValue(value);
53
59
  };
54
60
  const attrs = rnInputDef(f, disabled, errMsg);
@@ -1,4 +1,4 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { UCInput, UCOPIBase } from '../../uc/index.js';
3
3
  import type { UCFormProps } from '../lib/react/form.js';
4
- export declare function UCForm<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>({ clearAfterExec, disabled, execState, onChange, onSubmit: onSubmitBase, uc, }: UCFormProps<I, OPI0, OPI1>): ReactElement;
4
+ export declare function UCForm<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>({ clearAfterExec, disabled, execState, onSubmit: onSubmitBase, uc, }: UCFormProps<I, OPI0, OPI1>): ReactElement;
@@ -3,7 +3,7 @@ import { useRef } from 'react';
3
3
  import { useStyleContext } from '../lib/react/StyleContextProvider.js';
4
4
  import { UCFormField } from './UCFormField.js';
5
5
  import { UCFormSubmitControl } from './UCFormSubmitControl.js';
6
- export function UCForm({ clearAfterExec, disabled, execState, onChange, onSubmit: onSubmitBase, uc, }) {
6
+ export function UCForm({ clearAfterExec, disabled, execState, onSubmit: onSubmitBase, uc, }) {
7
7
  const { form } = useStyleContext();
8
8
  const formRef = useRef(null);
9
9
  const onSubmit = async (e) => {
@@ -13,5 +13,5 @@ export function UCForm({ clearAfterExec, disabled, execState, onChange, onSubmit
13
13
  formRef.current?.reset();
14
14
  }
15
15
  };
16
- return (_jsxs("form", { className: form?.className, onSubmit: onSubmit, ref: formRef, style: form?.style, children: [uc.inputFieldsForForm().map((f) => (_jsx(UCFormField, { disabled: disabled, execState: execState, f: f, onChange: onChange }, f.key))), _jsx(UCFormSubmitControl, { disabled: disabled, execState: execState, uc: uc })] }));
16
+ return (_jsxs("form", { className: form?.className, onSubmit: onSubmit, ref: formRef, style: form?.style, children: [uc.inputFieldsForForm().map((f) => (_jsx(UCFormField, { disabled: disabled, execState: execState, f: f }, f.key))), _jsx(UCFormSubmitControl, { disabled: disabled, execState: execState, uc: uc })] }));
17
17
  }
@@ -1,4 +1,4 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { DataType } from '../../dt/index.js';
3
3
  import { type UCFormFieldProps } from '../lib/react/form.js';
4
- export declare function UCFormField<T extends DataType>({ disabled, execState, f, onChange: onChangeBase, only, }: UCFormFieldProps<T>): ReactElement;
4
+ export declare function UCFormField<T extends DataType>({ disabled, execState, f, only, }: UCFormFieldProps<T>): ReactElement;
@@ -7,13 +7,12 @@ import { UCFormFieldControl } from './UCFormFieldControl.js';
7
7
  import { UCFormFieldDesc } from './UCFormFieldDesc.js';
8
8
  import { UCFormFieldErr } from './UCFormFieldErr.js';
9
9
  import { UCFormFieldLabel } from './UCFormFieldLabel.js';
10
- export function UCFormField({ disabled, execState, f, onChange: onChangeBase, only, }) {
10
+ export function UCFormField({ disabled, execState, f, only, }) {
11
11
  const { i18nManager } = useDIContext();
12
12
  const { formField } = useStyleContext();
13
13
  const [errMsg, setErrMsg] = useState(null);
14
- const onChange = (f, op, v) => {
15
- setErrMsg(validateFormField(i18nManager, f, v));
16
- onChangeBase(f, op, v);
14
+ const onChange = () => {
15
+ setErrMsg(validateFormField(i18nManager, f));
17
16
  };
18
17
  const elements = only ?? UC_FORM_FIELD_ELEMENTS;
19
18
  return (_jsxs("div", { className: formField?.className, style: formField?.style, children: [elements.includes('label') && _jsx(UCFormFieldLabel, { f: f }), elements.includes('control') && (_jsx(UCFormFieldControl, { disabled: disabled, execState: execState, f: f, onChange: onChange })), elements.includes('err') && errMsg && (_jsx(UCFormFieldErr, { errMsg: errMsg })), elements.includes('desc') && _jsx(UCFormFieldDesc, { f: f })] }));
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { TBoolean } from '../../dt/index.js';
3
- import { UCInputFieldChangeOperator, ucifRepeatability, } from '../../uc/index.js';
3
+ import { ucifRepeatability } from '../../uc/index.js';
4
4
  import { styleDef, useStyleContext, } from '../lib/react/StyleContextProvider.js';
5
5
  import { htmlInputDef } from '../lib/web/input.js';
6
6
  const CHECKED_FIELD_TYPES = ['checkbox', 'radio'];
@@ -27,7 +27,8 @@ export function UCFormFieldControl({ disabled, errMsg = null, execState, f, onCh
27
27
  if (target.localName === 'select' && !value) {
28
28
  // Prevent the value from being '' when we set/unset the select
29
29
  // Otherwise it sets '' as value and prevents the form for being valid
30
- onChangeBase(f, UCInputFieldChangeOperator.RESET, value);
30
+ f.clear();
31
+ onChangeBase();
31
32
  return;
32
33
  }
33
34
  if (CHECKED_FIELD_TYPES.includes(type) && 'checked' in target) {
@@ -41,10 +42,12 @@ export function UCFormFieldControl({ disabled, errMsg = null, execState, f, onCh
41
42
  const valueArr = value
42
43
  .split(MULTIPLE_VALUES_SEPARATOR)
43
44
  .map((v) => v.trim());
44
- onChangeBase(f, UCInputFieldChangeOperator.SET, valueArr);
45
+ f.setVal(valueArr);
46
+ onChangeBase();
45
47
  }
46
48
  else {
47
- onChangeBase(f, UCInputFieldChangeOperator.SET, value);
49
+ f.setVal(value);
50
+ onChangeBase();
48
51
  }
49
52
  };
50
53
  const defaultChecked = attrs.internal?.checked;
@@ -1,7 +1,7 @@
1
1
  import type { FilePath } from '../dt/index.js';
2
2
  import type { ServerClientManagerSettings } from '../target/lib/client/ServerClientManager.js';
3
3
  import type { ServerManager } from '../target/lib/server/ServerManager.js';
4
- import { type UCAuth, UCBuilder, type UCDef, type UCInput, type UCOPIBase } from '../uc/index.js';
4
+ import { type UCAuth, UCBuilder, type UCDef, type UCInput, type UCName, type UCOPIBase } from '../uc/index.js';
5
5
  import type { SrcImporter } from '../utils/index.js';
6
6
  import type { AppTesterConfigurator } from './AppTesterConfigurator.js';
7
7
  import type { AppTesterCtx, AppTesterUCDRef } from './ctx.js';
@@ -50,6 +50,7 @@ export declare class AppTester {
50
50
  * This can happen in case of circular dependencies for example.
51
51
  */
52
52
  private safeSrcImporter;
53
+ private ucds;
53
54
  private testResults;
54
55
  private testSummary;
55
56
  private ucDefSourcesCheckerOutput;
@@ -59,13 +60,15 @@ export declare class AppTester {
59
60
  checkAppIndex(): Promise<void>;
60
61
  checkAppManifest(): Promise<void>;
61
62
  checkUCDSources(): Promise<void>;
62
- checkUC(ucdRef: AppTesterUCDRef): Promise<UCDef>;
63
+ checkUC(ucdRef: AppTesterUCDRef): Promise<void>;
63
64
  execFlow(flow: AppTesterFlow): Promise<AppTesterFlowExecOutput>;
64
- execMonkeyTest<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>(ucd: UCDef<I, OPI0, OPI1>, input: I): Promise<UCExecutorExecOutput<I, OPI0, OPI1>>;
65
+ execMonkeyTest<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>(ucd: UCDef<I, OPI0, OPI1>, input: NonNullable<I>): Promise<UCExecutorExecOutput<I, OPI0, OPI1>>;
65
66
  execUC<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>(input: Omit<UCExecutorInput<I, OPI0, OPI1>, 'appManifest'>, flow?: AppTesterFlow): Promise<AppTestSuiteTestResult<I, OPI0, OPI1>>;
66
67
  finalize(): Promise<void>;
67
68
  getCtx(): AppTesterCtx;
69
+ getUCD<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>(ucName: UCName): UCDef<I, OPI0, OPI1>;
68
70
  init({ appPath, configurator, serverClientSettings, srcImporter, }: AppTesterInitArgs): Promise<void>;
71
+ initForUCExec(): Promise<void>;
69
72
  ucTestData(ucdRef: AppTesterUCDRef): Promise<AppTesterUCTestData[]>;
70
73
  private bindI18n;
71
74
  private bindServerClientSettings;