@tailor-platform/function-types 0.8.4 → 0.9.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @tailor-platform/function-types
2
2
 
3
+ ## 0.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#178](https://github.com/tailor-platform/function/pull/178) [`1b2e22b`](https://github.com/tailor-platform/function/commit/1b2e22b6f9895fd25df353a4680fb2bd6465b9b7) Thanks [@haru0017](https://github.com/haru0017)! - Add `downloadStream` and `uploadStream` types to `TailorDBFileAPI`. Mark `openDownloadStream` as deprecated.
8
+
9
+ ## 0.8.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [#169](https://github.com/tailor-platform/function/pull/169) [`eb7a92d`](https://github.com/tailor-platform/function/commit/eb7a92d424d6d6dbc5c55559d2f21e5bcb4b5aec) Thanks [@remiposo](https://github.com/remiposo)! - Add `tailor.context` namespace with `getInvoker()` for retrieving information about the invoker of the current function execution
14
+
3
15
  ## 0.8.4
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/function-types",
3
- "version": "0.8.4",
3
+ "version": "0.9.0",
4
4
  "description": "TypeScript types for Tailor Platform Function service",
5
5
  "repository": {
6
6
  "type": "git",
package/tailor.d.ts CHANGED
@@ -166,6 +166,14 @@ interface FileUploadOptions {
166
166
  contentType?: string;
167
167
  }
168
168
 
169
+ /**
170
+ * Upload stream options interface
171
+ */
172
+ interface FileUploadStreamOptions {
173
+ contentType?: string;
174
+ fileSize?: number;
175
+ }
176
+
169
177
  /**
170
178
  * Upload response interface
171
179
  */
@@ -189,6 +197,14 @@ interface FileDownloadAsBase64Response {
189
197
  metadata: DownloadMetadata;
190
198
  }
191
199
 
200
+ /**
201
+ * Download stream response interface
202
+ */
203
+ interface FileDownloadStreamResponse {
204
+ body: ReadableStream<Uint8Array>;
205
+ metadata: DownloadMetadata;
206
+ }
207
+
192
208
  /**
193
209
  * Stream chunk types
194
210
  */
@@ -223,7 +239,7 @@ interface TailorDBFileAPI {
223
239
 
224
240
  /**
225
241
  * Download a file from TailorDB
226
- * @throws {TailorDBFileError} FILE_TOO_LARGE if file exceeds 10MB - use openDownloadStream() for large files
242
+ * @throws {TailorDBFileError} FILE_TOO_LARGE if file exceeds 10MB - use downloadStream() for large files
227
243
  */
228
244
  download(
229
245
  namespace: string,
@@ -237,7 +253,7 @@ interface TailorDBFileAPI {
237
253
  * Unlike download which returns decoded binary data (Uint8Array),
238
254
  * this returns the raw Base64-encoded string for use cases requiring
239
255
  * 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
256
+ * @throws {TailorDBFileError} FILE_TOO_LARGE if file exceeds 10MB - use downloadStream() for large files
241
257
  */
242
258
  downloadAsBase64(
243
259
  namespace: string,
@@ -268,6 +284,7 @@ interface TailorDBFileAPI {
268
284
 
269
285
  /**
270
286
  * Open a download stream for large files
287
+ * @deprecated Use downloadStream() instead
271
288
  */
272
289
  openDownloadStream(
273
290
  namespace: string,
@@ -275,6 +292,28 @@ interface TailorDBFileAPI {
275
292
  fieldName: string,
276
293
  recordId: string
277
294
  ): Promise<FileStreamIterator>;
295
+
296
+ /**
297
+ * Download a file as a ReadableStream
298
+ */
299
+ downloadStream(
300
+ namespace: string,
301
+ typeName: string,
302
+ fieldName: string,
303
+ recordId: string
304
+ ): Promise<FileDownloadStreamResponse>;
305
+
306
+ /**
307
+ * Upload a file using a ReadableStream
308
+ */
309
+ uploadStream(
310
+ namespace: string,
311
+ typeName: string,
312
+ fieldName: string,
313
+ recordId: string,
314
+ readableStream: ReadableStream<Uint8Array | ArrayBuffer>,
315
+ options?: FileUploadStreamOptions
316
+ ): Promise<FileUploadResponse>;
278
317
  }
279
318
 
280
319
  declare namespace tailor.idp {
@@ -495,4 +534,28 @@ declare namespace tailor.workflow {
495
534
  key: string,
496
535
  callback: (waitPayload: any) => any
497
536
  ): Promise<void>;
498
- }
537
+ }
538
+
539
+ declare namespace tailor.context {
540
+ /**
541
+ * Information about the invoker of the current function execution.
542
+ */
543
+ interface Invoker {
544
+ /** The invoker's ID */
545
+ id: string;
546
+ /** The invoker's type */
547
+ type: "user" | "machine_user";
548
+ /** The workspace ID */
549
+ workspaceId: string;
550
+ /** The invoker's attribute IDs */
551
+ attributes: string[];
552
+ /** The invoker's attribute map */
553
+ attributeMap: Record<string, unknown>;
554
+ }
555
+
556
+ /**
557
+ * Returns information about the invoker of the current function execution,
558
+ * or `null` for anonymous invocations.
559
+ */
560
+ function getInvoker(): Invoker | null;
561
+ }