proxylang 0.1.2 → 0.1.4
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 +35 -2
- package/dist/cli.js +79 -15
- package/dist/{host-BvBQxdmA.js → host-BPBSZ-jw.js} +137 -27
- package/dist/index.d.ts +281 -32
- package/dist/index.js +622 -7
- 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;
|
|
@@ -168,22 +169,37 @@ export type GroupAlgorithm = {
|
|
|
168
169
|
readonly intervalSeconds?: number;
|
|
169
170
|
readonly toleranceMs?: number;
|
|
170
171
|
};
|
|
171
|
-
export type
|
|
172
|
-
readonly type: "
|
|
172
|
+
export type PortableAlgorithm = {
|
|
173
|
+
readonly type: "auto";
|
|
174
|
+
} | Extract<GroupAlgorithm, {
|
|
175
|
+
readonly type: "select" | "urltest";
|
|
176
|
+
}>;
|
|
177
|
+
export type StrategyImplementations = {
|
|
178
|
+
readonly surge?: GroupAlgorithm;
|
|
179
|
+
readonly "sing-box"?: GroupAlgorithm;
|
|
180
|
+
readonly mihomo?: GroupAlgorithm;
|
|
181
|
+
readonly stash?: GroupAlgorithm;
|
|
182
|
+
};
|
|
183
|
+
export type StrategyDefinition = {
|
|
173
184
|
readonly id: string;
|
|
174
185
|
readonly members: readonly string[];
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
186
|
+
} & ({
|
|
187
|
+
readonly algorithm: PortableAlgorithm;
|
|
188
|
+
readonly implementations?: StrategyImplementations;
|
|
189
|
+
} | {
|
|
190
|
+
readonly algorithm?: never;
|
|
191
|
+
readonly implementations: StrategyImplementations;
|
|
192
|
+
});
|
|
193
|
+
export type Strategy = StrategyDefinition & {
|
|
194
|
+
readonly type: "strategy";
|
|
181
195
|
};
|
|
182
196
|
export type StrategySelection = {
|
|
183
197
|
readonly id: string;
|
|
184
198
|
readonly engine: Engine;
|
|
185
199
|
readonly algorithm: GroupAlgorithm;
|
|
186
200
|
readonly members: readonly string[];
|
|
201
|
+
readonly requestedAlgorithm?: PortableAlgorithm;
|
|
202
|
+
readonly implementationSource?: "default" | "override";
|
|
187
203
|
};
|
|
188
204
|
export type ConcreteGroup = {
|
|
189
205
|
readonly id: string;
|
|
@@ -312,33 +328,53 @@ export declare const match: {
|
|
|
312
328
|
export declare const direct: () => Action;
|
|
313
329
|
export declare const reject: () => Action;
|
|
314
330
|
export declare const route: (to: string) => Action;
|
|
315
|
-
|
|
331
|
+
/** An exit parameter declared by policy.exits and resolved by use.bindings. */
|
|
332
|
+
export declare const slot: <const S extends string>(name: S) => Slot<S>;
|
|
316
333
|
export declare const secret: (name: string) => Secret;
|
|
317
|
-
export declare const rule: (id: string, when: Match, then: Action | Slot) => Rule
|
|
318
|
-
export declare const block: (id: string, rules: readonly Entry[], when?: Match) => Block
|
|
319
|
-
|
|
320
|
-
export declare const
|
|
334
|
+
export declare const rule: <const S extends string = never>(id: string, when: Match, then: Action | Slot<S>) => Rule<S>;
|
|
335
|
+
export declare const block: <const S extends string = never>(id: string, rules: readonly Entry<S>[], when?: Match) => Block<S>;
|
|
336
|
+
type CheckedEntries<S extends string, R extends readonly Entry[]> = R & (string extends (R[number] extends Entry<infer Used> ? Used : never) ? unknown : readonly Entry<S>[]);
|
|
337
|
+
export declare const policy: <const S extends string, const R extends readonly Entry[] = readonly Entry<S>[]>(definition: Omit<Policy<S>, "type" | "rules"> & {
|
|
338
|
+
readonly rules: CheckedEntries<NoInfer<S>, R>;
|
|
339
|
+
}) => Policy<S>;
|
|
340
|
+
export declare const use: <S extends string, const B extends Record<NoInfer<S>, Action | Slot>>(definition: Policy<S>, options: {
|
|
321
341
|
id: string;
|
|
322
|
-
bindings: Record<
|
|
323
|
-
}) => Use
|
|
324
|
-
export declare const sequence: (...parts: readonly (Entry | readonly Entry[])[]) => Entry[];
|
|
325
|
-
export declare const defineConfig: <T extends Config>(config: T
|
|
342
|
+
bindings: B & Record<Exclude<keyof B, S>, never>;
|
|
343
|
+
}) => Use<Extract<B[keyof B], Slot>["name"]>;
|
|
344
|
+
export declare const sequence: <const S extends string = never>(...parts: readonly (Entry<S> | readonly Entry<S>[])[]) => Entry<S>[];
|
|
345
|
+
export declare const defineConfig: <const T extends Config>(config: T & {
|
|
346
|
+
readonly targets: readonly (Config["targets"][number] & {
|
|
347
|
+
readonly program: string extends NoInfer<T>["targets"][number]["program"] ? string : keyof NoInfer<T>["programs"] & string;
|
|
348
|
+
})[];
|
|
349
|
+
readonly cases?: readonly (NonNullable<Config["cases"]>[number] & {
|
|
350
|
+
readonly program: string extends NonNullable<NoInfer<T>["cases"]>[number]["program"] ? string : keyof NoInfer<T>["programs"] & string;
|
|
351
|
+
})[];
|
|
352
|
+
}) => T;
|
|
326
353
|
/** Filtering is stable: catalogue order determines initial selector order. */
|
|
327
354
|
export declare function selectNodes(nodes: readonly ProxyNode[], query?: {
|
|
328
355
|
regions?: readonly string[];
|
|
329
356
|
providers?: readonly string[];
|
|
330
357
|
tags?: readonly string[];
|
|
331
358
|
}): string[];
|
|
332
|
-
/** A shared strategy
|
|
333
|
-
export declare const strategy: (definition:
|
|
359
|
+
/** A shared strategy declares an algorithm or explicitly selects native implementations. */
|
|
360
|
+
export declare const strategy: (definition: StrategyDefinition) => Strategy;
|
|
334
361
|
export declare const group: {
|
|
335
|
-
|
|
362
|
+
auto: () => {
|
|
363
|
+
readonly type: "auto";
|
|
364
|
+
};
|
|
365
|
+
select: () => Extract<GroupAlgorithm, {
|
|
366
|
+
type: "select";
|
|
367
|
+
}>;
|
|
336
368
|
urltest: (options: Omit<Extract<GroupAlgorithm, {
|
|
337
369
|
type: "urltest";
|
|
338
|
-
}>, "type">) => GroupAlgorithm
|
|
370
|
+
}>, "type">) => Extract<GroupAlgorithm, {
|
|
371
|
+
type: "urltest";
|
|
372
|
+
}>;
|
|
339
373
|
};
|
|
340
374
|
export declare const surge: {
|
|
341
|
-
smart: () => GroupAlgorithm
|
|
375
|
+
smart: () => Extract<GroupAlgorithm, {
|
|
376
|
+
type: "surge-smart";
|
|
377
|
+
}>;
|
|
342
378
|
ruleSet: (options: Omit<Extract<NativeRuleSet, {
|
|
343
379
|
engine: "surge";
|
|
344
380
|
}>, "type" | "engine" | "format"> & {
|
|
@@ -370,6 +406,7 @@ export declare const singbox: {
|
|
|
370
406
|
export declare const targetCatalog: readonly [{
|
|
371
407
|
readonly engine: "sing-box";
|
|
372
408
|
readonly version: "1.11.0";
|
|
409
|
+
readonly autoGroup: "urltest";
|
|
373
410
|
readonly platforms: readonly ["linux", "macos"];
|
|
374
411
|
readonly protocols: readonly ["trojan", "http", "shadowsocks", "vmess", "vless"];
|
|
375
412
|
readonly endpoints: readonly [];
|
|
@@ -379,6 +416,7 @@ export declare const targetCatalog: readonly [{
|
|
|
379
416
|
}, {
|
|
380
417
|
readonly engine: "sing-box";
|
|
381
418
|
readonly version: "1.12.0";
|
|
419
|
+
readonly autoGroup: "urltest";
|
|
382
420
|
readonly platforms: readonly ["linux", "macos"];
|
|
383
421
|
readonly protocols: readonly ["trojan", "http", "anytls", "shadowsocks", "vmess", "vless"];
|
|
384
422
|
readonly endpoints: readonly ["sing-box-tailscale"];
|
|
@@ -388,6 +426,7 @@ export declare const targetCatalog: readonly [{
|
|
|
388
426
|
}, {
|
|
389
427
|
readonly engine: "surge";
|
|
390
428
|
readonly version: "6.10.0";
|
|
429
|
+
readonly autoGroup: "surge-smart";
|
|
391
430
|
readonly platforms: readonly ["macos"];
|
|
392
431
|
readonly protocols: readonly ["trojan", "http", "anytls", "shadowsocks", "vmess"];
|
|
393
432
|
readonly endpoints: readonly [];
|
|
@@ -397,6 +436,7 @@ export declare const targetCatalog: readonly [{
|
|
|
397
436
|
}, {
|
|
398
437
|
readonly engine: "mihomo";
|
|
399
438
|
readonly version: "1.19.32";
|
|
439
|
+
readonly autoGroup: "urltest";
|
|
400
440
|
readonly platforms: readonly ["linux", "macos"];
|
|
401
441
|
readonly protocols: readonly ["trojan", "http", "anytls", "shadowsocks", "vmess", "vless"];
|
|
402
442
|
readonly endpoints: readonly [];
|
|
@@ -406,6 +446,7 @@ export declare const targetCatalog: readonly [{
|
|
|
406
446
|
}, {
|
|
407
447
|
readonly engine: "stash";
|
|
408
448
|
readonly version: "4.2.1";
|
|
449
|
+
readonly autoGroup: null;
|
|
409
450
|
readonly platforms: readonly ["macos"];
|
|
410
451
|
readonly protocols: readonly ["trojan", "http", "anytls", "shadowsocks", "vmess"];
|
|
411
452
|
readonly endpoints: readonly [];
|
|
@@ -474,6 +515,8 @@ type BuildResult = {
|
|
|
474
515
|
readonly code: string;
|
|
475
516
|
readonly active?: string;
|
|
476
517
|
readonly generation?: string;
|
|
518
|
+
readonly reason?: "ACCESS_DENIED" | "NO_SPACE" | "READ_ONLY" | "INVALID_DIRECTORY" | "IO_ERROR";
|
|
519
|
+
readonly hint?: string;
|
|
477
520
|
};
|
|
478
521
|
/** All targets publish together by one active.json rename. Config files never go to stdout. */
|
|
479
522
|
export declare function buildToDirectory(compilation: Compilation, output: string, resolveSecret?: (token: Secret) => string | undefined): Promise<BuildResult>;
|
|
@@ -548,4 +591,210 @@ type ProxyNodeArtifact = {
|
|
|
548
591
|
export declare function compileProxyNodes(input: unknown): ProxyNodeCompilation;
|
|
549
592
|
export declare function renderProxyNodes(compilation: ProxyNodeCompilation, resolveSecret: (token: Secret) => string | undefined): ProxyNodeArtifact;
|
|
550
593
|
//#endregion
|
|
551
|
-
|
|
594
|
+
//#region src/surge-profile.d.ts
|
|
595
|
+
declare const policy$1: z.ZodUnion<readonly [z.ZodObject<{
|
|
596
|
+
ref: z.ZodString;
|
|
597
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
598
|
+
builtin: z.ZodEnum<{
|
|
599
|
+
DIRECT: "DIRECT";
|
|
600
|
+
REJECT: "REJECT";
|
|
601
|
+
"REJECT-DROP": "REJECT-DROP";
|
|
602
|
+
"REJECT-NO-DROP": "REJECT-NO-DROP";
|
|
603
|
+
"REJECT-TINYGIF": "REJECT-TINYGIF";
|
|
604
|
+
}>;
|
|
605
|
+
}, z.core.$strict>]>;
|
|
606
|
+
type SurgePolicy = z.infer<typeof policy$1>;
|
|
607
|
+
declare const generalSchema: z.ZodObject<{
|
|
608
|
+
loglevel: z.ZodOptional<z.ZodEnum<{
|
|
609
|
+
info: "info";
|
|
610
|
+
notify: "notify";
|
|
611
|
+
verbose: "verbose";
|
|
612
|
+
warning: "warning";
|
|
613
|
+
}>>;
|
|
614
|
+
"dns-server": z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
615
|
+
"encrypted-dns-server": z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
616
|
+
"show-error-page-for-reject": z.ZodOptional<z.ZodBoolean>;
|
|
617
|
+
"exclude-simple-hostnames": z.ZodOptional<z.ZodBoolean>;
|
|
618
|
+
"internet-test-url": z.ZodOptional<z.ZodString>;
|
|
619
|
+
"skip-proxy": z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodString]>>>;
|
|
620
|
+
ipv6: z.ZodOptional<z.ZodBoolean>;
|
|
621
|
+
"ipv6-vif": z.ZodOptional<z.ZodEnum<{
|
|
622
|
+
always: "always";
|
|
623
|
+
auto: "auto";
|
|
624
|
+
disabled: "disabled";
|
|
625
|
+
}>>;
|
|
626
|
+
"bypass-system": z.ZodOptional<z.ZodBoolean>;
|
|
627
|
+
replica: z.ZodOptional<z.ZodBoolean>;
|
|
628
|
+
"tls-provider": z.ZodOptional<z.ZodEnum<{
|
|
629
|
+
default: "default";
|
|
630
|
+
openssl: "openssl";
|
|
631
|
+
}>>;
|
|
632
|
+
"bypass-tun": z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
633
|
+
"always-real-ip": z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
634
|
+
"http-api": z.ZodOptional<z.ZodObject<{
|
|
635
|
+
password: z.ZodObject<{
|
|
636
|
+
type: z.ZodLiteral<"env">;
|
|
637
|
+
name: z.ZodString;
|
|
638
|
+
}, z.core.$strict>;
|
|
639
|
+
listen: z.ZodString;
|
|
640
|
+
}, z.core.$strict>>;
|
|
641
|
+
"http-api-web-dashboard": z.ZodOptional<z.ZodBoolean>;
|
|
642
|
+
"external-controller-access": z.ZodOptional<z.ZodObject<{
|
|
643
|
+
password: z.ZodObject<{
|
|
644
|
+
type: z.ZodLiteral<"env">;
|
|
645
|
+
name: z.ZodString;
|
|
646
|
+
}, z.core.$strict>;
|
|
647
|
+
listen: z.ZodString;
|
|
648
|
+
}, z.core.$strict>>;
|
|
649
|
+
"hijack-dns": z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
650
|
+
"http-listen": z.ZodOptional<z.ZodString>;
|
|
651
|
+
"socks5-listen": z.ZodOptional<z.ZodString>;
|
|
652
|
+
"proxy-restricted-to-lan": z.ZodOptional<z.ZodBoolean>;
|
|
653
|
+
}, z.core.$strict>;
|
|
654
|
+
type SurgeGeneral = z.infer<typeof generalSchema>;
|
|
655
|
+
declare const hostSchema: z.ZodObject<{
|
|
656
|
+
pattern: z.ZodString;
|
|
657
|
+
address: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
|
|
658
|
+
server: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
|
|
659
|
+
}, z.core.$strict>;
|
|
660
|
+
type SurgeHost = z.infer<typeof hostSchema>;
|
|
661
|
+
declare const tunnelSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
662
|
+
type: z.ZodLiteral<"tailscale">;
|
|
663
|
+
id: z.ZodString;
|
|
664
|
+
sectionName: z.ZodString;
|
|
665
|
+
authKey: z.ZodObject<{
|
|
666
|
+
type: z.ZodLiteral<"env">;
|
|
667
|
+
name: z.ZodString;
|
|
668
|
+
}, z.core.$strict>;
|
|
669
|
+
hostname: z.ZodString;
|
|
670
|
+
dnsServer: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
671
|
+
autoAddMagicDnsRule: z.ZodOptional<z.ZodBoolean>;
|
|
672
|
+
idleKeepalive: z.ZodOptional<z.ZodNumber>;
|
|
673
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
674
|
+
type: z.ZodLiteral<"wireguard">;
|
|
675
|
+
id: z.ZodString;
|
|
676
|
+
sectionName: z.ZodString;
|
|
677
|
+
privateKey: z.ZodObject<{
|
|
678
|
+
type: z.ZodLiteral<"env">;
|
|
679
|
+
name: z.ZodString;
|
|
680
|
+
}, z.core.$strict>;
|
|
681
|
+
selfIp: z.ZodString;
|
|
682
|
+
dnsServer: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
683
|
+
mtu: z.ZodOptional<z.ZodNumber>;
|
|
684
|
+
peers: z.ZodArray<z.ZodObject<{
|
|
685
|
+
publicKey: z.ZodString;
|
|
686
|
+
endpoint: z.ZodString;
|
|
687
|
+
allowedIps: z.ZodArray<z.ZodString>;
|
|
688
|
+
presharedKey: z.ZodOptional<z.ZodObject<{
|
|
689
|
+
type: z.ZodLiteral<"env">;
|
|
690
|
+
name: z.ZodString;
|
|
691
|
+
}, z.core.$strict>>;
|
|
692
|
+
persistentKeepalive: z.ZodOptional<z.ZodNumber>;
|
|
693
|
+
}, z.core.$strict>>;
|
|
694
|
+
}, z.core.$strict>], "type">;
|
|
695
|
+
type SurgeTunnel = z.infer<typeof tunnelSchema>;
|
|
696
|
+
declare const groupSchema: z.ZodObject<{
|
|
697
|
+
id: z.ZodString;
|
|
698
|
+
type: z.ZodEnum<{
|
|
699
|
+
select: "select";
|
|
700
|
+
smart: "smart";
|
|
701
|
+
}>;
|
|
702
|
+
members: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
703
|
+
ref: z.ZodString;
|
|
704
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
705
|
+
builtin: z.ZodEnum<{
|
|
706
|
+
DIRECT: "DIRECT";
|
|
707
|
+
REJECT: "REJECT";
|
|
708
|
+
"REJECT-DROP": "REJECT-DROP";
|
|
709
|
+
"REJECT-NO-DROP": "REJECT-NO-DROP";
|
|
710
|
+
"REJECT-TINYGIF": "REJECT-TINYGIF";
|
|
711
|
+
}>;
|
|
712
|
+
}, z.core.$strict>]>>;
|
|
713
|
+
url: z.ZodOptional<z.ZodString>;
|
|
714
|
+
intervalSeconds: z.ZodOptional<z.ZodNumber>;
|
|
715
|
+
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
716
|
+
}, z.core.$strict>;
|
|
717
|
+
type SurgeGroup = z.infer<typeof groupSchema>;
|
|
718
|
+
type ConditionOptions = {
|
|
719
|
+
readonly noResolve?: boolean;
|
|
720
|
+
readonly extendedMatching?: boolean;
|
|
721
|
+
};
|
|
722
|
+
type SurgeCondition = ConditionOptions & ({
|
|
723
|
+
readonly type: "domain" | "domainSuffix" | "ipCidr" | "ipCidr6" | "sourceIp" | "processName" | "macAddress";
|
|
724
|
+
readonly value: string;
|
|
725
|
+
} | {
|
|
726
|
+
readonly type: "port" | "sourcePort";
|
|
727
|
+
readonly from: number;
|
|
728
|
+
readonly to?: number;
|
|
729
|
+
} | {
|
|
730
|
+
readonly type: "network";
|
|
731
|
+
readonly value: "tcp" | "udp";
|
|
732
|
+
} | {
|
|
733
|
+
readonly type: "all" | "any";
|
|
734
|
+
readonly conditions: readonly SurgeCondition[];
|
|
735
|
+
} | {
|
|
736
|
+
readonly type: "not";
|
|
737
|
+
readonly condition: SurgeCondition;
|
|
738
|
+
} | {
|
|
739
|
+
readonly type: "ruleSet";
|
|
740
|
+
readonly format: "rule-set" | "domain-set";
|
|
741
|
+
readonly url?: string;
|
|
742
|
+
readonly builtin?: "LAN" | "SYSTEM";
|
|
743
|
+
});
|
|
744
|
+
type SurgeRule = {
|
|
745
|
+
readonly when: SurgeCondition;
|
|
746
|
+
readonly then: SurgePolicy;
|
|
747
|
+
};
|
|
748
|
+
declare const managedSchema: z.ZodObject<{
|
|
749
|
+
url: z.ZodString;
|
|
750
|
+
query: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
751
|
+
type: z.ZodLiteral<"env">;
|
|
752
|
+
name: z.ZodString;
|
|
753
|
+
}, z.core.$strict>]>>>;
|
|
754
|
+
intervalSeconds: z.ZodNumber;
|
|
755
|
+
strict: z.ZodBoolean;
|
|
756
|
+
}, z.core.$strict>;
|
|
757
|
+
type SurgeProfileInput = {
|
|
758
|
+
readonly target: {
|
|
759
|
+
readonly engine: "surge";
|
|
760
|
+
readonly platform: "macos" | "ios";
|
|
761
|
+
readonly version: string;
|
|
762
|
+
};
|
|
763
|
+
readonly managed?: z.infer<typeof managedSchema>;
|
|
764
|
+
readonly general?: SurgeGeneral;
|
|
765
|
+
readonly hosts?: readonly SurgeHost[];
|
|
766
|
+
readonly nodes: readonly ProxyNode[];
|
|
767
|
+
readonly tunnels?: readonly SurgeTunnel[];
|
|
768
|
+
readonly groups: readonly SurgeGroup[];
|
|
769
|
+
readonly rules: readonly SurgeRule[];
|
|
770
|
+
readonly fallback: SurgePolicy;
|
|
771
|
+
readonly names?: Readonly<Record<string, string>>;
|
|
772
|
+
};
|
|
773
|
+
type SurgeProfileCompilation = {
|
|
774
|
+
readonly ok: boolean;
|
|
775
|
+
readonly artifactKind: "surge-profile";
|
|
776
|
+
readonly diagnostics: readonly Diagnostic[];
|
|
777
|
+
readonly bindings: readonly {
|
|
778
|
+
readonly id: string;
|
|
779
|
+
readonly nativeName: string;
|
|
780
|
+
}[];
|
|
781
|
+
};
|
|
782
|
+
type SurgeProfileArtifact = {
|
|
783
|
+
readonly artifactKind: "surge-profile";
|
|
784
|
+
readonly content: string;
|
|
785
|
+
};
|
|
786
|
+
export declare function compileSurgeProfile(input: unknown): SurgeProfileCompilation;
|
|
787
|
+
export declare function renderSurgeProfile(compilation: SurgeProfileCompilation, resolveSecret: (token: Secret) => string | undefined): SurgeProfileArtifact;
|
|
788
|
+
export declare function renderSurgeProfiles(compilations: readonly SurgeProfileCompilation[], resolveSecret: (token: Secret) => string | undefined): readonly SurgeProfileArtifact[];
|
|
789
|
+
//#endregion
|
|
790
|
+
//#region src/surge-compose.d.ts
|
|
791
|
+
/** Bind shared names only for included resources; explicit input mappings remain compiler-checked. */
|
|
792
|
+
export declare function surgeProfile(input: SurgeProfileInput, names?: Readonly<Record<string, string>>): SurgeProfileInput;
|
|
793
|
+
/** Stable queries produce native-profile policy references without consumer mapping code. */
|
|
794
|
+
export declare function surgeMembers(nodes: readonly ProxyNode[], query?: Parameters<typeof selectNodes>[1]): SurgePolicy[];
|
|
795
|
+
//#endregion
|
|
796
|
+
//#region src/surge-host.d.ts
|
|
797
|
+
/** Complete-profile batches use the out symlink protocol; the Program host remains unchanged. */
|
|
798
|
+
export declare function buildSurgeProfilesToDirectory(profiles: Readonly<Record<string, SurgeProfileInput>>, output: string, resolveSecret?: (token: Secret) => string | undefined): Promise<BuildResult>;
|
|
799
|
+
//#endregion
|
|
800
|
+
export type { Artifact, BuildResult, CaseResult, Compilation, ProxyBuilder, ProxyNodeArtifact, ProxyNodeCompilation, ProxyNodeInput, StrategyGroupCompilation, StrategyGroupInput, SurgeCondition, SurgeGeneral, SurgeGroup, SurgeHost, SurgePolicy, SurgeProfileArtifact, SurgeProfileCompilation, SurgeProfileInput, SurgeRule, SurgeTunnel, TargetPlan };
|