@kanian77/pastry-shared 0.0.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/bun.lock +38 -0
- package/dist/functions/getEnvFile.d.ts +3 -0
- package/dist/functions/getEnvFile.d.ts.map +1 -0
- package/dist/functions/getEnvFile.js +19 -0
- package/dist/functions/getEnvFile.js.map +1 -0
- package/dist/functions/index.d.ts +3 -0
- package/dist/functions/index.d.ts.map +1 -0
- package/dist/functions/index.js +3 -0
- package/dist/functions/index.js.map +1 -0
- package/dist/functions/isNotNullNorUndefined.d.ts +2 -0
- package/dist/functions/isNotNullNorUndefined.d.ts.map +1 -0
- package/dist/functions/isNotNullNorUndefined.js +4 -0
- package/dist/functions/isNotNullNorUndefined.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/types/ContentStatusEnum.d.ts +8 -0
- package/dist/types/ContentStatusEnum.d.ts.map +1 -0
- package/dist/types/ContentStatusEnum.js +9 -0
- package/dist/types/ContentStatusEnum.js.map +1 -0
- package/dist/types/EnvFileNames.d.ts +8 -0
- package/dist/types/EnvFileNames.d.ts.map +1 -0
- package/dist/types/EnvFileNames.js +9 -0
- package/dist/types/EnvFileNames.js.map +1 -0
- package/dist/types/Envs.d.ts +8 -0
- package/dist/types/Envs.d.ts.map +1 -0
- package/dist/types/Envs.js +9 -0
- package/dist/types/Envs.js.map +1 -0
- package/dist/types/FindAllBySchemaIdOptions.d.ts +8 -0
- package/dist/types/FindAllBySchemaIdOptions.d.ts.map +1 -0
- package/dist/types/FindAllBySchemaIdOptions.js +2 -0
- package/dist/types/FindAllBySchemaIdOptions.js.map +1 -0
- package/dist/types/FindAllBySchemaIdsOptions.d.ts +8 -0
- package/dist/types/FindAllBySchemaIdsOptions.d.ts.map +1 -0
- package/dist/types/FindAllBySchemaIdsOptions.js +2 -0
- package/dist/types/FindAllBySchemaIdsOptions.js.map +1 -0
- package/dist/types/FindAllOptions.d.ts +11 -0
- package/dist/types/FindAllOptions.d.ts.map +1 -0
- package/dist/types/FindAllOptions.js +2 -0
- package/dist/types/FindAllOptions.js.map +1 -0
- package/dist/types/FindByDerivedSchemaFromSlugOptions.d.ts +8 -0
- package/dist/types/FindByDerivedSchemaFromSlugOptions.d.ts.map +1 -0
- package/dist/types/FindByDerivedSchemaFromSlugOptions.js +2 -0
- package/dist/types/FindByDerivedSchemaFromSlugOptions.js.map +1 -0
- package/dist/types/PAGINATION_DEFAULTS.d.ts +9 -0
- package/dist/types/PAGINATION_DEFAULTS.d.ts.map +1 -0
- package/dist/types/PAGINATION_DEFAULTS.js +9 -0
- package/dist/types/PAGINATION_DEFAULTS.js.map +1 -0
- package/dist/types/PaginatedResult.d.ts +9 -0
- package/dist/types/PaginatedResult.d.ts.map +1 -0
- package/dist/types/PaginatedResult.js +2 -0
- package/dist/types/PaginatedResult.js.map +1 -0
- package/dist/types/PaginationMeta.d.ts +12 -0
- package/dist/types/PaginationMeta.d.ts.map +1 -0
- package/dist/types/PaginationMeta.js +2 -0
- package/dist/types/PaginationMeta.js.map +1 -0
- package/dist/types/PaginationParams.d.ts +8 -0
- package/dist/types/PaginationParams.d.ts.map +1 -0
- package/dist/types/PaginationParams.js +2 -0
- package/dist/types/PaginationParams.js.map +1 -0
- package/dist/types/PermissionsEnum.d.ts +11 -0
- package/dist/types/PermissionsEnum.d.ts.map +1 -0
- package/dist/types/PermissionsEnum.js +12 -0
- package/dist/types/PermissionsEnum.js.map +1 -0
- package/dist/types/PhoneNumberTypes.d.ts +8 -0
- package/dist/types/PhoneNumberTypes.d.ts.map +1 -0
- package/dist/types/PhoneNumberTypes.js +10 -0
- package/dist/types/PhoneNumberTypes.js.map +1 -0
- package/dist/types/RelationTypeEnum.d.ts +5 -0
- package/dist/types/RelationTypeEnum.d.ts.map +1 -0
- package/dist/types/RelationTypeEnum.js +6 -0
- package/dist/types/RelationTypeEnum.js.map +1 -0
- package/dist/types/SortConfig.d.ts +8 -0
- package/dist/types/SortConfig.d.ts.map +1 -0
- package/dist/types/SortConfig.js +2 -0
- package/dist/types/SortConfig.js.map +1 -0
- package/dist/types/TokenPayloadInterface.d.ts +13 -0
- package/dist/types/TokenPayloadInterface.d.ts.map +1 -0
- package/dist/types/TokenPayloadInterface.js +2 -0
- package/dist/types/TokenPayloadInterface.js.map +1 -0
- package/dist/types/UserRoleEnum.d.ts +8 -0
- package/dist/types/UserRoleEnum.d.ts.map +1 -0
- package/dist/types/UserRoleEnum.js +9 -0
- package/dist/types/UserRoleEnum.js.map +1 -0
- package/dist/types/UserTypeEnum.d.ts +5 -0
- package/dist/types/UserTypeEnum.d.ts.map +1 -0
- package/dist/types/UserTypeEnum.js +6 -0
- package/dist/types/UserTypeEnum.js.map +1 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.js.map +1 -0
- package/dist/zod-schemas/baseZodContentRelationSchema.d.ts +23 -0
- package/dist/zod-schemas/baseZodContentRelationSchema.d.ts.map +1 -0
- package/dist/zod-schemas/baseZodContentRelationSchema.js +13 -0
- package/dist/zod-schemas/baseZodContentRelationSchema.js.map +1 -0
- package/dist/zod-schemas/baseZodContentSchema.d.ts +33 -0
- package/dist/zod-schemas/baseZodContentSchema.d.ts.map +1 -0
- package/dist/zod-schemas/baseZodContentSchema.js +21 -0
- package/dist/zod-schemas/baseZodContentSchema.js.map +1 -0
- package/dist/zod-schemas/baseZodEntitySchema.d.ts +12 -0
- package/dist/zod-schemas/baseZodEntitySchema.d.ts.map +1 -0
- package/dist/zod-schemas/baseZodEntitySchema.js +11 -0
- package/dist/zod-schemas/baseZodEntitySchema.js.map +1 -0
- package/dist/zod-schemas/baseZodPermissionSchema.d.ts +14 -0
- package/dist/zod-schemas/baseZodPermissionSchema.d.ts.map +1 -0
- package/dist/zod-schemas/baseZodPermissionSchema.js +8 -0
- package/dist/zod-schemas/baseZodPermissionSchema.js.map +1 -0
- package/dist/zod-schemas/baseZodSchemaSchema.d.ts +285 -0
- package/dist/zod-schemas/baseZodSchemaSchema.d.ts.map +1 -0
- package/dist/zod-schemas/baseZodSchemaSchema.js +120 -0
- package/dist/zod-schemas/baseZodSchemaSchema.js.map +1 -0
- package/dist/zod-schemas/baseZodUserRoleSchema.d.ts +17 -0
- package/dist/zod-schemas/baseZodUserRoleSchema.d.ts.map +1 -0
- package/dist/zod-schemas/baseZodUserRoleSchema.js +10 -0
- package/dist/zod-schemas/baseZodUserRoleSchema.js.map +1 -0
- package/dist/zod-schemas/baseZodUserSchema.d.ts +24 -0
- package/dist/zod-schemas/baseZodUserSchema.d.ts.map +1 -0
- package/dist/zod-schemas/baseZodUserSchema.js +14 -0
- package/dist/zod-schemas/baseZodUserSchema.js.map +1 -0
- package/dist/zod-schemas/index.d.ts +9 -0
- package/dist/zod-schemas/index.d.ts.map +1 -0
- package/dist/zod-schemas/index.js +9 -0
- package/dist/zod-schemas/index.js.map +1 -0
- package/dist/zod-schemas/phoneNumberSchema.d.ts +9 -0
- package/dist/zod-schemas/phoneNumberSchema.d.ts.map +1 -0
- package/dist/zod-schemas/phoneNumberSchema.js +8 -0
- package/dist/zod-schemas/phoneNumberSchema.js.map +1 -0
- package/package.json +45 -0
- package/src/functions/getEnvFile.ts +19 -0
- package/src/functions/index.ts +2 -0
- package/src/functions/isNotNullNorUndefined.ts +5 -0
- package/src/index.ts +3 -0
- package/src/types/ContentStatusEnum.ts +7 -0
- package/src/types/EnvFileNames.ts +7 -0
- package/src/types/Envs.ts +7 -0
- package/src/types/FindAllBySchemaIdOptions.ts +10 -0
- package/src/types/FindAllBySchemaIdsOptions.ts +10 -0
- package/src/types/FindAllOptions.ts +11 -0
- package/src/types/FindByDerivedSchemaFromSlugOptions.ts +10 -0
- package/src/types/PAGINATION_DEFAULTS.ts +8 -0
- package/src/types/PaginatedResult.ts +9 -0
- package/src/types/PaginationMeta.ts +11 -0
- package/src/types/PaginationParams.ts +7 -0
- package/src/types/PermissionsEnum.ts +10 -0
- package/src/types/PhoneNumberTypes.ts +8 -0
- package/src/types/RelationTypeEnum.ts +4 -0
- package/src/types/SortConfig.ts +7 -0
- package/src/types/TokenPayloadInterface.ts +12 -0
- package/src/types/UserRoleEnum.ts +7 -0
- package/src/types/UserTypeEnum.ts +4 -0
- package/src/types/index.ts +17 -0
- package/src/zod-schemas/baseZodContentRelationSchema.ts +15 -0
- package/src/zod-schemas/baseZodContentSchema.ts +25 -0
- package/src/zod-schemas/baseZodEntitySchema.ts +13 -0
- package/src/zod-schemas/baseZodPermissionSchema.ts +8 -0
- package/src/zod-schemas/baseZodSchemaSchema.ts +142 -0
- package/src/zod-schemas/baseZodUserRoleSchema.ts +12 -0
- package/src/zod-schemas/baseZodUserSchema.ts +16 -0
- package/src/zod-schemas/index.ts +8 -0
- package/src/zod-schemas/phoneNumberSchema.ts +10 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { UserRoleEnum } from '../types';
|
|
3
|
+
export declare const baseZodUserRoleSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodUUID;
|
|
5
|
+
createdAt: z.ZodDate;
|
|
6
|
+
updatedAt: z.ZodOptional<z.ZodDate>;
|
|
7
|
+
createdBy: z.ZodOptional<z.ZodUUID>;
|
|
8
|
+
updatedBy: z.ZodOptional<z.ZodUUID>;
|
|
9
|
+
deleted: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
+
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
13
|
+
description: z.ZodOptional<z.ZodString>;
|
|
14
|
+
type: z.ZodEnum<typeof UserRoleEnum>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type UserRoleInterface = z.infer<typeof baseZodUserRoleSchema>;
|
|
17
|
+
//# sourceMappingURL=baseZodUserRoleSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseZodUserRoleSchema.d.ts","sourceRoot":"","sources":["../../src/zod-schemas/baseZodUserRoleSchema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,eAAO,MAAM,qBAAqB;;;;;;;;;;;;iBAKhC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { baseZodEntitySchema } from './baseZodEntitySchema';
|
|
3
|
+
import { UserRoleEnum } from '../types';
|
|
4
|
+
export const baseZodUserRoleSchema = baseZodEntitySchema.extend({
|
|
5
|
+
name: z.string().min(1).max(255),
|
|
6
|
+
slug: z.string().max(255).optional(),
|
|
7
|
+
description: z.string().optional(),
|
|
8
|
+
type: z.enum(UserRoleEnum),
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=baseZodUserRoleSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseZodUserRoleSchema.js","sourceRoot":"","sources":["../../src/zod-schemas/baseZodUserRoleSchema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CAAC,MAAM,CAAC;IAC9D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACpC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC;CAC3B,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UserTypeEnum } from '../types';
|
|
3
|
+
export declare const baseZodUserSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodUUID;
|
|
5
|
+
createdAt: z.ZodDate;
|
|
6
|
+
updatedAt: z.ZodOptional<z.ZodDate>;
|
|
7
|
+
createdBy: z.ZodOptional<z.ZodUUID>;
|
|
8
|
+
updatedBy: z.ZodOptional<z.ZodUUID>;
|
|
9
|
+
deleted: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
+
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
11
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
12
|
+
password: z.ZodOptional<z.ZodString>;
|
|
13
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
14
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
15
|
+
roleId: z.ZodUUID;
|
|
16
|
+
phoneNumber: z.ZodOptional<z.ZodObject<{
|
|
17
|
+
countryCode: z.ZodString;
|
|
18
|
+
number: z.ZodString;
|
|
19
|
+
type: z.ZodEnum<typeof import("../types/PhoneNumberTypes").PhoneNumberTypes>;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
userType: z.ZodEnum<typeof UserTypeEnum>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export type UserInterface = z.infer<typeof baseZodUserSchema>;
|
|
24
|
+
//# sourceMappingURL=baseZodUserSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseZodUserSchema.d.ts","sourceRoot":"","sources":["../../src/zod-schemas/baseZodUserSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;iBAQ5B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { baseZodEntitySchema } from './baseZodEntitySchema';
|
|
3
|
+
import { UserTypeEnum } from '../types';
|
|
4
|
+
import { phoneNumberSchema } from './phoneNumberSchema';
|
|
5
|
+
export const baseZodUserSchema = baseZodEntitySchema.extend({
|
|
6
|
+
email: z.email().optional(),
|
|
7
|
+
password: z.string().optional(),
|
|
8
|
+
firstName: z.string().max(255).optional(),
|
|
9
|
+
lastName: z.string().max(255).optional(),
|
|
10
|
+
roleId: z.uuid(),
|
|
11
|
+
phoneNumber: phoneNumberSchema.optional(),
|
|
12
|
+
userType: z.enum(UserTypeEnum),
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=baseZodUserSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseZodUserSchema.js","sourceRoot":"","sources":["../../src/zod-schemas/baseZodUserSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,MAAM,CAAC;IAC1D,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACzC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACxC,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE;IAChB,WAAW,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IACzC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC;CAC/B,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './baseZodSchemaSchema';
|
|
2
|
+
export * from './baseZodEntitySchema';
|
|
3
|
+
export * from './baseZodContentSchema';
|
|
4
|
+
export * from './baseZodContentRelationSchema';
|
|
5
|
+
export * from './baseZodUserRoleSchema';
|
|
6
|
+
export * from './baseZodUserSchema';
|
|
7
|
+
export * from './baseZodPermissionSchema';
|
|
8
|
+
export * from './phoneNumberSchema';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/zod-schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './baseZodSchemaSchema';
|
|
2
|
+
export * from './baseZodEntitySchema';
|
|
3
|
+
export * from './baseZodContentSchema';
|
|
4
|
+
export * from './baseZodContentRelationSchema';
|
|
5
|
+
export * from './baseZodUserRoleSchema';
|
|
6
|
+
export * from './baseZodUserSchema';
|
|
7
|
+
export * from './baseZodPermissionSchema';
|
|
8
|
+
export * from './phoneNumberSchema';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/zod-schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PhoneNumberTypes } from '../types/PhoneNumberTypes';
|
|
3
|
+
export declare const phoneNumberSchema: z.ZodObject<{
|
|
4
|
+
countryCode: z.ZodString;
|
|
5
|
+
number: z.ZodString;
|
|
6
|
+
type: z.ZodEnum<typeof PhoneNumberTypes>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export type PhoneNumberInterface = z.infer<typeof phoneNumberSchema>;
|
|
9
|
+
//# sourceMappingURL=phoneNumberSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phoneNumberSchema.d.ts","sourceRoot":"","sources":["../../src/zod-schemas/phoneNumberSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,eAAO,MAAM,iBAAiB;;;;iBAI5B,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PhoneNumberTypes } from '../types/PhoneNumberTypes';
|
|
3
|
+
export const phoneNumberSchema = z.object({
|
|
4
|
+
countryCode: z.string(),
|
|
5
|
+
number: z.string(),
|
|
6
|
+
type: z.enum(PhoneNumberTypes),
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=phoneNumberSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phoneNumberSchema.js","sourceRoot":"","sources":["../../src/zod-schemas/phoneNumberSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC;CAC/B,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kanian77/pastry-shared",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "shared constructs for @kanian77/pastry",
|
|
5
|
+
"author": "Patrick Assoa Adou <kanian77@gmail.com>",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"utilities",
|
|
8
|
+
"types",
|
|
9
|
+
"shared"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"packageManager": "bun@1.2.4",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"require": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./dist/*": {
|
|
23
|
+
"import": "./dist/*.js",
|
|
24
|
+
"require": "./dist/*.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc --build --verbose",
|
|
29
|
+
"dev": "tsc --build --verbose --watch",
|
|
30
|
+
"clean": "rm -rf dist && rm -rf tsconfig.tsbuildinfo",
|
|
31
|
+
"prepare": "bun run clean && bun run build",
|
|
32
|
+
"release": "bun run prepare && npm publish --userconfig .npmrc --access public"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"typescript": "~5.7.2",
|
|
36
|
+
"zod": "^4.1.12"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@types/bun": "^1.2.4",
|
|
40
|
+
"jose": "^6.1.3"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"zod": "^4.1.12"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EnvFileNames } from '../types/EnvFileNames';
|
|
2
|
+
import { Envs } from '../types/Envs';
|
|
3
|
+
|
|
4
|
+
export const getEnvFile = () => {
|
|
5
|
+
switch (process.env.ENV) {
|
|
6
|
+
case Envs.DEVELOPMENT:
|
|
7
|
+
return EnvFileNames.DEVELOPMENT;
|
|
8
|
+
case Envs.TESTING:
|
|
9
|
+
return EnvFileNames.TESTING;
|
|
10
|
+
case Envs.PRODUCTION:
|
|
11
|
+
return EnvFileNames.PRODUCTION;
|
|
12
|
+
case Envs.DEBUGGING:
|
|
13
|
+
return EnvFileNames.DEBUGGING;
|
|
14
|
+
case Envs.STAGING:
|
|
15
|
+
return EnvFileNames.STAGING;
|
|
16
|
+
default:
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PaginationParams } from './PaginationParams';
|
|
2
|
+
import { SortConfig } from './SortConfig';
|
|
3
|
+
import { FindAllOptions } from './FindAllOptions';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Repository options for findAll
|
|
7
|
+
*/
|
|
8
|
+
export interface FindAllBySchemaIdOptions extends FindAllOptions {
|
|
9
|
+
schemaId: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PaginationParams } from './PaginationParams';
|
|
2
|
+
import { SortConfig } from './SortConfig';
|
|
3
|
+
import { FindAllOptions } from './FindAllOptions';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Repository options for findAll
|
|
7
|
+
*/
|
|
8
|
+
export interface FindAllBySchemaIdsOptions extends FindAllOptions {
|
|
9
|
+
schemaIds: string[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PaginationParams } from "./PaginationParams";
|
|
2
|
+
import { SortConfig } from "./SortConfig";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Repository options for findAll
|
|
6
|
+
*/
|
|
7
|
+
export interface FindAllOptions {
|
|
8
|
+
withDeleted?: boolean;
|
|
9
|
+
pagination?: PaginationParams;
|
|
10
|
+
sort?: SortConfig;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PaginationParams } from './PaginationParams';
|
|
2
|
+
import { SortConfig } from './SortConfig';
|
|
3
|
+
import { FindAllOptions } from './FindAllOptions';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Repository options for findByDerivedSchemaFromSlug
|
|
7
|
+
*/
|
|
8
|
+
export interface FindByDerivedSchemaFromSlugOptions extends FindAllOptions {
|
|
9
|
+
slug: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export enum PermissionsEnum {
|
|
2
|
+
CONTENT_CREATE = 'CONTENT_CREATE',
|
|
3
|
+
CONTENT_READ = 'CONTENT_READ',
|
|
4
|
+
CONTENT_UPDATE = 'CONTENT_UPDATE',
|
|
5
|
+
CONTENT_DELETE = 'CONTENT_DELETE',
|
|
6
|
+
SCHEMA_CREATE = 'SCHEMA_CREATE',
|
|
7
|
+
SCHEMA_READ = 'SCHEMA_READ',
|
|
8
|
+
SCHEMA_UPDATE = 'SCHEMA_UPDATE',
|
|
9
|
+
SCHEMA_DELETE = 'SCHEMA_DELETE',
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UserRoleInterface } from '../zod-schemas';
|
|
2
|
+
import { PhoneNumberInterface } from '../zod-schemas/phoneNumberSchema';
|
|
3
|
+
export interface TokenPayloadInterface {
|
|
4
|
+
userId: string;
|
|
5
|
+
firstName: string;
|
|
6
|
+
lastName: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
role: Pick<UserRoleInterface, 'id' | 'slug' | 'name' | 'description'>;
|
|
9
|
+
phoneNumber?: PhoneNumberInterface;
|
|
10
|
+
exp: number;
|
|
11
|
+
iat: number;
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './EnvFileNames';
|
|
2
|
+
export * from './Envs';
|
|
3
|
+
export * from './ContentStatusEnum';
|
|
4
|
+
export * from './RelationTypeEnum';
|
|
5
|
+
export * from './UserRoleEnum';
|
|
6
|
+
export * from './PermissionsEnum';
|
|
7
|
+
export * from './TokenPayloadInterface';
|
|
8
|
+
export * from './UserTypeEnum';
|
|
9
|
+
export * from './PAGINATION_DEFAULTS';
|
|
10
|
+
export * from './PaginationParams';
|
|
11
|
+
export * from './PaginatedResult';
|
|
12
|
+
export * from './PaginationMeta';
|
|
13
|
+
export * from './FindAllOptions';
|
|
14
|
+
export * from './SortConfig';
|
|
15
|
+
export * from './FindAllBySchemaIdOptions';
|
|
16
|
+
export * from './FindByDerivedSchemaFromSlugOptions';
|
|
17
|
+
export * from './FindAllBySchemaIdsOptions';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { baseZodEntitySchema } from "./baseZodEntitySchema";
|
|
3
|
+
|
|
4
|
+
export const relationTypeZodEnum = z.enum([
|
|
5
|
+
'one',
|
|
6
|
+
'many'
|
|
7
|
+
])
|
|
8
|
+
export const baseZodContentRelationSchema = baseZodEntitySchema.extend({
|
|
9
|
+
sourceContentId: z.uuid(),
|
|
10
|
+
targetContentId: z.uuid(),
|
|
11
|
+
relationType: relationTypeZodEnum.default('one'),
|
|
12
|
+
sourceFieldSlug: z.string().optional(),
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export type ContentRelationInterface = z.infer<typeof baseZodContentRelationSchema>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { baseZodEntitySchema } from './baseZodEntitySchema';
|
|
3
|
+
|
|
4
|
+
// Enum for content status
|
|
5
|
+
export const ContentStatusZodEnum = z.enum([
|
|
6
|
+
'draft',
|
|
7
|
+
'published',
|
|
8
|
+
'archived',
|
|
9
|
+
'review',
|
|
10
|
+
'deleted',
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
export const baseZodContentSchema = baseZodEntitySchema.extend({
|
|
14
|
+
name: z.string().min(1).max(255),
|
|
15
|
+
schemaId: z.uuid(),
|
|
16
|
+
definition: z.any(), // Could be refined if you have a known structure
|
|
17
|
+
indexes: z.any().optional(),
|
|
18
|
+
status: ContentStatusZodEnum.default('draft'),
|
|
19
|
+
slug: z.string().max(255).optional(),
|
|
20
|
+
metadata: z.any().optional(),
|
|
21
|
+
userId: z.uuid(),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export type ContentInterface = z.infer<typeof baseZodContentSchema>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
|
|
3
|
+
export const baseZodEntitySchema = z.object({
|
|
4
|
+
id: z.uuid(),
|
|
5
|
+
createdAt: z.date(),
|
|
6
|
+
updatedAt: z.date().optional(),
|
|
7
|
+
createdBy: z.uuid().optional(),
|
|
8
|
+
updatedBy: z.uuid().optional(),
|
|
9
|
+
deleted: z.boolean().default(false),
|
|
10
|
+
deletedAt: z.date().nullable().optional(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type BaseEntityInterface = z.infer<typeof baseZodEntitySchema>;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { baseZodEntitySchema } from './baseZodEntitySchema';
|
|
3
|
+
import { RelationTypeEnum } from '../types';
|
|
4
|
+
|
|
5
|
+
// Allowed field types
|
|
6
|
+
export const FieldTypeEnum = z.enum([
|
|
7
|
+
'text',
|
|
8
|
+
'richText',
|
|
9
|
+
'number',
|
|
10
|
+
'boolean',
|
|
11
|
+
'dateTime',
|
|
12
|
+
'json',
|
|
13
|
+
'relation',
|
|
14
|
+
'media',
|
|
15
|
+
'select',
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
// Base properties shared by all fields
|
|
19
|
+
export const BaseFieldSchema = z.object({
|
|
20
|
+
slug: z
|
|
21
|
+
.string()
|
|
22
|
+
.min(3)
|
|
23
|
+
.regex(
|
|
24
|
+
/^[a-zA-Z0-9_]+$/,
|
|
25
|
+
'API slugs can only contain letters, numbers, and underscores'
|
|
26
|
+
),
|
|
27
|
+
label: z.string().min(1),
|
|
28
|
+
description: z.string().optional(),
|
|
29
|
+
required: z.boolean().default(false),
|
|
30
|
+
readOnly: z.boolean().default(false),
|
|
31
|
+
definition: z.object().optional(),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Schema for a simple text field
|
|
35
|
+
const TextFieldSchema = BaseFieldSchema.extend({
|
|
36
|
+
type: z.literal(FieldTypeEnum.enum.text),
|
|
37
|
+
minLength: z.number().int().min(0).optional(),
|
|
38
|
+
maxLength: z.number().int().min(1).optional(),
|
|
39
|
+
/** * A hint for the admin UI on how to render this field.
|
|
40
|
+
*/
|
|
41
|
+
format: z
|
|
42
|
+
.enum(['singleLine', 'multiLine', 'email', 'url', 'slug'])
|
|
43
|
+
.default('singleLine'),
|
|
44
|
+
defaultValue: z.string().optional(),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Schema for a rich text (Markdown/WYSIWYG) field
|
|
48
|
+
const RichTextFieldSchema = BaseFieldSchema.extend({
|
|
49
|
+
type: z.literal(FieldTypeEnum.enum.richText),
|
|
50
|
+
editorType: z.enum(['markdown', 'wysiwyg']).default('markdown'),
|
|
51
|
+
defaultValue: z.string().optional(),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Schema for a number field
|
|
55
|
+
const NumberFieldSchema = BaseFieldSchema.extend({
|
|
56
|
+
type: z.literal(FieldTypeEnum.enum.number),
|
|
57
|
+
format: z.enum(['integer', 'decimal']).default('decimal'),
|
|
58
|
+
min: z.number().optional(),
|
|
59
|
+
max: z.number().optional(),
|
|
60
|
+
defaultValue: z.number().optional(),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Schema for a boolean (toggle/checkbox) field
|
|
64
|
+
const BooleanFieldSchema = BaseFieldSchema.extend({
|
|
65
|
+
type: z.literal(FieldTypeEnum.enum.boolean),
|
|
66
|
+
display: z.enum(['toggle', 'checkbox']).default('toggle'),
|
|
67
|
+
defaultValue: z.boolean().optional(),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Schema for a date/time field
|
|
71
|
+
const DateTimeFieldSchema = BaseFieldSchema.extend({
|
|
72
|
+
type: z.literal(FieldTypeEnum.enum.dateTime),
|
|
73
|
+
format: z.enum(['date', 'dateTime', 'time']).default('dateTime'),
|
|
74
|
+
defaultValue: z.date().or(z.string().datetime()).optional(),
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Schema for a "select" (enum) field
|
|
78
|
+
const SelectOptionSchema = z.object({
|
|
79
|
+
label: z.string(),
|
|
80
|
+
value: z.string(),
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const SelectFieldSchema = BaseFieldSchema.extend({
|
|
84
|
+
type: z.literal(FieldTypeEnum.enum.select),
|
|
85
|
+
options: z.array(SelectOptionSchema).min(1, 'Must have at least one option'),
|
|
86
|
+
allowMultiple: z.boolean().default(false),
|
|
87
|
+
defaultValue: z.string().or(z.array(z.string())).optional(),
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Schema for a relation (e.g., link to a 'User' or 'Category')
|
|
91
|
+
const RelationFieldSchema = BaseFieldSchema.extend({
|
|
92
|
+
type: z.literal(FieldTypeEnum.enum.relation),
|
|
93
|
+
/**
|
|
94
|
+
* The apiId of the collection this field relates to.
|
|
95
|
+
*/
|
|
96
|
+
targetCollectionId: z.string(),
|
|
97
|
+
relationType: z.enum(RelationTypeEnum),
|
|
98
|
+
display: z.enum(['select', 'autocomplete']).default('select'),
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// Schema for a file/media upload field
|
|
102
|
+
const MediaFieldSchema = BaseFieldSchema.extend({
|
|
103
|
+
type: z.literal(FieldTypeEnum.enum.media),
|
|
104
|
+
allowMultiple: z.boolean().default(false),
|
|
105
|
+
allowedMimeTypes: z.array(z.string()).optional(), // e.g., ['image/jpeg', 'application/pdf']
|
|
106
|
+
maxSizeInBytes: z.number().int().min(1).optional(),
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// Schema for a raw JSON editor field
|
|
110
|
+
const JsonFieldSchema = BaseFieldSchema.extend({
|
|
111
|
+
type: z.literal(FieldTypeEnum.enum.json),
|
|
112
|
+
defaultValue: z.record(z.string(), z.any()).optional(),
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
export const FieldSchema = z.discriminatedUnion('type', [
|
|
116
|
+
TextFieldSchema,
|
|
117
|
+
RichTextFieldSchema,
|
|
118
|
+
NumberFieldSchema,
|
|
119
|
+
BooleanFieldSchema,
|
|
120
|
+
DateTimeFieldSchema,
|
|
121
|
+
SelectFieldSchema,
|
|
122
|
+
RelationFieldSchema,
|
|
123
|
+
MediaFieldSchema,
|
|
124
|
+
JsonFieldSchema,
|
|
125
|
+
]);
|
|
126
|
+
|
|
127
|
+
export type FieldDefinition = z.infer<typeof FieldSchema>;
|
|
128
|
+
|
|
129
|
+
// Base schema definition
|
|
130
|
+
export const baseZodSchemaSchema = baseZodEntitySchema.extend({
|
|
131
|
+
name: z.string().min(1),
|
|
132
|
+
slug: z.string().regex(/^[a-z0-9_\-]+$/), // unique identifier
|
|
133
|
+
description: z.string().optional(),
|
|
134
|
+
fields: z.array(FieldSchema).min(1),
|
|
135
|
+
version: z.number().default(1),
|
|
136
|
+
userId: z.uuid(),
|
|
137
|
+
parentSchemaId: z.uuid().optional(),
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
export type FieldType = z.infer<typeof FieldTypeEnum>;
|
|
141
|
+
export type Field = z.infer<typeof FieldSchema>;
|
|
142
|
+
export type SchemaInterface = z.infer<typeof baseZodSchemaSchema>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { baseZodEntitySchema } from './baseZodEntitySchema';
|
|
3
|
+
import { UserRoleEnum } from '../types';
|
|
4
|
+
|
|
5
|
+
export const baseZodUserRoleSchema = baseZodEntitySchema.extend({
|
|
6
|
+
name: z.string().min(1).max(255),
|
|
7
|
+
slug: z.string().max(255).optional(),
|
|
8
|
+
description: z.string().optional(),
|
|
9
|
+
type: z.enum(UserRoleEnum),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type UserRoleInterface = z.infer<typeof baseZodUserRoleSchema>;
|