@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.
- package/README.md +5 -0
- package/dist/browser.d.mts +47 -0
- package/dist/browser.mjs +4 -0
- package/dist/browser.mjs.map +1 -0
- package/dist/chunk-3D4BXUZX.mjs +54 -0
- package/dist/chunk-3D4BXUZX.mjs.map +1 -0
- package/dist/chunk-4RE36JUD.mjs +3160 -0
- package/dist/chunk-4RE36JUD.mjs.map +1 -0
- package/dist/chunk-6LYDFTTF.mjs +40 -0
- package/dist/chunk-6LYDFTTF.mjs.map +1 -0
- package/dist/chunk-CPLEE7LH.mjs +64 -0
- package/dist/chunk-CPLEE7LH.mjs.map +1 -0
- package/dist/chunk-G5FCNCLK.mjs +47 -0
- package/dist/chunk-G5FCNCLK.mjs.map +1 -0
- package/dist/chunk-IGC3TZGH.mjs +157 -0
- package/dist/chunk-IGC3TZGH.mjs.map +1 -0
- package/dist/chunk-NXPJWJ2B.mjs +180 -0
- package/dist/chunk-NXPJWJ2B.mjs.map +1 -0
- package/dist/chunk-OPAKTV2K.mjs +75 -0
- package/dist/chunk-OPAKTV2K.mjs.map +1 -0
- package/dist/chunk-VKFVZ67V.mjs +35 -0
- package/dist/chunk-VKFVZ67V.mjs.map +1 -0
- package/dist/chunk-W7DIL5J2.mjs +267 -0
- package/dist/chunk-W7DIL5J2.mjs.map +1 -0
- package/dist/chunk-ZLUHKBEC.mjs +44 -0
- package/dist/chunk-ZLUHKBEC.mjs.map +1 -0
- package/dist/chunk-ZQ2EZEOC.mjs +477 -0
- package/dist/chunk-ZQ2EZEOC.mjs.map +1 -0
- package/dist/compatibility-date.d.mts +80 -0
- package/dist/compatibility-date.mjs +4 -0
- package/dist/compatibility-date.mjs.map +1 -0
- package/dist/compliance-j3-tqeao.d.mts +3616 -0
- package/dist/compliance.d.mts +4 -0
- package/dist/compliance.mjs +9 -0
- package/dist/compliance.mjs.map +1 -0
- package/dist/docker-path.d.mts +8 -0
- package/dist/docker-path.mjs +5 -0
- package/dist/docker-path.mjs.map +1 -0
- package/dist/errors.d.mts +55 -0
- package/dist/errors.mjs +4 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/fs-helpers.d.mts +40 -0
- package/dist/fs-helpers.mjs +4 -0
- package/dist/fs-helpers.mjs.map +1 -0
- package/dist/global-wrangler-config-path.d.mts +35 -0
- package/dist/global-wrangler-config-path.mjs +5 -0
- package/dist/global-wrangler-config-path.mjs.map +1 -0
- package/dist/index.d.mts +1263 -0
- package/dist/index.mjs +26282 -0
- package/dist/index.mjs.map +1 -0
- package/dist/local-env.d.mts +54 -0
- package/dist/local-env.mjs +178 -0
- package/dist/local-env.mjs.map +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/open-OYMIZX6T.mjs +609 -0
- package/dist/open-OYMIZX6T.mjs.map +1 -0
- package/dist/prometheus-metrics.d.mts +50 -0
- package/dist/prometheus-metrics.mjs +4 -0
- package/dist/prometheus-metrics.mjs.map +1 -0
- package/dist/test-helpers/index.d.mts +46 -0
- package/dist/test-helpers/index.mjs +310 -0
- package/dist/test-helpers/index.mjs.map +1 -0
- package/dist/zod-format.d.mts +6 -0
- package/dist/zod-format.mjs +4 -0
- package/dist/zod-format.mjs.map +1 -0
- 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 @@
|
|
|
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 };
|
package/dist/errors.mjs
ADDED
|
@@ -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 @@
|
|
|
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 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"global-wrangler-config-path.mjs"}
|