transloadit 5.2.0 → 6.0.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.
Files changed (73) hide show
  1. package/dist/Transloadit.d.ts +1 -1
  2. package/dist/Transloadit.d.ts.map +1 -1
  3. package/dist/Transloadit.js +1 -0
  4. package/dist/Transloadit.js.map +1 -1
  5. package/dist/alphalib/aiMessages.d.ts +1 -1
  6. package/dist/alphalib/aiMessages.d.ts.map +1 -1
  7. package/dist/alphalib/aiMessages.js +1 -1
  8. package/dist/alphalib/aiMessages.js.map +1 -1
  9. package/dist/alphalib/types/assemblyStatus.d.ts +682 -682
  10. package/dist/alphalib/types/assemblyStatus.d.ts.map +1 -1
  11. package/dist/alphalib/types/assemblyStatus.js +23 -14
  12. package/dist/alphalib/types/assemblyStatus.js.map +1 -1
  13. package/dist/alphalib/types/robots/_ai-models.d.ts.map +1 -1
  14. package/dist/alphalib/types/robots/_ai-models.js +2 -0
  15. package/dist/alphalib/types/robots/_ai-models.js.map +1 -1
  16. package/dist/alphalib/types/robots/_google-image-seed.d.ts +8 -0
  17. package/dist/alphalib/types/robots/_google-image-seed.d.ts.map +1 -0
  18. package/dist/alphalib/types/robots/_google-image-seed.js +12 -0
  19. package/dist/alphalib/types/robots/_google-image-seed.js.map +1 -0
  20. package/dist/alphalib/types/robots/_instructions-primitives.d.ts +2 -0
  21. package/dist/alphalib/types/robots/_instructions-primitives.d.ts.map +1 -1
  22. package/dist/alphalib/types/robots/_instructions-primitives.js +11 -14
  23. package/dist/alphalib/types/robots/_instructions-primitives.js.map +1 -1
  24. package/dist/alphalib/types/robots/ai-chat.d.ts +1 -1
  25. package/dist/alphalib/types/robots/ai-chat.d.ts.map +1 -1
  26. package/dist/alphalib/types/robots/ai-chat.js.map +1 -1
  27. package/dist/alphalib/types/robots/google-import.d.ts +4 -6
  28. package/dist/alphalib/types/robots/google-import.d.ts.map +1 -1
  29. package/dist/alphalib/types/robots/google-import.js +5 -2
  30. package/dist/alphalib/types/robots/google-import.js.map +1 -1
  31. package/dist/alphalib/types/robots/google-store.d.ts.map +1 -1
  32. package/dist/alphalib/types/robots/google-store.js +5 -13
  33. package/dist/alphalib/types/robots/google-store.js.map +1 -1
  34. package/dist/alphalib/types/robots/http-import.d.ts.map +1 -1
  35. package/dist/alphalib/types/robots/http-import.js +4 -0
  36. package/dist/alphalib/types/robots/http-import.js.map +1 -1
  37. package/dist/alphalib/types/robots/image-generate.d.ts.map +1 -1
  38. package/dist/alphalib/types/robots/image-generate.js +6 -1
  39. package/dist/alphalib/types/robots/image-generate.js.map +1 -1
  40. package/dist/alphalib/types/robots/image-resize.d.ts +4 -0
  41. package/dist/alphalib/types/robots/image-resize.d.ts.map +1 -1
  42. package/dist/alphalib/types/robots/image-resize.js +34 -6
  43. package/dist/alphalib/types/robots/image-resize.js.map +1 -1
  44. package/dist/alphalib/types/robots/s3-store.d.ts.map +1 -1
  45. package/dist/alphalib/types/robots/s3-store.js +21 -17
  46. package/dist/alphalib/types/robots/s3-store.js.map +1 -1
  47. package/dist/alphalib/types/robots/video-thumbs.d.ts +6 -0
  48. package/dist/alphalib/types/robots/video-thumbs.d.ts.map +1 -1
  49. package/dist/alphalib/types/robots/video-thumbs.js +15 -5
  50. package/dist/alphalib/types/robots/video-thumbs.js.map +1 -1
  51. package/dist/alphalib/zodParseWithContext.d.ts +1 -1
  52. package/dist/alphalib/zodParseWithContext.d.ts.map +1 -1
  53. package/dist/bearerToken.d.ts +2 -0
  54. package/dist/bearerToken.d.ts.map +1 -1
  55. package/dist/bearerToken.js +2 -0
  56. package/dist/bearerToken.js.map +1 -1
  57. package/package.json +1 -1
  58. package/src/Transloadit.ts +2 -1
  59. package/src/alphalib/aiMessages.ts +1 -1
  60. package/src/alphalib/types/assemblyStatus.ts +24 -14
  61. package/src/alphalib/types/robots/_ai-models.ts +2 -0
  62. package/src/alphalib/types/robots/_google-image-seed.ts +14 -0
  63. package/src/alphalib/types/robots/_instructions-primitives.ts +13 -15
  64. package/src/alphalib/types/robots/ai-chat.ts +6 -7
  65. package/src/alphalib/types/robots/google-import.ts +7 -1
  66. package/src/alphalib/types/robots/google-store.ts +6 -11
  67. package/src/alphalib/types/robots/http-import.ts +4 -0
  68. package/src/alphalib/types/robots/image-generate.ts +8 -1
  69. package/src/alphalib/types/robots/image-resize.ts +36 -6
  70. package/src/alphalib/types/robots/s3-store.ts +21 -17
  71. package/src/alphalib/types/robots/video-thumbs.ts +19 -5
  72. package/src/alphalib/zodParseWithContext.ts +1 -1
  73. package/src/bearerToken.ts +5 -0
