Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 23 additions & 19 deletions src/alphalib/types/robots/_instructions-primitives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,9 @@ export function interpolateRecursive<Schema extends z.ZodFirstPartySchemaTypes>(
def,
) as InterpolatableSchema<Schema>
case z.ZodFirstPartyTypeKind.ZodNullable:
return interpolateRecursive(def.innerType).nullable() as InterpolatableSchema<Schema>
return interpolateRecursive(def.innerType)
.nullable()
.describe(def.description) as InterpolatableSchema<Schema>
case z.ZodFirstPartyTypeKind.ZodObject: {
const replacement = z.object(
Object.fromEntries(
Expand Down Expand Up @@ -354,18 +356,18 @@ export function interpolateRecursive<Schema extends z.ZodFirstPartySchemaTypes>(
case z.ZodFirstPartyTypeKind.ZodString:
return z.union([interpolationSchemaPartial, schema], def) as InterpolatableSchema<Schema>
case z.ZodFirstPartyTypeKind.ZodTuple: {
const tuple = z.tuple(def.items.map(interpolateRecursive))
const tuple = z.tuple(def.items.map(interpolateRecursive), def)

return z.union([
interpolationSchemaFull,
def.rest ? tuple.rest(def.rest) : tuple,
]) as InterpolatableSchema<Schema>
}
case z.ZodFirstPartyTypeKind.ZodUnion:
return z.union([
interpolationSchemaFull,
...(def.options.map(interpolateRecursive) as z.ZodUnionOptions),
]) as InterpolatableSchema<Schema>
return z.union(
[interpolationSchemaFull, ...(def.options.map(interpolateRecursive) as z.ZodUnionOptions)],
def,
) as InterpolatableSchema<Schema>
default:
return schema as InterpolatableSchema<Schema>
}
Expand Down Expand Up @@ -438,14 +440,14 @@ You can also set this to \`false\` to skip metadata extraction and speed up tran
`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`,
),

force_accept: z.boolean().default(false).describe(`
Force a Robot to accept a file type it would have ignored.
force_accept: z.boolean().default(false)
.describe(`Force a Robot to accept a file type it would have ignored.

By default Robots ignore files they are not familiar with.
[🤖/video/encode](https://transloadit.com/docs/robots/video-encode/), for
By default, Robots ignore files they are not familiar with.
[🤖/video/encode](/docs/robots/video-encode/), for
example, will happily ignore input images.

With the force_accept parameter set to true you can force Robots to accept all files thrown at them.
With the \`force_accept\` parameter set to \`true\`, you can force Robots to accept all files thrown at them.
This will typically lead to errors and should only be used for debugging or combatting edge cases.
`),
})
Expand Down Expand Up @@ -1167,9 +1169,9 @@ Go back to your Google credentials project and enable the "Google Cloud Storage

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.

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.
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.

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.
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.

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.
`),
Expand Down Expand Up @@ -1348,30 +1350,32 @@ export const filterCondition = z.union([
export const videoEncodeSpecificInstructionsSchema = robotFFmpegVideo
.extend({
resize_strategy: resize_strategy.describe(`
See the [available resize strategies](/docs/robots/image-resize/#resize-strategies).
See the [available resize strategies](/docs/topics/resize-strategies/).
`),
zoom: z.boolean().default(true).describe(`
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).
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/).
`),
crop: unsafeCoordinatesSchema.optional().describe(`
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.

For example:

