@uluops/ops-sdk 1.8.3 → 1.8.4
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/CHANGELOG.md +36 -1
- package/README.md +70 -49
- package/dist/client.d.ts +10 -45
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +16 -11
- package/dist/client.js.map +1 -1
- package/dist/config/constants.d.ts +2 -2
- package/dist/config/constants.js +1 -1
- package/dist/config/validators.d.ts +141 -1
- package/dist/config/validators.d.ts.map +1 -1
- package/dist/config/validators.js +146 -4
- package/dist/config/validators.js.map +1 -1
- package/dist/http/http-client.d.ts +17 -2
- package/dist/http/http-client.d.ts.map +1 -1
- package/dist/http/http-client.js +6 -1
- package/dist/http/http-client.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/operations/analytics.d.ts +86 -29
- package/dist/operations/analytics.d.ts.map +1 -1
- package/dist/operations/analytics.js +89 -32
- package/dist/operations/analytics.js.map +1 -1
- package/dist/operations/auth.d.ts +46 -8
- package/dist/operations/auth.d.ts.map +1 -1
- package/dist/operations/auth.js +46 -8
- package/dist/operations/auth.js.map +1 -1
- package/dist/operations/issues.d.ts +86 -16
- package/dist/operations/issues.d.ts.map +1 -1
- package/dist/operations/issues.js +86 -16
- package/dist/operations/issues.js.map +1 -1
- package/dist/operations/projects.d.ts +64 -10
- package/dist/operations/projects.d.ts.map +1 -1
- package/dist/operations/projects.js +69 -17
- package/dist/operations/projects.js.map +1 -1
- package/dist/operations/runs.d.ts +103 -19
- package/dist/operations/runs.d.ts.map +1 -1
- package/dist/operations/runs.js +107 -20
- package/dist/operations/runs.js.map +1 -1
- package/dist/types/analytics.d.ts +13 -21
- package/dist/types/analytics.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -2
- package/dist/types/index.js.map +1 -1
- package/dist/types/projects.d.ts +0 -6
- package/dist/types/projects.d.ts.map +1 -1
- package/dist/types/response-schemas.d.ts +8 -38
- package/dist/types/response-schemas.d.ts.map +1 -1
- package/dist/types/response-schemas.js +9 -7
- package/dist/types/response-schemas.js.map +1 -1
- package/dist/types/runs.d.ts +0 -6
- package/dist/types/runs.d.ts.map +1 -1
- package/dist/types/schemas.d.ts +3 -24
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/types/schemas.js +2 -4
- package/dist/types/schemas.js.map +1 -1
- package/package.json +4 -4
- package/dist/operations/admin.d.ts +0 -89
- package/dist/operations/admin.d.ts.map +0 -1
- package/dist/operations/admin.js +0 -134
- package/dist/operations/admin.js.map +0 -1
|
@@ -1,19 +1,52 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Client-side validation error thrown when input fails Zod schema validation.
|
|
4
|
+
*
|
|
5
|
+
* Contains structured error details from Zod for programmatic inspection.
|
|
6
|
+
* Import from `@uluops/ops-sdk/errors` or `@uluops/ops-sdk/config`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* try {
|
|
11
|
+
* validateSaveRunInput(data);
|
|
12
|
+
* } catch (err) {
|
|
13
|
+
* if (err instanceof InputValidationError) {
|
|
14
|
+
* console.log(err.message); // "Invalid save run: project: String must contain at least 1 character(s)"
|
|
15
|
+
* console.log(err.errors); // Zod issue array with path, code, message per field
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
4
19
|
*/
|
|
5
20
|
export declare class InputValidationError extends Error {
|
|
6
21
|
readonly errors: z.ZodError['issues'];
|
|
7
22
|
constructor(message: string, errors: z.ZodError['issues']);
|
|
8
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Validate user registration input.
|
|
26
|
+
* @param data - Raw input: `{ email: string (valid email, max 255), password: string (8-128 chars, requires uppercase + lowercase + digit) }`
|
|
27
|
+
* @returns Validated `RegisterInput`
|
|
28
|
+
* @throws {InputValidationError} If email is invalid or password doesn't meet requirements
|
|
29
|
+
*/
|
|
9
30
|
export declare function validateRegisterInput(data: unknown): {
|
|
10
31
|
email: string;
|
|
11
32
|
password: string;
|
|
12
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* Validate login input.
|
|
36
|
+
* @param data - Raw input: `{ email: string, password: string }`
|
|
37
|
+
* @returns Validated `LoginInput`
|
|
38
|
+
* @throws {InputValidationError} If email or password is missing
|
|
39
|
+
*/
|
|
13
40
|
export declare function validateLoginInput(data: unknown): {
|
|
14
41
|
email: string;
|
|
15
42
|
password: string;
|
|
16
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* Validate profile update input. At least one field must be provided.
|
|
46
|
+
* @param data - Raw input: `{ username?, name?, bio?, timezone?, websiteUrl?, avatar?, avatarMimeType? }`
|
|
47
|
+
* @returns Validated `UpdateProfileInput`
|
|
48
|
+
* @throws {InputValidationError} If no fields provided, or username doesn't match `^[a-z][a-z0-9_]{2,29}$`
|
|
49
|
+
*/
|
|
17
50
|
export declare function validateUpdateProfileInput(data: unknown): {
|
|
18
51
|
username?: string | null | undefined;
|
|
19
52
|
name?: string | null | undefined;
|
|
@@ -23,29 +56,74 @@ export declare function validateUpdateProfileInput(data: unknown): {
|
|
|
23
56
|
avatar?: string | null | undefined;
|
|
24
57
|
avatarMimeType?: "image/png" | "image/jpeg" | "image/gif" | "image/webp" | null | undefined;
|
|
25
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* Validate password change input.
|
|
61
|
+
* @param data - Raw input: `{ currentPassword: string, newPassword: string (8-128, upper+lower+digit) }`
|
|
62
|
+
* @returns Validated `ChangePasswordInput`
|
|
63
|
+
* @throws {InputValidationError} If current password missing or new password doesn't meet requirements
|
|
64
|
+
*/
|
|
26
65
|
export declare function validateChangePasswordInput(data: unknown): {
|
|
27
66
|
currentPassword: string;
|
|
28
67
|
newPassword: string;
|
|
29
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
* Validate password reset input (from reset email).
|
|
71
|
+
* @param data - Raw input: `{ token: string, password: string (8-128, upper+lower+digit) }`
|
|
72
|
+
* @returns Validated `ResetPasswordInput`
|
|
73
|
+
* @throws {InputValidationError} If token missing or password doesn't meet requirements
|
|
74
|
+
*/
|
|
30
75
|
export declare function validateResetPasswordInput(data: unknown): {
|
|
31
76
|
token: string;
|
|
32
77
|
password: string;
|
|
33
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* Validate API key creation input.
|
|
81
|
+
* @param data - Raw input: `{ name?: string (max 100), expiresAt?: string (ISO 8601) }`
|
|
82
|
+
* @returns Validated `CreateApiKeyInput`
|
|
83
|
+
* @throws {InputValidationError} If name exceeds 100 chars or expiresAt is not valid ISO 8601
|
|
84
|
+
*/
|
|
34
85
|
export declare function validateCreateApiKeyInput(data: unknown): {
|
|
35
86
|
name?: string | undefined;
|
|
36
87
|
expiresAt?: string | undefined;
|
|
37
88
|
};
|
|
89
|
+
/**
|
|
90
|
+
* Validate project creation input.
|
|
91
|
+
* @param data - Raw input: `{ name: string (1-200 chars) }`
|
|
92
|
+
* @returns Validated `CreateProjectInput`
|
|
93
|
+
* @throws {InputValidationError} If name is empty or exceeds 200 chars
|
|
94
|
+
*/
|
|
38
95
|
export declare function validateCreateProjectInput(data: unknown): {
|
|
39
96
|
name: string;
|
|
40
97
|
};
|
|
98
|
+
/**
|
|
99
|
+
* Validate project deletion input. Requires explicit confirmation.
|
|
100
|
+
* @param data - Raw input: `{ confirm: true, confirmationPhrase: string }`
|
|
101
|
+
* @returns Validated `DeleteProjectInput`
|
|
102
|
+
* @throws {InputValidationError} If confirm is not `true` or confirmationPhrase is missing
|
|
103
|
+
*/
|
|
41
104
|
export declare function validateDeleteProjectInput(data: unknown): {
|
|
42
105
|
confirm: true;
|
|
43
106
|
confirmationPhrase: string;
|
|
44
107
|
};
|
|
108
|
+
/**
|
|
109
|
+
* Validate project rename input.
|
|
110
|
+
* @param data - Raw input: `{ oldName: string, newName: string (1-200 chars) }`
|
|
111
|
+
* @returns Validated `RenameProjectInput`
|
|
112
|
+
* @throws {InputValidationError} If either name is empty or newName exceeds 200 chars
|
|
113
|
+
*/
|
|
45
114
|
export declare function validateRenameProjectInput(data: unknown): {
|
|
46
115
|
oldName: string;
|
|
47
116
|
newName: string;
|
|
48
117
|
};
|
|
118
|
+
/**
|
|
119
|
+
* Validate save run input. This is the primary validation for `client.runs.save()`.
|
|
120
|
+
* @param data - Raw input with required fields: `project` (1-200), `workflowType` (1-100),
|
|
121
|
+
* `agents` (non-empty array), `recommendations` (array, use `[]` for empty).
|
|
122
|
+
* Optional: `summary`, `rawMarkdown`, `idempotencyKey`, `definitionType/Name/Version/Hash`,
|
|
123
|
+
* `analysisRecords`, `analysisSummary`.
|
|
124
|
+
* @returns Validated `SaveRunInput`
|
|
125
|
+
* @throws {InputValidationError} If required fields missing, agents empty, or field constraints violated
|
|
126
|
+
*/
|
|
49
127
|
export declare function validateSaveRunInput(data: unknown): {
|
|
50
128
|
project: string;
|
|
51
129
|
workflowType: string;
|
|
@@ -64,6 +142,7 @@ export declare function validateSaveRunInput(data: unknown): {
|
|
|
64
142
|
totalEffectiveTokens?: number | undefined;
|
|
65
143
|
} | undefined;
|
|
66
144
|
durationMs?: number | undefined;
|
|
145
|
+
definitionVersion?: string | undefined;
|
|
67
146
|
}[];
|
|
68
147
|
recommendations: {
|
|
69
148
|
agent: string;
|
|
@@ -94,6 +173,7 @@ export declare function validateSaveRunInput(data: unknown): {
|
|
|
94
173
|
definitionName?: string | undefined;
|
|
95
174
|
definitionVersion?: string | undefined;
|
|
96
175
|
definitionHash?: string | undefined;
|
|
176
|
+
definitionId?: string | undefined;
|
|
97
177
|
definitionMinSubscription?: "free" | "hobbyist" | "plus" | "pro" | "enterprise" | undefined;
|
|
98
178
|
analysisRecords?: {
|
|
99
179
|
recordType: string;
|
|
@@ -130,6 +210,13 @@ export declare function validateSaveRunInput(data: unknown): {
|
|
|
130
210
|
auditImplications?: string[] | null | undefined;
|
|
131
211
|
}[] | undefined;
|
|
132
212
|
};
|
|
213
|
+
/**
|
|
214
|
+
* Validate archive runs input.
|
|
215
|
+
* @param data - Raw input: `{ project: string }` plus at least one filter:
|
|
216
|
+
* `beforeRunNumber?`, `beforeDate?` (ISO 8601), `keepLast?`, `reason?` (max 500)
|
|
217
|
+
* @returns Validated `ArchiveRunsInput`
|
|
218
|
+
* @throws {InputValidationError} If project missing or filter constraints violated
|
|
219
|
+
*/
|
|
133
220
|
export declare function validateArchiveRunsInput(data: unknown): {
|
|
134
221
|
project: string;
|
|
135
222
|
beforeRunNumber?: number | undefined;
|
|
@@ -137,6 +224,15 @@ export declare function validateArchiveRunsInput(data: unknown): {
|
|
|
137
224
|
keepLast?: number | undefined;
|
|
138
225
|
reason?: string | undefined;
|
|
139
226
|
};
|
|
227
|
+
/**
|
|
228
|
+
* Validate user-submitted issue creation input.
|
|
229
|
+
* @param data - Raw input with required: `project` (1-200), `title` (1-500),
|
|
230
|
+
* `priority` ('critical' | 'high' | 'suggested' | 'backlog').
|
|
231
|
+
* Optional: `severity`, `category`, `description` (max 10000), `filePath`, `lineNumber`,
|
|
232
|
+
* `failureCode` (e.g. 'SEM-VAL/H'), `failureDomain`, `failureMode`, `agent`, `type`.
|
|
233
|
+
* @returns Validated `CreateUserIssueInput`
|
|
234
|
+
* @throws {InputValidationError} If required fields missing or constraints violated
|
|
235
|
+
*/
|
|
140
236
|
export declare function validateCreateUserIssueInput(data: unknown): {
|
|
141
237
|
project: string;
|
|
142
238
|
title: string;
|
|
@@ -152,6 +248,12 @@ export declare function validateCreateUserIssueInput(data: unknown): {
|
|
|
152
248
|
agent?: string | undefined;
|
|
153
249
|
type?: "observation" | "feature" | "bug" | "refactor" | "config" | "docs" | "infra" | "security" | "test" | "deficiency" | "ambiguity" | undefined;
|
|
154
250
|
};
|
|
251
|
+
/**
|
|
252
|
+
* Validate issue metadata update input. All fields optional.
|
|
253
|
+
* @param data - Raw input: `{ title?, status?, priority?, severity?, failureCode?, filePath?, lineNumber?, ... }`
|
|
254
|
+
* @returns Validated `UpdateIssueInput`
|
|
255
|
+
* @throws {InputValidationError} If any provided field violates its constraints
|
|
256
|
+
*/
|
|
155
257
|
export declare function validateUpdateIssueInput(data: unknown): {
|
|
156
258
|
title?: string | undefined;
|
|
157
259
|
status?: "open" | "completed" | "deferred" | "wontfix" | "merged" | "false-positive" | "observation" | undefined;
|
|
@@ -165,15 +267,33 @@ export declare function validateUpdateIssueInput(data: unknown): {
|
|
|
165
267
|
filePath?: string | null | undefined;
|
|
166
268
|
lineNumber?: number | null | undefined;
|
|
167
269
|
};
|
|
270
|
+
/**
|
|
271
|
+
* Validate issue status update input.
|
|
272
|
+
* @param data - Raw input: `{ status: Status, reason?: string (max 500) }`
|
|
273
|
+
* @returns Validated `UpdateIssueStatusInput`
|
|
274
|
+
* @throws {InputValidationError} If status is not a valid Status enum value
|
|
275
|
+
*/
|
|
168
276
|
export declare function validateUpdateIssueStatusInput(data: unknown): {
|
|
169
277
|
status: "open" | "completed" | "deferred" | "wontfix" | "merged" | "false-positive" | "observation";
|
|
170
278
|
reason?: string | undefined;
|
|
171
279
|
};
|
|
280
|
+
/**
|
|
281
|
+
* Validate issue note creation input.
|
|
282
|
+
* @param data - Raw input: `{ content: string (1-10000), noteType?: NoteType, createdBy?: string }`
|
|
283
|
+
* @returns Validated `CreateIssueNoteInput`
|
|
284
|
+
* @throws {InputValidationError} If content is empty or exceeds 10000 chars
|
|
285
|
+
*/
|
|
172
286
|
export declare function validateCreateIssueNoteInput(data: unknown): {
|
|
173
287
|
content: string;
|
|
174
288
|
noteType?: "context" | "resolution" | "blocker" | undefined;
|
|
175
289
|
createdBy?: string | undefined;
|
|
176
290
|
};
|
|
291
|
+
/**
|
|
292
|
+
* Validate bulk issue status update input. Max 100 items per request.
|
|
293
|
+
* @param data - Raw input: `{ updates: Array<{ issueId?: string, id?: string, status: Status, reason?: string }> }`
|
|
294
|
+
* @returns Validated bulk update input
|
|
295
|
+
* @throws {InputValidationError} If updates array is empty, exceeds 100 items, or any item has invalid status
|
|
296
|
+
*/
|
|
177
297
|
export declare function validateBulkStatusUpdateInput(data: unknown): {
|
|
178
298
|
updates: {
|
|
179
299
|
status: "open" | "completed" | "deferred" | "wontfix" | "merged" | "false-positive" | "observation";
|
|
@@ -182,7 +302,27 @@ export declare function validateBulkStatusUpdateInput(data: unknown): {
|
|
|
182
302
|
reason?: string | undefined;
|
|
183
303
|
}[];
|
|
184
304
|
};
|
|
305
|
+
/**
|
|
306
|
+
* Validate that a string is a valid UUID v1-5.
|
|
307
|
+
* @param value - The string to validate
|
|
308
|
+
* @param fieldName - Field name for error messages (e.g. 'projectId', 'issueId')
|
|
309
|
+
* @throws {InputValidationError} If value is not a valid UUID format
|
|
310
|
+
*/
|
|
185
311
|
export declare function validateUuid(value: string, fieldName: string): void;
|
|
312
|
+
/**
|
|
313
|
+
* Validate that a value is a non-empty string after trimming.
|
|
314
|
+
* @param value - The value to validate
|
|
315
|
+
* @param fieldName - Field name for error messages
|
|
316
|
+
* @returns The trimmed string
|
|
317
|
+
* @throws {InputValidationError} If value is not a string or is empty after trimming
|
|
318
|
+
*/
|
|
186
319
|
export declare function validateRequiredString(value: unknown, fieldName: string): string;
|
|
320
|
+
/**
|
|
321
|
+
* Validate that a value is a positive integer (> 0).
|
|
322
|
+
* @param value - The value to validate (coerced via `Number()`)
|
|
323
|
+
* @param fieldName - Field name for error messages
|
|
324
|
+
* @returns The validated number
|
|
325
|
+
* @throws {InputValidationError} If value is not a positive integer
|
|
326
|
+
*/
|
|
187
327
|
export declare function validatePositiveInt(value: unknown, fieldName: string): number;
|
|
188
328
|
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/config/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoBxB
|
|
1
|
+
{"version":3,"file":"valid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ACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,OAAO;;;;;;;;;;;;;;EAEzD;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,OAAO;;;;;;;;;;;;EAErD;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,OAAO;;;EAE3D;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,OAAO;;;;EAEzD;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,OAAO;;;;;;;EAE1D;AAOD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAOnE;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAOhF;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAM7E"}
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { CreateProjectInputSchema, SaveRunInputSchema, CreateUserIssueInputSchema, UpdateIssueStatusInputSchema, CreateIssueNoteInputSchema, ArchiveRunsInputSchema, RegisterInputSchema, LoginInputSchema, UpdateProfileInputSchema, ChangePasswordInputSchema, ResetPasswordInputSchema, CreateApiKeyInputSchema, BulkStatusUpdateInputSchema, DeleteProjectInputSchema, RenameProjectInputSchema, UpdateIssueInputSchema, } from '../types/schemas.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Client-side validation error thrown when input fails Zod schema validation.
|
|
4
|
+
*
|
|
5
|
+
* Contains structured error details from Zod for programmatic inspection.
|
|
6
|
+
* Import from `@uluops/ops-sdk/errors` or `@uluops/ops-sdk/config`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* try {
|
|
11
|
+
* validateSaveRunInput(data);
|
|
12
|
+
* } catch (err) {
|
|
13
|
+
* if (err instanceof InputValidationError) {
|
|
14
|
+
* console.log(err.message); // "Invalid save run: project: String must contain at least 1 character(s)"
|
|
15
|
+
* console.log(err.errors); // Zod issue array with path, code, message per field
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
4
19
|
*/
|
|
5
20
|
export class InputValidationError extends Error {
|
|
6
21
|
errors;
|
|
@@ -11,7 +26,7 @@ export class InputValidationError extends Error {
|
|
|
11
26
|
}
|
|
12
27
|
}
|
|
13
28
|
/**
|
|
14
|
-
*
|
|
29
|
+
* Format a single Zod issue into a human-readable string.
|
|
15
30
|
*/
|
|
16
31
|
function formatZodIssue(e) {
|
|
17
32
|
const field = e.path.join('.') || '(root)';
|
|
@@ -32,78 +47,205 @@ function validate(schema, data, context) {
|
|
|
32
47
|
// ============================================
|
|
33
48
|
// AUTH VALIDATORS
|
|
34
49
|
// ============================================
|
|
50
|
+
/**
|
|
51
|
+
* Validate user registration input.
|
|
52
|
+
* @param data - Raw input: `{ email: string (valid email, max 255), password: string (8-128 chars, requires uppercase + lowercase + digit) }`
|
|
53
|
+
* @returns Validated `RegisterInput`
|
|
54
|
+
* @throws {InputValidationError} If email is invalid or password doesn't meet requirements
|
|
55
|
+
*/
|
|
35
56
|
export function validateRegisterInput(data) {
|
|
36
57
|
return validate(RegisterInputSchema, data, 'register input');
|
|
37
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Validate login input.
|
|
61
|
+
* @param data - Raw input: `{ email: string, password: string }`
|
|
62
|
+
* @returns Validated `LoginInput`
|
|
63
|
+
* @throws {InputValidationError} If email or password is missing
|
|
64
|
+
*/
|
|
38
65
|
export function validateLoginInput(data) {
|
|
39
66
|
return validate(LoginInputSchema, data, 'login input');
|
|
40
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Validate profile update input. At least one field must be provided.
|
|
70
|
+
* @param data - Raw input: `{ username?, name?, bio?, timezone?, websiteUrl?, avatar?, avatarMimeType? }`
|
|
71
|
+
* @returns Validated `UpdateProfileInput`
|
|
72
|
+
* @throws {InputValidationError} If no fields provided, or username doesn't match `^[a-z][a-z0-9_]{2,29}$`
|
|
73
|
+
*/
|
|
41
74
|
export function validateUpdateProfileInput(data) {
|
|
42
75
|
return validate(UpdateProfileInputSchema, data, 'profile update');
|
|
43
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Validate password change input.
|
|
79
|
+
* @param data - Raw input: `{ currentPassword: string, newPassword: string (8-128, upper+lower+digit) }`
|
|
80
|
+
* @returns Validated `ChangePasswordInput`
|
|
81
|
+
* @throws {InputValidationError} If current password missing or new password doesn't meet requirements
|
|
82
|
+
*/
|
|
44
83
|
export function validateChangePasswordInput(data) {
|
|
45
84
|
return validate(ChangePasswordInputSchema, data, 'password change');
|
|
46
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Validate password reset input (from reset email).
|
|
88
|
+
* @param data - Raw input: `{ token: string, password: string (8-128, upper+lower+digit) }`
|
|
89
|
+
* @returns Validated `ResetPasswordInput`
|
|
90
|
+
* @throws {InputValidationError} If token missing or password doesn't meet requirements
|
|
91
|
+
*/
|
|
47
92
|
export function validateResetPasswordInput(data) {
|
|
48
93
|
return validate(ResetPasswordInputSchema, data, 'password reset');
|
|
49
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Validate API key creation input.
|
|
97
|
+
* @param data - Raw input: `{ name?: string (max 100), expiresAt?: string (ISO 8601) }`
|
|
98
|
+
* @returns Validated `CreateApiKeyInput`
|
|
99
|
+
* @throws {InputValidationError} If name exceeds 100 chars or expiresAt is not valid ISO 8601
|
|
100
|
+
*/
|
|
50
101
|
export function validateCreateApiKeyInput(data) {
|
|
51
102
|
return validate(CreateApiKeyInputSchema, data, 'API key creation');
|
|
52
103
|
}
|
|
53
104
|
// ============================================
|
|
54
105
|
// PROJECT VALIDATORS
|
|
55
106
|
// ============================================
|
|
107
|
+
/**
|
|
108
|
+
* Validate project creation input.
|
|
109
|
+
* @param data - Raw input: `{ name: string (1-200 chars) }`
|
|
110
|
+
* @returns Validated `CreateProjectInput`
|
|
111
|
+
* @throws {InputValidationError} If name is empty or exceeds 200 chars
|
|
112
|
+
*/
|
|
56
113
|
export function validateCreateProjectInput(data) {
|
|
57
114
|
return validate(CreateProjectInputSchema, data, 'project creation');
|
|
58
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Validate project deletion input. Requires explicit confirmation.
|
|
118
|
+
* @param data - Raw input: `{ confirm: true, confirmationPhrase: string }`
|
|
119
|
+
* @returns Validated `DeleteProjectInput`
|
|
120
|
+
* @throws {InputValidationError} If confirm is not `true` or confirmationPhrase is missing
|
|
121
|
+
*/
|
|
59
122
|
export function validateDeleteProjectInput(data) {
|
|
60
123
|
return validate(DeleteProjectInputSchema, data, 'project deletion');
|
|
61
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Validate project rename input.
|
|
127
|
+
* @param data - Raw input: `{ oldName: string, newName: string (1-200 chars) }`
|
|
128
|
+
* @returns Validated `RenameProjectInput`
|
|
129
|
+
* @throws {InputValidationError} If either name is empty or newName exceeds 200 chars
|
|
130
|
+
*/
|
|
62
131
|
export function validateRenameProjectInput(data) {
|
|
63
132
|
return validate(RenameProjectInputSchema, data, 'project rename');
|
|
64
133
|
}
|
|
65
134
|
// ============================================
|
|
66
135
|
// RUN VALIDATORS
|
|
67
136
|
// ============================================
|
|
137
|
+
/**
|
|
138
|
+
* Validate save run input. This is the primary validation for `client.runs.save()`.
|
|
139
|
+
* @param data - Raw input with required fields: `project` (1-200), `workflowType` (1-100),
|
|
140
|
+
* `agents` (non-empty array), `recommendations` (array, use `[]` for empty).
|
|
141
|
+
* Optional: `summary`, `rawMarkdown`, `idempotencyKey`, `definitionType/Name/Version/Hash`,
|
|
142
|
+
* `analysisRecords`, `analysisSummary`.
|
|
143
|
+
* @returns Validated `SaveRunInput`
|
|
144
|
+
* @throws {InputValidationError} If required fields missing, agents empty, or field constraints violated
|
|
145
|
+
*/
|
|
68
146
|
export function validateSaveRunInput(data) {
|
|
69
147
|
return validate(SaveRunInputSchema, data, 'save run');
|
|
70
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Validate archive runs input.
|
|
151
|
+
* @param data - Raw input: `{ project: string }` plus at least one filter:
|
|
152
|
+
* `beforeRunNumber?`, `beforeDate?` (ISO 8601), `keepLast?`, `reason?` (max 500)
|
|
153
|
+
* @returns Validated `ArchiveRunsInput`
|
|
154
|
+
* @throws {InputValidationError} If project missing or filter constraints violated
|
|
155
|
+
*/
|
|
71
156
|
export function validateArchiveRunsInput(data) {
|
|
72
157
|
return validate(ArchiveRunsInputSchema, data, 'archive runs');
|
|
73
158
|
}
|
|
74
159
|
// ============================================
|
|
75
160
|
// ISSUE VALIDATORS
|
|
76
161
|
// ============================================
|
|
162
|
+
/**
|
|
163
|
+
* Validate user-submitted issue creation input.
|
|
164
|
+
* @param data - Raw input with required: `project` (1-200), `title` (1-500),
|
|
165
|
+
* `priority` ('critical' | 'high' | 'suggested' | 'backlog').
|
|
166
|
+
* Optional: `severity`, `category`, `description` (max 10000), `filePath`, `lineNumber`,
|
|
167
|
+
* `failureCode` (e.g. 'SEM-VAL/H'), `failureDomain`, `failureMode`, `agent`, `type`.
|
|
168
|
+
* @returns Validated `CreateUserIssueInput`
|
|
169
|
+
* @throws {InputValidationError} If required fields missing or constraints violated
|
|
170
|
+
*/
|
|
77
171
|
export function validateCreateUserIssueInput(data) {
|
|
78
172
|
return validate(CreateUserIssueInputSchema, data, 'issue creation');
|
|
79
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Validate issue metadata update input. All fields optional.
|
|
176
|
+
* @param data - Raw input: `{ title?, status?, priority?, severity?, failureCode?, filePath?, lineNumber?, ... }`
|
|
177
|
+
* @returns Validated `UpdateIssueInput`
|
|
178
|
+
* @throws {InputValidationError} If any provided field violates its constraints
|
|
179
|
+
*/
|
|
80
180
|
export function validateUpdateIssueInput(data) {
|
|
81
181
|
return validate(UpdateIssueInputSchema, data, 'issue update');
|
|
82
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Validate issue status update input.
|
|
185
|
+
* @param data - Raw input: `{ status: Status, reason?: string (max 500) }`
|
|
186
|
+
* @returns Validated `UpdateIssueStatusInput`
|
|
187
|
+
* @throws {InputValidationError} If status is not a valid Status enum value
|
|
188
|
+
*/
|
|
83
189
|
export function validateUpdateIssueStatusInput(data) {
|
|
84
190
|
return validate(UpdateIssueStatusInputSchema, data, 'status update');
|
|
85
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Validate issue note creation input.
|
|
194
|
+
* @param data - Raw input: `{ content: string (1-10000), noteType?: NoteType, createdBy?: string }`
|
|
195
|
+
* @returns Validated `CreateIssueNoteInput`
|
|
196
|
+
* @throws {InputValidationError} If content is empty or exceeds 10000 chars
|
|
197
|
+
*/
|
|
86
198
|
export function validateCreateIssueNoteInput(data) {
|
|
87
199
|
return validate(CreateIssueNoteInputSchema, data, 'issue note');
|
|
88
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Validate bulk issue status update input. Max 100 items per request.
|
|
203
|
+
* @param data - Raw input: `{ updates: Array<{ issueId?: string, id?: string, status: Status, reason?: string }> }`
|
|
204
|
+
* @returns Validated bulk update input
|
|
205
|
+
* @throws {InputValidationError} If updates array is empty, exceeds 100 items, or any item has invalid status
|
|
206
|
+
*/
|
|
89
207
|
export function validateBulkStatusUpdateInput(data) {
|
|
90
208
|
return validate(BulkStatusUpdateInputSchema, data, 'bulk status update');
|
|
91
209
|
}
|
|
92
210
|
// ============================================
|
|
93
211
|
// SIMPLE VALIDATORS
|
|
94
212
|
// ============================================
|
|
213
|
+
/**
|
|
214
|
+
* Validate that a string is a valid UUID v1-5.
|
|
215
|
+
* @param value - The string to validate
|
|
216
|
+
* @param fieldName - Field name for error messages (e.g. 'projectId', 'issueId')
|
|
217
|
+
* @throws {InputValidationError} If value is not a valid UUID format
|
|
218
|
+
*/
|
|
95
219
|
export function validateUuid(value, fieldName) {
|
|
96
220
|
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
97
221
|
if (!uuidRegex.test(value)) {
|
|
98
|
-
throw new InputValidationError(`Invalid ${fieldName}: must be a valid UUID`, [
|
|
222
|
+
throw new InputValidationError(`Invalid ${fieldName}: must be a valid UUID`, [
|
|
223
|
+
{ code: 'custom', path: [fieldName], message: 'must be a valid UUID' }
|
|
224
|
+
]);
|
|
99
225
|
}
|
|
100
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Validate that a value is a non-empty string after trimming.
|
|
229
|
+
* @param value - The value to validate
|
|
230
|
+
* @param fieldName - Field name for error messages
|
|
231
|
+
* @returns The trimmed string
|
|
232
|
+
* @throws {InputValidationError} If value is not a string or is empty after trimming
|
|
233
|
+
*/
|
|
101
234
|
export function validateRequiredString(value, fieldName) {
|
|
102
235
|
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
103
|
-
throw new InputValidationError(`${fieldName} is required`, [
|
|
236
|
+
throw new InputValidationError(`${fieldName} is required`, [
|
|
237
|
+
{ code: 'custom', path: [fieldName], message: 'is required' }
|
|
238
|
+
]);
|
|
104
239
|
}
|
|
105
240
|
return value.trim();
|
|
106
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Validate that a value is a positive integer (> 0).
|
|
244
|
+
* @param value - The value to validate (coerced via `Number()`)
|
|
245
|
+
* @param fieldName - Field name for error messages
|
|
246
|
+
* @returns The validated number
|
|
247
|
+
* @throws {InputValidationError} If value is not a positive integer
|
|
248
|
+
*/
|
|
107
249
|
export function validatePositiveInt(value, fieldName) {
|
|
108
250
|
const num = Number(value);
|
|
109
251
|
if (!Number.isInteger(num) || num <= 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/config/validators.ts"],"names":[],"mappings":"AAC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C,EAAE,OAAO,EAAE,aAAa,EAAE;SAC9D,CAAC,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc,EAAE,SAAiB;IACnE,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,oBAAoB,CAAC,GAAG,SAAS,6BAA6B,EAAE,EAAE,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -9,21 +9,36 @@ export { toQuery, type QueryParams, type QueryParamValue } from '@uluops/sdk-cor
|
|
|
9
9
|
import { type QueryParams as _QP } from '@uluops/sdk-core/utils';
|
|
10
10
|
/**
|
|
11
11
|
* Convert a camelCase query object to snake_case QueryParams for the API.
|
|
12
|
-
*
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* Values of `'all'` are intentionally stripped — the API interprets an absent
|
|
15
|
+
* filter parameter as "return all", so `status: 'all'` and omitting `status`
|
|
16
|
+
* produce the same result. This convention is used by `StatusFilter` and
|
|
17
|
+
* `PriorityFilter` union types which include `'all'` for consumer ergonomics.
|
|
13
18
|
*/
|
|
14
19
|
export declare function toApiQuery(query: object | undefined): _QP | undefined;
|
|
15
20
|
/**
|
|
16
|
-
* HTTP client configuration
|
|
21
|
+
* HTTP client configuration — shared base for OpsClient and OpsHttpClient.
|
|
22
|
+
* OpsClientConfig extends this with higher-level options.
|
|
17
23
|
*/
|
|
18
24
|
export interface HttpClientConfig {
|
|
25
|
+
/** API base URL (defaults to production; localhost:3100 when NODE_ENV=development) */
|
|
19
26
|
baseUrl?: string;
|
|
27
|
+
/** Request timeout in ms */
|
|
20
28
|
timeout?: number;
|
|
29
|
+
/** Number of retries for transient errors */
|
|
21
30
|
retries?: number;
|
|
31
|
+
/** Enable debug logging */
|
|
22
32
|
debug?: boolean;
|
|
33
|
+
/** API key for authentication (preferred) */
|
|
23
34
|
apiKey?: string;
|
|
35
|
+
/** Email for session-based auth */
|
|
24
36
|
email?: string;
|
|
37
|
+
/** Password for session-based auth */
|
|
25
38
|
password?: string;
|
|
39
|
+
/** Existing session token */
|
|
26
40
|
sessionToken?: string;
|
|
41
|
+
/** Callback when session token is refreshed */
|
|
27
42
|
onTokenRefresh?: (token: string) => void;
|
|
28
43
|
/** Org slug for multi-tenancy — sets X-Org-Slug header on all requests */
|
|
29
44
|
orgSlug?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/http/http-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,OAAO,EAAE,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzF,OAAO,EAAE,KAAK,WAAW,IAAI,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAGjE
|
|
1
|
+
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/http/http-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,OAAO,EAAE,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzF,OAAO,EAAE,KAAK,WAAW,IAAI,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAGjE;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,GAAG,SAAS,CAkBrE;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sFAAsF;IACtF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,UAAU;gBAC/B,MAAM,GAAE,gBAAqB;CAY1C"}
|
package/dist/http/http-client.js
CHANGED
|
@@ -11,7 +11,12 @@ export { toQuery } from '@uluops/sdk-core/utils';
|
|
|
11
11
|
import { toSnakeCase } from '../utils/helpers.js';
|
|
12
12
|
/**
|
|
13
13
|
* Convert a camelCase query object to snake_case QueryParams for the API.
|
|
14
|
-
*
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Values of `'all'` are intentionally stripped — the API interprets an absent
|
|
17
|
+
* filter parameter as "return all", so `status: 'all'` and omitting `status`
|
|
18
|
+
* produce the same result. This convention is used by `StatusFilter` and
|
|
19
|
+
* `PriorityFilter` union types which include `'all'` for consumer ergonomics.
|
|
15
20
|
*/
|
|
16
21
|
export function toApiQuery(query) {
|
|
17
22
|
if (!query)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../src/http/http-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,O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AAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;YACrF,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1B,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;QACD,mEAAmE;IACrE,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7D,CAAC;AA6BD;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,UAAU;IAC3C,YAAY,SAA2B,EAAE;QACvC,KAAK,CAAC;YACJ,GAAG,MAAM;YACT,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,gBAAgB;YAC3C,OAAO,EAAE,iBAAiB;YAC1B,UAAU,EAAE,WAAW;YACvB,YAAY,EAAE,gBAAgB;YAC9B,cAAc,EAAE;gBACd,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC5D;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export { OpsHttpClient, type HttpClientConfig, type QueryParams, type QueryParam
|
|
|
12
12
|
export { ApiKeyAuth, JwtSessionAuth, createAuthStrategy, type AuthStrategy, type AuthConfig } from './http/auth-strategy.js';
|
|
13
13
|
export * from './errors/errors.js';
|
|
14
14
|
export * from './types/index.js';
|
|
15
|
+
export type { AnalyticsMetric } from './operations/analytics.js';
|
|
15
16
|
export { loadCredentials, loadConfig, loadEnvFiles, type Credentials, type SdkConfig } from './config/loaders.js';
|
|
16
17
|
export { DEFAULT_BASE_URL, API_KEY_PREFIX, ENV_VARS } from './config/constants.js';
|
|
17
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9D,OAAO,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACrH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG7H,cAAc,oBAAoB,CAAC;AAGnC,cAAc,kBAAkB,CAAC;AAGjC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9D,OAAO,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACrH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG7H,cAAc,oBAAoB,CAAC;AAGnC,cAAc,kBAAkB,CAAC;AAGjC,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAGjE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,2DAA2D;AAC3D,OAAO,EAAE,SAAS,EAAwB,MAAM,aAAa,CAAC;AAE9D,oFAAoF;AACpF,OAAO,EAAE,aAAa,EAAiE,MAAM,uBAAuB,CAAC;AACrH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAsC,MAAM,yBAAyB,CAAC;AAE7H,0EAA0E;AAC1E,cAAc,oBAAoB,CAAC;AAEnC,gEAAgE;AAChE,cAAc,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,2DAA2D;AAC3D,OAAO,EAAE,SAAS,EAAwB,MAAM,aAAa,CAAC;AAE9D,oFAAoF;AACpF,OAAO,EAAE,aAAa,EAAiE,MAAM,uBAAuB,CAAC;AACrH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAsC,MAAM,yBAAyB,CAAC;AAE7H,0EAA0E;AAC1E,cAAc,oBAAoB,CAAC;AAEnC,gEAAgE;AAChE,cAAc,kBAAkB,CAAC;AAKjC,wFAAwF;AACxF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAoC,MAAM,qBAAqB,CAAC;AAClH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC"}
|