@rpcbase/db 0.35.0 → 0.37.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/README.md +30 -11
- package/dist/acl/index.js +11 -0
- package/dist/can-urGFf45M.js +131 -0
- package/dist/index.browser.d.ts +2 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.browser.js +114 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +319 -1130
- package/dist/models/{Tenant.d.ts → RBTenant.d.ts} +1 -1
- package/dist/models/RBTenant.d.ts.map +1 -0
- package/dist/models/{User.d.ts → RBUser.d.ts} +1 -1
- package/dist/models/RBUser.d.ts.map +1 -0
- package/dist/models/index.d.ts +2 -2
- package/dist/models/index.d.ts.map +1 -1
- package/dist/mongoose/extendMongooseSchema.d.ts +6 -0
- package/dist/mongoose/extendMongooseSchema.d.ts.map +1 -0
- package/dist/mongoose/index.d.ts +6 -0
- package/dist/mongoose/index.d.ts.map +1 -0
- package/dist/mongoose/localizedStringField.d.ts +4 -0
- package/dist/mongoose/localizedStringField.d.ts.map +1 -0
- package/dist/zod/extension.d.ts +17 -0
- package/dist/zod/extension.d.ts.map +1 -0
- package/dist/zod/index.d.ts +5 -0
- package/dist/zod/index.d.ts.map +1 -0
- package/dist/zod/localizedString.d.ts +14 -0
- package/dist/zod/localizedString.d.ts.map +1 -0
- package/package.json +5 -4
- package/dist/acl.d.ts +0 -2
- package/dist/acl.d.ts.map +0 -1
- package/dist/models/Tenant.d.ts.map +0 -1
- package/dist/models/User.d.ts.map +0 -1
- package/dist/schema/assertions/assertions.d.ts +0 -20
- package/dist/schema/assertions/assertions.d.ts.map +0 -1
- package/dist/schema/assertions/constructor.d.ts +0 -10
- package/dist/schema/assertions/constructor.d.ts.map +0 -1
- package/dist/schema/assertions/custom.d.ts +0 -6
- package/dist/schema/assertions/custom.d.ts.map +0 -1
- package/dist/schema/assertions/instanceOf.d.ts +0 -10
- package/dist/schema/assertions/instanceOf.d.ts.map +0 -1
- package/dist/schema/assertions/staticNames.d.ts +0 -10
- package/dist/schema/assertions/staticNames.d.ts.map +0 -1
- package/dist/schema/assertions/types.d.ts +0 -17
- package/dist/schema/assertions/types.d.ts.map +0 -1
- package/dist/schema/extension.d.ts +0 -78
- package/dist/schema/extension.d.ts.map +0 -1
- package/dist/schema/index.d.ts +0 -73
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/mongoose.types.d.ts +0 -93
- package/dist/schema/mongoose.types.d.ts.map +0 -1
- package/dist/setupFile.d.ts +0 -2
- package/dist/setupFile.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RBTenant.d.ts","sourceRoot":"","sources":["../../src/models/RBTenant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,SAAS;;;;iBAIpB,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,eAAO,MAAM,cAAc,EAAE,MAIA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RBUser.d.ts","sourceRoot":"","sources":["../../src/models/RBUser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,OAAO;;;;;;;;;iBASlB,CAAA;AAEF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAE9C,eAAO,MAAM,YAAY,EAAE,MASA,CAAA"}
|
package/dist/models/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Schema } from '../../../vite/node_modules/mongoose';
|
|
2
|
+
type MongooseSchemaExtension = Parameters<Schema["add"]>[0];
|
|
3
|
+
export declare function extendMongooseSchema<TSchema extends Schema>(baseSchema: TSchema, ...extensions: MongooseSchemaExtension[]): TSchema;
|
|
4
|
+
export declare function omitMongooseSchemaPaths<TSchema extends Schema>(schema: TSchema, paths: string[]): TSchema;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=extendMongooseSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extendMongooseSchema.d.ts","sourceRoot":"","sources":["../../src/mongoose/extendMongooseSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGjC,KAAK,uBAAuB,GAAG,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAE3D,wBAAgB,oBAAoB,CAAC,OAAO,SAAS,MAAM,EACzD,UAAU,EAAE,OAAO,EACnB,GAAG,UAAU,EAAE,uBAAuB,EAAE,GACvC,OAAO,CAMT;AAED,wBAAgB,uBAAuB,CAAC,OAAO,SAAS,MAAM,EAC5D,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,MAAM,EAAE,GACd,OAAO,CAIT"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as mongoose, InferSchemaType } from '../../../vite/node_modules/mongoose';
|
|
2
|
+
declare const Schema: typeof mongoose.Schema, model: typeof mongoose.model;
|
|
3
|
+
export { Schema, model, mongoose, type InferSchemaType };
|
|
4
|
+
export * from './extendMongooseSchema';
|
|
5
|
+
export * from './localizedStringField';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mongoose/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG/C,QAAA,MAAQ,MAAM,0BAAE,KAAK,uBAAa,CAAA;AAElC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,CAAA;AACxD,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SchemaTypeOptions } from '../../../vite/node_modules/mongoose';
|
|
2
|
+
import { LocalizedString } from '../zod/localizedString';
|
|
3
|
+
export declare function localizedStringField(options?: Omit<SchemaTypeOptions<LocalizedString>, "type" | "get">): SchemaTypeOptions<LocalizedString>;
|
|
4
|
+
//# sourceMappingURL=localizedStringField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localizedStringField.d.ts","sourceRoot":"","sources":["../../src/mongoose/localizedStringField.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAEjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAI7D,wBAAgB,oBAAoB,CAClC,OAAO,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,GACjE,iBAAiB,CAAC,eAAe,CAAC,CAQpC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from '../../../vite/node_modules/zod';
|
|
2
|
+
declare module '../../../vite/node_modules/zod' {
|
|
3
|
+
interface ZodString {
|
|
4
|
+
unique(arg?: boolean): this;
|
|
5
|
+
sparse(arg?: boolean): this;
|
|
6
|
+
}
|
|
7
|
+
interface ZodNumber {
|
|
8
|
+
unique(arg?: boolean): this;
|
|
9
|
+
sparse(arg?: boolean): this;
|
|
10
|
+
}
|
|
11
|
+
interface ZodDate {
|
|
12
|
+
unique(arg?: boolean): this;
|
|
13
|
+
sparse(arg?: boolean): this;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export declare function extendZod(zod: typeof z): void;
|
|
17
|
+
//# sourceMappingURL=extension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../src/zod/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,QAAQ,KAAK,CAAC;IACnB,UAAU,SAAS;QACjB,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;QAC3B,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;KAC5B;IAED,UAAU,SAAS;QACjB,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;QAC3B,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;KAC5B;IAED,UAAU,OAAO;QACf,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;QAC3B,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;KAC5B;CAEF;AAID,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,QAiBtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/zod/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAA;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGvC,cAAc,mBAAmB,CAAA;AAKjC,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from '../../../vite/node_modules/zod';
|
|
2
|
+
export type LanguageCode = string;
|
|
3
|
+
export type LocalizedString = Record<LanguageCode, string>;
|
|
4
|
+
export type I18nStringRecord = LocalizedString;
|
|
5
|
+
export type I18nString = LocalizedString;
|
|
6
|
+
export declare const LANGUAGE_CODE_REGEX: RegExp;
|
|
7
|
+
export declare function buildLocaleFallbackChain(locale: string, fallbacks?: string | string[]): string[];
|
|
8
|
+
export declare function resolveLocalizedString(value: LocalizedString | null | undefined, locale: string, options?: {
|
|
9
|
+
fallbacks?: string | string[];
|
|
10
|
+
}): string | undefined;
|
|
11
|
+
export declare function withLocalizedStringFallback<T extends object>(value: T): T;
|
|
12
|
+
export declare const zLocalizedString: () => z.ZodRecord<z.ZodString, z.ZodString>;
|
|
13
|
+
export declare const zI18nString: () => z.ZodRecord<z.ZodString, z.ZodString>;
|
|
14
|
+
//# sourceMappingURL=localizedString.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localizedString.d.ts","sourceRoot":"","sources":["../../src/zod/localizedString.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,MAAM,MAAM,YAAY,GAAG,MAAM,CAAA;AAEjC,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;AAE1D,MAAM,MAAM,gBAAgB,GAAG,eAAe,CAAA;AAE9C,MAAM,MAAM,UAAU,GAAG,eAAe,CAAA;AAExC,eAAO,MAAM,mBAAmB,QAAuC,CAAA;AAgBvE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CA6BhG;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,EACzC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE,GAC1C,MAAM,GAAG,SAAS,CAWpB;AAED,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CASzE;AAwBD,eAAO,MAAM,gBAAgB,6CAS5B,CAAA;AAED,eAAO,MAAM,WAAW,6CAAmB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/db",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -10,13 +10,14 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
|
+
"browser": "./dist/index.browser.js",
|
|
13
14
|
"import": "./dist/index.js",
|
|
14
15
|
"default": "./dist/index.js"
|
|
15
16
|
},
|
|
16
17
|
"./acl": {
|
|
17
|
-
"types": "./dist/index.d.ts",
|
|
18
|
-
"import": "./dist/index.js",
|
|
19
|
-
"default": "./dist/index.js"
|
|
18
|
+
"types": "./dist/acl/index.d.ts",
|
|
19
|
+
"import": "./dist/acl/index.js",
|
|
20
|
+
"default": "./dist/acl/index.js"
|
|
20
21
|
}
|
|
21
22
|
},
|
|
22
23
|
"scripts": {
|
package/dist/acl.d.ts
DELETED
package/dist/acl.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acl.d.ts","sourceRoot":"","sources":["../src/acl.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Tenant.d.ts","sourceRoot":"","sources":["../../src/models/Tenant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,SAAS;;;;iBAIpB,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,eAAO,MAAM,cAAc,EAAE,MAIA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../../src/models/User.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,OAAO;;;;;;;;;iBASlB,CAAA;AAEF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAE9C,eAAO,MAAM,YAAY,EAAE,MASA,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ZodType } from '../../../../vite/node_modules/zod';
|
|
2
|
-
declare const _default: {
|
|
3
|
-
objectId(f: ZodType<any>): f is ZodType<string>;
|
|
4
|
-
uuid(f: ZodType<any>): f is ZodType<string>;
|
|
5
|
-
string(f: ZodType<any>): f is import('../../../../vite/node_modules/zod').ZodString;
|
|
6
|
-
number(f: ZodType<any>): f is import('../../../../vite/node_modules/zod').ZodNumber;
|
|
7
|
-
object(f: ZodType<any>): f is import('../../../../vite/node_modules/zod').ZodObject<any>;
|
|
8
|
-
array(f: ZodType<any>): f is import('../../../../vite/node_modules/zod').ZodArray<any>;
|
|
9
|
-
boolean(f: ZodType<any>): f is import('../../../../vite/node_modules/zod').ZodBoolean;
|
|
10
|
-
enumerable(f: ZodType<any>): f is import('../../../../vite/node_modules/zod').ZodEnum<any>;
|
|
11
|
-
date(f: ZodType<any>): f is import('../../../../vite/node_modules/zod').ZodDate;
|
|
12
|
-
def(f: ZodType<any>): f is import('../../../../vite/node_modules/zod').ZodDefault<any>;
|
|
13
|
-
optional(f: ZodType<any>): f is import('../../../../vite/node_modules/zod').ZodOptional<any>;
|
|
14
|
-
nullable(f: ZodType<any>): f is import('../../../../vite/node_modules/zod').ZodNullable<any>;
|
|
15
|
-
union(f: ZodType<any>): f is import('../../../../vite/node_modules/zod').ZodUnion<any>;
|
|
16
|
-
any(f: ZodType<any>): f is import('../../../../vite/node_modules/zod').ZodAny;
|
|
17
|
-
mapOrRecord(f: ZodType<any>): f is import('../../../../vite/node_modules/zod').ZodMap<any> | import('../../../../vite/node_modules/zod').ZodRecord<any>;
|
|
18
|
-
};
|
|
19
|
-
export default _default;
|
|
20
|
-
//# sourceMappingURL=assertions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../../../src/schema/assertions/assertions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;;;;;;;;;;;;;;;;;;AAoBlC,wBAGC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IAsserts } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Constructor assertions (CommonJS)
|
|
4
|
-
* @internal
|
|
5
|
-
*
|
|
6
|
-
* Asserts if a Zod type is a specific type
|
|
7
|
-
* by checking the constructor name of it's prototype.
|
|
8
|
-
*/
|
|
9
|
-
export declare const zmAssert: IAsserts;
|
|
10
|
-
//# sourceMappingURL=constructor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constructor.d.ts","sourceRoot":"","sources":["../../../src/schema/assertions/constructor.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,EAAE,QAoDtB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../../src/schema/assertions/custom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAGlC,eAAO,MAAM,WAAW;gBACV,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC;YAIvC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC;CAG5C,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IAsserts } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Instance assertions (ESM)
|
|
4
|
-
* @internal
|
|
5
|
-
*
|
|
6
|
-
* Asserts if a Zod type is a specific type
|
|
7
|
-
* by checking the instance of it's prototype.
|
|
8
|
-
*/
|
|
9
|
-
export declare const zmAssert: IAsserts;
|
|
10
|
-
//# sourceMappingURL=instanceOf.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instanceOf.d.ts","sourceRoot":"","sources":["../../../src/schema/assertions/instanceOf.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,EAAE,QAoDtB,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IAsserts } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Static names assertions (Bundlers)
|
|
4
|
-
* @internal
|
|
5
|
-
*
|
|
6
|
-
* Asserts if a Zod type is a specific type
|
|
7
|
-
* by checking the `__zm_type` property of it's prototype.
|
|
8
|
-
*/
|
|
9
|
-
export declare const zmAssert: IAsserts;
|
|
10
|
-
//# sourceMappingURL=staticNames.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"staticNames.d.ts","sourceRoot":"","sources":["../../../src/schema/assertions/staticNames.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,EAAE,QAoDtB,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ZodAny, ZodArray, ZodBoolean, ZodDate, ZodDefault, ZodEnum, ZodMap, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodRecord, ZodString, ZodType, ZodUnion } from '../../../../vite/node_modules/zod';
|
|
2
|
-
export interface IAsserts {
|
|
3
|
-
string(f: ZodType<any>): f is ZodString;
|
|
4
|
-
number(f: ZodType<any>): f is ZodNumber;
|
|
5
|
-
object(f: ZodType<any>): f is ZodObject<any>;
|
|
6
|
-
array(f: ZodType<any>): f is ZodArray<any>;
|
|
7
|
-
boolean(f: ZodType<any>): f is ZodBoolean;
|
|
8
|
-
enumerable(f: ZodType<any>): f is ZodEnum<any>;
|
|
9
|
-
date(f: ZodType<any>): f is ZodDate;
|
|
10
|
-
def(f: ZodType<any>): f is ZodDefault<any>;
|
|
11
|
-
optional(f: ZodType<any>): f is ZodOptional<any>;
|
|
12
|
-
nullable(f: ZodType<any>): f is ZodNullable<any>;
|
|
13
|
-
union(f: ZodType<any>): f is ZodUnion<any>;
|
|
14
|
-
any(f: ZodType<any>): f is ZodAny;
|
|
15
|
-
mapOrRecord(f: ZodType<any>): f is ZodMap<any> | ZodRecord<any>;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
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AC,IAAI,WAAW,CAAC,GAAG,CAAC,CAAA;IAChD,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAA;IAC1C,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,MAAM,CAAA;IACjC,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,CAAA;CAChE"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { Types } from '../../../vite/node_modules/mongoose';
|
|
2
|
-
import { z } from '../../../vite/node_modules/zod';
|
|
3
|
-
declare module '../../../vite/node_modules/zod' {
|
|
4
|
-
interface ZodString {
|
|
5
|
-
unique: (arg?: boolean) => ZodString;
|
|
6
|
-
sparse: (arg?: boolean) => ZodString;
|
|
7
|
-
__zm_unique: boolean;
|
|
8
|
-
__zm_sparse: boolean;
|
|
9
|
-
}
|
|
10
|
-
interface ZodNumber {
|
|
11
|
-
unique: (arg?: boolean) => ZodNumber;
|
|
12
|
-
sparse: (arg?: boolean) => ZodNumber;
|
|
13
|
-
__zm_unique: boolean;
|
|
14
|
-
__zm_sparse: boolean;
|
|
15
|
-
}
|
|
16
|
-
interface ZodDate {
|
|
17
|
-
unique: (arg?: boolean) => ZodDate;
|
|
18
|
-
sparse: (arg?: boolean) => ZodDate;
|
|
19
|
-
__zm_unique: boolean;
|
|
20
|
-
__zm_sparse: boolean;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Extends the Zod library with additional functionality.
|
|
25
|
-
*
|
|
26
|
-
* This function modifies the Zod library to add custom validation and uniqueness checks.
|
|
27
|
-
* It ensures that the extension is only applied once.
|
|
28
|
-
*
|
|
29
|
-
* @param z_0 - The Zod library to extend.
|
|
30
|
-
*
|
|
31
|
-
* @remarks
|
|
32
|
-
* - Overrides `refine` method to `ZodType` that includes additional metadata for validation.
|
|
33
|
-
* - Overrides `unique` method to `ZodString`, `ZodNumber`, and `ZodDate` to mark them as unique.
|
|
34
|
-
* - Overrides `sparse` method to `ZodString`, `ZodNumber`, and `ZodDate` to mark them as sparse.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```typescript
|
|
38
|
-
* import { z } from "zod"
|
|
39
|
-
* import { extendZod } from "./extension"
|
|
40
|
-
*
|
|
41
|
-
* extendZod(z)
|
|
42
|
-
*
|
|
43
|
-
* const schema = z.object({
|
|
44
|
-
* name: z.string().unique()
|
|
45
|
-
* })
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
export declare function extendZod(z_0: typeof z): void;
|
|
49
|
-
export type TzmId = ReturnType<typeof createId> & {
|
|
50
|
-
unique: (arg?: boolean) => TzmId;
|
|
51
|
-
sparse: (arg?: boolean) => TzmId;
|
|
52
|
-
ref: (arg: string) => TzmId;
|
|
53
|
-
refPath: (arg: string) => TzmId;
|
|
54
|
-
};
|
|
55
|
-
declare const createId: () => z.ZodUnion<[z.ZodString, z.ZodCustom<Types.ObjectId, Types.ObjectId>]>;
|
|
56
|
-
export declare const zId: (ref?: string) => TzmId;
|
|
57
|
-
export type TzmUUID = ReturnType<typeof createUUID> & {
|
|
58
|
-
unique: (arg?: boolean) => TzmUUID;
|
|
59
|
-
sparse: (arg?: boolean) => TzmUUID;
|
|
60
|
-
ref: (arg: string) => TzmUUID;
|
|
61
|
-
refPath: (arg: string) => TzmUUID;
|
|
62
|
-
};
|
|
63
|
-
declare const createUUID: () => z.ZodUnion<[z.ZodUUID, z.ZodCustom<Types.UUID, Types.UUID>]>;
|
|
64
|
-
export declare const zUUID: (ref?: string) => TzmUUID;
|
|
65
|
-
export type LanguageCode = string;
|
|
66
|
-
export type LocalizedString = Record<LanguageCode, string>;
|
|
67
|
-
export type I18nStringRecord = LocalizedString;
|
|
68
|
-
export type I18nString = LocalizedString;
|
|
69
|
-
export declare const LANGUAGE_CODE_REGEX: RegExp;
|
|
70
|
-
export declare function buildLocaleFallbackChain(locale: string, fallbacks?: string | string[]): string[];
|
|
71
|
-
export declare function resolveLocalizedString(value: LocalizedString | null | undefined, locale: string, options?: {
|
|
72
|
-
fallbacks?: string | string[];
|
|
73
|
-
}): string | undefined;
|
|
74
|
-
export declare function withLocalizedStringFallback<T extends object>(value: T): T;
|
|
75
|
-
export declare const zLocalizedString: () => z.ZodRecord<z.ZodString, z.ZodString>;
|
|
76
|
-
export declare const zI18nString: () => z.ZodRecord<z.ZodString, z.ZodString>;
|
|
77
|
-
export {};
|
|
78
|
-
//# sourceMappingURL=extension.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../src/schema/extension.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAmB,MAAM,UAAU,CAAA;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,QAAQ,KAAK,CAAC;IACnB,UAAU,SAAS;QACjB,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,SAAS,CAAA;QACpC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,SAAS,CAAA;QACpC,WAAW,EAAE,OAAO,CAAA;QACpB,WAAW,EAAE,OAAO,CAAA;KACrB;IAED,UAAU,SAAS;QACjB,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,SAAS,CAAA;QACpC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,SAAS,CAAA;QACpC,WAAW,EAAE,OAAO,CAAA;QACpB,WAAW,EAAE,OAAO,CAAA;KACrB;IAED,UAAU,OAAO;QACf,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,OAAO,CAAA;QAClC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,OA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UAAU,GAAG,eAAe,CAAA;AAExC,eAAO,MAAM,mBAAmB,QAAuC,CAAA;AAgBvE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CA6BhG;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,EACzC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE,GAC1C,MAAM,GAAG,SAAS,CAWpB;AAED,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CASzE;AAwBD,eAAO,MAAM,gBAAgB,6CAU5B,CAAA;AAED,eAAO,MAAM,WAAW,6CAAmB,CAAA"}
|
package/dist/schema/index.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Schema, SchemaOptions } from '../../../vite/node_modules/mongoose';
|
|
2
|
-
import { ZodObject, ZodRawShape, z } from '../../../vite/node_modules/zod';
|
|
3
|
-
import type * as zm from "./mongoose.types";
|
|
4
|
-
export * from './extension';
|
|
5
|
-
export * from '../../../vite/node_modules/zod';
|
|
6
|
-
export { z };
|
|
7
|
-
/**
|
|
8
|
-
* Converts a Zod schema to a Mongoose schema
|
|
9
|
-
* @param schema zod schema to parse
|
|
10
|
-
* @returns mongoose schema
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* import { extendZod, zodSchema } from "@zodyac/zod-mongoose"
|
|
14
|
-
* import { model } from "mongoose"
|
|
15
|
-
* import { z } from "zod"
|
|
16
|
-
*
|
|
17
|
-
* extendZod(z)
|
|
18
|
-
*
|
|
19
|
-
* const zUser = z.object({
|
|
20
|
-
* name: z.string().min(3).max(255),
|
|
21
|
-
* age: z.number().min(18).max(100),
|
|
22
|
-
* active: z.boolean().default(false),
|
|
23
|
-
* access: z.enum(["admin", "user"]).default("user"),
|
|
24
|
-
* companyId: zId("Company"),
|
|
25
|
-
* address: z.object({
|
|
26
|
-
* street: z.string(),
|
|
27
|
-
* city: z.string(),
|
|
28
|
-
* state: z.enum(["CA", "NY", "TX"]),
|
|
29
|
-
* }),
|
|
30
|
-
* tags: z.array(z.string()),
|
|
31
|
-
* createdAt: z.date(),
|
|
32
|
-
* updatedAt: z.date(),
|
|
33
|
-
* })
|
|
34
|
-
*
|
|
35
|
-
* const schema = zodSchema(zDoc)
|
|
36
|
-
* const userModel = model("User", schema)
|
|
37
|
-
*/
|
|
38
|
-
export declare function zodSchema<T extends ZodRawShape>(schema: ZodObject<T>, options?: SchemaOptions<any>): Schema<z.infer<typeof schema>>;
|
|
39
|
-
/**
|
|
40
|
-
* Converts a Zod schema to a raw Mongoose schema object
|
|
41
|
-
* @param schema zod schema to parse
|
|
42
|
-
* @returns mongoose schema
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* import { extendZod, zodSchemaRaw } from "@zodyac/zod-mongoose"
|
|
46
|
-
* import { model, Schema } from "mongoose"
|
|
47
|
-
* import { z } from "zod"
|
|
48
|
-
*
|
|
49
|
-
* extendZod(z)
|
|
50
|
-
*
|
|
51
|
-
* const zUser = z.object({
|
|
52
|
-
* name: z.string().min(3).max(255),
|
|
53
|
-
* age: z.number().min(18).max(100),
|
|
54
|
-
* active: z.boolean().default(false),
|
|
55
|
-
* access: z.enum(["admin", "user"]).default("user"),
|
|
56
|
-
* companyId: zId("Company"),
|
|
57
|
-
* address: z.object({
|
|
58
|
-
* street: z.string(),
|
|
59
|
-
* city: z.string(),
|
|
60
|
-
* state: z.enum(["CA", "NY", "TX"]),
|
|
61
|
-
* }),
|
|
62
|
-
* tags: z.array(z.string()),
|
|
63
|
-
* createdAt: z.date(),
|
|
64
|
-
* updatedAt: z.date(),
|
|
65
|
-
* })
|
|
66
|
-
*
|
|
67
|
-
* const rawSchema = zodSchemaRaw(zDoc)
|
|
68
|
-
* const schema = new Schema(rawSchema)
|
|
69
|
-
* const userModel = model("User", schema)
|
|
70
|
-
*/
|
|
71
|
-
export declare function zodSchemaRaw<T extends ZodRawShape>(schema: ZodObject<T>): zm._Schema<T>;
|
|
72
|
-
export default zodSchema;
|
|
73
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAe,MAAM,UAAU,CAAA;AAClE,OAAO,EAEL,SAAS,EACT,WAAW,EAGX,CAAC,EACF,MAAM,KAAK,CAAA;AAIZ,OAAO,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAG3C,cAAc,aAAa,CAAA;AAC3B,cAAc,KAAK,CAAA;AAEnB,OAAO,EAAE,CAAC,EAAE,CAAA;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,WAAW,EAC7C,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EACpB,OAAO,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,GAC3B,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC,CAGhC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,WAAW,EAChD,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GACnB,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAEf;AAqbD,eAAe,SAAS,CAAA"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { SchemaDefinition, SchemaTypeOptions, SchemaTypes, Types } from '../../../vite/node_modules/mongoose';
|
|
2
|
-
import { ZodType, z } from '../../../vite/node_modules/zod';
|
|
3
|
-
export interface zID extends z.ZodUnion<[
|
|
4
|
-
z.ZodString,
|
|
5
|
-
z.ZodType<Types.ObjectId, Types.ObjectId>
|
|
6
|
-
]> {
|
|
7
|
-
__zm_type: "ObjectId";
|
|
8
|
-
__zm_ref?: string;
|
|
9
|
-
__zm_refPath?: string;
|
|
10
|
-
ref: (ref: string) => zID;
|
|
11
|
-
unique: (val?: boolean) => zID;
|
|
12
|
-
sparse: (val?: boolean) => zID;
|
|
13
|
-
refPath: (ref: string) => zID;
|
|
14
|
-
}
|
|
15
|
-
export interface zUUID extends z.ZodUnion<[
|
|
16
|
-
z.ZodString,
|
|
17
|
-
z.ZodType<Types.UUID, Types.UUID>
|
|
18
|
-
]> {
|
|
19
|
-
__zm_type: "UUID";
|
|
20
|
-
__zm_ref?: string;
|
|
21
|
-
__zm_refPath?: string;
|
|
22
|
-
unique: (val?: boolean) => zUUID;
|
|
23
|
-
sparse: (val?: boolean) => zUUID;
|
|
24
|
-
ref: (ref: string) => zUUID;
|
|
25
|
-
refPath: (ref: string) => zUUID;
|
|
26
|
-
}
|
|
27
|
-
export interface _Field<T> {
|
|
28
|
-
required: boolean;
|
|
29
|
-
default?: T;
|
|
30
|
-
validate?: {
|
|
31
|
-
validator: (v: T) => boolean;
|
|
32
|
-
message?: string;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export interface mString extends _Field<string> {
|
|
36
|
-
type: StringConstructor;
|
|
37
|
-
unique: boolean;
|
|
38
|
-
sparse: boolean;
|
|
39
|
-
enum?: string[];
|
|
40
|
-
match?: RegExp;
|
|
41
|
-
minLength?: number;
|
|
42
|
-
maxLength?: number;
|
|
43
|
-
}
|
|
44
|
-
export interface mNumber extends _Field<number> {
|
|
45
|
-
type: NumberConstructor;
|
|
46
|
-
unique: boolean;
|
|
47
|
-
sparse: boolean;
|
|
48
|
-
min?: number;
|
|
49
|
-
max?: number;
|
|
50
|
-
}
|
|
51
|
-
export interface mBoolean extends _Field<boolean> {
|
|
52
|
-
type: BooleanConstructor;
|
|
53
|
-
}
|
|
54
|
-
export interface mDate extends _Field<Date> {
|
|
55
|
-
type: DateConstructor;
|
|
56
|
-
unique: boolean;
|
|
57
|
-
sparse: boolean;
|
|
58
|
-
}
|
|
59
|
-
export interface mObjectId extends _Field<Types.ObjectId> {
|
|
60
|
-
type: typeof SchemaTypes.ObjectId;
|
|
61
|
-
unique?: boolean;
|
|
62
|
-
sparse?: boolean;
|
|
63
|
-
ref?: string;
|
|
64
|
-
refPath?: string;
|
|
65
|
-
}
|
|
66
|
-
export interface mUUID extends _Field<Types.UUID> {
|
|
67
|
-
type: typeof SchemaTypes.UUID;
|
|
68
|
-
unique?: boolean;
|
|
69
|
-
sparse?: boolean;
|
|
70
|
-
ref?: string;
|
|
71
|
-
refPath?: string;
|
|
72
|
-
}
|
|
73
|
-
export interface mArray<K> extends _Field<K[]> {
|
|
74
|
-
type: [_Field<K>];
|
|
75
|
-
}
|
|
76
|
-
export interface mMixed<T> extends _Field<T> {
|
|
77
|
-
type: typeof SchemaTypes.Mixed;
|
|
78
|
-
}
|
|
79
|
-
export type Constructor = StringConstructor | NumberConstructor | ObjectConstructor | DateConstructor | BooleanConstructor | BigIntConstructor | typeof SchemaTypes.ObjectId | typeof SchemaTypes.UUID;
|
|
80
|
-
export interface mMap<T, K> extends _Field<Map<T, K>> {
|
|
81
|
-
type: typeof Map;
|
|
82
|
-
of?: _Field<K>;
|
|
83
|
-
}
|
|
84
|
-
export type mField = mString | mNumber | mBoolean | mDate | mObjectId | mUUID | mMixed<unknown> | mArray<unknown> | _Schema<unknown> | mMap<unknown, unknown>;
|
|
85
|
-
export type _Schema<T> = SchemaDefinition & {
|
|
86
|
-
[K in keyof T]: (_Field<T[K]> & SchemaTypeOptions<T[K]>) | _Schema<T[K]>;
|
|
87
|
-
};
|
|
88
|
-
export type UnwrapZodType<T> = T extends ZodType<infer K> ? K : never;
|
|
89
|
-
export type EffectValidator<T> = {
|
|
90
|
-
validator: (v: T) => boolean;
|
|
91
|
-
message?: string;
|
|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CAAC,OAAO,CAAC,GACf,MAAM,CAAC,OAAO,CAAC,GACf,OAAO,CAAC,OAAO,CAAC,GAChB,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AAE1B,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,gBAAgB,GAAG;KACzC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACzE,CAAA;AAED,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAErE,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI;IAC/B,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA"}
|
package/dist/setupFile.d.ts
DELETED
package/dist/setupFile.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setupFile.d.ts","sourceRoot":"","sources":["../src/setupFile.ts"],"names":[],"mappings":""}
|