@geekmidas/edge 0.0.0-stage → 10.0.0-alpha.182

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 (84) hide show
  1. package/README.md +14 -2
  2. package/dist/certificates/local.cjs +393 -0
  3. package/dist/certificates/local.cjs.map +1 -0
  4. package/dist/certificates/local.d.cts +92 -0
  5. package/dist/certificates/local.d.cts.map +1 -0
  6. package/dist/certificates/local.d.mts +92 -0
  7. package/dist/certificates/local.d.mts.map +1 -0
  8. package/dist/certificates/local.mjs +361 -0
  9. package/dist/certificates/local.mjs.map +1 -0
  10. package/dist/compose-BHWyQvsD.cjs +22 -0
  11. package/dist/compose-BHWyQvsD.cjs.map +1 -0
  12. package/dist/compose-CcNlj65h.mjs +17 -0
  13. package/dist/compose-CcNlj65h.mjs.map +1 -0
  14. package/dist/dns/godaddy/index.cjs +448 -0
  15. package/dist/dns/godaddy/index.cjs.map +1 -0
  16. package/dist/dns/godaddy/index.d.cts +164 -0
  17. package/dist/dns/godaddy/index.d.cts.map +1 -0
  18. package/dist/dns/godaddy/index.d.mts +164 -0
  19. package/dist/dns/godaddy/index.d.mts.map +1 -0
  20. package/dist/dns/godaddy/index.mjs +435 -0
  21. package/dist/dns/godaddy/index.mjs.map +1 -0
  22. package/dist/dns/hostinger/index.cjs +252 -0
  23. package/dist/dns/hostinger/index.cjs.map +1 -0
  24. package/dist/dns/hostinger/index.d.cts +143 -0
  25. package/dist/dns/hostinger/index.d.cts.map +1 -0
  26. package/dist/dns/hostinger/index.d.mts +143 -0
  27. package/dist/dns/hostinger/index.d.mts.map +1 -0
  28. package/dist/dns/hostinger/index.mjs +249 -0
  29. package/dist/dns/hostinger/index.mjs.map +1 -0
  30. package/dist/dns/index.cjs +76 -0
  31. package/dist/dns/index.cjs.map +1 -0
  32. package/dist/dns/index.d.cts +144 -0
  33. package/dist/dns/index.d.cts.map +1 -0
  34. package/dist/dns/index.d.mts +144 -0
  35. package/dist/dns/index.d.mts.map +1 -0
  36. package/dist/dns/index.mjs +71 -0
  37. package/dist/dns/index.mjs.map +1 -0
  38. package/dist/dns/route53.cjs +210 -0
  39. package/dist/dns/route53.cjs.map +1 -0
  40. package/dist/dns/route53.d.cts +45 -0
  41. package/dist/dns/route53.d.cts.map +1 -0
  42. package/dist/dns/route53.d.mts +45 -0
  43. package/dist/dns/route53.d.mts.map +1 -0
  44. package/dist/dns/route53.mjs +209 -0
  45. package/dist/dns/route53.mjs.map +1 -0
  46. package/dist/errors-CO33_TDV.mjs +16 -0
  47. package/dist/errors-CO33_TDV.mjs.map +1 -0
  48. package/dist/errors-DBZfelEN.d.cts +13 -0
  49. package/dist/errors-DBZfelEN.d.cts.map +1 -0
  50. package/dist/errors-DBZfelEN.d.mts +13 -0
  51. package/dist/errors-DBZfelEN.d.mts.map +1 -0
  52. package/dist/errors-DlRLQOyZ.cjs +27 -0
  53. package/dist/errors-DlRLQOyZ.cjs.map +1 -0
  54. package/dist/index.cjs +6 -0
  55. package/dist/index.d.cts +15 -0
  56. package/dist/index.d.cts.map +1 -0
  57. package/dist/index.d.mts +15 -0
  58. package/dist/index.d.mts.map +1 -0
  59. package/dist/index.mjs +3 -0
  60. package/dist/proxy/caddy.cjs +167 -0
  61. package/dist/proxy/caddy.cjs.map +1 -0
  62. package/dist/proxy/caddy.d.cts +35 -0
  63. package/dist/proxy/caddy.d.cts.map +1 -0
  64. package/dist/proxy/caddy.d.mts +35 -0
  65. package/dist/proxy/caddy.d.mts.map +1 -0
  66. package/dist/proxy/caddy.mjs +164 -0
  67. package/dist/proxy/caddy.mjs.map +1 -0
  68. package/dist/proxy/traefik.cjs +460 -0
  69. package/dist/proxy/traefik.cjs.map +1 -0
  70. package/dist/proxy/traefik.d.cts +129 -0
  71. package/dist/proxy/traefik.d.cts.map +1 -0
  72. package/dist/proxy/traefik.d.mts +129 -0
  73. package/dist/proxy/traefik.d.mts.map +1 -0
  74. package/dist/proxy/traefik.mjs +437 -0
  75. package/dist/proxy/traefik.mjs.map +1 -0
  76. package/dist/routes/index.cjs +49 -0
  77. package/dist/routes/index.cjs.map +1 -0
  78. package/dist/routes/index.d.cts +205 -0
  79. package/dist/routes/index.d.cts.map +1 -0
  80. package/dist/routes/index.d.mts +205 -0
  81. package/dist/routes/index.d.mts.map +1 -0
  82. package/dist/routes/index.mjs +44 -0
  83. package/dist/routes/index.mjs.map +1 -0
  84. package/package.json +131 -3