\`\`\`json

{
"x1": 80,
"y1": 100,
"x2": "60%",
"y2": "80%"
}

\`\`\`

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.

You can also use a JSON string of such an object with coordinates in similar fashion: \`"{ "x1": <Integer>, "y1": <Integer>, "x2": <Integer>, "y2": <Integer> }"\`
You can also use a JSON string of such an object with coordinates in similar fashion:

\`\`\`json
"{\\"x1\\": <Integer>, \\"y1\\": <Integer>, \\"x2\\": <Integer>, \\"y2\\": <Integer>}"
\`\`\`
`),
background: color_with_alpha.default('#00000000').describe(`
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.
Expand Down Expand Up @@ -1400,7 +1404,7 @@ Splits the video into multiple chunks so that each chunk can be encoded in paral
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.
`),
watermark_url: z.string().default('').describe(`
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).
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).
`),
watermark_position: z.union([positionSchema, z.array(positionSchema)]).default('center')
.describe(`
Expand Down
5 changes: 3 additions & 2 deletions src/alphalib/types/robots/document-split.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ export const robotDocumentSplitInstructionsSchema = robotBase
pages: z
.union([z.string(), z.array(z.string())])
.describe(
'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.',
),
'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.',
)
.optional(),
})
.strict()

Expand Down
2 changes: 1 addition & 1 deletion src/alphalib/types/robots/document-thumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Height of the new image, in pixels. If not specified, will default to the height
`),
resize_strategy: z.enum(['crop', 'fillcrop', 'fit', 'min_fit', 'pad', 'stretch']).default('pad')
.describe(`
One of the [available resize strategies](/docs/robots/image-resize/#resize-strategies).
One of the [available resize strategies](/docs/topics/resize-strategies/).
`),
// TODO: Determine the allowed colors
background: z.string().default('#FFFFFF').describe(`
Expand Down
2 changes: 1 addition & 1 deletion src/alphalib/types/robots/file-preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Height of the thumbnail, in pixels.
resize_strategy: resize_strategy.describe(`
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.

See the list of available [resize strategies](/docs/robots/image-resize/#resize-strategies) for more details.
See the list of available [resize strategies](/docs/topics/resize-strategies/) for more details.
`),
background: color_with_alpha.default('#ffffffff').describe(`
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.
Expand Down
4 changes: 2 additions & 2 deletions src/alphalib/types/robots/google-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ Go back to your Google credentials project and enable the "Google Cloud Storage

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.

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.
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.

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.
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.

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.
`),
Expand Down
8 changes: 4 additions & 4 deletions src/alphalib/types/robots/image-resize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ In this example, the background color is determined by the [Assembly Variable](h
),
])
.default('fit').describe(`
See the list of available [resize strategies](/docs/robots/image-resize/#resize-strategies).
See the list of available [resize strategies](/docs/topics/resize-strategies/).
`),
zoom: z.boolean().default(true).describe(`
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).
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/).
`),
crop: unsafeCoordinatesSchema.optional().describe(`
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.
Expand All @@ -129,7 +129,7 @@ This will crop the area from \`(80, 100)\` to \`(600, 800)\` from a 1000×1000 p
You can also use a JSON string of such an object with coordinates in similar fashion:

\`\`\`json
"{"x1": <Integer>, "y1": <Integer>, "x2": <Integer>, "y2": <Integer>}"
"{\\"x1\\": <Integer>, \\"y1\\": <Integer>, \\"x2\\": <Integer>, \\"y2\\": <Integer>}"
\`\`\`

To crop around human faces, see [🤖/image/facedetect](/docs/robots/image-facedetect/).
Expand Down Expand Up @@ -265,7 +265,7 @@ Increases or decreases the saturation of the image by using a multiplier. For ex
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.
`),
watermark_url: z.string().optional().describe(`
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.
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.
`),
watermark_position: z.union([positionSchema, z.array(positionSchema)]).default('center')
.describe(`
Expand Down
2 changes: 1 addition & 1 deletion src/alphalib/types/robots/tus-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ To change the \`title\` or \`description\` per video, we recommend to [inject va
The URL of the Tus-compatible server, which you're uploading files to.
`),
credentials: z.string().optional().describe(`
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.
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.
`),
headers: z.record(z.string()).default({}).describe('Headers to pass along to destination')
.describe(`
Expand Down
2 changes: 1 addition & 1 deletion src/alphalib/types/robots/video-merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const robotVideoMergeInstructionsSchema = robotBase
.extend({
robot: z.literal('/video/merge'),
resize_strategy: resize_strategy.describe(`
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).
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/).
`),
background: color_with_alpha.default('#00000000').describe(`
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.
Expand Down
2 changes: 1 addition & 1 deletion src/alphalib/types/robots/video-thumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ The width of the thumbnail, in pixels. Defaults to the original width of the vid
The height of the thumbnail, in pixels. Defaults to the original height of the video.
`),
resize_strategy: resize_strategy.describe(`
One of the [available resize strategies](/docs/robots/image-resize/#resize-strategies).
One of the [available resize strategies](/docs/topics/resize-strategies/).
`),
background: color_with_alpha.default('#00000000').describe(`
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.
Expand Down