@trigger.dev/core 2.1.7 → 2.1.9
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/index.d.ts +440 -1
- package/dist/index.js +125 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
7
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
8
|
var __export = (target, all) => {
|
|
8
9
|
for (var name in all)
|
|
@@ -17,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
18
|
return to;
|
|
18
19
|
};
|
|
19
20
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var __publicField = (obj, key, value) => {
|
|
22
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
23
|
+
return value;
|
|
24
|
+
};
|
|
20
25
|
var __accessCheck = (obj, member, msg) => {
|
|
21
26
|
if (!member.has(obj))
|
|
22
27
|
throw TypeError("Cannot " + msg);
|
|
@@ -43,7 +48,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
43
48
|
// src/index.ts
|
|
44
49
|
var src_exports = {};
|
|
45
50
|
__export(src_exports, {
|
|
51
|
+
API_VERSIONS: () => API_VERSIONS,
|
|
46
52
|
ApiEventLogSchema: () => ApiEventLogSchema,
|
|
53
|
+
BloomFilter: () => BloomFilter,
|
|
47
54
|
CachedTaskSchema: () => CachedTaskSchema,
|
|
48
55
|
CommonMissingConnectionNotificationPayloadSchema: () => CommonMissingConnectionNotificationPayloadSchema,
|
|
49
56
|
CommonMissingConnectionNotificationResolvedPayloadSchema: () => CommonMissingConnectionNotificationResolvedPayloadSchema,
|
|
@@ -59,6 +66,7 @@ __export(src_exports, {
|
|
|
59
66
|
DisplayPropertySchema: () => DisplayPropertySchema,
|
|
60
67
|
DynamicTriggerEndpointMetadataSchema: () => DynamicTriggerEndpointMetadataSchema,
|
|
61
68
|
DynamicTriggerMetadataSchema: () => DynamicTriggerMetadataSchema,
|
|
69
|
+
EndpointHeadersSchema: () => EndpointHeadersSchema,
|
|
62
70
|
ErrorWithStackSchema: () => ErrorWithStackSchema,
|
|
63
71
|
EventExampleSchema: () => EventExampleSchema,
|
|
64
72
|
EventFilterSchema: () => EventFilterSchema,
|
|
@@ -100,6 +108,7 @@ __export(src_exports, {
|
|
|
100
108
|
MissingExternalConnectionResolvedNotificationPayloadSchema: () => MissingExternalConnectionResolvedNotificationPayloadSchema,
|
|
101
109
|
NormalizedRequestSchema: () => NormalizedRequestSchema,
|
|
102
110
|
NormalizedResponseSchema: () => NormalizedResponseSchema,
|
|
111
|
+
PLATFORM_FEATURES: () => PLATFORM_FEATURES,
|
|
103
112
|
PongErrorResponseSchema: () => PongErrorResponseSchema,
|
|
104
113
|
PongResponseSchema: () => PongResponseSchema,
|
|
105
114
|
PongSuccessResponseSchema: () => PongSuccessResponseSchema,
|
|
@@ -134,11 +143,13 @@ __export(src_exports, {
|
|
|
134
143
|
RunJobRetryWithTaskSchema: () => RunJobRetryWithTaskSchema,
|
|
135
144
|
RunJobSuccessSchema: () => RunJobSuccessSchema,
|
|
136
145
|
RunJobUnresolvedAuthErrorSchema: () => RunJobUnresolvedAuthErrorSchema,
|
|
146
|
+
RunJobYieldExecutionErrorSchema: () => RunJobYieldExecutionErrorSchema,
|
|
137
147
|
RunSourceContextSchema: () => RunSourceContextSchema,
|
|
138
148
|
RunStatusSchema: () => RunStatusSchema,
|
|
139
149
|
RunTaskBodyInputSchema: () => RunTaskBodyInputSchema,
|
|
140
150
|
RunTaskBodyOutputSchema: () => RunTaskBodyOutputSchema,
|
|
141
151
|
RunTaskOptionsSchema: () => RunTaskOptionsSchema,
|
|
152
|
+
RunTaskResponseWithCachedTasksBodySchema: () => RunTaskResponseWithCachedTasksBodySchema,
|
|
142
153
|
RunTaskSchema: () => RunTaskSchema,
|
|
143
154
|
RuntimeEnvironmentTypeSchema: () => RuntimeEnvironmentTypeSchema,
|
|
144
155
|
SCHEDULED_EVENT: () => SCHEDULED_EVENT,
|
|
@@ -173,6 +184,7 @@ __export(src_exports, {
|
|
|
173
184
|
deepMergeFilters: () => deepMergeFilters,
|
|
174
185
|
eventFilterMatches: () => eventFilterMatches,
|
|
175
186
|
replacements: () => replacements,
|
|
187
|
+
supportsFeature: () => supportsFeature,
|
|
176
188
|
urlWithSearchParams: () => urlWithSearchParams
|
|
177
189
|
});
|
|
178
190
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -578,7 +590,8 @@ var TaskSchema = import_zod7.z.object({
|
|
|
578
590
|
error: import_zod7.z.string().optional().nullable(),
|
|
579
591
|
parentId: import_zod7.z.string().optional().nullable(),
|
|
580
592
|
style: StyleSchema.optional().nullable(),
|
|
581
|
-
operation: import_zod7.z.string().optional().nullable()
|
|
593
|
+
operation: import_zod7.z.string().optional().nullable(),
|
|
594
|
+
callbackUrl: import_zod7.z.string().optional().nullable()
|
|
582
595
|
});
|
|
583
596
|
var ServerTaskSchema = TaskSchema.extend({
|
|
584
597
|
idempotencyKey: import_zod7.z.string(),
|
|
@@ -851,11 +864,13 @@ var HttpSourceRequestHeadersSchema = import_zod11.z.object({
|
|
|
851
864
|
})
|
|
852
865
|
});
|
|
853
866
|
var PongSuccessResponseSchema = import_zod11.z.object({
|
|
854
|
-
ok: import_zod11.z.literal(true)
|
|
867
|
+
ok: import_zod11.z.literal(true),
|
|
868
|
+
triggerVersion: import_zod11.z.string().optional()
|
|
855
869
|
});
|
|
856
870
|
var PongErrorResponseSchema = import_zod11.z.object({
|
|
857
871
|
ok: import_zod11.z.literal(false),
|
|
858
|
-
error: import_zod11.z.string()
|
|
872
|
+
error: import_zod11.z.string(),
|
|
873
|
+
triggerVersion: import_zod11.z.string().optional()
|
|
859
874
|
});
|
|
860
875
|
var PongResponseSchema = import_zod11.z.discriminatedUnion("ok", [
|
|
861
876
|
PongSuccessResponseSchema,
|
|
@@ -863,11 +878,13 @@ var PongResponseSchema = import_zod11.z.discriminatedUnion("ok", [
|
|
|
863
878
|
]);
|
|
864
879
|
var ValidateSuccessResponseSchema = import_zod11.z.object({
|
|
865
880
|
ok: import_zod11.z.literal(true),
|
|
866
|
-
endpointId: import_zod11.z.string()
|
|
881
|
+
endpointId: import_zod11.z.string(),
|
|
882
|
+
triggerVersion: import_zod11.z.string().optional()
|
|
867
883
|
});
|
|
868
884
|
var ValidateErrorResponseSchema = import_zod11.z.object({
|
|
869
885
|
ok: import_zod11.z.literal(false),
|
|
870
|
-
error: import_zod11.z.string()
|
|
886
|
+
error: import_zod11.z.string(),
|
|
887
|
+
triggerVersion: import_zod11.z.string().optional()
|
|
871
888
|
});
|
|
872
889
|
var ValidateResponseSchema = import_zod11.z.discriminatedUnion("ok", [
|
|
873
890
|
ValidateSuccessResponseSchema,
|
|
@@ -945,6 +962,9 @@ var IndexEndpointResponseSchema = import_zod11.z.object({
|
|
|
945
962
|
dynamicTriggers: import_zod11.z.array(DynamicTriggerEndpointMetadataSchema),
|
|
946
963
|
dynamicSchedules: import_zod11.z.array(RegisterDynamicSchedulePayloadSchema)
|
|
947
964
|
});
|
|
965
|
+
var EndpointHeadersSchema = import_zod11.z.object({
|
|
966
|
+
"trigger-version": import_zod11.z.string().optional()
|
|
967
|
+
});
|
|
948
968
|
var RawEventSchema = import_zod11.z.object({
|
|
949
969
|
/** The `name` property must exactly match any subscriptions you want to
|
|
950
970
|
trigger. */
|
|
@@ -1052,13 +1072,20 @@ var RunJobBodySchema = import_zod11.z.object({
|
|
|
1052
1072
|
}).optional(),
|
|
1053
1073
|
source: RunSourceContextSchema.optional(),
|
|
1054
1074
|
tasks: import_zod11.z.array(CachedTaskSchema).optional(),
|
|
1055
|
-
|
|
1075
|
+
cachedTaskCursor: import_zod11.z.string().optional(),
|
|
1076
|
+
noopTasksSet: import_zod11.z.string().optional(),
|
|
1077
|
+
connections: import_zod11.z.record(ConnectionAuthSchema).optional(),
|
|
1078
|
+
yieldedExecutions: import_zod11.z.string().array().optional()
|
|
1056
1079
|
});
|
|
1057
1080
|
var RunJobErrorSchema = import_zod11.z.object({
|
|
1058
1081
|
status: import_zod11.z.literal("ERROR"),
|
|
1059
1082
|
error: ErrorWithStackSchema,
|
|
1060
1083
|
task: TaskSchema.optional()
|
|
1061
1084
|
});
|
|
1085
|
+
var RunJobYieldExecutionErrorSchema = import_zod11.z.object({
|
|
1086
|
+
status: import_zod11.z.literal("YIELD_EXECUTION"),
|
|
1087
|
+
key: import_zod11.z.string()
|
|
1088
|
+
});
|
|
1062
1089
|
var RunJobInvalidPayloadErrorSchema = import_zod11.z.object({
|
|
1063
1090
|
status: import_zod11.z.literal("INVALID_PAYLOAD"),
|
|
1064
1091
|
errors: import_zod11.z.array(SchemaErrorSchema)
|
|
@@ -1089,6 +1116,7 @@ var RunJobSuccessSchema = import_zod11.z.object({
|
|
|
1089
1116
|
output: DeserializedJsonSchema.optional()
|
|
1090
1117
|
});
|
|
1091
1118
|
var RunJobResponseSchema = import_zod11.z.discriminatedUnion("status", [
|
|
1119
|
+
RunJobYieldExecutionErrorSchema,
|
|
1092
1120
|
RunJobErrorSchema,
|
|
1093
1121
|
RunJobUnresolvedAuthErrorSchema,
|
|
1094
1122
|
RunJobInvalidPayloadErrorSchema,
|
|
@@ -1191,6 +1219,13 @@ var RunTaskOptionsSchema = import_zod11.z.object({
|
|
|
1191
1219
|
params: import_zod11.z.any(),
|
|
1192
1220
|
/** The style of the log entry. */
|
|
1193
1221
|
style: StyleSchema.optional(),
|
|
1222
|
+
/** Allows you to expose a `task.callbackUrl` to use in your tasks. Enabling this feature will cause the task to return the data sent to the callbackUrl instead of the usual async callback result. */
|
|
1223
|
+
callback: import_zod11.z.object({
|
|
1224
|
+
/** Causes the task to wait for and return the data of the first request sent to `task.callbackUrl`. */
|
|
1225
|
+
enabled: import_zod11.z.boolean(),
|
|
1226
|
+
/** Time to wait for the first request to `task.callbackUrl`. Default: One hour. */
|
|
1227
|
+
timeoutInSeconds: import_zod11.z.number()
|
|
1228
|
+
}).partial().optional(),
|
|
1194
1229
|
/** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
|
|
1195
1230
|
connectionKey: import_zod11.z.string().optional(),
|
|
1196
1231
|
/** An operation you want to perform on the Trigger.dev platform, current only "fetch" is supported. If you wish to `fetch` use [`io.backgroundFetch()`](https://trigger.dev/docs/sdk/io/backgroundfetch) instead. */
|
|
@@ -1207,7 +1242,18 @@ var RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({
|
|
|
1207
1242
|
parentId: import_zod11.z.string().optional()
|
|
1208
1243
|
});
|
|
1209
1244
|
var RunTaskBodyOutputSchema = RunTaskBodyInputSchema.extend({
|
|
1210
|
-
params: DeserializedJsonSchema.optional().nullable()
|
|
1245
|
+
params: DeserializedJsonSchema.optional().nullable(),
|
|
1246
|
+
callback: import_zod11.z.object({
|
|
1247
|
+
enabled: import_zod11.z.boolean(),
|
|
1248
|
+
timeoutInSeconds: import_zod11.z.number().default(3600)
|
|
1249
|
+
}).optional()
|
|
1250
|
+
});
|
|
1251
|
+
var RunTaskResponseWithCachedTasksBodySchema = import_zod11.z.object({
|
|
1252
|
+
task: ServerTaskSchema,
|
|
1253
|
+
cachedTasks: import_zod11.z.object({
|
|
1254
|
+
tasks: import_zod11.z.array(CachedTaskSchema),
|
|
1255
|
+
cursor: import_zod11.z.string().optional()
|
|
1256
|
+
}).optional()
|
|
1211
1257
|
});
|
|
1212
1258
|
var CompleteTaskBodyInputSchema = RunTaskBodyInputSchema.pick({
|
|
1213
1259
|
properties: true,
|
|
@@ -1633,4 +1679,76 @@ function contentFilterMatches(actualValue, contentFilter) {
|
|
|
1633
1679
|
return true;
|
|
1634
1680
|
}
|
|
1635
1681
|
__name(contentFilterMatches, "contentFilterMatches");
|
|
1682
|
+
|
|
1683
|
+
// src/bloom.ts
|
|
1684
|
+
var import_node_buffer = require("buffer");
|
|
1685
|
+
var _BloomFilter = class _BloomFilter {
|
|
1686
|
+
constructor(size) {
|
|
1687
|
+
this.size = size;
|
|
1688
|
+
this.bitArray = new Uint8Array(Math.ceil(size / 8));
|
|
1689
|
+
}
|
|
1690
|
+
add(item) {
|
|
1691
|
+
const index = murmurHash3(item) % this.size;
|
|
1692
|
+
this.bitArray[Math.floor(index / 8)] |= 1 << index % 8;
|
|
1693
|
+
}
|
|
1694
|
+
test(item) {
|
|
1695
|
+
const index = murmurHash3(item) % this.size;
|
|
1696
|
+
return (this.bitArray[Math.floor(index / 8)] & 1 << index % 8) !== 0;
|
|
1697
|
+
}
|
|
1698
|
+
// Serialize to a Base64 string
|
|
1699
|
+
serialize() {
|
|
1700
|
+
return import_node_buffer.Buffer.from(this.bitArray).toString("base64");
|
|
1701
|
+
}
|
|
1702
|
+
// Deserialize from a Base64 string
|
|
1703
|
+
static deserialize(str, size) {
|
|
1704
|
+
const filter = new _BloomFilter(size);
|
|
1705
|
+
filter.bitArray = Uint8Array.from(import_node_buffer.Buffer.from(str, "base64"));
|
|
1706
|
+
return filter;
|
|
1707
|
+
}
|
|
1708
|
+
};
|
|
1709
|
+
__name(_BloomFilter, "BloomFilter");
|
|
1710
|
+
__publicField(_BloomFilter, "NOOP_TASK_SET_SIZE", 32768);
|
|
1711
|
+
var BloomFilter = _BloomFilter;
|
|
1712
|
+
function murmurHash3(str, seed = 0) {
|
|
1713
|
+
let h1 = 3735928559 ^ seed, h2 = 1103547991 ^ seed;
|
|
1714
|
+
for (let i = 0, ch; i < str.length; i++) {
|
|
1715
|
+
ch = str.charCodeAt(i);
|
|
1716
|
+
h1 = Math.imul(h1 ^ ch, 3432918353);
|
|
1717
|
+
h1 = h1 << 15 | h1 >>> 17;
|
|
1718
|
+
h1 = Math.imul(h1, 461845907);
|
|
1719
|
+
h2 = Math.imul(h2 ^ ch, 2246822507);
|
|
1720
|
+
h2 = h2 << 13 | h2 >>> 19;
|
|
1721
|
+
h2 = Math.imul(h2, 3266489909);
|
|
1722
|
+
}
|
|
1723
|
+
h1 ^= str.length;
|
|
1724
|
+
h2 ^= str.length;
|
|
1725
|
+
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507);
|
|
1726
|
+
h1 = Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
1727
|
+
h1 ^= h1 >>> 16;
|
|
1728
|
+
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507);
|
|
1729
|
+
h2 = Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
1730
|
+
h2 ^= h2 >>> 16;
|
|
1731
|
+
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
|
|
1732
|
+
}
|
|
1733
|
+
__name(murmurHash3, "murmurHash3");
|
|
1734
|
+
|
|
1735
|
+
// src/index.ts
|
|
1736
|
+
var API_VERSIONS = {
|
|
1737
|
+
LAZY_LOADED_CACHED_TASKS: "2023-09-29"
|
|
1738
|
+
};
|
|
1739
|
+
var PLATFORM_FEATURES = {
|
|
1740
|
+
yieldExecution: API_VERSIONS.LAZY_LOADED_CACHED_TASKS,
|
|
1741
|
+
lazyLoadedCachedTasks: API_VERSIONS.LAZY_LOADED_CACHED_TASKS
|
|
1742
|
+
};
|
|
1743
|
+
function supportsFeature(featureName, version) {
|
|
1744
|
+
if (version === "unversioned" || version === "unknown") {
|
|
1745
|
+
return false;
|
|
1746
|
+
}
|
|
1747
|
+
const supportedVersion = PLATFORM_FEATURES[featureName];
|
|
1748
|
+
if (!supportedVersion) {
|
|
1749
|
+
return false;
|
|
1750
|
+
}
|
|
1751
|
+
return version >= supportedVersion;
|
|
1752
|
+
}
|
|
1753
|
+
__name(supportsFeature, "supportsFeature");
|
|
1636
1754
|
//# sourceMappingURL=index.js.map
|