@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
|
@@ -9,8 +9,6 @@ import { LoggerProvider, BatchLogRecordProcessor, SimpleLogRecordProcessor } fro
|
|
|
9
9
|
import { NodeTracerProvider, BatchSpanProcessor, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-node';
|
|
10
10
|
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
|
|
11
11
|
import { fromZodError } from 'zod-validation-error';
|
|
12
|
-
import { FormDataEncoder } from 'form-data-encoder';
|
|
13
|
-
import { Readable } from 'node:stream';
|
|
14
12
|
import { PreciseDate } from '@google-cloud/precise-date';
|
|
15
13
|
import util from 'node:util';
|
|
16
14
|
import { setInterval } from 'node:timers/promises';
|
|
@@ -366,7 +364,7 @@ function getEnvVar(name) {
|
|
|
366
364
|
__name(getEnvVar, "getEnvVar");
|
|
367
365
|
|
|
368
366
|
// package.json
|
|
369
|
-
var version = "0.0.0-v3-prerelease-
|
|
367
|
+
var version = "0.0.0-v3-prerelease-20240620110206";
|
|
370
368
|
|
|
371
369
|
// src/v3/otel/tracingSDK.ts
|
|
372
370
|
var _a;
|
|
@@ -1617,37 +1615,6 @@ function zodfetchOffsetLimitPage(schema, url, params, requestInit, options) {
|
|
|
1617
1615
|
return new OffsetLimitPagePromise(fetchResult, schema, url, params, requestInit, options);
|
|
1618
1616
|
}
|
|
1619
1617
|
__name(zodfetchOffsetLimitPage, "zodfetchOffsetLimitPage");
|
|
1620
|
-
function zodupload(schema, url, body, requestInit, options) {
|
|
1621
|
-
const finalRequestInit = createMultipartFormRequestInit(body, requestInit);
|
|
1622
|
-
return new ApiPromise(_doZodFetch(schema, url, finalRequestInit, options));
|
|
1623
|
-
}
|
|
1624
|
-
__name(zodupload, "zodupload");
|
|
1625
|
-
async function createMultipartFormRequestInit(body, requestInit) {
|
|
1626
|
-
const form = await createForm(body);
|
|
1627
|
-
const encoder = new FormDataEncoder(form);
|
|
1628
|
-
const finalHeaders = {};
|
|
1629
|
-
for (const [key, value] of Object.entries(requestInit?.headers || {})) {
|
|
1630
|
-
finalHeaders[key] = value;
|
|
1631
|
-
}
|
|
1632
|
-
for (const [key, value] of Object.entries(encoder.headers)) {
|
|
1633
|
-
finalHeaders[key] = value;
|
|
1634
|
-
}
|
|
1635
|
-
finalHeaders["Content-Length"] = String(encoder.contentLength);
|
|
1636
|
-
const finalRequestInit = {
|
|
1637
|
-
...requestInit,
|
|
1638
|
-
headers: finalHeaders,
|
|
1639
|
-
body: Readable.from(encoder),
|
|
1640
|
-
// @ts-expect-error
|
|
1641
|
-
duplex: "half"
|
|
1642
|
-
};
|
|
1643
|
-
return finalRequestInit;
|
|
1644
|
-
}
|
|
1645
|
-
__name(createMultipartFormRequestInit, "createMultipartFormRequestInit");
|
|
1646
|
-
var createForm = /* @__PURE__ */ __name(async (body) => {
|
|
1647
|
-
const form = new FormData();
|
|
1648
|
-
await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value)));
|
|
1649
|
-
return form;
|
|
1650
|
-
}, "createForm");
|
|
1651
1618
|
async function _doZodFetch(schema, url, requestInit, options, attempt = 1) {
|
|
1652
1619
|
try {
|
|
1653
1620
|
const $requestInit = await requestInit;
|
|
@@ -1773,95 +1740,6 @@ function requestInitWithCache(requestInit) {
|
|
|
1773
1740
|
}
|
|
1774
1741
|
}
|
|
1775
1742
|
__name(requestInitWithCache, "requestInitWithCache");
|
|
1776
|
-
var addFormValue = /* @__PURE__ */ __name(async (form, key, value) => {
|
|
1777
|
-
if (value === void 0)
|
|
1778
|
-
return;
|
|
1779
|
-
if (value == null) {
|
|
1780
|
-
throw new TypeError(`Received null for "${key}"; to pass null in FormData, you must use the string 'null'`);
|
|
1781
|
-
}
|
|
1782
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
1783
|
-
form.append(key, String(value));
|
|
1784
|
-
} else if (isUploadable(value) || isBlobLike(value) || value instanceof Buffer || value instanceof ArrayBuffer) {
|
|
1785
|
-
const file = await toFile(value);
|
|
1786
|
-
form.append(key, file);
|
|
1787
|
-
} else if (Array.isArray(value)) {
|
|
1788
|
-
await Promise.all(value.map((entry) => addFormValue(form, key + "[]", entry)));
|
|
1789
|
-
} else if (typeof value === "object") {
|
|
1790
|
-
await Promise.all(Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop)));
|
|
1791
|
-
} else {
|
|
1792
|
-
throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`);
|
|
1793
|
-
}
|
|
1794
|
-
}, "addFormValue");
|
|
1795
|
-
async function toFile(value, name, options) {
|
|
1796
|
-
value = await value;
|
|
1797
|
-
options ??= isFileLike(value) ? {
|
|
1798
|
-
lastModified: value.lastModified,
|
|
1799
|
-
type: value.type
|
|
1800
|
-
} : {};
|
|
1801
|
-
if (isResponseLike(value)) {
|
|
1802
|
-
const blob = await value.blob();
|
|
1803
|
-
name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? "unknown_file";
|
|
1804
|
-
return new File([
|
|
1805
|
-
blob
|
|
1806
|
-
], name, options);
|
|
1807
|
-
}
|
|
1808
|
-
const bits = await getBytes(value);
|
|
1809
|
-
name ||= getName(value) ?? "unknown_file";
|
|
1810
|
-
if (!options.type) {
|
|
1811
|
-
const type = bits[0]?.type;
|
|
1812
|
-
if (typeof type === "string") {
|
|
1813
|
-
options = {
|
|
1814
|
-
...options,
|
|
1815
|
-
type
|
|
1816
|
-
};
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1819
|
-
return new File(bits, name, options);
|
|
1820
|
-
}
|
|
1821
|
-
__name(toFile, "toFile");
|
|
1822
|
-
function getName(value) {
|
|
1823
|
-
return getStringFromMaybeBuffer(value.name) || getStringFromMaybeBuffer(value.filename) || // For fs.ReadStream
|
|
1824
|
-
getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop();
|
|
1825
|
-
}
|
|
1826
|
-
__name(getName, "getName");
|
|
1827
|
-
var getStringFromMaybeBuffer = /* @__PURE__ */ __name((x) => {
|
|
1828
|
-
if (typeof x === "string")
|
|
1829
|
-
return x;
|
|
1830
|
-
if (typeof Buffer !== "undefined" && x instanceof Buffer)
|
|
1831
|
-
return String(x);
|
|
1832
|
-
return void 0;
|
|
1833
|
-
}, "getStringFromMaybeBuffer");
|
|
1834
|
-
async function getBytes(value) {
|
|
1835
|
-
let parts = [];
|
|
1836
|
-
if (typeof value === "string" || ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc.
|
|
1837
|
-
value instanceof ArrayBuffer) {
|
|
1838
|
-
parts.push(value);
|
|
1839
|
-
} else if (isBlobLike(value)) {
|
|
1840
|
-
parts.push(await value.arrayBuffer());
|
|
1841
|
-
} else if (isAsyncIterableIterator(value)) {
|
|
1842
|
-
for await (const chunk of value) {
|
|
1843
|
-
parts.push(chunk);
|
|
1844
|
-
}
|
|
1845
|
-
} else {
|
|
1846
|
-
throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`);
|
|
1847
|
-
}
|
|
1848
|
-
return parts;
|
|
1849
|
-
}
|
|
1850
|
-
__name(getBytes, "getBytes");
|
|
1851
|
-
function propsForError(value) {
|
|
1852
|
-
const props = Object.getOwnPropertyNames(value);
|
|
1853
|
-
return `[${props.map((p) => `"${p}"`).join(", ")}]`;
|
|
1854
|
-
}
|
|
1855
|
-
__name(propsForError, "propsForError");
|
|
1856
|
-
var isAsyncIterableIterator = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function", "isAsyncIterableIterator");
|
|
1857
|
-
var isResponseLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value.url === "string" && typeof value.blob === "function", "isResponseLike");
|
|
1858
|
-
var isFileLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value.name === "string" && typeof value.lastModified === "number" && isBlobLike(value), "isFileLike");
|
|
1859
|
-
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");
|
|
1860
|
-
var isFsReadStream = /* @__PURE__ */ __name((value) => value instanceof Readable, "isFsReadStream");
|
|
1861
|
-
var isUploadable = /* @__PURE__ */ __name((value) => {
|
|
1862
|
-
return isFileLike(value) || isResponseLike(value) || isFsReadStream(value);
|
|
1863
|
-
}, "isUploadable");
|
|
1864
|
-
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");
|
|
1865
1743
|
var _ApiPromise = class _ApiPromise extends Promise {
|
|
1866
1744
|
constructor(responsePromise) {
|
|
1867
1745
|
super((resolve) => {
|
|
@@ -2157,18 +2035,11 @@ var _ApiClient = class _ApiClient {
|
|
|
2157
2035
|
});
|
|
2158
2036
|
}
|
|
2159
2037
|
importEnvVars(projectRef, slug, body) {
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
});
|
|
2166
|
-
} else {
|
|
2167
|
-
return zodupload(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/import`, body, {
|
|
2168
|
-
method: "POST",
|
|
2169
|
-
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
|
|
2170
|
-
});
|
|
2171
|
-
}
|
|
2038
|
+
return zodfetch(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/import`, {
|
|
2039
|
+
method: "POST",
|
|
2040
|
+
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
|
|
2041
|
+
body: JSON.stringify(body)
|
|
2042
|
+
});
|
|
2172
2043
|
}
|
|
2173
2044
|
retrieveEnvVar(projectRef, slug, key) {
|
|
2174
2045
|
return zodfetch(EnvironmentVariableValue, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/${key}`, {
|