libmodulor 0.28.0 → 0.29.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 (100) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +2 -2
  3. package/dist/esm/apps/Helper/src/lib/layers/project.js +3 -3
  4. package/dist/esm/dt/base/TBase.d.ts +2 -0
  5. package/dist/esm/dt/base/TBase.js +5 -0
  6. package/dist/esm/dt/base/TBoolean.d.ts +2 -0
  7. package/dist/esm/dt/base/TBoolean.js +3 -0
  8. package/dist/esm/dt/base/TInt.d.ts +2 -0
  9. package/dist/esm/dt/base/TInt.js +3 -0
  10. package/dist/esm/dt/base/TNumber.d.ts +2 -0
  11. package/dist/esm/dt/base/TNumber.js +3 -0
  12. package/dist/esm/dt/base/TObject.d.ts +2 -0
  13. package/dist/esm/dt/base/TObject.js +29 -0
  14. package/dist/esm/dt/final/TApiKey.d.ts +2 -0
  15. package/dist/esm/dt/final/TApiKey.js +3 -0
  16. package/dist/esm/dt/final/TDateISO8601.d.ts +2 -0
  17. package/dist/esm/dt/final/TDateISO8601.js +3 -0
  18. package/dist/esm/dt/final/TDomainName.d.ts +2 -0
  19. package/dist/esm/dt/final/TDomainName.js +3 -0
  20. package/dist/esm/dt/final/TEmail.d.ts +2 -0
  21. package/dist/esm/dt/final/TEmail.js +3 -0
  22. package/dist/esm/dt/final/TEncryptionKey.d.ts +2 -0
  23. package/dist/esm/dt/final/TEncryptionKey.js +3 -0
  24. package/dist/esm/dt/final/TFile.d.ts +2 -0
  25. package/dist/esm/dt/final/TFile.js +3 -0
  26. package/dist/esm/dt/final/TIPv4.d.ts +2 -0
  27. package/dist/esm/dt/final/TIPv4.js +3 -0
  28. package/dist/esm/dt/final/TIPv6.d.ts +2 -0
  29. package/dist/esm/dt/final/TIPv6.js +3 -0
  30. package/dist/esm/dt/final/TJWT.d.ts +2 -0
  31. package/dist/esm/dt/final/TJWT.js +3 -0
  32. package/dist/esm/dt/final/TPassword.d.ts +2 -0
  33. package/dist/esm/dt/final/TPassword.js +3 -0
  34. package/dist/esm/dt/final/TSSHPrivateKey.d.ts +2 -0
  35. package/dist/esm/dt/final/TSSHPrivateKey.js +3 -0
  36. package/dist/esm/dt/final/TTime.d.ts +2 -0
  37. package/dist/esm/dt/final/TTime.js +3 -0
  38. package/dist/esm/dt/final/TURL.d.ts +2 -0
  39. package/dist/esm/dt/final/TURL.js +3 -0
  40. package/dist/esm/dt/index.d.ts +1 -0
  41. package/dist/esm/dt/targets/json-schema.d.ts +24 -0
  42. package/dist/esm/dt/targets/json-schema.js +1 -0
  43. package/dist/esm/error/funcs.d.ts +3 -0
  44. package/dist/esm/error/funcs.js +1 -1
  45. package/dist/esm/error/index.d.ts +1 -1
  46. package/dist/esm/error/index.js +1 -1
  47. package/dist/esm/product/manifest.d.ts +2 -0
  48. package/dist/esm/std/impl/SimpleMapI18nManager.d.ts +1 -1
  49. package/dist/esm/std/impl/SimpleMapI18nManager.js +4 -2
  50. package/dist/esm/target/edge-worker-hono-server/SyncEdgeWorkerHonoServerManager.d.ts +6 -2
  51. package/dist/esm/target/edge-worker-hono-server/SyncEdgeWorkerHonoServerManager.js +17 -9
  52. package/dist/esm/target/index.d.ts +1 -0
  53. package/dist/esm/target/lib/openapi/OpenAPISpecBuilder.d.ts +25 -0
  54. package/dist/esm/target/lib/openapi/OpenAPISpecBuilder.js +131 -0
  55. package/dist/esm/target/lib/openapi/consts.d.ts +2 -0
  56. package/dist/esm/target/lib/openapi/consts.js +1 -0
  57. package/dist/esm/target/lib/openapi/funcs.d.ts +16 -0
  58. package/dist/esm/target/lib/openapi/funcs.js +249 -0
  59. package/dist/esm/target/lib/openapi/input.d.ts +16 -0
  60. package/dist/esm/target/lib/openapi/input.js +33 -0
  61. package/dist/esm/target/lib/openapi/types.d.ts +109 -0
  62. package/dist/esm/target/lib/openapi/types.js +1 -0
  63. package/dist/esm/target/lib/rn/input.d.ts +3 -0
  64. package/dist/esm/target/lib/server/AuthCookieCreator.d.ts +2 -1
  65. package/dist/esm/target/lib/server/ServerBooter.d.ts +4 -2
  66. package/dist/esm/target/lib/server/ServerBooter.js +34 -11
  67. package/dist/esm/target/lib/server/ServerManager.d.ts +19 -9
  68. package/dist/esm/target/lib/server/ServerRequestHandler.d.ts +0 -1
  69. package/dist/esm/target/lib/server/ServerRequestHandler.js +2 -2
  70. package/dist/esm/target/lib/server/consts.d.ts +4 -0
  71. package/dist/esm/target/lib/server/consts.js +22 -0
  72. package/dist/esm/target/lib/server-express/CORSMiddlewareBuilder.d.ts +15 -0
  73. package/dist/esm/target/lib/server-express/CORSMiddlewareBuilder.js +55 -0
  74. package/dist/esm/target/lib/server-express/funcs.d.ts +2 -1
  75. package/dist/esm/target/lib/server-express/funcs.js +7 -2
  76. package/dist/esm/target/lib/server-hono/CORSMiddlewareBuilder.d.ts +14 -0
  77. package/dist/esm/target/lib/server-hono/CORSMiddlewareBuilder.js +46 -0
  78. package/dist/esm/target/lib/server-hono/funcs.d.ts +2 -1
  79. package/dist/esm/target/lib/server-hono/funcs.js +2 -1
  80. package/dist/esm/target/lib/shared.d.ts +4 -0
  81. package/dist/esm/target/lib/shared.js +2 -1
  82. package/dist/esm/target/nextjs-server/NextJSServerManager.d.ts +3 -1
  83. package/dist/esm/target/nextjs-server/NextJSServerManager.js +3 -0
  84. package/dist/esm/target/node-express-server/NodeExpressServerManager.d.ts +7 -3
  85. package/dist/esm/target/node-express-server/NodeExpressServerManager.js +24 -14
  86. package/dist/esm/target/node-hono-server/NodeHonoServerManager.d.ts +6 -2
  87. package/dist/esm/target/node-hono-server/NodeHonoServerManager.js +21 -11
  88. package/dist/esm/target/node-mcp-server/NodeLocalStdioMCPServerManager.d.ts +3 -1
  89. package/dist/esm/target/node-mcp-server/NodeLocalStdioMCPServerManager.js +19 -14
  90. package/dist/esm/target/node-mcp-server/types.d.ts +0 -4
  91. package/dist/esm/uc/UC.d.ts +2 -0
  92. package/dist/esm/uc/UC.js +16 -1
  93. package/dist/esm/uc/metadata.d.ts +7 -0
  94. package/dist/esm/uc/metadata.js +10 -0
  95. package/dist/esm/uc/output-field.d.ts +1 -0
  96. package/dist/esm/uc/output-field.js +13 -1
  97. package/dist/esm/uc/utils/ucHTTPContract.js +1 -1
  98. package/dist/esm/utils/http/types.d.ts +5 -0
  99. package/dist/esm/utils/index.d.ts +1 -1
  100. package/package.json +8 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.29.0 (2026-05-10)
