@azure-net/kit 3.9.2 → 4.0.0-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.
- package/dist/core/delivery/schema/Schema.d.ts +5 -3
- package/dist/core/delivery/schema/rules/Rules.js +2 -31
- package/dist/core/delivery/schema/rules/messages/index.d.ts +1 -0
- package/dist/core/delivery/schema/rules/messages/index.js +1 -0
- package/dist/core/delivery.d.ts +2 -2
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -8
- package/dist/core/constants/index.d.ts +0 -1
- package/dist/core/constants/index.js +0 -1
- package/dist/core/constants/masks.d.ts +0 -1466
- package/dist/core/constants/masks.js +0 -246
- package/dist/core/ui/eventModifiers/EventModifiers.d.ts +0 -17
- package/dist/core/ui/eventModifiers/EventModifiers.js +0 -31
- package/dist/core/ui/eventModifiers/index.d.ts +0 -1
- package/dist/core/ui/eventModifiers/index.js +0 -1
- package/dist/core/ui/index.d.ts +0 -4
- package/dist/core/ui/index.js +0 -4
- package/dist/core/ui/mask/Mask.d.ts +0 -13
- package/dist/core/ui/mask/Mask.js +0 -110
- package/dist/core/ui/mask/index.d.ts +0 -1
- package/dist/core/ui/mask/index.js +0 -1
- package/dist/core/ui/onClickOutside/OnClickOutside.d.ts +0 -3
- package/dist/core/ui/onClickOutside/OnClickOutside.js +0 -22
- package/dist/core/ui/onClickOutside/index.d.ts +0 -1
- package/dist/core/ui/onClickOutside/index.js +0 -1
- package/dist/core/ui/scrollTo/index.d.ts +0 -1
- package/dist/core/ui/scrollTo/index.js +0 -23
|
@@ -2,8 +2,10 @@ type TransformationParams<SchemaData> = {
|
|
|
2
2
|
validate?: boolean;
|
|
3
3
|
onValidationError?: (errors: RequestErrors<SchemaData>) => void;
|
|
4
4
|
};
|
|
5
|
-
type
|
|
6
|
-
|
|
5
|
+
type AtomicObject = Date | File | Blob | FileList | FormData | URL | RegExp | ArrayBuffer | DataView | Promise<unknown>;
|
|
6
|
+
type IsAtomic<T> = T extends AtomicObject ? true : false;
|
|
7
|
+
type DeepKeys<SchemaData> = IsAtomic<SchemaData> extends true ? never : SchemaData extends object ? {
|
|
8
|
+
[K in keyof SchemaData & string]: IsAtomic<SchemaData[K]> extends true ? K : SchemaData[K] extends object ? K | `${K}.${DeepKeys<SchemaData[K]>}` : K;
|
|
7
9
|
}[keyof SchemaData & string] : never;
|
|
8
10
|
export type ValidationParams<SchemaData = unknown, CurrentValue = unknown, CurrentKey = string> = {
|
|
9
11
|
val: CurrentValue;
|
|
@@ -19,7 +21,7 @@ export interface ValidationErrorsMap {
|
|
|
19
21
|
}
|
|
20
22
|
export type ValidationResult = ValidationMessage | ValidationErrorsMap | ValidationErrorsMap[] | undefined;
|
|
21
23
|
export type ValidationRuleResult<CurrentValue, ListValues = unknown, CurrentKey = string> = (params: ValidationParams<CurrentValue, ListValues, CurrentKey>) => ValidationResult;
|
|
22
|
-
type ValidationErrors<Errors> = Errors extends ReadonlyArray<infer U> ? ValidationErrors<U>[] : Errors extends object ? {
|
|
24
|
+
type ValidationErrors<Errors> = Errors extends ReadonlyArray<infer U> ? ValidationErrors<U>[] : IsAtomic<Errors> extends true ? ValidationMessage : Errors extends object ? {
|
|
23
25
|
[K in keyof Errors]?: ValidationErrors<Errors[K]>;
|
|
24
26
|
} : ValidationMessage;
|
|
25
27
|
export type RequestErrors<SchemaData> = Partial<ValidationErrors<SchemaData>>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { masks } from '../../../constants/masks.js';
|
|
2
1
|
/**
|
|
3
2
|
*
|
|
4
3
|
* @param validationMessages - BaseValidationMessages
|
|
@@ -180,7 +179,6 @@ export const createRules = (validationMessages) => {
|
|
|
180
179
|
* @returns ValidationRuleResult<T, D>
|
|
181
180
|
* @description Checks if the value is a phone number and if it is valid.
|
|
182
181
|
*/
|
|
183
|
-
const countryCodes = new Set(Object.values(masks).map((country) => country.cc)).add('8');
|
|
184
182
|
const phone = (params) => {
|
|
185
183
|
const { message } = { ...params, message: params?.message ?? validationMessages.phone };
|
|
186
184
|
return ({ val }) => {
|
|
@@ -197,40 +195,13 @@ export const createRules = (validationMessages) => {
|
|
|
197
195
|
return message();
|
|
198
196
|
}
|
|
199
197
|
let hasValidCountryCode = false;
|
|
200
|
-
if (cleanedVal.startsWith('
|
|
201
|
-
const sortedCodes = Array.from(countryCodes)
|
|
202
|
-
.filter((code) => code.startsWith('+'))
|
|
203
|
-
.sort((a, b) => b.length - a.length);
|
|
204
|
-
for (const code of sortedCodes) {
|
|
205
|
-
if (cleanedVal.startsWith(code)) {
|
|
206
|
-
const remainingDigits = cleanedVal.slice(code.length);
|
|
207
|
-
if (remainingDigits.length >= 4) {
|
|
208
|
-
hasValidCountryCode = true;
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
else if (cleanedVal.startsWith('8')) {
|
|
198
|
+
if (cleanedVal.startsWith('8')) {
|
|
215
199
|
if (cleanedVal.length === 11) {
|
|
216
200
|
hasValidCountryCode = true;
|
|
217
201
|
}
|
|
218
202
|
}
|
|
219
203
|
else if (/^\d+$/.test(cleanedVal)) {
|
|
220
|
-
|
|
221
|
-
.filter((code) => !code.startsWith('+') && code !== 'N/A')
|
|
222
|
-
.map((code) => code.replace('+', ''))
|
|
223
|
-
.sort((a, b) => b.length - a.length);
|
|
224
|
-
for (const code of codesWithoutPlus) {
|
|
225
|
-
if (cleanedVal.startsWith(code)) {
|
|
226
|
-
const remainingDigits = cleanedVal.slice(code.length);
|
|
227
|
-
if (remainingDigits.length >= 4) {
|
|
228
|
-
hasValidCountryCode = true;
|
|
229
|
-
break;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
if (!hasValidCountryCode && cleanedVal.length >= 7 && cleanedVal.length <= 10) {
|
|
204
|
+
if (!hasValidCountryCode && cleanedVal.length >= 6 && cleanedVal.length <= 16) {
|
|
234
205
|
hasValidCountryCode = true;
|
|
235
206
|
}
|
|
236
207
|
}
|
package/dist/core/delivery.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createPresenter, createStore, createPresenterFactory, createStoreFactory, clearCache } from '../edges/index.js';
|
|
2
2
|
export { createAsyncHelpers, type AsyncHelperRetry, type AsyncResourceSettings, type AsyncActionResponse } from './delivery/injectableDependencies/AsyncHelpers.js';
|
|
3
3
|
export { createErrorHandler } from './delivery/injectableDependencies/ErrorHandler.js';
|
|
4
|
-
export { createSchemaFactory, schema, type Schema, type RequestErrors, type ISchemaError, type ValidationResult, type ValidationRuleResult, type ValidationParams } from './delivery/schema/Schema.js';
|
|
5
|
-
export { createRules, validationMessagesRu, validationMessagesI18n, validationMessagesEn, type ValidationRuleParams } from './delivery/schema/rules/index.js';
|
|
4
|
+
export { createSchemaFactory, schema, type Schema, type RequestErrors, type ISchemaError, type ValidationResult, type ValidationRuleResult, type ValidationParams, type ValidationMessage, type ValidationErrorsMap } from './delivery/schema/Schema.js';
|
|
5
|
+
export { createRules, validationMessagesRu, validationMessagesI18n, validationMessagesEn, type ValidationRuleParams, type BaseValidationMessages } from './delivery/schema/rules/index.js';
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { event, stop, prevent, once, immediate, type EventHandler, onClickOutside, scrollTo, Mask, masked } from './ui/index.js';
|
|
2
1
|
export { createQuery, createAsyncSignal, createActiveForm, refreshAsyncSignal, refreshAllAsyncSignals, type AsyncSignalOptions, type AsyncSignalSvelte, type QueryController, type CreateQueryOptions, type AsyncSignalSource, type AsyncStatus } from './svelte/index.js';
|
|
3
2
|
export { createMiddlewareManager, type IMiddleware } from './shared/middleware/index.js';
|
|
4
3
|
export { ClassMirror } from './shared/classMirror/index.js';
|
package/dist/core/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { event, stop, prevent, once, immediate, onClickOutside, scrollTo, Mask, masked } from './ui/index.js';
|
|
2
1
|
export { createQuery, createAsyncSignal, createActiveForm, refreshAsyncSignal, refreshAllAsyncSignals } from './svelte/index.js';
|
|
3
2
|
export { createMiddlewareManager } from './shared/middleware/index.js';
|
|
4
3
|
export { ClassMirror } from './shared/classMirror/index.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './core/index.js';
|
|
2
|
-
export
|
|
2
|
+
export { __withEdgesUniversalLoad } from './edges/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './core/index.js';
|
|
2
|
-
export
|
|
2
|
+
export { __withEdgesUniversalLoad } from './edges/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-net/kit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"!dist/**/*.test.*",
|
|
@@ -17,10 +17,6 @@
|
|
|
17
17
|
"types": "./dist/index.d.ts",
|
|
18
18
|
"svelte": "./dist/index.js"
|
|
19
19
|
},
|
|
20
|
-
"./constants": {
|
|
21
|
-
"types": "./dist/core/constants/index.d.ts",
|
|
22
|
-
"svelte": "./dist/core/constants/index.js"
|
|
23
|
-
},
|
|
24
20
|
"./infra": {
|
|
25
21
|
"types": "./dist/core/infra.d.ts",
|
|
26
22
|
"svelte": "./dist/core/infra.js"
|
|
@@ -110,9 +106,9 @@
|
|
|
110
106
|
"svelte"
|
|
111
107
|
],
|
|
112
108
|
"dependencies": {
|
|
113
|
-
"@azure-net/edges": "^1.2.
|
|
114
|
-
"@azure-net/edges-translations": "^1.2.
|
|
115
|
-
"@azure-net/tools": "^1.2.
|
|
109
|
+
"@azure-net/edges": "^1.2.2",
|
|
110
|
+
"@azure-net/edges-translations": "^1.2.2",
|
|
111
|
+
"@azure-net/tools": "^1.2.2"
|
|
116
112
|
},
|
|
117
113
|
"scripts": {
|
|
118
114
|
"dev": "vite dev",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './masks.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './masks.js';
|