@cloudflare/workers-utils 0.1.0 → 0.1.1

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.
@@ -402,6 +402,7 @@ interface CfWorkerInit {
402
402
  logpush: boolean | undefined;
403
403
  placement: CfPlacement | undefined;
404
404
  tail_consumers: CfTailConsumer[] | undefined;
405
+ streaming_tail_consumers?: CfTailConsumer[] | undefined;
405
406
  limits: CfUserLimits | undefined;
406
407
  annotations?: Record<string, string | undefined>;
407
408
  keep_assets?: boolean | undefined;
@@ -636,6 +637,7 @@ type WorkerMetadataPut = {
636
637
  logpush?: boolean;
637
638
  placement?: CfPlacement;
638
639
  tail_consumers?: CfTailConsumer[];
640
+ streaming_tail_consumers?: CfTailConsumer[];
639
641
  limits?: CfUserLimits;
640
642
  assets?: {
641
643
  jwt: string;
@@ -1691,6 +1693,16 @@ interface EnvironmentNonInheritable {
1691
1693
  * @nonInheritable
1692
1694
  */
1693
1695
  tail_consumers?: TailConsumer[];
1696
+ /**
1697
+ * Specifies a list of Streaming Tail Workers that are bound to this Worker environment
1698
+ *
1699
+ * NOTE: This field is not automatically inherited from the top level environment,
1700
+ * and so must be specified in every named environment.
1701
+ *
1702
+ * @default []
1703
+ * @nonInheritable
1704
+ */
1705
+ streaming_tail_consumers?: StreamingTailConsumer[];
1694
1706
  /**
1695
1707
  * Specifies namespace bindings that are bound to this Worker environment.
1696
1708
  *
@@ -1839,6 +1851,10 @@ type TailConsumer = {
1839
1851
  /** (Optional) The environment of the service. */
1840
1852
  environment?: string;
1841
1853
  };
1854
+ type StreamingTailConsumer = {
1855
+ /** The name of the service streaming tail events will be forwarded to. */
1856
+ service: string;
1857
+ };
1842
1858
  interface DispatchNamespaceOutbound {
1843
1859
  /** Name of the service handling the outbound requests */
1844
1860
  service: string;
@@ -2160,12 +2176,12 @@ type RoutesRes = {
2160
2176
  interface APIWorkerConfig {
2161
2177
  name: string;
2162
2178
  entrypoint: string;
2163
- tags: string[];
2179
+ tags: string[] | null;
2164
2180
  compatibility_date: string;
2165
2181
  compatibility_flags: string[];
2166
2182
  logpush: boolean | undefined;
2167
2183
  routes: RoutesRes;
2168
- tail_consumers: TailConsumer[] | undefined;
2184
+ tail_consumers: TailConsumer[] | undefined | null;
2169
2185
  migration_tag?: string;
2170
2186
  domains: Cloudflare.Workers.Domain[];
2171
2187
  schedules: Cloudflare.Workers.Scripts.Schedules.ScheduleGetResponse.Schedule[];
@@ -2187,4 +2203,4 @@ interface APIWorkerConfig {
2187
2203
  */
2188
2204
  declare function constructWranglerConfig(workerOrWorkers: APIWorkerConfig | APIWorkerConfig[]): RawConfig;
2189
2205
 
2190
- export { type CfRateLimit 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 CfD1Database 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 Config 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 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 };
2206
+ 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 };
@@ -1,3 +1,3 @@
1
- export { g as constructWranglerConfig } from './browser-BbMtmAbH.mjs';
1
+ export { g as constructWranglerConfig } from './browser-BJCkNVW9.mjs';
2
2
  import '@cloudflare/workers-shared';
3
3
  import 'cloudflare';
package/dist/browser.mjs CHANGED
@@ -1 +1 @@
1
- export { constructWranglerConfig } from './chunk-LFBFF6MG.mjs';
1
+ export { constructWranglerConfig } from './chunk-PSOC3TD3.mjs';
@@ -1,35 +1,5 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
- }) : x)(function(x) {
11
- if (typeof require !== "undefined") return require.apply(this, arguments);
12
- throw Error('Dynamic require of "' + x + '" is not supported');
13
- });
14
- var __commonJS = (cb, mod) => function __require2() {
15
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
- };
17
- var __copyProps = (to, from, except, desc) => {
18
- if (from && typeof from === "object" || typeof from === "function") {
19
- for (let key of __getOwnPropNames(from))
20
- if (!__hasOwnProp.call(to, key) && key !== except)
21
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
- }
23
- return to;
24
- };
25
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
- // If the importer is in node compatibility mode or this is not an ESM
27
- // file that has been converted to a CommonJS file using a Babel-
28
- // compatible transform (i.e. "__esModule" has not been set), then set
29
- // "default" to the CommonJS "module.exports" for node compatibility.
30
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
- mod
32
- ));
33
3
 
34
4
  // src/constants.ts
35
5
  var INHERIT_SYMBOL = Symbol.for("inherit_binding");
@@ -487,7 +457,7 @@ function convertWorkerToWranglerConfig(config) {
487
457
  crons: config.schedules.map((scheduled) => scheduled.cron)
488
458
  }
489
459
  } : {},
