@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/workers/index.js
CHANGED
|
@@ -11,8 +11,6 @@ var sdkLogs = require('@opentelemetry/sdk-logs');
|
|
|
11
11
|
var sdkTraceNode = require('@opentelemetry/sdk-trace-node');
|
|
12
12
|
var semanticConventions = require('@opentelemetry/semantic-conventions');
|
|
13
13
|
var zodValidationError = require('zod-validation-error');
|
|
14
|
-
var formDataEncoder = require('form-data-encoder');
|
|
15
|
-
var stream = require('stream');
|
|
16
14
|
var preciseDate = require('@google-cloud/precise-date');
|
|
17
15
|
var util = require('util');
|
|
18
16
|
var promises = require('timers/promises');
|
|
@@ -372,7 +370,7 @@ function getEnvVar(name) {
|
|
|
372
370
|
__name(getEnvVar, "getEnvVar");
|
|
373
371
|
|
|
374
372
|
// package.json
|
|
375
|
-
var version = "3.0.0-beta.
|
|
373
|
+
var version = "3.0.0-beta.40";
|
|
376
374
|
|
|
377
375
|
// src/v3/otel/tracingSDK.ts
|
|
378
376
|
var _a;
|
|
@@ -465,12 +463,16 @@ var _TracingSDK = class _TracingSDK {
|
|
|
465
463
|
this.getTracer = traceProvider.getTracer.bind(traceProvider);
|
|
466
464
|
}
|
|
467
465
|
async flush() {
|
|
468
|
-
await
|
|
469
|
-
|
|
466
|
+
await Promise.all([
|
|
467
|
+
this._traceProvider.forceFlush(),
|
|
468
|
+
this._logProvider.forceFlush()
|
|
469
|
+
]);
|
|
470
470
|
}
|
|
471
471
|
async shutdown() {
|
|
472
|
-
await
|
|
473
|
-
|
|
472
|
+
await Promise.all([
|
|
473
|
+
this._traceProvider.shutdown(),
|
|
474
|
+
this._logProvider.shutdown()
|
|
475
|
+
]);
|
|
474
476
|
}
|
|
475
477
|
};
|
|
476
478
|
__name(_TracingSDK, "TracingSDK");
|
|
@@ -1619,37 +1621,6 @@ function zodfetchOffsetLimitPage(schema, url, params, requestInit, options) {
|
|
|
1619
1621
|
return new OffsetLimitPagePromise(fetchResult, schema, url, params, requestInit, options);
|
|
1620
1622
|
}
|
|
1621
1623
|
__name(zodfetchOffsetLimitPage, "zodfetchOffsetLimitPage");
|
|
1622
|
-
function zodupload(schema, url, body, requestInit, options) {
|
|
1623
|
-
const finalRequestInit = createMultipartFormRequestInit(body, requestInit);
|
|
1624
|
-
return new ApiPromise(_doZodFetch(schema, url, finalRequestInit, options));
|
|
1625
|
-
}
|
|
1626
|
-
__name(zodupload, "zodupload");
|
|
1627
|
-
async function createMultipartFormRequestInit(body, requestInit) {
|
|
1628
|
-
const form = await createForm(body);
|
|
1629
|
-
const encoder = new formDataEncoder.FormDataEncoder(form);
|
|
1630
|
-
const finalHeaders = {};
|
|
1631
|
-
for (const [key, value] of Object.entries(requestInit?.headers || {})) {
|
|
1632
|
-
finalHeaders[key] = value;
|
|
1633
|
-
}
|
|
1634
|
-
for (const [key, value] of Object.entries(encoder.headers)) {
|
|
1635
|
-
finalHeaders[key] = value;
|
|
1636
|
-
}
|
|
1637
|
-
finalHeaders["Content-Length"] = String(encoder.contentLength);
|
|
1638
|
-
const finalRequestInit = {
|
|
1639
|
-
...requestInit,
|
|
1640
|
-
headers: finalHeaders,
|
|
1641
|
-
body: stream.Readable.from(encoder),
|
|
1642
|
-
// @ts-expect-error
|
|
1643
|
-
duplex: "half"
|
|
1644
|
-
};
|
|
1645
|
-
return finalRequestInit;
|
|
1646
|
-
}
|
|
1647
|
-
__name(createMultipartFormRequestInit, "createMultipartFormRequestInit");
|
|
1648
|
-
var createForm = /* @__PURE__ */ __name(async (body) => {
|
|
1649
|
-
const form = new FormData();
|
|
1650
|
-
await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value)));
|
|
1651
|
-
return form;
|
|
1652
|
-
}, "createForm");
|
|
1653
1624
|
async function _doZodFetch(schema, url, requestInit, options, attempt = 1) {
|
|
1654
1625
|
try {
|
|
1655
1626
|
const $requestInit = await requestInit;
|
|
@@ -1775,95 +1746,6 @@ function requestInitWithCache(requestInit) {
|
|
|
1775
1746
|
}
|
|
1776
1747
|
}
|
|
1777
1748
|
__name(requestInitWithCache, "requestInitWithCache");
|
|
1778
|
-
var addFormValue = /* @__PURE__ */ __name(async (form, key, value) => {
|
|
1779
|
-
if (value === void 0)
|
|
1780
|
-
return;
|
|
1781
|
-
if (value == null) {
|
|
1782
|
-
throw new TypeError(`Received null for "${key}"; to pass null in FormData, you must use the string 'null'`);
|
|
1783
|
-
}
|
|
1784
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
1785
|
-
form.append(key, String(value));
|
|
1786
|
-
} else if (isUploadable(value) || isBlobLike(value) || value instanceof Buffer || value instanceof ArrayBuffer) {
|
|
1787
|
-
const file = await toFile(value);
|
|
1788
|
-
form.append(key, file);
|
|
1789
|
-
} else if (Array.isArray(value)) {
|
|
1790
|
-
await Promise.all(value.map((entry) => addFormValue(form, key + "[]", entry)));
|
|
1791
|
-
} else if (typeof value === "object") {
|
|
1792
|
-
await Promise.all(Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop)));
|
|
1793
|
-
} else {
|
|
1794
|
-
throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`);
|
|
1795
|
-
}
|
|
1796
|
-
}, "addFormValue");
|
|
1797
|
-
async function toFile(value, name, options) {
|
|
1798
|
-
value = await value;
|
|
1799
|
-
options ??= isFileLike(value) ? {
|
|
1800
|
-
lastModified: value.lastModified,
|
|
1801
|
-
type: value.type
|
|
1802
|
-
} : {};
|
|
1803
|
-
if (isResponseLike(value)) {
|
|
1804
|
-
const blob = await value.blob();
|
|
1805
|
-
name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? "unknown_file";
|
|
1806
|
-
return new File([
|
|
1807
|
-
blob
|
|
1808
|
-
], name, options);
|
|
1809
|
-
}
|
|
1810
|
-
const bits = await getBytes(value);
|
|
1811
|
-
name ||= getName(value) ?? "unknown_file";
|
|
1812
|
-
if (!options.type) {
|
|
1813
|
-
const type = bits[0]?.type;
|
|
1814
|
-
if (typeof type === "string") {
|
|
1815
|
-
options = {
|
|
1816
|
-
...options,
|
|
1817
|
-
type
|
|
1818
|
-
};
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
return new File(bits, name, options);
|
|
1822
|
-
}
|
|
1823
|
-
__name(toFile, "toFile");
|
|
1824
|
-
function getName(value) {
|
|
1825
|
-
return getStringFromMaybeBuffer(value.name) || getStringFromMaybeBuffer(value.filename) || // For fs.ReadStream
|
|
1826
|
-
getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop();
|
|
1827
|
-
}
|
|
1828
|
-
__name(getName, "getName");
|
|
1829
|
-
var getStringFromMaybeBuffer = /* @__PURE__ */ __name((x) => {
|
|
1830
|
-
if (typeof x === "string")
|
|
1831
|
-
return x;
|
|
1832
|
-
if (typeof Buffer !== "undefined" && x instanceof Buffer)
|
|
1833
|
-
return String(x);
|
|
1834
|
-
return void 0;
|
|
1835
|
-
}, "getStringFromMaybeBuffer");
|
|
1836
|
-
async function getBytes(value) {
|
|
1837
|
-
let parts = [];
|
|
1838
|
-
if (typeof value === "string" || ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc.
|
|
1839
|
-
value instanceof ArrayBuffer) {
|
|
1840
|
-
parts.push(value);
|
|
1841
|
-
} else if (isBlobLike(value)) {
|
|
1842
|
-
parts.push(await value.arrayBuffer());
|
|
1843
|
-
} else if (isAsyncIterableIterator(value)) {
|
|
1844
|
-
for await (const chunk of value) {
|
|
1845
|
-
parts.push(chunk);
|
|
1846
|
-
}
|
|
1847
|
-
} else {
|
|
1848
|
-
throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`);
|
|
1849
|
-
}
|
|
1850
|
-
return parts;
|
|
1851
|
-
}
|
|
1852
|
-
__name(getBytes, "getBytes");
|
|
1853
|
-
function propsForError(value) {
|
|
1854
|
-
const props = Object.getOwnPropertyNames(value);
|
|
1855
|
-
return `[${props.map((p) => `"${p}"`).join(", ")}]`;
|
|
1856
|
-
}
|
|
1857
|
-
__name(propsForError, "propsForError");
|
|
1858
|
-
var isAsyncIterableIterator = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function", "isAsyncIterableIterator");
|
|
1859
|
-
var isResponseLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value.url === "string" && typeof value.blob === "function", "isResponseLike");
|
|
1860
|
-
var isFileLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value.name === "string" && typeof value.lastModified === "number" && isBlobLike(value), "isFileLike");
|
|
1861
|
-
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");
|
|
1862
|
-
var isFsReadStream = /* @__PURE__ */ __name((value) => value instanceof stream.Readable, "isFsReadStream");
|
|
1863
|
-
var isUploadable = /* @__PURE__ */ __name((value) => {
|
|
1864
|
-
return isFileLike(value) || isResponseLike(value) || isFsReadStream(value);
|
|
1865
|
-
}, "isUploadable");
|
|
1866
|
-
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");
|
|
1867
1749
|
var _ApiPromise = class _ApiPromise extends Promise {
|
|
1868
1750
|
constructor(responsePromise) {
|
|
1869
1751
|
super((resolve) => {
|
|
@@ -2159,18 +2041,11 @@ var _ApiClient = class _ApiClient {
|
|
|
2159
2041
|
});
|
|
2160
2042
|
}
|
|
2161
2043
|
importEnvVars(projectRef, slug, body) {
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
});
|
|
2168
|
-
} else {
|
|
2169
|
-
return zodupload(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/import`, body, {
|
|
2170
|
-
method: "POST",
|
|
2171
|
-
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
|
|
2172
|
-
});
|
|
2173
|
-
}
|
|
2044
|
+
return zodfetch(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/import`, {
|
|
2045
|
+
method: "POST",
|
|
2046
|
+
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
|
|
2047
|
+
body: JSON.stringify(body)
|
|
2048
|
+
});
|
|
2174
2049
|
}
|
|
2175
2050
|
retrieveEnvVar(projectRef, slug, key) {
|
|
2176
2051
|
return zodfetch(EnvironmentVariableValue, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/${key}`, {
|