@tailor-platform/function-types 0.7.2 → 0.8.1

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @tailor-platform/function-types
2
2
 
3
+ ## 0.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#128](https://github.com/tailor-platform/function/pull/128) [`84ce6ba`](https://github.com/tailor-platform/function/commit/84ce6ba209e0c7bf51d0646ecfdcc32403904da6) Thanks [@k1LoW](https://github.com/k1LoW)! - feat: Add tailor.idp namespace type definitions
8
+
3
9
  ## 0.7.2
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/function-types",
3
- "version": "0.7.2",
3
+ "version": "0.8.1",
4
4
  "description": "TypeScript types for Tailor Platform Function service",
5
5
  "repository": {
6
6
  "type": "git",
package/tailor.d.ts CHANGED
@@ -117,7 +117,7 @@ declare namespace tailor.iconv {
117
117
  */
118
118
  declare class TailorDBFileError extends Error {
119
119
  name: 'TailorDBFileError';
120
- code?: 'INVALID_PARAMS' | 'INVALID_DATA_TYPE' | 'OPERATION_FAILED' | 'DELETE_FAILED' | 'STREAM_OPEN_FAILED' | 'STREAM_READ_ERROR' | 'STREAM_ERROR';
120
+ code?: 'INVALID_PARAMS' | 'INVALID_DATA_TYPE' | 'OPERATION_FAILED' | 'DELETE_FAILED' | 'STREAM_OPEN_FAILED' | 'STREAM_READ_ERROR' | 'STREAM_ERROR' | 'FILE_TOO_LARGE';
121
121
  cause?: unknown;
122
122
  }
123
123
 
@@ -135,6 +135,8 @@ interface UploadMetadata {
135
135
  interface DownloadMetadata {
136
136
  contentType: string;
137
137
  fileSize: number;
138
+ sha256sum: string;
139
+ lastUploadedAt: string;
138
140
  }
139
141
 
140
142
  /**
@@ -179,6 +181,14 @@ interface FileDownloadResponse {
179
181
  metadata: DownloadMetadata;
180
182
  }
181
183
 
184
+ /**
185
+ * Download as Base64 response interface
186
+ */
187
+ interface FileDownloadAsBase64Response {
188
+ data: string;
189
+ metadata: DownloadMetadata;
190
+ }
191
+
182
192
  /**
183
193
  * Stream chunk types
184
194
  */
@@ -213,6 +223,7 @@ interface TailorDBFileAPI {
213
223
 
214
224
  /**
215
225
  * Download a file from TailorDB
226
+ * @throws {TailorDBFileError} FILE_TOO_LARGE if file exceeds 10MB - use openDownloadStream() for large files
216
227
  */
217
228
  download(
218
229
  namespace: string,
@@ -221,6 +232,20 @@ interface TailorDBFileAPI {
221
232
  recordId: string
222
233
  ): Promise<FileDownloadResponse>;
223
234
 
235
+ /**
236
+ * Download a file from TailorDB as Base64 string
237
+ * Unlike download which returns decoded binary data (Uint8Array),
238
+ * this returns the raw Base64-encoded string for use cases requiring
239
+ * Base64 format (e.g., embedding in JSON responses, data URIs)
240
+ * @throws {TailorDBFileError} FILE_TOO_LARGE if file exceeds 10MB - use openDownloadStream() for large files
241
+ */
242
+ downloadAsBase64(
243
+ namespace: string,
244
+ typeName: string,
245
+ fieldName: string,
246
+ recordId: string
247
+ ): Promise<FileDownloadAsBase64Response>;
248
+
224
249
  /**
225
250
  * Delete a file from TailorDB
226
251
  */
@@ -252,6 +277,132 @@ interface TailorDBFileAPI {
252
277
  ): Promise<FileStreamIterator>;
253
278
  }
254
279
 
280
+ declare namespace tailor.idp {
281
+ /**
282
+ * Configuration for creating an IDP Client
283
+ */
284
+ interface ClientConfig {
285
+ namespace: string;
286
+ }
287
+
288
+ /**
289
+ * User object returned from IDP operations
290
+ */
291
+ interface User {
292
+ id: string;
293
+ name: string;
294
+ disabled: boolean;
295
+ createdAt?: string;
296
+ updatedAt?: string;
297
+ }
298
+
299
+ /**
300
+ * Query options for filtering users
301
+ */
302
+ interface UserQuery {
303
+ /** Filter by user IDs */
304
+ ids?: string[];
305
+ /** Filter by user names */
306
+ names?: string[];
307
+ }
308
+
309
+ /**
310
+ * Options for listing users
311
+ */
312
+ interface ListUsersOptions {
313
+ /** Maximum number of users to return */
314
+ first?: number;
315
+ /** Page token for pagination */
316
+ after?: string;
317
+ /** Query filter for users */
318
+ query?: UserQuery;
319
+ }
320
+
321
+ /**
322
+ * Response from listing users
323
+ */
324
+ interface ListUsersResponse {
325
+ users: User[];
326
+ nextPageToken: string | null;
327
+ totalCount: number;
328
+ }
329
+
330
+ /**
331
+ * Input for creating a new user
332
+ */
333
+ interface CreateUserInput {
334
+ /** The user's name (typically email) */
335
+ name: string;
336
+ /** The user's password */
337
+ password: string;
338
+ /** Whether the user is disabled */
339
+ disabled?: boolean;
340
+ }
341
+
342
+ /**
343
+ * Input for updating an existing user
344
+ */
345
+ interface UpdateUserInput {
346
+ /** The user's ID */
347
+ id: string;
348
+ /** New name for the user */
349
+ name?: string;
350
+ /** New password for the user */
351
+ password?: string;
352
+ /** New disabled status for the user */
353
+ disabled?: boolean;
354
+ }
355
+
356
+ /**
357
+ * Input for sending a password reset email
358
+ */
359
+ interface SendPasswordResetEmailInput {
360
+ /** The ID of the user */
361
+ userId: string;
362
+ /** The URI to redirect to after password reset */
363
+ redirectUri: string;
364
+ }
365
+
366
+ /**
367
+ * IDP Client for user management operations
368
+ */
369
+ class Client {
370
+ constructor(config: ClientConfig);
371
+
372
+ /**
373
+ * List users in the namespace with optional filtering and pagination.
374
+ */
375
+ users(options?: ListUsersOptions): Promise<ListUsersResponse>;
376
+
377
+ /**
378
+ * Get a user by ID.
379
+ */
380
+ user(userId: string): Promise<User>;
381
+
382
+ /**
383
+ * Create a new user.
384
+ */
385
+ createUser(input: CreateUserInput): Promise<User>;
386
+
387
+ /**
388
+ * Update an existing user.
389
+ */
390
+ updateUser(input: UpdateUserInput): Promise<User>;
391
+
392
+ /**
393
+ * Delete a user by ID.
394
+ * @returns True if successful
395
+ */
396
+ deleteUser(userId: string): Promise<boolean>;
397
+
398
+ /**
399
+ * Send a password reset email to a user.
400
+ * @returns True if successful
401
+ */
402
+ sendPasswordResetEmail(input: SendPasswordResetEmailInput): Promise<boolean>;
403
+ }
404
+ }
405
+
255
406
  declare namespace tailor.workflow {
256
407
  /**
257
408
  * Specifies the machine user that should be used to execute the workflow.