@mionjs/type-formats 0.8.0-alpha.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 (134) hide show
  1. package/.dist/cjs/BigintFormats.cjs +14 -0
  2. package/.dist/cjs/BigintFormats.cjs.map +1 -0
  3. package/.dist/cjs/BigintFormats.d.ts +2 -0
  4. package/.dist/cjs/NumberFormats.cjs +20 -0
  5. package/.dist/cjs/NumberFormats.cjs.map +1 -0
  6. package/.dist/cjs/NumberFormats.d.ts +2 -0
  7. package/.dist/cjs/StringFormats.cjs +120 -0
  8. package/.dist/cjs/StringFormats.cjs.map +1 -0
  9. package/.dist/cjs/StringFormats.d.ts +11 -0
  10. package/.dist/cjs/constants.d.ts +1 -0
  11. package/.dist/cjs/package.json +1 -0
  12. package/.dist/cjs/src/bigint/bigIntFormat.runtype.cjs +152 -0
  13. package/.dist/cjs/src/bigint/bigIntFormat.runtype.cjs.map +1 -0
  14. package/.dist/cjs/src/bigint/bigIntFormat.runtype.d.ts +21 -0
  15. package/.dist/cjs/src/bigint/defaultBigNumberFormats.cjs +16 -0
  16. package/.dist/cjs/src/bigint/defaultBigNumberFormats.cjs.map +1 -0
  17. package/.dist/cjs/src/bigint/defaultBigNumberFormats.d.ts +29 -0
  18. package/.dist/cjs/src/constants.cjs +34 -0
  19. package/.dist/cjs/src/constants.cjs.map +1 -0
  20. package/.dist/cjs/src/constants.d.ts +15 -0
  21. package/.dist/cjs/src/constants.mock.cjs +111 -0
  22. package/.dist/cjs/src/constants.mock.cjs.map +1 -0
  23. package/.dist/cjs/src/constants.mock.d.ts +335 -0
  24. package/.dist/cjs/src/number/defaultNumberFormats.cjs +28 -0
  25. package/.dist/cjs/src/number/defaultNumberFormats.cjs.map +1 -0
  26. package/.dist/cjs/src/number/defaultNumberFormats.d.ts +63 -0
  27. package/.dist/cjs/src/number/numberFormat.runtype.cjs +214 -0
  28. package/.dist/cjs/src/number/numberFormat.runtype.cjs.map +1 -0
  29. package/.dist/cjs/src/number/numberFormat.runtype.d.ts +21 -0
  30. package/.dist/cjs/src/string/date.runtype.cjs +88 -0
  31. package/.dist/cjs/src/string/date.runtype.cjs.map +1 -0
  32. package/.dist/cjs/src/string/date.runtype.d.ts +19 -0
  33. package/.dist/cjs/src/string/dateTime.runtype.cjs +83 -0
  34. package/.dist/cjs/src/string/dateTime.runtype.cjs.map +1 -0
  35. package/.dist/cjs/src/string/dateTime.runtype.d.ts +26 -0
  36. package/.dist/cjs/src/string/defaultStringFormats.runtype.cjs +25 -0
  37. package/.dist/cjs/src/string/defaultStringFormats.runtype.cjs.map +1 -0
  38. package/.dist/cjs/src/string/defaultStringFormats.runtype.d.ts +45 -0
  39. package/.dist/cjs/src/string/domain.runtype.cjs +248 -0
  40. package/.dist/cjs/src/string/domain.runtype.cjs.map +1 -0
  41. package/.dist/cjs/src/string/domain.runtype.d.ts +72 -0
  42. package/.dist/cjs/src/string/email.runtype.cjs +159 -0
  43. package/.dist/cjs/src/string/email.runtype.cjs.map +1 -0
  44. package/.dist/cjs/src/string/email.runtype.d.ts +57 -0
  45. package/.dist/cjs/src/string/ip.runtype.cjs +72 -0
  46. package/.dist/cjs/src/string/ip.runtype.cjs.map +1 -0
  47. package/.dist/cjs/src/string/ip.runtype.d.ts +50 -0
  48. package/.dist/cjs/src/string/stringFormat.runtype.cjs +270 -0
  49. package/.dist/cjs/src/string/stringFormat.runtype.cjs.map +1 -0
  50. package/.dist/cjs/src/string/stringFormat.runtype.d.ts +21 -0
  51. package/.dist/cjs/src/string/time.runtype.cjs +100 -0
  52. package/.dist/cjs/src/string/time.runtype.cjs.map +1 -0
  53. package/.dist/cjs/src/string/time.runtype.d.ts +21 -0
  54. package/.dist/cjs/src/string/url.runtype.cjs +160 -0
  55. package/.dist/cjs/src/string/url.runtype.cjs.map +1 -0
  56. package/.dist/cjs/src/string/url.runtype.d.ts +81 -0
  57. package/.dist/cjs/src/string/uuid.runtype.cjs +44 -0
  58. package/.dist/cjs/src/string/uuid.runtype.cjs.map +1 -0
  59. package/.dist/cjs/src/string/uuid.runtype.d.ts +22 -0
  60. package/.dist/cjs/src/type-formats-pure-fns.cjs +390 -0
  61. package/.dist/cjs/src/type-formats-pure-fns.cjs.map +1 -0
  62. package/.dist/cjs/src/type-formats-pure-fns.d.ts +27 -0
  63. package/.dist/cjs/src/utils.cjs +14 -0
  64. package/.dist/cjs/src/utils.cjs.map +1 -0
  65. package/.dist/cjs/src/utils.d.ts +3 -0
  66. package/.dist/cjs/vitest.config.d.ts +2 -0
  67. package/.dist/esm/BigintFormats.d.ts +2 -0
  68. package/.dist/esm/BigintFormats.js +14 -0
  69. package/.dist/esm/BigintFormats.js.map +1 -0
  70. package/.dist/esm/NumberFormats.d.ts +2 -0
  71. package/.dist/esm/NumberFormats.js +20 -0
  72. package/.dist/esm/NumberFormats.js.map +1 -0
  73. package/.dist/esm/StringFormats.d.ts +11 -0
  74. package/.dist/esm/StringFormats.js +120 -0
  75. package/.dist/esm/StringFormats.js.map +1 -0
  76. package/.dist/esm/constants.d.ts +1 -0
  77. package/.dist/esm/src/bigint/bigIntFormat.runtype.d.ts +21 -0
  78. package/.dist/esm/src/bigint/bigIntFormat.runtype.js +152 -0
  79. package/.dist/esm/src/bigint/bigIntFormat.runtype.js.map +1 -0
  80. package/.dist/esm/src/bigint/defaultBigNumberFormats.d.ts +29 -0
  81. package/.dist/esm/src/bigint/defaultBigNumberFormats.js +16 -0
  82. package/.dist/esm/src/bigint/defaultBigNumberFormats.js.map +1 -0
  83. package/.dist/esm/src/constants.d.ts +15 -0
  84. package/.dist/esm/src/constants.js +34 -0
  85. package/.dist/esm/src/constants.js.map +1 -0
  86. package/.dist/esm/src/constants.mock.d.ts +335 -0
  87. package/.dist/esm/src/constants.mock.js +111 -0
  88. package/.dist/esm/src/constants.mock.js.map +1 -0
  89. package/.dist/esm/src/number/defaultNumberFormats.d.ts +63 -0
  90. package/.dist/esm/src/number/defaultNumberFormats.js +28 -0
  91. package/.dist/esm/src/number/defaultNumberFormats.js.map +1 -0
  92. package/.dist/esm/src/number/numberFormat.runtype.d.ts +21 -0
  93. package/.dist/esm/src/number/numberFormat.runtype.js +214 -0
  94. package/.dist/esm/src/number/numberFormat.runtype.js.map +1 -0
  95. package/.dist/esm/src/string/date.runtype.d.ts +19 -0
  96. package/.dist/esm/src/string/date.runtype.js +88 -0
  97. package/.dist/esm/src/string/date.runtype.js.map +1 -0
  98. package/.dist/esm/src/string/dateTime.runtype.d.ts +26 -0
  99. package/.dist/esm/src/string/dateTime.runtype.js +83 -0
  100. package/.dist/esm/src/string/dateTime.runtype.js.map +1 -0
  101. package/.dist/esm/src/string/defaultStringFormats.runtype.d.ts +45 -0
  102. package/.dist/esm/src/string/defaultStringFormats.runtype.js +25 -0
  103. package/.dist/esm/src/string/defaultStringFormats.runtype.js.map +1 -0
  104. package/.dist/esm/src/string/domain.runtype.d.ts +72 -0
  105. package/.dist/esm/src/string/domain.runtype.js +248 -0
  106. package/.dist/esm/src/string/domain.runtype.js.map +1 -0
  107. package/.dist/esm/src/string/email.runtype.d.ts +57 -0
  108. package/.dist/esm/src/string/email.runtype.js +159 -0
  109. package/.dist/esm/src/string/email.runtype.js.map +1 -0
  110. package/.dist/esm/src/string/ip.runtype.d.ts +50 -0
  111. package/.dist/esm/src/string/ip.runtype.js +72 -0
  112. package/.dist/esm/src/string/ip.runtype.js.map +1 -0
  113. package/.dist/esm/src/string/stringFormat.runtype.d.ts +21 -0
  114. package/.dist/esm/src/string/stringFormat.runtype.js +270 -0
  115. package/.dist/esm/src/string/stringFormat.runtype.js.map +1 -0
  116. package/.dist/esm/src/string/time.runtype.d.ts +21 -0
  117. package/.dist/esm/src/string/time.runtype.js +100 -0
  118. package/.dist/esm/src/string/time.runtype.js.map +1 -0
  119. package/.dist/esm/src/string/url.runtype.d.ts +81 -0
  120. package/.dist/esm/src/string/url.runtype.js +160 -0
  121. package/.dist/esm/src/string/url.runtype.js.map +1 -0
  122. package/.dist/esm/src/string/uuid.runtype.d.ts +22 -0
  123. package/.dist/esm/src/string/uuid.runtype.js +44 -0
  124. package/.dist/esm/src/string/uuid.runtype.js.map +1 -0
  125. package/.dist/esm/src/type-formats-pure-fns.d.ts +27 -0
  126. package/.dist/esm/src/type-formats-pure-fns.js +390 -0
  127. package/.dist/esm/src/type-formats-pure-fns.js.map +1 -0
  128. package/.dist/esm/src/utils.d.ts +3 -0
  129. package/.dist/esm/src/utils.js +14 -0
  130. package/.dist/esm/src/utils.js.map +1 -0
  131. package/.dist/esm/vitest.config.d.ts +2 -0
  132. package/LICENSE +21 -0
  133. package/README.md +123 -0
  134. package/package.json +80 -0
