@trigger.dev/core 0.0.0-v3-prerelease-20240620110206 → 0.0.0-v3-prerelease-20240620125011
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-xJbR1Vai.d.mts → messages--WkQvA2l.d.mts} +0 -10
- package/dist/{messages-xJbR1Vai.d.ts → messages--WkQvA2l.d.ts} +0 -10
- package/dist/v3/index.d.mts +5 -4
- package/dist/v3/index.d.ts +5 -4
- package/dist/v3/index.js +136 -10
- package/dist/v3/index.js.map +1 -1
- package/dist/v3/index.mjs +136 -10
- package/dist/v3/index.mjs.map +1 -1
- package/dist/v3/otel/index.js +5 -9
- package/dist/v3/otel/index.js.map +1 -1
- package/dist/v3/otel/index.mjs +5 -9
- 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 +139 -14
- package/dist/v3/workers/index.js.map +1 -1
- package/dist/v3/workers/index.mjs +139 -14
- package/dist/v3/workers/index.mjs.map +1 -1
- package/dist/v3/zodfetch.d.mts +57 -1
- package/dist/v3/zodfetch.d.ts +57 -1
- package/dist/v3/zodfetch.js +130 -0
- package/dist/v3/zodfetch.js.map +1 -1
- package/dist/v3/zodfetch.mjs +123 -1
- package/dist/v3/zodfetch.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -12219,16 +12219,6 @@ declare const CoordinatorToPlatformMessages: {
|
|
|
12219
12219
|
docker: boolean;
|
|
12220
12220
|
version?: "v1" | undefined;
|
|
12221
12221
|
}>;
|
|
12222
|
-
callback: z.ZodObject<{
|
|
12223
|
-
version: z.ZodDefault<z.ZodLiteral<"v1">>;
|
|
12224
|
-
keepRunAlive: z.ZodBoolean;
|
|
12225
|
-
}, "strip", z.ZodTypeAny, {
|
|
12226
|
-
version: "v1";
|
|
12227
|
-
keepRunAlive: boolean;
|
|
12228
|
-
}, {
|
|
12229
|
-
keepRunAlive: boolean;
|
|
12230
|
-
version?: "v1" | undefined;
|
|
12231
|
-
}>;
|
|
12232
12222
|
};
|
|
12233
12223
|
INDEXING_FAILED: {
|
|
12234
12224
|
message: z.ZodObject<{
|
|
@@ -12219,16 +12219,6 @@ declare const CoordinatorToPlatformMessages: {
|
|
|
12219
12219
|
docker: boolean;
|
|
12220
12220
|
version?: "v1" | undefined;
|
|
12221
12221
|
}>;
|
|
12222
|
-
callback: z.ZodObject<{
|
|
12223
|
-
version: z.ZodDefault<z.ZodLiteral<"v1">>;
|
|
12224
|
-
keepRunAlive: z.ZodBoolean;
|
|
12225
|
-
}, "strip", z.ZodTypeAny, {
|
|
12226
|
-
version: "v1";
|
|
12227
|
-
keepRunAlive: boolean;
|
|
12228
|
-
}, {
|
|
12229
|
-
keepRunAlive: boolean;
|
|
12230
|
-
version?: "v1" | undefined;
|
|
12231
|
-
}>;
|
|
12232
12222
|
};
|
|
12233
12223
|
INDEXING_FAILED: {
|
|
12234
12224
|
message: z.ZodObject<{
|
package/dist/v3/index.d.mts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { CursorPageParams, ApiPromise, CursorPagePromise, OffsetLimitPagePromise } from './zodfetch.mjs';
|
|
3
|
+
import { Uploadable, BlobLikePart, CursorPageParams, ApiPromise, CursorPagePromise, OffsetLimitPagePromise } from './zodfetch.mjs';
|
|
4
4
|
export { APIHeaders, ApiConnectionError, ApiError, AuthenticationError, BadRequestError, ConflictError, CursorPage, CursorPageResponse, InternalServerError, NotFoundError, OffsetLimitPage, OffsetLimitPageParams, OffsetLimitPageResponse, Page, PageResponse, PermissionDeniedError, RateLimitError, UnprocessableEntityError } from './zodfetch.mjs';
|
|
5
5
|
import { T as TaskRunExecutionResult, B as BatchTaskRunExecutionResult, c as TaskRunError, a as TaskRunContext, R as RuntimeManager } from '../manager-S98VaLUy.mjs';
|
|
6
6
|
export { f as MachineConfig, d as MachineCpu, e as MachineMemory, g as MachinePreset, M as MachinePresetName, m as TaskRun, h as TaskRunBuiltInError, i as TaskRunCustomErrorObject, k as TaskRunErrorCodes, b as TaskRunExecution, o as TaskRunExecutionAttempt, t as TaskRunExecutionBatch, p as TaskRunExecutionEnvironment, q as TaskRunExecutionOrganization, r as TaskRunExecutionProject, s as TaskRunExecutionQueue, u as TaskRunExecutionRetry, n as TaskRunExecutionTask, v as TaskRunExecutionUsage, w as TaskRunFailedExecutionResult, l as TaskRunInternalError, j as TaskRunStringError, x as TaskRunSuccessfulExecutionResult } from '../manager-S98VaLUy.mjs';
|
|
7
7
|
import { C as Clock, b as ClockTime, f as TaskLogger, c as TaskCatalog, a as TaskMetadataWithFunctions, T as TriggerTracer } from '../catalog-Gjy5NtAB.mjs';
|
|
8
8
|
export { h as Context, F as FailureFnParams, n as HandleErrorArgs, j as HandleErrorFnParams, H as HandleErrorFunction, k as HandleErrorModificationOptions, m as HandleErrorResult, g as InitFnParams, I as InitOutput, L as LogLevel, M as MiddlewareFnParams, P as ProjectConfig, q as ResolveEnvironmentVariablesFunction, p as ResolveEnvironmentVariablesParams, o as ResolveEnvironmentVariablesResult, R as RunFnParams, S as StartFnParams, i as SuccessFnParams, u as usage } from '../catalog-Gjy5NtAB.mjs';
|
|
9
9
|
import { Attributes, Span } from '@opentelemetry/api';
|
|
10
|
-
import { B as BackgroundWorkerProperties } from '../messages
|
|
11
|
-
export { c as BackgroundWorkerClientMessages, b as BackgroundWorkerServerMessages, i as ClientToSharedQueueMessages, C as CoordinatorToPlatformMessages, k as CoordinatorToProdWorkerMessages, h as PlatformToCoordinatorMessages, g as PlatformToProviderMessages, a as ProdChildToWorkerMessages, l as ProdWorkerSocketData, P as ProdWorkerToChildMessages, j as ProdWorkerToCoordinatorMessages, f as ProviderToPlatformMessages, S as SharedQueueToClientMessages, T as TaskMetadataFailedToParseData, U as UncaughtExceptionMessage, e as childToWorkerMessages, d as clientWebsocketMessages, s as serverWebsocketMessages, w as workerToChildMessages } from '../messages
|
|
10
|
+
import { B as BackgroundWorkerProperties } from '../messages--WkQvA2l.mjs';
|
|
11
|
+
export { c as BackgroundWorkerClientMessages, b as BackgroundWorkerServerMessages, i as ClientToSharedQueueMessages, C as CoordinatorToPlatformMessages, k as CoordinatorToProdWorkerMessages, h as PlatformToCoordinatorMessages, g as PlatformToProviderMessages, a as ProdChildToWorkerMessages, l as ProdWorkerSocketData, P as ProdWorkerToChildMessages, j as ProdWorkerToCoordinatorMessages, f as ProviderToPlatformMessages, S as SharedQueueToClientMessages, T as TaskMetadataFailedToParseData, U as UncaughtExceptionMessage, e as childToWorkerMessages, d as clientWebsocketMessages, s as serverWebsocketMessages, w as workerToChildMessages } from '../messages--WkQvA2l.mjs';
|
|
12
12
|
import { P as Prettify, T as TaskFileMetadata, a as TaskMetadataWithFilePath, R as RetryOptions } from '../schemas-Sb0sJcEt.mjs';
|
|
13
13
|
export { C as Config, E as EnvironmentType, F as FixedWindowRateLimit, g as PostStartCauses, h as PreStopCauses, d as ProdTaskRunExecution, e as ProdTaskRunExecutionPayload, Q as QueueOptions, f as RateLimitOptions, k as RequireKeys, i as ResolvedConfig, S as SlidingWindowRateLimit, b as TaskMetadata, j as TaskRunExecutionLazyAttemptPayload, c as TaskRunExecutionPayload, W as WaitReason } from '../schemas-Sb0sJcEt.mjs';
|
|
14
14
|
import { Unit } from 'humanize-duration';
|
|
15
15
|
export { e as eventFilterMatches } from '../eventFilterMatches-2kHImluE.mjs';
|
|
16
|
+
import 'node:stream';
|
|
16
17
|
import '@opentelemetry/api-logs';
|
|
17
18
|
import '@opentelemetry/instrumentation';
|
|
18
19
|
|
|
@@ -4580,7 +4581,7 @@ interface ImportEnvironmentVariablesParams {
|
|
|
4580
4581
|
* 1. As a record of key-value pairs. e.g. `{ "key1": "value1", "key2": "value2" }`
|
|
4581
4582
|
* 2. As an "uploadable" object in dotenv format. An uploadable can be a Node readable stream, a string, or a Buffer. You can also pass the return value of a `fetch` call.
|
|
4582
4583
|
*/
|
|
4583
|
-
variables: Record<string, string>;
|
|
4584
|
+
variables: Uploadable | BlobLikePart | Record<string, string>;
|
|
4584
4585
|
override?: boolean;
|
|
4585
4586
|
}
|
|
4586
4587
|
interface CreateEnvironmentVariableParams {
|
package/dist/v3/index.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { CursorPageParams, ApiPromise, CursorPagePromise, OffsetLimitPagePromise } from './zodfetch.js';
|
|
3
|
+
import { Uploadable, BlobLikePart, CursorPageParams, ApiPromise, CursorPagePromise, OffsetLimitPagePromise } from './zodfetch.js';
|
|
4
4
|
export { APIHeaders, ApiConnectionError, ApiError, AuthenticationError, BadRequestError, ConflictError, CursorPage, CursorPageResponse, InternalServerError, NotFoundError, OffsetLimitPage, OffsetLimitPageParams, OffsetLimitPageResponse, Page, PageResponse, PermissionDeniedError, RateLimitError, UnprocessableEntityError } from './zodfetch.js';
|
|
5
5
|
import { T as TaskRunExecutionResult, B as BatchTaskRunExecutionResult, c as TaskRunError, a as TaskRunContext, R as RuntimeManager } from '../manager-S98VaLUy.js';
|
|
6
6
|
export { f as MachineConfig, d as MachineCpu, e as MachineMemory, g as MachinePreset, M as MachinePresetName, m as TaskRun, h as TaskRunBuiltInError, i as TaskRunCustomErrorObject, k as TaskRunErrorCodes, b as TaskRunExecution, o as TaskRunExecutionAttempt, t as TaskRunExecutionBatch, p as TaskRunExecutionEnvironment, q as TaskRunExecutionOrganization, r as TaskRunExecutionProject, s as TaskRunExecutionQueue, u as TaskRunExecutionRetry, n as TaskRunExecutionTask, v as TaskRunExecutionUsage, w as TaskRunFailedExecutionResult, l as TaskRunInternalError, j as TaskRunStringError, x as TaskRunSuccessfulExecutionResult } from '../manager-S98VaLUy.js';
|
|
7
7
|
import { C as Clock, b as ClockTime, f as TaskLogger, c as TaskCatalog, a as TaskMetadataWithFunctions, T as TriggerTracer } from '../catalog-EP9DGAGm.js';
|
|
8
8
|
export { h as Context, F as FailureFnParams, n as HandleErrorArgs, j as HandleErrorFnParams, H as HandleErrorFunction, k as HandleErrorModificationOptions, m as HandleErrorResult, g as InitFnParams, I as InitOutput, L as LogLevel, M as MiddlewareFnParams, P as ProjectConfig, q as ResolveEnvironmentVariablesFunction, p as ResolveEnvironmentVariablesParams, o as ResolveEnvironmentVariablesResult, R as RunFnParams, S as StartFnParams, i as SuccessFnParams, u as usage } from '../catalog-EP9DGAGm.js';
|
|
9
9
|
import { Attributes, Span } from '@opentelemetry/api';
|
|
10
|
-
import { B as BackgroundWorkerProperties } from '../messages
|
|
11
|
-
export { c as BackgroundWorkerClientMessages, b as BackgroundWorkerServerMessages, i as ClientToSharedQueueMessages, C as CoordinatorToPlatformMessages, k as CoordinatorToProdWorkerMessages, h as PlatformToCoordinatorMessages, g as PlatformToProviderMessages, a as ProdChildToWorkerMessages, l as ProdWorkerSocketData, P as ProdWorkerToChildMessages, j as ProdWorkerToCoordinatorMessages, f as ProviderToPlatformMessages, S as SharedQueueToClientMessages, T as TaskMetadataFailedToParseData, U as UncaughtExceptionMessage, e as childToWorkerMessages, d as clientWebsocketMessages, s as serverWebsocketMessages, w as workerToChildMessages } from '../messages
|
|
10
|
+
import { B as BackgroundWorkerProperties } from '../messages--WkQvA2l.js';
|
|
11
|
+
export { c as BackgroundWorkerClientMessages, b as BackgroundWorkerServerMessages, i as ClientToSharedQueueMessages, C as CoordinatorToPlatformMessages, k as CoordinatorToProdWorkerMessages, h as PlatformToCoordinatorMessages, g as PlatformToProviderMessages, a as ProdChildToWorkerMessages, l as ProdWorkerSocketData, P as ProdWorkerToChildMessages, j as ProdWorkerToCoordinatorMessages, f as ProviderToPlatformMessages, S as SharedQueueToClientMessages, T as TaskMetadataFailedToParseData, U as UncaughtExceptionMessage, e as childToWorkerMessages, d as clientWebsocketMessages, s as serverWebsocketMessages, w as workerToChildMessages } from '../messages--WkQvA2l.js';
|
|
12
12
|
import { P as Prettify, T as TaskFileMetadata, a as TaskMetadataWithFilePath, R as RetryOptions } from '../schemas-Sb0sJcEt.js';
|
|
13
13
|
export { C as Config, E as EnvironmentType, F as FixedWindowRateLimit, g as PostStartCauses, h as PreStopCauses, d as ProdTaskRunExecution, e as ProdTaskRunExecutionPayload, Q as QueueOptions, f as RateLimitOptions, k as RequireKeys, i as ResolvedConfig, S as SlidingWindowRateLimit, b as TaskMetadata, j as TaskRunExecutionLazyAttemptPayload, c as TaskRunExecutionPayload, W as WaitReason } from '../schemas-Sb0sJcEt.js';
|
|
14
14
|
import { Unit } from 'humanize-duration';
|
|
15
15
|
export { e as eventFilterMatches } from '../eventFilterMatches-2kHImluE.js';
|
|
16
|
+
import 'node:stream';
|
|
16
17
|
import '@opentelemetry/api-logs';
|
|
17
18
|
import '@opentelemetry/instrumentation';
|
|
18
19
|
|
|
@@ -4580,7 +4581,7 @@ interface ImportEnvironmentVariablesParams {
|
|
|
4580
4581
|
* 1. As a record of key-value pairs. e.g. `{ "key1": "value1", "key2": "value2" }`
|
|
4581
4582
|
* 2. As an "uploadable" object in dotenv format. An uploadable can be a Node readable stream, a string, or a Buffer. You can also pass the return value of a `fetch` call.
|
|
4582
4583
|
*/
|
|
4583
|
-
variables: Record<string, string>;
|
|
4584
|
+
variables: Uploadable | BlobLikePart | Record<string, string>;
|
|
4584
4585
|
override?: boolean;
|
|
4585
4586
|
}
|
|
4586
4587
|
interface CreateEnvironmentVariableParams {
|
package/dist/v3/index.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
var api = require('@opentelemetry/api');
|
|
4
4
|
var zod = require('zod');
|
|
5
5
|
var zodValidationError = require('zod-validation-error');
|
|
6
|
+
var formDataEncoder = require('form-data-encoder');
|
|
7
|
+
var stream = require('stream');
|
|
6
8
|
var preciseDate = require('@google-cloud/precise-date');
|
|
7
9
|
var apiLogs = require('@opentelemetry/api-logs');
|
|
8
10
|
var humanizeDuration = require('humanize-duration');
|
|
@@ -33,7 +35,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
// package.json
|
|
36
|
-
var version = "0.0.0-v3-prerelease-
|
|
38
|
+
var version = "0.0.0-v3-prerelease-20240620125011";
|
|
37
39
|
var dependencies = {
|
|
38
40
|
"@google-cloud/precise-date": "^4.0.0",
|
|
39
41
|
"@opentelemetry/api": "^1.8.0",
|
|
@@ -47,6 +49,7 @@ var dependencies = {
|
|
|
47
49
|
"@opentelemetry/sdk-trace-base": "^1.22.0",
|
|
48
50
|
"@opentelemetry/sdk-trace-node": "^1.22.0",
|
|
49
51
|
"@opentelemetry/semantic-conventions": "^1.22.0",
|
|
52
|
+
"form-data-encoder": "^4.0.2",
|
|
50
53
|
"humanize-duration": "^3.27.3",
|
|
51
54
|
"socket.io-client": "4.7.4",
|
|
52
55
|
superjson: "^2.2.1",
|
|
@@ -1514,10 +1517,6 @@ var CoordinatorToPlatformMessages = {
|
|
|
1514
1517
|
attemptNumber: zod.z.number()
|
|
1515
1518
|
})
|
|
1516
1519
|
])
|
|
1517
|
-
}),
|
|
1518
|
-
callback: zod.z.object({
|
|
1519
|
-
version: zod.z.literal("v1").default("v1"),
|
|
1520
|
-
keepRunAlive: zod.z.boolean()
|
|
1521
1520
|
})
|
|
1522
1521
|
},
|
|
1523
1522
|
INDEXING_FAILED: {
|
|
@@ -2628,6 +2627,37 @@ function zodfetchOffsetLimitPage(schema, url, params, requestInit, options) {
|
|
|
2628
2627
|
return new OffsetLimitPagePromise(fetchResult, schema, url, params, requestInit, options);
|
|
2629
2628
|
}
|
|
2630
2629
|
__name(zodfetchOffsetLimitPage, "zodfetchOffsetLimitPage");
|
|
2630
|
+
function zodupload(schema, url, body, requestInit, options) {
|
|
2631
|
+
const finalRequestInit = createMultipartFormRequestInit(body, requestInit);
|
|
2632
|
+
return new ApiPromise(_doZodFetch(schema, url, finalRequestInit, options));
|
|
2633
|
+
}
|
|
2634
|
+
__name(zodupload, "zodupload");
|
|
2635
|
+
async function createMultipartFormRequestInit(body, requestInit) {
|
|
2636
|
+
const form = await createForm(body);
|
|
2637
|
+
const encoder = new formDataEncoder.FormDataEncoder(form);
|
|
2638
|
+
const finalHeaders = {};
|
|
2639
|
+
for (const [key, value] of Object.entries(requestInit?.headers || {})) {
|
|
2640
|
+
finalHeaders[key] = value;
|
|
2641
|
+
}
|
|
2642
|
+
for (const [key, value] of Object.entries(encoder.headers)) {
|
|
2643
|
+
finalHeaders[key] = value;
|
|
2644
|
+
}
|
|
2645
|
+
finalHeaders["Content-Length"] = String(encoder.contentLength);
|
|
2646
|
+
const finalRequestInit = {
|
|
2647
|
+
...requestInit,
|
|
2648
|
+
headers: finalHeaders,
|
|
2649
|
+
body: stream.Readable.from(encoder),
|
|
2650
|
+
// @ts-expect-error
|
|
2651
|
+
duplex: "half"
|
|
2652
|
+
};
|
|
2653
|
+
return finalRequestInit;
|
|
2654
|
+
}
|
|
2655
|
+
__name(createMultipartFormRequestInit, "createMultipartFormRequestInit");
|
|
2656
|
+
var createForm = /* @__PURE__ */ __name(async (body) => {
|
|
2657
|
+
const form = new FormData();
|
|
2658
|
+
await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value)));
|
|
2659
|
+
return form;
|
|
2660
|
+
}, "createForm");
|
|
2631
2661
|
async function _doZodFetch(schema, url, requestInit, options, attempt = 1) {
|
|
2632
2662
|
try {
|
|
2633
2663
|
const $requestInit = await requestInit;
|
|
@@ -2753,6 +2783,95 @@ function requestInitWithCache(requestInit) {
|
|
|
2753
2783
|
}
|
|
2754
2784
|
}
|
|
2755
2785
|
__name(requestInitWithCache, "requestInitWithCache");
|
|
2786
|
+
var addFormValue = /* @__PURE__ */ __name(async (form, key, value) => {
|
|
2787
|
+
if (value === void 0)
|
|
2788
|
+
return;
|
|
2789
|
+
if (value == null) {
|
|
2790
|
+
throw new TypeError(`Received null for "${key}"; to pass null in FormData, you must use the string 'null'`);
|
|
2791
|
+
}
|
|
2792
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
2793
|
+
form.append(key, String(value));
|
|
2794
|
+
} else if (isUploadable(value) || isBlobLike(value) || value instanceof Buffer || value instanceof ArrayBuffer) {
|
|
2795
|
+
const file = await toFile(value);
|
|
2796
|
+
form.append(key, file);
|
|
2797
|
+
} else if (Array.isArray(value)) {
|
|
2798
|
+
await Promise.all(value.map((entry) => addFormValue(form, key + "[]", entry)));
|
|
2799
|
+
} else if (typeof value === "object") {
|
|
2800
|
+
await Promise.all(Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop)));
|
|
2801
|
+
} else {
|
|
2802
|
+
throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`);
|
|
2803
|
+
}
|
|
2804
|
+
}, "addFormValue");
|
|
2805
|
+
async function toFile(value, name, options) {
|
|
2806
|
+
value = await value;
|
|
2807
|
+
options ??= isFileLike(value) ? {
|
|
2808
|
+
lastModified: value.lastModified,
|
|
2809
|
+
type: value.type
|
|
2810
|
+
} : {};
|
|
2811
|
+
if (isResponseLike(value)) {
|
|
2812
|
+
const blob = await value.blob();
|
|
2813
|
+
name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? "unknown_file";
|
|
2814
|
+
return new File([
|
|
2815
|
+
blob
|
|
2816
|
+
], name, options);
|
|
2817
|
+
}
|
|
2818
|
+
const bits = await getBytes(value);
|
|
2819
|
+
name ||= getName(value) ?? "unknown_file";
|
|
2820
|
+
if (!options.type) {
|
|
2821
|
+
const type = bits[0]?.type;
|
|
2822
|
+
if (typeof type === "string") {
|
|
2823
|
+
options = {
|
|
2824
|
+
...options,
|
|
2825
|
+
type
|
|
2826
|
+
};
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
return new File(bits, name, options);
|
|
2830
|
+
}
|
|
2831
|
+
__name(toFile, "toFile");
|
|
2832
|
+
function getName(value) {
|
|
2833
|
+
return getStringFromMaybeBuffer(value.name) || getStringFromMaybeBuffer(value.filename) || // For fs.ReadStream
|
|
2834
|
+
getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop();
|
|
2835
|
+
}
|
|
2836
|
+
__name(getName, "getName");
|
|
2837
|
+
var getStringFromMaybeBuffer = /* @__PURE__ */ __name((x) => {
|
|
2838
|
+
if (typeof x === "string")
|
|
2839
|
+
return x;
|
|
2840
|
+
if (typeof Buffer !== "undefined" && x instanceof Buffer)
|
|
2841
|
+
return String(x);
|
|
2842
|
+
return void 0;
|
|
2843
|
+
}, "getStringFromMaybeBuffer");
|
|
2844
|
+
async function getBytes(value) {
|
|
2845
|
+
let parts = [];
|
|
2846
|
+
if (typeof value === "string" || ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc.
|
|
2847
|
+
value instanceof ArrayBuffer) {
|
|
2848
|
+
parts.push(value);
|
|
2849
|
+
} else if (isBlobLike(value)) {
|
|
2850
|
+
parts.push(await value.arrayBuffer());
|
|
2851
|
+
} else if (isAsyncIterableIterator(value)) {
|
|
2852
|
+
for await (const chunk of value) {
|
|
2853
|
+
parts.push(chunk);
|
|
2854
|
+
}
|
|
2855
|
+
} else {
|
|
2856
|
+
throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`);
|
|
2857
|
+
}
|
|
2858
|
+
return parts;
|
|
2859
|
+
}
|
|
2860
|
+
__name(getBytes, "getBytes");
|
|
2861
|
+
function propsForError(value) {
|
|
2862
|
+
const props = Object.getOwnPropertyNames(value);
|
|
2863
|
+
return `[${props.map((p) => `"${p}"`).join(", ")}]`;
|
|
2864
|
+
}
|
|
2865
|
+
__name(propsForError, "propsForError");
|
|
2866
|
+
var isAsyncIterableIterator = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function", "isAsyncIterableIterator");
|
|
2867
|
+
var isResponseLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value.url === "string" && typeof value.blob === "function", "isResponseLike");
|
|
2868
|
+
var isFileLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value.name === "string" && typeof value.lastModified === "number" && isBlobLike(value), "isFileLike");
|
|
2869
|
+
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");
|
|
2870
|
+
var isFsReadStream = /* @__PURE__ */ __name((value) => value instanceof stream.Readable, "isFsReadStream");
|
|
2871
|
+
var isUploadable = /* @__PURE__ */ __name((value) => {
|
|
2872
|
+
return isFileLike(value) || isResponseLike(value) || isFsReadStream(value);
|
|
2873
|
+
}, "isUploadable");
|
|
2874
|
+
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");
|
|
2756
2875
|
var _ApiPromise = class _ApiPromise extends Promise {
|
|
2757
2876
|
constructor(responsePromise) {
|
|
2758
2877
|
super((resolve) => {
|
|
@@ -3048,11 +3167,18 @@ var _ApiClient = class _ApiClient {
|
|
|
3048
3167
|
});
|
|
3049
3168
|
}
|
|
3050
3169
|
importEnvVars(projectRef, slug, body) {
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3170
|
+
if (isRecordLike(body.variables)) {
|
|
3171
|
+
return zodfetch(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/import`, {
|
|
3172
|
+
method: "POST",
|
|
3173
|
+
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
|
|
3174
|
+
body: JSON.stringify(body)
|
|
3175
|
+
});
|
|
3176
|
+
} else {
|
|
3177
|
+
return zodupload(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/import`, body, {
|
|
3178
|
+
method: "POST",
|
|
3179
|
+
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
|
|
3180
|
+
});
|
|
3181
|
+
}
|
|
3056
3182
|
}
|
|
3057
3183
|
retrieveEnvVar(projectRef, slug, key) {
|
|
3058
3184
|
return zodfetch(EnvironmentVariableValue, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/${key}`, {
|