@trigger.dev/core 3.0.0-beta.39 → 3.0.0-beta.40
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/{messages--WkQvA2l.d.mts → messages-xJbR1Vai.d.mts} +10 -0
- package/dist/{messages--WkQvA2l.d.ts → messages-xJbR1Vai.d.ts} +10 -0
- package/dist/v3/index.d.mts +5 -9
- package/dist/v3/index.d.ts +5 -9
- package/dist/v3/index.js +10 -136
- package/dist/v3/index.js.map +1 -1
- package/dist/v3/index.mjs +10 -136
- package/dist/v3/index.mjs.map +1 -1
- package/dist/v3/otel/index.js +9 -5
- package/dist/v3/otel/index.js.map +1 -1
- package/dist/v3/otel/index.mjs +9 -5
- package/dist/v3/otel/index.mjs.map +1 -1
- package/dist/v3/prod/index.d.mts +1 -1
- package/dist/v3/prod/index.d.ts +1 -1
- package/dist/v3/workers/index.d.mts +1 -1
- package/dist/v3/workers/index.d.ts +1 -1
- package/dist/v3/workers/index.js +14 -139
- package/dist/v3/workers/index.js.map +1 -1
- package/dist/v3/workers/index.mjs +14 -139
- package/dist/v3/workers/index.mjs.map +1 -1
- package/dist/v3/zodfetch.d.mts +1 -57
- package/dist/v3/zodfetch.d.ts +1 -57
- package/dist/v3/zodfetch.js +0 -130
- package/dist/v3/zodfetch.js.map +1 -1
- package/dist/v3/zodfetch.mjs +1 -123
- package/dist/v3/zodfetch.mjs.map +1 -1
- package/package.json +2 -2
package/dist/v3/index.mjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { propagation, context, trace, SpanStatusCode } from '@opentelemetry/api';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { fromZodError } from 'zod-validation-error';
|
|
4
|
-
import { FormDataEncoder } from 'form-data-encoder';
|
|
5
|
-
import { Readable } from 'node:stream';
|
|
6
4
|
import { PreciseDate } from '@google-cloud/precise-date';
|
|
7
5
|
import { logs } from '@opentelemetry/api-logs';
|
|
8
6
|
import humanizeDuration from 'humanize-duration';
|
|
@@ -29,7 +27,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
29
27
|
};
|
|
30
28
|
|
|
31
29
|
// package.json
|
|
32
|
-
var version = "3.0.0-beta.
|
|
30
|
+
var version = "3.0.0-beta.40";
|
|
33
31
|
var dependencies = {
|
|
34
32
|
"@google-cloud/precise-date": "^4.0.0",
|
|
35
33
|
"@opentelemetry/api": "^1.8.0",
|
|
@@ -43,7 +41,6 @@ var dependencies = {
|
|
|
43
41
|
"@opentelemetry/sdk-trace-base": "^1.22.0",
|
|
44
42
|
"@opentelemetry/sdk-trace-node": "^1.22.0",
|
|
45
43
|
"@opentelemetry/semantic-conventions": "^1.22.0",
|
|
46
|
-
"form-data-encoder": "^4.0.2",
|
|
47
44
|
"humanize-duration": "^3.27.3",
|
|
48
45
|
"socket.io-client": "4.7.4",
|
|
49
46
|
superjson: "^2.2.1",
|
|
@@ -1511,6 +1508,10 @@ var CoordinatorToPlatformMessages = {
|
|
|
1511
1508
|
attemptNumber: z.number()
|
|
1512
1509
|
})
|
|
1513
1510
|
])
|
|
1511
|
+
}),
|
|
1512
|
+
callback: z.object({
|
|
1513
|
+
version: z.literal("v1").default("v1"),
|
|
1514
|
+
keepRunAlive: z.boolean()
|
|
1514
1515
|
})
|
|
1515
1516
|
},
|
|
1516
1517
|
INDEXING_FAILED: {
|
|
@@ -2621,37 +2622,6 @@ function zodfetchOffsetLimitPage(schema, url, params, requestInit, options) {
|
|
|
2621
2622
|
return new OffsetLimitPagePromise(fetchResult, schema, url, params, requestInit, options);
|
|
2622
2623
|
}
|
|
2623
2624
|
__name(zodfetchOffsetLimitPage, "zodfetchOffsetLimitPage");
|
|
2624
|
-
function zodupload(schema, url, body, requestInit, options) {
|
|
2625
|
-
const finalRequestInit = createMultipartFormRequestInit(body, requestInit);
|
|
2626
|
-
return new ApiPromise(_doZodFetch(schema, url, finalRequestInit, options));
|
|
2627
|
-
}
|
|
2628
|
-
__name(zodupload, "zodupload");
|
|
2629
|
-
async function createMultipartFormRequestInit(body, requestInit) {
|
|
2630
|
-
const form = await createForm(body);
|
|
2631
|
-
const encoder = new FormDataEncoder(form);
|
|
2632
|
-
const finalHeaders = {};
|
|
2633
|
-
for (const [key, value] of Object.entries(requestInit?.headers || {})) {
|
|
2634
|
-
finalHeaders[key] = value;
|
|
2635
|
-
}
|
|
2636
|
-
for (const [key, value] of Object.entries(encoder.headers)) {
|
|
2637
|
-
finalHeaders[key] = value;
|
|
2638
|
-
}
|
|
2639
|
-
finalHeaders["Content-Length"] = String(encoder.contentLength);
|
|
2640
|
-
const finalRequestInit = {
|
|
2641
|
-
...requestInit,
|
|
2642
|
-
headers: finalHeaders,
|
|
2643
|
-
body: Readable.from(encoder),
|
|
2644
|
-
// @ts-expect-error
|
|
2645
|
-
duplex: "half"
|
|
2646
|
-
};
|
|
2647
|
-
return finalRequestInit;
|
|
2648
|
-
}
|
|
2649
|
-
__name(createMultipartFormRequestInit, "createMultipartFormRequestInit");
|
|
2650
|
-
var createForm = /* @__PURE__ */ __name(async (body) => {
|
|
2651
|
-
const form = new FormData();
|
|
2652
|
-
await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value)));
|
|
2653
|
-
return form;
|
|
2654
|
-
}, "createForm");
|
|
2655
2625
|
async function _doZodFetch(schema, url, requestInit, options, attempt = 1) {
|
|
2656
2626
|
try {
|
|
2657
2627
|
const $requestInit = await requestInit;
|
|
@@ -2777,95 +2747,6 @@ function requestInitWithCache(requestInit) {
|
|
|
2777
2747
|
}
|
|
2778
2748
|
}
|
|
2779
2749
|
__name(requestInitWithCache, "requestInitWithCache");
|
|
2780
|
-
var addFormValue = /* @__PURE__ */ __name(async (form, key, value) => {
|
|
2781
|
-
if (value === void 0)
|
|
2782
|
-
return;
|
|
2783
|
-
if (value == null) {
|
|
2784
|
-
throw new TypeError(`Received null for "${key}"; to pass null in FormData, you must use the string 'null'`);
|
|
2785
|
-
}
|
|
2786
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
2787
|
-
form.append(key, String(value));
|
|
2788
|
-
} else if (isUploadable(value) || isBlobLike(value) || value instanceof Buffer || value instanceof ArrayBuffer) {
|
|
2789
|
-
const file = await toFile(value);
|
|
2790
|
-
form.append(key, file);
|
|
2791
|
-
} else if (Array.isArray(value)) {
|
|
2792
|
-
await Promise.all(value.map((entry) => addFormValue(form, key + "[]", entry)));
|
|
2793
|
-
} else if (typeof value === "object") {
|
|
2794
|
-
await Promise.all(Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop)));
|
|
2795
|
-
} else {
|
|
2796
|
-
throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`);
|
|
2797
|
-
}
|
|
2798
|
-
}, "addFormValue");
|
|
2799
|
-
async function toFile(value, name, options) {
|
|
2800
|
-
value = await value;
|
|
2801
|
-
options ??= isFileLike(value) ? {
|
|
2802
|
-
lastModified: value.lastModified,
|
|
2803
|
-
type: value.type
|
|
2804
|
-
} : {};
|
|
2805
|
-
if (isResponseLike(value)) {
|
|
2806
|
-
const blob = await value.blob();
|
|
2807
|
-
name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? "unknown_file";
|
|
2808
|
-
return new File([
|
|
2809
|
-
blob
|
|
2810
|
-
], name, options);
|
|
2811
|
-
}
|
|
2812
|
-
const bits = await getBytes(value);
|
|
2813
|
-
name ||= getName(value) ?? "unknown_file";
|
|
2814
|
-
if (!options.type) {
|
|
2815
|
-
const type = bits[0]?.type;
|
|
2816
|
-
if (typeof type === "string") {
|
|
2817
|
-
options = {
|
|
2818
|
-
...options,
|
|
2819
|
-
type
|
|
2820
|
-
};
|
|
2821
|
-
}
|
|
2822
|
-
}
|
|
2823
|
-
return new File(bits, name, options);
|
|
2824
|
-
}
|
|
2825
|
-
__name(toFile, "toFile");
|
|
2826
|
-
function getName(value) {
|
|
2827
|
-
return getStringFromMaybeBuffer(value.name) || getStringFromMaybeBuffer(value.filename) || // For fs.ReadStream
|
|
2828
|
-
getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop();
|
|
2829
|
-
}
|
|
2830
|
-
__name(getName, "getName");
|
|
2831
|
-
var getStringFromMaybeBuffer = /* @__PURE__ */ __name((x) => {
|
|
2832
|
-
if (typeof x === "string")
|
|
2833
|
-
return x;
|
|
2834
|
-
if (typeof Buffer !== "undefined" && x instanceof Buffer)
|
|
2835
|
-
return String(x);
|
|
2836
|
-
return void 0;
|
|
2837
|
-
}, "getStringFromMaybeBuffer");
|
|
2838
|
-
async function getBytes(value) {
|
|
2839
|
-
let parts = [];
|
|
2840
|
-
if (typeof value === "string" || ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc.
|
|
2841
|
-
value instanceof ArrayBuffer) {
|
|
2842
|
-
parts.push(value);
|
|
2843
|
-
} else if (isBlobLike(value)) {
|
|
2844
|
-
parts.push(await value.arrayBuffer());
|
|
2845
|
-
} else if (isAsyncIterableIterator(value)) {
|
|
2846
|
-
for await (const chunk of value) {
|
|
2847
|
-
parts.push(chunk);
|
|
2848
|
-
}
|
|
2849
|
-
} else {
|
|
2850
|
-
throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`);
|
|
2851
|
-
}
|
|
2852
|
-
return parts;
|
|
2853
|
-
}
|
|
2854
|
-
__name(getBytes, "getBytes");
|
|
2855
|
-
function propsForError(value) {
|
|
2856
|
-
const props = Object.getOwnPropertyNames(value);
|
|
2857
|
-
return `[${props.map((p) => `"${p}"`).join(", ")}]`;
|
|
2858
|
-
}
|
|
2859
|
-
__name(propsForError, "propsForError");
|
|
2860
|
-
var isAsyncIterableIterator = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function", "isAsyncIterableIterator");
|
|
2861
|
-
var isResponseLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value.url === "string" && typeof value.blob === "function", "isResponseLike");
|
|
2862
|
-
var isFileLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value.name === "string" && typeof value.lastModified === "number" && isBlobLike(value), "isFileLike");
|
|
2863
|
-
var isBlobLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value.size === "number" && typeof value.type === "string" && typeof value.text === "function" && typeof value.slice === "function" && typeof value.arrayBuffer === "function", "isBlobLike");
|
|
2864
|
-
var isFsReadStream = /* @__PURE__ */ __name((value) => value instanceof Readable, "isFsReadStream");
|
|
2865
|
-
var isUploadable = /* @__PURE__ */ __name((value) => {
|
|
2866
|
-
return isFileLike(value) || isResponseLike(value) || isFsReadStream(value);
|
|
2867
|
-
}, "isUploadable");
|
|
2868
|
-
var isRecordLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length > 0 && Object.keys(value).every((key) => typeof key === "string" && typeof value[key] === "string"), "isRecordLike");
|
|
2869
2750
|
var _ApiPromise = class _ApiPromise extends Promise {
|
|
2870
2751
|
constructor(responsePromise) {
|
|
2871
2752
|
super((resolve) => {
|
|
@@ -3161,18 +3042,11 @@ var _ApiClient = class _ApiClient {
|
|
|
3161
3042
|
});
|
|
3162
3043
|
}
|
|
3163
3044
|
importEnvVars(projectRef, slug, body) {
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
});
|
|
3170
|
-
} else {
|
|
3171
|
-
return zodupload(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/import`, body, {
|
|
3172
|
-
method: "POST",
|
|
3173
|
-
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
|
|
3174
|
-
});
|
|
3175
|
-
}
|
|
3045
|
+
return zodfetch(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/import`, {
|
|
3046
|
+
method: "POST",
|
|
3047
|
+
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
|
|
3048
|
+
body: JSON.stringify(body)
|
|
3049
|
+
});
|
|
3176
3050
|
}
|
|
3177
3051
|
retrieveEnvVar(projectRef, slug, key) {
|
|
3178
3052
|
return zodfetch(EnvironmentVariableValue, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/${key}`, {
|