@or-sdk/library-types-v1 6.0.8 → 6.0.10

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.
@@ -138,6 +138,7 @@ export declare const GetPackagesQuery: z.ZodIntersection<z.ZodObject<{
138
138
  }>>;
139
139
  categories: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString]>, unknown[], string | string[]>>>;
140
140
  includeDeprecated: z.ZodDefault<z.ZodUnion<[z.ZodEffects<z.ZodString, boolean, string>, z.ZodBoolean]>>;
141
+ includePrerelease: z.ZodDefault<z.ZodUnion<[z.ZodEffects<z.ZodString, boolean, string>, z.ZodBoolean]>>;
141
142
  }, "strip", z.ZodTypeAny, {
142
143
  id?: unknown[];
143
144
  type?: "TEST_ONLY" | "UNKNOWN" | "STEP" | "STEP_INPUT" | "STEP_TEMPLATE" | "FLOW_TEMPLATE" | "BOT_TEMPLATE" | "TICKET_INPUT" | "CONTENT_INPUT" | "CONTENT" | "NPM_UNPACKED" | "S3_BUCKET" | "RWC_INPUT";
@@ -154,6 +155,7 @@ export declare const GetPackagesQuery: z.ZodIntersection<z.ZodObject<{
154
155
  order?: "asc" | "desc";
155
156
  categories?: unknown[];
156
157
  includeDeprecated?: boolean;
158
+ includePrerelease?: boolean;
157
159
  }, {
158
160
  id?: string | string[];
159
161
  type?: "TEST_ONLY" | "UNKNOWN" | "STEP" | "STEP_INPUT" | "STEP_TEMPLATE" | "FLOW_TEMPLATE" | "BOT_TEMPLATE" | "TICKET_INPUT" | "CONTENT_INPUT" | "CONTENT" | "NPM_UNPACKED" | "S3_BUCKET" | "RWC_INPUT";
@@ -168,6 +170,7 @@ export declare const GetPackagesQuery: z.ZodIntersection<z.ZodObject<{
168
170
  order?: "asc" | "desc";
169
171
  categories?: string | string[];
170
172
  includeDeprecated?: string | boolean;
173
+ includePrerelease?: string | boolean;
171
174
  }>>>;
172
175
  export declare const PackageParamUniversal: z.ZodObject<{
173
176
  type: z.ZodNativeEnum<{
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@or-sdk/library-types-v1",
3
- "version": "6.0.8",
3
+ "version": "6.0.10",
4
4
  "description": "Request/response v1 legacy types for the OR SDK",
5
5
  "files": [
6
6
  "./dist",
7
- "./src",
8
7
  "CHANGELOG.md"
9
8
  ],
10
9
  "private": false,
@@ -1,21 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- const uuidRegex = new RegExp(
4
- /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
5
- );
6
-
7
- export const CategoryNameType = z
8
- .string()
9
- .trim()
10
- .refine((s) => !uuidRegex.test(s), {
11
- message: 'Category name cannot be uuid',
12
- });
13
-
14
- export const CreateCategoryBody = z.object({
15
- name: CategoryNameType,
16
- });
17
-
18
- export const UpdateCategoryBody = z.object({
19
- name: CategoryNameType,
20
- hidden: z.boolean().optional(),
21
- });
@@ -1,3 +0,0 @@
1
- export * from './body';
2
- export * from './param';
3
- export * from './response';
@@ -1,7 +0,0 @@
1
- import { z } from 'zod';
2
- import { PackageTypeEnum } from '@or-sdk/library-prisma';
3
-
4
- export const CategoriesParamUniversal = z.object({
5
- type: z.nativeEnum(PackageTypeEnum),
6
- id: z.string().uuid(),
7
- });
@@ -1,14 +0,0 @@
1
- import { PackageTypeEnum } from '@or-sdk/library-prisma';
2
- import { z } from 'zod';
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
- });
@@ -1,19 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- export const PackageMeta = z
4
- .object({
5
- label: z.string().trim().optional(),
6
- name: 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
- .passthrough()
18
- .nullable()
19
- .default({});
@@ -1,100 +0,0 @@
1
- import {
2
- PackageSchemaTypeEnum,
3
- PackageStatusDetailsLevelEnum,
4
- PackageStatusDetailsStatusEnum,
5
- } from '@or-sdk/library-prisma';
6
- import { PackageMeta } from '../PackageMeta';
7
- import { z } from 'zod';
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,
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,
85
- data: z.any().optional(),
86
- schemaType: z.nativeEnum(PackageSchemaTypeEnum),
87
- isBeta: z.boolean().optional(),
88
- });
89
-
90
- export const DeprecateLegacyStepsBody = z.object({
91
- exclude: z.array(z.object({ id: z.string() })).default([]),
92
- include: z.array(z.object({ id: z.string() })).default([]),
93
- });
94
-
95
- export const PutLegacyPackageBody = z.object({
96
- name: z.string().default(''),
97
- description: z.string().default(''),
98
- categories: z.array(z.string()).default([]),
99
- data: z.any().default({}),
100
- });
@@ -1,7 +0,0 @@
1
- export * from './param';
2
-
3
- export * from './body';
4
-
5
- export * from './union';
6
-
7
- export * from './response';
@@ -1,157 +0,0 @@
1
- import {
2
- Prisma,
3
- PackageSchemaTypeEnum,
4
- PackageTypeEnum,
5
- PackageStatusDetailsLevelEnum,
6
- } from '@or-sdk/library-prisma';
7
- import { z } from 'zod';
8
- import { packageLevel, packageStatus } from './propTransformer';
9
-
10
- function clearArray<T>(arr = []): T[] {
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
- const PackageArrayOfStringParam = z
26
- .array(z.string())
27
- .or(z.string())
28
- .transform((data) => {
29
- if (!Array.isArray(data)) {
30
- data = [data];
31
- }
32
- return clearArray(data);
33
- })
34
- .optional()
35
- .default([]);
36
-
37
- export const GetPackagesQueryFilter = z.object({
38
- filter: z
39
- .object({
40
- id: PackageArrayOfStringParam,
41
- schemaType: z.nativeEnum(PackageSchemaTypeEnum).optional(),
42
- category: PackageArrayOfStringParam,
43
- level: z
44
- .array(z.nativeEnum(PackageStatusDetailsLevelEnum))
45
- .or(
46
- z
47
- .nativeEnum(PackageStatusDetailsLevelEnum)
48
- .transform((data) => [data]),
49
- )
50
- .default([
51
- PackageStatusDetailsLevelEnum.PDE,
52
- PackageStatusDetailsLevelEnum.ACCOUNT,
53
- ])
54
- .transform((data) => (Array.isArray(data) ? data : [data])),
55
- })
56
- .default({}),
57
- });
58
-
59
- export const GetPackagesQuery = z.intersection(
60
- GetPackagesQueryFilter,
61
- z
62
- .object({
63
- id: PackageArrayOfStringParam,
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: PackageArrayOfStringParam,
72
- category: PackageArrayOfStringParam,
73
- })
74
- .default({}),
75
- size: z
76
- .number()
77
- .or(z.string())
78
- .default(10)
79
- .transform((n) => Number(n) || 0),
80
- cursor: z
81
- .object({
82
- from: z
83
- .number()
84
- .or(z.string())
85
- .transform((n) => Number(n) || 0),
86
- })
87
- .or(z.any().transform(() => ({ from: 0 })))
88
- .transform((data) => (data?.from ? data : { from: 0 })),
89
- orderBy: z
90
- .nativeEnum(PackagesOrderByEnum)
91
- .default(PackagesOrderByEnum.createdAt)
92
- .transform((data) => {
93
- if (data === PackagesOrderByEnum.created) {
94
- return PackagesOrderByEnum.createdAt;
95
- }
96
- return data;
97
- }),
98
- order: z.nativeEnum(Prisma.SortOrder).default(Prisma.SortOrder.desc),
99
- categories: PackageArrayOfStringParam,
100
- includeDeprecated: z
101
- .string()
102
- .transform((v) => ['true', '1', 1, true].includes(v))
103
- .or(z.boolean())
104
- .default(false),
105
- })
106
- .default({}),
107
- );
108
-
109
- export const PackageParamUniversal = z.object({
110
- type: z.nativeEnum(PackageTypeEnum),
111
- id: z.string(),
112
- version: z.string().optional(),
113
- revisionId: z.string().optional(),
114
- });
115
-
116
- export const CreateReleaseParams = z.object({
117
- type: z.nativeEnum(PackageTypeEnum),
118
- id: z.string(),
119
- revisionId: z.string().optional(),
120
- version: z.string().optional(),
121
- level: packageLevel,
122
- });
123
-
124
- export const PackageParamNpmScope = z.object({
125
- npmScope: z.string(),
126
- });
127
-
128
- export const PackageIncludesParams = z.object({
129
- includeDeprecated: z
130
- .string()
131
- .transform((v) => ['true', '1', 1, true].includes(v))
132
- .or(z.boolean())
133
- .default(true),
134
- includeMember: z
135
- .string()
136
- .transform((v) => ['true', '1', 1, true].includes(v))
137
- .or(z.boolean())
138
- .default(true),
139
- includeReleaseNotes: z
140
- .string()
141
- .transform((v) => ['true', '1', 1, true].includes(v))
142
- .or(z.boolean())
143
- .default(true),
144
- includeData: z
145
- .string()
146
- .transform((v) => ['true', '1', 1, true].includes(v))
147
- .or(z.boolean())
148
- .default(true),
149
- });
150
-
151
- export const PackageSetSystemStatusParams = z.object({
152
- type: z.nativeEnum(PackageTypeEnum),
153
- id: z.string(),
154
- version: z.string().optional(),
155
- revisionId: z.string().optional(),
156
- status: packageStatus,
157
- });
@@ -1,17 +0,0 @@
1
- import { z } from 'zod';
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);
@@ -1,217 +0,0 @@
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 'zod';
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
- const PackageReleases = z
19
- .array(
20
- z.object({
21
- status: z.nativeEnum(PackageStatusDetailsStatusEnum),
22
- level: z.nativeEnum(PackageStatusDetailsLevelEnum),
23
- version: z.string(),
24
- primaryId: z.number().optional(),
25
- }),
26
- )
27
- .default([]);
28
-
29
- export const GetPackagesResponseEntity = z.object({
30
- createdAt: z.date().or(z.string()).optional(),
31
- id: z.string(),
32
- isExternal: z.boolean().optional(),
33
- isSandbox: z.boolean().optional(), // TODO: remove this after frontend will be updated #SA-32
34
- isPlayground: z.boolean().optional(),
35
- latest: PackageMeta,
36
- latestVersion: z.string().optional(),
37
- level: z.nativeEnum(PackageStatusDetailsLevelEnum).optional(),
38
- levels: z.array(z.nativeEnum(PackageStatusDetailsLevelEnum)).optional(),
39
- name: z.string().optional(),
40
- releases: PackageReleases,
41
- latestDocId: z.any().optional(),
42
- revisionId: z.string().optional(),
43
- schemaType: z.nativeEnum(PackageSchemaTypeEnum),
44
- status: z.string().optional(),
45
- statuses: z.array(z.string()).optional(),
46
- type: z.nativeEnum(PackageTypeEnum).optional(),
47
- versions: z.array(z.string()),
48
- });
49
-
50
- export const GetPackagesResponse = z.object({
51
- entities: z.array(GetPackagesResponseEntity),
52
- total: z.number().optional(),
53
- count: z.number().optional(), // TODO: remove this
54
- offset: z.number().optional(),
55
- limit: z.number().optional(),
56
- cursor: z.object({
57
- from: z.number(),
58
- }),
59
- categories: categoriesList,
60
- all: z.object({
61
- categories: categoriesList,
62
- count: z.number(),
63
- }),
64
- });
65
-
66
- export const PackageStatusDetails = z
67
- .object({
68
- release: z.object({
69
- pde: z
70
- .object({
71
- status: z.array(z.nativeEnum(PackageStatusDetailsStatusEnum)),
72
- })
73
- .optional(),
74
- user: z
75
- .object({
76
- status: z.array(z.nativeEnum(PackageStatusDetailsStatusEnum)),
77
- })
78
- .optional(),
79
- account: z
80
- .object({
81
- status: z.array(z.nativeEnum(PackageStatusDetailsStatusEnum)),
82
- })
83
- .optional(),
84
- }),
85
- system: z
86
- .object({
87
- status: z.array(z.nativeEnum(PackageStatusDetailsStatusEnum)),
88
- })
89
- .optional(),
90
- })
91
- .optional();
92
-
93
- export const GetPackageResponse = z.object({
94
- baseUrl: z.string(),
95
- data: z.any(),
96
- packageMeta: PackageMeta,
97
- id: z.string(),
98
- version: z.string(),
99
- schemaType: z.nativeEnum(PackageSchemaTypeEnum),
100
- revisionId: z.string().optional(),
101
- status: z.nativeEnum(PackageStatusDetailsStatusEnum).optional(),
102
- level: z.nativeEnum(PackageStatusDetailsLevelEnum).optional(),
103
- name: z.string(),
104
- description: z.string().nullable().optional(),
105
- categories: z.array(z.string()).optional(),
106
- statusDetails: PackageStatusDetails,
107
- servingType: z.string().optional(),
108
- });
109
-
110
- export const GetPackageByIdIncludes = z.object({
111
- releaseNotes: z
112
- .object({ markdown: z.string().nullable().optional() })
113
- .optional()
114
- .optional(),
115
- member: z
116
- .object({
117
- account: z
118
- .array(
119
- z.object({
120
- accountId: z.string(),
121
- }),
122
- )
123
- .optional(),
124
- user: z
125
- .array(
126
- z.object({
127
- userId: z.string(),
128
- }),
129
- )
130
- .optional(),
131
- })
132
- .optional()
133
- .describe('Deprecated for v2 version api'),
134
- membersAccountIds: z.array(z.string()).optional(),
135
- membersUserIds: z.array(z.string()).optional(),
136
- });
137
-
138
- export const GetPackageByIdResponse = z.intersection(
139
- z.object({
140
- version: z.string(),
141
- baseUrl: z.string(),
142
- statusDetails: PackageStatusDetails.optional(),
143
- servingType: z.string().optional(),
144
- createdAt: z.date().or(z.string()).optional(),
145
- revisionId: z.string().optional(),
146
- name: z.string().optional(),
147
- description: z.string().nullable().optional(),
148
- categories: z.array(z.string()).optional(),
149
- packageMeta: PackageMeta,
150
- id: z.string().optional(),
151
- schemaType: z.nativeEnum(PackageSchemaTypeEnum).optional(),
152
- }),
153
- GetPackageByIdIncludes,
154
- );
155
-
156
- export const GetPackageByIdLatestResponse = z.intersection(
157
- z.object({
158
- packageMeta: PackageMeta,
159
- id: z.string(),
160
- schemaType: z.nativeEnum(PackageSchemaTypeEnum),
161
- version: z.string(),
162
- name: z.string().trim().optional(),
163
- baseUrl: z.string(),
164
- servingType: z.string().optional(),
165
- releases: PackageReleases,
166
- }),
167
- GetPackageByIdIncludes,
168
- );
169
-
170
- export const GetPackageArchiveSignedUrl = z.object({
171
- key: z.string(),
172
- url: z.string(),
173
- });
174
-
175
- export const CreatePackageByVersionFileNamesResponse = z
176
- .array(
177
- z.object({
178
- fileName: z.string(),
179
- url: z.string(),
180
- fields: z.any(),
181
- }),
182
- )
183
- .optional()
184
- .describe(
185
- 'When you upload a package with multiple files, this field will be returned',
186
- );
187
-
188
- export const CreatePackageByVersionResponse = z.object({
189
- revisionId: z.string().optional(),
190
- isExists: z.boolean().optional(),
191
- fileNames: CreatePackageByVersionFileNamesResponse,
192
- url: z
193
- .string()
194
- .optional()
195
- .describe(
196
- 'When you upload a package with a single file, this field will be returned',
197
- ),
198
- fields: z
199
- .any()
200
- .optional()
201
- .describe(
202
- 'When you upload a package with a single file, this field will be returned',
203
- ),
204
- });
205
-
206
- export const GetPackageSystemStatusResponse = z.object({
207
- createdAt: z.date().or(z.string()),
208
- id: z.string(),
209
- revisionId: z.string(),
210
- statusDetailsSystem: z.array(
211
- z.object({
212
- status: z.nativeEnum(PackageStatusDetailsStatusEnum),
213
- }),
214
- ),
215
- type: z.nativeEnum(PackageTypeEnum),
216
- version: z.string(),
217
- });
@@ -1,41 +0,0 @@
1
- import { PackageSchemaTypeEnum } from '@or-sdk/library-prisma';
2
- import {
3
- CreatePackageReleaseBody,
4
- CreatePackageFromJsonBody,
5
- CreatePackageByVersionBody,
6
- } from './body';
7
- import {
8
- PackageParamUniversal,
9
- CreateReleaseParams,
10
- GetPackagesQueryFilter,
11
- PackageIncludesParams,
12
- } from './param';
13
- import { z } from 'zod';
14
- import { packageLevel, packageStatus } from './propTransformer';
15
-
16
- export const CreateReleaseUnion = z.intersection(
17
- CreatePackageReleaseBody,
18
- CreateReleaseParams,
19
- );
20
- export const CreatePackageFromJsonUnion = z.intersection(
21
- PackageParamUniversal,
22
- CreatePackageFromJsonBody,
23
- );
24
-
25
- export const StatusDetailsReleaseParam = z.object({
26
- statusDetailsReleaseData: z.object({
27
- status: packageStatus,
28
- level: packageLevel,
29
- }),
30
- schemaType: z.nativeEnum(PackageSchemaTypeEnum),
31
- });
32
-
33
- export const CreatePackageByVersionUnion = z.intersection(
34
- z.intersection(PackageParamUniversal, CreatePackageByVersionBody),
35
- StatusDetailsReleaseParam,
36
- );
37
-
38
- export const GetPackageByIdQueryUnion = z.intersection(
39
- GetPackagesQueryFilter,
40
- PackageIncludesParams,
41
- );