@camstack/core 0.1.37 → 0.1.38
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/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.d.ts +7 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.d.ts.map +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +46 -56
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js.map +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +47 -57
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs.map +1 -1
- package/dist/index.js +10 -138
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -138
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -37
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.d.ts +0 -8
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.d.ts.map +0 -1
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.js +0 -75
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.js.map +0 -1
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.mjs +0 -69
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.mjs.map +0 -1
- package/dist/builtins/auth-orchestrator/index.d.ts +0 -2
- package/dist/builtins/auth-orchestrator/index.d.ts.map +0 -1
- package/dist/builtins/auth-orchestrator/index.js +0 -7
- package/dist/builtins/auth-orchestrator/index.mjs +0 -2
- package/dist/builtins/mesh-orchestrator/index.d.ts +0 -2
- package/dist/builtins/mesh-orchestrator/index.d.ts.map +0 -1
- package/dist/builtins/mesh-orchestrator/index.js +0 -7
- package/dist/builtins/mesh-orchestrator/index.mjs +0 -2
- package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.d.ts +0 -9
- package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.d.ts.map +0 -1
- package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.js +0 -113
- package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.js.map +0 -1
- package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.mjs +0 -107
- package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.mjs.map +0 -1
- package/dist/builtins/turn-orchestrator/index.d.ts +0 -2
- package/dist/builtins/turn-orchestrator/index.d.ts.map +0 -1
- package/dist/builtins/turn-orchestrator/index.js +0 -7
- package/dist/builtins/turn-orchestrator/index.mjs +0 -2
- package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.d.ts +0 -34
- package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.d.ts.map +0 -1
- package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.js +0 -126
- package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.js.map +0 -1
- package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.mjs +0 -120
- package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|
|
@@ -225,30 +225,6 @@
|
|
|
225
225
|
}
|
|
226
226
|
]
|
|
227
227
|
},
|
|
228
|
-
{
|
|
229
|
-
"id": "auth-orchestrator",
|
|
230
|
-
"name": "Authentication Orchestrator",
|
|
231
|
-
"description": "Hub-only singleton facade over the auth-provider collection. Surfaces a unified provider list to the admin UI's Authentication page and the login screen's provider picker.",
|
|
232
|
-
"entry": "./dist/builtins/auth-orchestrator/index.js",
|
|
233
|
-
"protected": true,
|
|
234
|
-
"capabilities": [
|
|
235
|
-
{
|
|
236
|
-
"name": "authentication"
|
|
237
|
-
}
|
|
238
|
-
]
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
"id": "mesh-orchestrator",
|
|
242
|
-
"name": "Mesh Orchestrator",
|
|
243
|
-
"description": "Hub-only singleton facade over the mesh-network collection. Aggregates Tailscale / Headscale / ZeroTier providers for the admin UI's Mesh Networks page.",
|
|
244
|
-
"entry": "./dist/builtins/mesh-orchestrator/index.js",
|
|
245
|
-
"protected": true,
|
|
246
|
-
"capabilities": [
|
|
247
|
-
{
|
|
248
|
-
"name": "mesh-orchestrator"
|
|
249
|
-
}
|
|
250
|
-
]
|
|
251
|
-
},
|
|
252
228
|
{
|
|
253
229
|
"id": "remote-access-orchestrator",
|
|
254
230
|
"name": "Remote Access Orchestrator",
|
|
@@ -260,18 +236,6 @@
|
|
|
260
236
|
"name": "remote-access"
|
|
261
237
|
}
|
|
262
238
|
]
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
"id": "turn-orchestrator",
|
|
266
|
-
"name": "TURN Orchestrator",
|
|
267
|
-
"description": "Hub-only singleton facade over the turn-provider collection. Aggregates ICE servers from all enabled TURN providers; consumed by the WebRTC layer at session creation.",
|
|
268
|
-
"entry": "./dist/builtins/turn-orchestrator/index.js",
|
|
269
|
-
"protected": true,
|
|
270
|
-
"capabilities": [
|
|
271
|
-
{
|
|
272
|
-
"name": "turn-orchestrator"
|
|
273
|
-
}
|
|
274
|
-
]
|
|
275
239
|
}
|
|
276
240
|
]
|
|
277
241
|
},
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { BaseAddon, ProviderRegistration } from '@camstack/types';
|
|
2
|
-
export declare class AuthOrchestratorAddon extends BaseAddon<Record<string, never>> {
|
|
3
|
-
constructor();
|
|
4
|
-
protected onInitialize(): Promise<ProviderRegistration[]>;
|
|
5
|
-
private listProviders;
|
|
6
|
-
}
|
|
7
|
-
export default AuthOrchestratorAddon;
|
|
8
|
-
//# sourceMappingURL=auth-orchestrator.addon.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-orchestrator.addon.d.ts","sourceRoot":"","sources":["../../../src/builtins/auth-orchestrator/auth-orchestrator.addon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EACL,SAAS,EAIT,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAA;AA4BxB,qBAAa,qBAAsB,SAAQ,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;;cAKzD,YAAY,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;YAgBjD,aAAa;CAoC5B;AAED,eAAe,qBAAqB,CAAA"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
require("../../chunk-C13QxCFV.js");
|
|
6
|
-
let _camstack_types = require("@camstack/types");
|
|
7
|
-
//#region src/builtins/auth-orchestrator/auth-orchestrator.addon.ts
|
|
8
|
-
/**
|
|
9
|
-
* Authentication orchestrator — singleton facade over the
|
|
10
|
-
* `auth-provider` collection. Mirrors the backup-orchestrator pattern:
|
|
11
|
-
* UI consumers go through this builtin, which walks the
|
|
12
|
-
* `auth-provider` collection registered by `local-auth` and any
|
|
13
|
-
* additional `auth-*` addons (OIDC, SAML, LDAP, …) and returns a
|
|
14
|
-
* curated view.
|
|
15
|
-
*
|
|
16
|
-
* The actual login flow still goes through `auth-provider`
|
|
17
|
-
* collection methods (validateCredentials / getLoginUrl / …); this
|
|
18
|
-
* cap exists so the admin UI's "Authentication" page and the login
|
|
19
|
-
* screen's provider picker have ONE place to query instead of
|
|
20
|
-
* walking the collection themselves.
|
|
21
|
-
*/
|
|
22
|
-
var AuthOrchestratorAddon = class extends _camstack_types.BaseAddon {
|
|
23
|
-
constructor() {
|
|
24
|
-
super({});
|
|
25
|
-
}
|
|
26
|
-
async onInitialize() {
|
|
27
|
-
const provider = {
|
|
28
|
-
listProviders: async () => this.listProviders(),
|
|
29
|
-
setProviderEnabled: async () => {
|
|
30
|
-
return { success: true };
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
this.ctx.logger.info("Authentication orchestrator initialized");
|
|
34
|
-
return [{
|
|
35
|
-
capability: _camstack_types.authenticationCapability,
|
|
36
|
-
provider
|
|
37
|
-
}];
|
|
38
|
-
}
|
|
39
|
-
async listProviders() {
|
|
40
|
-
const entries = this.capabilities?.getCollectionEntries("auth-provider") ?? [];
|
|
41
|
-
const out = [];
|
|
42
|
-
for (const [addonId, raw] of entries) {
|
|
43
|
-
if (raw?.instances && raw.instances.length > 0) {
|
|
44
|
-
for (const inst of raw.instances) out.push({
|
|
45
|
-
addonId: raw.addonId ?? addonId,
|
|
46
|
-
instanceId: inst.instanceId,
|
|
47
|
-
displayName: inst.displayName,
|
|
48
|
-
...inst.icon !== void 0 ? { icon: inst.icon } : {},
|
|
49
|
-
hasRedirectFlow: inst.hasRedirectFlow,
|
|
50
|
-
hasCredentialFlow: inst.hasCredentialFlow,
|
|
51
|
-
...inst.kind !== void 0 ? { kind: inst.kind } : {},
|
|
52
|
-
...inst.status !== void 0 ? { status: inst.status } : {},
|
|
53
|
-
enabled: true
|
|
54
|
-
});
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
out.push({
|
|
58
|
-
addonId: raw?.addonId ?? addonId,
|
|
59
|
-
displayName: raw?.displayName ?? addonId,
|
|
60
|
-
...raw?.icon !== void 0 ? { icon: raw.icon } : {},
|
|
61
|
-
hasRedirectFlow: raw?.hasRedirectFlow ?? false,
|
|
62
|
-
hasCredentialFlow: raw?.hasCredentialFlow ?? addonId === "local-auth",
|
|
63
|
-
...raw?.kind !== void 0 ? { kind: raw.kind } : {},
|
|
64
|
-
...raw?.status !== void 0 ? { status: raw.status } : {},
|
|
65
|
-
enabled: true
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
return out;
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
//#endregion
|
|
72
|
-
exports.AuthOrchestratorAddon = AuthOrchestratorAddon;
|
|
73
|
-
exports.default = AuthOrchestratorAddon;
|
|
74
|
-
|
|
75
|
-
//# sourceMappingURL=auth-orchestrator.addon.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-orchestrator.addon.js","names":[],"sources":["../../../src/builtins/auth-orchestrator/auth-orchestrator.addon.ts"],"sourcesContent":["/**\n * Authentication orchestrator — singleton facade over the\n * `auth-provider` collection. Mirrors the backup-orchestrator pattern:\n * UI consumers go through this builtin, which walks the\n * `auth-provider` collection registered by `local-auth` and any\n * additional `auth-*` addons (OIDC, SAML, LDAP, …) and returns a\n * curated view.\n *\n * The actual login flow still goes through `auth-provider`\n * collection methods (validateCredentials / getLoginUrl / …); this\n * cap exists so the admin UI's \"Authentication\" page and the login\n * screen's provider picker have ONE place to query instead of\n * walking the collection themselves.\n */\nimport {\n BaseAddon,\n authenticationCapability,\n type AuthProviderInfo,\n type IAuthenticationProvider,\n type ProviderRegistration,\n} from '@camstack/types'\n\ninterface AuthProviderRegistrationLike {\n readonly addonId?: string\n readonly displayName?: string\n readonly icon?: string\n readonly hasRedirectFlow?: boolean\n readonly hasCredentialFlow?: boolean\n readonly kind?: string\n readonly status?: string\n /**\n * Multi-instance fan-out. When set, the orchestrator emits ONE\n * AuthProviderInfo per entry instead of a single one for the\n * collection entry. Used by addons that host multiple logical IdPs\n * within a single install (the OIDC addon supports Google +\n * Microsoft + custom from one installation).\n */\n readonly instances?: ReadonlyArray<{\n readonly instanceId: string\n readonly displayName: string\n readonly icon?: string\n readonly hasRedirectFlow: boolean\n readonly hasCredentialFlow: boolean\n readonly kind?: string\n readonly status?: string\n }>\n}\n\nexport class AuthOrchestratorAddon extends BaseAddon<Record<string, never>> {\n constructor() {\n super({})\n }\n\n protected async onInitialize(): Promise<ProviderRegistration[]> {\n const provider: IAuthenticationProvider = {\n listProviders: async () => this.listProviders(),\n setProviderEnabled: async () => {\n // Persistence is per-addon today — operators toggle enabled\n // via the provider addon's own settings panel. The orchestrator\n // exposes the affordance for forward-compat (UI may move the\n // enabled toggle into the Authentication page later) but\n // currently no-ops the persistence side.\n return { success: true as const }\n },\n }\n this.ctx.logger.info('Authentication orchestrator initialized')\n return [{ capability: authenticationCapability, provider }]\n }\n\n private async listProviders(): Promise<readonly AuthProviderInfo[]> {\n const entries = this.capabilities?.getCollectionEntries<AuthProviderRegistrationLike>('auth-provider') ?? []\n const out: AuthProviderInfo[] = []\n for (const [addonId, raw] of entries) {\n // Multi-instance: emit one entry per declared instance, preserving\n // the parent `addonId` so the login URL keeps `/addon/<addonId>/...`\n // while adding the `instanceId` path segment downstream.\n if (raw?.instances && raw.instances.length > 0) {\n for (const inst of raw.instances) {\n out.push({\n addonId: raw.addonId ?? addonId,\n instanceId: inst.instanceId,\n displayName: inst.displayName,\n ...(inst.icon !== undefined ? { icon: inst.icon } : {}),\n hasRedirectFlow: inst.hasRedirectFlow,\n hasCredentialFlow: inst.hasCredentialFlow,\n ...(inst.kind !== undefined ? { kind: inst.kind } : {}),\n ...(inst.status !== undefined ? { status: inst.status } : {}),\n enabled: true,\n })\n }\n continue\n }\n out.push({\n addonId: raw?.addonId ?? addonId,\n displayName: raw?.displayName ?? addonId,\n ...(raw?.icon !== undefined ? { icon: raw.icon } : {}),\n hasRedirectFlow: raw?.hasRedirectFlow ?? false,\n hasCredentialFlow: raw?.hasCredentialFlow ?? (addonId === 'local-auth'),\n ...(raw?.kind !== undefined ? { kind: raw.kind } : {}),\n ...(raw?.status !== undefined ? { status: raw.status } : {}),\n enabled: true,\n })\n }\n return out\n }\n}\n\nexport default AuthOrchestratorAddon\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgDA,IAAa,wBAAb,cAA2C,gBAAA,UAAiC;CAC1E,cAAc;EACZ,MAAM,EAAE,CAAC;;CAGX,MAAgB,eAAgD;EAC9D,MAAM,WAAoC;GACxC,eAAe,Y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/types";
|
|
2
|
-
//#region src/builtins/auth-orchestrator/auth-orchestrator.addon.ts
|
|
3
|
-
/**
|
|
4
|
-
* Authentication orchestrator — singleton facade over the
|
|
5
|
-
* `auth-provider` collection. Mirrors the backup-orchestrator pattern:
|
|
6
|
-
* UI consumers go through this builtin, which walks the
|
|
7
|
-
* `auth-provider` collection registered by `local-auth` and any
|
|
8
|
-
* additional `auth-*` addons (OIDC, SAML, LDAP, …) and returns a
|
|
9
|
-
* curated view.
|
|
10
|
-
*
|
|
11
|
-
* The actual login flow still goes through `auth-provider`
|
|
12
|
-
* collection methods (validateCredentials / getLoginUrl / …); this
|
|
13
|
-
* cap exists so the admin UI's "Authentication" page and the login
|
|
14
|
-
* screen's provider picker have ONE place to query instead of
|
|
15
|
-
* walking the collection themselves.
|
|
16
|
-
*/
|
|
17
|
-
var AuthOrchestratorAddon = class extends BaseAddon {
|
|
18
|
-
constructor() {
|
|
19
|
-
super({});
|
|
20
|
-
}
|
|
21
|
-
async onInitialize() {
|
|
22
|
-
const provider = {
|
|
23
|
-
listProviders: async () => this.listProviders(),
|
|
24
|
-
setProviderEnabled: async () => {
|
|
25
|
-
return { success: true };
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
this.ctx.logger.info("Authentication orchestrator initialized");
|
|
29
|
-
return [{
|
|
30
|
-
capability: authenticationCapability,
|
|
31
|
-
provider
|
|
32
|
-
}];
|
|
33
|
-
}
|
|
34
|
-
async listProviders() {
|
|
35
|
-
const entries = this.capabilities?.getCollectionEntries("auth-provider") ?? [];
|
|
36
|
-
const out = [];
|
|
37
|
-
for (const [addonId, raw] of entries) {
|
|
38
|
-
if (raw?.instances && raw.instances.length > 0) {
|
|
39
|
-
for (const inst of raw.instances) out.push({
|
|
40
|
-
addonId: raw.addonId ?? addonId,
|
|
41
|
-
instanceId: inst.instanceId,
|
|
42
|
-
displayName: inst.displayName,
|
|
43
|
-
...inst.icon !== void 0 ? { icon: inst.icon } : {},
|
|
44
|
-
hasRedirectFlow: inst.hasRedirectFlow,
|
|
45
|
-
hasCredentialFlow: inst.hasCredentialFlow,
|
|
46
|
-
...inst.kind !== void 0 ? { kind: inst.kind } : {},
|
|
47
|
-
...inst.status !== void 0 ? { status: inst.status } : {},
|
|
48
|
-
enabled: true
|
|
49
|
-
});
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
out.push({
|
|
53
|
-
addonId: raw?.addonId ?? addonId,
|
|
54
|
-
displayName: raw?.displayName ?? addonId,
|
|
55
|
-
...raw?.icon !== void 0 ? { icon: raw.icon } : {},
|
|
56
|
-
hasRedirectFlow: raw?.hasRedirectFlow ?? false,
|
|
57
|
-
hasCredentialFlow: raw?.hasCredentialFlow ?? addonId === "local-auth",
|
|
58
|
-
...raw?.kind !== void 0 ? { kind: raw.kind } : {},
|
|
59
|
-
...raw?.status !== void 0 ? { status: raw.status } : {},
|
|
60
|
-
enabled: true
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
return out;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
//#endregion
|
|
67
|
-
export { AuthOrchestratorAddon, AuthOrchestratorAddon as default };
|
|
68
|
-
|
|
69
|
-
//# sourceMappingURL=auth-orchestrator.addon.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-orchestrator.addon.mjs","names":[],"sources":["../../../src/builtins/auth-orchestrator/auth-orchestrator.addon.ts"],"sourcesContent":["/**\n * Authentication orchestrator — singleton facade over the\n * `auth-provider` collection. Mirrors the backup-orchestrator pattern:\n * UI consumers go through this builtin, which walks the\n * `auth-provider` collection registered by `local-auth` and any\n * additional `auth-*` addons (OIDC, SAML, LDAP, …) and returns a\n * curated view.\n *\n * The actual login flow still goes through `auth-provider`\n * collection methods (validateCredentials / getLoginUrl / …); this\n * cap exists so the admin UI's \"Authentication\" page and the login\n * screen's provider picker have ONE place to query instead of\n * walking the collection themselves.\n */\nimport {\n BaseAddon,\n authenticationCapability,\n type AuthProviderInfo,\n type IAuthenticationProvider,\n type ProviderRegistration,\n} from '@camstack/types'\n\ninterface AuthProviderRegistrationLike {\n readonly addonId?: string\n readonly displayName?: string\n readonly icon?: string\n readonly hasRedirectFlow?: boolean\n readonly hasCredentialFlow?: boolean\n readonly kind?: string\n readonly status?: string\n /**\n * Multi-instance fan-out. When set, the orchestrator emits ONE\n * AuthProviderInfo per entry instead of a single one for the\n * collection entry. Used by addons that host multiple logical IdPs\n * within a single install (the OIDC addon supports Google +\n * Microsoft + custom from one installation).\n */\n readonly instances?: ReadonlyArray<{\n readonly instanceId: string\n readonly displayName: string\n readonly icon?: string\n readonly hasRedirectFlow: boolean\n readonly hasCredentialFlow: boolean\n readonly kind?: string\n readonly status?: string\n }>\n}\n\nexport class AuthOrchestratorAddon extends BaseAddon<Record<string, never>> {\n constructor() {\n super({})\n }\n\n protected async onInitialize(): Promise<ProviderRegistration[]> {\n const provider: IAuthenticationProvider = {\n listProviders: async () => this.listProviders(),\n setProviderEnabled: async () => {\n // Persistence is per-addon today — operators toggle enabled\n // via the provider addon's own settings panel. The orchestrator\n // exposes the affordance for forward-compat (UI may move the\n // enabled toggle into the Authentication page later) but\n // currently no-ops the persistence side.\n return { success: true as const }\n },\n }\n this.ctx.logger.info('Authentication orchestrator initialized')\n return [{ capability: authenticationCapability, provider }]\n }\n\n private async listProviders(): Promise<readonly AuthProviderInfo[]> {\n const entries = this.capabilities?.getCollectionEntries<AuthProviderRegistrationLike>('auth-provider') ?? []\n const out: AuthProviderInfo[] = []\n for (const [addonId, raw] of entries) {\n // Multi-instance: emit one entry per declared instance, preserving\n // the parent `addonId` so the login URL keeps `/addon/<addonId>/...`\n // while adding the `instanceId` path segment downstream.\n if (raw?.instances && raw.instances.length > 0) {\n for (const inst of raw.instances) {\n out.push({\n addonId: raw.addonId ?? addonId,\n instanceId: inst.instanceId,\n displayName: inst.displayName,\n ...(inst.icon !== undefined ? { icon: inst.icon } : {}),\n hasRedirectFlow: inst.hasRedirectFlow,\n hasCredentialFlow: inst.hasCredentialFlow,\n ...(inst.kind !== undefined ? { kind: inst.kind } : {}),\n ...(inst.status !== undefined ? { status: inst.status } : {}),\n enabled: true,\n })\n }\n continue\n }\n out.push({\n addonId: raw?.addonId ?? addonId,\n displayName: raw?.displayName ?? addonId,\n ...(raw?.icon !== undefined ? { icon: raw.icon } : {}),\n hasRedirectFlow: raw?.hasRedirectFlow ?? false,\n hasCredentialFlow: raw?.hasCredentialFlow ?? (addonId === 'local-auth'),\n ...(raw?.kind !== undefined ? { kind: raw.kind } : {}),\n ...(raw?.status !== undefined ? { status: raw.status } : {}),\n enabled: true,\n })\n }\n return out\n }\n}\n\nexport default AuthOrchestratorAddon\n"],"mappings":";;;;;;;;;;;;;;;;AAgDA,IAAa,wBAAb,cAA2C,UAAiC;CAC1E,cAAc;EACZ,MAAM,EAAE,CAAC;;CAGX,MAAgB,eAAgD;EAC9D,MAAM,WAAoC;GACxC,eAAe,YAAY,KAAK,eAAe;GAC/C,oBAAoB,YAAY;IAM9B,OAAO,EAAE,SAAS,MAAe;;GAEpC;EACD,KAAK,IAAI,OAAO,KAAK,0CAA0C;EAC/D,OAAO,CAAC;GAAE,YAAY;GAA0B;GAAU,CAAC;;CAG7D,MAAc,gBAAsD;EAClE,MAAM,UAAU,KAAK,cAAc,qBAAmD,gBAAgB,IAAI,EAAE;EAC5G,MAAM,MAA0B,EAAE;EAClC,KAAK,MAAM,CAAC,SAAS,QAAQ,SAAS;GAIpC,IAAI,KAAK,aAAa,IAAI,UAAU,SAAS,GAAG;IAC9C,KAAK,MAAM,QAAQ,IAAI,WACrB,IAAI,KAAK;KACP,SAAS,IAAI,WAAW;KACxB,YAAY,KAAK;KACjB,aAAa,KAAK;KAClB,GAAI,KAAK,SAAS,KAAA,IAAY,EAAE,MAAM,KAAK,MAAM,GAAG,EAAE;KACtD,iBAAiB,KAAK;KACtB,mBAAmB,KAAK;KACxB,GAAI,KAAK,SAAS,KAAA,IAAY,EAAE,MAAM,KAAK,MAAM,GAAG,EAAE;KACtD,GAAI,KAAK,WAAW,KAAA,IAAY,EAAE,QAAQ,KAAK,QAAQ,GAAG,EAAE;KAC5D,SAAS;KACV,CAAC;IAEJ;;GAEF,IAAI,KAAK;IACP,SAAS,KAAK,WAAW;IACzB,aAAa,KAAK,eAAe;IACjC,GAAI,KAAK,SAAS,KAAA,IAAY,EAAE,MAAM,IAAI,MAAM,GAAG,EAAE;IACrD,iBAAiB,KAAK,mBAAmB;IACzC,mBAAmB,KAAK,qBAAsB,YAAY;IAC1D,GAAI,KAAK,SAAS,KAAA,IAAY,EAAE,MAAM,IAAI,MAAM,GAAG,EAAE;IACrD,GAAI,KAAK,WAAW,KAAA,IAAY,EAAE,QAAQ,IAAI,QAAQ,GAAG,EAAE;IAC3D,SAAS;IACV,CAAC;;EAEJ,OAAO"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/builtins/auth-orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_builtins_auth_orchestrator_auth_orchestrator_addon = require("./auth-orchestrator.addon.js");
|
|
6
|
-
exports.AuthOrchestratorAddon = require_builtins_auth_orchestrator_auth_orchestrator_addon.AuthOrchestratorAddon;
|
|
7
|
-
exports.default = require_builtins_auth_orchestrator_auth_orchestrator_addon.AuthOrchestratorAddon;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/builtins/mesh-orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_builtins_mesh_orchestrator_mesh_orchestrator_addon = require("./mesh-orchestrator.addon.js");
|
|
6
|
-
exports.MeshOrchestratorAddon = require_builtins_mesh_orchestrator_mesh_orchestrator_addon.MeshOrchestratorAddon;
|
|
7
|
-
exports.default = require_builtins_mesh_orchestrator_mesh_orchestrator_addon.MeshOrchestratorAddon;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { BaseAddon, ProviderRegistration } from '@camstack/types';
|
|
2
|
-
export declare class MeshOrchestratorAddon extends BaseAddon<Record<string, never>> {
|
|
3
|
-
constructor();
|
|
4
|
-
protected onInitialize(): Promise<ProviderRegistration[]>;
|
|
5
|
-
private resolveImpl;
|
|
6
|
-
private listProviders;
|
|
7
|
-
}
|
|
8
|
-
export default MeshOrchestratorAddon;
|
|
9
|
-
//# sourceMappingURL=mesh-orchestrator.addon.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mesh-orchestrator.addon.d.ts","sourceRoot":"","sources":["../../../src/builtins/mesh-orchestrator/mesh-orchestrator.addon.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,SAAS,EAKT,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAA;AAqCxB,qBAAa,qBAAsB,SAAQ,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;;cAKzD,YAAY,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAsC/D,OAAO,CAAC,WAAW;YAML,aAAa;CAqD5B;AAED,eAAe,qBAAqB,CAAA"}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
require("../../chunk-C13QxCFV.js");
|
|
6
|
-
let _camstack_types = require("@camstack/types");
|
|
7
|
-
//#region src/builtins/mesh-orchestrator/mesh-orchestrator.addon.ts
|
|
8
|
-
/**
|
|
9
|
-
* Mesh orchestrator — singleton facade over the `mesh-network`
|
|
10
|
-
* collection. One row per provider (Tailscale, Headscale, ZeroTier),
|
|
11
|
-
* aggregated for the admin UI's Mesh Networks page.
|
|
12
|
-
*/
|
|
13
|
-
var MeshOrchestratorAddon = class extends _camstack_types.BaseAddon {
|
|
14
|
-
constructor() {
|
|
15
|
-
super({});
|
|
16
|
-
}
|
|
17
|
-
async onInitialize() {
|
|
18
|
-
const provider = {
|
|
19
|
-
listProviders: async () => this.listProviders(),
|
|
20
|
-
joinProvider: async ({ addonId, authKey, hostname }) => {
|
|
21
|
-
const impl = this.resolveImpl(addonId);
|
|
22
|
-
if (!impl?.join) throw new Error(`Mesh provider "${addonId}" does not support join`);
|
|
23
|
-
return await impl.join({
|
|
24
|
-
authKey,
|
|
25
|
-
...hostname ? { hostname } : {}
|
|
26
|
-
});
|
|
27
|
-
},
|
|
28
|
-
leaveProvider: async ({ addonId }) => {
|
|
29
|
-
const impl = this.resolveImpl(addonId);
|
|
30
|
-
if (impl?.leave) await impl.leave();
|
|
31
|
-
return { success: true };
|
|
32
|
-
},
|
|
33
|
-
startLoginProvider: async ({ addonId, hostname }) => {
|
|
34
|
-
const impl = this.resolveImpl(addonId);
|
|
35
|
-
if (!impl?.startLogin) throw new Error(`Mesh provider "${addonId}" does not support startLogin`);
|
|
36
|
-
return await impl.startLogin(hostname ? { hostname } : {});
|
|
37
|
-
},
|
|
38
|
-
logoutProvider: async ({ addonId }) => {
|
|
39
|
-
const impl = this.resolveImpl(addonId);
|
|
40
|
-
if (!impl?.logout) throw new Error(`Mesh provider "${addonId}" does not support logout`);
|
|
41
|
-
await impl.logout();
|
|
42
|
-
return { loggedOut: true };
|
|
43
|
-
},
|
|
44
|
-
listProviderPeers: async ({ addonId }) => {
|
|
45
|
-
const impl = this.resolveImpl(addonId);
|
|
46
|
-
if (!impl?.listPeers) return { peers: [] };
|
|
47
|
-
return await impl.listPeers();
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
this.ctx.logger.info("Mesh orchestrator initialized");
|
|
51
|
-
return [{
|
|
52
|
-
capability: _camstack_types.meshOrchestratorCapability,
|
|
53
|
-
provider
|
|
54
|
-
}];
|
|
55
|
-
}
|
|
56
|
-
resolveImpl(addonId) {
|
|
57
|
-
return (this.capabilities?.getCollectionEntries("mesh-network") ?? []).find(([id]) => id === addonId)?.[1] ?? null;
|
|
58
|
-
}
|
|
59
|
-
async listProviders() {
|
|
60
|
-
const entries = this.capabilities?.getCollectionEntries("mesh-network") ?? [];
|
|
61
|
-
const out = [];
|
|
62
|
-
for (const [addonId, impl] of entries) {
|
|
63
|
-
let joined = false;
|
|
64
|
-
let meshIp = "";
|
|
65
|
-
let magicDnsHostname = "";
|
|
66
|
-
let peerCount = 0;
|
|
67
|
-
let endpoints = [];
|
|
68
|
-
let error;
|
|
69
|
-
let tenantName = "";
|
|
70
|
-
let magicDnsSuffix = "";
|
|
71
|
-
let userLogin = null;
|
|
72
|
-
let controlPlaneUrl = "";
|
|
73
|
-
let keyExpiry = null;
|
|
74
|
-
if (impl.getStatus) try {
|
|
75
|
-
const s = await impl.getStatus();
|
|
76
|
-
joined = s.joined;
|
|
77
|
-
meshIp = s.meshIp;
|
|
78
|
-
magicDnsHostname = s.magicDnsHostname;
|
|
79
|
-
peerCount = s.peerCount;
|
|
80
|
-
endpoints = s.endpoints;
|
|
81
|
-
error = s.error;
|
|
82
|
-
tenantName = s.tenantName;
|
|
83
|
-
magicDnsSuffix = s.magicDnsSuffix;
|
|
84
|
-
userLogin = s.userLogin;
|
|
85
|
-
controlPlaneUrl = s.controlPlaneUrl;
|
|
86
|
-
keyExpiry = s.keyExpiry;
|
|
87
|
-
} catch (err) {
|
|
88
|
-
error = err instanceof Error ? err.message : String(err);
|
|
89
|
-
}
|
|
90
|
-
out.push({
|
|
91
|
-
addonId,
|
|
92
|
-
displayName: impl.displayName ?? addonId,
|
|
93
|
-
joined,
|
|
94
|
-
meshIp,
|
|
95
|
-
magicDnsHostname,
|
|
96
|
-
peerCount,
|
|
97
|
-
endpoints,
|
|
98
|
-
...error !== void 0 ? { error } : {},
|
|
99
|
-
tenantName,
|
|
100
|
-
magicDnsSuffix,
|
|
101
|
-
userLogin,
|
|
102
|
-
controlPlaneUrl,
|
|
103
|
-
keyExpiry
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
return out;
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
//#endregion
|
|
110
|
-
exports.MeshOrchestratorAddon = MeshOrchestratorAddon;
|
|
111
|
-
exports.default = MeshOrchestratorAddon;
|
|
112
|
-
|
|
113
|
-
//# sourceMappingURL=mesh-orchestrator.addon.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mesh-orchestrator.addon.js","names":[],"sources":["../../../src/builtins/mesh-orchestrator/mesh-orchestrator.addon.ts"],"sourcesContent":["/**\n * Mesh orchestrator — singleton facade over the `mesh-network`\n * collection. One row per provider (Tailscale, Headscale, ZeroTier),\n * aggregated for the admin UI's Mesh Networks page.\n */\nimport {\n BaseAddon,\n meshOrchestratorCapability,\n type IMeshOrchestrator,\n type MeshPeer,\n type MeshProviderInfo,\n type ProviderRegistration,\n} from '@camstack/types'\n\ninterface MeshStatusLike {\n joined: boolean\n meshIp: string\n magicDnsHostname: string\n peerCount: number\n endpoints: readonly {\n id: string\n label: string\n scope: 'mesh' | 'public'\n url: string\n hostname: string\n port: number\n protocol: 'http' | 'https'\n }[]\n error?: string\n tenantName: string\n magicDnsSuffix: string\n userLogin: string | null\n controlPlaneUrl: string\n keyExpiry: number | null\n}\n\ninterface MeshNetworkLike {\n getStatus?: () => Promise<MeshStatusLike>\n join?: (input: { authKey: string; hostname?: string }) => Promise<{ joined: true }>\n startLogin?: (input: { hostname?: string }) => Promise<{ loginUrl: string }>\n leave?: () => Promise<{ left: true }>\n logout?: () => Promise<{ loggedOut: true }>\n listPeers?: () => Promise<{ peers: readonly MeshPeer[] }>\n}\n\ninterface MeshRegistrationMeta {\n readonly displayName?: string\n}\n\nexport class MeshOrchestratorAddon extends BaseAddon<Record<string, never>> {\n constructor() {\n super({})\n }\n\n protected async onInitialize(): Promise<ProviderRegistration[]> {\n const provider: IMeshOrchestrator = {\n listProviders: async () => this.listProviders(),\n joinProvider: async ({ addonId, authKey, hostname }) => {\n const impl = this.resolveImpl(addonId)\n if (!impl?.join) throw new Error(`Mesh provider \"${addonId}\" does not support join`)\n return await impl.join({ authKey, ...(hostname ? { hostname } : {}) })\n },\n leaveProvider: async ({ addonId }) => {\n const impl = this.resolveImpl(addonId)\n if (impl?.leave) await impl.leave()\n return { success: true as const }\n },\n startLoginProvider: async ({ addonId, hostname }) => {\n const impl = this.resolveImpl(addonId)\n if (!impl?.startLogin) {\n throw new Error(`Mesh provider \"${addonId}\" does not support startLogin`)\n }\n return await impl.startLogin(hostname ? { hostname } : {})\n },\n logoutProvider: async ({ addonId }) => {\n const impl = this.resolveImpl(addonId)\n if (!impl?.logout) {\n throw new Error(`Mesh provider \"${addonId}\" does not support logout`)\n }\n await impl.logout()\n return { loggedOut: true as const }\n },\n listProviderPeers: async ({ addonId }) => {\n const impl = this.resolveImpl(addonId)\n if (!impl?.listPeers) return { peers: [] }\n return await impl.listPeers()\n },\n }\n this.ctx.logger.info('Mesh orchestrator initialized')\n return [{ capability: meshOrchestratorCapability, provider }]\n }\n\n private resolveImpl(addonId: string): MeshNetworkLike | null {\n const entries = this.capabilities?.getCollectionEntries<MeshNetworkLike>('mesh-network') ?? []\n const found = entries.find(([id]) => id === addonId)\n return found?.[1] ?? null\n }\n\n private async listProviders(): Promise<readonly MeshProviderInfo[]> {\n const entries = this.capabilities?.getCollectionEntries<MeshNetworkLike & MeshRegistrationMeta>(\n 'mesh-network',\n ) ?? []\n const out: MeshProviderInfo[] = []\n for (const [addonId, impl] of entries) {\n let joined = false\n let meshIp = ''\n let magicDnsHostname = ''\n let peerCount = 0\n let endpoints: MeshProviderInfo['endpoints'] = []\n let error: string | undefined\n let tenantName = ''\n let magicDnsSuffix = ''\n let userLogin: string | null = null\n let controlPlaneUrl = ''\n let keyExpiry: number | null = null\n if (impl.getStatus) {\n try {\n const s = await impl.getStatus()\n joined = s.joined\n meshIp = s.meshIp\n magicDnsHostname = s.magicDnsHostname\n peerCount = s.peerCount\n endpoints = s.endpoints\n error = s.error\n tenantName = s.tenantName\n magicDnsSuffix = s.magicDnsSuffix\n userLogin = s.userLogin\n controlPlaneUrl = s.controlPlaneUrl\n keyExpiry = s.keyExpiry\n } catch (err) {\n error = err instanceof Error ? err.message : String(err)\n }\n }\n out.push({\n addonId,\n displayName: impl.displayName ?? addonId,\n joined,\n meshIp,\n magicDnsHostname,\n peerCount,\n endpoints,\n ...(error !== undefined ? { error } : {}),\n tenantName,\n magicDnsSuffix,\n userLogin,\n controlPlaneUrl,\n keyExpiry,\n })\n }\n return out\n }\n}\n\nexport default MeshOrchestratorAddon\n"],"mappings":";;;;;;;;;;;;AAiDA,IAAa,wBAAb,cAA2C,gBAAA,UAAiC;CAC1E,cAAc;EACZ,MAAM,EAAE,CAAC;;CAGX,MAAgB,eAAgD;EAC9D,MAAM,WAA8B;GAClC,eAAe,YAAY,KAAK,eAAe;GAC/C,cAAc,OAAO,EAAE,SAAS,SAAS,eAAe;IACtD,MAAM,OAAO,KAAK,YAAY,QAAQ;IACtC,IAAI,CAAC,MAAM,MAAM,MAAM,IAAI,MAAM,kBAAkB,QAAQ,yBAAyB;IACpF,OAAO,MAAM,KAAK,KAAK;KAAE;KAAS,GAAI,WAAW,EAAE,UAAU,GAAG,EAAE;KAAG,CAAC;;GAExE,eAAe,OAAO,EAAE,cAAc;IACpC,MAAM,OAAO,KAAK,YAAY,QAAQ;IACtC,IAAI,MAAM,OAAO,MAAM,KA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,MAAM,IAAI,MAAM,KAAK,WAAW;IAChC,SAAS,EAAE;IACX,SAAS,EAAE;IACX,mBAAmB,EAAE;IACrB,YAAY,EAAE;IACd,YAAY,EAAE;IACd,QAAQ,EAAE;IACV,aAAa,EAAE;IACf,iBAAiB,EAAE;IACnB,YAAY,EAAE;IACd,kBAAkB,EAAE;IACpB,YAAY,EAAE;YACP,KAAK;IACZ,QAAQ,eAAe,QAAQ,IAAI,UAAU,OAAO,IAAI;;GAG5D,IAAI,KAAK;IACP;IACA,aAAa,KAAK,eAAe;IACjC;IACA;IACA;IACA;IACA;IACA,GAAI,UAAU,KAAA,IAAY,EAAE,OAAO,GAAG,EAAE;IACxC;IACA;IACA;IACA;IACA;IACD,CAAC;;EAEJ,OAAO"}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { BaseAddon, meshOrchestratorCapability } from "@camstack/types";
|
|
2
|
-
//#region src/builtins/mesh-orchestrator/mesh-orchestrator.addon.ts
|
|
3
|
-
/**
|
|
4
|
-
* Mesh orchestrator — singleton facade over the `mesh-network`
|
|
5
|
-
* collection. One row per provider (Tailscale, Headscale, ZeroTier),
|
|
6
|
-
* aggregated for the admin UI's Mesh Networks page.
|
|
7
|
-
*/
|
|
8
|
-
var MeshOrchestratorAddon = class extends BaseAddon {
|
|
9
|
-
constructor() {
|
|
10
|
-
super({});
|
|
11
|
-
}
|
|
12
|
-
async onInitialize() {
|
|
13
|
-
const provider = {
|
|
14
|
-
listProviders: async () => this.listProviders(),
|
|
15
|
-
joinProvider: async ({ addonId, authKey, hostname }) => {
|
|
16
|
-
const impl = this.resolveImpl(addonId);
|
|
17
|
-
if (!impl?.join) throw new Error(`Mesh provider "${addonId}" does not support join`);
|
|
18
|
-
return await impl.join({
|
|
19
|
-
authKey,
|
|
20
|
-
...hostname ? { hostname } : {}
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
leaveProvider: async ({ addonId }) => {
|
|
24
|
-
const impl = this.resolveImpl(addonId);
|
|
25
|
-
if (impl?.leave) await impl.leave();
|
|
26
|
-
return { success: true };
|
|
27
|
-
},
|
|
28
|
-
startLoginProvider: async ({ addonId, hostname }) => {
|
|
29
|
-
const impl = this.resolveImpl(addonId);
|
|
30
|
-
if (!impl?.startLogin) throw new Error(`Mesh provider "${addonId}" does not support startLogin`);
|
|
31
|
-
return await impl.startLogin(hostname ? { hostname } : {});
|
|
32
|
-
},
|
|
33
|
-
logoutProvider: async ({ addonId }) => {
|
|
34
|
-
const impl = this.resolveImpl(addonId);
|
|
35
|
-
if (!impl?.logout) throw new Error(`Mesh provider "${addonId}" does not support logout`);
|
|
36
|
-
await impl.logout();
|
|
37
|
-
return { loggedOut: true };
|
|
38
|
-
},
|
|
39
|
-
listProviderPeers: async ({ addonId }) => {
|
|
40
|
-
const impl = this.resolveImpl(addonId);
|
|
41
|
-
if (!impl?.listPeers) return { peers: [] };
|
|
42
|
-
return await impl.listPeers();
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
this.ctx.logger.info("Mesh orchestrator initialized");
|
|
46
|
-
return [{
|
|
47
|
-
capability: meshOrchestratorCapability,
|
|
48
|
-
provider
|
|
49
|
-
}];
|
|
50
|
-
}
|
|
51
|
-
resolveImpl(addonId) {
|
|
52
|
-
return (this.capabilities?.getCollectionEntries("mesh-network") ?? []).find(([id]) => id === addonId)?.[1] ?? null;
|
|
53
|
-
}
|
|
54
|
-
async listProviders() {
|
|
55
|
-
const entries = this.capabilities?.getCollectionEntries("mesh-network") ?? [];
|
|
56
|
-
const out = [];
|
|
57
|
-
for (const [addonId, impl] of entries) {
|
|
58
|
-
let joined = false;
|
|
59
|
-
let meshIp = "";
|
|
60
|
-
let magicDnsHostname = "";
|
|
61
|
-
let peerCount = 0;
|
|
62
|
-
let endpoints = [];
|
|
63
|
-
let error;
|
|
64
|
-
let tenantName = "";
|
|
65
|
-
let magicDnsSuffix = "";
|
|
66
|
-
let userLogin = null;
|
|
67
|
-
let controlPlaneUrl = "";
|
|
68
|
-
let keyExpiry = null;
|
|
69
|
-
if (impl.getStatus) try {
|
|
70
|
-
const s = await impl.getStatus();
|
|
71
|
-
joined = s.joined;
|
|
72
|
-
meshIp = s.meshIp;
|
|
73
|
-
magicDnsHostname = s.magicDnsHostname;
|
|
74
|
-
peerCount = s.peerCount;
|
|
75
|
-
endpoints = s.endpoints;
|
|
76
|
-
error = s.error;
|
|
77
|
-
tenantName = s.tenantName;
|
|
78
|
-
magicDnsSuffix = s.magicDnsSuffix;
|
|
79
|
-
userLogin = s.userLogin;
|
|
80
|
-
controlPlaneUrl = s.controlPlaneUrl;
|
|
81
|
-
keyExpiry = s.keyExpiry;
|
|
82
|
-
} catch (err) {
|
|
83
|
-
error = err instanceof Error ? err.message : String(err);
|
|
84
|
-
}
|
|
85
|
-
out.push({
|
|
86
|
-
addonId,
|
|
87
|
-
displayName: impl.displayName ?? addonId,
|
|
88
|
-
joined,
|
|
89
|
-
meshIp,
|
|
90
|
-
magicDnsHostname,
|
|
91
|
-
peerCount,
|
|
92
|
-
endpoints,
|
|
93
|
-
...error !== void 0 ? { error } : {},
|
|
94
|
-
tenantName,
|
|
95
|
-
magicDnsSuffix,
|
|
96
|
-
userLogin,
|
|
97
|
-
controlPlaneUrl,
|
|
98
|
-
keyExpiry
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
return out;
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
//#endregion
|
|
105
|
-
export { MeshOrchestratorAddon, MeshOrchestratorAddon as default };
|
|
106
|
-
|
|
107
|
-
//# sourceMappingURL=mesh-orchestrator.addon.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mesh-orchestrator.addon.mjs","names":[],"sources":["../../../src/builtins/mesh-orchestrator/mesh-orchestrator.addon.ts"],"sourcesContent":["/**\n * Mesh orchestrator — singleton facade over the `mesh-network`\n * collection. One row per provider (Tailscale, Headscale, ZeroTier),\n * aggregated for the admin UI's Mesh Networks page.\n */\nimport {\n BaseAddon,\n meshOrchestratorCapability,\n type IMeshOrchestrator,\n type MeshPeer,\n type MeshProviderInfo,\n type ProviderRegistration,\n} from '@camstack/types'\n\ninterface MeshStatusLike {\n joined: boolean\n meshIp: string\n magicDnsHostname: string\n peerCount: number\n endpoints: readonly {\n id: string\n label: string\n scope: 'mesh' | 'public'\n url: string\n hostname: string\n port: number\n protocol: 'http' | 'https'\n }[]\n error?: string\n tenantName: string\n magicDnsSuffix: string\n userLogin: string | null\n controlPlaneUrl: string\n keyExpiry: number | null\n}\n\ninterface MeshNetworkLike {\n getStatus?: () => Promise<MeshStatusLike>\n join?: (input: { authKey: string; hostname?: string }) => Promise<{ joined: true }>\n startLogin?: (input: { hostname?: string }) => Promise<{ loginUrl: string }>\n leave?: () => Promise<{ left: true }>\n logout?: () => Promise<{ loggedOut: true }>\n listPeers?: () => Promise<{ peers: readonly MeshPeer[] }>\n}\n\ninterface MeshRegistrationMeta {\n readonly displayName?: string\n}\n\nexport class MeshOrchestratorAddon extends BaseAddon<Record<string, never>> {\n constructor() {\n super({})\n }\n\n protected async onInitialize(): Promise<ProviderRegistration[]> {\n const provider: IMeshOrchestrator = {\n listProviders: async () => this.listProviders(),\n joinProvider: async ({ addonId, authKey, hostname }) => {\n const impl = this.resolveImpl(addonId)\n if (!impl?.join) throw new Error(`Mesh provider \"${addonId}\" does not support join`)\n return await impl.join({ authKey, ...(hostname ? { hostname } : {}) })\n },\n leaveProvider: async ({ addonId }) => {\n const impl = this.resolveImpl(addonId)\n if (impl?.leave) await impl.leave()\n return { success: true as const }\n },\n startLoginProvider: async ({ addonId, hostname }) => {\n const impl = this.resolveImpl(addonId)\n if (!impl?.startLogin) {\n throw new Error(`Mesh provider \"${addonId}\" does not support startLogin`)\n }\n return await impl.startLogin(hostname ? { hostname } : {})\n },\n logoutProvider: async ({ addonId }) => {\n const impl = this.resolveImpl(addonId)\n if (!impl?.logout) {\n throw new Error(`Mesh provider \"${addonId}\" does not support logout`)\n }\n await impl.logout()\n return { loggedOut: true as const }\n },\n listProviderPeers: async ({ addonId }) => {\n const impl = this.resolveImpl(addonId)\n if (!impl?.listPeers) return { peers: [] }\n return await impl.listPeers()\n },\n }\n this.ctx.logger.info('Mesh orchestrator initialized')\n return [{ capability: meshOrchestratorCapability, provider }]\n }\n\n private resolveImpl(addonId: string): MeshNetworkLike | null {\n const entries = this.capabilities?.getCollectionEntries<MeshNetworkLike>('mesh-network') ?? []\n const found = entries.find(([id]) => id === addonId)\n return found?.[1] ?? null\n }\n\n private async listProviders(): Promise<readonly MeshProviderInfo[]> {\n const entries = this.capabilities?.getCollectionEntries<MeshNetworkLike & MeshRegistrationMeta>(\n 'mesh-network',\n ) ?? []\n const out: MeshProviderInfo[] = []\n for (const [addonId, impl] of entries) {\n let joined = false\n let meshIp = ''\n let magicDnsHostname = ''\n let peerCount = 0\n let endpoints: MeshProviderInfo['endpoints'] = []\n let error: string | undefined\n let tenantName = ''\n let magicDnsSuffix = ''\n let userLogin: string | null = null\n let controlPlaneUrl = ''\n let keyExpiry: number | null = null\n if (impl.getStatus) {\n try {\n const s = await impl.getStatus()\n joined = s.joined\n meshIp = s.meshIp\n magicDnsHostname = s.magicDnsHostname\n peerCount = s.peerCount\n endpoints = s.endpoints\n error = s.error\n tenantName = s.tenantName\n magicDnsSuffix = s.magicDnsSuffix\n userLogin = s.userLogin\n controlPlaneUrl = s.controlPlaneUrl\n keyExpiry = s.keyExpiry\n } catch (err) {\n error = err instanceof Error ? err.message : String(err)\n }\n }\n out.push({\n addonId,\n displayName: impl.displayName ?? addonId,\n joined,\n meshIp,\n magicDnsHostname,\n peerCount,\n endpoints,\n ...(error !== undefined ? { error } : {}),\n tenantName,\n magicDnsSuffix,\n userLogin,\n controlPlaneUrl,\n keyExpiry,\n })\n }\n return out\n }\n}\n\nexport default MeshOrchestratorAddon\n"],"mappings":";;;;;;;AAiDA,IAAa,wBAAb,cAA2C,UAAiC;CAC1E,cAAc;EACZ,MAAM,EAAE,CAAC;;CAGX,MAAg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AAQ,MAAM;;CAGvB,MAAc,gBAAsD;EAClE,MAAM,UAAU,KAAK,cAAc,qBACjC,eACD,IAAI,EAAE;EACP,MAAM,MAA0B,EAAE;EAClC,KAAK,MAAM,CAAC,SAAS,SAAS,SAAS;GACrC,IAAI,SAAS;GACb,IAAI,SAAS;GACb,IAAI,mBAAmB;GACvB,IAAI,YAAY;GAChB,IAAI,YAA2C,EAAE;GACjD,IAAI;GACJ,IAAI,aAAa;GACjB,IAAI,iBAAiB;GACrB,IAAI,YAA2B;GAC/B,IAAI,kBAAkB;GACtB,IAAI,YAA2B;GAC/B,IAAI,KAAK,WACP,IAAI;IACF,MAAM,IAAI,MAAM,KAAK,WAAW;IAChC,SAAS,EAAE;IACX,SAAS,EAAE;IACX,mBAAmB,EAAE;IACrB,YAAY,EAAE;IACd,YAAY,EAAE;IACd,QAAQ,EAAE;IACV,aAAa,EAAE;IACf,iBAAiB,EAAE;IACnB,YAAY,EAAE;IACd,kBAAkB,EAAE;IACpB,YAAY,EAAE;YACP,KAAK;IACZ,QAAQ,eAAe,QAAQ,IAAI,UAAU,OAAO,IAAI;;GAG5D,IAAI,KAAK;IACP;IACA,aAAa,KAAK,eAAe;IACjC;IACA;IACA;IACA;IACA;IACA,GAAI,UAAU,KAAA,IAAY,EAAE,OAAO,GAAG,EAAE;IACxC;IACA;IACA;IACA;IACA;IACD,CAAC;;EAEJ,OAAO"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/builtins/turn-orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_builtins_turn_orchestrator_turn_orchestrator_addon = require("./turn-orchestrator.addon.js");
|
|
6
|
-
exports.TurnOrchestratorAddon = require_builtins_turn_orchestrator_turn_orchestrator_addon.TurnOrchestratorAddon;
|
|
7
|
-
exports.default = require_builtins_turn_orchestrator_turn_orchestrator_addon.TurnOrchestratorAddon;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { BaseAddon, ProviderRegistration } from '@camstack/types';
|
|
2
|
-
interface TurnOrchestratorConfig {
|
|
3
|
-
/**
|
|
4
|
-
* addonIds the operator has explicitly enabled. Persisted in the
|
|
5
|
-
* addon-store; first-launch defaults to "every provider enabled" so
|
|
6
|
-
* a freshly-installed TURN addon participates immediately (the
|
|
7
|
-
* operator can disable from the UI). See `effectivelyEnabled`.
|
|
8
|
-
*/
|
|
9
|
-
readonly enabledProviders: readonly string[];
|
|
10
|
-
/**
|
|
11
|
-
* Sentinel: true after `enabledProviders` has been written at least
|
|
12
|
-
* once. Distinguishes "operator hasn't touched the toggles yet —
|
|
13
|
-
* default-enable all" from "operator cleared the list — keep it
|
|
14
|
-
* empty". Same shape as local-network's bootSeeded.
|
|
15
|
-
*/
|
|
16
|
-
readonly enabledProvidersSeeded: boolean;
|
|
17
|
-
}
|
|
18
|
-
export declare class TurnOrchestratorAddon extends BaseAddon<TurnOrchestratorConfig> {
|
|
19
|
-
constructor();
|
|
20
|
-
protected onInitialize(): Promise<ProviderRegistration[]>;
|
|
21
|
-
private getEntries;
|
|
22
|
-
/**
|
|
23
|
-
* Operator-effective enabled set. Before the first toggle, default
|
|
24
|
-
* to "every registered provider is enabled" so a fresh install of a
|
|
25
|
-
* TURN addon participates without manual intervention. After the
|
|
26
|
-
* operator clicks anything, the persisted list is authoritative.
|
|
27
|
-
*/
|
|
28
|
-
private effectivelyEnabled;
|
|
29
|
-
private markEnabled;
|
|
30
|
-
private listProviders;
|
|
31
|
-
private getAllServers;
|
|
32
|
-
}
|
|
33
|
-
export default TurnOrchestratorAddon;
|
|
34
|
-
//# sourceMappingURL=turn-orchestrator.addon.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"turn-orchestrator.addon.d.ts","sourceRoot":"","sources":["../../../src/builtins/turn-orchestrator/turn-orchestrator.addon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,SAAS,EAIT,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAA;AAOxB,UAAU,sBAAsB;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAA;IAC5C;;;;;OAKG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAA;CACzC;AAED,qBAAa,qBAAsB,SAAQ,SAAS,CAAC,sBAAsB,CAAC;;cAK1D,YAAY,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAkB/D,OAAO,CAAC,UAAU;IAIlB;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;YAOZ,WAAW;YAYX,aAAa;YAyCb,aAAa;CAiB5B;AAED,eAAe,qBAAqB,CAAA"}
|