Skip to content

Commit d34e55a

Browse files
authored
Sync alphalib 2025 09 16 (#251)
* Sync alphalib * Refactored the assembly instructions schema to avoid the TS7056 overflow by rebuilding the optional and required variants from a shared base shape rather than relying on .required(...). - src/alphalib/types/template.ts:109 Added assemblyInstructionsSharedShape so the common fields are defined once and can be reused for both schema variants without triggering massive inferred types. - src/alphalib/types/template.ts:134 Recreated assemblyInstructionsSchemaWithRequiredAuth with z.object({ auth: ..., ...sharedShape }), side-stepping the problematic required helper while keeping auth mandatory. cc @remcohaszing * Update _index.ts
1 parent 3359cca commit d34e55a

File tree

7 files changed

+740
-25
lines changed

7 files changed

+740
-25
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import z from 'zod'
2+
3+
import { assemblyAuthInstructionsSchema } from './template.ts'
4+
5+
export const assembliesGetSchema = z
6+
.object({
7+
auth: assemblyAuthInstructionsSchema,
8+
page: z
9+
.number()
10+
.int()
11+
.default(1)
12+
.describe('Specifies the current page, within the current pagination'),
13+
pagesize: z
14+
.number()
15+
.int()
16+
.min(1)
17+
.max(5000)
18+
.default(50)
19+
.describe(
20+
'Specifies how many Assemblies to be received per API request, which is useful for pagination.',
21+
),
22+
type: z
23+
.enum(['all', 'uploading', 'executing', 'canceled', 'completed', 'failed', 'request_aborted'])
24+
.describe('Specifies the types of Assemblies to be retrieved.'),
25+
fromdate: z
26+
.string()
27+
.describe(
28+
'Specifies the minimum Assembly UTC creation date/time. Only Assemblies after this time will be retrieved. Use the format `Y-m-d H:i:s`.',
29+
),
30+
todate: z
31+
.string()
32+
.default('NOW()')
33+
.describe(
34+
'Specifies the maximum Assembly UTC creation date/time. Only Assemblies before this time will be retrieved. Use the format `Y-m-d H:i:s`.',
35+
),
36+
keywords: z
37+
.array(z.string())
38+
.describe(
39+
'Specifies keywords to be matched in the Assembly Status. The Assembly fields checked include the `id`, `redirect_url`, `fields`, and `notify_url`, as well as error messages and files used.',
40+
),
41+
})
42+
.strict()
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { z } from 'zod'
2+
3+
import {
4+
assemblyAuthInstructionsSchema,
5+
fieldsSchema,
6+
notifyUrlSchema,
7+
optionalStepsSchema,
8+
templateIdSchema,
9+
} from './template.ts'
10+
11+
export const assemblyReplaySchema = z
12+
.object({
13+
auth: assemblyAuthInstructionsSchema,
14+
steps: optionalStepsSchema as typeof optionalStepsSchema,
15+
template_id: templateIdSchema,
16+
notify_url: notifyUrlSchema,
17+
fields: fieldsSchema,
18+
reparse_template: z
19+
.union([z.literal(0), z.literal(1)])
20+
.describe(
21+
'Specify `1` to reparse the Template used in your Assembly (useful if the Template changed in the meantime). Alternatively, `0` replays the identical Steps used in the Assembly.',
22+
),
23+
})
24+
.strict()
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { z } from 'zod'
2+
3+
import { assemblyAuthInstructionsSchema, optionalStepsSchema } from './template.ts'
4+
5+
export const assemblyReplayNotificationSchema = z
6+
.object({
7+
auth: assemblyAuthInstructionsSchema,
8+
steps: optionalStepsSchema as typeof optionalStepsSchema,
9+
wait: z
10+
.boolean()
11+
.default(true)
12+
.describe(
13+
'If it is provided with the value `false`, then the API request will return immediately even though the Notification is still in progress. This can be useful if your server takes some time to respond, but you do not want the replay API request to hang.',
14+
),
15+
})
16+
.strict()

src/alphalib/types/bill.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { z } from 'zod'
2+
3+
import { assemblyAuthInstructionsSchema } from './template.ts'
4+
5+
export const billSchema = z
6+
.object({
7+
auth: assemblyAuthInstructionsSchema,
8+
})
9+
.strict()

0 commit comments

Comments
 (0)