@or-sdk/library-types-v1 3.3.1-buildtypes652.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.
Files changed (126) hide show
  1. package/dist/.tsbuildinfo +1 -0
  2. package/dist/Categories/body.d.ts +18 -0
  3. package/dist/Categories/body.dto.d.ts +22 -0
  4. package/dist/Categories/body.dto.js +35 -0
  5. package/dist/Categories/body.dto.js.map +1 -0
  6. package/dist/Categories/body.js +12 -0
  7. package/dist/Categories/body.js.map +1 -0
  8. package/dist/Categories/index.d.ts +6 -0
  9. package/dist/Categories/index.js +23 -0
  10. package/dist/Categories/index.js.map +1 -0
  11. package/dist/Categories/param.d.ts +46 -0
  12. package/dist/Categories/param.dto.d.ts +50 -0
  13. package/dist/Categories/param.dto.js +35 -0
  14. package/dist/Categories/param.dto.js.map +1 -0
  15. package/dist/Categories/param.js +13 -0
  16. package/dist/Categories/param.js.map +1 -0
  17. package/dist/Categories/response.d.ts +94 -0
  18. package/dist/Categories/response.dto.d.ts +98 -0
  19. package/dist/Categories/response.dto.js +35 -0
  20. package/dist/Categories/response.dto.js.map +1 -0
  21. package/dist/Categories/response.js +16 -0
  22. package/dist/Categories/response.js.map +1 -0
  23. package/dist/PackageMeta.d.ts +35 -0
  24. package/dist/PackageMeta.js +19 -0
  25. package/dist/PackageMeta.js.map +1 -0
  26. package/dist/Packages/body.d.ts +315 -0
  27. package/dist/Packages/body.dto.d.ts +321 -0
  28. package/dist/Packages/body.dto.js +38 -0
  29. package/dist/Packages/body.dto.js.map +1 -0
  30. package/dist/Packages/body.js +80 -0
  31. package/dist/Packages/body.js.map +1 -0
  32. package/dist/Packages/index.d.ts +8 -0
  33. package/dist/Packages/index.js +25 -0
  34. package/dist/Packages/index.js.map +1 -0
  35. package/dist/Packages/param.d.ts +333 -0
  36. package/dist/Packages/param.dto.d.ts +343 -0
  37. package/dist/Packages/param.dto.js +50 -0
  38. package/dist/Packages/param.dto.js.map +1 -0
  39. package/dist/Packages/param.js +158 -0
  40. package/dist/Packages/param.js.map +1 -0
  41. package/dist/Packages/propTransformer.d.ts +3 -0
  42. package/dist/Packages/propTransformer.js +16 -0
  43. package/dist/Packages/propTransformer.js.map +1 -0
  44. package/dist/Packages/response.d.ts +1409 -0
  45. package/dist/Packages/response.dto.d.ts +1317 -0
  46. package/dist/Packages/response.dto.js +56 -0
  47. package/dist/Packages/response.dto.js.map +1 -0
  48. package/dist/Packages/response.js +173 -0
  49. package/dist/Packages/response.js.map +1 -0
  50. package/dist/Packages/union.d.ts +521 -0
  51. package/dist/Packages/union.dto.d.ts +675 -0
  52. package/dist/Packages/union.dto.js +41 -0
  53. package/dist/Packages/union.dto.js.map +1 -0
  54. package/dist/Packages/union.js +20 -0
  55. package/dist/Packages/union.js.map +1 -0
  56. package/dist/Sources/body.d.ts +413 -0
  57. package/dist/Sources/body.dto.d.ts +521 -0
  58. package/dist/Sources/body.dto.js +57 -0
  59. package/dist/Sources/body.dto.js.map +1 -0
  60. package/dist/Sources/body.js +83 -0
  61. package/dist/Sources/body.js.map +1 -0
  62. package/dist/Sources/index.d.ts +6 -0
  63. package/dist/Sources/index.js +23 -0
  64. package/dist/Sources/index.js.map +1 -0
  65. package/dist/Sources/param.d.ts +31 -0
  66. package/dist/Sources/param.dto.d.ts +33 -0
  67. package/dist/Sources/param.dto.js +32 -0
  68. package/dist/Sources/param.dto.js.map +1 -0
  69. package/dist/Sources/param.js +12 -0
  70. package/dist/Sources/param.js.map +1 -0
  71. package/dist/Sources/response.d.ts +960 -0
  72. package/dist/Sources/response.dto.d.ts +970 -0
  73. package/dist/Sources/response.dto.js +44 -0
  74. package/dist/Sources/response.dto.js.map +1 -0
  75. package/dist/Sources/response.js +106 -0
  76. package/dist/Sources/response.js.map +1 -0
  77. package/dist/Sync/index.d.ts +2 -0
  78. package/dist/Sync/index.js +19 -0
  79. package/dist/Sync/index.js.map +1 -0
  80. package/dist/Sync/response.d.ts +47 -0
  81. package/dist/Sync/response.dto.d.ts +51 -0
  82. package/dist/Sync/response.dto.js +35 -0
  83. package/dist/Sync/response.dto.js.map +1 -0
  84. package/dist/Sync/response.js +18 -0
  85. package/dist/Sync/response.js.map +1 -0
  86. package/dist/UploadUrl.d.ts +52 -0
  87. package/dist/UploadUrl.js +21 -0
  88. package/dist/UploadUrl.js.map +1 -0
  89. package/dist/User.d.ts +78 -0
  90. package/dist/User.js +22 -0
  91. package/dist/User.js.map +1 -0
  92. package/dist/index.d.ts +7 -0
  93. package/dist/index.js +24 -0
  94. package/dist/index.js.map +1 -0
  95. package/package.json +36 -0
  96. package/src/Categories/body.dto.ts +10 -0
  97. package/src/Categories/body.ts +10 -0
  98. package/src/Categories/index.ts +6 -0
  99. package/src/Categories/param.dto.ts +10 -0
  100. package/src/Categories/param.ts +11 -0
  101. package/src/Categories/response.dto.ts +10 -0
  102. package/src/Categories/response.ts +14 -0
  103. package/src/PackageMeta.ts +19 -0
  104. package/src/Packages/body.dto.ts +12 -0
  105. package/src/Packages/body.ts +88 -0
  106. package/src/Packages/index.ts +11 -0
  107. package/src/Packages/param.dto.ts +30 -0
  108. package/src/Packages/param.ts +181 -0
  109. package/src/Packages/propTransformer.ts +17 -0
  110. package/src/Packages/response.dto.ts +38 -0
  111. package/src/Packages/response.ts +203 -0
  112. package/src/Packages/union.dto.ts +18 -0
  113. package/src/Packages/union.ts +41 -0
  114. package/src/Sources/body.dto.ts +21 -0
  115. package/src/Sources/body.ts +101 -0
  116. package/src/Sources/index.ts +6 -0
  117. package/src/Sources/param.dto.ts +6 -0
  118. package/src/Sources/param.ts +9 -0
  119. package/src/Sources/response.dto.ts +22 -0
  120. package/src/Sources/response.ts +121 -0
  121. package/src/Sync/index.ts +2 -0
  122. package/src/Sync/response.dto.ts +10 -0
  123. package/src/Sync/response.ts +16 -0
  124. package/src/UploadUrl.ts +18 -0
  125. package/src/User.ts +18 -0
  126. package/src/index.ts +7 -0
