@sqrzro/server 4.0.0-alpha.63 → 4.0.0-alpha.64
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/csv/generate-csv-blob.d.ts +3 -0
- package/dist/csv/generate-csv-blob.d.ts.map +1 -0
- package/dist/csv/generate-csv-blob.js +5 -0
- package/dist/csv/generate-csv.d.ts +3 -0
- package/dist/csv/generate-csv.d.ts.map +1 -0
- package/dist/csv/generate-csv.js +5 -0
- package/dist/csv/index.d.ts +4 -7
- package/dist/csv/index.d.ts.map +1 -0
- package/dist/csv/index.js +3 -2
- package/dist/csv/parse-csv.d.ts +3 -0
- package/dist/csv/parse-csv.d.ts.map +1 -0
- package/dist/csv/parse-csv.js +13 -0
- package/dist/database/create-repository.d.ts +41 -0
- package/dist/database/create-repository.d.ts.map +1 -0
- package/dist/database/create-repository.js +207 -0
- package/dist/database/db.d.ts +6 -0
- package/dist/database/db.d.ts.map +1 -0
- package/dist/database/db.js +7 -0
- package/dist/database/index.d.ts +5 -99
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +2 -2
- package/dist/database/interfaces.d.ts +52 -0
- package/dist/database/interfaces.d.ts.map +1 -0
- package/dist/database/interfaces.js +1 -0
- package/dist/forms/ValidationError.d.ts +12 -0
- package/dist/forms/ValidationError.d.ts.map +1 -0
- package/dist/forms/ValidationError.js +15 -0
- package/dist/forms/create-rule.d.ts +8 -0
- package/dist/forms/create-rule.d.ts.map +1 -0
- package/dist/forms/create-rule.js +4 -0
- package/dist/forms/files/put-file.d.ts +3 -0
- package/dist/forms/files/put-file.d.ts.map +1 -0
- package/dist/forms/files/put-file.js +9 -0
- package/dist/forms/files/upload-file.d.ts +4 -0
- package/dist/forms/files/upload-file.d.ts.map +1 -0
- package/dist/forms/files/upload-file.js +14 -0
- package/dist/forms/index.d.ts +13 -67
- package/dist/forms/index.d.ts.map +1 -0
- package/dist/forms/index.js +11 -2
- package/dist/forms/preprocesses/alpha.d.ts +3 -0
- package/dist/forms/preprocesses/alpha.d.ts.map +1 -0
- package/dist/forms/preprocesses/alpha.js +7 -0
- package/dist/forms/preprocesses/alphanumeric.d.ts +3 -0
- package/dist/forms/preprocesses/alphanumeric.d.ts.map +1 -0
- package/dist/forms/preprocesses/alphanumeric.js +7 -0
- package/dist/forms/preprocesses/lowercase.d.ts +1 -0
- package/dist/forms/preprocesses/lowercase.d.ts.map +1 -0
- package/dist/forms/preprocesses/lowercase.js +1 -0
- package/dist/forms/preprocesses/numeric.d.ts +1 -0
- package/dist/forms/preprocesses/numeric.d.ts.map +1 -0
- package/dist/forms/preprocesses/numeric.js +1 -0
- package/dist/forms/preprocesses/uppercase.d.ts +1 -0
- package/dist/forms/preprocesses/uppercase.d.ts.map +1 -0
- package/dist/forms/preprocesses/uppercase.js +1 -0
- package/dist/forms/refiner/get-not-exists-refiner.d.ts +9 -0
- package/dist/forms/refiner/get-not-exists-refiner.d.ts.map +1 -0
- package/dist/forms/refiner/get-not-exists-refiner.js +13 -0
- package/dist/forms/rules/get-csv-rule.d.ts +4 -0
- package/dist/forms/rules/get-csv-rule.d.ts.map +1 -0
- package/dist/forms/rules/get-csv-rule.js +8 -0
- package/dist/forms/rules/get-phone-rule.d.ts +9 -0
- package/dist/forms/rules/get-phone-rule.d.ts.map +1 -0
- package/dist/forms/rules/get-phone-rule.js +15 -0
- package/dist/forms/submit-form.d.ts +19 -0
- package/dist/forms/submit-form.d.ts.map +1 -0
- package/dist/forms/submit-form.js +33 -0
- package/dist/forms/transformers/get-exists-transformer.d.ts +3 -0
- package/dist/forms/transformers/get-exists-transformer.d.ts.map +1 -0
- package/dist/forms/transformers/get-exists-transformer.js +9 -0
- package/dist/forms/utility/clean-data.d.ts +3 -0
- package/dist/forms/utility/clean-data.d.ts.map +1 -0
- package/dist/forms/utility/clean-data.js +18 -0
- package/dist/forms/utility/handle-redirect.d.ts +3 -0
- package/dist/forms/utility/handle-redirect.d.ts.map +1 -0
- package/dist/forms/utility/handle-redirect.js +7 -0
- package/dist/forms/utility/interfaces.d.ts +12 -0
- package/dist/forms/utility/interfaces.d.ts.map +1 -0
- package/dist/forms/utility/interfaces.js +1 -0
- package/dist/forms/utility/transform-errors.d.ts +4 -0
- package/dist/forms/utility/transform-errors.d.ts.map +1 -0
- package/dist/forms/utility/transform-errors.js +7 -0
- package/dist/forms/utility/transform-file-path.d.ts +3 -0
- package/dist/forms/utility/transform-file-path.d.ts.map +1 -0
- package/dist/forms/utility/transform-file-path.js +9 -0
- package/dist/forms/utility/transform-issue.d.ts +6 -0
- package/dist/forms/utility/transform-issue.d.ts.map +1 -0
- package/dist/forms/utility/transform-issue.js +17 -0
- package/dist/forms/validate-schema.d.ts +4 -0
- package/dist/forms/validate-schema.d.ts.map +1 -0
- package/dist/forms/validate-schema.js +20 -0
- package/dist/forms/validators/get-exists-validator.d.ts +5 -0
- package/dist/forms/validators/get-exists-validator.d.ts.map +1 -0
- package/dist/forms/validators/get-exists-validator.js +10 -0
- package/dist/forms/validators/get-not-exists-validator.d.ts +5 -0
- package/dist/forms/validators/get-not-exists-validator.d.ts.map +1 -0
- package/dist/forms/validators/get-not-exists-validator.js +10 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/json/index.d.ts +3 -7
- package/dist/json/index.d.ts.map +1 -0
- package/dist/json/index.js +2 -2
- package/dist/json/validate-json-response.d.ts +4 -0
- package/dist/json/validate-json-response.d.ts.map +1 -0
- package/dist/json/validate-json-response.js +7 -0
- package/dist/json/validate-json.d.ts +4 -0
- package/dist/json/validate-json.d.ts.map +1 -0
- package/dist/json/validate-json.js +4 -0
- package/dist/logs/LogRepository.d.ts +1 -0
- package/dist/logs/LogRepository.d.ts.map +1 -0
- package/dist/logs/LogRepository.js +1 -0
- package/dist/logs/index.d.ts +1 -0
- package/dist/logs/index.d.ts.map +1 -0
- package/dist/logs/index.js +1 -0
- package/dist/logs/log.d.ts +1 -0
- package/dist/logs/log.d.ts.map +1 -0
- package/dist/logs/log.js +1 -0
- package/dist/logs/utility/interfaces.d.ts +1 -0
- package/dist/logs/utility/interfaces.d.ts.map +1 -0
- package/dist/logs/utility/interfaces.js +1 -0
- package/dist/logs/utility/schema.d.ts +1 -0
- package/dist/logs/utility/schema.d.ts.map +1 -0
- package/dist/logs/utility/schema.js +1 -0
- package/dist/mail/create-mail.d.ts +4 -0
- package/dist/mail/create-mail.d.ts.map +1 -0
- package/dist/mail/create-mail.js +4 -0
- package/dist/mail/drivers/mailgun/index.d.ts +4 -0
- package/dist/mail/drivers/mailgun/index.d.ts.map +1 -0
- package/dist/mail/drivers/mailgun/index.js +24 -0
- package/dist/mail/drivers/mailgun/transform-mailgun-domain.d.ts +3 -0
- package/dist/mail/drivers/mailgun/transform-mailgun-domain.d.ts.map +1 -0
- package/dist/mail/drivers/mailgun/transform-mailgun-domain.js +4 -0
- package/dist/mail/drivers/mailtrap/index.d.ts +4 -0
- package/dist/mail/drivers/mailtrap/index.d.ts.map +1 -0
- package/dist/mail/drivers/mailtrap/index.js +31 -0
- package/dist/mail/drivers/mailtrap/transform-mailtrap-recipients.d.ts +5 -0
- package/dist/mail/drivers/mailtrap/transform-mailtrap-recipients.d.ts.map +1 -0
- package/dist/mail/drivers/mailtrap/transform-mailtrap-recipients.js +7 -0
- package/dist/mail/drivers/mandrill/index.d.ts +4 -0
- package/dist/mail/drivers/mandrill/index.d.ts.map +1 -0
- package/dist/mail/drivers/mandrill/index.js +34 -0
- package/dist/mail/drivers/mandrill/transform-mandrill-recipients.d.ts +6 -0
- package/dist/mail/drivers/mandrill/transform-mandrill-recipients.d.ts.map +1 -0
- package/dist/mail/drivers/mandrill/transform-mandrill-recipients.js +14 -0
- package/dist/mail/drivers/sendgrid/index.d.ts +4 -0
- package/dist/mail/drivers/sendgrid/index.d.ts.map +1 -0
- package/dist/mail/drivers/sendgrid/index.js +23 -0
- package/dist/mail/drivers/sendgrid/transform-sendgrid-recipients.d.ts +5 -0
- package/dist/mail/drivers/sendgrid/transform-sendgrid-recipients.d.ts.map +1 -0
- package/dist/mail/drivers/sendgrid/transform-sendgrid-recipients.js +7 -0
- package/dist/mail/get-mail.d.ts +7 -0
- package/dist/mail/get-mail.d.ts.map +1 -0
- package/dist/mail/get-mail.js +12 -0
- package/dist/mail/index.d.ts +5 -25
- package/dist/mail/index.d.ts.map +1 -0
- package/dist/mail/index.js +3 -3
- package/dist/mail/send-mail.d.ts +4 -0
- package/dist/mail/send-mail.d.ts.map +1 -0
- package/dist/mail/send-mail.js +45 -0
- package/dist/mail/utility/get-sender-details.d.ts +4 -0
- package/dist/mail/utility/get-sender-details.d.ts.map +1 -0
- package/dist/mail/utility/get-sender-details.js +15 -0
- package/dist/mail/utility/interfaces.d.ts +34 -0
- package/dist/mail/utility/interfaces.d.ts.map +1 -0
- package/dist/mail/utility/interfaces.js +1 -0
- package/dist/mail/utility/render-mail.d.ts +3 -0
- package/dist/mail/utility/render-mail.d.ts.map +1 -0
- package/dist/mail/utility/render-mail.js +20 -0
- package/dist/proxy/handle-proxy.d.ts +5 -0
- package/dist/proxy/handle-proxy.d.ts.map +1 -0
- package/dist/proxy/handle-proxy.js +17 -0
- package/dist/proxy/index.d.ts +3 -10
- package/dist/proxy/index.d.ts.map +1 -0
- package/dist/proxy/index.js +1 -2
- package/dist/proxy/utility/interfaces.d.ts +6 -0
- package/dist/proxy/utility/interfaces.d.ts.map +1 -0
- package/dist/proxy/utility/interfaces.js +1 -0
- package/dist/queue/add-to-queue.d.ts +3 -0
- package/dist/queue/add-to-queue.d.ts.map +1 -0
- package/dist/queue/add-to-queue.js +2 -0
- package/dist/queue/drivers/mail-queue-driver.d.ts +1 -0
- package/dist/queue/drivers/mail-queue-driver.d.ts.map +1 -0
- package/dist/queue/drivers/mail-queue-driver.js +1 -0
- package/dist/queue/handle-queue.d.ts +4 -0
- package/dist/queue/handle-queue.d.ts.map +1 -0
- package/dist/queue/handle-queue.js +2 -0
- package/dist/queue/index.d.ts +3 -0
- package/dist/queue/index.d.ts.map +1 -0
- package/dist/queue/index.js +2 -0
- package/dist/queue/utility/interfaces.d.ts +1 -0
- package/dist/queue/utility/interfaces.d.ts.map +1 -0
- package/dist/queue/utility/interfaces.js +1 -0
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +66 -2
- package/dist/storage/utility/get-client.d.ts +10 -0
- package/dist/storage/utility/get-client.d.ts.map +1 -0
- package/dist/storage/utility/get-client.js +22 -0
- package/dist/storage/utility/get-ttl.d.ts +3 -0
- package/dist/storage/utility/get-ttl.d.ts.map +1 -0
- package/dist/storage/utility/get-ttl.js +15 -0
- package/dist/storage/utility/is-localhost.d.ts +8 -0
- package/dist/storage/utility/is-localhost.d.ts.map +1 -0
- package/dist/storage/utility/is-localhost.js +9 -0
- package/dist/storage/utility/make-key.d.ts +3 -0
- package/dist/storage/utility/make-key.d.ts.map +1 -0
- package/dist/storage/utility/make-key.js +4 -0
- package/dist/utility/db.d.ts +5 -0
- package/dist/utility/db.d.ts.map +1 -0
- package/dist/utility/db.js +2 -0
- package/dist/utility/ensure-id-from-params.d.ts +3 -0
- package/dist/utility/ensure-id-from-params.d.ts.map +1 -0
- package/dist/utility/ensure-id-from-params.js +7 -0
- package/dist/utility/ensure-id.d.ts +3 -0
- package/dist/utility/ensure-id.d.ts.map +1 -0
- package/dist/utility/ensure-id.js +9 -0
- package/dist/utility/generate-id.d.ts +3 -0
- package/dist/utility/generate-id.d.ts.map +1 -0
- package/dist/utility/generate-id.js +12 -0
- package/dist/utility/get-id-from-params.d.ts +3 -0
- package/dist/utility/get-id-from-params.d.ts.map +1 -0
- package/dist/utility/get-id-from-params.js +18 -0
- package/dist/utility/guard-id.d.ts +4 -0
- package/dist/utility/guard-id.d.ts.map +1 -0
- package/dist/utility/guard-id.js +11 -0
- package/dist/utility/index.d.ts +7 -14
- package/dist/utility/index.d.ts.map +1 -0
- package/dist/utility/index.js +6 -2
- package/dist/{interfaces-DTUqy5Oj.d.ts → utility/interfaces.d.ts} +4 -5
- package/dist/utility/interfaces.d.ts.map +1 -0
- package/dist/utility/interfaces.js +1 -0
- package/dist/utility/syslog.d.ts +3 -0
- package/dist/utility/syslog.d.ts.map +1 -0
- package/dist/utility/syslog.js +16 -0
- package/package.json +11 -11
- package/dist/chunk-2ZLU4AUD.js +0 -2
- package/dist/chunk-2ZLU4AUD.js.map +0 -1
- package/dist/chunk-6GDOIHTS.js +0 -2
- package/dist/chunk-6GDOIHTS.js.map +0 -1
- package/dist/chunk-BA3BC4CD.js +0 -2
- package/dist/chunk-BA3BC4CD.js.map +0 -1
- package/dist/chunk-UCMLSO7F.js +0 -3
- package/dist/chunk-UCMLSO7F.js.map +0 -1
- package/dist/csv/index.js.map +0 -1
- package/dist/database/index.js.map +0 -1
- package/dist/forms/index.js.map +0 -1
- package/dist/interfaces-cnzok1wV.d.ts +0 -13
- package/dist/json/index.js.map +0 -1
- package/dist/mail/index.js.map +0 -1
- package/dist/proxy/index.js.map +0 -1
- package/dist/storage/index.js.map +0 -1
- package/dist/utility/index.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-file.d.ts","sourceRoot":"","sources":["../../../src/forms/files/upload-file.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAQ1D,iBAAe,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,CAM1D;eAEc,UAAU"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import submitForm from '../submit-form';
|
|
3
|
+
import putFile from './put-file';
|
|
4
|
+
const schema = z.object({
|
|
5
|
+
file: z.instanceof(File),
|
|
6
|
+
});
|
|
7
|
+
async function uploadFile(file) {
|
|
8
|
+
return submitForm({
|
|
9
|
+
fn: async (data) => putFile(data.file),
|
|
10
|
+
formData: { file },
|
|
11
|
+
schema,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export default uploadFile;
|
package/dist/forms/index.d.ts
CHANGED
|
@@ -1,67 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* that holds a record of validation error messages.
|
|
15
|
-
*/
|
|
16
|
-
declare class ValidationError extends Error {
|
|
17
|
-
messages: Record<string, string>;
|
|
18
|
-
constructor(messages: Record<string, string>);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface SubmitFormArgs<Schema extends z.ZodTypeAny, Response> {
|
|
22
|
-
fn: (data: z.infer<Schema>) => Promise<Response>;
|
|
23
|
-
formData: object;
|
|
24
|
-
onSuccess?: (model: Response) => Promise<void> | void;
|
|
25
|
-
onValidationError?: (error: ValidationError) => void;
|
|
26
|
-
schema: Schema;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Submit a form and handle validation and submission errors.
|
|
30
|
-
*
|
|
31
|
-
* @param args The arguments for submitting the form.
|
|
32
|
-
* @returns A promise that resolves to either the submitted model or an error.
|
|
33
|
-
*/
|
|
34
|
-
declare function submitForm<Schema extends z.ZodTypeAny, Response>(args: SubmitFormArgs<Schema, Response>): FormResponse<Response>;
|
|
35
|
-
|
|
36
|
-
declare function validateSchema<T extends z.ZodTypeAny>(data: object, schema: T): Promise<z.infer<T>>;
|
|
37
|
-
|
|
38
|
-
declare function uploadFile(file: File): FormResponse<string>;
|
|
39
|
-
|
|
40
|
-
declare function getNotExistsRefiner(field: string, fn: (value: any) => Promise<any>): [
|
|
41
|
-
(data: any) => Promise<boolean>,
|
|
42
|
-
{
|
|
43
|
-
message: string;
|
|
44
|
-
path: string[];
|
|
45
|
-
}
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
declare function getCSVRule(): ValidationRule<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<string[][], string>>, undefined, undefined>;
|
|
49
|
-
|
|
50
|
-
interface PhoneRuleOptions {
|
|
51
|
-
max?: number;
|
|
52
|
-
min?: number;
|
|
53
|
-
optional?: boolean;
|
|
54
|
-
}
|
|
55
|
-
declare function getPhoneRule({ max, min, optional }?: PhoneRuleOptions): ValidationRule<z$1.ZodPreprocess<z$1.ZodString | z$1.ZodNullable<z$1.ZodString>, unknown>, undefined, undefined>;
|
|
56
|
-
|
|
57
|
-
declare function getExistsTransformer<T, ID>(key: string, value: ID, fn: (value: ID) => Promise<T>): Promise<NonNullable<T>>;
|
|
58
|
-
|
|
59
|
-
declare function getExistsValidator<T, ID>(fn: (value: ID) => Promise<T>): [(value: ID) => Promise<boolean>, {
|
|
60
|
-
message: string;
|
|
61
|
-
}];
|
|
62
|
-
|
|
63
|
-
declare function getNotExistsValidator<ID>(fn: (value: ID) => Promise<any>): [(value: ID) => Promise<boolean>, {
|
|
64
|
-
message: string;
|
|
65
|
-
}];
|
|
66
|
-
|
|
67
|
-
export { FormResponse, ValidationError, ValidationRule, createRule, getCSVRule, getExistsTransformer, getExistsValidator, getNotExistsRefiner, getNotExistsValidator, getPhoneRule, submitForm, uploadFile, validateSchema };
|
|
1
|
+
export { default as createRule } from './create-rule';
|
|
2
|
+
export { default as submitForm } from './submit-form';
|
|
3
|
+
export { default as validateSchema } from './validate-schema';
|
|
4
|
+
export { default as ValidationError } from './ValidationError';
|
|
5
|
+
export { default as uploadFile } from './files/upload-file';
|
|
6
|
+
export { default as getNotExistsRefiner } from './refiner/get-not-exists-refiner';
|
|
7
|
+
export { default as getCSVRule } from './rules/get-csv-rule';
|
|
8
|
+
export { default as getPhoneRule } from './rules/get-phone-rule';
|
|
9
|
+
export { default as getExistsTransformer } from './transformers/get-exists-transformer';
|
|
10
|
+
export { default as getExistsValidator } from './validators/get-exists-validator';
|
|
11
|
+
export { default as getNotExistsValidator } from './validators/get-not-exists-validator';
|
|
12
|
+
export type { FormResponse, ValidationRule } from './utility/interfaces';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/forms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAExF,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAEzF,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/forms/index.js
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export { default as createRule } from './create-rule';
|
|
2
|
+
export { default as submitForm } from './submit-form';
|
|
3
|
+
export { default as validateSchema } from './validate-schema';
|
|
4
|
+
export { default as ValidationError } from './ValidationError';
|
|
5
|
+
export { default as uploadFile } from './files/upload-file';
|
|
6
|
+
export { default as getNotExistsRefiner } from './refiner/get-not-exists-refiner';
|
|
7
|
+
export { default as getCSVRule } from './rules/get-csv-rule';
|
|
8
|
+
export { default as getPhoneRule } from './rules/get-phone-rule';
|
|
9
|
+
export { default as getExistsTransformer } from './transformers/get-exists-transformer';
|
|
10
|
+
export { default as getExistsValidator } from './validators/get-exists-validator';
|
|
11
|
+
export { default as getNotExistsValidator } from './validators/get-not-exists-validator';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alpha.d.ts","sourceRoot":"","sources":["../../../src/forms/preprocesses/alpha.ts"],"names":[],"mappings":"AAAA,iBAAS,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKhD;eAEc,eAAe"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alphanumeric.d.ts","sourceRoot":"","sources":["../../../src/forms/preprocesses/alphanumeric.ts"],"names":[],"mappings":"AAAA,iBAAS,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKvD;eAEc,sBAAsB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=lowercase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lowercase.d.ts","sourceRoot":"","sources":["../../../src/forms/preprocesses/lowercase.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=numeric.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numeric.d.ts","sourceRoot":"","sources":["../../../src/forms/preprocesses/numeric.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=uppercase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uppercase.d.ts","sourceRoot":"","sources":["../../../src/forms/preprocesses/uppercase.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare function getNotExistsRefiner(field: string, fn: (value: any) => Promise<any>): [
|
|
2
|
+
(data: any) => Promise<boolean>,
|
|
3
|
+
{
|
|
4
|
+
message: string;
|
|
5
|
+
path: string[];
|
|
6
|
+
}
|
|
7
|
+
];
|
|
8
|
+
export default getNotExistsRefiner;
|
|
9
|
+
//# sourceMappingURL=get-not-exists-refiner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-not-exists-refiner.d.ts","sourceRoot":"","sources":["../../../src/forms/refiner/get-not-exists-refiner.ts"],"names":[],"mappings":"AAAA,iBAAS,mBAAmB,CACxB,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,GACjC;IACC,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,OAAO,CAAC;IAC/B;QACI,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,EAAE,CAAC;KAClB;CACJ,CAaA;eAEc,mBAAmB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function getNotExistsRefiner(field, fn) {
|
|
2
|
+
return [
|
|
3
|
+
async function (data) {
|
|
4
|
+
const result = await fn(data[field]);
|
|
5
|
+
if (!result) {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
return result.id === data.id;
|
|
9
|
+
},
|
|
10
|
+
{ message: 'ALREADY_EXISTS', path: [field] },
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
export default getNotExistsRefiner;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-csv-rule.d.ts","sourceRoot":"","sources":["../../../src/forms/rules/get-csv-rule.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAQpB,iBAAS,UAAU,kHAElB;eAEc,UAAU"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
interface PhoneRuleOptions {
|
|
3
|
+
max?: number;
|
|
4
|
+
min?: number;
|
|
5
|
+
optional?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare function getPhoneRule({ max, min, optional }?: PhoneRuleOptions): import("..").ValidationRule<z.ZodPreprocess<z.ZodNullable<z.ZodString> | z.ZodString, unknown>, undefined, undefined>;
|
|
8
|
+
export default getPhoneRule;
|
|
9
|
+
//# sourceMappingURL=get-phone-rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-phone-rule.d.ts","sourceRoot":"","sources":["../../../src/forms/rules/get-phone-rule.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAIpB,UAAU,gBAAgB;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AASD,iBAAS,YAAY,CAAC,EAAE,GAAQ,EAAE,GAAO,EAAE,QAAgB,EAAE,GAAE,gBAAqB,yHAMnF;eAEc,YAAY"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import createRule from '../create-rule';
|
|
3
|
+
function preprocess(value) {
|
|
4
|
+
if (typeof value === 'string') {
|
|
5
|
+
return value.replace(/[\s-]/g, '');
|
|
6
|
+
}
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
function getPhoneRule({ max = 20, min = 4, optional = false } = {}) {
|
|
10
|
+
const baseRule = z.string().regex(/^\d+$/).max(max).min(min);
|
|
11
|
+
const rule = optional ? baseRule.nullable() : baseRule.nonempty();
|
|
12
|
+
const validator = z.preprocess(preprocess, rule);
|
|
13
|
+
return createRule({ validator });
|
|
14
|
+
}
|
|
15
|
+
export default getPhoneRule;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { FormResponse } from './utility/interfaces';
|
|
3
|
+
import ValidationError from './ValidationError';
|
|
4
|
+
interface SubmitFormArgs<Schema extends z.ZodTypeAny, Response> {
|
|
5
|
+
fn: (data: z.infer<Schema>) => Promise<Response>;
|
|
6
|
+
formData: object;
|
|
7
|
+
onSuccess?: (model: Response) => Promise<void> | void;
|
|
8
|
+
onValidationError?: (error: ValidationError) => void;
|
|
9
|
+
schema: Schema;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Submit a form and handle validation and submission errors.
|
|
13
|
+
*
|
|
14
|
+
* @param args The arguments for submitting the form.
|
|
15
|
+
* @returns A promise that resolves to either the submitted model or an error.
|
|
16
|
+
*/
|
|
17
|
+
declare function submitForm<Schema extends z.ZodTypeAny, Response>(args: SubmitFormArgs<Schema, Response>): FormResponse<Response>;
|
|
18
|
+
export default submitForm;
|
|
19
|
+
//# sourceMappingURL=submit-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submit-form.d.ts","sourceRoot":"","sources":["../../src/forms/submit-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAuB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAGhD,UAAU,cAAc,CAAC,MAAM,SAAS,CAAC,CAAC,UAAU,EAAE,QAAQ;IAC1D,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACtD,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IACrD,MAAM,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,iBAAe,UAAU,CAAC,MAAM,SAAS,CAAC,CAAC,UAAU,EAAE,QAAQ,EAC3D,IAAI,EAAE,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,GACvC,YAAY,CAAC,QAAQ,CAAC,CAwBxB;eAEc,UAAU"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import handleRedirect from './utility/handle-redirect';
|
|
2
|
+
import ValidationError from './ValidationError';
|
|
3
|
+
import validateSchema from './validate-schema';
|
|
4
|
+
/**
|
|
5
|
+
* Submit a form and handle validation and submission errors.
|
|
6
|
+
*
|
|
7
|
+
* @param args The arguments for submitting the form.
|
|
8
|
+
* @returns A promise that resolves to either the submitted model or an error.
|
|
9
|
+
*/
|
|
10
|
+
async function submitForm(args) {
|
|
11
|
+
let response = { data: null, error: null, validation: null };
|
|
12
|
+
try {
|
|
13
|
+
const data = await validateSchema(args.formData, args.schema);
|
|
14
|
+
const model = await args.fn(data);
|
|
15
|
+
await args.onSuccess?.(model);
|
|
16
|
+
return { ...response, data: model };
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
if (error instanceof ValidationError) {
|
|
20
|
+
args.onValidationError?.(error);
|
|
21
|
+
return { ...response, validation: error.messages };
|
|
22
|
+
}
|
|
23
|
+
if (error instanceof Error) {
|
|
24
|
+
if (error.message === 'NEXT_REDIRECT' && 'digest' in error) {
|
|
25
|
+
handleRedirect(String(error.digest));
|
|
26
|
+
}
|
|
27
|
+
console.error(error);
|
|
28
|
+
return { ...response, error: error.message };
|
|
29
|
+
}
|
|
30
|
+
return { ...response, error: 'submitForm encountered an unknown error' };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export default submitForm;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-exists-transformer.d.ts","sourceRoot":"","sources":["../../../src/forms/transformers/get-exists-transformer.ts"],"names":[],"mappings":"AAEA,iBAAe,oBAAoB,CAAC,CAAC,EAAE,EAAE,EACrC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,EAAE,EACT,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,GAC9B,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAQzB;eAEc,oBAAoB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import ValidationError from '../ValidationError';
|
|
2
|
+
async function getExistsTransformer(key, value, fn) {
|
|
3
|
+
const result = await fn(value);
|
|
4
|
+
if (!result) {
|
|
5
|
+
throw new ValidationError({ [key]: 'NOT_FOUND' });
|
|
6
|
+
}
|
|
7
|
+
return result;
|
|
8
|
+
}
|
|
9
|
+
export default getExistsTransformer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean-data.d.ts","sourceRoot":"","sources":["../../../src/forms/utility/clean-data.ts"],"names":[],"mappings":"AAEA,iBAAS,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAoBjC;eAEc,SAAS"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { isPlainObject } from '@sqrzro/utility';
|
|
2
|
+
function cleanData(value) {
|
|
3
|
+
if (typeof value === 'string') {
|
|
4
|
+
return (value.trim() === '' ? null : value.trim());
|
|
5
|
+
}
|
|
6
|
+
if (Array.isArray(value)) {
|
|
7
|
+
return value.map((item) => cleanData(item));
|
|
8
|
+
}
|
|
9
|
+
if (isPlainObject(value)) {
|
|
10
|
+
const result = {};
|
|
11
|
+
for (const [key, val] of Object.entries(value)) {
|
|
12
|
+
result[key] = cleanData(val);
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
export default cleanData;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-redirect.d.ts","sourceRoot":"","sources":["../../../src/forms/utility/handle-redirect.ts"],"names":[],"mappings":"AAGA,iBAAS,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAG5C;eAEc,cAAc"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface AwaitedFormResponse<M> {
|
|
2
|
+
data: M | null;
|
|
3
|
+
error: string | null;
|
|
4
|
+
validation: Record<string, string> | null;
|
|
5
|
+
}
|
|
6
|
+
export type FormResponse<M> = Promise<AwaitedFormResponse<M>>;
|
|
7
|
+
export type ValidationRule<V, T = undefined, R = undefined> = {
|
|
8
|
+
refiner: R;
|
|
9
|
+
transformer: T;
|
|
10
|
+
validator: V;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/forms/utility/interfaces.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB,CAAC,CAAC;IAClC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC7C;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9D,MAAM,MAAM,cAAc,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,GAAG,SAAS,IAAI;IAC1D,OAAO,EAAE,CAAC,CAAC;IACX,WAAW,EAAE,CAAC,CAAC;IACf,SAAS,EAAE,CAAC,CAAC;CAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-errors.d.ts","sourceRoot":"","sources":["../../../src/forms/utility/transform-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iBAAS,eAAe,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQlE;eAEc,eAAe"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-file-path.d.ts","sourceRoot":"","sources":["../../../src/forms/utility/transform-file-path.ts"],"names":[],"mappings":"AAIA,iBAAS,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAU7C;eAEc,iBAAiB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { joinURL } from '@sqrzro/utility';
|
|
2
|
+
import { generateID } from '../../utility';
|
|
3
|
+
function transformFilePath(file) {
|
|
4
|
+
const url = process.env.APP_URL ?? '_default_';
|
|
5
|
+
const obj = new URL(url);
|
|
6
|
+
const extension = file.name.split('.').pop() ?? '';
|
|
7
|
+
return joinURL(`${obj.hostname.replace('www.', '').replace(/\./g, '-')}${obj.port ? `-${obj.port}` : ''}`, `${generateID(null, 32)}.${extension}`);
|
|
8
|
+
}
|
|
9
|
+
export default transformFilePath;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { $ZodIssue, $ZodIssueBase, $ZodRawIssue } from 'zod/v4/core';
|
|
2
|
+
declare function transformIssue<T extends $ZodIssueBase = $ZodIssue>(issue: $ZodRawIssue<T>): {
|
|
3
|
+
message: string;
|
|
4
|
+
} | null;
|
|
5
|
+
export default transformIssue;
|
|
6
|
+
//# sourceMappingURL=transform-issue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-issue.d.ts","sourceRoot":"","sources":["../../../src/forms/utility/transform-issue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAiB1E,iBAAS,cAAc,CAAC,CAAC,SAAS,aAAa,GAAG,SAAS,EACvD,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,GACvB;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAM5B;eAEc,cAAc"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function isRequired(issue) {
|
|
2
|
+
if (typeof issue.input === 'undefined' &&
|
|
3
|
+
(issue.code === 'invalid_type' || issue.code === 'invalid_value')) {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
if (!issue.input && (issue.code === 'invalid_format' || issue.code === 'too_small')) {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
function transformIssue(issue) {
|
|
12
|
+
if (isRequired(issue)) {
|
|
13
|
+
return { message: 'REQUIRED' };
|
|
14
|
+
}
|
|
15
|
+
return issue.message ? { message: issue.message } : null;
|
|
16
|
+
}
|
|
17
|
+
export default transformIssue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-schema.d.ts","sourceRoot":"","sources":["../../src/forms/validate-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,iBAAe,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAChD,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,CAAC,GACV,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAYrB;eAEc,cAAc"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import cleanData from './utility/clean-data';
|
|
3
|
+
import transformErrors from './utility/transform-errors';
|
|
4
|
+
import transformIssue from './utility/transform-issue';
|
|
5
|
+
import ValidationError from './ValidationError';
|
|
6
|
+
async function validateSchema(data, schema) {
|
|
7
|
+
try {
|
|
8
|
+
const result = await schema.parseAsync(cleanData(data), {
|
|
9
|
+
error: (issue) => transformIssue(issue),
|
|
10
|
+
});
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
if (error instanceof z.ZodError) {
|
|
15
|
+
throw new ValidationError(transformErrors(error));
|
|
16
|
+
}
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export default validateSchema;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-exists-validator.d.ts","sourceRoot":"","sources":["../../../src/forms/validators/get-exists-validator.ts"],"names":[],"mappings":"AAAA,iBAAS,kBAAkB,CAAC,CAAC,EAAE,EAAE,EAC7B,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,GAC9B,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAQxD;eAEc,kBAAkB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-not-exists-validator.d.ts","sourceRoot":"","sources":["../../../src/forms/validators/get-not-exists-validator.ts"],"names":[],"mappings":"AAAA,iBAAS,qBAAqB,CAAC,EAAE,EAC7B,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,GAChC,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAQxD;eAEc,qBAAqB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {};
|
package/dist/json/index.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare function validateJson<T extends z.ZodType>(data: unknown, schema: T): z.infer<T>;
|
|
6
|
-
|
|
7
|
-
export { validateJson, validateJsonResponse };
|
|
1
|
+
export { default as validateJsonResponse } from './validate-json-response';
|
|
2
|
+
export { default as validateJson } from './validate-json';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/json/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/json/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export { default as validateJsonResponse } from './validate-json-response';
|
|
2
|
+
export { default as validateJson } from './validate-json';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-json-response.d.ts","sourceRoot":"","sources":["../../src/json/validate-json-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,iBAAe,oBAAoB,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EACnD,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,EACxB,MAAM,EAAE,CAAC,GACV,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAKrB;eAEc,oBAAoB"}
|