@@ -38,48 +38,54 @@ export const robotS3StoreInstructionsSchema = robotBase
38
38
  .merge(robotUse)
39
39
  .merge(s3Base)
40
40
  .extend({
41
+ // URL rewriting does not fix bucket addressing, and custom paths need not use file.url_name.
42
+ // Keep the bucket warning separate from the old blanket filename-sanitization claim.
41
43
  robot: z.literal('/s3/store').describe(`
42
44
  If you are new to Amazon S3, see our tutorial on [using your own S3 bucket](/docs/faq/how-to-set-up-an-amazon-s3-bucket/).
43
45
 
44
- The URL to the result file in your S3 bucket will be returned in the <dfn>Assembly Status JSON</dfn>. If your S3 bucket has versioning enabled, the version ID of the file will be returned within \`meta.version_id\`
46
+ The URL to the result file in your S3 bucket will be returned in the <dfn>Assembly Status JSON</dfn>. A returned URL does not make a private object public or grant read access. If your S3 bucket has versioning enabled, the version ID of the file will be returned within \`meta.version_id\`.
45
47
 
46
48
  > [!Warning]
47
- > **Avoid permission errors.** By default, \`acl\` is set to \`"${s3StoreAclSchema.parse(undefined)}"\`. AWS S3 has a bucket setting called \`Block new public ACLs and uploading public objects\`. Set this to <strong>False</strong> in your bucket if you intend to leave \`acl\` as \`"${s3StoreAclSchema.parse(undefined)}"\`. Otherwise, you’ll receive permission errors in your Assemblies despite your S3 credentials being configured correctly.
49
+ > **Configure private buckets explicitly.** The Robot’s default \`acl\` is still \`"${s3StoreAclSchema.parse(undefined)}"\`. For a private bucket, set \`acl: "bucket-default"\` and do not supply ACL or grant headers. This omits the generated ACL header and works with [Bucket owner enforced Object Ownership](https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html), where ACLs are disabled. Keep S3 Block Public Access enabled. Setting \`acl: "private"\` still sends an ACL and is not equivalent to omitting it.
48
50
 
49
51
  > [!Warning]
50
- > **Use DNS-compliant bucket names.** Your bucket name [must be DNS-compliant](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html) and must not contain uppercase letters. Any non-alphanumeric characters in the file names will be replaced with an underscore, and spaces will be replaced with dashes. If your existing S3 bucket contains uppercase letters or is otherwise not DNS-compliant, rewrite the result URLs using the <dfn>Robot</dfn>’s \`url_prefix\` parameter.
52
+ > **Use DNS-compliant bucket names.** Follow AWS’s [bucket naming rules](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html). The \`url_prefix\` parameter changes returned URLs; it does not change the bucket or its access permissions.
51
53
 
52
54
  <span id="minimum-s3-iam-permissions" aria-hidden="true"></span>
53
55
 
54
56
  ## Limit access
55
57
 
56
- You will also need to add permissions to your bucket so that Transloadit can access it properly. Here is an example IAM policy that you can use. Following the [principle of least privilege](https://en.wikipedia.org/wiki/Principle_of_least_privilege), it contains the **minimum required permissions** to export a file to your S3 bucket using Transloadit. You may require more permissions (especially viewing permissions) depending on your application.
58
+ Use a dedicated AWS identity with access limited to the destination bucket and object prefix. Do not use [AWS root access keys](https://docs.aws.amazon.com/IAM/latest/UserGuide/root-user-best-practices.html). Store its access key ID, secret access key, bucket name and region as \`key\`, \`secret\`, \`bucket\` and \`bucket_region\` in <dfn>Template Credentials</dfn>, then reference their name with \`credentials\`. Trusted backend integrations can instead supply those parameters directly; do not expose AWS secrets in browser instructions.
57
59
 
58
- Please change \`{BUCKET_NAME}\` in the values for \`Sid\` and \`Resource\` accordingly. Also, this policy will grant the minimum required permissions to all your users. We advise you to create a separate Amazon IAM user, and use its User ARN (can be found in the "Summary" tab of a user [here](https://console.aws.amazon.com/iam/home#users)) for the \`Principal\` value. More information about this can be found [here](https://docs.aws.amazon.com/AmazonS3/latest/dev/AccessPolicyLanguage_UseCases_s3_a.html).
60
+ The following is an [identity-based IAM policy](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html), attached to that dedicated identity, not a bucket policy. It intentionally has no \`Principal\`. Replace \`{BUCKET_NAME}\` and use a Robot \`path\` beginning with \`uploads/\`, or adapt both the policy prefix and the path together.
61
+
62
+ This example covers uploads and failed multipart-upload cleanup with an explicit \`bucket_region\`, \`acl: "bucket-default"\`, no ACL/grant headers, no tags and S3-managed encryption (SSE-S3). Existing bucket policies, organization controls or endpoint policies can still deny access.
59
63
 
60
64
  \`\`\`json
61
65
  {
62
66
  "Version": "2012-10-17",
63
67
  "Statement": [
64
68
  {
65
- "Sid": "AllowTransloaditToStoreFilesIn{BUCKET_NAME}Bucket",
69
+ "Sid": "UploadAndAbortWithinPrefix",
66
70
  "Effect": "Allow",
67
- "Action": ["s3:GetBucketLocation", "s3:ListBucket", "s3:PutObject", "s3:PutObjectAcl"],
68
- "Resource": ["arn:aws:s3:::{BUCKET_NAME}", "arn:aws:s3:::{BUCKET_NAME}/*"]
71
+ "Action": ["s3:PutObject", "s3:AbortMultipartUpload"],
72
+ "Resource": "arn:aws:s3:::{BUCKET_NAME}/uploads/*"
69
73
  }
70
74
  ]
71
75
  }
72
76
  \`\`\`
73
77
 
74
- The \`Sid\` value is just an identifier for you to recognize the rule later. You can name it anything you like.
78
+ The uploader uses either \`PutObject\` or \`CreateMultipartUpload\`, \`UploadPart\` and \`CompleteMultipartUpload\`; failed multipart uploads can trigger \`AbortMultipartUpload\`. AWS maps the successful upload operations to \`s3:PutObject\`. Write access can **overwrite an existing object key**; it is not add-only. Choose unique object paths and consider versioning for recovery.
75
79
 
76
- The policy needs to be separated into two parts, because the \`ListBucket\` action requires permissions on the bucket while the other actions require permissions on the objects in the bucket. When targeting the objects there's a trailing slash and an asterisk in the \`Resource\` parameter, whereas when the policy targets the bucket, the slash and the asterisk are omitted.
80
+ Add permissions only for features you use, following AWS’s [operation permission reference](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-policy-actions.html):
77
81
 
78
- Please note that if you give the <dfn>Robot</dfn>'s \`acl\` parameter a value of \`"bucket-default"\`, then you do not need the \`"s3:PutObjectAcl"\` permission in your bucket policy.
82
+ - Without an explicit \`bucket_region\`, region discovery can require \`s3:GetBucketLocation\` and fallback \`s3:ListBucket\` on the bucket ARN, \`arn:aws:s3:::{BUCKET_NAME}\`, without an object suffix. Supplying the correct region avoids these discovery requests.
83
+ - ACL or grant headers require \`s3:PutObjectAcl\`; tags require \`s3:PutObjectTagging\` on the allowed object prefix. \`bucket-default\` does not remove ACL/grant headers you supply in \`headers\`.
84
+ - Downloading private results requires separate read authorization. Even a URL generated with \`sign_urls_for\` needs the signing identity to have the appropriate read permissions.
79
85
 
80
- In order to build proper result URLs we need to know the region in which your S3 bucket resides. For this we require the \`GetBucketLocation\` permission. Figuring out your bucket's region this way will also slow down your Assemblies. To make this much faster and to also not require the \`GetBucketLocation\` permission, we have added the \`bucket_region\` parameter to the /s3/store and /s3/import Robots. We recommend using them at all times.
86
+ S3 applies its [bucket encryption configuration](https://docs.aws.amazon.com/AmazonS3/latest/userguide/default-bucket-encryption.html) when no encryption override is sent. You can request SSE-KMS through \`headers\`, using \`x-amz-server-side-encryption: aws:kms\` and \`x-amz-server-side-encryption-aws-kms-key-id\`. When either bucket default encryption or request headers select [SSE-KMS](https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingKMSEncryption.html), the uploading identity needs \`kms:GenerateDataKey\` on the relevant key, plus \`kms:Decrypt\` for multipart uploads. For a customer-managed key, grant these permissions with a compatible KMS key policy; the base S3 policy above does not include them. Do not add blanket \`kms:*\` or \`sts:*\` grants.
81
87
 
82
- Please keep in mind that if you use bucket encryption you may also need to add \`"sts:*"\` and \`"kms:*"\` to the bucket policy. Please read [here](https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) and [here](https://aws.amazon.com/blogs/security/how-to-restrict-amazon-s3-bucket-access-to-a-specific-iam-role/) in case you run into trouble with our example bucket policy.
88
+ Short-lived AWS credentials are a matching set of \`key\`, \`secret\` and \`session_token\`. Have a trusted backend obtain and refresh all three, then supply them together when it creates the Assembly. It can pass them directly in Robot instructions or save and update them together through the [Template Credentials API](/docs/api/template-credentials-post/). Keep all three out of browser instructions; replacing only the session token does not refresh expired access keys. This Robot passes the supplied credentials to S3; it does not assume a role or refresh expired credentials. Keep temporary credentials valid for the upload.
83
89
  `),
84
90
  path: storeFilePath,
85
91
  url_prefix: z
@@ -89,9 +95,7 @@ Please keep in mind that if you use bucket encryption you may also need to add \
89
95
  The URL prefix used for the returned URL, such as \`"http://my.cdn.com/some/path/"\`.
90
96
  `),
91
97
  acl: s3StoreAclSchema.describe(`
92
- The permissions used for this file.
93
-
94
- Please keep in mind that the default value \`"${s3StoreAclSchema.parse(undefined)}"\` can lead to permission errors due to the \`"Block all public access"\` checkbox that is checked by default when creating a new Amazon S3 Bucket in the AWS console.
98
+ The ACL used for this file. The default remains \`"${s3StoreAclSchema.parse(undefined)}"\`, which can conflict with S3 Block Public Access and disabled ACLs. For modern private buckets, explicitly set \`"bucket-default"\` to omit the generated ACL header, and do not supply ACL/grant headers in \`headers\`. \`"private"\` still sends an ACL.
95
99
  `),
96
100
  check_integrity: z
97
101
  .boolean()
@@ -139,7 +143,7 @@ This parameter provides signed URLs in the result JSON (in the \`signed_url\` an
139
143
  .string()
140
144
  .optional()
141
145
  .describe(`
142
- The session token to use for the S3 store. This is only used if the credentials are from an IAM user with the \`sts:AssumeRole\` permission.
146
+ The session token belonging to the temporary AWS access key ID and secret access key supplied for this upload. The Robot does not assume a role or refresh these credentials; they must remain valid for the upload.
143
147
  `),
144
148
  })
