@automate.ax/integration-contracts 0.124.0 → 0.125.0
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.
- package/dist/apify/index.d.ts +1085 -0
- package/dist/apify/index.js +169 -0
- package/dist/apify/schemas.d.ts +100 -0
- package/dist/apify/schemas.js +203 -0
- package/dist/linear/schemas.d.ts +8 -8
- package/dist/notion/schemas.d.ts +33 -33
- package/dist/triggers.d.ts +2 -1
- package/dist/vercel/index.d.ts +16 -16
- package/dist/vercel/schemas.d.ts +24 -24
- package/package.json +8 -2
- package/src/apify/index.ts +210 -0
- package/src/apify/schemas.ts +214 -0
- package/src/triggers.ts +2 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { APIFY_BUILD_SCHEMA, APIFY_RUN_SCHEMA, mapApifyBuild, mapApifyRun, } from "./schemas.js";
|
|
3
|
+
export * from "./schemas.js";
|
|
4
|
+
export const APIFY_RUN_EVENT_TYPES = [
|
|
5
|
+
"ACTOR.RUN.CREATED",
|
|
6
|
+
"ACTOR.RUN.SUCCEEDED",
|
|
7
|
+
"ACTOR.RUN.FAILED",
|
|
8
|
+
"ACTOR.RUN.ABORTED",
|
|
9
|
+
"ACTOR.RUN.TIMED_OUT",
|
|
10
|
+
"ACTOR.RUN.RESURRECTED",
|
|
11
|
+
];
|
|
12
|
+
export const APIFY_BUILD_EVENT_TYPES = [
|
|
13
|
+
"ACTOR.BUILD.CREATED",
|
|
14
|
+
"ACTOR.BUILD.SUCCEEDED",
|
|
15
|
+
"ACTOR.BUILD.FAILED",
|
|
16
|
+
"ACTOR.BUILD.ABORTED",
|
|
17
|
+
"ACTOR.BUILD.TIMED_OUT",
|
|
18
|
+
];
|
|
19
|
+
export const APIFY_EVENT_TYPES = [
|
|
20
|
+
...APIFY_RUN_EVENT_TYPES,
|
|
21
|
+
...APIFY_BUILD_EVENT_TYPES,
|
|
22
|
+
];
|
|
23
|
+
export const APIFY_RUN_TRIGGER_CONFIG_SCHEMA = z.union([
|
|
24
|
+
z.object({
|
|
25
|
+
actorId: z.string().trim().min(1),
|
|
26
|
+
taskId: z.never().optional(),
|
|
27
|
+
}),
|
|
28
|
+
z.object({
|
|
29
|
+
actorId: z.never().optional(),
|
|
30
|
+
taskId: z.string().trim().min(1),
|
|
31
|
+
}),
|
|
32
|
+
]);
|
|
33
|
+
export const APIFY_BUILD_TRIGGER_CONFIG_SCHEMA = z.object({
|
|
34
|
+
actorId: z.string().trim().min(1),
|
|
35
|
+
});
|
|
36
|
+
const APIFY_WEBHOOK_EVENT_SCHEMA = z.looseObject({
|
|
37
|
+
createdAt: z.iso.datetime(),
|
|
38
|
+
eventData: z.looseObject({
|
|
39
|
+
actorBuildId: z.string().optional(),
|
|
40
|
+
actorId: z.string(),
|
|
41
|
+
actorRunId: z.string().optional(),
|
|
42
|
+
actorTaskId: z.string().nullable().optional(),
|
|
43
|
+
}),
|
|
44
|
+
eventType: z.enum(APIFY_EVENT_TYPES),
|
|
45
|
+
resource: z.unknown(),
|
|
46
|
+
userId: z.string(),
|
|
47
|
+
});
|
|
48
|
+
const APIFY_RUN_EVENT_SCHEMA = z.object({
|
|
49
|
+
createdAt: z.iso.datetime(),
|
|
50
|
+
eventData: z.object({
|
|
51
|
+
actorId: z.string(),
|
|
52
|
+
actorRunId: z.string(),
|
|
53
|
+
actorTaskId: z.string().nullable().optional(),
|
|
54
|
+
}),
|
|
55
|
+
eventType: z.enum(APIFY_RUN_EVENT_TYPES),
|
|
56
|
+
resource: APIFY_RUN_SCHEMA,
|
|
57
|
+
userId: z.string(),
|
|
58
|
+
});
|
|
59
|
+
const APIFY_BUILD_EVENT_SCHEMA = z.object({
|
|
60
|
+
createdAt: z.iso.datetime(),
|
|
61
|
+
eventData: z.object({
|
|
62
|
+
actorBuildId: z.string(),
|
|
63
|
+
actorId: z.string(),
|
|
64
|
+
}),
|
|
65
|
+
eventType: z.enum(APIFY_BUILD_EVENT_TYPES),
|
|
66
|
+
resource: APIFY_BUILD_SCHEMA,
|
|
67
|
+
userId: z.string(),
|
|
68
|
+
});
|
|
69
|
+
export const APIFY_EVENT_SCHEMA = z.union([
|
|
70
|
+
APIFY_RUN_EVENT_SCHEMA,
|
|
71
|
+
APIFY_BUILD_EVENT_SCHEMA,
|
|
72
|
+
]);
|
|
73
|
+
/**
|
|
74
|
+
* Parses and normalizes the default Apify webhook payload.
|
|
75
|
+
*
|
|
76
|
+
* @param value - Untrusted provider payload.
|
|
77
|
+
*/
|
|
78
|
+
export function parseApifyEvent(value) {
|
|
79
|
+
const event = APIFY_WEBHOOK_EVENT_SCHEMA.parse(value);
|
|
80
|
+
if (isApifyRunEventType(event.eventType)) {
|
|
81
|
+
return APIFY_RUN_EVENT_SCHEMA.parse({
|
|
82
|
+
...event,
|
|
83
|
+
eventData: {
|
|
84
|
+
actorId: event.eventData.actorId,
|
|
85
|
+
actorRunId: event.eventData.actorRunId,
|
|
86
|
+
actorTaskId: event.eventData.actorTaskId,
|
|
87
|
+
},
|
|
88
|
+
resource: mapApifyRun(event.resource),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return APIFY_BUILD_EVENT_SCHEMA.parse({
|
|
92
|
+
...event,
|
|
93
|
+
eventData: {
|
|
94
|
+
actorBuildId: event.eventData.actorBuildId,
|
|
95
|
+
actorId: event.eventData.actorId,
|
|
96
|
+
},
|
|
97
|
+
resource: mapApifyBuild(event.resource),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Returns whether an Apify webhook type describes an Actor run.
|
|
102
|
+
*
|
|
103
|
+
* @param type - Provider webhook event type.
|
|
104
|
+
*/
|
|
105
|
+
export function isApifyRunEventType(type) {
|
|
106
|
+
return APIFY_RUN_EVENT_TYPES.includes(type);
|
|
107
|
+
}
|
|
108
|
+
export const apifyRunEventTypeMap = {
|
|
109
|
+
"ACTOR.RUN.ABORTED": "apify.actorRun.aborted",
|
|
110
|
+
"ACTOR.RUN.CREATED": "apify.actorRun.created",
|
|
111
|
+
"ACTOR.RUN.FAILED": "apify.actorRun.failed",
|
|
112
|
+
"ACTOR.RUN.RESURRECTED": "apify.actorRun.resurrected",
|
|
113
|
+
"ACTOR.RUN.SUCCEEDED": "apify.actorRun.succeeded",
|
|
114
|
+
"ACTOR.RUN.TIMED_OUT": "apify.actorRun.timedOut",
|
|
115
|
+
};
|
|
116
|
+
export const apifyBuildEventTypeMap = {
|
|
117
|
+
"ACTOR.BUILD.ABORTED": "apify.actorBuild.aborted",
|
|
118
|
+
"ACTOR.BUILD.CREATED": "apify.actorBuild.created",
|
|
119
|
+
"ACTOR.BUILD.FAILED": "apify.actorBuild.failed",
|
|
120
|
+
"ACTOR.BUILD.SUCCEEDED": "apify.actorBuild.succeeded",
|
|
121
|
+
"ACTOR.BUILD.TIMED_OUT": "apify.actorBuild.timedOut",
|
|
122
|
+
};
|
|
123
|
+
export const apifyEventTypeMap = {
|
|
124
|
+
...apifyRunEventTypeMap,
|
|
125
|
+
...apifyBuildEventTypeMap,
|
|
126
|
+
};
|
|
127
|
+
export const apifyTriggerContracts = {
|
|
128
|
+
"apify.actorBuild.aborted": buildContract("ACTOR.BUILD.ABORTED"),
|
|
129
|
+
"apify.actorBuild.created": buildContract("ACTOR.BUILD.CREATED"),
|
|
130
|
+
"apify.actorBuild.event": {
|
|
131
|
+
configSchema: APIFY_BUILD_TRIGGER_CONFIG_SCHEMA,
|
|
132
|
+
eventSchema: APIFY_BUILD_EVENT_SCHEMA,
|
|
133
|
+
},
|
|
134
|
+
"apify.actorBuild.failed": buildContract("ACTOR.BUILD.FAILED"),
|
|
135
|
+
"apify.actorBuild.succeeded": buildContract("ACTOR.BUILD.SUCCEEDED"),
|
|
136
|
+
"apify.actorBuild.timedOut": buildContract("ACTOR.BUILD.TIMED_OUT"),
|
|
137
|
+
"apify.actorRun.aborted": runContract("ACTOR.RUN.ABORTED"),
|
|
138
|
+
"apify.actorRun.created": runContract("ACTOR.RUN.CREATED"),
|
|
139
|
+
"apify.actorRun.event": {
|
|
140
|
+
configSchema: APIFY_RUN_TRIGGER_CONFIG_SCHEMA,
|
|
141
|
+
eventSchema: APIFY_RUN_EVENT_SCHEMA,
|
|
142
|
+
},
|
|
143
|
+
"apify.actorRun.failed": runContract("ACTOR.RUN.FAILED"),
|
|
144
|
+
"apify.actorRun.resurrected": runContract("ACTOR.RUN.RESURRECTED"),
|
|
145
|
+
"apify.actorRun.succeeded": runContract("ACTOR.RUN.SUCCEEDED"),
|
|
146
|
+
"apify.actorRun.timedOut": runContract("ACTOR.RUN.TIMED_OUT"),
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Builds one Actor run trigger contract.
|
|
150
|
+
*
|
|
151
|
+
* @param type - Exact provider run event type.
|
|
152
|
+
*/
|
|
153
|
+
function runContract(type) {
|
|
154
|
+
return {
|
|
155
|
+
configSchema: APIFY_RUN_TRIGGER_CONFIG_SCHEMA,
|
|
156
|
+
eventSchema: APIFY_RUN_EVENT_SCHEMA.refine((event) => event.eventType === type),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Builds one Actor build trigger contract.
|
|
161
|
+
*
|
|
162
|
+
* @param type - Exact provider build event type.
|
|
163
|
+
*/
|
|
164
|
+
function buildContract(type) {
|
|
165
|
+
return {
|
|
166
|
+
configSchema: APIFY_BUILD_TRIGGER_CONFIG_SCHEMA,
|
|
167
|
+
eventSchema: APIFY_BUILD_EVENT_SCHEMA.refine((event) => event.eventType === type),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
export declare const APIFY_JOB_STATUS_SCHEMA: z.ZodEnum<{
|
|
3
|
+
READY: "READY";
|
|
4
|
+
RUNNING: "RUNNING";
|
|
5
|
+
SUCCEEDED: "SUCCEEDED";
|
|
6
|
+
FAILED: "FAILED";
|
|
7
|
+
"TIMING-OUT": "TIMING-OUT";
|
|
8
|
+
"TIMED-OUT": "TIMED-OUT";
|
|
9
|
+
ABORTING: "ABORTING";
|
|
10
|
+
ABORTED: "ABORTED";
|
|
11
|
+
}>;
|
|
12
|
+
export declare const APIFY_RUN_SCHEMA: z.ZodObject<{
|
|
13
|
+
actorId: z.ZodString;
|
|
14
|
+
actorTaskId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
15
|
+
buildId: z.ZodString;
|
|
16
|
+
buildNumber: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
17
|
+
defaultDatasetId: z.ZodString;
|
|
18
|
+
defaultKeyValueStoreId: z.ZodString;
|
|
19
|
+
defaultRequestQueueId: z.ZodString;
|
|
20
|
+
exitCode: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
21
|
+
finishedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
22
|
+
id: z.ZodString;
|
|
23
|
+
meta: z.ZodObject<{
|
|
24
|
+
origin: z.ZodString;
|
|
25
|
+
scheduleId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
26
|
+
scheduledAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
29
|
+
build: z.ZodString;
|
|
30
|
+
diskMbytes: z.ZodNumber;
|
|
31
|
+
maxItems: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
32
|
+
maxTotalChargeUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
33
|
+
memoryMbytes: z.ZodNumber;
|
|
34
|
+
timeoutSecs: z.ZodNumber;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
startedAt: z.ZodISODateTime;
|
|
37
|
+
stats: z.ZodOptional<z.ZodObject<{
|
|
38
|
+
computeUnits: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
durationMillis: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
runTimeSecs: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
}, z.core.$strip>>;
|
|
42
|
+
status: z.ZodEnum<{
|
|
43
|
+
READY: "READY";
|
|
44
|
+
RUNNING: "RUNNING";
|
|
45
|
+
SUCCEEDED: "SUCCEEDED";
|
|
46
|
+
FAILED: "FAILED";
|
|
47
|
+
"TIMING-OUT": "TIMING-OUT";
|
|
48
|
+
"TIMED-OUT": "TIMED-OUT";
|
|
49
|
+
ABORTING: "ABORTING";
|
|
50
|
+
ABORTED: "ABORTED";
|
|
51
|
+
}>;
|
|
52
|
+
statusMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
usageTotalUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
54
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
export declare const APIFY_BUILD_SCHEMA: z.ZodObject<{
|
|
57
|
+
actorId: z.ZodString;
|
|
58
|
+
buildNumber: z.ZodString;
|
|
59
|
+
finishedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
60
|
+
id: z.ZodString;
|
|
61
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
62
|
+
origin: z.ZodString;
|
|
63
|
+
}, z.core.$strip>>;
|
|
64
|
+
options: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
65
|
+
betaPackages: z.ZodOptional<z.ZodBoolean>;
|
|
66
|
+
diskMbytes: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
memoryMbytes: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
useCache: z.ZodOptional<z.ZodBoolean>;
|
|
69
|
+
}, z.core.$strip>>>;
|
|
70
|
+
startedAt: z.ZodISODateTime;
|
|
71
|
+
stats: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
72
|
+
computeUnits: z.ZodNumber;
|
|
73
|
+
durationMillis: z.ZodNumber;
|
|
74
|
+
runTimeSecs: z.ZodNumber;
|
|
75
|
+
}, z.core.$strip>>>;
|
|
76
|
+
status: z.ZodEnum<{
|
|
77
|
+
READY: "READY";
|
|
78
|
+
RUNNING: "RUNNING";
|
|
79
|
+
SUCCEEDED: "SUCCEEDED";
|
|
80
|
+
FAILED: "FAILED";
|
|
81
|
+
"TIMING-OUT": "TIMING-OUT";
|
|
82
|
+
"TIMED-OUT": "TIMED-OUT";
|
|
83
|
+
ABORTING: "ABORTING";
|
|
84
|
+
ABORTED: "ABORTED";
|
|
85
|
+
}>;
|
|
86
|
+
usageTotalUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
87
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
/**
|
|
90
|
+
* Converts an official Apify Actor run into the public camelCase contract.
|
|
91
|
+
*
|
|
92
|
+
* @param value - Official client or webhook run value.
|
|
93
|
+
*/
|
|
94
|
+
export declare function mapApifyRun(value: unknown): z.output<typeof APIFY_RUN_SCHEMA>;
|
|
95
|
+
/**
|
|
96
|
+
* Converts an official Apify Actor build into the public camelCase contract.
|
|
97
|
+
*
|
|
98
|
+
* @param value - Official client or webhook build value.
|
|
99
|
+
*/
|
|
100
|
+
export declare function mapApifyBuild(value: unknown): z.output<typeof APIFY_BUILD_SCHEMA>;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
export const APIFY_JOB_STATUS_SCHEMA = z.enum([
|
|
3
|
+
"READY",
|
|
4
|
+
"RUNNING",
|
|
5
|
+
"SUCCEEDED",
|
|
6
|
+
"FAILED",
|
|
7
|
+
"TIMING-OUT",
|
|
8
|
+
"TIMED-OUT",
|
|
9
|
+
"ABORTING",
|
|
10
|
+
"ABORTED",
|
|
11
|
+
]);
|
|
12
|
+
const APIFY_DATE_SCHEMA = z.union([z.date(), z.iso.datetime()]);
|
|
13
|
+
const APIFY_RUN_META_SCHEMA = z.looseObject({
|
|
14
|
+
origin: z.string(),
|
|
15
|
+
scheduleId: z.string().nullable().optional(),
|
|
16
|
+
scheduledAt: APIFY_DATE_SCHEMA.nullable().optional(),
|
|
17
|
+
});
|
|
18
|
+
const APIFY_RUN_OPTIONS_SCHEMA = z.looseObject({
|
|
19
|
+
build: z.string(),
|
|
20
|
+
diskMbytes: z.number().int().nonnegative(),
|
|
21
|
+
maxItems: z.number().int().nonnegative().nullable().optional(),
|
|
22
|
+
maxTotalChargeUsd: z.number().nonnegative().nullable().optional(),
|
|
23
|
+
memoryMbytes: z.number().int().min(128).max(32_768),
|
|
24
|
+
timeoutSecs: z.number().int().nonnegative(),
|
|
25
|
+
});
|
|
26
|
+
const APIFY_RUN_STATS_SCHEMA = z.looseObject({
|
|
27
|
+
computeUnits: z.number().nonnegative().optional(),
|
|
28
|
+
durationMillis: z.number().int().nonnegative().optional(),
|
|
29
|
+
runTimeSecs: z.number().nonnegative().optional(),
|
|
30
|
+
});
|
|
31
|
+
const APIFY_BUILD_META_SCHEMA = z.looseObject({ origin: z.string() });
|
|
32
|
+
const APIFY_BUILD_OPTIONS_SCHEMA = z.looseObject({
|
|
33
|
+
betaPackages: z.boolean().optional(),
|
|
34
|
+
diskMbytes: z.number().int().nonnegative().optional(),
|
|
35
|
+
memoryMbytes: z.number().int().min(128).max(32_768).optional(),
|
|
36
|
+
useCache: z.boolean().optional(),
|
|
37
|
+
});
|
|
38
|
+
const APIFY_BUILD_STATS_SCHEMA = z.looseObject({
|
|
39
|
+
computeUnits: z.number().nonnegative(),
|
|
40
|
+
durationMillis: z.number().int().nonnegative(),
|
|
41
|
+
runTimeSecs: z.number().nonnegative(),
|
|
42
|
+
});
|
|
43
|
+
const APIFY_RUN_WIRE_SCHEMA = z.looseObject({
|
|
44
|
+
actId: z.string(),
|
|
45
|
+
actorTaskId: z.string().nullable().optional(),
|
|
46
|
+
buildId: z.string(),
|
|
47
|
+
buildNumber: z.string().nullable().optional(),
|
|
48
|
+
defaultDatasetId: z.string(),
|
|
49
|
+
defaultKeyValueStoreId: z.string(),
|
|
50
|
+
defaultRequestQueueId: z.string(),
|
|
51
|
+
exitCode: z.number().int().nullable().optional(),
|
|
52
|
+
finishedAt: APIFY_DATE_SCHEMA.nullable().optional(),
|
|
53
|
+
id: z.string(),
|
|
54
|
+
meta: APIFY_RUN_META_SCHEMA,
|
|
55
|
+
options: APIFY_RUN_OPTIONS_SCHEMA.optional(),
|
|
56
|
+
startedAt: APIFY_DATE_SCHEMA,
|
|
57
|
+
stats: APIFY_RUN_STATS_SCHEMA.optional(),
|
|
58
|
+
status: APIFY_JOB_STATUS_SCHEMA,
|
|
59
|
+
statusMessage: z.string().nullable().optional(),
|
|
60
|
+
usageTotalUsd: z.number().nonnegative().nullable().optional(),
|
|
61
|
+
userId: z.string().optional(),
|
|
62
|
+
});
|
|
63
|
+
const APIFY_BUILD_WIRE_SCHEMA = z.looseObject({
|
|
64
|
+
actId: z.string(),
|
|
65
|
+
buildNumber: z.string(),
|
|
66
|
+
finishedAt: APIFY_DATE_SCHEMA.nullable().optional(),
|
|
67
|
+
id: z.string(),
|
|
68
|
+
meta: APIFY_BUILD_META_SCHEMA.optional(),
|
|
69
|
+
options: APIFY_BUILD_OPTIONS_SCHEMA.nullable().optional(),
|
|
70
|
+
startedAt: APIFY_DATE_SCHEMA,
|
|
71
|
+
stats: APIFY_BUILD_STATS_SCHEMA.nullable().optional(),
|
|
72
|
+
status: APIFY_JOB_STATUS_SCHEMA,
|
|
73
|
+
usageTotalUsd: z.number().nonnegative().nullable().optional(),
|
|
74
|
+
userId: z.string().optional(),
|
|
75
|
+
});
|
|
76
|
+
export const APIFY_RUN_SCHEMA = z.object({
|
|
77
|
+
actorId: z.string(),
|
|
78
|
+
actorTaskId: z.string().nullable().optional(),
|
|
79
|
+
buildId: z.string(),
|
|
80
|
+
buildNumber: z.string().nullable().optional(),
|
|
81
|
+
defaultDatasetId: z.string(),
|
|
82
|
+
defaultKeyValueStoreId: z.string(),
|
|
83
|
+
defaultRequestQueueId: z.string(),
|
|
84
|
+
exitCode: z.number().int().nullable().optional(),
|
|
85
|
+
finishedAt: z.iso.datetime().nullable().optional(),
|
|
86
|
+
id: z.string(),
|
|
87
|
+
meta: z.object({
|
|
88
|
+
origin: z.string(),
|
|
89
|
+
scheduleId: z.string().nullable().optional(),
|
|
90
|
+
scheduledAt: z.iso.datetime().nullable().optional(),
|
|
91
|
+
}),
|
|
92
|
+
options: z
|
|
93
|
+
.object({
|
|
94
|
+
build: z.string(),
|
|
95
|
+
diskMbytes: z.number().int().nonnegative(),
|
|
96
|
+
maxItems: z.number().int().nonnegative().nullable().optional(),
|
|
97
|
+
maxTotalChargeUsd: z.number().nonnegative().nullable().optional(),
|
|
98
|
+
memoryMbytes: z.number().int().min(128).max(32_768),
|
|
99
|
+
timeoutSecs: z.number().int().nonnegative(),
|
|
100
|
+
})
|
|
101
|
+
.optional(),
|
|
102
|
+
startedAt: z.iso.datetime(),
|
|
103
|
+
stats: z
|
|
104
|
+
.object({
|
|
105
|
+
computeUnits: z.number().nonnegative().optional(),
|
|
106
|
+
durationMillis: z.number().int().nonnegative().optional(),
|
|
107
|
+
runTimeSecs: z.number().nonnegative().optional(),
|
|
108
|
+
})
|
|
109
|
+
.optional(),
|
|
110
|
+
status: APIFY_JOB_STATUS_SCHEMA,
|
|
111
|
+
statusMessage: z.string().nullable().optional(),
|
|
112
|
+
usageTotalUsd: z.number().nonnegative().nullable().optional(),
|
|
113
|
+
userId: z.string().optional(),
|
|
114
|
+
});
|
|
115
|
+
export const APIFY_BUILD_SCHEMA = z.object({
|
|
116
|
+
actorId: z.string(),
|
|
117
|
+
buildNumber: z.string(),
|
|
118
|
+
finishedAt: z.iso.datetime().nullable().optional(),
|
|
119
|
+
id: z.string(),
|
|
120
|
+
meta: z.object({ origin: z.string() }).optional(),
|
|
121
|
+
options: z
|
|
122
|
+
.object({
|
|
123
|
+
betaPackages: z.boolean().optional(),
|
|
124
|
+
diskMbytes: z.number().int().nonnegative().optional(),
|
|
125
|
+
memoryMbytes: z.number().int().min(128).max(32_768).optional(),
|
|
126
|
+
useCache: z.boolean().optional(),
|
|
127
|
+
})
|
|
128
|
+
.nullable()
|
|
129
|
+
.optional(),
|
|
130
|
+
startedAt: z.iso.datetime(),
|
|
131
|
+
stats: z
|
|
132
|
+
.object({
|
|
133
|
+
computeUnits: z.number().nonnegative(),
|
|
134
|
+
durationMillis: z.number().int().nonnegative(),
|
|
135
|
+
runTimeSecs: z.number().nonnegative(),
|
|
136
|
+
})
|
|
137
|
+
.nullable()
|
|
138
|
+
.optional(),
|
|
139
|
+
status: APIFY_JOB_STATUS_SCHEMA,
|
|
140
|
+
usageTotalUsd: z.number().nonnegative().nullable().optional(),
|
|
141
|
+
userId: z.string().optional(),
|
|
142
|
+
});
|
|
143
|
+
/**
|
|
144
|
+
* Converts an official Apify Actor run into the public camelCase contract.
|
|
145
|
+
*
|
|
146
|
+
* @param value - Official client or webhook run value.
|
|
147
|
+
*/
|
|
148
|
+
export function mapApifyRun(value) {
|
|
149
|
+
const run = APIFY_RUN_WIRE_SCHEMA.parse(value);
|
|
150
|
+
return APIFY_RUN_SCHEMA.parse({
|
|
151
|
+
actorId: run.actId,
|
|
152
|
+
actorTaskId: run.actorTaskId,
|
|
153
|
+
buildId: run.buildId,
|
|
154
|
+
buildNumber: run.buildNumber,
|
|
155
|
+
defaultDatasetId: run.defaultDatasetId,
|
|
156
|
+
defaultKeyValueStoreId: run.defaultKeyValueStoreId,
|
|
157
|
+
defaultRequestQueueId: run.defaultRequestQueueId,
|
|
158
|
+
exitCode: run.exitCode,
|
|
159
|
+
finishedAt: toIsoDate(run.finishedAt),
|
|
160
|
+
id: run.id,
|
|
161
|
+
meta: {
|
|
162
|
+
origin: run.meta.origin,
|
|
163
|
+
scheduleId: run.meta.scheduleId,
|
|
164
|
+
scheduledAt: toIsoDate(run.meta.scheduledAt),
|
|
165
|
+
},
|
|
166
|
+
options: run.options,
|
|
167
|
+
startedAt: toIsoDate(run.startedAt),
|
|
168
|
+
stats: run.stats,
|
|
169
|
+
status: run.status,
|
|
170
|
+
statusMessage: run.statusMessage,
|
|
171
|
+
usageTotalUsd: run.usageTotalUsd,
|
|
172
|
+
userId: run.userId,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Converts an official Apify Actor build into the public camelCase contract.
|
|
177
|
+
*
|
|
178
|
+
* @param value - Official client or webhook build value.
|
|
179
|
+
*/
|
|
180
|
+
export function mapApifyBuild(value) {
|
|
181
|
+
const build = APIFY_BUILD_WIRE_SCHEMA.parse(value);
|
|
182
|
+
return APIFY_BUILD_SCHEMA.parse({
|
|
183
|
+
actorId: build.actId,
|
|
184
|
+
buildNumber: build.buildNumber,
|
|
185
|
+
finishedAt: toIsoDate(build.finishedAt),
|
|
186
|
+
id: build.id,
|
|
187
|
+
meta: build.meta,
|
|
188
|
+
options: build.options,
|
|
189
|
+
startedAt: toIsoDate(build.startedAt),
|
|
190
|
+
stats: build.stats,
|
|
191
|
+
status: build.status,
|
|
192
|
+
usageTotalUsd: build.usageTotalUsd,
|
|
193
|
+
userId: build.userId,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Normalizes an optional provider date without changing nullability.
|
|
198
|
+
*
|
|
199
|
+
* @param value - Provider date value.
|
|
200
|
+
*/
|
|
201
|
+
function toIsoDate(value) {
|
|
202
|
+
return value instanceof Date ? value.toISOString() : value;
|
|
203
|
+
}
|
package/dist/linear/schemas.d.ts
CHANGED
|
@@ -4391,10 +4391,8 @@ export declare const LINEAR_ISSUE_RELATION_SCHEMA: z.ZodObject<{
|
|
|
4391
4391
|
updatedAt: z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>;
|
|
4392
4392
|
}, z.core.$strip>;
|
|
4393
4393
|
export declare const LINEAR_PROVIDER_PROJECT_SCHEMA: z.ZodObject<{
|
|
4394
|
-
name: z.ZodString;
|
|
4395
|
-
description: z.ZodString;
|
|
4396
|
-
createdAt: z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>;
|
|
4397
4394
|
id: z.ZodString;
|
|
4395
|
+
startedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>;
|
|
4398
4396
|
status: z.ZodObject<{
|
|
4399
4397
|
color: z.ZodString;
|
|
4400
4398
|
description: z.ZodNullable<z.ZodString>;
|
|
@@ -4402,8 +4400,10 @@ export declare const LINEAR_PROVIDER_PROJECT_SCHEMA: z.ZodObject<{
|
|
|
4402
4400
|
name: z.ZodString;
|
|
4403
4401
|
type: z.ZodString;
|
|
4404
4402
|
}, z.core.$strip>;
|
|
4403
|
+
createdAt: z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>;
|
|
4404
|
+
description: z.ZodString;
|
|
4405
|
+
name: z.ZodString;
|
|
4405
4406
|
completedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>;
|
|
4406
|
-
startedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>;
|
|
4407
4407
|
color: z.ZodString;
|
|
4408
4408
|
content: z.ZodNullable<z.ZodString>;
|
|
4409
4409
|
priority: z.ZodNumber;
|
|
@@ -4469,9 +4469,11 @@ export declare const LINEAR_PROVIDER_PROJECT_SCHEMA: z.ZodObject<{
|
|
|
4469
4469
|
}, z.core.$strip>;
|
|
4470
4470
|
export declare const LINEAR_PROVIDER_ISSUE_SCHEMA: z.ZodObject<{
|
|
4471
4471
|
number: z.ZodNumber;
|
|
4472
|
-
description: z.ZodNullable<z.ZodString>;
|
|
4473
|
-
createdAt: z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>;
|
|
4474
4472
|
id: z.ZodString;
|
|
4473
|
+
startedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>;
|
|
4474
|
+
createdAt: z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>;
|
|
4475
|
+
title: z.ZodString;
|
|
4476
|
+
description: z.ZodNullable<z.ZodString>;
|
|
4475
4477
|
project: z.ZodNullable<z.ZodObject<{
|
|
4476
4478
|
id: z.ZodString;
|
|
4477
4479
|
name: z.ZodString;
|
|
@@ -4479,7 +4481,6 @@ export declare const LINEAR_PROVIDER_ISSUE_SCHEMA: z.ZodObject<{
|
|
|
4479
4481
|
url: z.ZodString;
|
|
4480
4482
|
}, z.core.$strip>>;
|
|
4481
4483
|
completedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>;
|
|
4482
|
-
startedAt: z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>;
|
|
4483
4484
|
parent: z.ZodNullable<z.ZodObject<{
|
|
4484
4485
|
id: z.ZodString;
|
|
4485
4486
|
identifier: z.ZodString;
|
|
@@ -4500,7 +4501,6 @@ export declare const LINEAR_PROVIDER_ISSUE_SCHEMA: z.ZodObject<{
|
|
|
4500
4501
|
id: z.ZodString;
|
|
4501
4502
|
name: z.ZodString;
|
|
4502
4503
|
}, z.core.$strip>>;
|
|
4503
|
-
title: z.ZodString;
|
|
4504
4504
|
priority: z.ZodNumber;
|
|
4505
4505
|
url: z.ZodString;
|
|
4506
4506
|
updatedAt: z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>;
|