4
+
5
+ Report an error when the `onClose` handler of SSE has been missed only when it has streamed once.
6
+
7
+ Introduce the automatic generation of [OpenAPI](https://www.openapis.org) specs for server targets.
8
+ It is disabled by default.
9
+ To opt-in, simply open the server's `settings.ts` and set `server_expose_openapi_spec: true`.
10
+ When the server starts, the spec is generated on the fly and made available at `/api/openapi.json`.
11
+ This path is customizable by setting `server_expose_openapi_spec_at`.
12
+ See it in action in the [Playground](https://libmodulor.c100k.eu/docs/examples/Playground).
13
+
14
+ Introduce [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS) settings for server targets.
15
+ It is disabled by default.
16
+ Settings available : `server_cors_credentials`, `server_cors_headers`, `server_cors_methods`, `server_cors_origins`.
17
+
18
+ See all the changes here : https://github.com/c100k/libmodulor/compare/v0.28.0...master
19
+
3
20
  ## v0.28.0 (2026-05-01)
4
21
 
5
22
  Replace `Provider` by `Factory` in Dependency Injection (`inversify`). If you're using `bindProvider`, simply replace it by `bindFactory`.
package/README.md CHANGED
@@ -21,7 +21,7 @@ Here is how to easily create all of them, in a brand new project :
21
21
 
22
22
  ```sh
23
23
  # Create a project
24
- npx libmodulor CreateProject --projectName my-super-project
24
+ pnpx libmodulor CreateProject --projectName my-super-project
25
25
  cd my-super-project
26
26
 
27
27
  # Create an app
@@ -50,4 +50,4 @@ If you think you can help in any way, feel free to contact me (cf. `author` in `
50
50
 
51
51
  ## ⚖️ License
52
52
 
53
- [LGPL-3.0](https://github.com/c100k/libmodulor/blob/v0.28.0/LICENSE)
53
+ [LGPL-3.0](https://github.com/c100k/libmodulor/blob/v0.29.0/LICENSE)
@@ -87,8 +87,8 @@ export const PACKAGE_JSON = (name) => `{
87
87
  "reflect-metadata": "^0.2.2"
88
88
  },
89
89
  "devDependencies": {
90
- "@biomejs/biome": "^2.4.12",
91
- "@types/node": "^25.6.0",
90
+ "@biomejs/biome": "^2.4.14",
91
+ "@types/node": "^25.6.2",
92
92
  "@vitest/coverage-v8": "^3.2.4",
93
93
  "buffer": "^6.0.3",
94
94
  "cookie-parser": "^1.4.7",
@@ -96,7 +96,7 @@ export const PACKAGE_JSON = (name) => `{
96
96
  "express-fileupload": "^1.5.2",
97
97
  "fast-check": "^4.7.0",
98
98
  "helmet": "^8.1.0",
99
- "jose": "^6.2.2",
99
+ "jose": "^6.2.3",
100
100
  "typescript": "^6.0.3",
101
101
  "vite": "^6.4.2",
102
102
  "vitest": "^3.2.4"
@@ -1,6 +1,7 @@
1
1
  import type { IconCode } from '../../icon/index.js';
2
2
  import type { DataType } from '../DataType.js';
3
3
  import type { Color } from '../final/TColor.js';
4
+ import type { JSONSchemaType } from '../targets/json-schema.js';
4
5
  import type { RNInputMode } from '../targets/rn.js';
5
6
  import type { HTMLInputType } from '../targets/web.js';
6
7
  import { Validation } from '../Validation.js';
@@ -54,6 +55,7 @@ export declare abstract class TBase<T extends DataType> {
54
55
  hasStrictOptions(): boolean;
55
56
  htmlInputType(): HTMLInputType;
56
57
  isSensitive(): boolean;
58
+ jsonSchemaType(): JSONSchemaType;
57
59
  rnInputMode(): RNInputMode;
58
60
  setDefaultValue(defaultValue: T): this;
59
61
  setExamples(examples: T[]): this;
@@ -66,6 +66,11 @@ export class TBase {
66
66
  isSensitive() {
67
67
  return false;
68
68
  }
69
+ jsonSchemaType() {
70
+ return {
71
+ type: 'string',
72
+ };
73
+ }
69
74
  rnInputMode() {
70
75
  return 'text';
71
76
  }
@@ -1,3 +1,4 @@
1
+ import type { JSONSchemaType } from '../targets/json-schema.js';
1
2
  import type { HTMLInputType } from '../targets/web.js';
2
3
  import type { Validation } from '../Validation.js';
3
4
  import { TBase, type TName } from './TBase.js';
@@ -7,5 +8,6 @@ export declare class TBoolean extends TBase<boolean> {
7
8
  example(): boolean;
8
9
  fmt(ifNullOrUndefined?: string | undefined): string;
9
10
  htmlInputType(): HTMLInputType;
11
+ jsonSchemaType(): JSONSchemaType;
10
12
  validate(): Validation;
11
13
  }
@@ -36,6 +36,9 @@ export class TBoolean extends TBase {
36
36
  htmlInputType() {
37
37
  return 'checkbox';
38
38
  }
39
+ jsonSchemaType() {
40
+ return { type: 'boolean' };
41
+ }
39
42
  validate() {
40
43
  const validation = super.validate();
41
44
  if (!validation.isOK()) {
@@ -1,4 +1,5 @@
1
1
  import type { Unit } from '../../utils/index.js';
2
+ import type { JSONSchemaType } from '../targets/json-schema.js';
2
3
  import type { RNInputMode } from '../targets/rn.js';
3
4
  import type { Validation } from '../Validation.js';
4
5
  import type { TName } from './TBase.js';
@@ -13,6 +14,7 @@ export declare class TInt<T extends Int = Int> extends TNumber<T> {
13
14
  assign(raw: unknown): this;
14
15
  example(): T;
15
16
  getConstraints(): TIntConstraints | undefined;
17
+ jsonSchemaType(): JSONSchemaType;
16
18
  max(): NonNullable<TIntConstraints['max']>;
17
19
  min(): NonNullable<TIntConstraints['min']>;
18
20
  rnInputMode(): RNInputMode;
@@ -34,6 +34,9 @@ export class TInt extends TNumber {
34
34
  getConstraints() {
35
35
  return this.constraints;
36
36
  }
37
+ jsonSchemaType() {
38
+ return { type: 'integer' };
39
+ }
37
40
  max() {
38
41
  return this.constraints?.max ?? TInt.DEFAULT_MAX;
39
42
  }
@@ -1,5 +1,6 @@
1
1
  import { type Unit } from '../../utils/index.js';
2
2
  import type { UIntQuantity } from '../final/TUIntQuantity.js';
3
+ import type { JSONSchemaType } from '../targets/json-schema.js';
3
4
  import type { RNInputMode } from '../targets/rn.js';
4
5
  import type { HTMLInputType } from '../targets/web.js';
5
6
  import type { Validation } from '../Validation.js';
@@ -24,6 +25,7 @@ export declare class TNumber<T extends number = number> extends TBase<T> {
24
25
  getDecimalsCount(): UIntQuantity | undefined;
25
26
  getStep(): T | undefined;
26
27
  htmlInputType(): HTMLInputType;
28
+ jsonSchemaType(): JSONSchemaType;
27
29
  max(): NonNullable<TNumberConstraints<number>['max']>;
28
30
  min(): NonNullable<TNumberConstraints<number>['min']>;
29
31
  rnInputMode(): RNInputMode;
@@ -49,6 +49,9 @@ export class TNumber extends TBase {
49
49
  htmlInputType() {
50
50
  return 'number';
51
51
  }
52
+ jsonSchemaType() {
53
+ return { type: 'number' };
54
+ }
52
55
  max() {
53
56
  return this.constraints?.max ?? TNumber.DEFAULT_MAX;
54
57
  }
@@ -1,4 +1,5 @@
1
1
  import type { EnumOf } from '../../utils/index.js';
2
+ import type { JSONSchemaType } from '../targets/json-schema.js';
2
3
  import type { Validation } from '../Validation.js';
3
4
  import { TBase, type TName } from './TBase.js';
4
5
  export declare const TObjectShapeValidationStrategy: {
@@ -30,6 +31,7 @@ export declare class TObject<T extends object> extends TBase<T> {
30
31
  tName(): TName;
31
32
  example(): T;
32
33
  fmt(ifNullOrUndefined?: string | undefined): string;
34
+ jsonSchemaType(): JSONSchemaType;
33
35
  validate(): Validation;
34
36
  private valueAndExampleHaveSameKeys;
35
37
  }
@@ -36,6 +36,35 @@ export class TObject extends TBase {
36
36
  }
37
37
  return JSON.stringify(this.raw);
38
38
  }
39
+ jsonSchemaType() {
40
+ const example = this.example();
41
+ const properties = Object.entries(example).reduce((acc, [k, v]) => {
42
+ const typeofv = typeof v;
43
+ // TODO : Make this work recursively
44
+ switch (typeofv) {
45
+ case 'boolean':
46
+ acc[k] = { type: 'boolean' };
47
+ break;
48
+ case 'bigint':
49
+ case 'number':
50
+ acc[k] = { type: 'number' };
51
+ break;
52
+ case 'function':
53
+ case 'object':
54
+ case 'symbol':
55
+ case 'undefined':
56
+ acc[k] = { type: 'object' };
57
+ break;
58
+ case 'string':
59
+ acc[k] = { type: 'string' };
60
+ break;
61
+ default:
62
+ typeofv;
63
+ }
64
+ return acc;
65
+ }, {});
66
+ return { properties, type: 'object' };
67
+ }
39
68
  validate() {
40
69
  const validation = super.validate();
41
70
  if (!validation.isOK()) {
@@ -1,10 +1,12 @@
1
1
  import type { TName } from '../base/TBase.js';
2
2
  import { TString } from '../base/TString.js';
3
+ import type { JSONSchemaType } from '../targets/json-schema.js';
3
4
  import type { HTMLInputType } from '../targets/web.js';
4
5
  export type ApiKey = string;
5
6
  export declare class TApiKey extends TString<ApiKey> {
6
7
  tName(): TName;
7
8
  example(): ApiKey;
8
9
  htmlInputType(): HTMLInputType;
10
+ jsonSchemaType(): JSONSchemaType;
9
11
  isSensitive(): boolean;
10
12
  }
@@ -9,6 +9,9 @@ export class TApiKey extends TString {
9
9
  htmlInputType() {
10
10
  return 'password';
11
11
  }
12
+ jsonSchemaType() {
13
+ return { format: 'password', type: 'string' };
14
+ }
12
15
  isSensitive() {
13
16
  return true;
14
17
  }
@@ -1,5 +1,6 @@
1
1
  import type { TName } from '../base/TBase.js';
2
2
  import { TString } from '../base/TString.js';
3
+ import type { JSONSchemaType } from '../targets/json-schema.js';
3
4
  import type { HTMLInputType } from '../targets/web.js';
4
5
  import type { Validation } from '../Validation.js';
5
6
  export type DateISO8601 = string;
@@ -8,5 +9,6 @@ export declare class TDateISO8601 extends TString<DateISO8601> {
8
9
  example(): DateISO8601;
9
10
  fmt(ifNullOrUndefined?: string | undefined): string;
10
11
  htmlInputType(): HTMLInputType;
12
+ jsonSchemaType(): JSONSchemaType;
11
13
  validate(): Validation;
12
14
  }
@@ -15,6 +15,9 @@ export class TDateISO8601 extends TString {
15
15
  htmlInputType() {
16
16
  return 'date';
17
17
  }
18
+ jsonSchemaType() {
19
+ return { format: 'date', type: 'string' };
20
+ }
18
21
  validate() {
19
22
  const validation = super.validate();
20
23
  if (!validation.isOK()) {
@@ -1,5 +1,6 @@
1
1
  import type { TName } from '../base/TBase.js';
2
2
  import { TString, type TStringConstraints } from '../base/TString.js';
3
+ import type { JSONSchemaType } from '../targets/json-schema.js';
3
4
  import type { RNInputMode } from '../targets/rn.js';
4
5
  import type { HTMLInputType } from '../targets/web.js';
5
6
  export type DomainName = string;
@@ -9,5 +10,6 @@ export declare class TDomainName extends TString<DomainName> {
9
10
  tName(): TName;
10
11
  example(): DomainName;
11
12
  htmlInputType(): HTMLInputType;
13
+ jsonSchemaType(): JSONSchemaType;
12
14
  rnInputMode(): RNInputMode;
13
15
  }
@@ -16,6 +16,9 @@ export class TDomainName extends TString {
16
16
  htmlInputType() {
17
17
  return 'url';
18
18
  }
19
+ jsonSchemaType() {
20
+ return { format: 'hostname', type: 'string' };
21
+ }
19
22
  rnInputMode() {
20
23
  return 'url';
21
24
  }
@@ -1,5 +1,6 @@
1
1
  import type { TName } from '../base/TBase.js';
2
2
  import { TString, type TStringConstraints } from '../base/TString.js';
3
+ import type { JSONSchemaType } from '../targets/json-schema.js';
3
4
  import type { RNInputMode } from '../targets/rn.js';
4
5
  import type { HTMLInputType } from '../targets/web.js';
5
6
  export type Email = string;
@@ -9,5 +10,6 @@ export declare class TEmail extends TString<Email> {
9
10
  tName(): TName;
10
11
  example(): Email;
11
12
  htmlInputType(): HTMLInputType;
13
+ jsonSchemaType(): JSONSchemaType;
12
14
  rnInputMode(): RNInputMode;
13
15
  }
@@ -18,6 +18,9 @@ export class TEmail extends TString {
18
18
  htmlInputType() {
19
19
  return 'email';
20
20
  }
21
+ jsonSchemaType() {
22
+ return { format: 'email', type: 'string' };
23
+ }
21
24
  rnInputMode() {
22
25
  return 'email';
23
26
  }
@@ -1,10 +1,12 @@
1
1
  import type { TName } from '../base/TBase.js';
2
2
  import { TString } from '../base/TString.js';
3
+ import type { JSONSchemaType } from '../targets/json-schema.js';
3
4
  import type { HTMLInputType } from '../targets/web.js';
4
5
  export type EncryptionKey = string;
5
6
  export declare class TEncryptionKey extends TString<EncryptionKey> {
6
7
  tName(): TName;
7
8
  example(): EncryptionKey;
8
9
  htmlInputType(): HTMLInputType;
10
+ jsonSchemaType(): JSONSchemaType;
9
11
  isSensitive(): boolean;
10
12
  }
@@ -9,6 +9,9 @@ export class TEncryptionKey extends TString {
9
9
  htmlInputType() {
10
10
  return 'password';
11
11
  }
12
+ jsonSchemaType() {
13
+ return { format: 'password', type: 'string' };
14
+ }
12
15
  isSensitive() {
13
16
  return true;
14
17
  }
@@ -1,5 +1,6 @@
1
1
  import type { ConstraintsForHuman, TName } from '../base/TBase.js';
2
2
  import { TObject } from '../base/TObject.js';
3
+ import type { JSONSchemaType } from '../targets/json-schema.js';
3
4
  import type { HTMLInputType } from '../targets/web.js';
4
5
  import type { Validation } from '../Validation.js';
5
6
  import { type FileMimeType } from './TFileMimeType.js';
@@ -25,6 +26,7 @@ export declare class TFile extends TObject<File> {
25
26
  example(): File;
26
27
  getConstraintsForHuman(): ConstraintsForHuman | null;
27
28
  htmlInputType(): HTMLInputType;
29
+ jsonSchemaType(): JSONSchemaType;
28
30
  validate(): Validation;
29
31
  getFileConstraints(): TFileConstraints;
30
32
  fmtBytes(bytes: number, decimals?: number): string;
@@ -53,6 +53,9 @@ export class TFile extends TObject {
53
53
  htmlInputType() {
54
54
  return 'file';
55
55
  }
56
+ jsonSchemaType() {
57
+ return { format: 'binary', type: 'string' };
58
+ }
56
59
  validate() {
57
60
  const validation = super.validate();
58
61
  if (!validation.isOK()) {
@@ -1,9 +1,11 @@
1
1
  import type { TName } from '../base/TBase.js';
2
2
  import { TString, type TStringConstraints } from '../base/TString.js';
3
+ import type { JSONSchemaType } from '../targets/json-schema.js';
3
4
  export type IPv4 = `${number}.${number}.${number}.${number}`;
4
5
  export declare class TIPv4 extends TString<IPv4> {
5
6
  static readonly FORMAT: RegExp;
6
7
  constructor(constraints?: TStringConstraints);
7
8
  tName(): TName;
8
9
  example(): IPv4;
10
+ jsonSchemaType(): JSONSchemaType;
9
11
  }
@@ -13,4 +13,7 @@ export class TIPv4 extends TString {
13
13
  example() {
14
14
  return '255.255.255.255';
15
15
  }
16
+ jsonSchemaType() {
17
+ return { format: 'ipv4', type: 'string' };
18
+ }
16
19
  }
@@ -1,9 +1,11 @@
1
1
  import type { TName } from '../base/TBase.js';
2
2
  import { TString, type TStringConstraints } from '../base/TString.js';
3
+ import type { JSONSchemaType } from '../targets/json-schema.js';
3
4
  export type IPv6 = `${string}:${string}:${string}:${string}:${string}:${string}:${string}:${string}`;
4
5
  export declare class TIPv6 extends TString<IPv6> {
5
6
  static readonly FORMAT: RegExp;
6
7
  constructor(constraints?: TStringConstraints);
7
8
  tName(): TName;
8
9
  example(): IPv6;
10
+ jsonSchemaType(): JSONSchemaType;
9
11
  }
@@ -14,4 +14,7 @@ export class TIPv6 extends TString {
14
14
  example() {
15
15
  return '2001:0db8:85a3:0000:0000:8a2e:0370:7334';
16
16
  }
17
+ jsonSchemaType() {
18
+ return { format: 'ipv6', type: 'string' };
19
+ }
17
20
  }
@@ -1,5 +1,6 @@
1
1
  import type { TName } from '../base/TBase.js';
2
2
  import { TString } from '../base/TString.js';
3
+ import type { JSONSchemaType } from '../targets/json-schema.js';
3
4
  import type { HTMLInputType } from '../targets/web.js';
4
5
  import type { Validation } from '../Validation.js';
5
6
  export type JWT = string;
@@ -7,6 +8,7 @@ export declare class TJWT extends TString<JWT> {
7
8
  tName(): TName;
8
9
  example(): JWT;
9
10
  htmlInputType(): HTMLInputType;
11
+ jsonSchemaType(): JSONSchemaType;
10
12
  isSensitive(): boolean;
11
13
  validate(): Validation;
12
14
  }
@@ -9,6 +9,9 @@ export class TJWT extends TString {
9
9
  htmlInputType() {
10
10
  return 'password';
11
11
  }
12
+ jsonSchemaType() {
13
+ return { format: 'password', type: 'string' };
14
+ }
12
15
  isSensitive() {
13
16
  return true;
14
17
  }
@@ -1,10 +1,12 @@
1
1
  import type { TName } from '../base/TBase.js';
2
2
  import { TString } from '../base/TString.js';
3
+ import type { JSONSchemaType } from '../targets/json-schema.js';
3
4
  import type { HTMLInputType } from '../targets/web.js';
4
5
  export type Password = string;
5
6
  export declare class TPassword extends TString<Password> {
6
7
  tName(): TName;
7
8
  example(): Password;
8
9
  htmlInputType(): HTMLInputType;
10
+ jsonSchemaType(): JSONSchemaType;
9
11
  isSensitive(): boolean;
10
12
  }
@@ -9,6 +9,9 @@ export class TPassword extends TString {
9
9
  htmlInputType() {
10
10
  return 'password';
11
11
  }
12
+ jsonSchemaType() {
13
+ return { format: 'password', type: 'string' };
14
+ }
12
15
  isSensitive() {
13
16
  return true;
14
17
  }
@@ -1,5 +1,6 @@
1
1
  import type { TName } from '../base/TBase.js';
2
2
  import { TString, type TStringConstraints } from '../base/TString.js';
3
+ import type { JSONSchemaType } from '../targets/json-schema.js';
3
4
  import type { HTMLInputType } from '../targets/web.js';
4
5
  type Type = 'OPENSSH' | 'RSA';
5
6
  export declare const SSHPrivatekKeyTypes: Type[];
@@ -10,6 +11,7 @@ export declare class TSSHPrivateKey extends TString<SSHPrivateKey> {
10
11
  tName(): TName;
11
12
  example(): SSHPrivateKey;
12
13
  htmlInputType(): HTMLInputType;
14
+ jsonSchemaType(): JSONSchemaType;
13
15
  isPotentiallyLong(): boolean;
14
16
  isSensitive(): boolean;
15
17
  }
@@ -17,6 +17,9 @@ export class TSSHPrivateKey extends TString {
17
17
  htmlInputType() {
18
18
  return 'password';
19
19
  }
20
+ jsonSchemaType() {
21
+ return { format: 'password', type: 'string' };
22
+ }
20
23
  isPotentiallyLong() {
21
24
  return true;
22
25
  }
@@ -1,5 +1,6 @@
1
1
  import type { TName } from '../base/TBase.js';
2
2
  import { TString, type TStringConstraints } from '../base/TString.js';
3
+ import type { JSONSchemaType } from '../targets/json-schema.js';
3
4
  import type { RNInputMode } from '../targets/rn.js';
4
5
  import type { HTMLInputType } from '../targets/web.js';
5
6
  export type Time = `${number}${number}:${number}${number}` | `${number}${number}:${number}${number}:${number}${number}`;
@@ -9,5 +10,6 @@ export declare class TTime extends TString<Time> {
9
10
  tName(): TName;
10
11
  example(): Time;
11
12
  htmlInputType(): HTMLInputType;
13
+ jsonSchemaType(): JSONSchemaType;
12
14
  rnInputMode(): RNInputMode;
13
15
  }
@@ -16,6 +16,9 @@ export class TTime extends TString {
16
16
  htmlInputType() {
17
17
  return 'time';
18
18
  }
19
+ jsonSchemaType() {
20
+ return { format: 'time', type: 'string' };
21
+ }
19
22
  rnInputMode() {
20
23
  return 'numeric';
21
24
  }
@@ -1,5 +1,6 @@
1
1
  import type { TName } from '../base/TBase.js';
2
2
  import { TString, type TStringConstraints } from '../base/TString.js';
3
+ import type { JSONSchemaType } from '../targets/json-schema.js';
3
4
  import type { RNInputMode } from '../targets/rn.js';
4
5
  import type { HTMLInputType } from '../targets/web.js';
5
6
  import type { Validation } from '../Validation.js';
@@ -10,6 +11,7 @@ export declare class TURL extends TString<URL> {
10
11
  tName(): TName;
11
12
  example(): URL;
12
13
  htmlInputType(): HTMLInputType;
14
+ jsonSchemaType(): JSONSchemaType;
13
15
  rnInputMode(): RNInputMode;
14
16
  validate(): Validation;
15
17
  private isLocalhost;
@@ -17,6 +17,9 @@ export class TURL extends TString {
17
17
  htmlInputType() {
18
18
  return 'url';
19
19
  }
20
+ jsonSchemaType() {
21
+ return { format: 'uri', type: 'string' };
22
+ }
20
23
  rnInputMode() {
21
24
  return 'url';
22
25
  }
@@ -76,6 +76,7 @@ export { TUsername, type Username } from './final/TUsername.js';
76
76
  export { TUUID, type UUID } from './final/TUUID.js';
77
77
  export { TYear, type Year } from './final/TYear.js';
78
78
  export { TYesNo, type YesNo } from './final/TYesNo.js';
79
+ export type { JSONSchemaNumberFormat, JSONSchemaObjectProperties, JSONSchemaStringFormat, JSONSchemaType, } from './targets/json-schema.js';
79
80
  export type { RNInputMode } from './targets/rn.js';
80
81
  export type { HTMLInputType } from './targets/web.js';
81
82
  export { Validation, type Violation, type ViolationFormat, type ViolationI18n, type ViolationI18nable, type ViolationType, } from './Validation.js';
@@ -0,0 +1,24 @@
1
+ export type JSONSchemaNumberFormat = 'double' | 'float' | 'int32' | 'int64';
2
+ export type JSONSchemaStringFormat = 'binary' | 'byte' | 'date' | 'date-time' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'password' | 'time' | 'uuid' | 'uri';
3
+ export type JSONSchemaObjectProperties = Record<string, JSONSchemaType>;
4
+ export type JSONSchemaType = {
5
+ type: 'array';
6
+ items: JSONSchemaType;
7
+ maxItems?: number | undefined;
8
+ minItems?: number | undefined;
9
+ uniqueItems?: boolean | undefined;
10
+ } | {
11
+ type: 'boolean';
12
+ } | {
13
+ type: 'integer';
14
+ } | {
15
+ type: 'number';
16
+ format?: JSONSchemaNumberFormat;
17
+ } | {
18
+ type: 'object';
19
+ properties?: JSONSchemaObjectProperties;
20
+ required?: string[];
21
+ } | {
22
+ type: 'string';
23
+ format?: JSONSchemaStringFormat;
24
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,7 @@
1
1
  import type { ErrorMessage, HTTPStatusNumber } from '../dt/index.js';
2
+ import type { Class } from '../utils/index.js';
3
+ import type { CustomError } from './CustomError.js';
4
+ export declare const ERROR_HTTP_STATUS_MAP: Map<HTTPStatusNumber, Class<CustomError>>;
2
5
  export declare function isEmptyJSON(err: unknown): boolean;
3
6
  export declare function isInvalidJSON(err: unknown): boolean;
4
7
  export declare function throwCustomError(message: ErrorMessage, status: HTTPStatusNumber): never;
@@ -4,7 +4,7 @@ import { InternalServerError } from './InternalServerError.js';
4
4
  import { NotFoundError } from './NotFoundError.js';
5
5
  import { UnauthorizedError } from './UnauthorizedError.js';
6
6
  import { UnavailableError } from './UnavailableError.js';
7
- const ERROR_HTTP_STATUS_MAP = new Map([
7
+ export const ERROR_HTTP_STATUS_MAP = new Map([
8
8
  [400, IllegalArgumentError],
9
9
  [401, UnauthorizedError],
10
10
  [403, ForbiddenError],
@@ -1,7 +1,7 @@
1
1
  export { CustomError, type ServerError } from './CustomError.js';
2
2
  export { ForbiddenAsNotFoundError } from './ForbiddenAsNotFoundError.js';
3
3
  export { ForbiddenError } from './ForbiddenError.js';
4
- export { isEmptyJSON, isInvalidJSON, throwCustomError } from './funcs.js';
4
+ export { ERROR_HTTP_STATUS_MAP, isEmptyJSON, isInvalidJSON, throwCustomError, } from './funcs.js';
5
5
  export { IllegalArgumentError } from './IllegalArgumentError.js';
6
6
  export { InternalServerError } from './InternalServerError.js';
7
7
  export { NotAvailableError } from './internal/NotAvailableError.js';
@@ -1,7 +1,7 @@
1
1
  export { CustomError } from './CustomError.js';
2
2
  export { ForbiddenAsNotFoundError } from './ForbiddenAsNotFoundError.js';
3
3
  export { ForbiddenError } from './ForbiddenError.js';
4
- export { isEmptyJSON, isInvalidJSON, throwCustomError } from './funcs.js';
4
+ export { ERROR_HTTP_STATUS_MAP, isEmptyJSON, isInvalidJSON, throwCustomError, } from './funcs.js';
5
5
  export { IllegalArgumentError } from './IllegalArgumentError.js';
6
6
  export { InternalServerError } from './InternalServerError.js';
7
7
  export { NotAvailableError } from './internal/NotAvailableError.js';
@@ -1,4 +1,5 @@
1
1
  import type { AppName } from '../app/index.js';
2
+ import type { SemVerVersion } from '../dt/index.js';
2
3
  import type { UCName } from '../uc/index.js';
3
4
  export interface ProductAppReg {
4
5
  /**
@@ -25,6 +26,7 @@ export type ProductName = string;
25
26
  export interface ProductManifest {
26
27
  appReg: ProductAppReg[];
27
28
  name: ProductName;
29
+ version?: SemVerVersion;
28
30
  }
29
31
  export interface ProductWording {
30
32
  desc: string | null;