Skip to content

Commit 754fa87

Browse files
authored
Sync alphalib 2025 07 30 (#245)
* w * Update document-split.ts
1 parent e12d173 commit 754fa87

File tree

9 files changed

+37
-32
lines changed

9 files changed

+37
-32
lines changed

src/alphalib/types/robots/_instructions-primitives.ts

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,9 @@ export function interpolateRecursive<Schema extends z.ZodFirstPartySchemaTypes>(
323323
def,
324324
) as InterpolatableSchema<Schema>
325325
case z.ZodFirstPartyTypeKind.ZodNullable:
326-
return interpolateRecursive(def.innerType).nullable() as InterpolatableSchema<Schema>
326+
return interpolateRecursive(def.innerType)
327+
.nullable()
328+
.describe(def.description) as InterpolatableSchema<Schema>
327329
case z.ZodFirstPartyTypeKind.ZodObject: {
328330
const replacement = z.object(
329331
Object.fromEntries(
@@ -354,18 +356,18 @@ export function interpolateRecursive<Schema extends z.ZodFirstPartySchemaTypes>(
354356
case z.ZodFirstPartyTypeKind.ZodString:
355357
return z.union([interpolationSchemaPartial, schema], def) as InterpolatableSchema<Schema>
356358
case z.ZodFirstPartyTypeKind.ZodTuple: {
357-
const tuple = z.tuple(def.items.map(interpolateRecursive))
359+
const tuple = z.tuple(def.items.map(interpolateRecursive), def)
358360

359361
return z.union([
360362
interpolationSchemaFull,
361363
def.rest ? tuple.rest(def.rest) : tuple,
362364
]) as InterpolatableSchema<Schema>
363365
}
364366
case z.ZodFirstPartyTypeKind.ZodUnion:
365-
return z.union([
366-
interpolationSchemaFull,
367-
...(def.options.map(interpolateRecursive) as z.ZodUnionOptions),
368-
]) as InterpolatableSchema<Schema>
367+
return z.union(
368+
[interpolationSchemaFull, ...(def.options.map(interpolateRecursive) as z.ZodUnionOptions)],
369+
def,
370+
) as InterpolatableSchema<Schema>
369371
default:
370372
return schema as InterpolatableSchema<Schema>
371373
}
@@ -438,14 +440,14 @@ You can also set this to \`false\` to skip metadata extraction and speed up tran
438440
`Setting the queue to 'batch', manually downgrades the priority of jobs for this step to avoid consuming Priority job slots for jobs that don't need zero queue waiting times`,
439441
),
440442

441-
force_accept: z.boolean().default(false).describe(`
442-
Force a Robot to accept a file type it would have ignored.
443+
force_accept: z.boolean().default(false)
444+
.describe(`Force a Robot to accept a file type it would have ignored.
443445
444-
By default Robots ignore files they are not familiar with.
445-
[🤖/video/encode](https://transloadit.com/docs/robots/video-encode/), for
446+
By default, Robots ignore files they are not familiar with.
447+
[🤖/video/encode](/docs/robots/video-encode/), for
446448
example, will happily ignore input images.
447449
448-
With the force_accept parameter set to true you can force Robots to accept all files thrown at them.
450+
With the \`force_accept\` parameter set to \`true\`, you can force Robots to accept all files thrown at them.
449451
This will typically lead to errors and should only be used for debugging or combatting edge cases.
450452
`),
451453
})
@@ -1167,9 +1169,9 @@ Go back to your Google credentials project and enable the "Google Cloud Storage
11671169
11681170
Now you can set up the \`storage.objects.create\` and \`storage.objects.delete\` permissions. The latter is optional and only required if you intend to overwrite existing paths.
11691171
1170-
To do this from the Google Cloud console, navigate to "IAM &amp; Admin" and select "Roles". From here, select "+CREATE ROLE", enter a name, set the role launch stage as general availability and set the permissions stated above.
1172+
To do this from the Google Cloud console, navigate to "IAM &amp; Admin" and select "Roles". From here, click "Create Role", enter a name, set the role launch stage to _General availability,_ and set the permissions stated above.
11711173
1172-
Next, relocate to your storage browser and select the ellipsis on your bucket to edit bucket permissions. From here, select "ADD MEMBER", enter your service account as a new member and select your newly created role.
1174+
Next, go to Storage browser and select the ellipsis on your bucket to edit bucket permissions. From here, select "Add Member", enter your service account as a new member, and select your newly created role.
11731175
11741176
Then, create your associated [Template Credentials](/c/template-credentials/) in your Transloadit account and use the name of your <dfn>Template Credentials</dfn> as this parameter's value.
11751177
`),
@@ -1348,30 +1350,32 @@ export const filterCondition = z.union([
13481350
export const videoEncodeSpecificInstructionsSchema = robotFFmpegVideo
13491351
.extend({
13501352
resize_strategy: resize_strategy.describe(`
1351-
See the [available resize strategies](/docs/robots/image-resize/#resize-strategies).
1353+
See the [available resize strategies](/docs/topics/resize-strategies/).
13521354
`),
13531355
zoom: z.boolean().default(true).describe(`
1354-
If this is set to \`false\`, smaller videos will not be stretched to the desired width and height. For details about the impact of zooming for your preferred resize strategy, see the list of available [resize strategies](/docs/robots/image-resize/#resize-strategies).
1356+
If this is set to \`false\`, smaller videos will not be stretched to the desired width and height. For details about the impact of zooming for your preferred resize strategy, see the list of available [resize strategies](/docs/topics/resize-strategies/).
13551357
`),
13561358
crop: unsafeCoordinatesSchema.optional().describe(`
13571359
Specify an object containing coordinates for the top left and bottom right corners of the rectangle to be cropped from the original video(s). Values can be integers for absolute pixel values or strings for percentage based values.
13581360
13591361
For example:
13601362
13611363
\`\`\`json
1362-
13631364
{
13641365
"x1": 80,
13651366
"y1": 100,
13661367
"x2": "60%",
13671368
"y2": "80%"
13681369
}
1369-
13701370
\`\`\`
13711371
13721372
This will crop the area from \`(80, 100)\` to \`(600, 800)\` from a 1000×1000 pixels video, which is a square whose width is 520px and height is 700px. If \`crop\` is set, the width and height parameters are ignored, and the \`resize_strategy\` is set to \`crop\` automatically.
13731373
1374-
You can also use a JSON string of such an object with coordinates in similar fashion: \`"{ "x1": <Integer>, "y1": <Integer>, "x2": <Integer>, "y2": <Integer> }"\`
1374+
You can also use a JSON string of such an object with coordinates in similar fashion:
1375+
1376+
\`\`\`json
1377+
"{\\"x1\\": <Integer>, \\"y1\\": <Integer>, \\"x2\\": <Integer>, \\"y2\\": <Integer>}"
1378+
\`\`\`
13751379
`),
13761380
background: color_with_alpha.default('#00000000').describe(`
13771381
The background color of the resulting video the \`"rrggbbaa"\` format (red, green, blue, alpha) when used with the \`"pad"\` resize strategy. The default color is black.
@@ -1400,7 +1404,7 @@ Splits the video into multiple chunks so that each chunk can be encoded in paral
14001404
Allows you to specify the duration of each chunk when \`turbo\` is set to \`true\`. This means you can take advantage of that feature while using fewer <dfn>Priority Job Slots</dfn>. For instance, the longer each chunk is, the fewer <dfn>Encoding Jobs</dfn> will need to be used.
14011405
`),
14021406
watermark_url: z.string().default('').describe(`
1403-
A URL indicating a PNG image to be overlaid above this image. You can also [supply the watermark via another Assembly Step](/docs/robots/video-encode/#watermark-parameters-video-encode).
1407+
A URL indicating a PNG image to be overlaid above this image. You can also [supply the watermark via another Assembly Step](/docs/topics/use-parameter/#supplying-the-watermark-via-an-assembly-step).
14041408
`),
14051409
watermark_position: z.union([positionSchema, z.array(positionSchema)]).default('center')
14061410
.describe(`

src/alphalib/types/robots/document-split.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ export const robotDocumentSplitInstructionsSchema = robotBase
3838
pages: z
3939
.union([z.string(), z.array(z.string())])
4040
.describe(
41-
'The pages to select from the input PDF and to be included in the output PDF. Each entry can be a single page number (e.g. 5), or a range (e.g. `5-10`). Page numbers start at 1.',
42-
),
41+
'The pages to select from the input PDF and to be included in the output PDF. Each entry can be a single page number (e.g. 5), or a range (e.g. `5-10`). Page numbers start at 1. By default all pages are extracted.',
42+
)
43+
.optional(),
4344
})
4445
.strict()
4546

src/alphalib/types/robots/document-thumbs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Height of the new image, in pixels. If not specified, will default to the height
8181
`),
8282
resize_strategy: z.enum(['crop', 'fillcrop', 'fit', 'min_fit', 'pad', 'stretch']).default('pad')
8383
.describe(`
84-
One of the [available resize strategies](/docs/robots/image-resize/#resize-strategies).
84+
One of the [available resize strategies](/docs/topics/resize-strategies/).
8585
`),
8686
// TODO: Determine the allowed colors
8787
background: z.string().default('#FFFFFF').describe(`

src/alphalib/types/robots/file-preview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Height of the thumbnail, in pixels.
7575
resize_strategy: resize_strategy.describe(`
7676
To achieve the desired dimensions of the preview thumbnail, the <dfn>Robot</dfn> might have to resize the generated image. This happens, for example, when the dimensions of a frame extracted from a video do not match the chosen \`width\` and \`height\` parameters.
7777
78-
See the list of available [resize strategies](/docs/robots/image-resize/#resize-strategies) for more details.
78+
See the list of available [resize strategies](/docs/topics/resize-strategies/) for more details.
7979
`),
8080
background: color_with_alpha.default('#ffffffff').describe(`
8181
The hexadecimal code of the color used to fill the background (only used for the pad resize strategy). The format is \`#rrggbb[aa]\` (red, green, blue, alpha). Use \`#00000000\` for a transparent padding.

src/alphalib/types/robots/google-store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ Go back to your Google credentials project and enable the "Google Cloud Storage
5959
6060
Now you can set up the \`storage.objects.create\` and \`storage.objects.delete\` permissions. The latter is optional and only required if you intend to overwrite existing paths.
6161
62-
To do this from the Google Cloud console, navigate to "IAM &amp; Admin" and select "Roles". From here, select "+CREATE ROLE", enter a name, set the role launch stage as general availability and set the permissions stated above.
62+
To do this from the Google Cloud console, navigate to "IAM &amp; Admin" and select "Roles". From here, click "Create Role", enter a name, set the role launch stage to _General availability,_ and set the permissions stated above.
6363
64-
Next, relocate to your storage browser and select the ellipsis on your bucket to edit bucket permissions. From here, select "ADD MEMBER", enter your service account as a new member and select your newly created role.
64+
Next, go to Storage browser and select the ellipsis on your bucket to edit bucket permissions. From here, select "Add Member", enter your service account as a new member, and select your newly created role.
6565
6666
Then, create your associated [Template Credentials](/c/template-credentials/) in your Transloadit account and use the name of your <dfn>Template Credentials</dfn> as this parameter's value.
6767
`),

src/alphalib/types/robots/image-resize.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ In this example, the background color is determined by the [Assembly Variable](h
105105
),
106106
])
107107
.default('fit').describe(`
108-
See the list of available [resize strategies](/docs/robots/image-resize/#resize-strategies).
108+
See the list of available [resize strategies](/docs/topics/resize-strategies/).
109109
`),
110110
zoom: z.boolean().default(true).describe(`
111-
If this is set to \`false\`, smaller images will not be stretched to the desired width and height. For details about the impact of zooming for your preferred resize strategy, see the list of available [resize strategies](/docs/robots/image-resize/#resize-strategies).
111+
If this is set to \`false\`, smaller images will not be stretched to the desired width and height. For details about the impact of zooming for your preferred resize strategy, see the list of available [resize strategies](/docs/topics/resize-strategies/).
112112
`),
113113
crop: unsafeCoordinatesSchema.optional().describe(`
114114
Specify an object containing coordinates for the top left and bottom right corners of the rectangle to be cropped from the original image(s). The coordinate system is rooted in the top left corner of the image. Values can be integers for absolute pixel values or strings for percentage based values.
@@ -129,7 +129,7 @@ This will crop the area from \`(80, 100)\` to \`(600, 800)\` from a 1000×1000 p
129129
You can also use a JSON string of such an object with coordinates in similar fashion:
130130
131131
\`\`\`json
132-
"{"x1": <Integer>, "y1": <Integer>, "x2": <Integer>, "y2": <Integer>}"
132+
"{\\"x1\\": <Integer>, \\"y1\\": <Integer>, \\"x2\\": <Integer>, \\"y2\\": <Integer>}"
133133
\`\`\`
134134
135135
To crop around human faces, see [🤖/image/facedetect](/docs/robots/image-facedetect/).
@@ -265,7 +265,7 @@ Increases or decreases the saturation of the image by using a multiplier. For ex
265265
Changes the hue by rotating the color of the image. The value \`100\` would produce no change whereas \`0\` and \`200\` will negate the colors in the image.
266266
`),
267267
watermark_url: z.string().optional().describe(`
268-
A URL indicating a PNG image to be overlaid above this image. Please note that you can also [supply the watermark via another Assembly Step](/docs/robots/image-resize/#image-resize-supply-watermark-via-assembly-step). With watermarking you can add an image onto another image. This is usually used for logos.
268+
A URL indicating a PNG image to be overlaid above this image. Please note that you can also [supply the watermark via another Assembly Step](/docs/topics/use-parameter/#supplying-the-watermark-via-an-assembly-step). With watermarking you can add an image onto another image. This is usually used for logos.
269269
`),
270270
watermark_position: z.union([positionSchema, z.array(positionSchema)]).default('center')
271271
.describe(`

src/alphalib/types/robots/tus-store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ To change the \`title\` or \`description\` per video, we recommend to [inject va
5959
The URL of the Tus-compatible server, which you're uploading files to.
6060
`),
6161
credentials: z.string().optional().describe(`
62-
Create <dfn>Template Credentials</dfn> for this <dfn>Robot</dfn> in your [Transloadit account]({{site.base_url}}/c/template-credentials/) and use the name of the <dfn>Template Credentials</dfn> as this parameter's value. For this <dfn>Robot</dfn>, use the HTTP template, which allows request headers to be passed along to the destination server.
62+
Create <dfn>Template Credentials</dfn> for this <dfn>Robot</dfn> in your [Transloadit account](/c/template-credentials/) and use the name of the <dfn>Template Credentials</dfn> as this parameter's value. For this <dfn>Robot</dfn>, use the HTTP template, which allows request headers to be passed along to the destination server.
6363
`),
6464
headers: z.record(z.string()).default({}).describe('Headers to pass along to destination')
6565
.describe(`

src/alphalib/types/robots/video-merge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const robotVideoMergeInstructionsSchema = robotBase
4444
.extend({
4545
robot: z.literal('/video/merge'),
4646
resize_strategy: resize_strategy.describe(`
47-
If the given width/height parameters are bigger than the input image's dimensions, then the \`resize_strategy\` determines how the image will be resized to match the provided width/height. See the [available resize strategies](/docs/robots/image-resize/#resize-strategies).
47+
If the given width/height parameters are bigger than the input image's dimensions, then the \`resize_strategy\` determines how the image will be resized to match the provided width/height. See the [available resize strategies](/docs/topics/resize-strategies/).
4848
`),
4949
background: color_with_alpha.default('#00000000').describe(`
5050
The background color of the resulting video the \`"rrggbbaa"\` format (red, green, blue, alpha) when used with the \`"pad"\` resize strategy. The default color is black.

src/alphalib/types/robots/video-thumbs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ The width of the thumbnail, in pixels. Defaults to the original width of the vid
8080
The height of the thumbnail, in pixels. Defaults to the original height of the video.
8181
`),
8282
resize_strategy: resize_strategy.describe(`
83-
One of the [available resize strategies](/docs/robots/image-resize/#resize-strategies).
83+
One of the [available resize strategies](/docs/topics/resize-strategies/).
8484
`),
8585
background: color_with_alpha.default('#00000000').describe(`
8686
The background color of the resulting thumbnails in the \`"rrggbbaa"\` format (red, green, blue, alpha) when used with the \`"pad"\` resize strategy. The default color is black.

0 commit comments

Comments
 (0)