@@ -0,0 +1,129 @@
1
+ import { EdgeRoute, EdgeTls } from "../routes/index.cjs";
2
+ //#region src/proxy/traefik.d.ts
3
+ /**
4
+ * The image, pinned: the edge is every stack's way in, so a new version is a
5
+ * change to this line, not whatever `latest` is on the day a server starts.
6
+ */
7
+ export declare const TRAEFIK_IMAGE = "traefik:v3.7.13";
8
+ /** The edge's name when nothing renames it: one per server. */
9
+ export declare const DEFAULT_EDGE_PROJECT = "gkm-edge";
10
+ /**
11
+ * The variable that renames the edge — its compose project, and with it its
12
+ * network and its volumes (`<project>_acme`, `_certs`, `_dynamic`). A testing
13
+ * and advanced knob: an end-to-end suite runs an edge of its own beside a
14
+ * developer's, and never touches theirs. Every command that registers with
15
+ * one edge must be run with the same value.
16
+ */
17
+ export declare const EDGE_PROJECT_ENV = "GKM_EDGE_PROJECT";
18
+ /** The edge's compose project: `GKM_EDGE_PROJECT`, else `gkm-edge`. */
19
+ export declare function edgeProject(env?: NodeJS.ProcessEnv): string;
20
+ /**
21
+ * The edge's compose project, one per server — read once, when gkm starts,
22
+ * so every step of a run names the same edge.
23
+ */
24
+ export declare const EDGE_PROJECT: string;
25
+ /**
26
+ * The external network the edge and every stack's public services share:
27
+ * named after the edge, so a renamed edge has a network of its own.
28
+ */
29
+ export declare const EDGE_NETWORK: string;
30
+ /** The edge's compose service. */
31
+ export declare const EDGE_SERVICE = "traefik";
32
+ /** Inside the edge's container: what it watches, and where certificates are. */
33
+ export declare const EDGE_DYNAMIC_DIR = "/etc/gkm-edge/dynamic";
34
+ export declare const EDGE_CERTS_DIR = "/etc/gkm-edge/certs";
35
+ /** The certificate resolver every deployed route without its own certificate uses. */
36
+ export declare const ACME_RESOLVER = "letsencrypt";
37
+ /**
38
+ * The resolver a wildcard site's `*.<domain>` certificate comes from: Let's
39
+ * Encrypt issues a wildcard only over the DNS challenge, which the edge
40
+ * answers by writing an `_acme-challenge` TXT record through Route 53.
41
+ */
42
+ export declare const ACME_DNS_RESOLVER = "letsencrypt-dns";
43
+ /**
44
+ * The key the edge writes those records with, inside its container: written
45
+ * by the deploy of a stage with a wildcard site, and allowed nothing but
46
+ * each such stage's `_acme-challenge` record (see `acmeDns.ts`).
47
+ */
48
+ export declare const EDGE_AWS_CREDENTIALS = "/etc/gkm-edge/certs/aws-credentials";
49
+ /** A stack's service, as the edge — and the stack itself — reach it. */
50
+ export declare function edgeAlias(project: string, service: string): string;
51
+ /** A stack's certificate, as the edge's container reads it. */
52
+ export declare function edgeCertificatePaths(project: string): {
53
+ certFile: string;
54
+ keyFile: string;
55
+ };
56
+ /** The edge's ports on the host. */
57
+ export interface EdgePorts {
58
+ https: number;
59
+ http: number;
60
+ }
61
+ /**
62
+ * The edge's static configuration: the entrypoints, the redirect, ACME, and
63
+ * the directory it watches. No API and no dashboard — nothing about the edge
64
+ * is reachable but the routes stacks register.
65
+ */
66
+ export declare function traefikStatic(ports: EdgePorts): Record<string, unknown>;
67
+ /** The edge's compose document. */
68
+ export declare function edgeCompose(options: {
69
+ ports: EdgePorts;
70
+ /**
71
+ * The static configuration, as written: handed to the container inline
72
+ * (`configs.content`), so nothing is read from a path on whichever machine
73
+ * runs the deploy — and its hash recreates the edge when it changes.
74
+ */
75
+ staticConfig: string;
76
+ logging: {
77
+ driver: string;
78
+ options: Record<string, string>;
79
+ };
80
+ }): Record<string, unknown>;
81
+ /** What a stack registers with the edge — its routes, and its certificate. */
82
+ export interface TraefikStackOptions {
83
+ project: string;
84
+ /** ACME, or the stage's own certificate. */
85
+ tls: EdgeTls;
86
+ /**
87
+ * The stack's token, on which a service of the stack keeps gkm's client
88
+ * address through the edge — see `clientIpRule`.
89
+ */
90
+ edgeToken?: string;
91
+ }
92
+ /** A stack's dynamic configuration, as an object. */
93
+ export declare function traefikDynamic(routes: readonly EdgeRoute[], options: TraefikStackOptions): Record<string, unknown>;
94
+ /**
95
+ * A host a stack routes on the shared edge: one name, or — for a wildcard
96
+ * site — every one label under a domain but the ones it never takes.
97
+ */
98
+ export type EdgeClaim = {
99
+ host: string;
100
+ } | {
101
+ wildcard: string;
102
+ except: readonly string[];
103
+ };
104
+ /**
105
+ * What a stack's routes claim on the edge, from the route model: one claim
106
+ * per host, each route's aliases and redirects included.
107
+ */
108
+ export declare function edgeClaims(routes: readonly EdgeRoute[]): EdgeClaim[];
109
+ /**
110
+ * The hosts a stack's file on the edge claims: from its claims line, or — a
111
+ * file written before gkm wrote one — from its routers' rules, in the shapes
112
+ * `traefikDynamic` renders them.
113
+ */
114
+ export declare function readEdgeClaims(file: string): EdgeClaim[];
115
+ /**
116
+ * Where two claims meet, as a host to name — or undefined where they never
117
+ * do. A wildcard takes one label under its domain, so it meets a name one
118
+ * label under it that it does not leave out, and another wildcard on the
119
+ * same domain.
120
+ */
121
+ export declare function claimsOverlap(a: EdgeClaim, b: EdgeClaim): string | undefined;
122
+ /** A stack's dynamic configuration file, as written to the edge's directory. */
123
+ export declare function traefikDynamicFile(routes: readonly EdgeRoute[], options: TraefikStackOptions): string;
124
+ /** The edge's static configuration file. */
125
+ export declare function traefikStaticFile(ports: EdgePorts): string;
126
+ /** The edge's compose file. */
127
+ export declare function edgeComposeFile(options: Parameters<typeof edgeCompose>[0]): string;
128
+ //#endregion
129
+ //# sourceMappingURL=traefik.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traefik.d.cts","names":[],"sources":["../../src/proxy/traefik.ts"],"mappings":";;;;;;qBAsCa;;qBAGA;;;;;;;;qBASA;;wBAGG,YAAY,MAAK,OAAO;;;;;qBAQ3B;;;;;qBAMA;;qBAGA;;qBAGA;qBACA;;qBAGA;;;;;;qBAOA;;;;;;qBAOA;;wBAMG,UAAU,iBAAiB;;wBAK3B,qBAAqB;EACpC;EACA;;;iBASgB;EAChB;EACA;;;;;;;wBAQe,cAAc,OAAO,YAAY;;wBAmDjC,YAAY;EAC3B,OAAO;;;;;;EAMP;EACA;IAAW;IAAgB,SAAS;;IACjC;;iBAoDa;EAChB;;EAEA,KAAK;;;;;EAKL;;;wBAIe,eACf,iBAAiB,aACjB,SAAS,sBACP;;;;;YAmPS;EACP;;EACA;EAAkB;;;;;;wBAMP,WAAW,iBAAiB,cAAc;;;;;;wBAyB1C,eAAe,eAAe;;;;;;;wBAqE9B,cAAc,GAAG,WAAW,GAAG;;wBAqB/B,mBACf,iBAAiB,aACjB,SAAS;;wBAWM,kBAAkB,OAAO;;wBAMzB,gBACf,SAAS,kBAAkB"}
@@ -0,0 +1,129 @@
1
+ import { EdgeRoute, EdgeTls } from "../routes/index.mjs";
2
+ //#region src/proxy/traefik.d.ts
3
+ /**
4
+ * The image, pinned: the edge is every stack's way in, so a new version is a
5
+ * change to this line, not whatever `latest` is on the day a server starts.
6
+ */
7
+ export declare const TRAEFIK_IMAGE = "traefik:v3.7.13";
8
+ /** The edge's name when nothing renames it: one per server. */
9
+ export declare const DEFAULT_EDGE_PROJECT = "gkm-edge";
10
+ /**
11
+ * The variable that renames the edge — its compose project, and with it its
12
+ * network and its volumes (`<project>_acme`, `_certs`, `_dynamic`). A testing
13
+ * and advanced knob: an end-to-end suite runs an edge of its own beside a
14
+ * developer's, and never touches theirs. Every command that registers with
15
+ * one edge must be run with the same value.
16
+ */
17
+ export declare const EDGE_PROJECT_ENV = "GKM_EDGE_PROJECT";
18
+ /** The edge's compose project: `GKM_EDGE_PROJECT`, else `gkm-edge`. */
19
+ export declare function edgeProject(env?: NodeJS.ProcessEnv): string;
20
+ /**
21
+ * The edge's compose project, one per server — read once, when gkm starts,
22
+ * so every step of a run names the same edge.
23
+ */
24
+ export declare const EDGE_PROJECT: string;
25
+ /**
26
+ * The external network the edge and every stack's public services share:
27
+ * named after the edge, so a renamed edge has a network of its own.
28
+ */
29
+ export declare const EDGE_NETWORK: string;
30
+ /** The edge's compose service. */
31
+ export declare const EDGE_SERVICE = "traefik";
32
+ /** Inside the edge's container: what it watches, and where certificates are. */
33
+ export declare const EDGE_DYNAMIC_DIR = "/etc/gkm-edge/dynamic";
34
+ export declare const EDGE_CERTS_DIR = "/etc/gkm-edge/certs";
35
+ /** The certificate resolver every deployed route without its own certificate uses. */
36
+ export declare const ACME_RESOLVER = "letsencrypt";
37
+ /**
38
+ * The resolver a wildcard site's `*.<domain>` certificate comes from: Let's
39
+ * Encrypt issues a wildcard only over the DNS challenge, which the edge
40
+ * answers by writing an `_acme-challenge` TXT record through Route 53.
41
+ */
42
+ export declare const ACME_DNS_RESOLVER = "letsencrypt-dns";
43
+ /**
44
+ * The key the edge writes those records with, inside its container: written
45
+ * by the deploy of a stage with a wildcard site, and allowed nothing but
46
+ * each such stage's `_acme-challenge` record (see `acmeDns.ts`).
47
+ */
48
+ export declare const EDGE_AWS_CREDENTIALS = "/etc/gkm-edge/certs/aws-credentials";
49
+ /** A stack's service, as the edge — and the stack itself — reach it. */
50
+ export declare function edgeAlias(project: string, service: string): string;
51
+ /** A stack's certificate, as the edge's container reads it. */
52
+ export declare function edgeCertificatePaths(project: string): {
53
+ certFile: string;
54
+ keyFile: string;
55
+ };
56
+ /** The edge's ports on the host. */
57
+ export interface EdgePorts {
58
+ https: number;
59
+ http: number;
60
+ }
61
+ /**
62
+ * The edge's static configuration: the entrypoints, the redirect, ACME, and
63
+ * the directory it watches. No API and no dashboard — nothing about the edge
64
+ * is reachable but the routes stacks register.
65
+ */
66
+ export declare function traefikStatic(ports: EdgePorts): Record<string, unknown>;
67
+ /** The edge's compose document. */
68
+ export declare function edgeCompose(options: {
69
+ ports: EdgePorts;
70
+ /**
71
+ * The static configuration, as written: handed to the container inline
72
+ * (`configs.content`), so nothing is read from a path on whichever machine
73
+ * runs the deploy — and its hash recreates the edge when it changes.
74
+ */
75
+ staticConfig: string;
76
+ logging: {
77
+ driver: string;
78
+ options: Record<string, string>;
79
+ };
80
+ }): Record<string, unknown>;
81
+ /** What a stack registers with the edge — its routes, and its certificate. */
82
+ export interface TraefikStackOptions {
83
+ project: string;
84
+ /** ACME, or the stage's own certificate. */
85
+ tls: EdgeTls;
86
+ /**
87
+ * The stack's token, on which a service of the stack keeps gkm's client
88
+ * address through the edge — see `clientIpRule`.
89
+ */
90
+ edgeToken?: string;
91
+ }
92
+ /** A stack's dynamic configuration, as an object. */
93
+ export declare function traefikDynamic(routes: readonly EdgeRoute[], options: TraefikStackOptions): Record<string, unknown>;
94
+ /**
95
+ * A host a stack routes on the shared edge: one name, or — for a wildcard
96
+ * site — every one label under a domain but the ones it never takes.
97
+ */
98
+ export type EdgeClaim = {
99
+ host: string;
100
+ } | {
101
+ wildcard: string;
102
+ except: readonly string[];
103
+ };
104
+ /**
105
+ * What a stack's routes claim on the edge, from the route model: one claim
106
+ * per host, each route's aliases and redirects included.
107
+ */
108
+ export declare function edgeClaims(routes: readonly EdgeRoute[]): EdgeClaim[];
109
+ /**
110
+ * The hosts a stack's file on the edge claims: from its claims line, or — a
111
+ * file written before gkm wrote one — from its routers' rules, in the shapes
112
+ * `traefikDynamic` renders them.
113
+ */
114
+ export declare function readEdgeClaims(file: string): EdgeClaim[];
115
+ /**
116
+ * Where two claims meet, as a host to name — or undefined where they never
117
+ * do. A wildcard takes one label under its domain, so it meets a name one
118
+ * label under it that it does not leave out, and another wildcard on the
119
+ * same domain.
120
+ */
121
+ export declare function claimsOverlap(a: EdgeClaim, b: EdgeClaim): string | undefined;
122
+ /** A stack's dynamic configuration file, as written to the edge's directory. */
123
+ export declare function traefikDynamicFile(routes: readonly EdgeRoute[], options: TraefikStackOptions): string;
124
+ /** The edge's static configuration file. */
125
+ export declare function traefikStaticFile(ports: EdgePorts): string;
126
+ /** The edge's compose file. */
127
+ export declare function edgeComposeFile(options: Parameters<typeof edgeCompose>[0]): string;
128
+ //#endregion
129
+ //# sourceMappingURL=traefik.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traefik.d.mts","names":[],"sources":["../../src/proxy/traefik.ts"],"mappings":";;;;;;qBAsCa;;qBAGA;;;;;;;;qBASA;;wBAGG,YAAY,MAAK,OAAO;;;;;qBAQ3B;;;;;qBAMA;;qBAGA;;qBAGA;qBACA;;qBAGA;;;;;;qBAOA;;;;;;qBAOA;;wBAMG,UAAU,iBAAiB;;wBAK3B,qBAAqB;EACpC;EACA;;;iBASgB;EAChB;EACA;;;;;;;wBAQe,cAAc,OAAO,YAAY;;wBAmDjC,YAAY;EAC3B,OAAO;;;;;;EAMP;EACA;IAAW;IAAgB,SAAS;;IACjC;;iBAoDa;EAChB;;EAEA,KAAK;;;;;EAKL;;;wBAIe,eACf,iBAAiB,aACjB,SAAS,sBACP;;;;;YAmPS;EACP;;EACA;EAAkB;;;;;;wBAMP,WAAW,iBAAiB,cAAc;;;;;;wBAyB1C,eAAe,eAAe;;;;;;;wBAqE9B,cAAc,GAAG,WAAW,GAAG;;wBAqB/B,mBACf,iBAAiB,aACjB,SAAS;;wBAWM,kBAAkB,OAAO;;wBAMzB,gBACf,SAAS,kBAAkB"}