@stacksjs/validation 0.52.0 → 0.52.1
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/index.d.ts +2 -51
- package/dist/index.mjs +2 -25
- package/dist/is.d.ts +72 -0
- package/dist/is.mjs +212 -0
- package/dist/validate.d.ts +51 -0
- package/dist/validate.mjs +25 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,51 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
APP_NAME: validate.ZodOptional<validate.ZodDefault<validate.ZodString>>;
|
|
4
|
-
APP_ENV: validate.ZodOptional<validate.ZodDefault<validate.ZodString>>;
|
|
5
|
-
APP_KEY: validate.ZodString;
|
|
6
|
-
APP_URL: validate.ZodDefault<validate.ZodString>;
|
|
7
|
-
APP_DEBUG: validate.ZodDefault<validate.ZodBoolean>;
|
|
8
|
-
DB_CONNECTION: validate.ZodOptional<validate.ZodDefault<validate.ZodString>>;
|
|
9
|
-
DB_DATABASE: validate.ZodOptional<validate.ZodDefault<validate.ZodString>>;
|
|
10
|
-
DB_USERNAME: validate.ZodOptional<validate.ZodDefault<validate.ZodString>>;
|
|
11
|
-
DB_PASSWORD: validate.ZodOptional<validate.ZodString>;
|
|
12
|
-
SEARCH_ENGINE_DRIVER: validate.ZodOptional<validate.ZodString>;
|
|
13
|
-
MEILISEARCH_HOST: validate.ZodDefault<validate.ZodOptional<validate.ZodString>>;
|
|
14
|
-
MEILISEARCH_KEY: validate.ZodOptional<validate.ZodString>;
|
|
15
|
-
}, "strip", validate.ZodTypeAny, {
|
|
16
|
-
APP_KEY: string;
|
|
17
|
-
APP_URL: string;
|
|
18
|
-
APP_DEBUG: boolean;
|
|
19
|
-
MEILISEARCH_HOST: string;
|
|
20
|
-
APP_NAME?: string | undefined;
|
|
21
|
-
APP_ENV?: string | undefined;
|
|
22
|
-
DB_CONNECTION?: string | undefined;
|
|
23
|
-
DB_DATABASE?: string | undefined;
|
|
24
|
-
DB_USERNAME?: string | undefined;
|
|
25
|
-
DB_PASSWORD?: string | undefined;
|
|
26
|
-
SEARCH_ENGINE_DRIVER?: string | undefined;
|
|
27
|
-
MEILISEARCH_KEY?: string | undefined;
|
|
28
|
-
}, {
|
|
29
|
-
APP_KEY: string;
|
|
30
|
-
APP_NAME?: string | undefined;
|
|
31
|
-
APP_ENV?: string | undefined;
|
|
32
|
-
APP_URL?: string | undefined;
|
|
33
|
-
APP_DEBUG?: boolean | undefined;
|
|
34
|
-
DB_CONNECTION?: string | undefined;
|
|
35
|
-
DB_DATABASE?: string | undefined;
|
|
36
|
-
DB_USERNAME?: string | undefined;
|
|
37
|
-
DB_PASSWORD?: string | undefined;
|
|
38
|
-
SEARCH_ENGINE_DRIVER?: string | undefined;
|
|
39
|
-
MEILISEARCH_HOST?: string | undefined;
|
|
40
|
-
MEILISEARCH_KEY?: string | undefined;
|
|
41
|
-
}>;
|
|
42
|
-
export type StacksEnv = validate.infer<typeof envVariables>;
|
|
43
|
-
export declare enum Type {
|
|
44
|
-
String = "String",
|
|
45
|
-
Number = "Number",
|
|
46
|
-
Boolean = "Boolean",
|
|
47
|
-
Date = "Date",
|
|
48
|
-
Object = "Object",
|
|
49
|
-
Array = "Array"
|
|
50
|
-
}
|
|
51
|
-
export { validate, z };
|
|
1
|
+
export * from './is';
|
|
2
|
+
export * from './validate';
|
package/dist/index.mjs
CHANGED
|
@@ -1,25 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
APP_NAME: validate.string().default("Stacks").optional(),
|
|
4
|
-
APP_ENV: validate.string().default("local").optional(),
|
|
5
|
-
APP_KEY: validate.string(),
|
|
6
|
-
APP_URL: validate.string().url().default("http://localhost:3333"),
|
|
7
|
-
APP_DEBUG: validate.boolean().default(true),
|
|
8
|
-
DB_CONNECTION: validate.string().default("mysql").optional(),
|
|
9
|
-
DB_DATABASE: validate.string().default("stacks").optional(),
|
|
10
|
-
DB_USERNAME: validate.string().default("root").optional(),
|
|
11
|
-
DB_PASSWORD: validate.string().optional(),
|
|
12
|
-
SEARCH_ENGINE_DRIVER: validate.string().optional(),
|
|
13
|
-
MEILISEARCH_HOST: validate.string().optional().default("http://127.0.0.1:7700"),
|
|
14
|
-
MEILISEARCH_KEY: validate.string().optional()
|
|
15
|
-
});
|
|
16
|
-
export var Type = /* @__PURE__ */ ((Type2) => {
|
|
17
|
-
Type2["String"] = "String";
|
|
18
|
-
Type2["Number"] = "Number";
|
|
19
|
-
Type2["Boolean"] = "Boolean";
|
|
20
|
-
Type2["Date"] = "Date";
|
|
21
|
-
Type2["Object"] = "Object";
|
|
22
|
-
Type2["Array"] = "Array";
|
|
23
|
-
return Type2;
|
|
24
|
-
})(Type || {});
|
|
25
|
-
export { validate, z };
|
|
1
|
+
export * from "./is.mjs";
|
|
2
|
+
export * from "./validate.mjs";
|
package/dist/is.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { HashAlgorithm } from '@stacksjs/types';
|
|
2
|
+
export declare function isEmail(email: string): boolean;
|
|
3
|
+
export declare function isStrongPassword(password: string): boolean;
|
|
4
|
+
export declare function isAlphanumeric(username: string): boolean;
|
|
5
|
+
export declare function validateUsername(username: string): boolean;
|
|
6
|
+
export declare function isURL(url: string): boolean;
|
|
7
|
+
export declare function isMobilePhone(phoneNumber: string): boolean;
|
|
8
|
+
export declare function isAlpha(name: string): boolean;
|
|
9
|
+
export declare function isPostalCode(zipCode: string): boolean;
|
|
10
|
+
export declare function isNumeric(number: string): boolean;
|
|
11
|
+
export declare function isHexColor(color: string): boolean;
|
|
12
|
+
export declare function isHexadecimal(hex: string): boolean;
|
|
13
|
+
export declare function isBase64(base64: string): boolean;
|
|
14
|
+
export declare function isUUID(uuid: string): boolean;
|
|
15
|
+
export declare function isJSON(json: string): boolean;
|
|
16
|
+
export declare function isCreditCard(creditCard: string): boolean;
|
|
17
|
+
export declare function isISBN(isbn: string): boolean;
|
|
18
|
+
export declare function isIP(ip: string): boolean;
|
|
19
|
+
export declare function isIPRange(ip: string): boolean;
|
|
20
|
+
export declare function isMACAddress(macAddress: string): boolean;
|
|
21
|
+
export declare function isLatLong(latitude: string): boolean;
|
|
22
|
+
export declare function isLatitude(longitude: string): boolean;
|
|
23
|
+
export declare function isLongitude(longitude: string): boolean;
|
|
24
|
+
export declare function isCurrency(currency: string): boolean;
|
|
25
|
+
export declare function isDataURI(dataURI: string): boolean;
|
|
26
|
+
export declare function isMimeType(mimeType: string): boolean;
|
|
27
|
+
export declare function isJWT(jwt: string): boolean;
|
|
28
|
+
export declare function isMongoId(mongoId: string): boolean;
|
|
29
|
+
export declare function isAscii(ascii: string): boolean;
|
|
30
|
+
export declare function isBase32(base32: string): boolean;
|
|
31
|
+
export declare function isByteLength(byteLength: string): boolean;
|
|
32
|
+
export declare function isFQDN(fqdn: string): boolean;
|
|
33
|
+
export declare function isFullWidth(fullWidth: string): boolean;
|
|
34
|
+
export declare function isHalfWidth(halfWidth: string): boolean;
|
|
35
|
+
export declare function isHash(hash: string, algorithm: HashAlgorithm): boolean;
|
|
36
|
+
export declare function isHSL(hsl: string): boolean;
|
|
37
|
+
export declare function isIBAN(iban: string): boolean;
|
|
38
|
+
export declare function isIdentityCard(identityCard: string): boolean;
|
|
39
|
+
export declare function isISIN(isin: string): boolean;
|
|
40
|
+
export declare function isISO8601(iso8601: string): boolean;
|
|
41
|
+
export declare function isISRC(isrc: string): boolean;
|
|
42
|
+
export declare function isISSN(issn: string): boolean;
|
|
43
|
+
export declare function isISO31661Alpha2(iso31661Alpha2: string): boolean;
|
|
44
|
+
export declare function isISO31661Alpha3(iso31661Alpha3: string): boolean;
|
|
45
|
+
export declare function isDef<T = any>(val?: T): val is T;
|
|
46
|
+
export declare function isBoolean(val: any): val is boolean;
|
|
47
|
+
export declare function isFunction<T extends Function>(val: any): val is T;
|
|
48
|
+
export declare function isNumber(val: any): val is number;
|
|
49
|
+
export declare function isString(val: unknown): val is string;
|
|
50
|
+
export declare function isObject(val: any): val is object;
|
|
51
|
+
export declare function isWindow(val: any): boolean;
|
|
52
|
+
export declare const isBrowser: boolean;
|
|
53
|
+
export declare const isServer: boolean;
|
|
54
|
+
export declare function isMap(val: any): val is Map<any, any>;
|
|
55
|
+
export declare function isSet(val: any): val is Set<any>;
|
|
56
|
+
export declare function isPromise<T = any>(val: any): val is Promise<T>;
|
|
57
|
+
export declare function isUndefined(v: any): boolean;
|
|
58
|
+
export declare function isNull(v: any): boolean;
|
|
59
|
+
export declare function isSymbol(v: any): boolean;
|
|
60
|
+
export declare function isDate(v: any): boolean;
|
|
61
|
+
export declare function isRegExp(v: any): boolean;
|
|
62
|
+
export declare function isArray(v: any): boolean;
|
|
63
|
+
export declare function isPrimitive(v: any): boolean;
|
|
64
|
+
export declare function isInteger(v: any): boolean;
|
|
65
|
+
export declare function isFloat(v: any): boolean;
|
|
66
|
+
export declare function isPositive(v: any): boolean;
|
|
67
|
+
export declare function isNegative(v: any): boolean;
|
|
68
|
+
export declare function isEven(v: any): boolean;
|
|
69
|
+
export declare function isOdd(v: any): boolean;
|
|
70
|
+
export declare function isEvenOrOdd(v: any): false | "even" | "odd";
|
|
71
|
+
export declare function isPositiveOrNegative(v: any): false | "positive" | "negative";
|
|
72
|
+
export declare function isIntegerOrFloat(v: any): false | "integer" | "float";
|
package/dist/is.mjs
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { getTypeName, toString } from "@stacksjs/utils";
|
|
2
|
+
import validator from "validator";
|
|
3
|
+
export function isEmail(email) {
|
|
4
|
+
return validator.isEmail(email);
|
|
5
|
+
}
|
|
6
|
+
export function isStrongPassword(password) {
|
|
7
|
+
return validator.isStrongPassword(password);
|
|
8
|
+
}
|
|
9
|
+
export function isAlphanumeric(username) {
|
|
10
|
+
return validator.isAlphanumeric(username);
|
|
11
|
+
}
|
|
12
|
+
export function validateUsername(username) {
|
|
13
|
+
return isAlphanumeric(username);
|
|
14
|
+
}
|
|
15
|
+
export function isURL(url) {
|
|
16
|
+
return validator.isURL(url);
|
|
17
|
+
}
|
|
18
|
+
export function isMobilePhone(phoneNumber) {
|
|
19
|
+
return validator.isMobilePhone(phoneNumber);
|
|
20
|
+
}
|
|
21
|
+
export function isAlpha(name) {
|
|
22
|
+
return validator.isAlpha(name);
|
|
23
|
+
}
|
|
24
|
+
export function isPostalCode(zipCode) {
|
|
25
|
+
return validator.isPostalCode(zipCode, "any");
|
|
26
|
+
}
|
|
27
|
+
export function isNumeric(number) {
|
|
28
|
+
return validator.isNumeric(number);
|
|
29
|
+
}
|
|
30
|
+
export function isHexColor(color) {
|
|
31
|
+
return validator.isHexColor(color);
|
|
32
|
+
}
|
|
33
|
+
export function isHexadecimal(hex) {
|
|
34
|
+
return validator.isHexadecimal(hex);
|
|
35
|
+
}
|
|
36
|
+
export function isBase64(base64) {
|
|
37
|
+
return validator.isBase64(base64);
|
|
38
|
+
}
|
|
39
|
+
export function isUUID(uuid) {
|
|
40
|
+
return validator.isUUID(uuid);
|
|
41
|
+
}
|
|
42
|
+
export function isJSON(json) {
|
|
43
|
+
return validator.isJSON(json);
|
|
44
|
+
}
|
|
45
|
+
export function isCreditCard(creditCard) {
|
|
46
|
+
return validator.isCreditCard(creditCard);
|
|
47
|
+
}
|
|
48
|
+
export function isISBN(isbn) {
|
|
49
|
+
return validator.isISBN(isbn);
|
|
50
|
+
}
|
|
51
|
+
export function isIP(ip) {
|
|
52
|
+
return validator.isIP(ip);
|
|
53
|
+
}
|
|
54
|
+
export function isIPRange(ip) {
|
|
55
|
+
return validator.isIPRange(ip);
|
|
56
|
+
}
|
|
57
|
+
export function isMACAddress(macAddress) {
|
|
58
|
+
return validator.isMACAddress(macAddress);
|
|
59
|
+
}
|
|
60
|
+
export function isLatLong(latitude) {
|
|
61
|
+
return validator.isLatLong(latitude);
|
|
62
|
+
}
|
|
63
|
+
export function isLatitude(longitude) {
|
|
64
|
+
return validator.isLatLong(longitude);
|
|
65
|
+
}
|
|
66
|
+
export function isLongitude(longitude) {
|
|
67
|
+
return validator.isLatLong(longitude);
|
|
68
|
+
}
|
|
69
|
+
export function isCurrency(currency) {
|
|
70
|
+
return validator.isCurrency(currency);
|
|
71
|
+
}
|
|
72
|
+
export function isDataURI(dataURI) {
|
|
73
|
+
return validator.isDataURI(dataURI);
|
|
74
|
+
}
|
|
75
|
+
export function isMimeType(mimeType) {
|
|
76
|
+
return validator.isMimeType(mimeType);
|
|
77
|
+
}
|
|
78
|
+
export function isJWT(jwt) {
|
|
79
|
+
return validator.isJWT(jwt);
|
|
80
|
+
}
|
|
81
|
+
export function isMongoId(mongoId) {
|
|
82
|
+
return validator.isMongoId(mongoId);
|
|
83
|
+
}
|
|
84
|
+
export function isAscii(ascii) {
|
|
85
|
+
return validator.isAscii(ascii);
|
|
86
|
+
}
|
|
87
|
+
export function isBase32(base32) {
|
|
88
|
+
return validator.isBase32(base32);
|
|
89
|
+
}
|
|
90
|
+
export function isByteLength(byteLength) {
|
|
91
|
+
return validator.isByteLength(byteLength);
|
|
92
|
+
}
|
|
93
|
+
export function isFQDN(fqdn) {
|
|
94
|
+
return validator.isFQDN(fqdn);
|
|
95
|
+
}
|
|
96
|
+
export function isFullWidth(fullWidth) {
|
|
97
|
+
return validator.isFullWidth(fullWidth);
|
|
98
|
+
}
|
|
99
|
+
export function isHalfWidth(halfWidth) {
|
|
100
|
+
return validator.isHalfWidth(halfWidth);
|
|
101
|
+
}
|
|
102
|
+
export function isHash(hash, algorithm) {
|
|
103
|
+
return validator.isHash(hash, algorithm);
|
|
104
|
+
}
|
|
105
|
+
export function isHSL(hsl) {
|
|
106
|
+
return validator.isHSL(hsl);
|
|
107
|
+
}
|
|
108
|
+
export function isIBAN(iban) {
|
|
109
|
+
return validator.isIBAN(iban);
|
|
110
|
+
}
|
|
111
|
+
export function isIdentityCard(identityCard) {
|
|
112
|
+
return validator.isIdentityCard(identityCard);
|
|
113
|
+
}
|
|
114
|
+
export function isISIN(isin) {
|
|
115
|
+
return validator.isISIN(isin);
|
|
116
|
+
}
|
|
117
|
+
export function isISO8601(iso8601) {
|
|
118
|
+
return validator.isISO8601(iso8601);
|
|
119
|
+
}
|
|
120
|
+
export function isISRC(isrc) {
|
|
121
|
+
return validator.isISRC(isrc);
|
|
122
|
+
}
|
|
123
|
+
export function isISSN(issn) {
|
|
124
|
+
return validator.isISSN(issn);
|
|
125
|
+
}
|
|
126
|
+
export function isISO31661Alpha2(iso31661Alpha2) {
|
|
127
|
+
return validator.isISO31661Alpha2(iso31661Alpha2);
|
|
128
|
+
}
|
|
129
|
+
export function isISO31661Alpha3(iso31661Alpha3) {
|
|
130
|
+
return validator.isISO31661Alpha3(iso31661Alpha3);
|
|
131
|
+
}
|
|
132
|
+
export function isDef(val) {
|
|
133
|
+
return typeof val !== "undefined";
|
|
134
|
+
}
|
|
135
|
+
export function isBoolean(val) {
|
|
136
|
+
return typeof val === "boolean";
|
|
137
|
+
}
|
|
138
|
+
export function isFunction(val) {
|
|
139
|
+
return typeof val === "function";
|
|
140
|
+
}
|
|
141
|
+
export function isNumber(val) {
|
|
142
|
+
return typeof val === "number";
|
|
143
|
+
}
|
|
144
|
+
export function isString(val) {
|
|
145
|
+
return typeof val === "string";
|
|
146
|
+
}
|
|
147
|
+
export function isObject(val) {
|
|
148
|
+
return toString(val) === "[object Object]";
|
|
149
|
+
}
|
|
150
|
+
export function isWindow(val) {
|
|
151
|
+
return typeof window !== "undefined" && toString(val) === "[object Window]";
|
|
152
|
+
}
|
|
153
|
+
export const isBrowser = typeof window !== "undefined";
|
|
154
|
+
export const isServer = typeof document === "undefined";
|
|
155
|
+
export function isMap(val) {
|
|
156
|
+
return toString(val) === "[object Map]";
|
|
157
|
+
}
|
|
158
|
+
export function isSet(val) {
|
|
159
|
+
return toString(val) === "[object Set]";
|
|
160
|
+
}
|
|
161
|
+
export function isPromise(val) {
|
|
162
|
+
return toString(val) === "[object Promise]";
|
|
163
|
+
}
|
|
164
|
+
export function isUndefined(v) {
|
|
165
|
+
return getTypeName(v) === "undefined";
|
|
166
|
+
}
|
|
167
|
+
export function isNull(v) {
|
|
168
|
+
return getTypeName(v) === "null";
|
|
169
|
+
}
|
|
170
|
+
export function isSymbol(v) {
|
|
171
|
+
return getTypeName(v) === "symbol";
|
|
172
|
+
}
|
|
173
|
+
export function isDate(v) {
|
|
174
|
+
return getTypeName(v) === "date";
|
|
175
|
+
}
|
|
176
|
+
export function isRegExp(v) {
|
|
177
|
+
return getTypeName(v) === "regexp";
|
|
178
|
+
}
|
|
179
|
+
export function isArray(v) {
|
|
180
|
+
return getTypeName(v) === "array";
|
|
181
|
+
}
|
|
182
|
+
export function isPrimitive(v) {
|
|
183
|
+
const type = getTypeName(v);
|
|
184
|
+
return type === "null" || type === "undefined" || type === "string" || type === "number" || type === "boolean" || type === "symbol";
|
|
185
|
+
}
|
|
186
|
+
export function isInteger(v) {
|
|
187
|
+
return isNumber(v) && Number.isInteger(v);
|
|
188
|
+
}
|
|
189
|
+
export function isFloat(v) {
|
|
190
|
+
return isNumber(v) && !Number.isInteger(v);
|
|
191
|
+
}
|
|
192
|
+
export function isPositive(v) {
|
|
193
|
+
return isNumber(v) && v > 0;
|
|
194
|
+
}
|
|
195
|
+
export function isNegative(v) {
|
|
196
|
+
return isNumber(v) && v < 0;
|
|
197
|
+
}
|
|
198
|
+
export function isEven(v) {
|
|
199
|
+
return isNumber(v) && v % 2 === 0;
|
|
200
|
+
}
|
|
201
|
+
export function isOdd(v) {
|
|
202
|
+
return isNumber(v) && v % 2 !== 0;
|
|
203
|
+
}
|
|
204
|
+
export function isEvenOrOdd(v) {
|
|
205
|
+
return isNumber(v) && (v % 2 === 0 ? "even" : "odd");
|
|
206
|
+
}
|
|
207
|
+
export function isPositiveOrNegative(v) {
|
|
208
|
+
return isNumber(v) && (v > 0 ? "positive" : "negative");
|
|
209
|
+
}
|
|
210
|
+
export function isIntegerOrFloat(v) {
|
|
211
|
+
return isNumber(v) && (Number.isInteger(v) ? "integer" : "float");
|
|
212
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z as validate, z } from 'zod';
|
|
2
|
+
export declare const envVariables: validate.ZodObject<{
|
|
3
|
+
APP_NAME: validate.ZodOptional<validate.ZodDefault<validate.ZodString>>;
|
|
4
|
+
APP_ENV: validate.ZodOptional<validate.ZodDefault<validate.ZodString>>;
|
|
5
|
+
APP_KEY: validate.ZodString;
|
|
6
|
+
APP_URL: validate.ZodDefault<validate.ZodString>;
|
|
7
|
+
APP_DEBUG: validate.ZodDefault<validate.ZodBoolean>;
|
|
8
|
+
DB_CONNECTION: validate.ZodOptional<validate.ZodDefault<validate.ZodString>>;
|
|
9
|
+
DB_DATABASE: validate.ZodOptional<validate.ZodDefault<validate.ZodString>>;
|
|
10
|
+
DB_USERNAME: validate.ZodOptional<validate.ZodDefault<validate.ZodString>>;
|
|
11
|
+
DB_PASSWORD: validate.ZodOptional<validate.ZodString>;
|
|
12
|
+
SEARCH_ENGINE_DRIVER: validate.ZodOptional<validate.ZodString>;
|
|
13
|
+
MEILISEARCH_HOST: validate.ZodDefault<validate.ZodOptional<validate.ZodString>>;
|
|
14
|
+
MEILISEARCH_KEY: validate.ZodOptional<validate.ZodString>;
|
|
15
|
+
}, "strip", validate.ZodTypeAny, {
|
|
16
|
+
APP_KEY: string;
|
|
17
|
+
APP_URL: string;
|
|
18
|
+
APP_DEBUG: boolean;
|
|
19
|
+
MEILISEARCH_HOST: string;
|
|
20
|
+
APP_NAME?: string | undefined;
|
|
21
|
+
APP_ENV?: string | undefined;
|
|
22
|
+
DB_CONNECTION?: string | undefined;
|
|
23
|
+
DB_DATABASE?: string | undefined;
|
|
24
|
+
DB_USERNAME?: string | undefined;
|
|
25
|
+
DB_PASSWORD?: string | undefined;
|
|
26
|
+
SEARCH_ENGINE_DRIVER?: string | undefined;
|
|
27
|
+
MEILISEARCH_KEY?: string | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
APP_KEY: string;
|
|
30
|
+
APP_NAME?: string | undefined;
|
|
31
|
+
APP_ENV?: string | undefined;
|
|
32
|
+
APP_URL?: string | undefined;
|
|
33
|
+
APP_DEBUG?: boolean | undefined;
|
|
34
|
+
DB_CONNECTION?: string | undefined;
|
|
35
|
+
DB_DATABASE?: string | undefined;
|
|
36
|
+
DB_USERNAME?: string | undefined;
|
|
37
|
+
DB_PASSWORD?: string | undefined;
|
|
38
|
+
SEARCH_ENGINE_DRIVER?: string | undefined;
|
|
39
|
+
MEILISEARCH_HOST?: string | undefined;
|
|
40
|
+
MEILISEARCH_KEY?: string | undefined;
|
|
41
|
+
}>;
|
|
42
|
+
export type StacksEnv = validate.infer<typeof envVariables>;
|
|
43
|
+
export declare enum Type {
|
|
44
|
+
String = "String",
|
|
45
|
+
Number = "Number",
|
|
46
|
+
Boolean = "Boolean",
|
|
47
|
+
Date = "Date",
|
|
48
|
+
Object = "Object",
|
|
49
|
+
Array = "Array"
|
|
50
|
+
}
|
|
51
|
+
export { validate, z };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z as validate, z } from "zod";
|
|
2
|
+
export const envVariables = validate.object({
|
|
3
|
+
APP_NAME: validate.string().default("Stacks").optional(),
|
|
4
|
+
APP_ENV: validate.string().default("local").optional(),
|
|
5
|
+
APP_KEY: validate.string(),
|
|
6
|
+
APP_URL: validate.string().url().default("http://localhost:3333"),
|
|
7
|
+
APP_DEBUG: validate.boolean().default(true),
|
|
8
|
+
DB_CONNECTION: validate.string().default("mysql").optional(),
|
|
9
|
+
DB_DATABASE: validate.string().default("stacks").optional(),
|
|
10
|
+
DB_USERNAME: validate.string().default("root").optional(),
|
|
11
|
+
DB_PASSWORD: validate.string().optional(),
|
|
12
|
+
SEARCH_ENGINE_DRIVER: validate.string().optional(),
|
|
13
|
+
MEILISEARCH_HOST: validate.string().optional().default("http://127.0.0.1:7700"),
|
|
14
|
+
MEILISEARCH_KEY: validate.string().optional()
|
|
15
|
+
});
|
|
16
|
+
export var Type = /* @__PURE__ */ ((Type2) => {
|
|
17
|
+
Type2["String"] = "String";
|
|
18
|
+
Type2["Number"] = "Number";
|
|
19
|
+
Type2["Boolean"] = "Boolean";
|
|
20
|
+
Type2["Date"] = "Date";
|
|
21
|
+
Type2["Object"] = "Object";
|
|
22
|
+
Type2["Array"] = "Array";
|
|
23
|
+
return Type2;
|
|
24
|
+
})(Type || {});
|
|
25
|
+
export { validate, z };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/validation",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.52.
|
|
4
|
+
"version": "0.52.1",
|
|
5
5
|
"packageManager": "pnpm@8.5.1",
|
|
6
6
|
"description": "The Stacks Validation methods.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"zod": "^3.21.4"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@stacksjs/development": "0.52.
|
|
46
|
-
"@stacksjs/path": "0.52.
|
|
45
|
+
"@stacksjs/development": "0.52.1",
|
|
46
|
+
"@stacksjs/path": "0.52.1"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "unbuild",
|