@nightintelligence/cloudflare-workers-utils 0.35.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.
Files changed (66) hide show
  1. package/README.md +5 -0
  2. package/dist/browser.d.mts +47 -0
  3. package/dist/browser.mjs +4 -0
  4. package/dist/browser.mjs.map +1 -0
  5. package/dist/chunk-3D4BXUZX.mjs +54 -0
  6. package/dist/chunk-3D4BXUZX.mjs.map +1 -0
  7. package/dist/chunk-4RE36JUD.mjs +3160 -0
  8. package/dist/chunk-4RE36JUD.mjs.map +1 -0
  9. package/dist/chunk-6LYDFTTF.mjs +40 -0
  10. package/dist/chunk-6LYDFTTF.mjs.map +1 -0
  11. package/dist/chunk-CPLEE7LH.mjs +64 -0
  12. package/dist/chunk-CPLEE7LH.mjs.map +1 -0
  13. package/dist/chunk-G5FCNCLK.mjs +47 -0
  14. package/dist/chunk-G5FCNCLK.mjs.map +1 -0
  15. package/dist/chunk-IGC3TZGH.mjs +157 -0
  16. package/dist/chunk-IGC3TZGH.mjs.map +1 -0
  17. package/dist/chunk-NXPJWJ2B.mjs +180 -0
  18. package/dist/chunk-NXPJWJ2B.mjs.map +1 -0
  19. package/dist/chunk-OPAKTV2K.mjs +75 -0
  20. package/dist/chunk-OPAKTV2K.mjs.map +1 -0
  21. package/dist/chunk-VKFVZ67V.mjs +35 -0
  22. package/dist/chunk-VKFVZ67V.mjs.map +1 -0
  23. package/dist/chunk-W7DIL5J2.mjs +267 -0
  24. package/dist/chunk-W7DIL5J2.mjs.map +1 -0
  25. package/dist/chunk-ZLUHKBEC.mjs +44 -0
  26. package/dist/chunk-ZLUHKBEC.mjs.map +1 -0
  27. package/dist/chunk-ZQ2EZEOC.mjs +477 -0
  28. package/dist/chunk-ZQ2EZEOC.mjs.map +1 -0
  29. package/dist/compatibility-date.d.mts +80 -0
  30. package/dist/compatibility-date.mjs +4 -0
  31. package/dist/compatibility-date.mjs.map +1 -0
  32. package/dist/compliance-j3-tqeao.d.mts +3616 -0
  33. package/dist/compliance.d.mts +4 -0
  34. package/dist/compliance.mjs +9 -0
  35. package/dist/compliance.mjs.map +1 -0
  36. package/dist/docker-path.d.mts +8 -0
  37. package/dist/docker-path.mjs +5 -0
  38. package/dist/docker-path.mjs.map +1 -0
  39. package/dist/errors.d.mts +55 -0
  40. package/dist/errors.mjs +4 -0
  41. package/dist/errors.mjs.map +1 -0
  42. package/dist/fs-helpers.d.mts +40 -0
  43. package/dist/fs-helpers.mjs +4 -0
  44. package/dist/fs-helpers.mjs.map +1 -0
  45. package/dist/global-wrangler-config-path.d.mts +35 -0
  46. package/dist/global-wrangler-config-path.mjs +5 -0
  47. package/dist/global-wrangler-config-path.mjs.map +1 -0
  48. package/dist/index.d.mts +1263 -0
  49. package/dist/index.mjs +26282 -0
  50. package/dist/index.mjs.map +1 -0
  51. package/dist/local-env.d.mts +54 -0
  52. package/dist/local-env.mjs +178 -0
  53. package/dist/local-env.mjs.map +1 -0
  54. package/dist/metafile-esm.json +1 -0
  55. package/dist/open-OYMIZX6T.mjs +609 -0
  56. package/dist/open-OYMIZX6T.mjs.map +1 -0
  57. package/dist/prometheus-metrics.d.mts +50 -0
  58. package/dist/prometheus-metrics.mjs +4 -0
  59. package/dist/prometheus-metrics.mjs.map +1 -0
  60. package/dist/test-helpers/index.d.mts +46 -0
  61. package/dist/test-helpers/index.mjs +310 -0
  62. package/dist/test-helpers/index.mjs.map +1 -0
  63. package/dist/zod-format.d.mts +6 -0
  64. package/dist/zod-format.mjs +4 -0
  65. package/dist/zod-format.mjs.map +1 -0
  66. package/package.json +126 -0