490
- tail_consumers: config.tail_consumers,
460
+ tail_consumers: config.tail_consumers ?? void 0,
491
461
  observability: config.observability,
492
462
  ...mappedBindings
493
463
  };
@@ -530,4 +500,4 @@ function constructWranglerConfig(workerOrWorkers) {
530
500
  }
531
501
  __name(constructWranglerConfig, "constructWranglerConfig");
532
502
 
533
- export { CommandLineArgsError, DeprecationError, ENVIRONMENT_TAG_PREFIX, FatalError, INHERIT_SYMBOL, JsonFriendlyFatalError, MissingConfigError, PATH_TO_DEPLOY_CONFIG, SERVICE_TAG_PREFIX, UserError, __commonJS, __name, __require, __toESM, assertNever, constructWranglerConfig, createFatalError, formatCompatibilityDate, mapWorkerMetadataBindings };
503
+ export { CommandLineArgsError, DeprecationError, ENVIRONMENT_TAG_PREFIX, FatalError, INHERIT_SYMBOL, JsonFriendlyFatalError, MissingConfigError, PATH_TO_DEPLOY_CONFIG, SERVICE_TAG_PREFIX, UserError, __name, assertNever, constructWranglerConfig, createFatalError, formatCompatibilityDate, mapWorkerMetadataBindings };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CfWorkerInit, R as RawConfig, a as Config, W as WorkerMetadataBinding } from './browser-BbMtmAbH.mjs';
2
- export { ak as AssetConfigMetadata, A as Assets, H as CfAIBinding, a3 as CfAnalyticsEngineDataset, a8 as CfAssetsBinding, G as CfBrowserBinding, ab as CfCapnp, S as CfD1Database, L as CfDataBlobBindings, a4 as CfDispatchNamespace, M as CfDurableObject, ad as CfDurableObjectMigrations, Y as CfHelloWorld, a0 as CfHyperdrive, I as CfImagesBinding, y as CfKvNamespace, a6 as CfLogfwdr, a7 as CfLogfwdrBinding, a5 as CfMTlsCertificate, J as CfMediaBinding, w as CfModule, v as CfModuleType, a9 as CfPipeline, ae as CfPlacement, P as CfQueue, Q as CfR2Bucket, $ as CfRateLimit, u as CfScriptFormat, X as CfSecretsStoreSecrets, z as CfSendEmailBindings, a1 as CfService, af as CfTailConsumer, F as CfTextBlobBindings, ac as CfUnsafe, aa as CfUnsafeBinding, ag as CfUserLimits, x as CfVars, V as CfVectorize, K as CfVersionMetadataBinding, a2 as CfVpcService, B as CfWasmModuleBindings, ah as CfWorkerContext, _ as CfWorkerLoader, ai as CfWorkerSourceMap, N as CfWorkflow, k as CloudchamberConfig, c as ConfigFields, q as ConfigModuleRuleType, l as ContainerApp, t as ContainerEngine, i as CustomDomainRoute, r as DispatchNamespaceOutbound, s as DockerConfiguration, m as DurableObjectBindings, D as DurableObjectMigration, ap as ENVIRONMENT_TAG_PREFIX, E as Environment, o as EnvironmentNonInheritable, an as INHERIT_SYMBOL, aj as Json, O as Observability, aq as PATH_TO_DEPLOY_CONFIG, b as RawDevConfig, d as RawEnvironment, e as RedirectedRawConfig, j as Route, p as Rule, ao as SERVICE_TAG_PREFIX, am as ServiceMetadataRes, T as TailConsumer, U as UserLimits, al as WorkerMetadata, n as WorkflowBinding, Z as ZoneIdRoute, h as ZoneNameRoute, g as constructWranglerConfig, f as defaultWranglerConfig } from './browser-BbMtmAbH.mjs';
1
+ import { C as CfWorkerInit, R as RawConfig, a as Config, W as WorkerMetadataBinding } from './browser-BJCkNVW9.mjs';
2
+ export { al as AssetConfigMetadata, A as Assets, H as CfAIBinding, a4 as CfAnalyticsEngineDataset, a9 as CfAssetsBinding, G as CfBrowserBinding, ac as CfCapnp, V as CfD1Database, L as CfDataBlobBindings, a5 as CfDispatchNamespace, M as CfDurableObject, ae as CfDurableObjectMigrations, _ as CfHelloWorld, a1 as CfHyperdrive, I as CfImagesBinding, y as CfKvNamespace, a7 as CfLogfwdr, a8 as CfLogfwdrBinding, a6 as CfMTlsCertificate, J as CfMediaBinding, w as CfModule, v as CfModuleType, aa as CfPipeline, af as CfPlacement, P as CfQueue, Q as CfR2Bucket, a0 as CfRateLimit, u as CfScriptFormat, Y as CfSecretsStoreSecrets, z as CfSendEmailBindings, a2 as CfService, ag as CfTailConsumer, F as CfTextBlobBindings, ad as CfUnsafe, ab as CfUnsafeBinding, ah as CfUserLimits, x as CfVars, X as CfVectorize, K as CfVersionMetadataBinding, a3 as CfVpcService, B as CfWasmModuleBindings, ai as CfWorkerContext, $ as CfWorkerLoader, aj as CfWorkerSourceMap, N as CfWorkflow, k as CloudchamberConfig, c as ConfigFields, q as ConfigModuleRuleType, l as ContainerApp, t as ContainerEngine, i as CustomDomainRoute, r as DispatchNamespaceOutbound, s as DockerConfiguration, m as DurableObjectBindings, D as DurableObjectMigration, aq as ENVIRONMENT_TAG_PREFIX, E as Environment, o as EnvironmentNonInheritable, ao as INHERIT_SYMBOL, ak as Json, O as Observability, ar as PATH_TO_DEPLOY_CONFIG, b as RawDevConfig, d as RawEnvironment, e as RedirectedRawConfig, j as Route, p as Rule, ap as SERVICE_TAG_PREFIX, an as ServiceMetadataRes, S as StreamingTailConsumer, T as TailConsumer, U as UserLimits, am as WorkerMetadata, n as WorkflowBinding, Z as ZoneIdRoute, h as ZoneNameRoute, g as constructWranglerConfig, f as defaultWranglerConfig } from './browser-BJCkNVW9.mjs';
3
3
  import * as jsoncParser from 'jsonc-parser';
