Skip to content

Commit 8b5d4e0

Browse files
committed
Sync alphalib
1 parent 2119dbe commit 8b5d4e0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+797
-1078
lines changed

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

Lines changed: 375 additions & 144 deletions
Large diffs are not rendered by default.

src/alphalib/types/robots/audio-artwork.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { z } from 'zod'
22

3-
import { ffmpegStackVersionSchema, useParamSchema } from './_instructions-primitives.ts'
3+
import { robotFFmpegAudio, robotBase, robotUse } from './_instructions-primitives.ts'
44
import type { RobotMeta } from './_instructions-primitives.ts'
55

66
export const meta: RobotMeta = {
@@ -33,27 +33,23 @@ export const meta: RobotMeta = {
3333
typical_file_type: 'audio file',
3434
}
3535

36-
export const robotAudioArtworkInstructionsSchema = z
37-
.object({
38-
result: z
39-
.boolean()
40-
.optional()
41-
.describe(`Whether the results of this Step should be present in the Assembly Status JSON`),
36+
export const robotAudioArtworkInstructionsSchema = robotBase
37+
.merge(robotUse)
38+
.merge(robotFFmpegAudio)
39+
.extend({
4240
robot: z.literal('/audio/artwork').describe(`
4341
For extraction, this <dfn>Robot</dfn> uses the image format embedded within the audio file — most often, this is JPEG.
4442
4543
If you need the image in a different format, pipe the result of this <dfn>Robot</dfn> into [🤖/image/resize](/docs/transcoding/image-manipulation/image-resize/).
4644
4745
The \`method\` parameter determines whether to extract or insert.
4846
`),
49-
use: useParamSchema.optional(),
5047
method: z.enum(['extract', 'insert']).default('extract').describe(`
5148
What should be done with the audio file. A value of \`"extract"\` means audio artwork will be extracted. A value of \`"insert"\` means the provided image will be inserted as audio artwork.
5249
`),
5350
change_format_if_necessary: z.boolean().default(false).describe(`
5451
Whether the original file should be transcoded into a new format if there is an issue with the original file.
5552
`),
56-
ffmpeg_stack: ffmpegStackVersionSchema.optional(),
5753
})
5854
.strict()
5955
export type RobotAudioArtworkInstructions = z.infer<typeof robotAudioArtworkInstructionsSchema>

src/alphalib/types/robots/audio-concat.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ import { z } from 'zod'
22

33
import {
44
bitrateSchema,
5-
ffmpegParamSchema,
6-
ffmpegStackVersionSchema,
7-
outputMetaParamSchema,
5+
robotFFmpeg,
86
preset,
7+
robotBase,
8+
robotUse,
99
sampleRateSchema,
10-
useParamSchema,
1110
} from './_instructions-primitives.ts'
1211
import type { RobotMeta } from './_instructions-primitives.ts'
1312

@@ -47,17 +46,17 @@ export const meta: RobotMeta = {
4746
typical_file_type: 'audio file',
4847
}
4948

50-
export const robotAudioConcatInstructionsSchema = z
51-
.object({
49+
export const robotAudioConcatInstructionsSchema = robotBase
50+
.merge(robotUse)
51+
.merge(robotFFmpeg)
52+
.extend({
5253
result: z
5354
.boolean()
5455
.optional()
5556
.describe(`Whether the results of this Step should be present in the Assembly Status JSON`),
5657
robot: z.literal('/audio/concat').describe(`
5758
This Robot can concatenate an almost infinite number of audio files.
5859
`),
59-
use: useParamSchema.optional(),
60-
output_meta: outputMetaParamSchema,
6160
preset: preset.optional().describe(`
6261
Performs conversion using pre-configured settings.
6362
@@ -76,8 +75,6 @@ When used this adds an audio fade in and out effect between each section of your
7675
7776
This parameter does not add an audio fade effect at the beginning or end of your result audio file. If you want to do so, create an additional [🤖/audio/encode](/docs/transcoding/audio-encoding/audio-encode/) <dfn>Step</dfn> and use our \`ffmpeg\` parameter as shown in this [demo](/demos/audio-encoding/ffmpeg-fade-in-and-out/).
7877
`),
79-
ffmpeg_stack: ffmpegStackVersionSchema.optional(),
80-
ffmpeg: ffmpegParamSchema.optional(),
8178
})
8279
.strict()
8380
export type RobotAudioConcatInstructions = z.infer<typeof robotAudioConcatInstructionsSchema>

src/alphalib/types/robots/audio-encode.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ import { z } from 'zod'
22

33
import {
44
bitrateSchema,
5-
ffmpegParamSchema,
6-
ffmpegStackVersionSchema,
7-
outputMetaParamSchema,
5+
robotFFmpeg,
86
preset,
7+
robotBase,
8+
robotUse,
99
sampleRateSchema,
10-
useParamSchema,
1110
} from './_instructions-primitives.ts'
1211
import type { RobotMeta } from './_instructions-primitives.ts'
1312

@@ -43,15 +42,15 @@ export const meta: RobotMeta = {
4342
typical_file_type: 'audio file',
4443
}
4544

46-
export const robotAudioEncodeInstructionsSchema = z
47-
.object({
45+
export const robotAudioEncodeInstructionsSchema = robotBase
46+
.merge(robotUse)
47+
.merge(robotFFmpeg)
48+
.extend({
4849
result: z
4950
.boolean()
5051
.optional()
5152
.describe(`Whether the results of this Step should be present in the Assembly Status JSON`),
5253
robot: z.literal('/audio/encode'),
53-
use: useParamSchema.optional(),
54-
output_meta: outputMetaParamSchema,
5554
preset: preset.default('mp3').describe(`
5655
Performs conversion using pre-configured settings.
5756
@@ -65,8 +64,6 @@ Bit rate of the resulting audio file, in bits per second. If not specified will
6564
sample_rate: sampleRateSchema.optional().describe(`
6665
Sample rate of the resulting audio file, in Hertz. If not specified will default to the sample rate of the input audio file.
6766
`),
68-
ffmpeg_stack: ffmpegStackVersionSchema.optional(),
69-
ffmpeg: ffmpegParamSchema.optional(),
7067
})
7168
.strict()
7269
export type RobotAudioEncodeInstructions = z.infer<typeof robotAudioEncodeInstructionsSchema>

src/alphalib/types/robots/audio-loop.ts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ import { z } from 'zod'
22

33
import {
44
bitrateSchema,
5-
ffmpegParamSchema,
6-
ffmpegStackVersionSchema,
7-
outputMetaParamSchema,
5+
robotFFmpeg,
86
preset,
7+
robotBase,
8+
robotUse,
99
sampleRateSchema,
10-
useParamSchema,
1110
} from './_instructions-primitives.ts'
1211
import type { RobotMeta } from './_instructions-primitives.ts'
1312

@@ -43,15 +42,11 @@ export const meta: RobotMeta = {
4342
typical_file_type: 'audio file',
4443
}
4544

46-
export const robotAudioLoopInstructionsSchema = z
47-
.object({
48-
result: z
49-
.boolean()
50-
.optional()
51-
.describe(`Whether the results of this Step should be present in the Assembly Status JSON`),
45+
export const robotAudioLoopInstructionsSchema = robotBase
46+
.merge(robotUse)
47+
.merge(robotFFmpeg)
48+
.extend({
5249
robot: z.literal('/audio/loop'),
53-
use: useParamSchema.optional(),
54-
output_meta: outputMetaParamSchema,
5550
preset: preset.optional().describe(`
5651
Performs conversion using pre-configured settings.
5752
@@ -68,8 +63,6 @@ Sample rate of the resulting audio file, in Hertz. If not specified will default
6863
duration: z.number().default(60).describe(`
6964
Target duration for the whole process in seconds. The <dfn>Robot</dfn> will loop the input audio file for as long as this target duration is not reached yet.
7065
`),
71-
ffmpeg_stack: ffmpegStackVersionSchema.optional(),
72-
ffmpeg: ffmpegParamSchema.optional(),
7366
})
7467
.strict()
7568
export type RobotAudioLoopInstructions = z.infer<typeof robotAudioLoopInstructionsSchema>

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

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ import { z } from 'zod'
22

33
import {
44
bitrateSchema,
5-
ffmpegParamSchema,
6-
ffmpegStackVersionSchema,
7-
outputMetaParamSchema,
5+
robotFFmpeg,
86
preset,
7+
robotBase,
8+
robotUse,
99
sampleRateSchema,
10-
useParamSchema,
1110
} from './_instructions-primitives.ts'
1211
import type { RobotMeta } from './_instructions-primitives.ts'
1312

@@ -48,15 +47,11 @@ export const meta: RobotMeta = {
4847
typical_file_type: 'audio file',
4948
}
5049

51-
export const robotAudioMergeInstructionsSchema = z
52-
.object({
53-
result: z
54-
.boolean()
55-
.optional()
56-
.describe(`Whether the results of this Step should be present in the Assembly Status JSON`),
50+
export const robotAudioMergeInstructionsSchema = robotBase
51+
.merge(robotUse)
52+
.merge(robotFFmpeg)
53+
.extend({
5754
robot: z.literal('/audio/merge'),
58-
use: useParamSchema.optional(),
59-
output_meta: outputMetaParamSchema,
6055
preset: preset.describe(`
6156
Performs conversion using pre-configured settings.
6257
@@ -78,8 +73,6 @@ Specifies if any input files that do not match the target duration should be loo
7873
volume: z.enum(['average', 'sum']).default('average').describe(`
7974
Valid values are \`"average"\` and \`"sum"\` here. \`"average"\` means each input is scaled 1/n (n is the number of inputs) or \`"sum"\` which means each individual audio stays on the same volume, but since we merge tracks 'on top' of each other, this could result in very loud output.
8075
`),
81-
ffmpeg_stack: ffmpegStackVersionSchema.optional(),
82-
ffmpeg: ffmpegParamSchema.optional(),
8376
})
8477
.strict()
8578
export type RobotAudioMergeInstructions = z.infer<typeof robotAudioMergeInstructionsSchema>

src/alphalib/types/robots/audio-waveform.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import { z } from 'zod'
22

3-
import {
4-
color_with_alpha,
5-
ffmpegParamSchema,
6-
ffmpegStackVersionSchema,
7-
outputMetaParamSchema,
8-
useParamSchema,
9-
} from './_instructions-primitives.ts'
3+
import { color_with_alpha, robotFFmpeg, robotBase, robotUse } from './_instructions-primitives.ts'
104
import type { RobotMeta } from './_instructions-primitives.ts'
115

126
export const meta: RobotMeta = {
@@ -51,19 +45,15 @@ Here is an example waveform image:
5145
typical_file_type: 'audio file',
5246
}
5347

54-
export const robotAudioWaveformInstructionsSchema = z
55-
.object({
56-
result: z
57-
.boolean()
58-
.optional()
59-
.describe(`Whether the results of this Step should be present in the Assembly Status JSON`),
48+
export const robotAudioWaveformInstructionsSchema = robotBase
49+
.merge(robotUse)
50+
.merge(robotFFmpeg)
51+
.extend({
6052
robot: z.literal('/audio/waveform').describe(`
6153
We recommend that you use an [🤖/audio/encode](/docs/transcoding/audio-encoding/audio-encode/) <dfn>Step</dfn> prior to your waveform <dfn>Step</dfn> to convert audio files to MP3. This way it is guaranteed that [🤖/audio/waveform](/docs/transcoding/audio-encoding/audio-waveform/) accepts your audio file and you can also down-sample large audio files and save some money.
6254
6355
Similarly, if you need the output image in a different format, please pipe the result of this <dfn>Robot</dfn> into [🤖/image/resize](/docs/transcoding/image-manipulation/image-resize/).
6456
`),
65-
use: useParamSchema.optional(),
66-
output_meta: outputMetaParamSchema,
6757
format: z.enum(['image', 'json']).default('image').describe(`
6858
The format of the result file. Can be \`"image"\` or \`"json"\`. If \`"image"\` is supplied, a PNG image will be created, otherwise a JSON file.
6959
`),
@@ -88,8 +78,6 @@ The color used in the center of the gradient. The format is "rrggbbaa" (red, gre
8878
outer_color: color_with_alpha.default('000000ff').describe(`
8979
The color used in the outer parts of the gradient. The format is "rrggbbaa" (red, green, blue, alpha).
9080
`),
91-
ffmpeg_stack: ffmpegStackVersionSchema.optional(),
92-
ffmpeg: ffmpegParamSchema.optional(),
9381
})
9482
.strict()
9583
export type RobotAudioWaveformInstructions = z.infer<typeof robotAudioWaveformInstructionsSchema>

src/alphalib/types/robots/azure-import.ts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { z } from 'zod'
22

33
import {
4-
credentials,
4+
azureBase,
55
files_per_page,
6-
ignore_errors,
6+
robotImport,
77
next_page_token,
88
path,
9+
robotBase,
910
} from './_instructions-primitives.ts'
1011
import type { RobotMeta } from './_instructions-primitives.ts'
1112

@@ -41,19 +42,11 @@ export const meta: RobotMeta = {
4142
typical_file_type: 'file',
4243
}
4344

44-
export const robotAzureImportInstructionsSchema = z
45-
.object({
46-
result: z
47-
.boolean()
48-
.optional()
49-
.describe(`Whether the results of this Step should be present in the Assembly Status JSON`),
45+
export const robotAzureImportInstructionsSchema = robotBase
46+
.merge(robotImport)
47+
.merge(azureBase)
48+
.extend({
5049
robot: z.literal('/azure/import'),
51-
ignore_errors,
52-
credentials: credentials.describe(`
53-
Please create your associated <dfn>Template Credentials</dfn> in your Transloadit account and use the name of your [Template Credentials](/c/template-credentials/) as this parameter's value. They will contain the values for your Azure Container, Account and Key.
54-
55-
While we recommend to use <dfn>Template Credentials</dfn> at all times, some use cases demand dynamic credentials for which using <dfn>Template Credentials</dfn> is too unwieldy because of their static nature. If you have this requirement, feel free to use the following parameters instead: \`"account"\`, \`"key"\`, \`"container"\`.
56-
`),
5750
path: path.describe(`
5851
The path in your container to the specific file or directory. If the path points to a file, only this file will be imported. For example: \`images/avatar.jpg\`.
5952

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

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { z } from 'zod'
22

3-
import { useParamSchema } from './_instructions-primitives.ts'
3+
import { azureBase, robotBase, robotUse } from './_instructions-primitives.ts'
44
import type { RobotMeta } from './_instructions-primitives.ts'
55

66
export const meta: RobotMeta = {
@@ -34,19 +34,11 @@ export const meta: RobotMeta = {
3434
typical_file_type: 'file',
3535
}
3636

37-
export const robotAzureStoreInstructionsSchema = z
38-
.object({
39-
result: z
40-
.boolean()
41-
.optional()
42-
.describe(`Whether the results of this Step should be present in the Assembly Status JSON`),
37+
export const robotAzureStoreInstructionsSchema = robotBase
38+
.merge(robotUse)
39+
.merge(azureBase)
40+
.extend({
4341
robot: z.literal('/azure/store'),
44-
use: useParamSchema.optional(),
45-
credentials: z.string().describe(`
46-
Please create your associated <dfn>Template Credentials</dfn> in your Transloadit account and use the name of your [Template Credentials](/c/template-credentials/) as this parameter's value. They will contain the values for your Azure Container, Account and Key.
47-
48-
While we recommend to use <dfn>Template Credentials</dfn> at all times, some use cases demand dynamic credentials for which using <dfn>Template Credentials</dfn> is too unwieldy because of their static nature. If you have this requirement, feel free to use the following parameters instead: \`"account"\`, \`"key"\`, \`"container"\`.
49-
`),
5042
path: z.string().default('${unique_prefix}/${file.url_name}').describe(`
5143
The path at which the file is to be stored. This may include any available [Assembly variables](/docs/topics/assembly-instructions/#assembly-variables).
5244
`),

src/alphalib/types/robots/backblaze-import.ts

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { z } from 'zod'
22

33
import {
4-
credentials,
4+
backblazeBase,
55
files_per_page,
6-
ignore_errors,
6+
robotImport,
77
path,
88
recursive,
9+
robotBase,
910
} from './_instructions-primitives.ts'
1011
import type { RobotMeta } from './_instructions-primitives.ts'
1112

@@ -42,25 +43,11 @@ export const meta: RobotMeta = {
4243
typical_file_type: 'file',
4344
}
4445

45-
export const robotBackblazeImportInstructionsSchema = z
46-
.object({
47-
result: z
48-
.boolean()
49-
.optional()
50-
.describe(`Whether the results of this Step should be present in the Assembly Status JSON`),
46+
export const robotBackblazeImportInstructionsSchema = robotBase
47+
.merge(robotImport)
48+
.merge(backblazeBase)
49+
.extend({
5150
robot: z.literal('/backblaze/import'),
52-
ignore_errors,
53-
credentials: credentials.describe(`
54-
Please create your associated <dfn>Template Credentials</dfn> in your Transloadit account and use the name of your <dfn>Template Credentials</dfn> as this parameter's value. They will contain the values for your Backblaze Bucket Name, App Key ID, and App Key.
55-
56-
To create your credential information, head over to Backblaze, sign in to your account, and select "Create a Bucket". Save the name of your bucket, and click on the "App Keys" tab, scroll to the bottom of the page then select “Add a New Application Key”. Allow access to your recently created bucket, select “Read and Write” as your type of access, and tick the “Allow List All Bucket Names” option.
57-
58-
Now that everything is in place, create your key, and take note of the information you are given so you can input the information into your <dfn>Template Credentials</dfn>.
59-
60-
⚠️ Your App Key will only be viewable once, so make sure you note this down.
61-
62-
While we recommend to use <dfn>Template Credentials</dfn> at all times, some use cases demand dynamic credentials for which using <dfn>Template Credentials</dfn> is too unwieldy because of their static nature. If you have this requirement, feel free to use the following parameters instead: \`"bucket"\`, \`"app_key_id"\`, \`"app_key"\`.
63-
`),
6451
path: path.describe(`
6552
The path in your bucket to the specific file or directory. If the path points to a file, only this file will be imported. For example: \`images/avatar.jpg\`.
6653

0 commit comments

Comments
 (0)