@cloudflare/workers-utils 0.3.0 → 0.5.0
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/browser.d.mts +41 -3
- package/dist/browser.mjs +2 -2
- package/dist/{chunk-73TUG5Z7.mjs → chunk-H6ZOCMLW.mjs} +2 -8
- package/dist/{chunk-DCOBXSFB.mjs → chunk-UB4QLUTD.mjs} +7 -1
- package/dist/chunk-WHXYFHDX.mjs +3180 -0
- package/dist/{browser-mD2xO9Bj.d.mts → config-cFPB-c8J.d.mts} +42 -40
- package/dist/index.d.mts +13 -4
- package/dist/index.mjs +213 -3253
- package/dist/metafile-esm.json +1 -1
- package/dist/test-helpers/index.d.mts +10 -1
- package/dist/test-helpers/index.mjs +68 -8
- package/package.json +9 -7
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { RouterConfig, AssetConfig } from '@cloudflare/workers-shared';
|
|
2
|
-
import { Cloudflare } from 'cloudflare';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* A symbol to inherit a binding from the deployed worker.
|
|
@@ -225,6 +224,7 @@ interface CfService {
|
|
|
225
224
|
entrypoint?: string;
|
|
226
225
|
props?: Record<string, unknown>;
|
|
227
226
|
remote?: boolean;
|
|
227
|
+
cross_account_grant?: string;
|
|
228
228
|
}
|
|
229
229
|
interface CfVpcService {
|
|
230
230
|
binding: string;
|
|
@@ -315,10 +315,19 @@ interface CfDurableObjectMigrations {
|
|
|
315
315
|
deleted_classes?: string[];
|
|
316
316
|
}[];
|
|
317
317
|
}
|
|
318
|
-
|
|
318
|
+
type CfPlacement = {
|
|
319
319
|
mode: "smart";
|
|
320
320
|
hint?: string;
|
|
321
|
-
}
|
|
321
|
+
} | {
|
|
322
|
+
mode?: "targeted";
|
|
323
|
+
region: string;
|
|
324
|
+
} | {
|
|
325
|
+
mode?: "targeted";
|
|
326
|
+
host: string;
|
|
327
|
+
} | {
|
|
328
|
+
mode?: "targeted";
|
|
329
|
+
hostname: string;
|
|
330
|
+
};
|
|
322
331
|
interface CfTailConsumer {
|
|
323
332
|
service: string;
|
|
324
333
|
environment?: string;
|
|
@@ -558,6 +567,7 @@ type WorkerMetadataBinding = {
|
|
|
558
567
|
service: string;
|
|
559
568
|
environment?: string;
|
|
560
569
|
entrypoint?: string;
|
|
570
|
+
cross_account_grant?: string;
|
|
561
571
|
} | {
|
|
562
572
|
type: "analytics_engine";
|
|
563
573
|
name: string;
|
|
@@ -823,6 +833,25 @@ type ContainerApp = {
|
|
|
823
833
|
/** @defaults to 2 GB */
|
|
824
834
|
disk_mb?: number;
|
|
825
835
|
};
|
|
836
|
+
wrangler_ssh?: {
|
|
837
|
+
/**
|
|
838
|
+
* If enabled, those with write access to a container will be able to SSH into it through Wrangler.
|
|
839
|
+
* @default false
|
|
840
|
+
*/
|
|
841
|
+
enabled: boolean;
|
|
842
|
+
/**
|
|
843
|
+
* Port that the SSH service is running on
|
|
844
|
+
* @defaults to 22
|
|
845
|
+
*/
|
|
846
|
+
port?: number;
|
|
847
|
+
};
|
|
848
|
+
/**
|
|
849
|
+
* SSH public keys to put in the container's authorized_keys file.
|
|
850
|
+
*/
|
|
851
|
+
authorized_keys?: {
|
|
852
|
+
name: string;
|
|
853
|
+
public_key: string;
|
|
854
|
+
}[];
|
|
826
855
|
/**
|
|
827
856
|
* @deprecated Use top level `containers` fields instead.
|
|
828
857
|
* `configuration.image` should be `image`
|
|
@@ -1189,6 +1218,15 @@ interface EnvironmentInheritable {
|
|
|
1189
1218
|
placement: {
|
|
1190
1219
|
mode: "off" | "smart";
|
|
1191
1220
|
hint?: string;
|
|
1221
|
+
} | {
|
|
1222
|
+
mode?: "targeted";
|
|
1223
|
+
region: string;
|
|
1224
|
+
} | {
|
|
1225
|
+
mode?: "targeted";
|
|
1226
|
+
host: string;
|
|
1227
|
+
} | {
|
|
1228
|
+
mode?: "targeted";
|
|
1229
|
+
hostname: string;
|
|
1192
1230
|
} | undefined;
|
|
1193
1231
|
/**
|
|
1194
1232
|
* Specify the directory of static assets to deploy/serve
|
|
@@ -2172,40 +2210,4 @@ interface EnvironmentMap {
|
|
|
2172
2210
|
}
|
|
2173
2211
|
declare const defaultWranglerConfig: Config;
|
|
2174
2212
|
|
|
2175
|
-
type
|
|
2176
|
-
id: string;
|
|
2177
|
-
pattern: string;
|
|
2178
|
-
zone_name: string;
|
|
2179
|
-
script: string;
|
|
2180
|
-
}[];
|
|
2181
|
-
interface APIWorkerConfig {
|
|
2182
|
-
name: string;
|
|
2183
|
-
entrypoint: string;
|
|
2184
|
-
tags: string[] | null;
|
|
2185
|
-
compatibility_date: string;
|
|
2186
|
-
compatibility_flags: string[];
|
|
2187
|
-
logpush: boolean | undefined;
|
|
2188
|
-
routes: RoutesRes;
|
|
2189
|
-
tail_consumers: TailConsumer[] | undefined | null;
|
|
2190
|
-
migration_tag?: string;
|
|
2191
|
-
domains: Cloudflare.Workers.Domain[];
|
|
2192
|
-
schedules: Cloudflare.Workers.Scripts.Schedules.ScheduleGetResponse.Schedule[];
|
|
2193
|
-
assets?: AssetConfig;
|
|
2194
|
-
bindings: WorkerMetadata["bindings"];
|
|
2195
|
-
observability: Cloudflare.Workers.Beta.Worker.Observability | undefined;
|
|
2196
|
-
limits: {
|
|
2197
|
-
cpu_ms: number;
|
|
2198
|
-
} | undefined;
|
|
2199
|
-
placement: Cloudflare.Workers.Beta.Workers.Version.Placement | undefined;
|
|
2200
|
-
subdomain: {
|
|
2201
|
-
enabled: boolean;
|
|
2202
|
-
previews_enabled: boolean;
|
|
2203
|
-
};
|
|
2204
|
-
}
|
|
2205
|
-
/**
|
|
2206
|
-
* Given the information of multiple Workers (representing different environments),
|
|
2207
|
-
* construct a Wrangler config file for the application.
|
|
2208
|
-
*/
|
|
2209
|
-
declare function constructWranglerConfig(workerOrWorkers: APIWorkerConfig | APIWorkerConfig[]): RawConfig;
|
|
2210
|
-
|
|
2211
|
-
export { type CfWorkerLoader as $, type Assets as A, type CfWasmModuleBindings as B, type CfWorkerInit as C, type DurableObjectMigration as D, type Environment as E, type CfTextBlobBindings as F, type CfBrowserBinding as G, type CfAIBinding as H, type CfImagesBinding as I, type CfMediaBinding as J, type CfVersionMetadataBinding as K, type CfDataBlobBindings as L, type CfDurableObject as M, type CfWorkflow as N, type Observability as O, type CfQueue as P, type CfR2Bucket as Q, type RawConfig as R, type StreamingTailConsumer as S, type TailConsumer as T, type UserLimits as U, type CfD1Database as V, type WorkerMetadataBinding as W, type CfVectorize as X, type CfSecretsStoreSecrets as Y, type ZoneIdRoute as Z, type CfHelloWorld as _, type Config as a, type CfRateLimit as a0, type CfHyperdrive as a1, type CfService as a2, type CfVpcService as a3, type CfAnalyticsEngineDataset as a4, type CfDispatchNamespace as a5, type CfMTlsCertificate as a6, type CfLogfwdr as a7, type CfLogfwdrBinding as a8, type CfAssetsBinding as a9, type CfPipeline as aa, type CfUnsafeBinding as ab, type CfCapnp as ac, type CfUnsafe as ad, type CfDurableObjectMigrations as ae, type CfPlacement as af, type CfTailConsumer as ag, type CfUserLimits as ah, type CfWorkerContext as ai, type CfWorkerSourceMap as aj, type Json as ak, type AssetConfigMetadata as al, type WorkerMetadata as am, type ServiceMetadataRes as an, INHERIT_SYMBOL as ao, SERVICE_TAG_PREFIX as ap, ENVIRONMENT_TAG_PREFIX as aq, PATH_TO_DEPLOY_CONFIG as ar, type RawDevConfig as b, type ConfigFields as c, type RawEnvironment as d, type RedirectedRawConfig as e, defaultWranglerConfig as f, constructWranglerConfig as g, type ZoneNameRoute as h, type CustomDomainRoute as i, type Route as j, type CloudchamberConfig as k, type ContainerApp as l, type DurableObjectBindings as m, type WorkflowBinding as n, type EnvironmentNonInheritable as o, type Rule as p, type ConfigModuleRuleType as q, type DispatchNamespaceOutbound as r, type DockerConfiguration as s, type ContainerEngine as t, type CfScriptFormat as u, type CfModuleType as v, type CfModule as w, type CfVars as x, type CfKvNamespace as y, type CfSendEmailBindings as z };
|
|
2213
|
+
export { type CfRateLimit as $, type Assets as A, type CfTextBlobBindings as B, type CfWorkerInit as C, type DurableObjectMigration as D, type Environment as E, type CfBrowserBinding as F, type CfAIBinding as G, type CfImagesBinding as H, type CfMediaBinding as I, type CfVersionMetadataBinding as J, type CfDataBlobBindings as K, type CfDurableObject as L, type CfWorkflow as M, type CfQueue as N, type Observability as O, type CfR2Bucket as P, type CfD1Database as Q, type RawConfig as R, type StreamingTailConsumer as S, type TailConsumer as T, type UserLimits as U, type CfVectorize as V, type WorkerMetadataBinding as W, type CfSecretsStoreSecrets as X, type CfHelloWorld as Y, type ZoneIdRoute as Z, type CfWorkerLoader as _, type RedirectedRawConfig as a, type CfHyperdrive as a0, type CfService as a1, type CfVpcService as a2, type CfAnalyticsEngineDataset as a3, type CfDispatchNamespace as a4, type CfMTlsCertificate as a5, type CfLogfwdr as a6, type CfLogfwdrBinding as a7, type CfAssetsBinding as a8, type CfPipeline as a9, type CfUnsafeBinding as aa, type CfCapnp as ab, type CfUnsafe as ac, type CfDurableObjectMigrations as ad, type CfPlacement as ae, type CfTailConsumer as af, type CfUserLimits as ag, type CfWorkerContext as ah, type CfWorkerSourceMap as ai, type Json as aj, type AssetConfigMetadata as ak, type WorkerMetadata as al, type ServiceMetadataRes as am, INHERIT_SYMBOL as an, SERVICE_TAG_PREFIX as ao, ENVIRONMENT_TAG_PREFIX as ap, PATH_TO_DEPLOY_CONFIG as aq, type Config as b, type RawDevConfig as c, type ConfigFields as d, type RawEnvironment as e, defaultWranglerConfig as f, type ZoneNameRoute as g, type CustomDomainRoute as h, type Route as i, type CloudchamberConfig as j, type ContainerApp as k, type DurableObjectBindings as l, type WorkflowBinding as m, type EnvironmentNonInheritable as n, type Rule as o, type ConfigModuleRuleType as p, type DispatchNamespaceOutbound as q, type DockerConfiguration as r, type ContainerEngine as s, type CfScriptFormat as t, type CfModuleType as u, type CfModule as v, type CfVars as w, type CfKvNamespace as x, type CfSendEmailBindings as y, type CfWasmModuleBindings as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { C as CfWorkerInit, R as RawConfig,
|
|
2
|
-
export {
|
|
1
|
+
import { C as CfWorkerInit, R as RawConfig, b as Config, W as WorkerMetadataBinding } from './config-cFPB-c8J.mjs';
|
|
2
|
+
export { ak as AssetConfigMetadata, A as Assets, G as CfAIBinding, a3 as CfAnalyticsEngineDataset, a8 as CfAssetsBinding, F as CfBrowserBinding, ab as CfCapnp, Q as CfD1Database, K as CfDataBlobBindings, a4 as CfDispatchNamespace, L as CfDurableObject, ad as CfDurableObjectMigrations, Y as CfHelloWorld, a0 as CfHyperdrive, H as CfImagesBinding, x as CfKvNamespace, a6 as CfLogfwdr, a7 as CfLogfwdrBinding, a5 as CfMTlsCertificate, I as CfMediaBinding, v as CfModule, u as CfModuleType, a9 as CfPipeline, ae as CfPlacement, N as CfQueue, P as CfR2Bucket, $ as CfRateLimit, t as CfScriptFormat, X as CfSecretsStoreSecrets, y as CfSendEmailBindings, a1 as CfService, af as CfTailConsumer, B as CfTextBlobBindings, ac as CfUnsafe, aa as CfUnsafeBinding, ag as CfUserLimits, w as CfVars, V as CfVectorize, J as CfVersionMetadataBinding, a2 as CfVpcService, z as CfWasmModuleBindings, ah as CfWorkerContext, _ as CfWorkerLoader, ai as CfWorkerSourceMap, M as CfWorkflow, j as CloudchamberConfig, d as ConfigFields, p as ConfigModuleRuleType, k as ContainerApp, s as ContainerEngine, h as CustomDomainRoute, q as DispatchNamespaceOutbound, r as DockerConfiguration, l as DurableObjectBindings, D as DurableObjectMigration, ap as ENVIRONMENT_TAG_PREFIX, E as Environment, n as EnvironmentNonInheritable, an as INHERIT_SYMBOL, aj as Json, O as Observability, aq as PATH_TO_DEPLOY_CONFIG, c as RawDevConfig, e as RawEnvironment, a as RedirectedRawConfig, i as Route, o as Rule, ao as SERVICE_TAG_PREFIX, am as ServiceMetadataRes, S as StreamingTailConsumer, T as TailConsumer, U as UserLimits, al as WorkerMetadata, m as WorkflowBinding, Z as ZoneIdRoute, g as ZoneNameRoute, f as defaultWranglerConfig } from './config-cFPB-c8J.mjs';
|
|
3
3
|
import * as jsoncParser from 'jsonc-parser';
|
|
4
|
+
export { constructWranglerConfig } from './browser.mjs';
|
|
4
5
|
import '@cloudflare/workers-shared';
|
|
5
6
|
import 'cloudflare';
|
|
6
7
|
|
|
@@ -245,6 +246,7 @@ declare function parseTOML<T>(input: string, file?: string): T | never;
|
|
|
245
246
|
*/
|
|
246
247
|
type PackageJSON = {
|
|
247
248
|
name?: string;
|
|
249
|
+
version?: string;
|
|
248
250
|
devDependencies?: Record<string, unknown>;
|
|
249
251
|
dependencies?: Record<string, unknown>;
|
|
250
252
|
scripts?: Record<string, unknown>;
|
|
@@ -443,7 +445,9 @@ type VariableNames =
|
|
|
443
445
|
/** Docker host configuration (handled separately from environment variable factory). */
|
|
444
446
|
| "WRANGLER_DOCKER_HOST"
|
|
445
447
|
/** Docker host configuration (handled separately from environment variable factory). */
|
|
446
|
-
| "DOCKER_HOST"
|
|
448
|
+
| "DOCKER_HOST"
|
|
449
|
+
/** Environment variable used to signal that the current process is being run by the open-next deploy command. */
|
|
450
|
+
| "OPEN_NEXT_DEPLOY";
|
|
447
451
|
type DeprecatedNames = "CF_ACCOUNT_ID" | "CF_API_TOKEN" | "CF_API_KEY" | "CF_EMAIL" | "CF_API_BASE_URL";
|
|
448
452
|
type ElementType<A> = A extends readonly (infer T)[] ? T : never;
|
|
449
453
|
/**
|
|
@@ -657,7 +661,12 @@ declare const getWranglerHideBanner: () => boolean;
|
|
|
657
661
|
* `CLOUDFLARE_ENV` specifies the currently selected Wrangler/Cloudflare environment.
|
|
658
662
|
*/
|
|
659
663
|
declare const getCloudflareEnv: () => string | undefined;
|
|
664
|
+
/**
|
|
665
|
+
* `OPEN_NEXT_DEPLOY` is an environment variables that indicates that the current process is being
|
|
666
|
+
* run by the open-next deploy command
|
|
667
|
+
*/
|
|
668
|
+
declare const getOpenNextDeployFromEnv: () => string | undefined;
|
|
660
669
|
|
|
661
670
|
declare function getGlobalWranglerConfigPath(): string;
|
|
662
671
|
|
|
663
|
-
export { APIError, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, CfWorkerInit, CommandLineArgsError, type ComplianceConfig, Config, type ConfigBindingOptions, DeprecationError, FatalError, type File, JsonFriendlyFatalError, type Location, type Message, MissingConfigError, type NormalizeAndValidateConfigArgs, type PackageJSON, ParseError, PatchConfigError, RawConfig, type ResolveConfigPathOptions, type TelemetryMessage, UserError, WorkerMetadataBinding, assertNever, bucketFormatMessage, configFileName, configFormat, createFatalError, experimental_patchConfig, experimental_readRawConfig, findWranglerConfig, formatCompatibilityDate, formatConfigSnippet, friendlyBindingNames, getBooleanEnvironmentVariableFactory, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getDockerPath, getEnvironmentVariableFactory, getGlobalWranglerConfigPath, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkersCIBranchName, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, hasProperty, indexLocation, isOptionalProperty, isPagesConfig, isRequiredProperty, isValidR2BucketName, mapWorkerMetadataBindings, normalizeAndValidateConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, readFileSync, readFileSyncToBuffer, resolveWranglerConfigPath, searchLocation, validatePagesConfig };
|
|
672
|
+
export { APIError, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, CfWorkerInit, CommandLineArgsError, type ComplianceConfig, Config, type ConfigBindingOptions, DeprecationError, FatalError, type File, JsonFriendlyFatalError, type Location, type Message, MissingConfigError, type NormalizeAndValidateConfigArgs, type PackageJSON, ParseError, PatchConfigError, RawConfig, type ResolveConfigPathOptions, type TelemetryMessage, UserError, WorkerMetadataBinding, assertNever, bucketFormatMessage, configFileName, configFormat, createFatalError, experimental_patchConfig, experimental_readRawConfig, findWranglerConfig, formatCompatibilityDate, formatConfigSnippet, friendlyBindingNames, getBooleanEnvironmentVariableFactory, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getDockerPath, getEnvironmentVariableFactory, getGlobalWranglerConfigPath, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkersCIBranchName, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, hasProperty, indexLocation, isOptionalProperty, isPagesConfig, isRequiredProperty, isValidR2BucketName, mapWorkerMetadataBindings, normalizeAndValidateConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, readFileSync, readFileSyncToBuffer, resolveWranglerConfigPath, searchLocation, validatePagesConfig };
|