4
4
  import '@cloudflare/workers-shared';
5
5
  import 'cloudflare';
@@ -297,6 +297,38 @@ declare function parseByteSize(s: string, base?: number | undefined): number;
297
297
 
298
298
  declare function validatePagesConfig(config: Config, envNames: string[], projectName?: string): Diagnostics;
299
299
 
300
+ /**
301
+ * Returns whether `target` has the required property `property` of type `type`.
302
+ *
303
+ * @param target the object to test.
304
+ * @param property the property name to test.
305
+ * @param type the expected type of the property.
306
+ * @param choices optional list of allowed values for the property.
307
+ * @returns whether `target` has the required property `property` of type `type`, and optionally one of `choices`.
308
+ */
309
+ declare const isRequiredProperty: <T extends object>(target: object, property: keyof T, type: TypeofType, choices?: unknown[]) => target is T;
310
+ /**
311
+ * Returns whether `target` has the optional property `property` of type `type`.
312
+ *
313
+ * @param target the object to test.
314
+ * @param property the property name to test.
315
+ * @param type the expected type of the property.
316
+ * @returns whether `target` has the optional property `property` of type `type`.
317
+ */
318
+ declare const isOptionalProperty: <T extends object>(target: object, property: keyof T, type: TypeofType) => target is T;
319
+ /**
320
+ * Returns whether `target` has the property `property`.
321
+ *
322
+ * @param target the object to test.
323
+ * @param property the property name to test.
324
+ * @returns whether `target` has the property `property`.
325
+ */
326
+ declare const hasProperty: <T extends object>(target: object, property: keyof T) => target is T;
327
+ /**
328
+ * JavaScript `typeof` operator return values.
329
+ */
330
+ type TypeofType = "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
331
+
300
332
  declare function assertNever(_value: never): void;
301
333
 
302
334
  /**
@@ -317,4 +349,4 @@ declare function formatCompatibilityDate(date: Date): string;
317
349
  */
318
350
  declare function mapWorkerMetadataBindings(bindings: WorkerMetadataBinding[]): RawConfig;
319
351
 
320
- export { APIError, CfWorkerInit, CommandLineArgsError, 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, indexLocation, isPagesConfig, isValidR2BucketName, mapWorkerMetadataBindings, normalizeAndValidateConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, readFileSync, readFileSyncToBuffer, resolveWranglerConfigPath, searchLocation, validatePagesConfig };
352
+ export { APIError, CfWorkerInit, CommandLineArgsError, 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, hasProperty, indexLocation, isOptionalProperty, isPagesConfig, isRequiredProperty, isValidR2BucketName, mapWorkerMetadataBindings, normalizeAndValidateConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, readFileSync, readFileSyncToBuffer, resolveWranglerConfigPath, searchLocation, validatePagesConfig };