alchemy 0.80.1 → 0.81.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/bin/alchemy.js +11 -5
- package/bin/services/execute-alchemy.ts +18 -6
- package/lib/alchemy.js +1 -1
- package/lib/alchemy.js.map +1 -1
- package/lib/cloudflare/compatibility-date.gen.d.ts +1 -1
- package/lib/cloudflare/compatibility-date.gen.js +1 -1
- package/lib/cloudflare/hyperdrive.d.ts +23 -5
- package/lib/cloudflare/hyperdrive.d.ts.map +1 -1
- package/lib/cloudflare/hyperdrive.js.map +1 -1
- package/lib/cloudflare/index.d.ts +3 -0
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +3 -0
- package/lib/cloudflare/index.js.map +1 -1
- package/lib/cloudflare/miniflare/miniflare-worker-proxy.d.ts.map +1 -1
- package/lib/cloudflare/miniflare/miniflare-worker-proxy.js +7 -0
- package/lib/cloudflare/miniflare/miniflare-worker-proxy.js.map +1 -1
- package/lib/cloudflare/queue.d.ts +0 -3
- package/lib/cloudflare/queue.d.ts.map +1 -1
- package/lib/cloudflare/queue.js +53 -31
- package/lib/cloudflare/queue.js.map +1 -1
- package/lib/cloudflare/tunnel-route.d.ts +172 -0
- package/lib/cloudflare/tunnel-route.d.ts.map +1 -0
- package/lib/cloudflare/tunnel-route.js +251 -0
- package/lib/cloudflare/tunnel-route.js.map +1 -0
- package/lib/cloudflare/warp-default-profile.d.ts +133 -0
- package/lib/cloudflare/warp-default-profile.d.ts.map +1 -0
- package/lib/cloudflare/warp-default-profile.js +138 -0
- package/lib/cloudflare/warp-default-profile.js.map +1 -0
- package/lib/cloudflare/warp-device-profile.d.ts +272 -0
- package/lib/cloudflare/warp-device-profile.d.ts.map +1 -0
- package/lib/cloudflare/warp-device-profile.js +291 -0
- package/lib/cloudflare/warp-device-profile.js.map +1 -0
- package/lib/scope.d.ts +1 -1
- package/lib/scope.d.ts.map +1 -1
- package/lib/scope.js +1 -1
- package/lib/scope.js.map +1 -1
- package/package.json +1 -1
- package/src/alchemy.ts +1 -1
- package/src/cloudflare/compatibility-date.gen.ts +1 -1
- package/src/cloudflare/hyperdrive.ts +27 -5
- package/src/cloudflare/index.ts +3 -0
- package/src/cloudflare/miniflare/miniflare-worker-proxy.ts +11 -0
- package/src/cloudflare/queue.ts +97 -56
- package/src/cloudflare/tunnel-route.ts +495 -0
- package/src/cloudflare/warp-default-profile.ts +320 -0
- package/src/cloudflare/warp-device-profile.ts +616 -0
- package/src/scope.ts +2 -2
- package/workers/tunnel-proxy.js +1 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { Resource, ResourceKind } from "../resource.js";
|
|
2
|
+
import { handleApiError } from "./api-error.js";
|
|
3
|
+
import { createCloudflareApi, } from "./api.js";
|
|
4
|
+
export function isWarpDefaultProfile(resource) {
|
|
5
|
+
return resource?.[ResourceKind] === "cloudflare::WarpDefaultProfile";
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Manages the Cloudflare WARP Default Device Profile, which defines the
|
|
9
|
+
* account-wide default WARP client settings that apply when no custom profile matches.
|
|
10
|
+
*
|
|
11
|
+
* The default profile always exists and cannot be deleted. This resource allows you
|
|
12
|
+
* to update its settings programmatically.
|
|
13
|
+
*
|
|
14
|
+
* @see https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/warp/configure-warp/device-profiles/
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ## Update default WARP settings
|
|
18
|
+
*
|
|
19
|
+
* Configure the default behavior for all devices
|
|
20
|
+
*
|
|
21
|
+
* const defaultProfile = await WarpDefaultProfile("default", {
|
|
22
|
+
* serviceModeV2: { mode: "warp" },
|
|
23
|
+
* autoConnect: 0,
|
|
24
|
+
* captivePortal: 180,
|
|
25
|
+
* supportUrl: "https://support.example.com"
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ## Default profile with split tunnel
|
|
30
|
+
*
|
|
31
|
+
* Configure default split tunnel behavior for all devices
|
|
32
|
+
*
|
|
33
|
+
* const defaultWithSplitTunnel = await WarpDefaultProfile("default", {
|
|
34
|
+
* serviceModeV2: { mode: "warp" },
|
|
35
|
+
* splitTunnel: {
|
|
36
|
+
* mode: "exclude",
|
|
37
|
+
* entries: [
|
|
38
|
+
* { address: "10.0.0.0/8", description: "Internal network" },
|
|
39
|
+
* { address: "192.168.0.0/16", description: "Local network" }
|
|
40
|
+
* ]
|
|
41
|
+
* }
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ## Locked default profile
|
|
46
|
+
*
|
|
47
|
+
* Create a locked-down default configuration
|
|
48
|
+
*
|
|
49
|
+
* const lockedDefault = await WarpDefaultProfile("default", {
|
|
50
|
+
* serviceModeV2: { mode: "warp" },
|
|
51
|
+
* switchLocked: true,
|
|
52
|
+
* allowedToLeave: false,
|
|
53
|
+
* disableAutoFallback: true,
|
|
54
|
+
* tunnelProtocol: "wireguard"
|
|
55
|
+
* });
|
|
56
|
+
*/
|
|
57
|
+
export const WarpDefaultProfile = Resource("cloudflare::WarpDefaultProfile", async function (id, props = {}) {
|
|
58
|
+
const api = await createCloudflareApi(props);
|
|
59
|
+
if (this.phase === "delete") {
|
|
60
|
+
// Default profile cannot be deleted, just remove from state
|
|
61
|
+
return this.destroy();
|
|
62
|
+
}
|
|
63
|
+
// Update default profile (single PATCH endpoint)
|
|
64
|
+
await updateDefaultPolicy(api, props);
|
|
65
|
+
return {
|
|
66
|
+
...props,
|
|
67
|
+
modifiedAt: Date.now(),
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
// Type-safe mapping - TypeScript errors if any SimpleDeviceSettingKey is missing
|
|
71
|
+
const DEVICE_SETTINGS_MAP = {
|
|
72
|
+
disableAutoFallback: "disable_auto_fallback",
|
|
73
|
+
allowModeSwitch: "allow_mode_switch",
|
|
74
|
+
switchLocked: "switch_locked",
|
|
75
|
+
tunnelProtocol: "tunnel_protocol",
|
|
76
|
+
autoConnect: "auto_connect",
|
|
77
|
+
allowedToLeave: "allowed_to_leave",
|
|
78
|
+
captivePortal: "captive_portal",
|
|
79
|
+
supportUrl: "support_url",
|
|
80
|
+
excludeOfficeIps: "exclude_office_ips",
|
|
81
|
+
lanAllowMinutes: "lan_allow_minutes",
|
|
82
|
+
lanAllowSubnetSize: "lan_allow_subnet_size",
|
|
83
|
+
};
|
|
84
|
+
async function updateDefaultPolicy(api, props) {
|
|
85
|
+
// Build device settings object
|
|
86
|
+
const deviceSettings = {};
|
|
87
|
+
if (props.serviceModeV2) {
|
|
88
|
+
deviceSettings.service_mode_v2 = {
|
|
89
|
+
mode: props.serviceModeV2.mode,
|
|
90
|
+
...(props.serviceModeV2.port && { port: props.serviceModeV2.port }),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
// Apply all simple field mappings
|
|
94
|
+
for (const propKey of Object.keys(DEVICE_SETTINGS_MAP)) {
|
|
95
|
+
deviceSettings[DEVICE_SETTINGS_MAP[propKey]] = props[propKey];
|
|
96
|
+
}
|
|
97
|
+
// Split tunnel config is part of the body for default policy
|
|
98
|
+
if (props.splitTunnel) {
|
|
99
|
+
if (props.splitTunnel.mode === "include") {
|
|
100
|
+
deviceSettings.include = props.splitTunnel.entries.map((entry) => ({
|
|
101
|
+
address: entry.address,
|
|
102
|
+
...(entry.description && { description: entry.description }),
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
deviceSettings.exclude = props.splitTunnel.entries.map((entry) => ({
|
|
107
|
+
address: entry.address,
|
|
108
|
+
...(entry.description && { description: entry.description }),
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const requestBody = {
|
|
113
|
+
...(Object.keys(deviceSettings).length > 0 && { ...deviceSettings }),
|
|
114
|
+
};
|
|
115
|
+
const response = await api.patch(`/accounts/${api.accountId}/devices/policy`, requestBody);
|
|
116
|
+
if (!response.ok) {
|
|
117
|
+
await handleApiError(response, "update", "warp_default_profile", "default");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async function updateDefaultSplitTunnel(api, config) {
|
|
121
|
+
const routes = config.entries.map((entry) => ({
|
|
122
|
+
address: entry.address,
|
|
123
|
+
...(entry.description && { description: entry.description }),
|
|
124
|
+
}));
|
|
125
|
+
if (config.mode === "include") {
|
|
126
|
+
const response = await api.put(`/accounts/${api.accountId}/devices/policies/default/includes`, routes);
|
|
127
|
+
if (!response.ok) {
|
|
128
|
+
await handleApiError(response, "update split tunnel includes", "warp_default_profile", "default");
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
const response = await api.put(`/accounts/${api.accountId}/devices/policies/default/excludes`, routes);
|
|
133
|
+
if (!response.ok) {
|
|
134
|
+
await handleApiError(response, "update split tunnel excludes", "warp_default_profile", "default");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=warp-default-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warp-default-profile.js","sourceRoot":"","sources":["../../src/cloudflare/warp-default-profile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EACL,mBAAmB,GAGpB,MAAM,UAAU,CAAC;AAwFlB,MAAM,UAAU,oBAAoB,CAClC,QAAa;IAEb,OAAO,QAAQ,EAAE,CAAC,YAAY,CAAC,KAAK,gCAAgC,CAAC;AACvE,CAAC;AAYD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CACxC,gCAAgC,EAChC,KAAK,WAEH,EAAU,EACV,QAAiC,EAAE;IAEnC,MAAM,GAAG,GAAG,M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CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC5C,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,GAAG,CAAC,KAAK,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC;KAC7D,CAAC,CAAC,CAAC;IAEJ,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,GAAG,CAC5B,aAAa,GAAG,CAAC,SAAS,oCAAoC,EAC9D,MAAM,CACP,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,cAAc,CAClB,QAAQ,EACR,8BAA8B,EAC9B,sBAAsB,EACtB,SAAS,CACV,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,GAAG,CAC5B,aAAa,GAAG,CAAC,SAAS,oCAAoC,EAC9D,MAAM,CACP,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,cAAc,CAClB,QAAQ,EACR,8BAA8B,EAC9B,sBAAsB,EACtB,SAAS,CACV,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import type { Context } from "../context.ts";
|
|
2
|
+
import { type CloudflareApiOptions } from "./api.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Service mode configuration for WARP client
|
|
5
|
+
*/
|
|
6
|
+
export interface ServiceModeV2 {
|
|
7
|
+
/**
|
|
8
|
+
* WARP client operational mode
|
|
9
|
+
*/
|
|
10
|
+
mode: "warp" | "proxy" | "doh_only" | "warp_tunnel_only";
|
|
11
|
+
/**
|
|
12
|
+
* Port number (only used for proxy mode)
|
|
13
|
+
*/
|
|
14
|
+
port?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Split tunnel route entry
|
|
18
|
+
*/
|
|
19
|
+
export interface SplitTunnelEntry {
|
|
20
|
+
/**
|
|
21
|
+
* IP address or CIDR block (e.g., "10.0.0.0/8" or "192.168.1.1")
|
|
22
|
+
* or domain name (e.g., "example.com"). Use either address or host.
|
|
23
|
+
*/
|
|
24
|
+
address?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Domain host for split tunnel (alternative to address)
|
|
27
|
+
*/
|
|
28
|
+
host?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Optional description for this route
|
|
31
|
+
*/
|
|
32
|
+
description?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Split tunnel configuration
|
|
36
|
+
*/
|
|
37
|
+
export interface SplitTunnelConfig {
|
|
38
|
+
/**
|
|
39
|
+
* Split tunnel mode
|
|
40
|
+
* - "include": Only specified routes go through WARP
|
|
41
|
+
* - "exclude": All routes except specified ones go through WARP
|
|
42
|
+
*/
|
|
43
|
+
mode: "include" | "exclude";
|
|
44
|
+
/**
|
|
45
|
+
* List of routes to include or exclude
|
|
46
|
+
*/
|
|
47
|
+
entries: SplitTunnelEntry[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Properties for creating or updating a WARP Device Profile
|
|
51
|
+
*/
|
|
52
|
+
export interface WarpDeviceProfileProps extends CloudflareApiOptions {
|
|
53
|
+
/**
|
|
54
|
+
* Name of the device profile
|
|
55
|
+
*
|
|
56
|
+
* @default ${app}-${stage}-${id}
|
|
57
|
+
*/
|
|
58
|
+
name?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Description of the device profile
|
|
61
|
+
*/
|
|
62
|
+
description?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Wirefilter expression for device matching
|
|
65
|
+
* Determines which devices this profile applies to
|
|
66
|
+
*
|
|
67
|
+
* @example 'identity.groups.name == "Engineering"'
|
|
68
|
+
* @example 'identity.email == "admin@example.com"'
|
|
69
|
+
*/
|
|
70
|
+
match?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Precedence order (lower number = higher priority)
|
|
73
|
+
* Profiles with lower precedence values are evaluated first
|
|
74
|
+
*/
|
|
75
|
+
precedence?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Whether the profile is enabled
|
|
78
|
+
*
|
|
79
|
+
* @default true
|
|
80
|
+
*/
|
|
81
|
+
enabled?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Service mode configuration for WARP client
|
|
84
|
+
*/
|
|
85
|
+
serviceModeV2?: ServiceModeV2;
|
|
86
|
+
/**
|
|
87
|
+
* Disable automatic fallback to direct connection if tunnel fails
|
|
88
|
+
*/
|
|
89
|
+
disableAutoFallback?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Allow users to manually switch WARP modes
|
|
92
|
+
*/
|
|
93
|
+
allowModeSwitch?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Lock the WARP toggle switch (users cannot change it)
|
|
96
|
+
*/
|
|
97
|
+
switchLocked?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Tunnel protocol to use
|
|
100
|
+
*/
|
|
101
|
+
tunnelProtocol?: "wireguard" | "masque";
|
|
102
|
+
/**
|
|
103
|
+
* Auto-connect timeout in seconds
|
|
104
|
+
* Set to 0 to disable auto-connect
|
|
105
|
+
*/
|
|
106
|
+
autoConnect?: number;
|
|
107
|
+
/**
|
|
108
|
+
* Allow users to disconnect from WARP
|
|
109
|
+
*/
|
|
110
|
+
allowedToLeave?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Captive portal timeout in seconds
|
|
113
|
+
* Time before showing captive portal
|
|
114
|
+
*/
|
|
115
|
+
captivePortal?: number;
|
|
116
|
+
/**
|
|
117
|
+
* Support URL for feedback button in WARP client
|
|
118
|
+
*/
|
|
119
|
+
supportUrl?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Exclude office IPs from WARP tunnel
|
|
122
|
+
*/
|
|
123
|
+
excludeOfficeIps?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* LAN allow duration in minutes
|
|
126
|
+
*/
|
|
127
|
+
lanAllowMinutes?: number;
|
|
128
|
+
/**
|
|
129
|
+
* LAN subnet size for local network access
|
|
130
|
+
*/
|
|
131
|
+
lanAllowSubnetSize?: number;
|
|
132
|
+
/**
|
|
133
|
+
* Split tunnel configuration
|
|
134
|
+
* Controls which routes bypass or use the WARP tunnel
|
|
135
|
+
*/
|
|
136
|
+
splitTunnel?: SplitTunnelConfig;
|
|
137
|
+
/**
|
|
138
|
+
* Whether to adopt an existing profile with the same name if it exists
|
|
139
|
+
* If true and a profile with the same name exists, it will be adopted rather than creating a new one
|
|
140
|
+
*
|
|
141
|
+
* @default false
|
|
142
|
+
*/
|
|
143
|
+
adopt?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Whether to delete the profile when removed from Alchemy
|
|
146
|
+
* If set to false, the profile will remain but the resource will be removed from state
|
|
147
|
+
*
|
|
148
|
+
* @default true
|
|
149
|
+
*/
|
|
150
|
+
delete?: boolean;
|
|
151
|
+
}
|
|
152
|
+
export declare function isWarpDeviceProfile(resource: any): resource is WarpDeviceProfile;
|
|
153
|
+
/**
|
|
154
|
+
* Output returned after WARP Device Profile creation/update
|
|
155
|
+
*/
|
|
156
|
+
export type WarpDeviceProfile = Omit<WarpDeviceProfileProps, "delete" | "adopt"> & {
|
|
157
|
+
/**
|
|
158
|
+
* The policy ID assigned by Cloudflare
|
|
159
|
+
*/
|
|
160
|
+
policyId: string;
|
|
161
|
+
/**
|
|
162
|
+
* Name of the profile (required in output)
|
|
163
|
+
*/
|
|
164
|
+
name: string;
|
|
165
|
+
/**
|
|
166
|
+
* Time at which the profile was created
|
|
167
|
+
*/
|
|
168
|
+
createdAt: number;
|
|
169
|
+
/**
|
|
170
|
+
* Time at which the profile was last modified
|
|
171
|
+
*/
|
|
172
|
+
modifiedAt: number;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Creates and manages a Cloudflare WARP Device Profile, which defines WARP client
|
|
176
|
+
* settings for specific sets of devices based on matching rules.
|
|
177
|
+
*
|
|
178
|
+
* Device profiles allow you to apply different WARP configurations to different
|
|
179
|
+
* groups of devices based on user identity, groups, operating system, or other criteria.
|
|
180
|
+
*
|
|
181
|
+
* @see https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/warp/configure-warp/device-profiles/
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ## Basic device profile for a user group
|
|
185
|
+
*
|
|
186
|
+
* Create a profile that applies to all devices belonging to the Engineering group
|
|
187
|
+
*
|
|
188
|
+
* const engProfile = await WarpDeviceProfile("engineering", {
|
|
189
|
+
* name: "Engineering Team",
|
|
190
|
+
* match: 'identity.groups.name == "Engineering"',
|
|
191
|
+
* precedence: 100,
|
|
192
|
+
* serviceModeV2: { mode: "warp" },
|
|
193
|
+
* allowedToLeave: false,
|
|
194
|
+
* switchLocked: true
|
|
195
|
+
* });
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ## Profile with split tunnel configuration
|
|
199
|
+
*
|
|
200
|
+
* Create a profile that excludes internal network routes from the WARP tunnel
|
|
201
|
+
*
|
|
202
|
+
* const internalProfile = await WarpDeviceProfile("internal-network", {
|
|
203
|
+
* name: "Internal Network Access",
|
|
204
|
+
* match: 'identity.email.ends_with("@company.com")',
|
|
205
|
+
* precedence: 50,
|
|
206
|
+
* serviceModeV2: { mode: "warp" },
|
|
207
|
+
* splitTunnel: {
|
|
208
|
+
* mode: "exclude",
|
|
209
|
+
* entries: [
|
|
210
|
+
* { address: "10.0.0.0/8", description: "Internal network" },
|
|
211
|
+
* { address: "192.168.0.0/16", description: "Local network" }
|
|
212
|
+
* ]
|
|
213
|
+
* }
|
|
214
|
+
* });
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ## Profile with include mode split tunnel
|
|
218
|
+
*
|
|
219
|
+
* Only route specific networks through WARP
|
|
220
|
+
*
|
|
221
|
+
* const selectiveProfile = await WarpDeviceProfile("selective", {
|
|
222
|
+
* name: "Selective Routing",
|
|
223
|
+
* match: 'identity.groups.name == "Remote Workers"',
|
|
224
|
+
* precedence: 200,
|
|
225
|
+
* serviceModeV2: { mode: "warp" },
|
|
226
|
+
* splitTunnel: {
|
|
227
|
+
* mode: "include",
|
|
228
|
+
* entries: [
|
|
229
|
+
* { address: "10.0.0.0/8", description: "Company network" },
|
|
230
|
+
* { address: "company.com", description: "Company domain" }
|
|
231
|
+
* ]
|
|
232
|
+
* }
|
|
233
|
+
* });
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ## Adopt an existing profile
|
|
237
|
+
*
|
|
238
|
+
* Take over management of an existing device profile
|
|
239
|
+
*
|
|
240
|
+
* const existingProfile = await WarpDeviceProfile("existing", {
|
|
241
|
+
* name: "Existing Profile",
|
|
242
|
+
* adopt: true,
|
|
243
|
+
* match: 'identity.groups.name == "IT"',
|
|
244
|
+
* precedence: 10
|
|
245
|
+
* });
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ## Profile with all WARP settings
|
|
249
|
+
*
|
|
250
|
+
* Configure comprehensive WARP client behavior
|
|
251
|
+
*
|
|
252
|
+
* const fullProfile = await WarpDeviceProfile("comprehensive", {
|
|
253
|
+
* name: "Full Configuration",
|
|
254
|
+
* match: 'identity.email == "admin@example.com"',
|
|
255
|
+
* precedence: 1,
|
|
256
|
+
* enabled: true,
|
|
257
|
+
* serviceModeV2: { mode: "warp" },
|
|
258
|
+
* disableAutoFallback: false,
|
|
259
|
+
* allowModeSwitch: false,
|
|
260
|
+
* switchLocked: true,
|
|
261
|
+
* tunnelProtocol: "wireguard",
|
|
262
|
+
* autoConnect: 0,
|
|
263
|
+
* allowedToLeave: false,
|
|
264
|
+
* captivePortal: 180,
|
|
265
|
+
* supportUrl: "https://support.example.com",
|
|
266
|
+
* excludeOfficeIps: true,
|
|
267
|
+
* lanAllowMinutes: 5,
|
|
268
|
+
* lanAllowSubnetSize: 24
|
|
269
|
+
* });
|
|
270
|
+
*/
|
|
271
|
+
export declare const WarpDeviceProfile: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<WarpDeviceProfile>, id: string, props?: WarpDeviceProfileProps) => Promise<WarpDeviceProfile>);
|
|
272
|
+
//# sourceMappingURL=warp-device-profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warp-device-profile.d.ts","sourceRoot":"","sources":["../../src/cloudflare/warp-device-profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAK7C,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,kBAAkB,CAAC;IAEzD;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IAE5B;;OAEG;IACH,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,oBAAoB;IAClE;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,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