readlint.com 0.0.0-stage → 0.4.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.
@@ -0,0 +1,605 @@
1
+ export type ClientOptions = {
2
+ baseUrl: `${string}://${string}` | (string & {});
3
+ };
4
+ /**
5
+ * Body_createDeviceCode
6
+ */
7
+ export type BodyCreateDeviceCode = {
8
+ /**
9
+ * Client Id
10
+ */
11
+ client_id: 'readlint-cli';
12
+ /**
13
+ * Hostname
14
+ */
15
+ hostname?: string;
16
+ /**
17
+ * Os
18
+ */
19
+ os?: string;
20
+ };
21
+ /**
22
+ * Body_createDeviceToken
23
+ */
24
+ export type BodyCreateDeviceToken = {
25
+ /**
26
+ * Client Id
27
+ */
28
+ client_id: string;
29
+ /**
30
+ * Device Code
31
+ */
32
+ device_code: string;
33
+ /**
34
+ * Grant Type
35
+ */
36
+ grant_type: string;
37
+ };
38
+ /**
39
+ * CheckResult
40
+ */
41
+ export type CheckResult = {
42
+ /**
43
+ * Check
44
+ */
45
+ check: string;
46
+ /**
47
+ * Group
48
+ */
49
+ group: string;
50
+ /**
51
+ * Problem Probability
52
+ */
53
+ problem_probability: number;
54
+ /**
55
+ * Verdict
56
+ */
57
+ verdict: 'clear' | 'unsure' | 'finding';
58
+ };
59
+ /**
60
+ * DeviceCodeResponse
61
+ */
62
+ export type DeviceCodeResponse = {
63
+ /**
64
+ * Device Code
65
+ */
66
+ device_code: string;
67
+ /**
68
+ * Expires In
69
+ */
70
+ expires_in: number;
71
+ /**
72
+ * Interval
73
+ */
74
+ interval: number;
75
+ /**
76
+ * User Code
77
+ */
78
+ user_code: string;
79
+ /**
80
+ * Verification Uri
81
+ */
82
+ verification_uri: string;
83
+ /**
84
+ * Verification Uri Complete
85
+ */
86
+ verification_uri_complete: string;
87
+ };
88
+ /**
89
+ * DeviceTokenResponse
90
+ */
91
+ export type DeviceTokenResponse = {
92
+ /**
93
+ * Access Token
94
+ */
95
+ access_token: string;
96
+ /**
97
+ * Expires In
98
+ */
99
+ expires_in: number;
100
+ /**
101
+ * Token Type
102
+ */
103
+ token_type?: string;
104
+ };
105
+ /**
106
+ * ErrorDetail
107
+ */
108
+ export type ErrorDetail = {
109
+ /**
110
+ * Code
111
+ */
112
+ code: string;
113
+ };
114
+ /**
115
+ * ErrorResponse
116
+ */
117
+ export type ErrorResponse = {
118
+ detail: ErrorDetail;
119
+ };
120
+ /**
121
+ * EvaluationPage
122
+ */
123
+ export type EvaluationPage = {
124
+ /**
125
+ * Items
126
+ */
127
+ items: Array<EvaluationSummary>;
128
+ /**
129
+ * Next Offset
130
+ */
131
+ next_offset: number | null;
132
+ };
133
+ /**
134
+ * EvaluationReport
135
+ */
136
+ export type EvaluationReport = {
137
+ /**
138
+ * Article Checks
139
+ */
140
+ article_checks: Array<CheckResult>;
141
+ /**
142
+ * Banned Phrases
143
+ */
144
+ banned_phrases: Array<PhraseResult>;
145
+ /**
146
+ * Description
147
+ */
148
+ description: string;
149
+ /**
150
+ * Expires At
151
+ */
152
+ expires_at: string;
153
+ /**
154
+ * Input Tokens
155
+ */
156
+ input_tokens: number;
157
+ /**
158
+ * Model
159
+ */
160
+ model: string;
161
+ /**
162
+ * Omitted Computed Jsx
163
+ */
164
+ omitted_computed_jsx: Array<string>;
165
+ /**
166
+ * Prose Blocks
167
+ */
168
+ prose_blocks: Array<ProseResult>;
169
+ /**
170
+ * Title
171
+ */
172
+ title: string;
173
+ };
174
+ /**
175
+ * EvaluationRequest
176
+ */
177
+ export type EvaluationRequest = {
178
+ /**
179
+ * Article
180
+ *
181
+ * Markdown or MDX source
182
+ */
183
+ article: string;
184
+ /**
185
+ * Description
186
+ */
187
+ description?: string;
188
+ /**
189
+ * Title
190
+ */
191
+ title?: string | null;
192
+ };
193
+ /**
194
+ * EvaluationResult
195
+ */
196
+ export type EvaluationResult = {
197
+ /**
198
+ * Created At
199
+ */
200
+ created_at: string;
201
+ /**
202
+ * Error Code
203
+ */
204
+ error_code: string | null;
205
+ /**
206
+ * Expires At
207
+ */
208
+ expires_at: string;
209
+ /**
210
+ * Id
211
+ */
212
+ id: string;
213
+ report: EvaluationReport | null;
214
+ /**
215
+ * Status
216
+ */
217
+ status: 'running' | 'complete' | 'failed';
218
+ /**
219
+ * Title
220
+ */
221
+ title: string;
222
+ };
223
+ /**
224
+ * EvaluationSummary
225
+ */
226
+ export type EvaluationSummary = {
227
+ /**
228
+ * Created At
229
+ */
230
+ created_at: string;
231
+ /**
232
+ * Error Code
233
+ */
234
+ error_code: string | null;
235
+ /**
236
+ * Expires At
237
+ */
238
+ expires_at: string;
239
+ /**
240
+ * Id
241
+ */
242
+ id: string;
243
+ /**
244
+ * Status
245
+ */
246
+ status: 'running' | 'complete' | 'failed';
247
+ /**
248
+ * Title
249
+ */
250
+ title: string;
251
+ };
252
+ /**
253
+ * HTTPValidationError
254
+ */
255
+ export type HttpValidationError = {
256
+ /**
257
+ * Detail
258
+ */
259
+ detail?: Array<ValidationError>;
260
+ };
261
+ /**
262
+ * InvalidField
263
+ */
264
+ export type InvalidField = {
265
+ /**
266
+ * Location
267
+ */
268
+ location: Array<string | number>;
269
+ /**
270
+ * Type
271
+ */
272
+ type: string;
273
+ };
274
+ /**
275
+ * OAuthError
276
+ */
277
+ export type OAuthError = {
278
+ /**
279
+ * Error
280
+ */
281
+ error: string;
282
+ };
283
+ /**
284
+ * PhraseResult
285
+ */
286
+ export type PhraseResult = {
287
+ /**
288
+ * Block
289
+ */
290
+ block: number | null;
291
+ /**
292
+ * Phrase
293
+ */
294
+ phrase: string;
295
+ /**
296
+ * Where
297
+ */
298
+ where: string;
299
+ };
300
+ /**
301
+ * ProseResult
302
+ */
303
+ export type ProseResult = {
304
+ /**
305
+ * Findings
306
+ */
307
+ findings: Array<CheckResult>;
308
+ /**
309
+ * Index
310
+ */
311
+ index: number;
312
+ /**
313
+ * Kind
314
+ */
315
+ kind: 'paragraph' | 'list';
316
+ /**
317
+ * Role
318
+ */
319
+ role: string;
320
+ /**
321
+ * Section
322
+ */
323
+ section: string;
324
+ /**
325
+ * Text
326
+ */
327
+ text: string;
328
+ /**
329
+ * Unsure
330
+ */
331
+ unsure: Array<CheckResult>;
332
+ };
333
+ /**
334
+ * ValidationDetail
335
+ */
336
+ export type ValidationDetail = {
337
+ /**
338
+ * Code
339
+ */
340
+ code: string;
341
+ /**
342
+ * Fields
343
+ */
344
+ fields?: Array<InvalidField> | null;
345
+ };
346
+ /**
347
+ * ValidationError
348
+ */
349
+ export type ValidationError = {
350
+ /**
351
+ * Context
352
+ */
353
+ ctx?: {
354
+ [key: string]: unknown;
355
+ };
356
+ /**
357
+ * Input
358
+ */
359
+ input?: unknown;
360
+ /**
361
+ * Location
362
+ */
363
+ loc: Array<string | number>;
364
+ /**
365
+ * Message
366
+ */
367
+ msg: string;
368
+ /**
369
+ * Error Type
370
+ */
371
+ type: string;
372
+ };
373
+ /**
374
+ * ValidationResponse
375
+ */
376
+ export type ValidationResponse = {
377
+ detail: ValidationDetail;
378
+ };
379
+ export type CreateDeviceCodeData = {
380
+ body: BodyCreateDeviceCode;
381
+ path?: never;
382
+ query?: never;
383
+ url: '/auth/device/code';
384
+ };
385
+ export type CreateDeviceCodeErrors = {
386
+ /**
387
+ * Bad Request
388
+ */
389
+ 400: OAuthError;
390
+ };
391
+ export type CreateDeviceCodeError = CreateDeviceCodeErrors[keyof CreateDeviceCodeErrors];
392
+ export type CreateDeviceCodeResponses = {
393
+ /**
394
+ * Successful Response
395
+ */
396
+ 200: DeviceCodeResponse;
397
+ };
398
+ export type CreateDeviceCodeResponse = CreateDeviceCodeResponses[keyof CreateDeviceCodeResponses];
399
+ export type CreateDeviceTokenData = {
400
+ body: BodyCreateDeviceToken;
401
+ path?: never;
402
+ query?: never;
403
+ url: '/auth/device/token';
404
+ };
405
+ export type CreateDeviceTokenErrors = {
406
+ /**
407
+ * Bad Request
408
+ */
409
+ 400: OAuthError;
410
+ };
411
+ export type CreateDeviceTokenError = CreateDeviceTokenErrors[keyof CreateDeviceTokenErrors];
412
+ export type CreateDeviceTokenResponses = {
413
+ /**
414
+ * Successful Response
415
+ */
416
+ 200: DeviceTokenResponse;
417
+ };
418
+ export type CreateDeviceTokenResponse = CreateDeviceTokenResponses[keyof CreateDeviceTokenResponses];
419
+ export type ListEvaluationsV1EvaluationsGetData = {
420
+ body?: never;
421
+ path?: never;
422
+ query?: {
423
+ /**
424
+ * Limit
425
+ */
426
+ limit?: number | null;
427
+ /**
428
+ * Offset
429
+ */
430
+ offset?: number;
431
+ };
432
+ url: '/v1/evaluations';
433
+ };
434
+ export type ListEvaluationsV1EvaluationsGetErrors = {
435
+ /**
436
+ * Account authentication required
437
+ */
438
+ 401: ErrorResponse;
439
+ /**
440
+ * Invalid request
441
+ */
442
+ 422: ValidationResponse;
443
+ /**
444
+ * Unexpected server failure
445
+ */
446
+ 500: ErrorResponse;
447
+ /**
448
+ * Service unavailable
449
+ */
450
+ 503: ErrorResponse;
451
+ };
452
+ export type ListEvaluationsV1EvaluationsGetError = ListEvaluationsV1EvaluationsGetErrors[keyof ListEvaluationsV1EvaluationsGetErrors];
453
+ export type ListEvaluationsV1EvaluationsGetResponses = {
454
+ /**
455
+ * Successful Response
456
+ */
457
+ 200: EvaluationPage;
458
+ };
459
+ export type ListEvaluationsV1EvaluationsGetResponse = ListEvaluationsV1EvaluationsGetResponses[keyof ListEvaluationsV1EvaluationsGetResponses];
460
+ export type CreateEvaluationV1EvaluationsPostData = {
461
+ body: EvaluationRequest;
462
+ headers: {
463
+ /**
464
+ * Idempotency-Key
465
+ */
466
+ 'idempotency-key': string;
467
+ };
468
+ path?: never;
469
+ query?: never;
470
+ url: '/v1/evaluations';
471
+ };
472
+ export type CreateEvaluationV1EvaluationsPostErrors = {
473
+ /**
474
+ * Account authentication required
475
+ */
476
+ 401: ErrorResponse;
477
+ /**
478
+ * Evaluation credit exhausted
479
+ */
480
+ 402: ErrorResponse;
481
+ /**
482
+ * Evaluation access denied
483
+ */
484
+ 403: ErrorResponse;
485
+ /**
486
+ * Idempotency key reused
487
+ */
488
+ 409: ErrorResponse;
489
+ /**
490
+ * Article exceeds model context
491
+ */
492
+ 413: ErrorResponse;
493
+ /**
494
+ * Invalid request
495
+ */
496
+ 422: ValidationResponse;
497
+ /**
498
+ * Response 500 Create Evaluation V1 Evaluations Post
499
+ *
500
+ * Unexpected evaluation failure
501
+ */
502
+ 500: EvaluationResult | ErrorResponse;
503
+ /**
504
+ * Provider send failed
505
+ */
506
+ 502: EvaluationResult;
507
+ /**
508
+ * Service unavailable
509
+ */
510
+ 503: ErrorResponse;
511
+ };
512
+ export type CreateEvaluationV1EvaluationsPostError = CreateEvaluationV1EvaluationsPostErrors[keyof CreateEvaluationV1EvaluationsPostErrors];
513
+ export type CreateEvaluationV1EvaluationsPostResponses = {
514
+ /**
515
+ * Successful Response
516
+ */
517
+ 200: EvaluationResult;
518
+ /**
519
+ * Evaluation in progress
520
+ */
521
+ 202: EvaluationResult;
522
+ };
523
+ export type CreateEvaluationV1EvaluationsPostResponse = CreateEvaluationV1EvaluationsPostResponses[keyof CreateEvaluationV1EvaluationsPostResponses];
524
+ export type RemoveEvaluationV1EvaluationsEvaluationIdDeleteData = {
525
+ body?: never;
526
+ path: {
527
+ /**
528
+ * Evaluation Id
529
+ */
530
+ evaluation_id: string;
531
+ };
532
+ query?: never;
533
+ url: '/v1/evaluations/{evaluation_id}';
534
+ };
535
+ export type RemoveEvaluationV1EvaluationsEvaluationIdDeleteErrors = {
536
+ /**
537
+ * Account authentication required
538
+ */
539
+ 401: ErrorResponse;
540
+ /**
541
+ * Evaluation not found
542
+ */
543
+ 404: ErrorResponse;
544
+ /**
545
+ * Invalid request
546
+ */
547
+ 422: ValidationResponse;
548
+ /**
549
+ * Unexpected server failure
550
+ */
551
+ 500: ErrorResponse;
552
+ /**
553
+ * Service unavailable
554
+ */
555
+ 503: ErrorResponse;
556
+ };
557
+ export type RemoveEvaluationV1EvaluationsEvaluationIdDeleteError = RemoveEvaluationV1EvaluationsEvaluationIdDeleteErrors[keyof RemoveEvaluationV1EvaluationsEvaluationIdDeleteErrors];
558
+ export type RemoveEvaluationV1EvaluationsEvaluationIdDeleteResponses = {
559
+ /**
560
+ * Successful Response
561
+ */
562
+ 204: void;
563
+ };
564
+ export type RemoveEvaluationV1EvaluationsEvaluationIdDeleteResponse = RemoveEvaluationV1EvaluationsEvaluationIdDeleteResponses[keyof RemoveEvaluationV1EvaluationsEvaluationIdDeleteResponses];
565
+ export type GetEvaluationV1EvaluationsEvaluationIdGetData = {
566
+ body?: never;
567
+ path: {
568
+ /**
569
+ * Evaluation Id
570
+ */
571
+ evaluation_id: string;
572
+ };
573
+ query?: never;
574
+ url: '/v1/evaluations/{evaluation_id}';
575
+ };
576
+ export type GetEvaluationV1EvaluationsEvaluationIdGetErrors = {
577
+ /**
578
+ * Account authentication required
579
+ */
580
+ 401: ErrorResponse;
581
+ /**
582
+ * Evaluation not found
583
+ */
584
+ 404: ErrorResponse;
585
+ /**
586
+ * Invalid request
587
+ */
588
+ 422: ValidationResponse;
589
+ /**
590
+ * Unexpected server failure
591
+ */
592
+ 500: ErrorResponse;
593
+ /**
594
+ * Service unavailable
595
+ */
596
+ 503: ErrorResponse;
597
+ };
598
+ export type GetEvaluationV1EvaluationsEvaluationIdGetError = GetEvaluationV1EvaluationsEvaluationIdGetErrors[keyof GetEvaluationV1EvaluationsEvaluationIdGetErrors];
599
+ export type GetEvaluationV1EvaluationsEvaluationIdGetResponses = {
600
+ /**
601
+ * Successful Response
602
+ */
603
+ 200: EvaluationResult;
604
+ };
605
+ export type GetEvaluationV1EvaluationsEvaluationIdGetResponse = GetEvaluationV1EvaluationsEvaluationIdGetResponses[keyof GetEvaluationV1EvaluationsEvaluationIdGetResponses];
@@ -0,0 +1,2 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ export {};
@@ -0,0 +1,46 @@
1
+ import type { EvaluationResult, EvaluationPage, DeviceCodeResponse, DeviceTokenResponse } from "./gen/types.gen.js";
2
+ export type { EvaluationResult as Evaluation, EvaluationPage, EvaluationReport, EvaluationSummary, CheckResult, ProseResult, PhraseResult, DeviceCodeResponse, DeviceTokenResponse, } from "./gen/types.gen.js";
3
+ /** Sanitized failure. status is null when no reliable HTTP answer arrived. */
4
+ export declare class ReadlintError extends Error {
5
+ readonly code: string;
6
+ readonly status: number | null;
7
+ readonly evaluationId: string | null;
8
+ readonly name = "ReadlintError";
9
+ constructor(code: string, message: string, status?: number | null, evaluationId?: string | null);
10
+ }
11
+ export interface ReadlintOptions {
12
+ apiKey?: string;
13
+ /** HTTPS origin; HTTP is allowed only on loopback for development. */
14
+ baseUrl?: string;
15
+ /** Deadline per attempt, including reading the body. Default: 120000 ms. */
16
+ timeoutMs?: number;
17
+ /** Retries for reads and idempotent submissions only. Default: 2. */
18
+ maxRetries?: number;
19
+ fetch?: typeof globalThis.fetch;
20
+ }
21
+ export interface EvaluateOptions {
22
+ /** Required: retain this key and identical article/options after a lost response. */
23
+ idempotencyKey: string;
24
+ title?: string | null;
25
+ description?: string;
26
+ }
27
+ /** Typed evaluation API and low-level device flow. The SDK transport uses native fetch. */
28
+ export declare class Readlint {
29
+ #private;
30
+ readonly baseUrl: string;
31
+ constructor(options?: ReadlintOptions);
32
+ evaluate(article: string, options: EvaluateOptions): Promise<EvaluationResult>;
33
+ listEvaluations(options?: {
34
+ limit?: number;
35
+ offset?: number;
36
+ }): Promise<EvaluationPage>;
37
+ getEvaluation(evaluationId: string): Promise<EvaluationResult>;
38
+ deleteEvaluation(evaluationId: string): Promise<void>;
39
+ /** Display verification_uri_complete, then poll no faster than interval. */
40
+ createDeviceCode(options?: {
41
+ hostname?: string;
42
+ os?: string;
43
+ }): Promise<DeviceCodeResponse>;
44
+ /** One poll only. Handle authorization_pending and slow_down explicitly. Never persisted by the SDK. */
45
+ createDeviceToken(deviceCode: string): Promise<DeviceTokenResponse>;
46
+ }