145
149
  .strict()
@@ -1,3 +1,4 @@
1
+ import type { MODEL_CAPABILITIES } from './_ai-models.ts'
1
2
  import type {
2
3
  RobotDefinition,
3
4
  RobotMetaInput,
@@ -22,6 +23,15 @@ import {
22
23
  /** Markup over the AI provider cost for smart thumbnail selection. */
23
24
  export const smartThumbnailMarkupPercent = 50
24
25
 
26
+ /** Dedicated vision model so /ai/chat default upgrades do not change thumbnail analysis costs. */
27
+ export const smartThumbnailModel = 'openai/gpt-5.4-mini' satisfies keyof typeof MODEL_CAPABILITIES
28
+
29
+ /** Maximum long-side dimension of scoring previews; returned thumbnails keep their output size. */
30
+ export const smartThumbnailAnalysisMaxSize = 512
31
+
32
+ /** Frame ranking needs little reasoning compared with general-purpose chat. */
33
+ export const smartThumbnailReasoningEffort = 'low'
34
+
25
35
  const thumbnailCountSchema = z.number().int().min(1).max(999).default(8)
26
36
  const smartMaximumCandidatesSchema = z.number().int().min(2).max(100).default(20)
27
37
  const defaultThumbnailCount = thumbnailCountSchema.parse(undefined)
@@ -58,13 +68,15 @@ export const robotVideoThumbsInstructionsSchema = robotBase
58
68
  .merge(robotFFmpeg)
59
69
  .extend({
60
70
  robot: z.literal('/video/thumbs').describe(`
61
- Set \`smart: true\` to select strong preview images with AI instead of taking frames only at regular intervals. The Robot scores candidate frames for clarity, brightness, composition, faces, expressions, action, and visual interest, then returns the best \`count\` frames in chronological order. Smart results include \`file.meta.smart_score\` and \`file.meta.smart_reasons\`. If AI scoring is unavailable, the Assembly continues with the candidate frames in fallback order. No AI credentials are required.
71
+ Set \`smart: true\` to select strong preview images with AI instead of taking frames only at regular intervals. The Robot scores candidate frames for clarity, brightness, composition, faces, expressions, action, and visual interest, then returns the best \`count\` frames in chronological order. Smart results include \`file.meta.smart_score\` and \`file.meta.smart_reasons\`. If AI scoring is unavailable, the Assembly continues with the candidate frames in fallback order and includes a warning. No AI credentials are required.
62
72
 
63
73
  ## AI pricing
64
74
 
65
- Regular \`/video/thumbs\` processing charges still apply. AI frame analysis is billed separately at the underlying provider cost plus a ${smartThumbnailMarkupPercent}% Transloadit markup. The exact AI charge varies with the number of candidate frames, the internally selected model and provider pricing, and the image payload size.
75
+ Regular \`/video/thumbs\` processing charges still apply. AI frame analysis is billed separately at the underlying provider cost plus a ${smartThumbnailMarkupPercent}% Transloadit markup. Smart selection uses the dedicated \`${smartThumbnailModel}\` vision model with \`${smartThumbnailReasoningEffort}\` reasoning, independently of the \`/ai/chat\` default. The exact AI charge varies with the number of candidate frames and provider pricing.
66
76
 
67
- \`smart_max_candidates\` is the main cost and latency control. The Robot analyzes up to three candidates per requested thumbnail, capped by \`smart_max_candidates\`, but never fewer than \`count\`. With the defaults of \`count: ${defaultThumbnailCount}\` and \`smart_max_candidates: ${defaultSmartMaximumCandidates}\`, it analyzes ${getSmartThumbnailCandidateCount(defaultThumbnailCount, defaultSmartMaximumCandidates)} frames and returns the best ${defaultThumbnailCount}. Lower the candidate limit to reduce AI cost and latency; raise it to give the AI more frames to choose from.
77
+ The AI scores preview copies capped at ${smartThumbnailAnalysisMaxSize} pixels on the long side, preserving aspect ratio and without enlarging smaller images. Returned thumbnails keep the requested output dimensions and format; larger outputs do not increase the scoring preview beyond this limit.
78
+
79
+ \`smart_max_candidates\` is the main cost and latency control. The Robot analyzes up to three candidates per requested thumbnail, capped by \`smart_max_candidates\`, but never fewer than \`count\`. With the defaults of \`count: ${defaultThumbnailCount}\` and \`smart_max_candidates: ${defaultSmartMaximumCandidates}\`, it analyzes ${getSmartThumbnailCandidateCount(defaultThumbnailCount, defaultSmartMaximumCandidates)} frames and returns the best ${defaultThumbnailCount}. Lower the candidate limit to reduce AI cost and latency. Raising it can enlarge the pool up to three times \`count\`; higher limits have no effect.
68
80
 
69
81
  > [!Note]
70
82
  > Use \`count\` with smart selection. To consistently extract exact timestamps with \`offsets\`, set \`smart: false\`.
@@ -146,17 +158,19 @@ The AI evaluates frames based on:
146
158
  - Action and motion (avoiding transition frames)
147
159
  - Overall visual interest
148
160
 
149
- Regular \`/video/thumbs\` processing charges still apply. AI frame analysis is billed separately at the underlying provider cost plus a ${smartThumbnailMarkupPercent}% Transloadit markup. You do not need to provide AI credentials.
161
+ Regular \`/video/thumbs\` processing charges still apply. AI frame analysis uses a dedicated low-cost vision model with \`${smartThumbnailReasoningEffort}\` reasoning and preview copies capped at ${smartThumbnailAnalysisMaxSize} pixels on the long side. Returned thumbnails retain their requested dimensions and format. Analysis is billed separately at the underlying provider cost plus a ${smartThumbnailMarkupPercent}% Transloadit markup. You do not need to provide AI credentials.
150
162
 
151
163
  Smart mode generates its own regularly spaced candidate timestamps; use \`smart: false\` with \`offsets\` when you need specified timestamps. Selected smart thumbnails are returned in chronological order, not score order. Inspect \`meta.thumb_offset\`, \`meta.smart_score\`, and \`meta.smart_reasons\` when evaluating the selection.
152
164
 
153
- If AI scoring fails, the Robot selects from the extracted candidates in chronological order and records a fallback reason. If no candidates can be extracted, it attempts standard thumbnail extraction. A completed Assembly does not guarantee a representative or publication-safe poster; check that outputs exist and apply your application’s review policy.
165
+ If AI scoring fails, the Robot selects extracted candidates in chronological order and records a fallback reason. With no candidates, it attempts standard extraction. Both fallbacks add an Assembly warning. A completed Assembly does not guarantee a representative or publication-safe poster; check that outputs exist and apply your application’s review policy.
154
166
  `),
155
167
  smart_max_candidates: smartMaximumCandidatesSchema.describe(`
156
168
  The maximum size of the candidate pool when \`smart\` is \`true\`. The Robot analyzes up to three candidates per requested thumbnail, capped by this value, but it will never analyze fewer candidates than the requested \`count\`.
157
169
 
158
170
  A higher number may yield better results but increases processing time and AI cost. With the defaults of \`count: ${defaultThumbnailCount}\` and \`smart_max_candidates: ${defaultSmartMaximumCandidates}\`, the Robot analyzes ${getSmartThumbnailCandidateCount(defaultThumbnailCount, defaultSmartMaximumCandidates)} frames and returns the best ${defaultThumbnailCount} in chronological order.
159
171
 
172
+ Raising this limit above three times \`count\` does not enlarge the pool. For example, \`count: 1\` analyzes at most three candidates.
173
+
160
174
  This parameter is only used when \`smart\` is \`true\`.
161
175
  `),
162
176
  })
@@ -1,4 +1,4 @@
1
- import type { z } from 'zod'
1
+ import type { z } from 'zod/v3'
2
2
 
3
3
  export type ZodIssueWithContext = z.ZodIssue & {
4
4
  parentObj: unknown
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod'
2
2
 
3
+ import packageJson from '../package.json' with { type: 'json' }
4
+
3
5
  export type BearerTokenAudience = 'mcp' | 'api2' | (string & {})
4
6
 
5
7
  export type BearerTokenResponse = {
@@ -11,6 +13,8 @@ export type BearerTokenResponse = {
11
13
 
12
14
  export type MintBearerTokenOptions = {
13
15
  allowProcessEnvEndpointFallback?: boolean
16
+ /** Client identity reported in the Transloadit-Client header. */
17
+ clientName?: string
14
18
  endpoint?: string
15
19
  aud?: BearerTokenAudience | string
16
20
  /**
@@ -158,6 +162,7 @@ export async function mintBearerTokenWithCredentials(
158
162
  Authorization: buildBasicAuthHeaderValue(credentials),
159
163
  Accept: 'application/json',
160
164
  'Content-Type': 'application/x-www-form-urlencoded',
165
+ 'Transloadit-Client': options.clientName?.trim() || `node-sdk:${packageJson.version}`,
161
166
  },
162
167
  body: params.toString(),
163
168
  })