@sudobility/whisperly_types 1.0.24 → 1.0.25
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/dist/index.cjs +13 -2
- package/dist/index.d.ts +350 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9,7 +9,13 @@ exports.errorResponse = errorResponse;
|
|
|
9
9
|
// =============================================================================
|
|
10
10
|
// Response Helper Functions
|
|
11
11
|
// =============================================================================
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Create a standardized success response wrapping the given data.
|
|
14
|
+
*
|
|
15
|
+
* @template T - The type of the response data
|
|
16
|
+
* @param data - The response payload
|
|
17
|
+
* @returns A {@link BaseResponse} with `success: true` and an ISO 8601 timestamp
|
|
18
|
+
*/
|
|
13
19
|
function successResponse(data) {
|
|
14
20
|
return {
|
|
15
21
|
success: true,
|
|
@@ -17,7 +23,12 @@ function successResponse(data) {
|
|
|
17
23
|
timestamp: new Date().toISOString(),
|
|
18
24
|
};
|
|
19
25
|
}
|
|
20
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Create a standardized error response with the given error message.
|
|
28
|
+
*
|
|
29
|
+
* @param error - A human-readable error message describing what went wrong
|
|
30
|
+
* @returns A {@link BaseResponse} with `success: false` and an ISO 8601 timestamp
|
|
31
|
+
*/
|
|
21
32
|
function errorResponse(error) {
|
|
22
33
|
return {
|
|
23
34
|
success: false,
|
package/dist/index.d.ts
CHANGED
|
@@ -4,182 +4,494 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export type { ApiResponse, BaseResponse, NetworkClient, Optional, PaginatedResponse, PaginationInfo, PaginationOptions, } from '@sudobility/types';
|
|
6
6
|
import type { Optional, BaseResponse } from '@sudobility/types';
|
|
7
|
+
/**
|
|
8
|
+
* A string representing a date/time in ISO 8601 format.
|
|
9
|
+
*
|
|
10
|
+
* Expected format: `"YYYY-MM-DDTHH:mm:ss.sssZ"` (e.g., `"2024-01-15T12:00:00.000Z"`).
|
|
11
|
+
* For date-only fields, the format is `"YYYY-MM-DD"` (e.g., `"2024-01-15"`).
|
|
12
|
+
*
|
|
13
|
+
* This is a type alias for `string` and is fully compatible with plain string assignments.
|
|
14
|
+
* It serves as documentation to indicate that the value should conform to ISO 8601.
|
|
15
|
+
*/
|
|
16
|
+
export type ISODateString = string;
|
|
17
|
+
/**
|
|
18
|
+
* Subscription tier levels that determine rate limits and feature access.
|
|
19
|
+
*
|
|
20
|
+
* - `"free"` - Free tier with basic limits
|
|
21
|
+
* - `"starter"` - Starter tier with increased limits
|
|
22
|
+
* - `"pro"` - Professional tier with high limits
|
|
23
|
+
* - `"enterprise"` - Enterprise tier with custom limits
|
|
24
|
+
*/
|
|
25
|
+
export type RateLimitTier = 'free' | 'starter' | 'pro' | 'enterprise';
|
|
26
|
+
/**
|
|
27
|
+
* Represents a Whisperly platform user, mapped from Firebase Authentication.
|
|
28
|
+
*
|
|
29
|
+
* The primary key is {@link User.firebase_uid | firebase_uid}, which corresponds
|
|
30
|
+
* to the Firebase Auth UID. Users are created upon first sign-in.
|
|
31
|
+
*/
|
|
7
32
|
export interface User {
|
|
33
|
+
/** Primary key. Firebase Authentication UID for this user. */
|
|
8
34
|
firebase_uid: string;
|
|
35
|
+
/** User's email address from Firebase Auth. Null if not provided. */
|
|
9
36
|
email: string | null;
|
|
37
|
+
/** User's display name from Firebase Auth. Null if not provided. */
|
|
10
38
|
display_name: string | null;
|
|
39
|
+
/** Timestamp when the user record was created. Null if not yet persisted. */
|
|
11
40
|
created_at: Date | null;
|
|
41
|
+
/** Timestamp when the user record was last updated. Null if never updated. */
|
|
12
42
|
updated_at: Date | null;
|
|
13
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* User-level settings, primarily for organization/entity configuration.
|
|
46
|
+
*
|
|
47
|
+
* Each user can have multiple settings records for different organizations.
|
|
48
|
+
* The {@link UserSettings.firebase_uid | firebase_uid} links back to the {@link User}.
|
|
49
|
+
*/
|
|
14
50
|
export interface UserSettings {
|
|
51
|
+
/** Primary key. Auto-generated unique identifier. Null before persistence. */
|
|
15
52
|
id: string | null;
|
|
53
|
+
/** Foreign key referencing {@link User.firebase_uid}. */
|
|
16
54
|
firebase_uid: string;
|
|
55
|
+
/** Display name for the organization. Null if not set. */
|
|
17
56
|
organization_name: string | null;
|
|
57
|
+
/**
|
|
58
|
+
* URL-safe path/slug for the organization.
|
|
59
|
+
* @deprecated Legacy field for personal organization paths. Will be replaced by entity-based routing.
|
|
60
|
+
*/
|
|
18
61
|
organization_path: string;
|
|
62
|
+
/** Whether this is the user's default organization/settings. */
|
|
19
63
|
is_default: boolean;
|
|
64
|
+
/** Timestamp when the settings record was created. Null if not yet persisted. */
|
|
20
65
|
created_at: Date | null;
|
|
66
|
+
/** Timestamp when the settings record was last updated. Null if never updated. */
|
|
21
67
|
updated_at: Date | null;
|
|
22
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* A localization project within an entity/organization.
|
|
71
|
+
*
|
|
72
|
+
* Projects are the primary organizational unit for translations. Each project
|
|
73
|
+
* has its own API key, language configuration, and dictionaries.
|
|
74
|
+
*
|
|
75
|
+
* Primary key: {@link Project.id | id}. Scoped to an entity via {@link Project.entity_id | entity_id}.
|
|
76
|
+
*/
|
|
23
77
|
export interface Project {
|
|
78
|
+
/** Primary key. Auto-generated unique identifier. */
|
|
24
79
|
id: string;
|
|
80
|
+
/** Foreign key referencing the owning entity/organization. */
|
|
25
81
|
entity_id: string;
|
|
82
|
+
/** URL-safe machine name for the project (e.g., "my-app"). Used in API routes. */
|
|
26
83
|
project_name: string;
|
|
84
|
+
/** Human-readable display name for the project (e.g., "My Application"). */
|
|
27
85
|
display_name: string;
|
|
86
|
+
/** Optional project description. Null if not provided. */
|
|
28
87
|
description: string | null;
|
|
88
|
+
/** Optional translation instructions/context provided to the translation service. Null if not set. */
|
|
29
89
|
instructions: string | null;
|
|
90
|
+
/** Default source language code (e.g., "en"). Null if auto-detect is used. */
|
|
30
91
|
default_source_language: string | null;
|
|
92
|
+
/** Default target language codes (e.g., ["ja", "es"]). Null if not configured. */
|
|
31
93
|
default_target_languages: string[] | null;
|
|
94
|
+
/** List of allowed IP addresses for API access. Null if unrestricted. */
|
|
32
95
|
ip_allowlist: string[] | null;
|
|
96
|
+
/** API key for authenticating translation requests. Null if not yet generated. */
|
|
33
97
|
api_key: string | null;
|
|
98
|
+
/** Whether the project is active and accepting requests. Null treated as active. */
|
|
34
99
|
is_active: boolean | null;
|
|
100
|
+
/** Timestamp when the project was created. Null if not yet persisted. */
|
|
35
101
|
created_at: Date | null;
|
|
102
|
+
/** Timestamp when the project was last updated. Null if never updated. */
|
|
36
103
|
updated_at: Date | null;
|
|
37
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* A dictionary container within a project, holding translation term entries.
|
|
107
|
+
*
|
|
108
|
+
* Each project has one dictionary that contains {@link DictionaryEntry} records
|
|
109
|
+
* for term-level translation overrides.
|
|
110
|
+
*
|
|
111
|
+
* Primary key: {@link Dictionary.id | id}. Scoped to a project via {@link Dictionary.project_id | project_id}.
|
|
112
|
+
*/
|
|
38
113
|
export interface Dictionary {
|
|
114
|
+
/** Primary key. Auto-generated unique identifier. */
|
|
39
115
|
id: string;
|
|
116
|
+
/** Foreign key referencing the owning entity/organization. */
|
|
40
117
|
entity_id: string;
|
|
118
|
+
/** Foreign key referencing the parent {@link Project}. */
|
|
41
119
|
project_id: string;
|
|
120
|
+
/** Timestamp when the dictionary was created. Null if not yet persisted. */
|
|
42
121
|
created_at: Date | null;
|
|
122
|
+
/** Timestamp when the dictionary was last updated. Null if never updated. */
|
|
43
123
|
updated_at: Date | null;
|
|
44
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* An individual translation entry within a {@link Dictionary}.
|
|
127
|
+
*
|
|
128
|
+
* Each entry represents a single term in a single language. Multiple entries
|
|
129
|
+
* with the same dictionary form a complete set of translations for a term.
|
|
130
|
+
*
|
|
131
|
+
* Primary key: {@link DictionaryEntry.id | id}.
|
|
132
|
+
*/
|
|
45
133
|
export interface DictionaryEntry {
|
|
134
|
+
/** Primary key. Auto-generated unique identifier. */
|
|
46
135
|
id: string;
|
|
136
|
+
/** Foreign key referencing the parent {@link Dictionary}. */
|
|
47
137
|
dictionary_id: string;
|
|
138
|
+
/** ISO 639-1 language code (e.g., "en", "ja", "es"). */
|
|
48
139
|
language_code: string;
|
|
140
|
+
/** The translated text for this language. */
|
|
49
141
|
text: string;
|
|
142
|
+
/** Timestamp when the entry was created. Null if not yet persisted. */
|
|
50
143
|
created_at: Date | null;
|
|
144
|
+
/** Timestamp when the entry was last updated. Null if never updated. */
|
|
51
145
|
updated_at: Date | null;
|
|
52
146
|
}
|
|
53
|
-
/**
|
|
147
|
+
/**
|
|
148
|
+
* Flattened dictionary translations mapping language codes to translated text.
|
|
149
|
+
*
|
|
150
|
+
* Used as the payload format for dictionary create/update operations.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```typescript
|
|
154
|
+
* const translations: DictionaryTranslations = {
|
|
155
|
+
* "en": "hello",
|
|
156
|
+
* "es": "hola",
|
|
157
|
+
* "ja": "\u3053\u3093\u306b\u3061\u306f"
|
|
158
|
+
* };
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
54
161
|
export type DictionaryTranslations = Record<string, string>;
|
|
162
|
+
/**
|
|
163
|
+
* A single usage/analytics record tracking a translation API request.
|
|
164
|
+
*
|
|
165
|
+
* Primary key: {@link UsageRecord.uuid | uuid}. Scoped to an entity and project.
|
|
166
|
+
*/
|
|
55
167
|
export interface UsageRecord {
|
|
168
|
+
/** Primary key. UUID for this usage record. */
|
|
56
169
|
uuid: string;
|
|
170
|
+
/** Foreign key referencing the entity/organization that made the request. */
|
|
57
171
|
entity_id: string;
|
|
172
|
+
/** Foreign key referencing the {@link Project} the request was made against. */
|
|
58
173
|
project_id: string;
|
|
174
|
+
/** Timestamp when the API request occurred. */
|
|
59
175
|
timestamp: Date;
|
|
176
|
+
/** Number of translation requests in this record (typically 1). */
|
|
60
177
|
request_count: number;
|
|
178
|
+
/** Number of individual strings translated. */
|
|
61
179
|
string_count: number;
|
|
180
|
+
/** Total character count across all translated strings. */
|
|
62
181
|
character_count: number;
|
|
182
|
+
/** Whether the translation request was successful. */
|
|
63
183
|
success: boolean;
|
|
184
|
+
/** Error message if the request failed. Null on success. */
|
|
64
185
|
error_message: string | null;
|
|
65
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Request body for creating a new user.
|
|
189
|
+
*
|
|
190
|
+
* The {@link UserCreateRequest.firebase_uid | firebase_uid} is required and must match
|
|
191
|
+
* the authenticated Firebase user.
|
|
192
|
+
*/
|
|
66
193
|
export interface UserCreateRequest {
|
|
194
|
+
/** Firebase Authentication UID. Must match the authenticated user. */
|
|
67
195
|
firebase_uid: string;
|
|
196
|
+
/** User's email address. */
|
|
68
197
|
email: Optional<string>;
|
|
198
|
+
/** User's display name. */
|
|
69
199
|
display_name: Optional<string>;
|
|
70
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Request body for updating an existing user's profile.
|
|
203
|
+
*
|
|
204
|
+
* All fields are optional; only provided fields will be updated.
|
|
205
|
+
*/
|
|
71
206
|
export interface UserUpdateRequest {
|
|
207
|
+
/** Updated email address. */
|
|
72
208
|
email: Optional<string>;
|
|
209
|
+
/** Updated display name. */
|
|
73
210
|
display_name: Optional<string>;
|
|
74
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* Request body for updating user settings (organization configuration).
|
|
214
|
+
*
|
|
215
|
+
* All fields are optional; only provided fields will be updated.
|
|
216
|
+
*/
|
|
75
217
|
export interface UserSettingsUpdateRequest {
|
|
218
|
+
/** Updated organization display name. */
|
|
76
219
|
organization_name: Optional<string>;
|
|
220
|
+
/**
|
|
221
|
+
* Updated organization URL path/slug.
|
|
222
|
+
* @deprecated Legacy field. Will be replaced by entity-based routing.
|
|
223
|
+
*/
|
|
77
224
|
organization_path: Optional<string>;
|
|
78
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Request body for creating a new project.
|
|
228
|
+
*
|
|
229
|
+
* {@link ProjectCreateRequest.project_name | project_name} and
|
|
230
|
+
* {@link ProjectCreateRequest.display_name | display_name} are required.
|
|
231
|
+
* All other fields are optional.
|
|
232
|
+
*/
|
|
79
233
|
export interface ProjectCreateRequest {
|
|
234
|
+
/** URL-safe machine name for the project. Must be unique within the entity. */
|
|
80
235
|
project_name: string;
|
|
236
|
+
/** Human-readable display name for the project. */
|
|
81
237
|
display_name: string;
|
|
238
|
+
/** Optional project description. */
|
|
82
239
|
description: Optional<string>;
|
|
240
|
+
/** Optional translation instructions/context for the translation service. */
|
|
83
241
|
instructions: Optional<string>;
|
|
242
|
+
/** Default source language code (e.g., "en"). Omit for auto-detection. */
|
|
84
243
|
default_source_language: Optional<string>;
|
|
244
|
+
/** Default target language codes (e.g., ["ja", "es"]). */
|
|
85
245
|
default_target_languages: Optional<string[]>;
|
|
246
|
+
/** List of allowed IP addresses for API access. Omit for unrestricted. */
|
|
86
247
|
ip_allowlist: Optional<string[]>;
|
|
87
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* Request body for updating an existing project.
|
|
251
|
+
*
|
|
252
|
+
* All fields are optional; only provided fields will be updated.
|
|
253
|
+
* Fields that accept `null` can be explicitly cleared.
|
|
254
|
+
*/
|
|
88
255
|
export interface ProjectUpdateRequest {
|
|
256
|
+
/** Updated URL-safe machine name. */
|
|
89
257
|
project_name: Optional<string>;
|
|
258
|
+
/** Updated human-readable display name. */
|
|
90
259
|
display_name: Optional<string>;
|
|
260
|
+
/** Updated description. Pass `null` to clear. */
|
|
91
261
|
description: Optional<string>;
|
|
262
|
+
/** Updated translation instructions. Pass `null` to clear. */
|
|
92
263
|
instructions: Optional<string>;
|
|
264
|
+
/** Updated default source language. Pass `null` to clear (auto-detect). */
|
|
93
265
|
default_source_language: Optional<string | null>;
|
|
266
|
+
/** Updated default target languages. Pass `null` to clear. */
|
|
94
267
|
default_target_languages: Optional<string[] | null>;
|
|
268
|
+
/** Updated IP allowlist. Pass `null` to remove restrictions. */
|
|
95
269
|
ip_allowlist: Optional<string[] | null>;
|
|
270
|
+
/** Updated API key. Pass `null` to revoke. */
|
|
96
271
|
api_key: Optional<string | null>;
|
|
272
|
+
/** Whether the project should be active. */
|
|
97
273
|
is_active: Optional<boolean>;
|
|
98
274
|
}
|
|
275
|
+
/**
|
|
276
|
+
* Request body for creating dictionary translations.
|
|
277
|
+
* Accepts a direct `{ language_code: text }` mapping, not wrapped in an envelope.
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```typescript
|
|
281
|
+
* const request: DictionaryCreateRequest = { "en": "hello", "es": "hola" };
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
99
284
|
export type DictionaryCreateRequest = DictionaryTranslations;
|
|
285
|
+
/**
|
|
286
|
+
* Request body for updating dictionary translations.
|
|
287
|
+
* Accepts a direct `{ language_code: text }` mapping, not wrapped in an envelope.
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* ```typescript
|
|
291
|
+
* const request: DictionaryUpdateRequest = { "en": "goodbye", "es": "adi\u00f3s" };
|
|
292
|
+
* ```
|
|
293
|
+
*/
|
|
100
294
|
export type DictionaryUpdateRequest = DictionaryTranslations;
|
|
295
|
+
/**
|
|
296
|
+
* Query parameters for listing projects.
|
|
297
|
+
*
|
|
298
|
+
* All parameters are passed as query string values (strings), not typed booleans.
|
|
299
|
+
*/
|
|
101
300
|
export interface ProjectQueryParams {
|
|
301
|
+
/** Filter by active status. Pass `"true"` or `"false"` as a string. */
|
|
102
302
|
is_active: Optional<string>;
|
|
103
303
|
}
|
|
304
|
+
/**
|
|
305
|
+
* Query parameters for usage analytics endpoints.
|
|
306
|
+
*
|
|
307
|
+
* All parameters are passed as query string values. Date fields should be
|
|
308
|
+
* in `"YYYY-MM-DD"` format (e.g., `"2024-01-01"`). When both `start_date`
|
|
309
|
+
* and `end_date` are provided, the range is inclusive on both ends.
|
|
310
|
+
*/
|
|
104
311
|
export interface UsageAnalyticsQueryParams {
|
|
312
|
+
/** Filter analytics to a specific project by ID. */
|
|
105
313
|
project_id: Optional<string>;
|
|
314
|
+
/** Start date filter in `"YYYY-MM-DD"` format (inclusive). */
|
|
106
315
|
start_date: Optional<string>;
|
|
316
|
+
/** End date filter in `"YYYY-MM-DD"` format (inclusive). */
|
|
107
317
|
end_date: Optional<string>;
|
|
318
|
+
/** Filter by success status. Pass `"true"` or `"false"` as a string. */
|
|
108
319
|
success: Optional<string>;
|
|
109
320
|
}
|
|
321
|
+
/**
|
|
322
|
+
* Request body for the translation API endpoint.
|
|
323
|
+
*
|
|
324
|
+
* Submits one or more strings for translation into the specified target languages.
|
|
325
|
+
*/
|
|
110
326
|
export interface TranslationRequest {
|
|
327
|
+
/** Array of text strings to translate. Must contain at least one string. */
|
|
111
328
|
strings: string[];
|
|
329
|
+
/** Array of target ISO 639-1 language codes (e.g., ["ja", "es"]). Must contain at least one. */
|
|
112
330
|
target_languages: string[];
|
|
331
|
+
/** Source language code. If omitted, the source language is auto-detected. */
|
|
113
332
|
source_language: Optional<string>;
|
|
114
333
|
/** Skip dictionary term matching/replacement. Set to true when translating dictionary entries. */
|
|
115
334
|
skip_dictionaries?: boolean;
|
|
116
335
|
}
|
|
336
|
+
/**
|
|
337
|
+
* Response from the translation API endpoint.
|
|
338
|
+
*
|
|
339
|
+
* Contains translations organized by target language, with each language
|
|
340
|
+
* mapping to an array of translated strings in the same order as the input.
|
|
341
|
+
*/
|
|
117
342
|
export interface TranslationResponse {
|
|
343
|
+
/** Translations keyed by target language code. Each value is an array matching the input `strings` order. */
|
|
118
344
|
translations: Record<string, string[]>;
|
|
345
|
+
/** List of dictionary terms that were matched and used during translation. */
|
|
119
346
|
dictionary_terms_used: string[];
|
|
347
|
+
/** Unique identifier for this translation request, used for tracking and debugging. */
|
|
120
348
|
request_id: string;
|
|
121
349
|
}
|
|
350
|
+
/**
|
|
351
|
+
* Request parameters for the dictionary lookup callback endpoint.
|
|
352
|
+
*
|
|
353
|
+
* Used by the external translation service to look up dictionary terms via GET request.
|
|
354
|
+
*/
|
|
122
355
|
export interface DictionaryLookupRequest {
|
|
356
|
+
/** The term to look up in the dictionary. */
|
|
123
357
|
term: string;
|
|
358
|
+
/** Comma-separated list of language codes to look up (e.g., "ja,es,fr"). */
|
|
124
359
|
languages: string;
|
|
125
360
|
}
|
|
361
|
+
/**
|
|
362
|
+
* Response from the dictionary lookup callback endpoint.
|
|
363
|
+
*
|
|
364
|
+
* Returns the term and its translations in each requested language.
|
|
365
|
+
* Languages without a translation return `null`.
|
|
366
|
+
*/
|
|
126
367
|
export interface DictionaryLookupResponse {
|
|
368
|
+
/** The term that was looked up. */
|
|
127
369
|
term: string;
|
|
370
|
+
/** Translations keyed by language code. `null` if no translation exists for that language. */
|
|
128
371
|
translations: Record<string, string | null>;
|
|
129
372
|
}
|
|
373
|
+
/**
|
|
374
|
+
* Response from the dictionary search endpoint.
|
|
375
|
+
*
|
|
376
|
+
* Returns the dictionary ID and all translations for a matched term.
|
|
377
|
+
*/
|
|
130
378
|
export interface DictionarySearchResponse {
|
|
379
|
+
/** The ID of the dictionary containing the matched term. */
|
|
131
380
|
dictionary_id: string;
|
|
381
|
+
/** All translations for the matched term, keyed by language code. */
|
|
132
382
|
translations: DictionaryTranslations;
|
|
133
383
|
}
|
|
384
|
+
/**
|
|
385
|
+
* Aggregate usage statistics for a given time period.
|
|
386
|
+
*
|
|
387
|
+
* Provides totals, success/failure breakdowns, and the period boundaries.
|
|
388
|
+
*/
|
|
134
389
|
export interface UsageAggregate {
|
|
390
|
+
/** Total number of translation requests in the period. */
|
|
135
391
|
total_requests: number;
|
|
392
|
+
/** Total number of individual strings translated. */
|
|
136
393
|
total_strings: number;
|
|
394
|
+
/** Total character count across all translated strings. */
|
|
137
395
|
total_characters: number;
|
|
396
|
+
/** Number of successful translation requests. */
|
|
138
397
|
successful_requests: number;
|
|
398
|
+
/** Number of failed translation requests. */
|
|
139
399
|
failed_requests: number;
|
|
400
|
+
/** Success rate as a decimal between 0 and 1 (e.g., 0.95 = 95%). */
|
|
140
401
|
success_rate: number;
|
|
141
|
-
|
|
142
|
-
|
|
402
|
+
/** Start of the analytics period in ISO 8601 date format (e.g., "2024-01-01"). */
|
|
403
|
+
period_start: ISODateString;
|
|
404
|
+
/** End of the analytics period in ISO 8601 date format (e.g., "2024-01-31"). */
|
|
405
|
+
period_end: ISODateString;
|
|
143
406
|
}
|
|
407
|
+
/**
|
|
408
|
+
* Usage statistics broken down by project.
|
|
409
|
+
*/
|
|
144
410
|
export interface UsageByProject {
|
|
411
|
+
/** The project ID. */
|
|
145
412
|
project_id: string;
|
|
413
|
+
/** The project's machine name. */
|
|
146
414
|
project_name: string;
|
|
415
|
+
/** Number of translation requests for this project. */
|
|
147
416
|
request_count: number;
|
|
417
|
+
/** Number of individual strings translated for this project. */
|
|
148
418
|
string_count: number;
|
|
419
|
+
/** Total character count for this project. */
|
|
149
420
|
character_count: number;
|
|
421
|
+
/** Success rate as a decimal between 0 and 1. */
|
|
150
422
|
success_rate: number;
|
|
151
423
|
}
|
|
424
|
+
/**
|
|
425
|
+
* Usage statistics broken down by date.
|
|
426
|
+
*/
|
|
152
427
|
export interface UsageByDate {
|
|
153
|
-
date
|
|
428
|
+
/** The date in ISO 8601 date format (e.g., "2024-01-15"). */
|
|
429
|
+
date: ISODateString;
|
|
430
|
+
/** Number of translation requests on this date. */
|
|
154
431
|
request_count: number;
|
|
432
|
+
/** Number of individual strings translated on this date. */
|
|
155
433
|
string_count: number;
|
|
434
|
+
/** Total character count on this date. */
|
|
156
435
|
character_count: number;
|
|
157
436
|
}
|
|
437
|
+
/**
|
|
438
|
+
* Complete analytics response containing aggregate, per-project, and per-date breakdowns.
|
|
439
|
+
*/
|
|
158
440
|
export interface AnalyticsResponse {
|
|
441
|
+
/** Overall aggregate statistics for the queried period. */
|
|
159
442
|
aggregate: UsageAggregate;
|
|
443
|
+
/** Usage breakdown by project. */
|
|
160
444
|
by_project: UsageByProject[];
|
|
445
|
+
/** Usage breakdown by date. */
|
|
161
446
|
by_date: UsageByDate[];
|
|
162
447
|
}
|
|
448
|
+
/**
|
|
449
|
+
* Represents a supported language with its display metadata.
|
|
450
|
+
*/
|
|
163
451
|
export interface AvailableLanguage {
|
|
452
|
+
/** ISO 639-1 language code (e.g., "en", "ja"). */
|
|
164
453
|
language_code: string;
|
|
454
|
+
/** Human-readable language name (e.g., "English", "Japanese"). */
|
|
165
455
|
language: string;
|
|
456
|
+
/** Flag emoji for the language (e.g., "\uD83C\uDDFA\uD83C\uDDF8", "\uD83C\uDDEF\uD83C\uDDF5"). */
|
|
166
457
|
flag: string;
|
|
167
458
|
}
|
|
459
|
+
/**
|
|
460
|
+
* Response containing a project's configured languages.
|
|
461
|
+
*/
|
|
168
462
|
export interface ProjectLanguagesResponse {
|
|
463
|
+
/** The project ID. */
|
|
169
464
|
project_id: string;
|
|
465
|
+
/** Comma-separated list of language codes (e.g., "en,zh,ja"). */
|
|
170
466
|
languages: string;
|
|
171
467
|
}
|
|
468
|
+
/**
|
|
469
|
+
* Current rate limit status for an entity/organization.
|
|
470
|
+
*
|
|
471
|
+
* Provides monthly and hourly limit information along with current usage
|
|
472
|
+
* and reset timestamps.
|
|
473
|
+
*/
|
|
172
474
|
export interface RateLimitStatus {
|
|
173
|
-
tier
|
|
475
|
+
/** The subscription tier determining rate limits. */
|
|
476
|
+
tier: RateLimitTier;
|
|
477
|
+
/** Maximum number of requests allowed per month. */
|
|
174
478
|
monthly_limit: number;
|
|
479
|
+
/** Number of requests used this month. */
|
|
175
480
|
monthly_used: number;
|
|
481
|
+
/** Number of requests remaining this month. Can be 0 when limit is reached. */
|
|
176
482
|
monthly_remaining: number;
|
|
483
|
+
/** Maximum number of requests allowed per hour. */
|
|
177
484
|
hourly_limit: number;
|
|
485
|
+
/** Number of requests used this hour. */
|
|
178
486
|
hourly_used: number;
|
|
487
|
+
/** Number of requests remaining this hour. Can be 0 when limit is reached. */
|
|
179
488
|
hourly_remaining: number;
|
|
489
|
+
/** Timestamps indicating when rate limits reset. */
|
|
180
490
|
resets_at: {
|
|
181
|
-
monthly:
|
|
182
|
-
|
|
491
|
+
/** ISO 8601 timestamp when the monthly counter resets (e.g., "2024-02-01T00:00:00Z"). */
|
|
492
|
+
monthly: ISODateString;
|
|
493
|
+
/** ISO 8601 timestamp when the hourly counter resets (e.g., "2024-01-15T15:00:00Z"). */
|
|
494
|
+
hourly: ISODateString;
|
|
183
495
|
};
|
|
184
496
|
}
|
|
185
497
|
/** Request payload for external translation service */
|
|
@@ -202,25 +514,54 @@ export interface TranslationServiceResponse {
|
|
|
202
514
|
/** Detected source language code */
|
|
203
515
|
detected_source_language?: string;
|
|
204
516
|
}
|
|
205
|
-
/**
|
|
517
|
+
/**
|
|
518
|
+
* Create a standardized success response wrapping the given data.
|
|
519
|
+
*
|
|
520
|
+
* @template T - The type of the response data
|
|
521
|
+
* @param data - The response payload
|
|
522
|
+
* @returns A {@link BaseResponse} with `success: true` and an ISO 8601 timestamp
|
|
523
|
+
*/
|
|
206
524
|
export declare function successResponse<T>(data: T): BaseResponse<T>;
|
|
207
|
-
/**
|
|
525
|
+
/**
|
|
526
|
+
* Create a standardized error response with the given error message.
|
|
527
|
+
*
|
|
528
|
+
* @param error - A human-readable error message describing what went wrong
|
|
529
|
+
* @returns A {@link BaseResponse} with `success: false` and an ISO 8601 timestamp
|
|
530
|
+
*/
|
|
208
531
|
export declare function errorResponse(error: string): BaseResponse<never>;
|
|
532
|
+
/** API response containing an array of {@link Project} objects. */
|
|
209
533
|
export type ProjectListResponse = BaseResponse<Project[]>;
|
|
534
|
+
/** API response containing a single {@link Project}. */
|
|
210
535
|
export type ProjectResponse = BaseResponse<Project>;
|
|
536
|
+
/** API response containing {@link UserSettings}. */
|
|
211
537
|
export type UserSettingsResponse = BaseResponse<UserSettings>;
|
|
538
|
+
/** API response containing {@link RateLimitStatus}. */
|
|
212
539
|
export type RateLimitResponse = BaseResponse<RateLimitStatus>;
|
|
540
|
+
/** API response containing {@link DictionaryTranslations}. */
|
|
213
541
|
export type DictionaryResponse = BaseResponse<DictionaryTranslations>;
|
|
542
|
+
/** API response containing a {@link DictionarySearchResponse}. */
|
|
214
543
|
export type DictionarySearchApiResponse = BaseResponse<DictionarySearchResponse>;
|
|
544
|
+
/** API response containing a {@link DictionaryLookupResponse}. */
|
|
215
545
|
export type DictionaryLookupApiResponse = BaseResponse<DictionaryLookupResponse>;
|
|
546
|
+
/** API response containing an {@link AnalyticsResponse}. */
|
|
216
547
|
export type AnalyticsApiResponse = BaseResponse<AnalyticsResponse>;
|
|
548
|
+
/** API response containing a {@link TranslationResponse}. */
|
|
217
549
|
export type TranslationApiResponse = BaseResponse<TranslationResponse>;
|
|
550
|
+
/** API response containing an array of {@link AvailableLanguage} objects. */
|
|
218
551
|
export type AvailableLanguagesApiResponse = BaseResponse<AvailableLanguage[]>;
|
|
552
|
+
/** API response containing a {@link ProjectLanguagesResponse}. */
|
|
219
553
|
export type ProjectLanguagesApiResponse = BaseResponse<ProjectLanguagesResponse>;
|
|
554
|
+
/** API response containing {@link HealthCheckData}. */
|
|
220
555
|
export type HealthCheckResponse = BaseResponse<HealthCheckData>;
|
|
556
|
+
/**
|
|
557
|
+
* Health check endpoint data indicating API status.
|
|
558
|
+
*/
|
|
221
559
|
export interface HealthCheckData {
|
|
560
|
+
/** The API service name (e.g., "whisperly-api"). */
|
|
222
561
|
name: string;
|
|
562
|
+
/** The API version string (e.g., "1.0.0"). */
|
|
223
563
|
version: string;
|
|
564
|
+
/** Current health status (e.g., "healthy", "degraded", "unhealthy"). */
|
|
224
565
|
status: string;
|
|
225
566
|
}
|
|
226
567
|
//# 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":"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AC9D,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAAC,sBAAsB,CAAC,CAAC;AAEtE,kEAAkE;AAClE,MAAM,MAAM,2BAA2B,GAAG,YAAY,CAAC,wBAAwB,CAAC,CAAC;AAEjF,kEAAkE;AAClE,MAAM,MAAM,2BAA2B,GAAG,YAAY,CAAC,wBAAwB,CAAC,CAAC;AAEjF,4DAA4D;AAC5D,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,iBAAiB,CAAC,CAAC;AAEnE,6DAA6D;AAC7D,MAAM,MAAM,sBAAsB,GAAG,YAAY,CAAC,mBAAmB,CAAC,CAAC;AAEvE,6EAA6E;AAC7E,MAAM,MAAM,6BAA6B,GAAG,YAAY,CAAC,iBAAiB,EAAE,CAAC,CAAC;AAE9E,kEAAkE;AAClE,MAAM,MAAM,2BAA2B,GAAG,YAAY,CAAC,wBAAwB,CAAC,CAAC;AAEjF,uDAAuD;AACvD,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC;AAMhE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,13 @@ exports.errorResponse = errorResponse;
|
|
|
9
9
|
// =============================================================================
|
|
10
10
|
// Response Helper Functions
|
|
11
11
|
// =============================================================================
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Create a standardized success response wrapping the given data.
|
|
14
|
+
*
|
|
15
|
+
* @template T - The type of the response data
|
|
16
|
+
* @param data - The response payload
|
|
17
|
+
* @returns A {@link BaseResponse} with `success: true` and an ISO 8601 timestamp
|
|
18
|
+
*/
|
|
13
19
|
function successResponse(data) {
|
|
14
20
|
return {
|
|
15
21
|
success: true,
|
|
@@ -17,7 +23,12 @@ function successResponse(data) {
|
|
|
17
23
|
timestamp: new Date().toISOString(),
|
|
18
24
|
};
|
|
19
25
|
}
|
|
20
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Create a standardized error response with the given error message.
|
|
28
|
+
*
|
|
29
|
+
* @param error - A human-readable error message describing what went wrong
|
|
30
|
+
* @returns A {@link BaseResponse} with `success: false` and an ISO 8601 timestamp
|
|
31
|
+
*/
|
|
21
32
|
function errorResponse(error) {
|
|
22
33
|
return {
|
|
23
34
|
success: false,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAwmBH,0CAMC;AAQD,sCAMC;AA/BD,gFAAgF;AAChF,4BAA4B;AAC5B,gFAAgF;AAEhF;;;;;;GAMG;AACH,SAAgB,eAAe,CAAI,IAAO;IACxC,OAAO;QACL,OAAO,EAAE,IAAI;QACb,IAAI;QACJ,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,KAAa;IACzC,OAAO;QACL,OAAO,EAAE,KAAK;QACd,KAAK;QACL,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC;AACJ,CAAC"}
|