@or-sdk/library-types-v2 6.0.5 → 6.0.7

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.
@@ -1,116 +0,0 @@
1
- import {
2
- PackageStatusDetailsLevelEnum,
3
- PackageStatusDetailsStatusEnum,
4
- PackageTypeEnum,
5
- PackageSchemaTypeEnum,
6
- } from '@or-sdk/library-prisma';
7
- import { PaginationParamsFunc } from '../List';
8
- import { InAndNotInFunc } from '../PropFilter';
9
- import { z } from 'zod';
10
-
11
- export const UniversalPackageParams = z.object({
12
- id: z.string(),
13
- revisionId: z.string().optional(),
14
- version: z.string().optional(),
15
- type: z.nativeEnum(PackageTypeEnum),
16
- });
17
-
18
- export const AddPackageReleaseSystemStatusParams = UniversalPackageParams.merge(
19
- z.object({
20
- status: z.nativeEnum(PackageStatusDetailsStatusEnum),
21
- }),
22
- );
23
-
24
- export const AddPackageReleaseReleaseStatusParams =
25
- UniversalPackageParams.merge(
26
- z.object({
27
- status: z.nativeEnum(PackageStatusDetailsStatusEnum),
28
- level: z.nativeEnum(PackageStatusDetailsLevelEnum),
29
- }),
30
- );
31
-
32
- export const GetPackagesParamsFilter = z.object({
33
- schemaType: InAndNotInFunc({
34
- type: z.nativeEnum(PackageSchemaTypeEnum),
35
- }).optional(),
36
- categories: z
37
- .object({
38
- name: InAndNotInFunc({
39
- type: z.string().trim().toLowerCase(),
40
- }),
41
- })
42
- .optional(),
43
- id: InAndNotInFunc({
44
- type: z.string().trim().toLowerCase(),
45
- }).optional(),
46
- servingType: InAndNotInFunc({
47
- type: z.string().trim().toUpperCase(),
48
- }).optional(),
49
- statusDetailsSystem: z
50
- .object({
51
- status: InAndNotInFunc({
52
- type: z.nativeEnum(PackageStatusDetailsStatusEnum),
53
- defaultValue: {
54
- in: [PackageStatusDetailsStatusEnum.UPLOADED],
55
- },
56
- }),
57
- })
58
- .optional()
59
- .default({}),
60
- statusDetailsRelease: z
61
- .object({
62
- status: InAndNotInFunc({
63
- type: z.nativeEnum(PackageStatusDetailsStatusEnum),
64
- defaultValue: {
65
- in: [
66
- PackageStatusDetailsStatusEnum.BETA,
67
- PackageStatusDetailsStatusEnum.RELEASED,
68
- ],
69
- notIn: [PackageStatusDetailsStatusEnum.DEPRECATED],
70
- },
71
- }),
72
- level: InAndNotInFunc({
73
- type: z.nativeEnum(PackageStatusDetailsLevelEnum),
74
- defaultValue: {
75
- in: [
76
- PackageStatusDetailsLevelEnum.ACCOUNT,
77
- PackageStatusDetailsLevelEnum.PDE,
78
- ],
79
- notIn: [PackageStatusDetailsLevelEnum.USER],
80
- },
81
- }),
82
- })
83
- .optional()
84
- .default({}),
85
- });
86
-
87
- export const GetPackagesParams = PaginationParamsFunc([
88
- 'updatedAt',
89
- 'createdAt',
90
- ])
91
- .merge(
92
- z.object({
93
- filter: GetPackagesParamsFilter.optional().default({}),
94
- scope: GetPackagesParamsFilter.pick({ id: true, categories: true })
95
- .optional()
96
- .default({}),
97
- query: z.string().trim().toLowerCase().default(''),
98
- }),
99
- )
100
- .optional()
101
- .default({});
102
-
103
- export const GetPackageParams = GetPackagesParamsFilter.pick({
104
- schemaType: true,
105
- statusDetailsRelease: true,
106
- statusDetailsSystem: true,
107
- }).optional();
108
-
109
- export const DeletePackageParams = z.object({
110
- force: z.any().transform((o) => [undefined, true, 'true', '1'].includes(o)),
111
- filter: GetPackagesParamsFilter.pick({
112
- statusDetailsRelease: true,
113
- statusDetailsSystem: true,
114
- schemaType: true,
115
- }),
116
- });
@@ -1,116 +0,0 @@
1
- import {
2
- PackageStatusDetailsLevelEnum,
3
- PackageStatusDetailsStatusEnum,
4
- prismaZodGenerated,
5
- } from '@or-sdk/library-prisma';
6
- import { ListView } from '../List';
7
- import { z } from 'zod';
8
- import { CreatedBy } from '../CreatedBy';
9
-
10
- const PackageModelResponse = prismaZodGenerated._PackageModel
11
- .omit({
12
- createdById: true,
13
- modifiedById: true,
14
- data: true,
15
- sourceRevisionId: true,
16
- })
17
- .merge(
18
- z.object({
19
- createdBy: CreatedBy.optional(),
20
- }),
21
- );
22
-
23
- const PackageReleaseModelResponse = prismaZodGenerated._PackageReleaseModel
24
- .omit({
25
- createdById: true,
26
- modifiedById: true,
27
- sourceRevisionId: true,
28
- versionInt: true,
29
- })
30
- .merge(
31
- z.object({
32
- data: z.any().optional(),
33
- createdBy: CreatedBy.optional(),
34
- categories: prismaZodGenerated._CategoryModel
35
- .pick({
36
- id: true,
37
- name: true,
38
- })
39
- .array(),
40
- statusDetailsSystem: prismaZodGenerated._PackageStatusDetailsSystemModel
41
- .pick({
42
- status: true,
43
- createdAt: true,
44
- updatedAt: true,
45
- })
46
- .merge(z.object({ createdBy: CreatedBy.optional() }))
47
- .array()
48
- .optional(),
49
- statusDetailsRelease: prismaZodGenerated._PackageStatusDetailsReleaseModel
50
- .pick({
51
- status: true,
52
- level: true,
53
- createdAt: true,
54
- updatedAt: true,
55
- })
56
- .merge(z.object({ createdBy: CreatedBy.optional() }))
57
- .array()
58
- .optional(),
59
- }),
60
- );
61
-
62
- export const AddPackageResponse = z.object({
63
- packageRelease: PackageReleaseModelResponse,
64
- package: PackageModelResponse,
65
- baseUrl: z.string().optional().nullable(),
66
- uploadSignature: z
67
- .object({
68
- fileName: z.string(),
69
- url: z.string(),
70
- fields: z.any(),
71
- })
72
- .array(),
73
- });
74
-
75
- export const GetPackagesListResponse = ListView.extend({
76
- categories: prismaZodGenerated._CategoryModel
77
- .pick({
78
- name: true,
79
- })
80
- .merge(
81
- z.object({
82
- total: z.number(),
83
- }),
84
- )
85
- .array(),
86
- total: z.number(),
87
- items: PackageModelResponse.merge(
88
- z.object({
89
- latest: PackageReleaseModelResponse,
90
- latestVersion: z.string(),
91
- latestRevisionId: z.string(),
92
- label: z.string(),
93
- releases: z.array(
94
- z.object({
95
- status: z.nativeEnum(PackageStatusDetailsStatusEnum),
96
- level: z.nativeEnum(PackageStatusDetailsLevelEnum),
97
- version: z.string(),
98
- revisionId: z.string(),
99
- }),
100
- ),
101
- }),
102
- ).array(),
103
- });
104
-
105
- export const GetPackageResponse = PackageModelResponse.merge(
106
- z.object({
107
- createdBy: CreatedBy,
108
- releases: PackageReleaseModelResponse.array(),
109
- }),
110
- );
111
-
112
- export const GetPackageReleaseResponse = PackageReleaseModelResponse.merge(
113
- z.object({
114
- baseUrl: z.string(),
115
- }),
116
- );
package/src/PropFilter.ts DELETED
@@ -1,30 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- export const InAndNotInFunc = ({
4
- defaultValue = {},
5
- inProp = true,
6
- notInProp = true,
7
- type,
8
- }: {
9
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
- defaultValue?: { in?: any[]; notIn?: any[] };
11
- inProp?: boolean;
12
- notInProp?: boolean;
13
- type: z.ZodTypeAny;
14
- }) =>
15
- z
16
- .object({
17
- in: type
18
- .transform((s) => [s])
19
- .or(z.array(type))
20
- .optional()
21
- .describe('This values will be included in the result'),
22
- notIn: type
23
- .transform((s) => [s])
24
- .or(z.array(type))
25
- .optional()
26
- .describe('This values will be excluded from the result'),
27
- })
28
- .pick({ in: inProp as true, notIn: notInProp as true })
29
- .optional()
30
- .default(defaultValue);
File without changes
@@ -1,4 +0,0 @@
1
- export * from './Packages';
2
- export * from './CreatedBy';
3
- export * from './List';
4
- export * from './PropFilter';
package/src/index.ts DELETED
@@ -1,20 +0,0 @@
1
- import { z } from 'zod';
2
- import * as allZodSchemas from './index.public';
3
- export type PackageMetaDTO = z.infer<typeof allZodSchemas.PackageMeta>
4
- export type AddPackageBodyDTO = z.infer<typeof allZodSchemas.AddPackageBody>
5
- export type UpdatePackageByRevisionBodyDTO = z.infer<typeof allZodSchemas.UpdatePackageByRevisionBody>
6
- export type AddPackageDependenciesBodyDTO = z.infer<typeof allZodSchemas.AddPackageDependenciesBody>
7
- export type AddPackageResponseDTO = z.infer<typeof allZodSchemas.AddPackageResponse>
8
- export type GetPackagesListResponseDTO = z.infer<typeof allZodSchemas.GetPackagesListResponse>
9
- export type GetPackageResponseDTO = z.infer<typeof allZodSchemas.GetPackageResponse>
10
- export type GetPackageReleaseResponseDTO = z.infer<typeof allZodSchemas.GetPackageReleaseResponse>
11
- export type UniversalPackageParamsDTO = z.infer<typeof allZodSchemas.UniversalPackageParams>
12
- export type AddPackageReleaseSystemStatusParamsDTO = z.infer<typeof allZodSchemas.AddPackageReleaseSystemStatusParams>
13
- export type AddPackageReleaseReleaseStatusParamsDTO = z.infer<typeof allZodSchemas.AddPackageReleaseReleaseStatusParams>
14
- export type GetPackagesParamsFilterDTO = z.infer<typeof allZodSchemas.GetPackagesParamsFilter>
15
- export type GetPackagesParamsDTO = z.infer<typeof allZodSchemas.GetPackagesParams>
16
- export type GetPackageParamsDTO = z.infer<typeof allZodSchemas.GetPackageParams>
17
- export type DeletePackageParamsDTO = z.infer<typeof allZodSchemas.DeletePackageParams>
18
- export type CreatedByDTO = z.infer<typeof allZodSchemas.CreatedBy>
19
- export type ListViewDTO = z.infer<typeof allZodSchemas.ListView>
20
- export * from './index.public';