@@ -0,0 +1,11 @@
1
+ import { z } from 'nestjs-zod/z';
2
+ import { PackageTypeEnum } from '@or-sdk/library-prisma';
3
+
4
+ export const CategoryUniversalParam = z.object({
5
+ type: z.nativeEnum(PackageTypeEnum),
6
+ });
7
+
8
+ export const UpdateCategoryParam = z.object({
9
+ type: z.nativeEnum(PackageTypeEnum),
10
+ id: z.string().uuid(),
11
+ });
@@ -0,0 +1,10 @@
1
+ import { createZodDto } from 'nestjs-zod';
2
+ import * as response from './response';
3
+
4
+ export class CategoryItemResponseDTO extends createZodDto(
5
+ response.CategoryItemResponse,
6
+ ) {}
7
+
8
+ export class CategoryListResponseDTO extends createZodDto(
9
+ response.CategoryListResponse,
10
+ ) {}
@@ -0,0 +1,14 @@
1
+ import { PackageTypeEnum } from '@or-sdk/library-prisma';
2
+ import { z } from 'nestjs-zod/z';
3
+
4
+ export const CategoryItemResponse = z.object({
5
+ id: z.string(),
6
+ name: z.string(),
7
+ hidden: z.boolean().optional(),
8
+ type: z.nativeEnum(PackageTypeEnum).optional(),
9
+ });
10
+
11
+ export const CategoryListResponse = z.object({
12
+ categories: z.array(CategoryItemResponse),
13
+ type: z.nativeEnum(PackageTypeEnum).optional(),
14
+ });
@@ -0,0 +1,19 @@
1
+ import { z } from 'nestjs-zod/z';
2
+
3
+ export const PackageMeta = z
4
+ .intersection(
5
+ z.object({
6
+ label: z.string().trim().optional(),
7
+ id: z.string().trim().optional(),
8
+ version: z.string().trim().optional(),
9
+ categories: z.array(z.string()).optional(),
10
+ description: z.string().trim().nullable().optional(),
11
+ icon: z.string().trim().nullable().optional(),
12
+ iconType: z.string().trim().nullable().optional(),
13
+ recommendedSteps: z.array(z.string()).nullable().optional(),
14
+ shape: z.string().trim().nullable().optional(),
15
+ tags: z.array(z.string().trim()).nullable().optional(),
16
+ }),
17
+ z.record(z.any(), z.any()),
18
+ )
19
+ .optional();
@@ -0,0 +1,12 @@
1
+ import { createZodDto } from 'nestjs-zod';
2
+ import * as body from './body';
3
+
4
+ export class CreatePackageByVersionBodyDTO extends createZodDto(
5
+ body.CreatePackageByVersionBody,
6
+ ) {}
7
+ export class CreatePackageReleaseBodyDTO extends createZodDto(
8
+ body.CreatePackageReleaseBody,
9
+ ) {}
10
+ export class CreatePackageFromJsonBodyDTO extends createZodDto(
11
+ body.CreatePackageFromJsonBody,
12
+ ) {}
@@ -0,0 +1,88 @@
1
+ import {
2
+ PackageSchemaTypeEnum,
3
+ PackageStatusDetailsLevelEnum,
4
+ PackageStatusDetailsStatusEnum,
5
+ } from '@or-sdk/library-prisma';
6
+ import { PackageMeta } from '../PackageMeta';
7
+ import { z } from 'nestjs-zod/z';
8
+
9
+ export const CreatePackageByVersionBody = z
10
+ .object({
11
+ fileName: z.string().trim().optional(),
12
+ fileNames: z.array(z.string()).optional(),
13
+ name: z.string().trim().optional(),
14
+ label: z.string().trim().optional(),
15
+ description: z.string().optional(),
16
+ categories: z.array(z.string()).optional(),
17
+ packageMeta: PackageMeta.optional(),
18
+ revisionId: z.string().optional(),
19
+ status: z
20
+ .nativeEnum(PackageStatusDetailsStatusEnum)
21
+ .default(PackageStatusDetailsStatusEnum.BETA)
22
+ .optional(),
23
+ level: z
24
+ .nativeEnum(PackageStatusDetailsLevelEnum)
25
+ .default(PackageStatusDetailsLevelEnum.ACCOUNT)
26
+ .optional(),
27
+ servingType: z
28
+ .string()
29
+ .optional()
30
+ .transform((s) => s?.toUpperCase?.()),
31
+ })
32
+ .transform((body) => {
33
+ body.label = body.label || body.name;
34
+
35
+ return body;
36
+ });
37
+
38
+ export const CreatePackageReleaseBody = z
39
+ .object({
40
+ status: z
41
+ .string()
42
+ .transform(
43
+ (status) => PackageStatusDetailsStatusEnum?.[status?.toUpperCase?.()],
44
+ )
45
+ .optional(),
46
+ releaseNotes: z
47
+ .union([
48
+ z.string(),
49
+ z
50
+ .object({
51
+ markdown: z.string().optional(),
52
+ })
53
+ .transform((s) => s?.markdown || ''),
54
+ ])
55
+ .transform((s) => s?.trim?.() || s)
56
+ .optional(),
57
+ membersAccountIds: z.array(z.string()).optional(),
58
+ membersUserIds: z.array(z.string()).optional(),
59
+ member: z
60
+ .object({
61
+ account: z
62
+ .array(
63
+ z.object({
64
+ accountId: z.string(),
65
+ }),
66
+ )
67
+ .optional(),
68
+ })
69
+ .optional(),
70
+ })
71
+ .transform((body) => {
72
+ if (!body?.membersAccountIds?.length) {
73
+ body.membersAccountIds =
74
+ body.member?.account.map((e) => e.accountId) || [];
75
+ }
76
+
77
+ return body;
78
+ });
79
+
80
+ export const CreatePackageFromJsonBody = z.object({
81
+ name: z.string(),
82
+ description: z.string(),
83
+ categories: z.array(z.string()).optional(),
84
+ packageMeta: PackageMeta.optional(),
85
+ data: z.any().optional(),
86
+ schemaType: z.nativeEnum(PackageSchemaTypeEnum),
87
+ isBeta: z.boolean().optional(),
88
+ });
@@ -0,0 +1,11 @@
1
+ export * from './param';
2
+ export * from './param.dto';
3
+
4
+ export * from './body';
5
+ export * from './body.dto';
6
+
7
+ export * from './union';
8
+ export * from './union.dto';
9
+
10
+ export * from './response';
11
+ export * from './response.dto';
@@ -0,0 +1,30 @@
1
+ import { createZodDto } from 'nestjs-zod';
2
+ import * as params from './param';
3
+
4
+ export class PackageParamUniversalDTO extends createZodDto(
5
+ params.PackageParamUniversal,
6
+ ) {}
7
+
8
+ export class CreateReleaseParamsDTO extends createZodDto(
9
+ params.CreateReleaseParams,
10
+ ) {}
11
+
12
+ export class GetPackagesQueryDTO extends createZodDto(
13
+ params.GetPackagesQuery,
14
+ ) {}
15
+
16
+ export class GetPackagesQueryFilterDTO extends createZodDto(
17
+ params.GetPackagesQueryFilter,
18
+ ) {}
19
+
20
+ export class PackageParamNpmScopeDTO extends createZodDto(
21
+ params.PackageParamNpmScope,
22
+ ) {}
23
+
24
+ export class PackageIncludesParamsDTO extends createZodDto(
25
+ params.PackageIncludesParams,
26
+ ) {}
27
+
28
+ export class PackageSetSystemStatusParamsDTO extends createZodDto(
29
+ params.PackageSetSystemStatusParams,
30
+ ) {}
@@ -0,0 +1,181 @@
1
+ import {
2
+ Prisma,
3
+ PackageSchemaTypeEnum,
4
+ PackageTypeEnum,
5
+ PackageStatusDetailsLevelEnum,
6
+ } from '@or-sdk/library-prisma';
7
+ import { z } from 'nestjs-zod/z';
8
+ import { packageLevel, packageStatus } from './propTransformer';
9
+
10
+ function clearArray<T>(arr = []) {
11
+ return arr
12
+ .map((e) => e?.trim?.())
13
+ .filter(
14
+ (item) =>
15
+ ['', 'undefined', 'false', 'true', 'null'].indexOf(`${item}`) === -1,
16
+ ) as T[];
17
+ }
18
+
19
+ export enum PackagesOrderByEnum {
20
+ createdAt = 'createdAt',
21
+ created = 'created', // override
22
+ updatedAt = 'updatedAt',
23
+ }
24
+
25
+ export const GetPackagesQueryFilter = z.object({
26
+ filter: z
27
+ .object({
28
+ id: z
29
+ .array(z.string())
30
+ .or(z.string())
31
+ .transform((data) => clearArray(Array.isArray(data) ? data : [data]))
32
+ .default([]),
33
+ schemaType: z.nativeEnum(PackageSchemaTypeEnum).optional(),
34
+ category: z
35
+ .array(z.string())
36
+ .or(z.string())
37
+ .default([])
38
+ .transform((data) => (Array.isArray(data) ? data : [data])),
39
+ level: z
40
+ .array(z.nativeEnum(PackageStatusDetailsLevelEnum))
41
+ .or(
42
+ z
43
+ .nativeEnum(PackageStatusDetailsLevelEnum)
44
+ .transform((data) => [data]),
45
+ )
46
+ .default([
47
+ PackageStatusDetailsLevelEnum.PDE,
48
+ PackageStatusDetailsLevelEnum.ACCOUNT,
49
+ ])
50
+ .transform((data) => (Array.isArray(data) ? data : [data])),
51
+ })
52
+ .default({}),
53
+ });
54
+
55
+ export const GetPackagesQuery = z
56
+ .intersection(
57
+ GetPackagesQueryFilter,
58
+ z
59
+ .object({
60
+ id: z
61
+ .string()
62
+ .optional()
63
+ .transform((s) => s?.trim?.() || s || false),
64
+ type: z.nativeEnum(PackageTypeEnum).optional(),
65
+ query: z
66
+ .string()
67
+ .optional()
68
+ .transform((s) => (typeof s === 'string' ? s.trim() : s)),
69
+ scope: z
70
+ .object({
71
+ id: z
72
+ .array(z.string())
73
+ .or(z.string())
74
+ .transform((data) =>
75
+ clearArray(Array.isArray(data) ? data : [data]),
76
+ )
77
+ .default([]),
78
+ category: z
79
+ .array(z.string())
80
+ .or(z.string())
81
+ .transform((data) =>
82
+ clearArray(Array.isArray(data) ? data : [data]),
83
+ )
84
+ .default([]),
85
+ })
86
+ .default({}),
87
+ size: z
88
+ .number()
89
+ .or(z.string())
90
+ .default(10)
91
+ .transform((n) => Number(n) || 0),
92
+ cursor: z
93
+ .object({
94
+ from: z
95
+ .number()
96
+ .or(z.string())
97
+ .transform((n) => Number(n) || 0),
98
+ })
99
+ .or(z.any().transform(() => ({ from: 0 })))
100
+ .transform((data) => (data?.from ? data : { from: 0 })),
101
+ orderBy: z
102
+ .nativeEnum(PackagesOrderByEnum)
103
+ .default(PackagesOrderByEnum.createdAt)
104
+ .transform((data) => {
105
+ if (data === PackagesOrderByEnum.created) {
106
+ return PackagesOrderByEnum.createdAt;
107
+ }
108
+ return data;
109
+ }),
110
+ order: z.nativeEnum(Prisma.SortOrder).default(Prisma.SortOrder.desc),
111
+ categories: z
112
+ .array(z.string())
113
+ .default([])
114
+ .transform((data) => clearArray(data)),
115
+ includeDeprecated: z
116
+ .string()
117
+ .transform((v) => ['true', '1', 1, true].includes(v))
118
+ .or(z.boolean())
119
+ .default(false),
120
+ })
121
+ .default({}),
122
+ )
123
+ .transform((data) => {
124
+ return {
125
+ ...data,
126
+ categories: [
127
+ ...(data.scope?.category || []),
128
+ ...(data.filter?.category || []),
129
+ ],
130
+ };
131
+ });
132
+
133
+ export const PackageParamUniversal = z.object({
134
+ type: z.nativeEnum(PackageTypeEnum),
135
+ id: z.string(),
136
+ version: z.string().optional(),
137
+ revisionId: z.string().optional(),
138
+ });
139
+
140
+ export const CreateReleaseParams = z.object({
141
+ type: z.nativeEnum(PackageTypeEnum),
142
+ id: z.string(),
143
+ revisionId: z.string().optional(),
144
+ version: z.string().optional(),
145
+ level: packageLevel,
146
+ });
147
+
148
+ export const PackageParamNpmScope = z.object({
149
+ npmScope: z.string(),
150
+ });
151
+
152
+ export const PackageIncludesParams = z.object({
153
+ includeDeprecated: z
154
+ .string()
155
+ .transform((v) => ['true', '1', 1, true].includes(v))
156
+ .or(z.boolean())
157
+ .default(true),
158
+ includeMember: z
159
+ .string()
160
+ .transform((v) => ['true', '1', 1, true].includes(v))
161
+ .or(z.boolean())
162
+ .default(true),
163
+ includeReleaseNotes: z
164
+ .string()
165
+ .transform((v) => ['true', '1', 1, true].includes(v))
166
+ .or(z.boolean())
167
+ .default(true),
168
+ includeData: z
169
+ .string()
170
+ .transform((v) => ['true', '1', 1, true].includes(v))
171
+ .or(z.boolean())
172
+ .default(true),
173
+ });
174
+
175
+ export const PackageSetSystemStatusParams = z.object({
176
+ type: z.nativeEnum(PackageTypeEnum),
177
+ id: z.string(),
178
+ version: z.string().optional(),
179
+ revisionId: z.string().optional(),
180
+ status: packageStatus,
181
+ });
@@ -0,0 +1,17 @@
1
+ import { z } from 'nestjs-zod/z';
2
+ import {
3
+ PackageStatusDetailsLevelEnum,
4
+ PackageStatusDetailsStatusEnum,
5
+ } from '@or-sdk/library-prisma';
6
+
7
+ export const packageStatus = z
8
+ .string()
9
+ .trim()
10
+ .toUpperCase()
11
+ .transform((status) => PackageStatusDetailsStatusEnum?.[status] || null);
12
+
13
+ export const packageLevel = z
14
+ .string()
15
+ .trim()
16
+ .toUpperCase()
17
+ .transform((level) => PackageStatusDetailsLevelEnum?.[level] || null);
@@ -0,0 +1,38 @@
1
+ import { createZodDto } from 'nestjs-zod';
2
+ import * as response from './response';
3
+
4
+ export class GetPackagesResponseDTO extends createZodDto(
5
+ response.GetPackagesResponse,
6
+ ) {}
7
+
8
+ export class GetPackagesResponseEntityDTO extends createZodDto(
9
+ response.GetPackagesResponseEntity,
10
+ ) {}
11
+
12
+ export class GetPackageResponseDTO extends createZodDto(
13
+ response.GetPackageResponse,
14
+ ) {}
15
+
16
+ export class GetPackageByIdResponseDTO extends createZodDto(
17
+ response.GetPackageByIdResponse,
18
+ ) {}
19
+
20
+ export class GetPackageByIdLatestResponseDTO extends createZodDto(
21
+ response.GetPackageByIdLatestResponse,
22
+ ) {}
23
+
24
+ export class GetPackageArchiveSignedUrlDTO extends createZodDto(
25
+ response.GetPackageArchiveSignedUrl,
26
+ ) {}
27
+
28
+ export class CreatePackageByVersionResponseDTO extends createZodDto(
29
+ response.CreatePackageByVersionResponse,
30
+ ) {}
31
+
32
+ export class CreatePackageByVersionFileNamesResponseDTO extends createZodDto(
33
+ response.CreatePackageByVersionFileNamesResponse,
34
+ ) {}
35
+
36
+ export class GetPackageSystemStatusResponseDTO extends createZodDto(
37
+ response.GetPackageSystemStatusResponse,
38
+ ) {}
@@ -0,0 +1,203 @@
1
+ import {
2
+ PackageSchemaTypeEnum,
3
+ PackageStatusDetailsLevelEnum,
4
+ PackageStatusDetailsStatusEnum,
5
+ PackageTypeEnum,
6
+ } from '@or-sdk/library-prisma';
7
+ import { PackageMeta } from '../PackageMeta';
8
+ import { z } from 'nestjs-zod/z';
9
+
10
+ const categoriesList = z.array(
11
+ z.object({
12
+ id: z.string().nullable(),
13
+ count: z.number(),
14
+ name: z.string().optional(),
15
+ }),
16
+ );
17
+
18
+ export const GetPackagesResponseEntity = z.object({
19
+ createdAt: z.date().or(z.string()).optional(),
20
+ id: z.string(),
21
+ isExternal: z.boolean().optional(),
22
+ isSandbox: z.boolean().optional(),
23
+ latest: PackageMeta,
24
+ latestVersion: z.string().optional(),
25
+ level: z.nativeEnum(PackageStatusDetailsLevelEnum).optional(),
26
+ levels: z.array(z.nativeEnum(PackageStatusDetailsLevelEnum)).optional(),
27
+ name: z.string().optional(),
28
+ releases: z
29
+ .array(
30
+ z.object({
31
+ status: z.nativeEnum(PackageStatusDetailsStatusEnum),
32
+ level: z.nativeEnum(PackageStatusDetailsLevelEnum),
33
+ version: z.string(),
34
+ primaryId: z.number().optional(),
35
+ }),
36
+ )
37
+ .optional(),
38
+ latestDocId: z.any().optional(),
39
+ revisionId: z.string().optional(),
40
+ schemaType: z.nativeEnum(PackageSchemaTypeEnum),
41
+ status: z.string().optional(),
42
+ statuses: z.array(z.string()).optional(),
43
+ type: z.nativeEnum(PackageTypeEnum).optional(),
44
+ versions: z.array(z.string()),
45
+ });
46
+
47
+ export const GetPackagesResponse = z.object({
48
+ entities: z.array(GetPackagesResponseEntity),
49
+ total: z.number().optional(),
50
+ count: z.number().optional(), // TODO: remove this
51
+ offset: z.number().optional(),
52
+ limit: z.number().optional(),
53
+ cursor: z.object({
54
+ from: z.number(),
55
+ }),
56
+ categories: categoriesList,
57
+ all: z.object({
58
+ categories: categoriesList,
59
+ count: z.number(),
60
+ }),
61
+ });
62
+
63
+ export const PackageStatusDetails = z
64
+ .object({
65
+ release: z.object({
66
+ pde: z
67
+ .object({
68
+ status: z.array(z.nativeEnum(PackageStatusDetailsStatusEnum)),
69
+ })
70
+ .optional(),
71
+ user: z
72
+ .object({
73
+ status: z.array(z.nativeEnum(PackageStatusDetailsStatusEnum)),
74
+ })
75
+ .optional(),
76
+ account: z
77
+ .object({
78
+ status: z.array(z.nativeEnum(PackageStatusDetailsStatusEnum)),
79
+ })
80
+ .optional(),
81
+ }),
82
+ system: z
83
+ .object({
84
+ status: z.array(z.nativeEnum(PackageStatusDetailsStatusEnum)),
85
+ })
86
+ .optional(),
87
+ })
88
+ .optional();
89
+
90
+ export const GetPackageResponse = z.object({
91
+ baseUrl: z.string(),
92
+ data: z.any(),
93
+ packageMeta: PackageMeta,
94
+ id: z.string(),
95
+ version: z.string(),
96
+ schemaType: z.nativeEnum(PackageSchemaTypeEnum),
97
+ revisionId: z.string().optional(),
98
+ status: z.nativeEnum(PackageStatusDetailsStatusEnum).optional(),
99
+ level: z.nativeEnum(PackageStatusDetailsLevelEnum).optional(),
100
+ name: z.string(),
101
+ description: z.string().nullable().optional(),
102
+ categories: z.array(z.string()).optional(),
103
+ statusDetails: PackageStatusDetails,
104
+ servingType: z.string().optional(),
105
+ });
106
+
107
+ export const GetPackageByIdResponse = z.object({
108
+ version: z.string(),
109
+ baseUrl: z.string(),
110
+ statusDetails: PackageStatusDetails.optional(),
111
+ servingType: z.string().optional(),
112
+ releaseNotes: z
113
+ .object({ markdown: z.string().nullable().optional() })
114
+ .optional()
115
+ .optional(),
116
+ member: z
117
+ .object({
118
+ account: z
119
+ .array(
120
+ z.object({
121
+ accountId: z.string(),
122
+ }),
123
+ )
124
+ .optional(),
125
+ user: z
126
+ .array(
127
+ z.object({
128
+ userId: z.string(),
129
+ }),
130
+ )
131
+ .optional(),
132
+ })
133
+ .optional()
134
+ .describe('Deprecated for v2 version api'),
135
+ membersAccountIds: z.array(z.string()).optional(),
136
+ membersUserIds: z.array(z.string()).optional(),
137
+ createdAt: z.date().or(z.string()).optional(),
138
+ revisionId: z.string().optional(),
139
+ name: z.string().optional(),
140
+ description: z.string().nullable().optional(),
141
+ categories: z.array(z.string()).optional(),
142
+ packageMeta: PackageMeta.optional(),
143
+ id: z.string().optional(),
144
+ schemaType: z.nativeEnum(PackageSchemaTypeEnum).optional(),
145
+ });
146
+
147
+ export const GetPackageByIdLatestResponse = z.object({
148
+ packageMeta: PackageMeta,
149
+ id: z.string(),
150
+ schemaType: z.nativeEnum(PackageSchemaTypeEnum),
151
+ version: z.string(),
152
+ baseUrl: z.string(),
153
+ servingType: z.string().optional(),
154
+ });
155
+
156
+ export const GetPackageArchiveSignedUrl = z.object({
157
+ key: z.string(),
158
+ url: z.string(),
159
+ });
160
+
161
+ export const CreatePackageByVersionFileNamesResponse = z
162
+ .array(
163
+ z.object({
164
+ fileName: z.string(),
165
+ url: z.string(),
166
+ fields: z.any(),
167
+ }),
168
+ )
169
+ .optional()
170
+ .describe(
171
+ 'When you upload a package with multiple files, this field will be returned',
172
+ );
173
+
174
+ export const CreatePackageByVersionResponse = z.object({
175
+ revisionId: z.string().optional(),
176
+ isExists: z.boolean().optional(),
177
+ fileNames: CreatePackageByVersionFileNamesResponse,
178
+ url: z
179
+ .string()
180
+ .optional()
181
+ .describe(
182
+ 'When you upload a package with a single file, this field will be returned',
183
+ ),
184
+ fields: z
185
+ .any()
186
+ .optional()
187
+ .describe(
188
+ 'When you upload a package with a single file, this field will be returned',
189
+ ),
190
+ });
191
+
192
+ export const GetPackageSystemStatusResponse = z.object({
193
+ createdAt: z.date().or(z.string()),
194
+ id: z.string(),
195
+ revisionId: z.string(),
196
+ statusDetailsSystem: z.array(
197
+ z.object({
198
+ status: z.nativeEnum(PackageStatusDetailsStatusEnum),
199
+ }),
200
+ ),
201
+ type: z.nativeEnum(PackageTypeEnum),
202
+ version: z.string(),
203
+ });
@@ -0,0 +1,18 @@
1
+ import { createZodDto } from 'nestjs-zod';
2
+ import * as union from './union';
3
+
4
+ export class CreateReleaseUnionDTO extends createZodDto(
5
+ union.CreateReleaseUnion,
6
+ ) {}
7
+
8
+ export class CreatePackageFromJsonUnionDTO extends createZodDto(
9
+ union.CreatePackageFromJsonUnion,
10
+ ) {}
11
+
12
+ export class CreatePackageByVersionUnionDTO extends createZodDto(
13
+ union.CreatePackageByVersionUnion,
14
+ ) {}
15
+
16
+ export class GetPackageByIdQueryUnionDTO extends createZodDto(
17
+ union.GetPackageByIdQueryUnion,
18
+ ) {}