@madebyentropy/tnl 0.0.0-stage → 0.1.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/LICENSE +28 -0
- package/NOTICE +5 -0
- package/THIRD_PARTY_LICENSES.txt +3297 -0
- package/dist/adapters/ioredis.d.ts +7 -0
- package/dist/adapters/ioredis.js +87 -0
- package/dist/adapters/node-postgres.d.ts +8 -0
- package/dist/adapters/node-postgres.js +41 -0
- package/dist/adapters/postgres-js.d.ts +7 -0
- package/dist/adapters/postgres-js.js +55 -0
- package/dist/bin/tnl.d.ts +2 -0
- package/dist/bin/tnl.js +16 -0
- package/dist/browser.d.ts +18 -0
- package/dist/browser.js +43 -0
- package/dist/bun.d.ts +9 -0
- package/dist/bun.js +6 -0
- package/dist/cloudflare.d.ts +9 -0
- package/dist/cloudflare.js +16 -0
- package/dist/config.d.ts +107 -0
- package/dist/config.gen.d.ts +1185 -0
- package/dist/config.gen.js +2 -0
- package/dist/config.js +3 -0
- package/dist/control.d.ts +5 -0
- package/dist/control.js +9 -0
- package/dist/durable-object.d.ts +51 -0
- package/dist/durable-object.js +374 -0
- package/dist/durable-object.worker.d.ts +5 -0
- package/dist/durable-object.worker.js +11 -0
- package/dist/errors.d.ts +17 -0
- package/dist/errors.js +230 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +2 -0
- package/dist/internal/connector/cancellation.d.ts +7 -0
- package/dist/internal/connector/cancellation.js +30 -0
- package/dist/internal/connector/client.d.ts +62 -0
- package/dist/internal/connector/client.js +504 -0
- package/dist/internal/connector/client_factory.d.ts +6 -0
- package/dist/internal/connector/client_factory.js +123 -0
- package/dist/internal/connector/connection.d.ts +39 -0
- package/dist/internal/connector/connection.js +739 -0
- package/dist/internal/connector/connection_ipc.d.ts +12 -0
- package/dist/internal/connector/connection_ipc.js +198 -0
- package/dist/internal/connector/context.d.ts +28 -0
- package/dist/internal/connector/context.js +19 -0
- package/dist/internal/connector/contract.d.ts +392 -0
- package/dist/internal/connector/contract.js +56 -0
- package/dist/internal/connector/deployment_types.d.ts +27 -0
- package/dist/internal/connector/deployment_types.js +1 -0
- package/dist/internal/connector/driver_socket.d.ts +21 -0
- package/dist/internal/connector/driver_socket.js +129 -0
- package/dist/internal/connector/management.d.ts +29 -0
- package/dist/internal/connector/management.js +118 -0
- package/dist/internal/connector/native_operations.d.ts +16 -0
- package/dist/internal/connector/native_operations.js +30 -0
- package/dist/internal/connector/native_stream.d.ts +7 -0
- package/dist/internal/connector/native_stream.js +219 -0
- package/dist/internal/connector/operation_handles.d.ts +9 -0
- package/dist/internal/connector/operation_handles.js +18 -0
- package/dist/internal/connector/portable_operations.d.ts +13 -0
- package/dist/internal/connector/portable_operations.js +25 -0
- package/dist/internal/connector/snapshot.d.ts +183 -0
- package/dist/internal/connector/snapshot.js +47 -0
- package/dist/internal/connector/wasm_abi.d.ts +76 -0
- package/dist/internal/connector/wasm_abi.js +5 -0
- package/dist/internal/connector/wasm_client.d.ts +58 -0
- package/dist/internal/connector/wasm_client.js +545 -0
- package/dist/internal/connector/wasm_loader.d.ts +15 -0
- package/dist/internal/connector/wasm_loader.js +99 -0
- package/dist/internal/connector/wasm_stream.d.ts +4 -0
- package/dist/internal/connector/wasm_stream.js +177 -0
- package/dist/internal/connector/workload/contract.d.ts +54 -0
- package/dist/internal/connector/workload/contract.js +14 -0
- package/dist/internal/connector/workload/provider.d.ts +24 -0
- package/dist/internal/connector/workload/provider.js +130 -0
- package/dist/internal/enrollment_source.d.ts +4 -0
- package/dist/internal/enrollment_source.js +34 -0
- package/dist/internal/management/client/client.gen.d.ts +2 -0
- package/dist/internal/management/client/client.gen.js +216 -0
- package/dist/internal/management/client/index.d.ts +10 -0
- package/dist/internal/management/client/index.js +6 -0
- package/dist/internal/management/client/types.gen.d.ts +120 -0
- package/dist/internal/management/client/types.gen.js +2 -0
- package/dist/internal/management/client/utils.gen.d.ts +37 -0
- package/dist/internal/management/client/utils.gen.js +228 -0
- package/dist/internal/management/client.gen.d.ts +12 -0
- package/dist/internal/management/client.gen.js +3 -0
- package/dist/internal/management/core/auth.gen.d.ts +25 -0
- package/dist/internal/management/core/auth.gen.js +14 -0
- package/dist/internal/management/core/bodySerializer.gen.d.ts +25 -0
- package/dist/internal/management/core/bodySerializer.gen.js +57 -0
- package/dist/internal/management/core/params.gen.d.ts +43 -0
- package/dist/internal/management/core/params.gen.js +109 -0
- package/dist/internal/management/core/pathSerializer.gen.d.ts +33 -0
- package/dist/internal/management/core/pathSerializer.gen.js +106 -0
- package/dist/internal/management/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/internal/management/core/queryKeySerializer.gen.js +92 -0
- package/dist/internal/management/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/internal/management/core/serverSentEvents.gen.js +132 -0
- package/dist/internal/management/core/types.gen.d.ts +83 -0
- package/dist/internal/management/core/types.gen.js +2 -0
- package/dist/internal/management/core/utils.gen.d.ts +19 -0
- package/dist/internal/management/core/utils.gen.js +87 -0
- package/dist/internal/management/index.d.ts +2 -0
- package/dist/internal/management/index.js +2 -0
- package/dist/internal/management/sdk.gen.d.ts +73 -0
- package/dist/internal/management/sdk.gen.js +191 -0
- package/dist/internal/management/types.gen.d.ts +464 -0
- package/dist/internal/management/types.gen.js +2 -0
- package/dist/internal/management/zod.gen.d.ts +850 -0
- package/dist/internal/management/zod.gen.js +252 -0
- package/dist/internal/native/launcher.d.ts +8 -0
- package/dist/internal/native/launcher.js +75 -0
- package/dist/internal/native/native-targets.d.ts +9 -0
- package/dist/internal/native/native-targets.js +8 -0
- package/dist/internal/portable/cloudflare-publisher-client.d.ts +54 -0
- package/dist/internal/portable/cloudflare-publisher-client.js +91 -0
- package/dist/internal/portable/cloudflare-publisher.d.ts +19 -0
- package/dist/internal/portable/cloudflare-publisher.js +210 -0
- package/dist/internal/portable/durable-deployment.d.ts +10 -0
- package/dist/internal/portable/durable-deployment.js +22 -0
- package/dist/internal/portable/enrollment.d.ts +26 -0
- package/dist/internal/portable/enrollment.js +196 -0
- package/dist/internal/portable/publication.d.ts +54 -0
- package/dist/internal/portable/publication.js +304 -0
- package/dist/internal/portable/request.d.ts +1 -0
- package/dist/internal/portable/request.js +20 -0
- package/dist/internal/portable/storage-browser.d.ts +9 -0
- package/dist/internal/portable/storage-browser.js +115 -0
- package/dist/internal/portable/storage-durable-object.d.ts +11 -0
- package/dist/internal/portable/storage-durable-object.js +110 -0
- package/dist/internal/portable/storage-host.d.ts +8 -0
- package/dist/internal/portable/storage-host.js +142 -0
- package/dist/internal/portable/storage.d.ts +15 -0
- package/dist/internal/portable/storage.js +29 -0
- package/dist/internal/project/native_runtime.d.ts +24 -0
- package/dist/internal/project/native_runtime.js +23 -0
- package/dist/internal/project/runtime.d.ts +467 -0
- package/dist/internal/project/runtime.js +183 -0
- package/dist/internal/project/service_metadata.d.ts +3 -0
- package/dist/internal/project/service_metadata.js +12 -0
- package/dist/internal/publication_certificate.d.ts +28 -0
- package/dist/internal/publication_certificate.js +32 -0
- package/dist/internal/publication_run.d.ts +8 -0
- package/dist/internal/publication_run.js +19 -0
- package/dist/internal/publisher/app.d.ts +33 -0
- package/dist/internal/publisher/app.js +317 -0
- package/dist/internal/publisher/fetch.d.ts +6 -0
- package/dist/internal/publisher/fetch.js +135 -0
- package/dist/internal/publisher/fetch_types.d.ts +1 -0
- package/dist/internal/publisher/fetch_types.js +1 -0
- package/dist/internal/publisher/framework.d.ts +27 -0
- package/dist/internal/publisher/framework.js +82 -0
- package/dist/internal/publisher/local.d.ts +39 -0
- package/dist/internal/publisher/local.js +312 -0
- package/dist/internal/publisher/native_publisher.d.ts +25 -0
- package/dist/internal/publisher/native_publisher.js +228 -0
- package/dist/internal/publisher/port.d.ts +2 -0
- package/dist/internal/publisher/port.js +15 -0
- package/dist/internal/publisher/publication.d.ts +88 -0
- package/dist/internal/publisher/publication.js +627 -0
- package/dist/internal/publisher/register.d.ts +31 -0
- package/dist/internal/publisher/register.js +136 -0
- package/dist/internal/publisher/registration.d.ts +385 -0
- package/dist/internal/publisher/registration.js +223 -0
- package/dist/internal/publisher/status.d.ts +47 -0
- package/dist/internal/publisher/status.js +137 -0
- package/dist/internal/publisher/target.d.ts +6 -0
- package/dist/internal/publisher/target.js +44 -0
- package/dist/internal/runtime_resources.d.ts +38 -0
- package/dist/internal/runtime_resources.js +52 -0
- package/dist/internal/tracing.d.ts +10 -0
- package/dist/internal/tracing.js +78 -0
- package/dist/internal/validation.d.ts +3 -0
- package/dist/internal/validation.js +9 -0
- package/dist/internal/values.d.ts +27 -0
- package/dist/internal/values.js +54 -0
- package/dist/next.d.ts +12 -0
- package/dist/next.js +82 -0
- package/dist/node.d.ts +9 -0
- package/dist/node.js +6 -0
- package/dist/project.d.ts +173 -0
- package/dist/project.js +1 -0
- package/dist/response.d.ts +1 -0
- package/dist/response.js +34 -0
- package/dist/third-party-licenses.txt +1537 -0
- package/dist/vite.d.ts +5 -0
- package/dist/vite.js +200 -0
- package/dist/wasm/build.json +16 -0
- package/dist/wasm/connector.wasm +0 -0
- package/dist/wasm/go-license.txt +27 -0
- package/dist/wasm/publisher.wasm +0 -0
- package/dist/wasm/third-party-licenses.txt +3297 -0
- package/dist/wasm/wasm_exec.d.ts +1 -0
- package/dist/wasm/wasm_exec.js +575 -0
- package/dist/workload.d.ts +11 -0
- package/dist/workload.js +4 -0
- package/package.json +159 -4
- package/readme.md +13 -0
- package/README.md +0 -3
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { Server as HTTPSServer } from "node:https";
|
|
2
|
+
import { TnlError } from "../../errors.js";
|
|
3
|
+
import { isFetchServer } from "./fetch.js";
|
|
4
|
+
import { canonicalListenerTarget } from "./target.js";
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { parseValue } from "../validation.js";
|
|
7
|
+
const registrationTimeoutMilliseconds = 10 * 60 * 1000;
|
|
8
|
+
const listenerAddressSchema = z.object({ address: z.string(), port: z.number() });
|
|
9
|
+
const bunObservers = new WeakMap();
|
|
10
|
+
// restore the application's method when the final observer leaves.
|
|
11
|
+
export function observeListenerClose(server, callback) {
|
|
12
|
+
if (!isBunServer(server)) {
|
|
13
|
+
const stopped = () => {
|
|
14
|
+
void callback().catch(() => { });
|
|
15
|
+
};
|
|
16
|
+
server.once("close", stopped);
|
|
17
|
+
return () => {
|
|
18
|
+
server.off("close", stopped);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
let observers = bunObservers.get(server);
|
|
22
|
+
if (observers === undefined) {
|
|
23
|
+
const original = server.stop;
|
|
24
|
+
const callbacks = new Set();
|
|
25
|
+
const wrapped = async (force) => {
|
|
26
|
+
const failures = [];
|
|
27
|
+
try {
|
|
28
|
+
await original.call(server, force);
|
|
29
|
+
}
|
|
30
|
+
catch (cause) {
|
|
31
|
+
failures.push(cause);
|
|
32
|
+
}
|
|
33
|
+
const results = await Promise.allSettled([...callbacks].map((callback) => callback()));
|
|
34
|
+
failures.push(...results.flatMap((result) => result.status === "rejected" ? [result.reason] : []));
|
|
35
|
+
if (failures.length === 1)
|
|
36
|
+
throw failures[0];
|
|
37
|
+
if (failures.length > 1)
|
|
38
|
+
throw new AggregateError(failures, "listener stop and publication cleanup failed");
|
|
39
|
+
};
|
|
40
|
+
observers = { original, wrapped, callbacks };
|
|
41
|
+
server.stop = wrapped;
|
|
42
|
+
bunObservers.set(server, observers);
|
|
43
|
+
}
|
|
44
|
+
const current = observers;
|
|
45
|
+
current.callbacks.add(callback);
|
|
46
|
+
return () => {
|
|
47
|
+
current.callbacks.delete(callback);
|
|
48
|
+
if (current.callbacks.size !== 0)
|
|
49
|
+
return;
|
|
50
|
+
if (server.stop === current.wrapped)
|
|
51
|
+
server.stop = current.original;
|
|
52
|
+
if (bunObservers.get(server) === current)
|
|
53
|
+
bunObservers.delete(server);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export async function listeningTarget(server, options = {}) {
|
|
57
|
+
options.signal?.throwIfAborted();
|
|
58
|
+
if (isBunServer(server)) {
|
|
59
|
+
const hostname = server.hostname ?? server.url.hostname;
|
|
60
|
+
if ((server.url.protocol !== "http:" && server.url.protocol !== "https:") ||
|
|
61
|
+
typeof server.port !== "number" ||
|
|
62
|
+
!Number.isInteger(server.port) ||
|
|
63
|
+
typeof hostname !== "string") {
|
|
64
|
+
throw new TnlError("sdk.target_invalid");
|
|
65
|
+
}
|
|
66
|
+
return canonicalListenerTarget(options.targetHostname ?? hostname, server.port, server.url.protocol === "https:" ? "https" : "http");
|
|
67
|
+
}
|
|
68
|
+
if (server.address() === null) {
|
|
69
|
+
await new Promise((resolve, reject) => {
|
|
70
|
+
let timer;
|
|
71
|
+
const cleanup = () => {
|
|
72
|
+
clearTimeout(timer);
|
|
73
|
+
server.off("listening", onListening);
|
|
74
|
+
server.off("error", onError);
|
|
75
|
+
server.off("close", onClose);
|
|
76
|
+
options.signal?.removeEventListener("abort", onAbort);
|
|
77
|
+
};
|
|
78
|
+
const onListening = () => {
|
|
79
|
+
cleanup();
|
|
80
|
+
resolve();
|
|
81
|
+
};
|
|
82
|
+
const onError = (error) => {
|
|
83
|
+
cleanup();
|
|
84
|
+
reject(new TnlError("sdk.listener_failed", { cause: error }));
|
|
85
|
+
};
|
|
86
|
+
const onClose = () => {
|
|
87
|
+
cleanup();
|
|
88
|
+
reject(new TnlError("sdk.listener_failed"));
|
|
89
|
+
};
|
|
90
|
+
const onAbort = () => {
|
|
91
|
+
cleanup();
|
|
92
|
+
reject(options.signal?.reason);
|
|
93
|
+
};
|
|
94
|
+
options.signal?.addEventListener("abort", onAbort, { once: true });
|
|
95
|
+
server.once("listening", onListening);
|
|
96
|
+
server.once("error", onError);
|
|
97
|
+
server.once("close", onClose);
|
|
98
|
+
timer = setTimeout(() => {
|
|
99
|
+
cleanup();
|
|
100
|
+
reject(new TnlError("sdk.listener_failed"));
|
|
101
|
+
}, registrationTimeoutMilliseconds);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
const address = parseValue(listenerAddressSchema, server.address(), "sdk.target_invalid");
|
|
105
|
+
return canonicalListenerTarget(options.targetHostname ?? address.address, address.port,
|
|
106
|
+
// Bun aliases the node:http and node:https constructors. the SDK's owned
|
|
107
|
+
// Fetch listener is always plain HTTP, even when instanceof says otherwise.
|
|
108
|
+
!isFetchServer(server) && server instanceof HTTPSServer ? "https" : "http");
|
|
109
|
+
}
|
|
110
|
+
export async function closeServer(server, signal) {
|
|
111
|
+
if (isBunServer(server)) {
|
|
112
|
+
await server.stop(signal?.aborted === true);
|
|
113
|
+
signal?.throwIfAborted();
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (server.listening) {
|
|
117
|
+
await new Promise((resolve, reject) => {
|
|
118
|
+
const force = () => server.closeAllConnections?.();
|
|
119
|
+
signal?.addEventListener("abort", force, { once: true });
|
|
120
|
+
server.close((error) => {
|
|
121
|
+
signal?.removeEventListener("abort", force);
|
|
122
|
+
if (signal?.aborted === true)
|
|
123
|
+
reject(signal.reason);
|
|
124
|
+
else if (error)
|
|
125
|
+
reject(error);
|
|
126
|
+
else
|
|
127
|
+
resolve();
|
|
128
|
+
});
|
|
129
|
+
if (signal === undefined || signal.aborted)
|
|
130
|
+
force();
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
export function isBunServer(server) {
|
|
135
|
+
return "stop" in server && typeof server.stop === "function";
|
|
136
|
+
}
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import type { EndpointSelection, RuntimeEndpoint } from "./local.js";
|
|
3
|
+
import { type ExportedCertificate, type ServiceCertificate } from "../publication_certificate.js";
|
|
4
|
+
export interface RegistrationRuntime {
|
|
5
|
+
start(directory: string, binary?: string, selection?: EndpointSelection, signal?: AbortSignal): Promise<RuntimeEndpoint>;
|
|
6
|
+
request(endpoint: RuntimeEndpoint, operation: string, body?: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
7
|
+
}
|
|
8
|
+
export interface RegistrationShutdown {
|
|
9
|
+
readonly deadline: string;
|
|
10
|
+
readonly signal: AbortSignal;
|
|
11
|
+
}
|
|
12
|
+
declare const assignmentSchema: z.ZodReadonly<z.ZodPipe<z.ZodObject<{
|
|
13
|
+
version: z.ZodLiteral<1>;
|
|
14
|
+
registration_id: z.core.$ZodBranded<z.ZodTemplateLiteral<`reg_${string}`>, "RegistrationID", "out">;
|
|
15
|
+
service: z.ZodString;
|
|
16
|
+
hostname: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
|
|
17
|
+
public_url: z.ZodUnion<readonly [z.ZodTemplateLiteral<`https://${string}`>, z.ZodLiteral<"">]>;
|
|
18
|
+
project: z.ZodReadonly<z.ZodObject<{
|
|
19
|
+
namespace: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
|
|
20
|
+
services: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodReadonly<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
21
|
+
namespace: z.ZodString;
|
|
22
|
+
hostname: z.ZodString;
|
|
23
|
+
port: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodInt]>;
|
|
24
|
+
public: z.ZodBoolean;
|
|
25
|
+
protocol: z.ZodLiteral<"http">;
|
|
26
|
+
url: z.ZodTemplateLiteral<`https://${string}`>;
|
|
27
|
+
paths: z.ZodOptional<z.ZodPipe<z.ZodRecord<z.ZodTemplateLiteral<`/${string}`>, z.ZodReadonly<z.ZodObject<{
|
|
28
|
+
service: z.ZodString;
|
|
29
|
+
url: z.ZodTemplateLiteral<`https://${string}`>;
|
|
30
|
+
stripPrefix: z.ZodBoolean;
|
|
31
|
+
}, z.core.$strict>>>, z.ZodTransform<Readonly<Record<string, Readonly<{
|
|
32
|
+
service: string;
|
|
33
|
+
url: `https://${string}`;
|
|
34
|
+
stripPrefix: boolean;
|
|
35
|
+
}> | undefined>>, Record<`/${string}`, Readonly<{
|
|
36
|
+
service: string;
|
|
37
|
+
url: `https://${string}`;
|
|
38
|
+
stripPrefix: boolean;
|
|
39
|
+
}>>>>>;
|
|
40
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
41
|
+
namespace: z.ZodString;
|
|
42
|
+
hostname: z.ZodString;
|
|
43
|
+
port: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodInt]>;
|
|
44
|
+
public: z.ZodBoolean;
|
|
45
|
+
protocol: z.ZodLiteral<"kubernetes">;
|
|
46
|
+
url: z.ZodTemplateLiteral<`https://${string}`>;
|
|
47
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
48
|
+
namespace: z.ZodString;
|
|
49
|
+
hostname: z.ZodString;
|
|
50
|
+
port: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodInt]>;
|
|
51
|
+
public: z.ZodBoolean;
|
|
52
|
+
protocol: z.ZodLiteral<"postgres">;
|
|
53
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
54
|
+
namespace: z.ZodString;
|
|
55
|
+
hostname: z.ZodString;
|
|
56
|
+
port: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodInt]>;
|
|
57
|
+
public: z.ZodBoolean;
|
|
58
|
+
protocol: z.ZodLiteral<"mysql">;
|
|
59
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
60
|
+
namespace: z.ZodString;
|
|
61
|
+
hostname: z.ZodString;
|
|
62
|
+
port: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodInt]>;
|
|
63
|
+
public: z.ZodBoolean;
|
|
64
|
+
protocol: z.ZodLiteral<"tcp">;
|
|
65
|
+
}, z.core.$strict>], "protocol">>>, z.ZodTransform<Readonly<Record<string, Readonly<{
|
|
66
|
+
namespace: string;
|
|
67
|
+
hostname: string;
|
|
68
|
+
port: number;
|
|
69
|
+
public: boolean;
|
|
70
|
+
protocol: "http";
|
|
71
|
+
url: `https://${string}`;
|
|
72
|
+
paths?: Readonly<Record<string, Readonly<{
|
|
73
|
+
service: string;
|
|
74
|
+
url: `https://${string}`;
|
|
75
|
+
stripPrefix: boolean;
|
|
76
|
+
}> | undefined>> | undefined;
|
|
77
|
+
}> | Readonly<{
|
|
78
|
+
namespace: string;
|
|
79
|
+
hostname: string;
|
|
80
|
+
port: number;
|
|
81
|
+
public: boolean;
|
|
82
|
+
protocol: "kubernetes";
|
|
83
|
+
url: `https://${string}`;
|
|
84
|
+
}> | Readonly<{
|
|
85
|
+
namespace: string;
|
|
86
|
+
hostname: string;
|
|
87
|
+
port: number;
|
|
88
|
+
public: boolean;
|
|
89
|
+
protocol: "postgres";
|
|
90
|
+
}> | Readonly<{
|
|
91
|
+
namespace: string;
|
|
92
|
+
hostname: string;
|
|
93
|
+
port: number;
|
|
94
|
+
public: boolean;
|
|
95
|
+
protocol: "mysql";
|
|
96
|
+
}> | Readonly<{
|
|
97
|
+
namespace: string;
|
|
98
|
+
hostname: string;
|
|
99
|
+
port: number;
|
|
100
|
+
public: boolean;
|
|
101
|
+
protocol: "tcp";
|
|
102
|
+
}> | undefined>>, Record<string, Readonly<{
|
|
103
|
+
namespace: string;
|
|
104
|
+
hostname: string;
|
|
105
|
+
port: number;
|
|
106
|
+
public: boolean;
|
|
107
|
+
protocol: "http";
|
|
108
|
+
url: `https://${string}`;
|
|
109
|
+
paths?: Readonly<Record<string, Readonly<{
|
|
110
|
+
service: string;
|
|
111
|
+
url: `https://${string}`;
|
|
112
|
+
stripPrefix: boolean;
|
|
113
|
+
}> | undefined>> | undefined;
|
|
114
|
+
}> | Readonly<{
|
|
115
|
+
namespace: string;
|
|
116
|
+
hostname: string;
|
|
117
|
+
port: number;
|
|
118
|
+
public: boolean;
|
|
119
|
+
protocol: "kubernetes";
|
|
120
|
+
url: `https://${string}`;
|
|
121
|
+
}> | Readonly<{
|
|
122
|
+
namespace: string;
|
|
123
|
+
hostname: string;
|
|
124
|
+
port: number;
|
|
125
|
+
public: boolean;
|
|
126
|
+
protocol: "postgres";
|
|
127
|
+
}> | Readonly<{
|
|
128
|
+
namespace: string;
|
|
129
|
+
hostname: string;
|
|
130
|
+
port: number;
|
|
131
|
+
public: boolean;
|
|
132
|
+
protocol: "mysql";
|
|
133
|
+
}> | Readonly<{
|
|
134
|
+
namespace: string;
|
|
135
|
+
hostname: string;
|
|
136
|
+
port: number;
|
|
137
|
+
public: boolean;
|
|
138
|
+
protocol: "tcp";
|
|
139
|
+
}>>>>;
|
|
140
|
+
worktree: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
141
|
+
label: z.ZodReadonly<z.ZodObject<{
|
|
142
|
+
project: z.ZodString;
|
|
143
|
+
checkout: z.ZodExactOptional<z.ZodString>;
|
|
144
|
+
id: z.ZodString;
|
|
145
|
+
fullLabel: z.ZodString;
|
|
146
|
+
}, z.core.$strict>>;
|
|
147
|
+
}, z.core.$strict>>>;
|
|
148
|
+
oauth: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
149
|
+
hostname: z.ZodString;
|
|
150
|
+
url: z.ZodTemplateLiteral<`https://${string}`>;
|
|
151
|
+
}, z.core.$strict>>>;
|
|
152
|
+
webhooks: z.ZodOptional<z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodReadonly<z.ZodObject<{
|
|
153
|
+
hostname: z.ZodString;
|
|
154
|
+
url: z.ZodTemplateLiteral<`https://${string}`>;
|
|
155
|
+
service: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"">]>;
|
|
156
|
+
path: z.ZodTemplateLiteral<`/${string}`>;
|
|
157
|
+
methods: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
158
|
+
DELETE: "DELETE";
|
|
159
|
+
GET: "GET";
|
|
160
|
+
HEAD: "HEAD";
|
|
161
|
+
OPTIONS: "OPTIONS";
|
|
162
|
+
PATCH: "PATCH";
|
|
163
|
+
POST: "POST";
|
|
164
|
+
PUT: "PUT";
|
|
165
|
+
}>>>;
|
|
166
|
+
}, z.core.$strict>>>, z.ZodTransform<Readonly<Record<string, Readonly<{
|
|
167
|
+
hostname: string;
|
|
168
|
+
url: `https://${string}`;
|
|
169
|
+
service: string;
|
|
170
|
+
path: `/${string}`;
|
|
171
|
+
methods: readonly ("DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT")[];
|
|
172
|
+
}> | undefined>>, Record<string, Readonly<{
|
|
173
|
+
hostname: string;
|
|
174
|
+
url: `https://${string}`;
|
|
175
|
+
service: string;
|
|
176
|
+
path: `/${string}`;
|
|
177
|
+
methods: readonly ("DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT")[];
|
|
178
|
+
}>>>>>;
|
|
179
|
+
aliases: z.ZodOptional<z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodReadonly<z.ZodObject<{
|
|
180
|
+
hostname: z.ZodString;
|
|
181
|
+
url: z.ZodTemplateLiteral<`https://${string}`>;
|
|
182
|
+
service: z.ZodString;
|
|
183
|
+
}, z.core.$strict>>>, z.ZodTransform<Readonly<Record<string, Readonly<{
|
|
184
|
+
hostname: string;
|
|
185
|
+
url: `https://${string}`;
|
|
186
|
+
service: string;
|
|
187
|
+
}> | undefined>>, Record<string, Readonly<{
|
|
188
|
+
hostname: string;
|
|
189
|
+
url: `https://${string}`;
|
|
190
|
+
service: string;
|
|
191
|
+
}>>>>>;
|
|
192
|
+
dev: z.ZodBoolean;
|
|
193
|
+
}, z.core.$strict>>;
|
|
194
|
+
}, z.core.$strict>, z.ZodTransform<{
|
|
195
|
+
registrationID: `reg_${string}` & z.$brand<"RegistrationID">;
|
|
196
|
+
service: string;
|
|
197
|
+
hostname: string | undefined;
|
|
198
|
+
publicURL: `https://${string}` | undefined;
|
|
199
|
+
project: Readonly<{
|
|
200
|
+
namespace: string;
|
|
201
|
+
services: Readonly<Record<string, Readonly<{
|
|
202
|
+
namespace: string;
|
|
203
|
+
hostname: string;
|
|
204
|
+
port: number;
|
|
205
|
+
public: boolean;
|
|
206
|
+
protocol: "http";
|
|
207
|
+
url: `https://${string}`;
|
|
208
|
+
paths?: Readonly<Record<string, Readonly<{
|
|
209
|
+
service: string;
|
|
210
|
+
url: `https://${string}`;
|
|
211
|
+
stripPrefix: boolean;
|
|
212
|
+
}> | undefined>> | undefined;
|
|
213
|
+
}> | Readonly<{
|
|
214
|
+
namespace: string;
|
|
215
|
+
hostname: string;
|
|
216
|
+
port: number;
|
|
217
|
+
public: boolean;
|
|
218
|
+
protocol: "kubernetes";
|
|
219
|
+
url: `https://${string}`;
|
|
220
|
+
}> | Readonly<{
|
|
221
|
+
namespace: string;
|
|
222
|
+
hostname: string;
|
|
223
|
+
port: number;
|
|
224
|
+
public: boolean;
|
|
225
|
+
protocol: "postgres";
|
|
226
|
+
}> | Readonly<{
|
|
227
|
+
namespace: string;
|
|
228
|
+
hostname: string;
|
|
229
|
+
port: number;
|
|
230
|
+
public: boolean;
|
|
231
|
+
protocol: "mysql";
|
|
232
|
+
}> | Readonly<{
|
|
233
|
+
namespace: string;
|
|
234
|
+
hostname: string;
|
|
235
|
+
port: number;
|
|
236
|
+
public: boolean;
|
|
237
|
+
protocol: "tcp";
|
|
238
|
+
}> | undefined>>;
|
|
239
|
+
worktree?: Readonly<{
|
|
240
|
+
label: Readonly<{
|
|
241
|
+
project: string;
|
|
242
|
+
checkout?: string;
|
|
243
|
+
id: string;
|
|
244
|
+
fullLabel: string;
|
|
245
|
+
}>;
|
|
246
|
+
}> | undefined;
|
|
247
|
+
oauth?: Readonly<{
|
|
248
|
+
hostname: string;
|
|
249
|
+
url: `https://${string}`;
|
|
250
|
+
}> | undefined;
|
|
251
|
+
webhooks?: Readonly<Record<string, Readonly<{
|
|
252
|
+
hostname: string;
|
|
253
|
+
url: `https://${string}`;
|
|
254
|
+
service: string;
|
|
255
|
+
path: `/${string}`;
|
|
256
|
+
methods: readonly ("DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT")[];
|
|
257
|
+
}> | undefined>> | undefined;
|
|
258
|
+
aliases?: Readonly<Record<string, Readonly<{
|
|
259
|
+
hostname: string;
|
|
260
|
+
url: `https://${string}`;
|
|
261
|
+
service: string;
|
|
262
|
+
}> | undefined>> | undefined;
|
|
263
|
+
dev: boolean;
|
|
264
|
+
}>;
|
|
265
|
+
}, {
|
|
266
|
+
version: 1;
|
|
267
|
+
registration_id: `reg_${string}` & z.$brand<"RegistrationID">;
|
|
268
|
+
service: string;
|
|
269
|
+
hostname: string;
|
|
270
|
+
public_url: "" | `https://${string}`;
|
|
271
|
+
project: Readonly<{
|
|
272
|
+
namespace: string;
|
|
273
|
+
services: Readonly<Record<string, Readonly<{
|
|
274
|
+
namespace: string;
|
|
275
|
+
hostname: string;
|
|
276
|
+
port: number;
|
|
277
|
+
public: boolean;
|
|
278
|
+
protocol: "http";
|
|
279
|
+
url: `https://${string}`;
|
|
280
|
+
paths?: Readonly<Record<string, Readonly<{
|
|
281
|
+
service: string;
|
|
282
|
+
url: `https://${string}`;
|
|
283
|
+
stripPrefix: boolean;
|
|
284
|
+
}> | undefined>> | undefined;
|
|
285
|
+
}> | Readonly<{
|
|
286
|
+
namespace: string;
|
|
287
|
+
hostname: string;
|
|
288
|
+
port: number;
|
|
289
|
+
public: boolean;
|
|
290
|
+
protocol: "kubernetes";
|
|
291
|
+
url: `https://${string}`;
|
|
292
|
+
}> | Readonly<{
|
|
293
|
+
namespace: string;
|
|
294
|
+
hostname: string;
|
|
295
|
+
port: number;
|
|
296
|
+
public: boolean;
|
|
297
|
+
protocol: "postgres";
|
|
298
|
+
}> | Readonly<{
|
|
299
|
+
namespace: string;
|
|
300
|
+
hostname: string;
|
|
301
|
+
port: number;
|
|
302
|
+
public: boolean;
|
|
303
|
+
protocol: "mysql";
|
|
304
|
+
}> | Readonly<{
|
|
305
|
+
namespace: string;
|
|
306
|
+
hostname: string;
|
|
307
|
+
port: number;
|
|
308
|
+
public: boolean;
|
|
309
|
+
protocol: "tcp";
|
|
310
|
+
}> | undefined>>;
|
|
311
|
+
worktree?: Readonly<{
|
|
312
|
+
label: Readonly<{
|
|
313
|
+
project: string;
|
|
314
|
+
checkout?: string;
|
|
315
|
+
id: string;
|
|
316
|
+
fullLabel: string;
|
|
317
|
+
}>;
|
|
318
|
+
}> | undefined;
|
|
319
|
+
oauth?: Readonly<{
|
|
320
|
+
hostname: string;
|
|
321
|
+
url: `https://${string}`;
|
|
322
|
+
}> | undefined;
|
|
323
|
+
webhooks?: Readonly<Record<string, Readonly<{
|
|
324
|
+
hostname: string;
|
|
325
|
+
url: `https://${string}`;
|
|
326
|
+
service: string;
|
|
327
|
+
path: `/${string}`;
|
|
328
|
+
methods: readonly ("DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT")[];
|
|
329
|
+
}> | undefined>> | undefined;
|
|
330
|
+
aliases?: Readonly<Record<string, Readonly<{
|
|
331
|
+
hostname: string;
|
|
332
|
+
url: `https://${string}`;
|
|
333
|
+
service: string;
|
|
334
|
+
}> | undefined>> | undefined;
|
|
335
|
+
dev: boolean;
|
|
336
|
+
}>;
|
|
337
|
+
}>>>;
|
|
338
|
+
export type Assignment = z.output<typeof assignmentSchema>;
|
|
339
|
+
export declare function parseAssignment(value: unknown): Assignment;
|
|
340
|
+
type Registration = {
|
|
341
|
+
readonly version: 1;
|
|
342
|
+
readonly registration_id: string;
|
|
343
|
+
readonly owner: string;
|
|
344
|
+
readonly target?: string;
|
|
345
|
+
};
|
|
346
|
+
type Acquisition = {
|
|
347
|
+
readonly kind: "configured";
|
|
348
|
+
readonly request: Readonly<{
|
|
349
|
+
owner: string;
|
|
350
|
+
[key: string]: unknown;
|
|
351
|
+
}>;
|
|
352
|
+
readonly target?: string;
|
|
353
|
+
} | {
|
|
354
|
+
readonly kind: "invocation";
|
|
355
|
+
readonly request: Readonly<{
|
|
356
|
+
owner: string;
|
|
357
|
+
target: string;
|
|
358
|
+
[key: string]: unknown;
|
|
359
|
+
}>;
|
|
360
|
+
};
|
|
361
|
+
export declare function recoverableRegistration(cause: unknown): boolean;
|
|
362
|
+
export declare function publicationCleanupFailed(cause: unknown): boolean;
|
|
363
|
+
export declare class NativeRegistration {
|
|
364
|
+
private currentEndpoint;
|
|
365
|
+
private current;
|
|
366
|
+
private uncertain;
|
|
367
|
+
private unregisterReplyLost;
|
|
368
|
+
private readonly acquisition;
|
|
369
|
+
private readonly runtime;
|
|
370
|
+
private readonly directory;
|
|
371
|
+
private readonly selection;
|
|
372
|
+
constructor(runtime: RegistrationRuntime, directory: string, selection: EndpointSelection, acquisition: Acquisition);
|
|
373
|
+
get endpoint(): RuntimeEndpoint;
|
|
374
|
+
get registration(): Registration | undefined;
|
|
375
|
+
discover(signal?: AbortSignal): Promise<void>;
|
|
376
|
+
acquire(signal?: AbortSignal): Promise<Assignment | undefined>;
|
|
377
|
+
bind(target: string, signal?: AbortSignal): Promise<void>;
|
|
378
|
+
renew(signal?: AbortSignal, certificate?: ServiceCertificate): Promise<void>;
|
|
379
|
+
status(signal?: AbortSignal): Promise<unknown>;
|
|
380
|
+
exportCertificate(signal: AbortSignal): Promise<ExportedCertificate>;
|
|
381
|
+
unregister(budget: RegistrationShutdown, retry?: {
|
|
382
|
+
readonly pause: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
|
|
383
|
+
}): Promise<void>;
|
|
384
|
+
}
|
|
385
|
+
export {};
|