@@ -0,0 +1,4 @@
1
+ export { p as COMPLIANCE_REGION_CONFIG_PUBLIC, q as COMPLIANCE_REGION_CONFIG_UNKNOWN, ar as ComplianceConfig, bE as getCloudflareApiBaseUrl, bG as getCloudflareComplianceRegion, bL as getComplianceRegionSubdomain } from './compliance-j3-tqeao.mjs';
2
+ import 'node:url';
3
+ import 'undici';
4
+ import '@cloudflare/workers-shared';
@@ -0,0 +1,9 @@
1
+ export { COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, getCloudflareApiBaseUrl, getCloudflareComplianceRegion, getComplianceRegionSubdomain } from './chunk-NXPJWJ2B.mjs';
2
+ import './chunk-G5FCNCLK.mjs';
3
+ import './chunk-OPAKTV2K.mjs';
4
+ import './chunk-CPLEE7LH.mjs';
5
+ import './chunk-IGC3TZGH.mjs';
6
+ import './chunk-VKFVZ67V.mjs';
7
+ import './chunk-6LYDFTTF.mjs';
8
+ //# sourceMappingURL=compliance.mjs.map
9
+ //# sourceMappingURL=compliance.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"compliance.mjs"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Returns the configured path to the Docker binary.
3
+ *
4
+ * @returns The value of `WRANGLER_DOCKER_BIN`, or `docker` when unset.
5
+ */
6
+ declare const getDockerPath: () => string;
7
+
8
+ export { getDockerPath };
@@ -0,0 +1,5 @@
1
+ export { getDockerPath } from './chunk-OPAKTV2K.mjs';
2
+ import './chunk-CPLEE7LH.mjs';
3
+ import './chunk-6LYDFTTF.mjs';
4
+ //# sourceMappingURL=docker-path.mjs.map
5
+ //# sourceMappingURL=docker-path.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"docker-path.mjs"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * This is used to provide telemetry with a sanitised error
3
+ * message that could not have any user-identifying information.
4
+ * Set to `true` to duplicate `message`.
5
+ * */
6
+ type TelemetryMessage = {
7
+ telemetryMessage: string | boolean;
8
+ };
9
+ type UserErrorOptions = ErrorOptions & TelemetryMessage;
10
+ type FatalErrorOptions = UserErrorOptions & {
11
+ code?: number;
12
+ };
13
+ /**
14
+ * Base class for errors where the user has done something wrong. These are not
15
+ * reported to Sentry. API errors are intentionally *not* `UserError`s, and are
16
+ * reported to Sentry. This will help us understand which API errors need better
17
+ * messaging.
18
+ */
19
+ declare class UserError extends Error {
20
+ telemetryMessage: string | undefined;
21
+ constructor(message: string, options: UserErrorOptions);
22
+ }
23
+ declare class DeprecationError extends UserError {
24
+ constructor(message: string, options: TelemetryMessage);
25
+ }
26
+ declare class FatalError extends UserError {
27
+ readonly code: number | undefined;
28
+ constructor(message: string, options: FatalErrorOptions);
29
+ }
30
+ declare class CommandLineArgsError extends UserError {
31
+ }
32
+ /**
33
+ * JsonFriendlyFatalError is used to output JSON when wrangler crashes, useful for --json mode.
34
+ *
35
+ * To use, pass stringify'd json into the constructor like so:
36
+ * ```js
37
+ * throw new JsonFriendlyFatalError(JSON.stringify({ error: messageToDisplay }), {
38
+ * telemetryMessage: false,
39
+ * });
40
+ * ```
41
+ */
42
+ declare class JsonFriendlyFatalError extends FatalError {
43
+ }
44
+ declare class MissingConfigError extends Error {
45
+ telemetryMessage: string | undefined;
46
+ constructor(key: string);
47
+ }
48
+ /**
49
+ * Create either a FatalError or JsonFriendlyFatalError depending upon `isJson` parameter.
50
+ *
51
+ * If `isJson` is true, then the `message` is JSON stringified.
52
+ */
53
+ declare function createFatalError(message: unknown, isJson: boolean, options: FatalErrorOptions): Error;
54
+
55
+ export { CommandLineArgsError, DeprecationError, FatalError, JsonFriendlyFatalError, MissingConfigError, type TelemetryMessage, UserError, createFatalError };
@@ -0,0 +1,4 @@
1
+ export { CommandLineArgsError, DeprecationError, FatalError, JsonFriendlyFatalError, MissingConfigError, UserError, createFatalError } from './chunk-CPLEE7LH.mjs';
2
+ import './chunk-6LYDFTTF.mjs';
3
+ //# sourceMappingURL=errors.mjs.map
4
+ //# sourceMappingURL=errors.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"errors.mjs"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Returns whether the given path is a directory
3
+ *
4
+ * Note: this function never throws; if the path does not exist or is inaccessible, it returns false.
5
+ *
6
+ * @param path The file system path to check
7
+ * @returns `true` if the path is a directory, `false` otherwise
8
+ */
9
+ declare function isDirectory(path: string): boolean;
10
+ /**
11
+ * Recursively remove a directory without waiting for completion or throwing any errors.
12
+ *
13
+ * @param dirPath The directory path to remove
14
+ * @param options An object with a `fireAndForget` property set to `true`
15
+ * @return `void` - the removal is fire-and-forget with errors suppressed
16
+ */
17
+ declare function removeDir(dirPath: string, { fireAndForget }: {
18
+ fireAndForget: true;
19
+ }): void;
20
+ /**
21
+ * Recursively remove a directory with retries for Windows compatibility.
22
+ *
23
+ * @param dirPath The directory path to remove
24
+ * @param options An optional object with a `fireAndForget` property set to `false`, if defined
25
+ * @return `Promise<void>` - resolves when the removal is complete, or rejects if the removal fails
26
+ */
27
+ declare function removeDir(dirPath: string, options?: {
28
+ fireAndForget?: false;
29
+ }): Promise<void>;
30
+ /**
31
+ * Synchronously and recursively remove a directory, with retries for Windows compatibility.
32
+ *
33
+ * @see {@link removeDir} for the async version and rationale.
34
+ *
35
+ * @param dirPath The directory path to remove
36
+ * @throws If the removal fails after retries, an error will be thrown
37
+ */
38
+ declare function removeDirSync(dirPath: string): void;
39
+
40
+ export { isDirectory, removeDir, removeDirSync };
@@ -0,0 +1,4 @@
1
+ export { isDirectory, removeDir, removeDirSync } from './chunk-VKFVZ67V.mjs';
2
+ import './chunk-6LYDFTTF.mjs';
3
+ //# sourceMappingURL=fs-helpers.mjs.map
4
+ //# sourceMappingURL=fs-helpers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"fs-helpers.mjs"}
@@ -0,0 +1,35 @@
1
+ interface GetGlobalConfigPathOptions {
2
+ /**
3
+ * The application namespace. Defaults to `"wrangler"`.
4
+ */
5
+ appName?: string;
6
+ /**
7
+ * Whether to prepend a `.` to `appName` when resolving the XDG path and the
8
+ * legacy `$HOME` directory. Defaults to `true` to match wrangler's
9
+ * historical behaviour (`.wrangler`).
10
+ */
11
+ leadingDot?: boolean;
12
+ /**
13
+ * When `true` (the default, matching wrangler's historical behaviour), a
14
+ * pre-existing `~/.<appName>` directory takes precedence over the XDG path.
15
+ * Pass `false` to always use the XDG-compliant path.
16
+ */
17
+ useLegacyHomeDir?: boolean;
18
+ }
19
+ /**
20
+ * Resolve the global config directory for a Cloudflare CLI.
21
+ *
22
+ * Defaults to wrangler's directory (`.wrangler`) so existing callers are
23
+ * unaffected, but accepts an `appName` so other first-party CLIs (e.g. `cf`)
24
+ * can reuse the same XDG-compliant resolution under their own namespace.
25
+ */
26
+ declare function getGlobalConfigPath({ appName, leadingDot, useLegacyHomeDir, }?: GetGlobalConfigPathOptions): string;
27
+ /**
28
+ * Resolve the XDG-compliant global cache directory for wrangler (`.wrangler`).
29
+ *
30
+ * Unlike {@link getGlobalConfigPath}, this never falls back to a legacy
31
+ * `~/.wrangler` directory.
32
+ */
33
+ declare function getGlobalWranglerCachePath(): string;
34
+
35
+ export { type GetGlobalConfigPathOptions, getGlobalConfigPath, getGlobalWranglerCachePath };
@@ -0,0 +1,5 @@
1
+ export { getGlobalConfigPath, getGlobalWranglerCachePath } from './chunk-IGC3TZGH.mjs';
2
+ import './chunk-VKFVZ67V.mjs';
3
+ import './chunk-6LYDFTTF.mjs';
4
+ //# sourceMappingURL=global-wrangler-config-path.mjs.map
5
+ //# sourceMappingURL=global-wrangler-config-path.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"global-wrangler-config-path.mjs"}