@@ -0,0 +1,159 @@
1
+ import { registerFormatter, BaseRunTypeFormat, JitFunctions, randomItem, __ΩTypeFormat as ___TypeFormat } from "@mionjs/run-types";
2
+ import { ReflectionKind } from "@deepkit/type";
3
+ import { DomainRunTypeFormat, __ΩDEFAULT_STRICT_DOMAIN_PARAMS as ___DEFAULT_STRICT_DOMAIN_PARAMS } from "./domain.runtype.js";
4
+ import { StringRunTypeFormat, stringIgnoreProps } from "./stringFormat.runtype.js";
5
+ import { EMAIL_NAME_SAMPLES_ARRAY, __ΩEMAIL_SAMPLES as ___EMAIL_SAMPLES, __ΩEMAIL_NAME_SAMPLES as ___EMAIL_NAME_SAMPLES, __ΩEMAIL_SAMPLES_PUNYCODE as ___EMAIL_SAMPLES_PUNYCODE } from "../constants.mock.js";
6
+ import { paramVal } from "../utils.js";
7
+ const EMAIL_PATTERN = /^[^\s@]{1,64}@(?:[a-zA-Z0-9-]{1,63}\.)+[a-zA-Z]{2,63}$/;
8
+ const EMAIL_PATTERN_PUNYCODE = /^[^\s@]{1,64}@(?:[a-zA-Z0-9-]{1,63}\.)+[a-zA-Z0-9-]{2,63}$/;
9
+ class EmailRunTypeFormat extends BaseRunTypeFormat {
10
+ static id = "email";
11
+ kind = ReflectionKind.string;
12
+ name = EmailRunTypeFormat.id;
13
+ // Formatter instances as class variables
14
+ rootFormatter;
15
+ domainFormatter;
16
+ localPartFormatter;
17
+ constructor(parentPath) {
18
+ super(parentPath);
19
+ this.rootFormatter = new StringRunTypeFormat(this.getFormatPath());
20
+ this.domainFormatter = new DomainRunTypeFormat(this.getFormatPath("domain"));
21
+ this.localPartFormatter = new StringRunTypeFormat(this.getFormatPath("localPart"));
22
+ }
23
+ getIgnoredProps() {
24
+ return stringIgnoreProps;
25
+ }
26
+ canEmbedFormatterCode(fnID, rt, p) {
27
+ const params = p || this.getParams(rt);
28
+ if (fnID === JitFunctions.isType.id || fnID === JitFunctions.typeErrors.id) {
29
+ const superResult = super.canEmbedFormatterCode(fnID, rt);
30
+ const domainResult = params.domain ? this.domainFormatter.canEmbedFormatterCode(fnID, rt, params.domain) : false;
31
+ return superResult && (!!params.pattern || domainResult);
32
+ }
33
+ return super.canEmbedFormatterCode(fnID, rt);
34
+ }
35
+ emitIsType(comp, rt) {
36
+ const params = this.getParams(rt);
37
+ const fnID = comp.fnID;
38
+ const fmtName = this.getFormatName();
39
+ if (params.pattern)
40
+ return this.rootFormatter.compileFormat(fnID, comp, rt, params, comp.vλl, fmtName);
41
+ const vλl = comp.vλl;
42
+ const vLocalPart = "localPart" + this.getFormatNestLevel();
43
+ const vDomain = "domain" + this.getFormatNestLevel();
44
+ const vAtPos = "atPos" + this.getFormatNestLevel();
45
+ const rootCode = this.rootFormatter.compileFormat(fnID, comp, rt, params, vλl, fmtName);
46
+ const localPartCode = this.localPartFormatter.compileFormat(fnID, comp, rt, params.localPart, vLocalPart, fmtName);
47
+ const domainCode = this.domainFormatter.compileFormat(fnID, comp, rt, params.domain, vDomain, fmtName);
48
+ const rootSafeCode = rootCode.code ? `if (!(${rootCode.code})) return false;` : "";
49
+ const returnCode = this.isRootFormat() ? `return true;` : "";
50
+ const domainIsExpression = domainCode.type === "E";
51
+ const domainSafeCode = domainCode.code && domainIsExpression ? `if (!(${domainCode.code})) return false;` : domainCode.code;
52
+ const code = `
53
+ ${rootSafeCode}
54
+ const ${vAtPos} = ${vλl}.lastIndexOf('@');
55
+ if (${vAtPos} === -1) return false;
56
+ const ${vLocalPart} = ${vλl}.substring(0, ${vAtPos});
57
+ const ${vDomain} = ${vλl}.substring(${vAtPos} + 1);
58
+ if (!(${localPartCode.code})) return false;
59
+ ${domainSafeCode}
60
+ ${returnCode}
61
+ `;
62
+ return { code, type: "S" };
63
+ }
64
+ emitIsTypeErrors(comp, rt) {
65
+ const params = this.getParams(rt);
66
+ const fnID = comp.fnID;
67
+ const fmtName = this.getFormatName();
68
+ if (params.pattern)
69
+ return this.rootFormatter.compileFormat(fnID, comp, rt, params, comp.vλl, fmtName);
70
+ const errFn = this.getCallJitFormatErr(comp, rt, this, false);
71
+ const vλl = comp.vλl;
72
+ const vLocalPart = "localPart";
73
+ const vDomain = "domain";
74
+ const vAtPos = "atPos";
75
+ const rootCode = this.rootFormatter.compileFormat(fnID, comp, rt, params, vλl, fmtName);
76
+ const localPartCode = this.localPartFormatter.compileFormat(fnID, comp, rt, params.localPart, vLocalPart, fmtName);
77
+ const domainCode = this.domainFormatter.compileFormat(fnID, comp, rt, params.domain, vDomain, fmtName);
78
+ const code = `
79
+ ${rootCode.code ? `${rootCode.code};` : ""}
80
+ const ${vAtPos} = ${vλl}.lastIndexOf('@');
81
+ if (${vAtPos} === -1) ${errFn("@", "Email missing @ symbol")};
82
+ const ${vLocalPart} = ${vλl}.substring(0, ${vAtPos});
83
+ const ${vDomain} = ${vλl}.substring(${vAtPos} + 1);
84
+ ${localPartCode.code ? `${localPartCode.code};` : ""}
85
+ ${domainCode.code ? `${domainCode.code};` : ""}
86
+ `;
87
+ return { code, type: "S" };
88
+ }
89
+ _mock(opts, rt) {
90
+ const params = this.getParams(rt);
91
+ if (params.pattern)
92
+ return this.rootFormatter.mock(opts, rt, params);
93
+ const localPart = this.mockLocalPart(opts, rt, params.localPart);
94
+ const domain = this.domainFormatter.mock(opts, rt, params.domain);
95
+ return `${localPart}@${domain}`;
96
+ }
97
+ mockLocalPart(opts, rt, params) {
98
+ const hasParams = !!Object.keys(params).length;
99
+ if (!hasParams)
100
+ return randomItem(EMAIL_NAME_SAMPLES_ARRAY);
101
+ const defaultParams = {
102
+ ...params,
103
+ maxLength: params.maxLength ?? 64,
104
+ minLength: params.minLength ?? 1
105
+ };
106
+ return this.localPartFormatter.mock(opts, rt, defaultParams);
107
+ }
108
+ emitFormat(comp) {
109
+ return { code: `${comp.vλl}.toLowerCase()`, type: "E" };
110
+ }
111
+ validateParams(rt, params) {
112
+ const hasPattern = !!params.pattern;
113
+ const hasLocalPartOrDomain = !!params.localPart || !!params.domain;
114
+ if (hasPattern && hasLocalPartOrDomain)
115
+ throw new Error(`Email can only have either pattern or (localPart and domain) in type ${this.printPath(rt)}`);
116
+ if (params.localPart && !params.domain || !params.localPart && params.domain)
117
+ throw new Error(`Email localPart and domain must be used together in type ${this.printPath(rt)}`);
118
+ if (params.maxLength && paramVal(params.maxLength) > 254)
119
+ throw new Error(`Email maxLength cannot be greater than 254 in type ${this.printPath(rt, "maxLength")}`);
120
+ if (params.minLength && paramVal(params.minLength) < 7)
121
+ throw new Error(`Email minLength cannot be less than 7 in type ${this.printPath(rt, "minLength")}`);
122
+ this.rootFormatter.validateParams(rt, params);
123
+ if (params.localPart) {
124
+ if (Object.values(params.localPart).length === 0)
125
+ throw new Error(`Email localPart must have at least one validator in type ${this.printPath(rt, "localPart")}`);
126
+ if (params.localPart.maxLength && paramVal(params.localPart.maxLength) > 64)
127
+ throw new Error(`Email localPart.maxLength cannot be greater than 64 in type ${this.printPath(rt, "localPart.maxLength")}`);
128
+ if (params.localPart.minLength && paramVal(params.localPart.minLength) < 1)
129
+ throw new Error(`Email localPart.minLength cannot be less than 1 in type ${this.printPath(rt, "localPart.minLength")}`);
130
+ this.localPartFormatter.validateParams(rt, params.localPart);
131
+ }
132
+ if (params.domain) {
133
+ if (Object.values(params.domain).length === 0) {
134
+ throw new Error(`Email domain must have at least one validator in type ${this.printPath(rt, "domain")}`);
135
+ }
136
+ this.domainFormatter.validateParams(rt, params.domain);
137
+ }
138
+ }
139
+ }
140
+ const EMAIL_RUN_TYPE_FORMATTER = registerFormatter(new EmailRunTypeFormat());
141
+ const __ΩDEFAULT_STRICT_EMAIL_PARAMS = [254, "maxLength", 64, 1, "minLength", ` ()<>[]:;\\,{}|+@`, "val", "Invalid characters in email local part", "errorMessage", () => ___EMAIL_NAME_SAMPLES, "mockSamples", "disallowedChars", "localPart", () => ___DEFAULT_STRICT_DOMAIN_PARAMS, "domain", "DEFAULT_STRICT_EMAIL_PARAMS", `P.!4"P.#4".$4%P.&4'.(4)n*4+M4,M4-n.4/Mw0y`];
142
+ const __ΩDEFAULT_EMAIL_PARAMS = [() => EMAIL_PATTERN, "EmailPattern", () => ___EMAIL_SAMPLES, "MockSamples", 254, "maxLength", 7, "minLength", "val", "mockSamples", "Invalid email format", "errorMessage", "pattern", "DEFAULT_EMAIL_PARAMS", `i!c"n#c$P.%4&.'4(Pe#!4)e#"4*.+4,M4-Mw.y`];
143
+ const __ΩFormatEmail = [() => __ΩDEFAULT_EMAIL_PARAMS, "EP", () => ___TypeFormat, "email", "email", "FormatEmail", 'n!c"&.$e!!.%o#%w&y'];
144
+ const __ΩFormatEmailStrict = ["E", () => __ΩFormatEmail, () => __ΩDEFAULT_STRICT_EMAIL_PARAMS, "FormatEmailStrict", 'PMc!Pn#e"!Ko""w$y'];
145
+ const __ΩFormatEmailPattern = ["EmailPattern", "MockSamples", () => __ΩFormatEmail, () => __ΩDEFAULT_EMAIL_PARAMS, "FormatEmailPattern", 'b!b"e!!e!"o$#o#"w%y'];
146
+ const __ΩFormatEmailPunycode = [() => __ΩFormatEmailPattern, () => EMAIL_PATTERN_PUNYCODE, () => ___EMAIL_SAMPLES_PUNYCODE, "FormatEmailPunycode", 'i"n#o!#w$y'];
147
+ export {
148
+ EMAIL_PATTERN,
149
+ EMAIL_PATTERN_PUNYCODE,
150
+ EMAIL_RUN_TYPE_FORMATTER,
151
+ EmailRunTypeFormat,
152
+ __ΩDEFAULT_EMAIL_PARAMS,
153
+ __ΩDEFAULT_STRICT_EMAIL_PARAMS,
154
+ __ΩFormatEmail,
155
+ __ΩFormatEmailPattern,
156
+ __ΩFormatEmailPunycode,
157
+ __ΩFormatEmailStrict
158
+ };
159
+ //# sourceMappingURL=email.runtype.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.runtype.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,50 @@
1
+ import { BaseRunType, JitFnCompiler, JitErrorsFnCompiler, RunTypeOptions, JitCode, BaseRunTypeFormat, TypeFormat } from '@mionjs/run-types';
2
+ import { ReflectionKind } from '@deepkit/type';
3
+ import { FormatParams_IP } from '@mionjs/core';
4
+ export declare class IPRunTypeFormat extends BaseRunTypeFormat<FormatParams_IP> {
5
+ static id: string;
6
+ kind: ReflectionKind;
7
+ name: string;
8
+ emitIsType(comp: JitFnCompiler, rt: BaseRunType): JitCode;
9
+ _mock(opts: RunTypeOptions, rt: BaseRunType): string;
10
+ emitIsTypeErrors(comp: JitErrorsFnCompiler, rt: BaseRunType): JitCode;
11
+ emitFormat(comp: JitFnCompiler): JitCode;
12
+ }
13
+ export declare function mockIpV4(p: FormatParams_IP): string;
14
+ export declare function mockIpV6(p: FormatParams_IP): string;
15
+ export declare const IP_RUN_TYPE_FORMATTER: IPRunTypeFormat;
16
+ type DEFAULT_IP_PARAMS = {
17
+ version: 'any';
18
+ allowLocalHost: true;
19
+ };
20
+ export type FormatIP<P extends FormatParams_IP = DEFAULT_IP_PARAMS> = TypeFormat<string, 'ip', P, 'ip'>;
21
+ export type FormatIPv4 = FormatIP<{
22
+ version: 4;
23
+ allowLocalHost: true;
24
+ }>;
25
+ export type FormatIPv6 = FormatIP<{
26
+ version: 6;
27
+ allowLocalHost: true;
28
+ }>;
29
+ export type FormatIPWithPort = FormatIP<{
30
+ version: 'any';
31
+ allowLocalHost: true;
32
+ allowPort: true;
33
+ }>;
34
+ export type FormatIPv4WithPort = FormatIP<{
35
+ version: 4;
36
+ allowLocalHost: true;
37
+ allowPort: true;
38
+ }>;
39
+ export type FormatIPv6WithPort = FormatIP<{
40
+ version: 6;
41
+ allowLocalHost: true;
42
+ allowPort: true;
43
+ }>;
44
+ export {};
45
+ export declare type __ΩFormatIP = any[];
46
+ export declare type __ΩFormatIPv4 = any[];
47
+ export declare type __ΩFormatIPv6 = any[];
48
+ export declare type __ΩFormatIPWithPort = any[];
49
+ export declare type __ΩFormatIPv4WithPort = any[];
50
+ export declare type __ΩFormatIPv6WithPort = any[];
@@ -0,0 +1,72 @@
1
+ import { registerFormatter, BaseRunTypeFormat, __ΩTypeFormat as ___TypeFormat } from "@mionjs/run-types";
2
+ import { ReflectionKind } from "@deepkit/type";
3
+ import { paramVal } from "../utils.js";
4
+ import { cpf_isIPV4, cpf_isIPV6 } from "../type-formats-pure-fns.js";
5
+ class IPRunTypeFormat extends BaseRunTypeFormat {
6
+ static id = "ip";
7
+ kind = ReflectionKind.string;
8
+ name = IPRunTypeFormat.id;
9
+ emitIsType(comp, rt) {
10
+ const params = this.getParams(rt);
11
+ if (params.version === 4)
12
+ return { code: this.compilePureFunctionCall(comp, rt, cpf_isIPV4).callCode, type: "E" };
13
+ if (params.version === 6)
14
+ return { code: this.compilePureFunctionCall(comp, rt, cpf_isIPV6).callCode, type: "E" };
15
+ return {
16
+ code: `${this.compilePureFunctionCall(comp, rt, cpf_isIPV4).callCode} || ${this.compilePureFunctionCall(comp, rt, cpf_isIPV6).callCode}`,
17
+ type: "E"
18
+ };
19
+ }
20
+ _mock(opts, rt) {
21
+ const params = this.getParams(rt);
22
+ if (params.version === 4)
23
+ return mockIpV4(params);
24
+ if (params.version === 6)
25
+ return mockIpV6(params);
26
+ return Math.random() > 0.5 ? mockIpV4(params) : mockIpV6(params);
27
+ }
28
+ emitIsTypeErrors(comp, rt) {
29
+ const isTypeCodeObj = this.emitIsType(comp, rt);
30
+ const isTypeCode = isTypeCodeObj.code;
31
+ if (!isTypeCode)
32
+ return { code: "", type: "S" };
33
+ const params = this.getParams(rt);
34
+ const errFn = this.getCallJitFormatErr(comp, rt, this);
35
+ return { code: `if (!(${isTypeCode})) ${errFn("version", paramVal(params.version))}`, type: "S" };
36
+ }
37
+ emitFormat(comp) {
38
+ return { code: `${comp.vλl}.toLowerCase()`, type: "E" };
39
+ }
40
+ }
41
+ function mockIpV4(p) {
42
+ const r = Math.random();
43
+ if (p.allowLocalHost && r > 0.8)
44
+ return Math.random() > 0.5 ? "localhost" : "127:0:0:1";
45
+ return Array.from({ length: 4 }, () => Math.floor(Math.random() * 256)).join(".");
46
+ }
47
+ function mockIpV6(p) {
48
+ if (p.allowLocalHost && Math.random() > 0.8)
49
+ return Math.random() > 0.5 ? "0:0:0:0:0:0:0:1" : "::1";
50
+ return Array.from({ length: 8 }, () => Math.floor(Math.random() * 65535).toString(16)).join(":");
51
+ }
52
+ const IP_RUN_TYPE_FORMATTER = registerFormatter(new IPRunTypeFormat());
53
+ const __ΩDEFAULT_IP_PARAMS = ["any", "version", true, "allowLocalHost", "DEFAULT_IP_PARAMS", 'P.!4".#4$Mw%y'];
54
+ const __ΩFormatIP = [() => __ΩDEFAULT_IP_PARAMS, "P", () => ___TypeFormat, "ip", "ip", "FormatIP", 'n!c"&.$e!!.%o#%w&y'];
55
+ const __ΩFormatIPv4 = [() => __ΩFormatIP, 4, "version", true, "allowLocalHost", "FormatIPv4", 'P."4#.$4%Mo!"w&y'];
56
+ const __ΩFormatIPv6 = [() => __ΩFormatIP, 6, "version", true, "allowLocalHost", "FormatIPv6", 'P."4#.$4%Mo!"w&y'];
57
+ const __ΩFormatIPWithPort = [() => __ΩFormatIP, "any", "version", true, "allowLocalHost", true, "allowPort", "FormatIPWithPort", `P."4#.$4%.&4'Mo!"w(y`];
58
+ const __ΩFormatIPv4WithPort = [() => __ΩFormatIP, 4, "version", true, "allowLocalHost", true, "allowPort", "FormatIPv4WithPort", `P."4#.$4%.&4'Mo!"w(y`];
59
+ const __ΩFormatIPv6WithPort = [() => __ΩFormatIP, 6, "version", true, "allowLocalHost", true, "allowPort", "FormatIPv6WithPort", `P."4#.$4%.&4'Mo!"w(y`];
60
+ export {
61
+ IPRunTypeFormat,
62
+ IP_RUN_TYPE_FORMATTER,
63
+ __ΩFormatIP,
64
+ __ΩFormatIPWithPort,
65
+ __ΩFormatIPv4,
66
+ __ΩFormatIPv4WithPort,
67
+ __ΩFormatIPv6,
68
+ __ΩFormatIPv6WithPort,
69
+ mockIpV4,
70
+ mockIpV6
71
+ };
72
+ //# sourceMappingURL=ip.runtype.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ip.runtype.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,21 @@
1
+ import { BaseRunType, JitFnCompiler, JitErrorsFnCompiler, JitCode, TypeFormat, BaseRunTypeFormat, RunTypeOptions } from '@mionjs/run-types';
2
+ import { ReflectionKind } from '@deepkit/type';
3
+ import { FormatParam_Pattern, StringParams } from '@mionjs/core';
4
+ export declare const stringIgnoreProps: string[];
5
+ export declare class StringRunTypeFormat extends BaseRunTypeFormat<StringParams> {
6
+ static readonly id: "stringFormat";
7
+ readonly kind = ReflectionKind.string;
8
+ readonly name: "stringFormat";
9
+ getIgnoredProps(): string[] | undefined;
10
+ emitFormat(comp: JitFnCompiler, rt: BaseRunType): JitCode;
11
+ emitIsType(comp: JitFnCompiler, rt: BaseRunType): JitCode;
12
+ emitIsTypeErrors(comp: JitErrorsFnCompiler, rt: BaseRunType): JitCode;
13
+ _mock(opts: RunTypeOptions, rt: BaseRunType, params?: StringParams): string;
14
+ private mockString;
15
+ validateParams(rt: BaseRunType, p: StringParams): void;
16
+ }
17
+ export declare function isPatternParam(p: any): p is FormatParam_Pattern;
18
+ export declare function patternParamsToStrParams(p: FormatParam_Pattern): StringParams;
19
+ export declare const STRING_RUN_TYPE_FORMATTER: StringRunTypeFormat;
20
+ export type FormatString<P extends StringParams = {}, BrandName extends string = never> = TypeFormat<string, typeof StringRunTypeFormat.id, P, BrandName>;
21
+ export declare type __ΩFormatString = any[];
@@ -0,0 +1,270 @@
1
+ import { registerFormatter, BaseRunTypeFormat, getToLiteralFn, randomItem, mockString, random, __ΩTypeFormat as ___TypeFormat } from "@mionjs/run-types";
2
+ import { ReflectionKind } from "@deepkit/type";
3
+ import { paramVal, regexpEscape } from "../utils.js";
4
+ const defaultMessages = {
5
+ allowedChars: "Invalid characters",
6
+ disallowedChars: "Invalid characters",
7
+ allowedValues: "Invalid value",
8
+ disallowedValues: "Invalid value",
9
+ pattern: "Invalid pattern"
10
+ };
11
+ const propsWithRequiredSamples = ["disallowedChars", "disallowedChars", "pattern"];
12
+ const stringIgnoreProps = ["samples", "sampleChars"];
13
+ class StringRunTypeFormat extends BaseRunTypeFormat {
14
+ static id = "stringFormat";
15
+ kind = ReflectionKind.string;
16
+ name = StringRunTypeFormat.id;
17
+ getIgnoredProps() {
18
+ return stringIgnoreProps;
19
+ }
20
+ emitFormat(comp, rt) {
21
+ const operations = [];
22
+ const p = this.getParams(rt);
23
+ const vλl = comp.vλl;
24
+ if (p.trim)
25
+ operations.push((v) => `${v}.trim()`);
26
+ if (p.replace)
27
+ operations.push((v) => `${v}.replace(${p?.replace?.searchValue}, ${p?.replace?.replaceValue})`);
28
+ if (p.replaceAll)
29
+ operations.push((v) => `${v}.replaceAll(${p?.replaceAll?.searchValue}, ${p?.replaceAll?.replaceValue})`);
30
+ if (p.lowercase)
31
+ operations.push((v) => `${v}.toLowerCase()`);
32
+ if (p.uppercase)
33
+ operations.push((v) => `${v}.toUpperCase()`);
34
+ if (p.capitalize)
35
+ operations.push((v) => `(${v}.charAt(0).toUpperCase() + ${vλl}.slice(1))`);
36
+ return { code: operations.reduce((acc, op) => op(acc), vλl), type: "E" };
37
+ }
38
+ emitIsType(comp, rt) {
39
+ const conditions = [];
40
+ const p = this.getParams(rt);
41
+ const vλl = comp.vλl;
42
+ const literalFn = getToLiteralFn(comp, this.getIgnoredProps());
43
+ if (p.maxLength !== void 0)
44
+ conditions.push(`${vλl}.length <= ${literalFn(p.maxLength)}`);
45
+ if (p.minLength !== void 0)
46
+ conditions.push(`${vλl}.length >= ${literalFn(p.minLength)}`);
47
+ if (p.length !== void 0)
48
+ conditions.push(`${vλl}.length === ${literalFn(p.length)}`);
49
+ if (p.pattern !== void 0)
50
+ conditions.push(`${literalFn(p.pattern.val)}.test(${vλl})`);
51
+ if (p.allowedChars) {
52
+ const regexp = getAllowedCharsRegexp(p.allowedChars.val, p.allowedChars.ignoreCase);
53
+ conditions.push(`${literalFn(regexp)}.test(${vλl})`);
54
+ }
55
+ if (p.disallowedChars) {
56
+ const regexp = getDisallowedCharsRegexp(p.disallowedChars.val, p.disallowedChars.ignoreCase);
57
+ conditions.push(`!${literalFn(regexp)}.test(${vλl})`);
58
+ }
59
+ if (p.allowedValues) {
60
+ const regexp = getAllowedValuesRegexp(p.allowedValues.val, p.allowedValues.ignoreCase);
61
+ conditions.push(`${literalFn(regexp)}.test(${vλl})`);
62
+ }
63
+ if (p.disallowedValues) {
64
+ const regexp = getDisallowedValuesRegexp(p.disallowedValues.val, p.disallowedValues.ignoreCase);
65
+ conditions.push(`!${literalFn(regexp)}.test(${vλl})`);
66
+ }
67
+ return { code: conditions.join(" && "), type: "E" };
68
+ }
69
+ emitIsTypeErrors(comp, rt) {
70
+ const conditions = [];
71
+ const p = this.getParams(rt);
72
+ const vλl = comp.vλl;
73
+ const literalFn = getToLiteralFn(comp, this.getIgnoredProps());
74
+ const errFn = this.getCallJitFormatErr(comp, rt, this, false);
75
+ if (p.maxLength !== void 0) {
76
+ const maxL = paramVal(p.maxLength);
77
+ const errCode = errFn("maxLength", maxL);
78
+ conditions.push(`if (${vλl}.length > ${maxL}) ${errCode}`);
79
+ }
80
+ if (p.minLength !== void 0) {
81
+ const minL = paramVal(p.minLength);
82
+ const errCode = errFn("minLength", minL);
83
+ conditions.push(`if (${vλl}.length < ${minL}) ${errCode}`);
84
+ }
85
+ if (p.length !== void 0) {
86
+ const length = paramVal(p.length);
87
+ const errCode = errFn("length", length);
88
+ conditions.push(`if (${vλl}.length !== ${length}) ${errCode}`);
89
+ }
90
+ if (p.pattern !== void 0) {
91
+ const errCode = errFn("pattern", getDefaultMessage("pattern", p));
92
+ conditions.push(`if (!${literalFn(p.pattern.val)}.test(${vλl})) ${errCode}`);
93
+ }
94
+ if (p.allowedChars) {
95
+ const regexp = getAllowedCharsRegexp(p.allowedChars.val, p.allowedChars.ignoreCase);
96
+ const errCode = errFn("allowedChars", getDefaultMessage("allowedChars", p));
97
+ conditions.push(`if (!${literalFn(regexp)}.test(${vλl})) ${errCode}`);
98
+ }
99
+ if (p.disallowedChars) {
100
+ const regexp = getDisallowedCharsRegexp(p.disallowedChars.val, p.disallowedChars.ignoreCase);
101
+ const errCode = errFn("disallowedChars", getDefaultMessage("disallowedChars", p));
102
+ conditions.push(`if (${literalFn(regexp)}.test(${vλl})) ${errCode}`);
103
+ }
104
+ if (p.allowedValues) {
105
+ const regexp = getAllowedValuesRegexp(p.allowedValues.val, p.allowedValues.ignoreCase);
106
+ const errCode = errFn("allowedValues", getDefaultMessage("allowedValues", p));
107
+ conditions.push(`if (!${literalFn(regexp)}.test(${vλl})) ${errCode}`);
108
+ }
109
+ if (p.disallowedValues) {
110
+ const regexp = getDisallowedValuesRegexp(p.disallowedValues.val, p.disallowedValues.ignoreCase);
111
+ const errCode = errFn("disallowedValues", getDefaultMessage("disallowedValues", p));
112
+ conditions.push(`if (${literalFn(regexp)}.test(${vλl})) ${errCode}`);
113
+ }
114
+ return { code: conditions.join(";"), type: "S" };
115
+ }
116
+ _mock(opts, rt, params) {
117
+ const p = params || this.getParams(rt);
118
+ if (p.allowedValues)
119
+ return randomItem(p.allowedValues.val);
120
+ const samples = p.pattern?.mockSamples || p.disallowedChars?.mockSamples || p.disallowedValues?.mockSamples;
121
+ if (samples && typeof samples !== "string" && Array.isArray(samples)) {
122
+ const ignoreCase = p.disallowedChars?.ignoreCase || p.disallowedValues?.ignoreCase;
123
+ const samplesAllCases = ignoreCase ? valuesAllCases(samples) : samples;
124
+ return randomItem(samplesAllCases);
125
+ }
126
+ if (samples && typeof samples === "string") {
127
+ return this.mockString(p, samples, void 0);
128
+ }
129
+ const allowedChars = p.allowedChars?.ignoreCase ? charsAllCases(p.allowedChars.val) : p.allowedChars?.val;
130
+ const disallowedChars = p.disallowedChars?.ignoreCase ? charsAllCases(p.disallowedChars.val) : p.disallowedChars?.val;
131
+ return this.mockString(p, allowedChars, disallowedChars);
132
+ }
133
+ mockString(p, allowedChars, disallowedChars) {
134
+ switch (true) {
135
+ case p.length !== void 0:
136
+ return mockString(paramVal(p.length), allowedChars, disallowedChars);
137
+ case (p.maxLength !== void 0 && p.minLength !== void 0):
138
+ return mockString(random(paramVal(p.minLength), paramVal(p.maxLength)), allowedChars, disallowedChars);
139
+ case p.maxLength !== void 0:
140
+ return mockString(random(0, paramVal(p.maxLength)), allowedChars, disallowedChars);
141
+ case p.minLength !== void 0: {
142
+ const minLength = paramVal(p.minLength);
143
+ return mockString(random(minLength, minLength + random(1, 1 + minLength * 2)), allowedChars, disallowedChars);
144
+ }
145
+ default:
146
+ return mockString(void 0, allowedChars, disallowedChars);
147
+ }
148
+ }
149
+ validateParams(rt, p) {
150
+ const throwIfInvalid = (v, name, subName, skipLengthChecks = false) => {
151
+ const err = getParamError(v, p, skipLengthChecks);
152
+ if (err)
153
+ throw new Error(`Parameter ${name}.${subName} "${v}" does not satisfies "${err}" in type ${this.printPath(rt, subName)}`);
154
+ };
155
+ if (p.length !== void 0 && (p.maxLength !== void 0 || p.minLength !== void 0))
156
+ throw new Error(`length can not be used with maxLength or minLength in ${this.printPath(rt, "length")}`);
157
+ if (p.maxLength !== void 0 && p.minLength !== void 0 && p.maxLength < p.minLength)
158
+ throw new Error(`maxLength can not be less than minLength in ${this.printPath(rt, "maxLength")}`);
159
+ if (p.allowedValues?.val && p.allowedValues?.val.length > 100)
160
+ throw new Error(`allowedValues can not have more than 100 values in ${this.printPath(rt, "allowedValues")}`);
161
+ if (p.disallowedValues?.val && p.disallowedValues?.val.length > 100)
162
+ throw new Error(`disallowedValues can not have more than 100 values in ${this.printPath(rt, "disallowedValues")}`);
163
+ const complexParams = [
164
+ { name: "pattern", param: p.pattern },
165
+ { name: "allowedChars", param: p.allowedChars },
166
+ { name: "disallowedChars", param: p.disallowedChars },
167
+ { name: "allowedValues", param: p.allowedValues },
168
+ { name: "disallowedValues", param: p.disallowedValues }
169
+ ].filter((p2) => p2.param !== void 0);
170
+ if (complexParams.length > 1) {
171
+ throw new Error(`Only one of the parameters [pattern, allowedChars, disallowedChars, allowedValues, disallowedValues] can be used at once in ${this.printPath(rt)}`);
172
+ }
173
+ complexParams.forEach((c) => {
174
+ const { mockSamples } = c.param;
175
+ const requireSamples = propsWithRequiredSamples.includes(c.name);
176
+ if (requireSamples && !mockSamples)
177
+ throw new Error(`When ${c.name} is defined it is also required to provide samples in ${this.printPath(rt, c.name)}`);
178
+ if (Array.isArray(mockSamples) && mockSamples.length === 0)
179
+ throw new Error(`${c.name}.mockSamples can not be an empty array in ${this.printPath(rt, "mockSamples")}`);
180
+ if (typeof mockSamples === "string" && mockSamples.length === 0)
181
+ throw new Error(`${c.name}.mockSamples can not be an empty string in ${this.printPath(rt, "mockSamples")}`);
182
+ if (Array.isArray(mockSamples))
183
+ mockSamples.forEach((sample) => throwIfInvalid(sample, c.name, "mockSamples"));
184
+ if (typeof mockSamples === "string")
185
+ mockSamples.split("").forEach((char) => throwIfInvalid(char, c.name, "mockSamples", true));
186
+ });
187
+ if (p.allowedChars?.val)
188
+ throwIfInvalid(p.allowedChars?.val, "allowedChars", "val", true);
189
+ p.allowedValues?.val.forEach((v) => throwIfInvalid(v, "allowedValues", "val"));
190
+ if (p.pattern && p.replace && !p.pattern.val.test(p.replace.searchValue))
191
+ throw new Error(`replace.searchValue "${p.replace.searchValue}" invalid for pattern ${p.pattern.val} in ${this.printPath(rt, "replace")}`);
192
+ if (p.pattern && p.replaceAll && !p.pattern.val.test(p.replaceAll.searchValue))
193
+ throw new Error(`replaceAll.searchValue "${p.replaceAll.searchValue}" invalid for pattern ${p.pattern.val} in ${this.printPath(rt, "replaceAll")}`);
194
+ if ([p.lowercase, p.uppercase, p.capitalize].filter(Boolean).length > 1) {
195
+ throw new Error(`Only one text formatter (lowercase, uppercase, capitalize) allowed for ${this.printPath(rt, "formatters")}`);
196
+ }
197
+ }
198
+ }
199
+ function isPatternParam(p) {
200
+ const isMessage = p.message === void 0 || typeof p.message === "string";
201
+ const isSamples = p.samples === void 0 || Array.isArray(p.samples) && p.samples.every((s) => typeof s === "string");
202
+ const isSampleChars = p.sampleChars === void 0 || typeof p.sampleChars === "string" && p.sampleChars.length > 0;
203
+ const hasSamples = !!p.samples?.length || !!p.sampleChars?.length;
204
+ const isRegexpObj = typeof p.regexp === "object" && p.regexp instanceof RegExp;
205
+ return isMessage && hasSamples && isSamples && isSampleChars && isRegexpObj;
206
+ }
207
+ function patternParamsToStrParams(p) {
208
+ return { pattern: p };
209
+ }
210
+ function getParamError(v, p, skipLengthChecks = false) {
211
+ if (!skipLengthChecks) {
212
+ if (p.maxLength !== void 0 && v.length > p.maxLength)
213
+ return "maxLength";
214
+ if (p.minLength !== void 0 && v.length < p.minLength)
215
+ return "minLength";
216
+ if (p.length !== void 0 && v.length !== p.length)
217
+ return "length";
218
+ }
219
+ if (p.pattern && !p.pattern.val.test(v))
220
+ return "pattern";
221
+ if (p.allowedChars && !getAllowedCharsRegexp(p.allowedChars.val).test(v))
222
+ return "allowedChars";
223
+ if (p.disallowedChars && getDisallowedCharsRegexp(p.disallowedChars.val).test(v))
224
+ return "disallowedChars";
225
+ if (p.allowedValues && !p.allowedValues.val.includes(v))
226
+ return "allowedValues";
227
+ if (p.disallowedValues && p.disallowedValues.val.includes(v))
228
+ return "disallowedValues";
229
+ }
230
+ function getDefaultMessage(name, p) {
231
+ return p[name]?.errorMessage || defaultMessages[name];
232
+ }
233
+ function getAllowedCharsRegexp(allowedChars, ignoreCase) {
234
+ const flags = ignoreCase ? "i" : "";
235
+ return new RegExp(`^[${regexpEscape(allowedChars)}]+$`, flags);
236
+ }
237
+ function getDisallowedCharsRegexp(disallowedChars, ignoreCase) {
238
+ const flags = ignoreCase ? "i" : "";
239
+ return new RegExp(`[${regexpEscape(disallowedChars)}]`, flags);
240
+ }
241
+ function getAllowedValuesRegexp(allowedValues, ignoreCase) {
242
+ const flags = ignoreCase ? "i" : "";
243
+ return new RegExp(`^(?:${allowedValues.map((v) => regexpEscape(v)).join("|")})$`, flags);
244
+ }
245
+ function getDisallowedValuesRegexp(disallowedValues, ignoreCase) {
246
+ const flags = ignoreCase ? "i" : "";
247
+ return new RegExp(`^(?:${disallowedValues.map((v) => regexpEscape(v)).join("|")})$`, flags);
248
+ }
249
+ function charsAllCases(string) {
250
+ if (!string)
251
+ return;
252
+ const chars = string.split("");
253
+ const allCases = [...chars.map((c) => c.toLowerCase()), ...chars.map((c) => c.toUpperCase())];
254
+ return Array.from(new Set(allCases)).join("");
255
+ }
256
+ function valuesAllCases(stringList) {
257
+ const allCases = [...stringList, ...stringList.map((s) => s.toLowerCase()), ...stringList.map((s) => s.toUpperCase())];
258
+ return Array.from(new Set(allCases));
259
+ }
260
+ const STRING_RUN_TYPE_FORMATTER = registerFormatter(new StringRunTypeFormat());
261
+ const __ΩFormatString = ["P", "BrandName", () => ___TypeFormat, () => StringRunTypeFormat.id, "FormatString", 'PMc!!c"&i$e!!e!"o#%w%y'];
262
+ export {
263
+ STRING_RUN_TYPE_FORMATTER,
264
+ StringRunTypeFormat,
265
+ __ΩFormatString,
266
+ isPatternParam,
267
+ patternParamsToStrParams,
268
+ stringIgnoreProps
269
+ };
270
+ //# sourceMappingURL=stringFormat.runtype.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringFormat.runtype.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,21 @@
1
+ import { BaseRunType, JitFnCompiler, JitErrorsFnCompiler, JitCode, BaseRunTypeFormat, TypeFormat, RunTypeOptions } from '@mionjs/run-types';
2
+ import { ReflectionKind } from '@deepkit/type';
3
+ import { FormatParams_Time } from '@mionjs/core';
4
+ export declare class TimeStringRunTypeFormat extends BaseRunTypeFormat<FormatParams_Time> {
5
+ static id: "time";
6
+ kind: ReflectionKind;
7
+ name: "time";
8
+ emitIsType(comp: JitFnCompiler, rt: BaseRunType): JitCode;
9
+ emitIsTypeErrors(comp: JitErrorsFnCompiler, rt: BaseRunType): JitCode;
10
+ _mock(opts: RunTypeOptions, rt: BaseRunType): string;
11
+ getFormatPureFn(format: FormatStringTime): import('@mionjs/core').CompiledPureFunction;
12
+ }
13
+ export declare function mockMilliseconds(): string;
14
+ export declare function mockTimeZone(): string;
15
+ export declare const TIME_RUN_TYPE_FORMATTER: TimeStringRunTypeFormat;
16
+ export type DEFAULT_TIME_FORMAT_PARAMS = {
17
+ format: 'ISO';
18
+ };
19
+ export type FormatStringTime<P extends FormatParams_Time = DEFAULT_TIME_FORMAT_PARAMS> = TypeFormat<string, typeof TimeStringRunTypeFormat.id, P, 'time'>;
20
+ export declare type __ΩDEFAULT_TIME_FORMAT_PARAMS = any[];
21
+ export declare type __ΩFormatStringTime = any[];