proxylang 0.1.1 → 0.1.3
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 +42 -3
- package/dist/cli.js +32 -3
- package/dist/{host-Cw60hFyr.js → host-CB08cTs0.js} +468 -385
- package/dist/index.d.ts +296 -19
- package/dist/index.js +584 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
//#region src/types.d.ts
|
|
2
3
|
export type Network = "tcp" | "udp";
|
|
3
4
|
export type NamedRuleSet = {
|
|
@@ -46,20 +47,20 @@ export type Action = {
|
|
|
46
47
|
readonly type: "route";
|
|
47
48
|
readonly to: string;
|
|
48
49
|
};
|
|
49
|
-
export type Slot = {
|
|
50
|
+
export type Slot<S extends string = string> = {
|
|
50
51
|
readonly type: "slot";
|
|
51
|
-
readonly name:
|
|
52
|
+
readonly name: S;
|
|
52
53
|
};
|
|
53
|
-
export type Rule = {
|
|
54
|
+
export type Rule<S extends string = string> = {
|
|
54
55
|
readonly type: "rule";
|
|
55
56
|
readonly id: string;
|
|
56
57
|
readonly when: Match;
|
|
57
|
-
readonly then: Action | Slot
|
|
58
|
+
readonly then: Action | Slot<S>;
|
|
58
59
|
};
|
|
59
|
-
export type Block = {
|
|
60
|
+
export type Block<S extends string = string> = {
|
|
60
61
|
readonly type: "block";
|
|
61
62
|
readonly id: string;
|
|
62
|
-
readonly rules: readonly Entry[];
|
|
63
|
+
readonly rules: readonly Entry<S>[];
|
|
63
64
|
readonly when?: Match;
|
|
64
65
|
};
|
|
65
66
|
export type Policy<S extends string = string> = {
|
|
@@ -68,13 +69,13 @@ export type Policy<S extends string = string> = {
|
|
|
68
69
|
readonly exits: readonly S[];
|
|
69
70
|
readonly rules: readonly Entry[];
|
|
70
71
|
};
|
|
71
|
-
export type Use = {
|
|
72
|
+
export type Use<S extends string = string> = {
|
|
72
73
|
readonly type: "use";
|
|
73
74
|
readonly id: string;
|
|
74
75
|
readonly policy: Policy;
|
|
75
|
-
readonly bindings: Readonly<Record<string, Action | Slot
|
|
76
|
+
readonly bindings: Readonly<Record<string, Action | Slot<S>>>;
|
|
76
77
|
};
|
|
77
|
-
export type Entry = Rule | Block | Use
|
|
78
|
+
export type Entry<S extends string = string> = Rule<S> | Block<S> | Use<S>;
|
|
78
79
|
export type Secret = {
|
|
79
80
|
readonly type: "env";
|
|
80
81
|
readonly name: string;
|
|
@@ -84,6 +85,7 @@ export type ProxyBase = {
|
|
|
84
85
|
readonly server: string;
|
|
85
86
|
readonly port: number;
|
|
86
87
|
readonly via?: string;
|
|
88
|
+
readonly tcpFastOpen?: boolean;
|
|
87
89
|
readonly label?: string;
|
|
88
90
|
readonly region?: string;
|
|
89
91
|
readonly provider?: string;
|
|
@@ -92,6 +94,14 @@ export type ProxyBase = {
|
|
|
92
94
|
export type ProxyTLS = {
|
|
93
95
|
readonly serverName: string;
|
|
94
96
|
readonly alpn?: readonly string[];
|
|
97
|
+
readonly skipCertVerify?: boolean;
|
|
98
|
+
};
|
|
99
|
+
export type SurgeProxyOptions = {
|
|
100
|
+
readonly udpRelay?: boolean;
|
|
101
|
+
readonly blockQuic?: "auto" | "on" | "off";
|
|
102
|
+
};
|
|
103
|
+
type SurgeAutomaticUdpOptions = Omit<SurgeProxyOptions, "udpRelay"> & {
|
|
104
|
+
readonly udpRelay?: true;
|
|
95
105
|
};
|
|
96
106
|
export type WebSocketTransport = {
|
|
97
107
|
readonly type: "ws";
|
|
@@ -102,11 +112,15 @@ export type TrojanNode = ProxyBase & {
|
|
|
102
112
|
readonly type: "trojan";
|
|
103
113
|
readonly password: Secret;
|
|
104
114
|
readonly serverName?: string;
|
|
115
|
+
readonly skipCertVerify?: boolean;
|
|
116
|
+
readonly surge?: SurgeAutomaticUdpOptions;
|
|
105
117
|
};
|
|
106
118
|
export type AnyTLSNode = ProxyBase & {
|
|
107
119
|
readonly type: "anytls";
|
|
108
120
|
readonly password: Secret;
|
|
109
121
|
readonly serverName?: string;
|
|
122
|
+
readonly skipCertVerify?: boolean;
|
|
123
|
+
readonly surge?: SurgeAutomaticUdpOptions;
|
|
110
124
|
};
|
|
111
125
|
export type HttpNode = ProxyBase & {
|
|
112
126
|
readonly type: "http";
|
|
@@ -118,12 +132,14 @@ export type ShadowsocksNode = ProxyBase & {
|
|
|
118
132
|
readonly type: "shadowsocks";
|
|
119
133
|
readonly method: "aes-128-gcm" | "aes-256-gcm" | "chacha20-ietf-poly1305";
|
|
120
134
|
readonly password: Secret;
|
|
135
|
+
readonly surge?: SurgeProxyOptions;
|
|
121
136
|
};
|
|
122
137
|
export type VMessNode = ProxyBase & {
|
|
123
138
|
readonly type: "vmess";
|
|
124
139
|
readonly uuid: Secret;
|
|
125
140
|
readonly tls?: ProxyTLS;
|
|
126
141
|
readonly transport?: WebSocketTransport;
|
|
142
|
+
readonly surge?: Pick<SurgeProxyOptions, "blockQuic">;
|
|
127
143
|
};
|
|
128
144
|
export type VLESSNode = ProxyBase & {
|
|
129
145
|
readonly type: "vless";
|
|
@@ -267,6 +283,18 @@ export type Explanation = {
|
|
|
267
283
|
}[];
|
|
268
284
|
};
|
|
269
285
|
//#endregion
|
|
286
|
+
//#region src/proxy-builder.d.ts
|
|
287
|
+
type ProxyBuilder<N extends ProxyNode> = {
|
|
288
|
+
readonly via: (id: string) => ProxyBuilder<N>;
|
|
289
|
+
readonly label: (text: string) => ProxyBuilder<N>;
|
|
290
|
+
readonly tcpFastOpen: (enabled: boolean) => ProxyBuilder<N>;
|
|
291
|
+
readonly build: () => N;
|
|
292
|
+
};
|
|
293
|
+
/** Fluent construction is separate from the plain-data node consumed by the compiler. */
|
|
294
|
+
declare function proxyBuilder<N extends ProxyNode>(node: N): ProxyBuilder<Extract<ProxyNode, {
|
|
295
|
+
type: N["type"];
|
|
296
|
+
}>>;
|
|
297
|
+
//#endregion
|
|
270
298
|
//#region src/dsl.d.ts
|
|
271
299
|
export declare const ruleSet: (definition: Omit<NamedRuleSet, "type">) => NamedRuleSet;
|
|
272
300
|
export declare const match: {
|
|
@@ -285,17 +313,28 @@ export declare const match: {
|
|
|
285
313
|
export declare const direct: () => Action;
|
|
286
314
|
export declare const reject: () => Action;
|
|
287
315
|
export declare const route: (to: string) => Action;
|
|
288
|
-
|
|
316
|
+
/** An exit parameter declared by policy.exits and resolved by use.bindings. */
|
|
317
|
+
export declare const slot: <const S extends string>(name: S) => Slot<S>;
|
|
289
318
|
export declare const secret: (name: string) => Secret;
|
|
290
|
-
export declare const rule: (id: string, when: Match, then: Action | Slot) => Rule
|
|
291
|
-
export declare const block: (id: string, rules: readonly Entry[], when?: Match) => Block
|
|
292
|
-
|
|
293
|
-
export declare const
|
|
319
|
+
export declare const rule: <const S extends string = never>(id: string, when: Match, then: Action | Slot<S>) => Rule<S>;
|
|
320
|
+
export declare const block: <const S extends string = never>(id: string, rules: readonly Entry<S>[], when?: Match) => Block<S>;
|
|
321
|
+
type CheckedEntries<S extends string, R extends readonly Entry[]> = R & (string extends (R[number] extends Entry<infer Used> ? Used : never) ? unknown : readonly Entry<S>[]);
|
|
322
|
+
export declare const policy: <const S extends string, const R extends readonly Entry[] = readonly Entry<S>[]>(definition: Omit<Policy<S>, "type" | "rules"> & {
|
|
323
|
+
readonly rules: CheckedEntries<NoInfer<S>, R>;
|
|
324
|
+
}) => Policy<S>;
|
|
325
|
+
export declare const use: <S extends string, const B extends Record<NoInfer<S>, Action | Slot>>(definition: Policy<S>, options: {
|
|
294
326
|
id: string;
|
|
295
|
-
bindings: Record<
|
|
296
|
-
}) => Use
|
|
297
|
-
export declare const sequence: (...parts: readonly (Entry | readonly Entry[])[]) => Entry[];
|
|
298
|
-
export declare const defineConfig: <T extends Config>(config: T
|
|
327
|
+
bindings: B & Record<Exclude<keyof B, S>, never>;
|
|
328
|
+
}) => Use<Extract<B[keyof B], Slot>["name"]>;
|
|
329
|
+
export declare const sequence: <const S extends string = never>(...parts: readonly (Entry<S> | readonly Entry<S>[])[]) => Entry<S>[];
|
|
330
|
+
export declare const defineConfig: <const T extends Config>(config: T & {
|
|
331
|
+
readonly targets: readonly (Config["targets"][number] & {
|
|
332
|
+
readonly program: string extends NoInfer<T>["targets"][number]["program"] ? string : keyof NoInfer<T>["programs"] & string;
|
|
333
|
+
})[];
|
|
334
|
+
readonly cases?: readonly (NonNullable<Config["cases"]>[number] & {
|
|
335
|
+
readonly program: string extends NonNullable<NoInfer<T>["cases"]>[number]["program"] ? string : keyof NoInfer<T>["programs"] & string;
|
|
336
|
+
})[];
|
|
337
|
+
}) => T;
|
|
299
338
|
/** Filtering is stable: catalogue order determines initial selector order. */
|
|
300
339
|
export declare function selectNodes(nodes: readonly ProxyNode[], query?: {
|
|
301
340
|
regions?: readonly string[];
|
|
@@ -324,6 +363,7 @@ export declare const mihomo: {
|
|
|
324
363
|
}>, "type" | "engine">) => NativeRuleSet;
|
|
325
364
|
};
|
|
326
365
|
export declare const proxy: {
|
|
366
|
+
builder: typeof proxyBuilder;
|
|
327
367
|
http: (options: Omit<HttpNode, "type">) => HttpNode;
|
|
328
368
|
trojan: (options: Omit<TrojanNode, "type">) => TrojanNode;
|
|
329
369
|
anytls: (options: Omit<AnyTLSNode, "type">) => AnyTLSNode;
|
|
@@ -479,4 +519,241 @@ export declare class StaticRuleSetUnknownError extends Error {
|
|
|
479
519
|
constructor();
|
|
480
520
|
}
|
|
481
521
|
//#endregion
|
|
482
|
-
|
|
522
|
+
//#region src/proxy-fragments.d.ts
|
|
523
|
+
type ProxyNodeInput = {
|
|
524
|
+
readonly target: {
|
|
525
|
+
readonly engine: "surge";
|
|
526
|
+
readonly platform: "macos";
|
|
527
|
+
readonly version: "6.10.0";
|
|
528
|
+
};
|
|
529
|
+
readonly nodes: readonly ProxyNode[];
|
|
530
|
+
readonly names?: Readonly<Record<string, string>>;
|
|
531
|
+
readonly externals?: readonly {
|
|
532
|
+
readonly id: string;
|
|
533
|
+
readonly nativeName: string;
|
|
534
|
+
readonly kind: "proxy" | "group";
|
|
535
|
+
}[];
|
|
536
|
+
};
|
|
537
|
+
type ProxyNodeCompilation = {
|
|
538
|
+
readonly ok: boolean;
|
|
539
|
+
readonly artifactKind: "proxy-nodes";
|
|
540
|
+
readonly diagnostics: readonly Diagnostic[];
|
|
541
|
+
readonly bindings: readonly {
|
|
542
|
+
readonly id: string;
|
|
543
|
+
readonly nativeName: string;
|
|
544
|
+
}[];
|
|
545
|
+
readonly requirements: readonly {
|
|
546
|
+
readonly id: string;
|
|
547
|
+
readonly nativeName: string;
|
|
548
|
+
readonly kind: "proxy" | "group";
|
|
549
|
+
readonly usedBy: readonly string[];
|
|
550
|
+
}[];
|
|
551
|
+
};
|
|
552
|
+
type ProxyNodeArtifact = {
|
|
553
|
+
readonly artifactKind: "proxy-nodes";
|
|
554
|
+
readonly content: string;
|
|
555
|
+
readonly entries: readonly {
|
|
556
|
+
readonly id: string;
|
|
557
|
+
readonly content: string;
|
|
558
|
+
}[];
|
|
559
|
+
};
|
|
560
|
+
export declare function compileProxyNodes(input: unknown): ProxyNodeCompilation;
|
|
561
|
+
export declare function renderProxyNodes(compilation: ProxyNodeCompilation, resolveSecret: (token: Secret) => string | undefined): ProxyNodeArtifact;
|
|
562
|
+
//#endregion
|
|
563
|
+
//#region src/surge-profile.d.ts
|
|
564
|
+
declare const policy$1: z.ZodUnion<readonly [z.ZodObject<{
|
|
565
|
+
ref: z.ZodString;
|
|
566
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
567
|
+
builtin: z.ZodEnum<{
|
|
568
|
+
DIRECT: "DIRECT";
|
|
569
|
+
REJECT: "REJECT";
|
|
570
|
+
"REJECT-DROP": "REJECT-DROP";
|
|
571
|
+
"REJECT-NO-DROP": "REJECT-NO-DROP";
|
|
572
|
+
"REJECT-TINYGIF": "REJECT-TINYGIF";
|
|
573
|
+
}>;
|
|
574
|
+
}, z.core.$strict>]>;
|
|
575
|
+
type SurgePolicy = z.infer<typeof policy$1>;
|
|
576
|
+
declare const generalSchema: z.ZodObject<{
|
|
577
|
+
loglevel: z.ZodOptional<z.ZodEnum<{
|
|
578
|
+
info: "info";
|
|
579
|
+
notify: "notify";
|
|
580
|
+
verbose: "verbose";
|
|
581
|
+
warning: "warning";
|
|
582
|
+
}>>;
|
|
583
|
+
"dns-server": z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
584
|
+
"encrypted-dns-server": z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
585
|
+
"show-error-page-for-reject": z.ZodOptional<z.ZodBoolean>;
|
|
586
|
+
"exclude-simple-hostnames": z.ZodOptional<z.ZodBoolean>;
|
|
587
|
+
"internet-test-url": z.ZodOptional<z.ZodString>;
|
|
588
|
+
"skip-proxy": z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodString]>>>;
|
|
589
|
+
ipv6: z.ZodOptional<z.ZodBoolean>;
|
|
590
|
+
"ipv6-vif": z.ZodOptional<z.ZodEnum<{
|
|
591
|
+
always: "always";
|
|
592
|
+
auto: "auto";
|
|
593
|
+
disabled: "disabled";
|
|
594
|
+
}>>;
|
|
595
|
+
"bypass-system": z.ZodOptional<z.ZodBoolean>;
|
|
596
|
+
replica: z.ZodOptional<z.ZodBoolean>;
|
|
597
|
+
"tls-provider": z.ZodOptional<z.ZodEnum<{
|
|
598
|
+
default: "default";
|
|
599
|
+
openssl: "openssl";
|
|
600
|
+
}>>;
|
|
601
|
+
"bypass-tun": z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
602
|
+
"always-real-ip": z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
603
|
+
"http-api": z.ZodOptional<z.ZodObject<{
|
|
604
|
+
password: z.ZodObject<{
|
|
605
|
+
type: z.ZodLiteral<"env">;
|
|
606
|
+
name: z.ZodString;
|
|
607
|
+
}, z.core.$strict>;
|
|
608
|
+
listen: z.ZodString;
|
|
609
|
+
}, z.core.$strict>>;
|
|
610
|
+
"http-api-web-dashboard": z.ZodOptional<z.ZodBoolean>;
|
|
611
|
+
"external-controller-access": z.ZodOptional<z.ZodObject<{
|
|
612
|
+
password: z.ZodObject<{
|
|
613
|
+
type: z.ZodLiteral<"env">;
|
|
614
|
+
name: z.ZodString;
|
|
615
|
+
}, z.core.$strict>;
|
|
616
|
+
listen: z.ZodString;
|
|
617
|
+
}, z.core.$strict>>;
|
|
618
|
+
"hijack-dns": z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
619
|
+
"http-listen": z.ZodOptional<z.ZodString>;
|
|
620
|
+
"socks5-listen": z.ZodOptional<z.ZodString>;
|
|
621
|
+
"proxy-restricted-to-lan": z.ZodOptional<z.ZodBoolean>;
|
|
622
|
+
}, z.core.$strict>;
|
|
623
|
+
type SurgeGeneral = z.infer<typeof generalSchema>;
|
|
624
|
+
declare const hostSchema: z.ZodObject<{
|
|
625
|
+
pattern: z.ZodString;
|
|
626
|
+
address: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
|
|
627
|
+
server: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
|
|
628
|
+
}, z.core.$strict>;
|
|
629
|
+
type SurgeHost = z.infer<typeof hostSchema>;
|
|
630
|
+
declare const tunnelSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
631
|
+
type: z.ZodLiteral<"tailscale">;
|
|
632
|
+
id: z.ZodString;
|
|
633
|
+
sectionName: z.ZodString;
|
|
634
|
+
authKey: z.ZodObject<{
|
|
635
|
+
type: z.ZodLiteral<"env">;
|
|
636
|
+
name: z.ZodString;
|
|
637
|
+
}, z.core.$strict>;
|
|
638
|
+
hostname: z.ZodString;
|
|
639
|
+
dnsServer: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
640
|
+
autoAddMagicDnsRule: z.ZodOptional<z.ZodBoolean>;
|
|
641
|
+
idleKeepalive: z.ZodOptional<z.ZodNumber>;
|
|
642
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
643
|
+
type: z.ZodLiteral<"wireguard">;
|
|
644
|
+
id: z.ZodString;
|
|
645
|
+
sectionName: z.ZodString;
|
|
646
|
+
privateKey: z.ZodObject<{
|
|
647
|
+
type: z.ZodLiteral<"env">;
|
|
648
|
+
name: z.ZodString;
|
|
649
|
+
}, z.core.$strict>;
|
|
650
|
+
selfIp: z.ZodString;
|
|
651
|
+
dnsServer: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
652
|
+
mtu: z.ZodOptional<z.ZodNumber>;
|
|
653
|
+
peers: z.ZodArray<z.ZodObject<{
|
|
654
|
+
publicKey: z.ZodString;
|
|
655
|
+
endpoint: z.ZodString;
|
|
656
|
+
allowedIps: z.ZodArray<z.ZodString>;
|
|
657
|
+
presharedKey: z.ZodOptional<z.ZodObject<{
|
|
658
|
+
type: z.ZodLiteral<"env">;
|
|
659
|
+
name: z.ZodString;
|
|
660
|
+
}, z.core.$strict>>;
|
|
661
|
+
persistentKeepalive: z.ZodOptional<z.ZodNumber>;
|
|
662
|
+
}, z.core.$strict>>;
|
|
663
|
+
}, z.core.$strict>], "type">;
|
|
664
|
+
type SurgeTunnel = z.infer<typeof tunnelSchema>;
|
|
665
|
+
declare const groupSchema: z.ZodObject<{
|
|
666
|
+
id: z.ZodString;
|
|
667
|
+
type: z.ZodEnum<{
|
|
668
|
+
select: "select";
|
|
669
|
+
smart: "smart";
|
|
670
|
+
}>;
|
|
671
|
+
members: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
672
|
+
ref: z.ZodString;
|
|
673
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
674
|
+
builtin: z.ZodEnum<{
|
|
675
|
+
DIRECT: "DIRECT";
|
|
676
|
+
REJECT: "REJECT";
|
|
677
|
+
"REJECT-DROP": "REJECT-DROP";
|
|
678
|
+
"REJECT-NO-DROP": "REJECT-NO-DROP";
|
|
679
|
+
"REJECT-TINYGIF": "REJECT-TINYGIF";
|
|
680
|
+
}>;
|
|
681
|
+
}, z.core.$strict>]>>;
|
|
682
|
+
url: z.ZodOptional<z.ZodString>;
|
|
683
|
+
intervalSeconds: z.ZodOptional<z.ZodNumber>;
|
|
684
|
+
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
685
|
+
}, z.core.$strict>;
|
|
686
|
+
type SurgeGroup = z.infer<typeof groupSchema>;
|
|
687
|
+
type ConditionOptions = {
|
|
688
|
+
readonly noResolve?: boolean;
|
|
689
|
+
readonly extendedMatching?: boolean;
|
|
690
|
+
};
|
|
691
|
+
type SurgeCondition = ConditionOptions & ({
|
|
692
|
+
readonly type: "domain" | "domainSuffix" | "ipCidr" | "ipCidr6" | "sourceIp" | "processName" | "macAddress";
|
|
693
|
+
readonly value: string;
|
|
694
|
+
} | {
|
|
695
|
+
readonly type: "port" | "sourcePort";
|
|
696
|
+
readonly from: number;
|
|
697
|
+
readonly to?: number;
|
|
698
|
+
} | {
|
|
699
|
+
readonly type: "network";
|
|
700
|
+
readonly value: "tcp" | "udp";
|
|
701
|
+
} | {
|
|
702
|
+
readonly type: "all" | "any";
|
|
703
|
+
readonly conditions: readonly SurgeCondition[];
|
|
704
|
+
} | {
|
|
705
|
+
readonly type: "not";
|
|
706
|
+
readonly condition: SurgeCondition;
|
|
707
|
+
} | {
|
|
708
|
+
readonly type: "ruleSet";
|
|
709
|
+
readonly format: "rule-set" | "domain-set";
|
|
710
|
+
readonly url?: string;
|
|
711
|
+
readonly builtin?: "LAN" | "SYSTEM";
|
|
712
|
+
});
|
|
713
|
+
type SurgeRule = {
|
|
714
|
+
readonly when: SurgeCondition;
|
|
715
|
+
readonly then: SurgePolicy;
|
|
716
|
+
};
|
|
717
|
+
declare const managedSchema: z.ZodObject<{
|
|
718
|
+
url: z.ZodString;
|
|
719
|
+
query: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
720
|
+
type: z.ZodLiteral<"env">;
|
|
721
|
+
name: z.ZodString;
|
|
722
|
+
}, z.core.$strict>]>>>;
|
|
723
|
+
intervalSeconds: z.ZodNumber;
|
|
724
|
+
strict: z.ZodBoolean;
|
|
725
|
+
}, z.core.$strict>;
|
|
726
|
+
type SurgeProfileInput = {
|
|
727
|
+
readonly target: {
|
|
728
|
+
readonly engine: "surge";
|
|
729
|
+
readonly platform: "macos" | "ios";
|
|
730
|
+
readonly version: string;
|
|
731
|
+
};
|
|
732
|
+
readonly managed?: z.infer<typeof managedSchema>;
|
|
733
|
+
readonly general?: SurgeGeneral;
|
|
734
|
+
readonly hosts?: readonly SurgeHost[];
|
|
735
|
+
readonly nodes: readonly ProxyNode[];
|
|
736
|
+
readonly tunnels?: readonly SurgeTunnel[];
|
|
737
|
+
readonly groups: readonly SurgeGroup[];
|
|
738
|
+
readonly rules: readonly SurgeRule[];
|
|
739
|
+
readonly fallback: SurgePolicy;
|
|
740
|
+
readonly names?: Readonly<Record<string, string>>;
|
|
741
|
+
};
|
|
742
|
+
type SurgeProfileCompilation = {
|
|
743
|
+
readonly ok: boolean;
|
|
744
|
+
readonly artifactKind: "surge-profile";
|
|
745
|
+
readonly diagnostics: readonly Diagnostic[];
|
|
746
|
+
readonly bindings: readonly {
|
|
747
|
+
readonly id: string;
|
|
748
|
+
readonly nativeName: string;
|
|
749
|
+
}[];
|
|
750
|
+
};
|
|
751
|
+
type SurgeProfileArtifact = {
|
|
752
|
+
readonly artifactKind: "surge-profile";
|
|
753
|
+
readonly content: string;
|
|
754
|
+
};
|
|
755
|
+
export declare function compileSurgeProfile(input: unknown): SurgeProfileCompilation;
|
|
756
|
+
export declare function renderSurgeProfile(compilation: SurgeProfileCompilation, resolveSecret: (token: Secret) => string | undefined): SurgeProfileArtifact;
|
|
757
|
+
export declare function renderSurgeProfiles(compilations: readonly SurgeProfileCompilation[], resolveSecret: (token: Secret) => string | undefined): readonly SurgeProfileArtifact[];
|
|
758
|
+
//#endregion
|
|
759
|
+
export type { Artifact, BuildResult, CaseResult, Compilation, ProxyBuilder, ProxyNodeArtifact, ProxyNodeCompilation, ProxyNodeInput, StrategyGroupCompilation, StrategyGroupInput, SurgeCondition, SurgeGeneral, SurgeGroup, SurgeHost, SurgePolicy, SurgeProfileArtifact, SurgeProfileCompilation, SurgeProfileInput, SurgeRule, SurgeTunnel, TargetPlan };
|