@trigger.dev/core 0.0.0-v3-prerelease-20240619135614 → 0.0.0-v3-prerelease-20240620110206
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 +4 -5
- package/dist/v3/index.d.ts +4 -5
- 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 +1 -1
- package/dist/v3/otel/index.js.map +1 -1
- package/dist/v3/otel/index.mjs +1 -1
- 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 +6 -135
- package/dist/v3/workers/index.js.map +1 -1
- package/dist/v3/workers/index.mjs +6 -135
- 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 = "0.0.0-v3-prerelease-
|
|
373
|
+
var version = "0.0.0-v3-prerelease-20240620110206";
|
|
376
374
|
|
|
377
375
|
// src/v3/otel/tracingSDK.ts
|
|
378
376
|
var _a;
|
|
@@ -1623,37 +1621,6 @@ function zodfetchOffsetLimitPage(schema, url, params, requestInit, options) {
|
|
|
1623
1621
|
return new OffsetLimitPagePromise(fetchResult, schema, url, params, requestInit, options);
|
|
1624
1622
|
}
|
|
1625
1623
|
__name(zodfetchOffsetLimitPage, "zodfetchOffsetLimitPage");
|
|
1626
|
-
function zodupload(schema, url, body, requestInit, options) {
|
|
1627
|
-
const finalRequestInit = createMultipartFormRequestInit(body, requestInit);
|
|
1628
|
-
return new ApiPromise(_doZodFetch(schema, url, finalRequestInit, options));
|
|
1629
|
-
}
|
|
1630
|
-
__name(zodupload, "zodupload");
|
|
1631
|
-
async function createMultipartFormRequestInit(body, requestInit) {
|
|
1632
|
-
const form = await createForm(body);
|
|
1633
|
-
const encoder = new formDataEncoder.FormDataEncoder(form);
|
|
1634
|
-
const finalHeaders = {};
|
|
1635
|
-
for (const [key, value] of Object.entries(requestInit?.headers || {})) {
|
|
1636
|
-
finalHeaders[key] = value;
|
|
1637
|
-
}
|
|
1638
|
-
for (const [key, value] of Object.entries(encoder.headers)) {
|
|
1639
|
-
finalHeaders[key] = value;
|
|
1640
|
-
}
|
|
1641
|
-
finalHeaders["Content-Length"] = String(encoder.contentLength);
|
|
1642
|
-
const finalRequestInit = {
|
|
1643
|
-
...requestInit,
|
|
1644
|
-
headers: finalHeaders,
|
|
1645
|
-
body: stream.Readable.from(encoder),
|
|
1646
|
-
// @ts-expect-error
|
|
1647
|
-
duplex: "half"
|
|
1648
|
-
};
|
|
1649
|
-
return finalRequestInit;
|
|
1650
|
-
}
|
|
1651
|
-
__name(createMultipartFormRequestInit, "createMultipartFormRequestInit");
|
|
1652
|
-
var createForm = /* @__PURE__ */ __name(async (body) => {
|
|
1653
|
-
const form = new FormData();
|
|
1654
|
-
await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value)));
|
|
1655
|
-
return form;
|
|
1656
|
-
}, "createForm");
|
|
1657
1624
|
async function _doZodFetch(schema, url, requestInit, options, attempt = 1) {
|
|
1658
1625
|
try {
|
|
1659
1626
|
const $requestInit = await requestInit;
|
|
@@ -1779,95 +1746,6 @@ function requestInitWithCache(requestInit) {
|
|
|
1779
1746
|
}
|
|
1780
1747
|
}
|
|
1781
1748
|
__name(requestInitWithCache, "requestInitWithCache");
|
|
1782
|
-
var addFormValue = /* @__PURE__ */ __name(async (form, key, value) => {
|
|
1783
|
-
if (value === void 0)
|
|
1784
|
-
return;
|
|
1785
|
-
if (value == null) {
|
|
1786
|
-
throw new TypeError(`Received null for "${key}"; to pass null in FormData, you must use the string 'null'`);
|
|
1787
|
-
}
|
|
1788
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
1789
|
-
form.append(key, String(value));
|
|
1790
|
-
} else if (isUploadable(value) || isBlobLike(value) || value instanceof Buffer || value instanceof ArrayBuffer) {
|
|
1791
|
-
const file = await toFile(value);
|
|
1792
|
-
form.append(key, file);
|
|
1793
|
-
} else if (Array.isArray(value)) {
|
|
1794
|
-
await Promise.all(value.map((entry) => addFormValue(form, key + "[]", entry)));
|
|
1795
|
-
} else if (typeof value === "object") {
|
|
1796
|
-
await Promise.all(Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop)));
|
|
1797
|
-
} else {
|
|
1798
|
-
throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`);
|
|
1799
|
-
}
|
|
1800
|
-
}, "addFormValue");
|
|
1801
|
-
async function toFile(value, name, options) {
|
|
1802
|
-
value = await value;
|
|
1803
|
-
options ??= isFileLike(value) ? {
|
|
1804
|
-
lastModified: value.lastModified,
|
|
1805
|
-
type: value.type
|
|
1806
|
-
} : {};
|
|
1807
|
-
if (isResponseLike(value)) {
|
|
1808
|
-
const blob = await value.blob();
|
|
1809
|
-
name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? "unknown_file";
|
|
1810
|
-
return new File([
|
|
1811
|
-
blob
|
|
1812
|
-
], name, options);
|
|
1813
|
-
}
|
|
1814
|
-
const bits = await getBytes(value);
|
|
1815
|
-
name ||= getName(value) ?? "unknown_file";
|
|
1816
|
-
if (!options.type) {
|
|
1817
|
-
const type = bits[0]?.type;
|
|
1818
|
-
if (typeof type === "string") {
|
|
1819
|
-
options = {
|
|
1820
|
-
...options,
|
|
1821
|
-
type
|
|
1822
|
-
};
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1825
|
-
return new File(bits, name, options);
|
|
1826
|
-
}
|
|
1827
|
-
__name(toFile, "toFile");
|
|
1828
|
-
function getName(value) {
|
|
1829
|
-
return getStringFromMaybeBuffer(value.name) || getStringFromMaybeBuffer(value.filename) || // For fs.ReadStream
|
|
1830
|
-
getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop();
|
|
1831
|
-
}
|
|
1832
|
-
__name(getName, "getName");
|
|
1833
|
-
var getStringFromMaybeBuffer = /* @__PURE__ */ __name((x) => {
|
|
1834
|
-
if (typeof x === "string")
|
|
1835
|
-
return x;
|
|
1836
|
-
if (typeof Buffer !== "undefined" && x instanceof Buffer)
|
|
1837
|
-
return String(x);
|
|
1838
|
-
return void 0;
|
|
1839
|
-
}, "getStringFromMaybeBuffer");
|
|
1840
|
-
async function getBytes(value) {
|
|
1841
|
-
let parts = [];
|
|
1842
|
-
if (typeof value === "string" || ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc.
|
|
1843
|
-
value instanceof ArrayBuffer) {
|
|
1844
|
-
parts.push(value);
|
|
1845
|
-
} else if (isBlobLike(value)) {
|
|
1846
|
-
parts.push(await value.arrayBuffer());
|
|
1847
|
-
} else if (isAsyncIterableIterator(value)) {
|
|
1848
|
-
for await (const chunk of value) {
|
|
1849
|
-
parts.push(chunk);
|
|
1850
|
-
}
|
|
1851
|
-
} else {
|
|
1852
|
-
throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`);
|
|
1853
|
-
}
|
|
1854
|
-
return parts;
|
|
1855
|
-
}
|
|
1856
|
-
__name(getBytes, "getBytes");
|
|
1857
|
-
function propsForError(value) {
|
|
1858
|
-
const props = Object.getOwnPropertyNames(value);
|
|
1859
|
-
return `[${props.map((p) => `"${p}"`).join(", ")}]`;
|
|
1860
|
-
}
|
|
1861
|
-
__name(propsForError, "propsForError");
|
|
1862
|
-
var isAsyncIterableIterator = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function", "isAsyncIterableIterator");
|
|
1863
|
-
var isResponseLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value.url === "string" && typeof value.blob === "function", "isResponseLike");
|
|
1864
|
-
var isFileLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value.name === "string" && typeof value.lastModified === "number" && isBlobLike(value), "isFileLike");
|
|
1865
|
-
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");
|
|
1866
|
-
var isFsReadStream = /* @__PURE__ */ __name((value) => value instanceof stream.Readable, "isFsReadStream");
|
|
1867
|
-
var isUploadable = /* @__PURE__ */ __name((value) => {
|
|
1868
|
-
return isFileLike(value) || isResponseLike(value) || isFsReadStream(value);
|
|
1869
|
-
}, "isUploadable");
|
|
1870
|
-
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");
|
|
1871
1749
|
var _ApiPromise = class _ApiPromise extends Promise {
|
|
1872
1750
|
constructor(responsePromise) {
|
|
1873
1751
|
super((resolve) => {
|
|
@@ -2163,18 +2041,11 @@ var _ApiClient = class _ApiClient {
|
|
|
2163
2041
|
});
|
|
2164
2042
|
}
|
|
2165
2043
|
importEnvVars(projectRef, slug, body) {
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
});
|
|
2172
|
-
} else {
|
|
2173
|
-
return zodupload(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/import`, body, {
|
|
2174
|
-
method: "POST",
|
|
2175
|
-
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
|
|
2176
|
-
});
|
|
2177
|
-
}
|
|
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
|
+
});
|
|
2178
2049
|
}
|
|
2179
2050
|
retrieveEnvVar(projectRef, slug, key) {
|
|
2180
2051
|
return zodfetch(EnvironmentVariableValue, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/${key}`, {
|