@camstack/system 1.0.2
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/addon/addon-api-factory.d.ts +35 -0
- package/dist/addon-routes/addon-route-registry.d.ts +37 -0
- package/dist/addon-runner.js +599 -0
- package/dist/addon-runner.mjs +597 -0
- package/dist/auth/api-key-manager.d.ts +26 -0
- package/dist/auth/auth-manager.d.ts +109 -0
- package/dist/auth/parse-record.d.ts +18 -0
- package/dist/auth/scope-matcher.d.ts +7 -0
- package/dist/auth/scoped-token-manager.d.ts +40 -0
- package/dist/auth/totp-manager.d.ts +51 -0
- package/dist/auth/user-manager.d.ts +34 -0
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.d.ts +53 -0
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +259 -0
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +251 -0
- package/dist/builtins/addon-pages-aggregator/dedupe-pages.d.ts +6 -0
- package/dist/builtins/addon-pages-aggregator/index.d.ts +1 -0
- package/dist/builtins/addon-pages-aggregator/index.js +8 -0
- package/dist/builtins/addon-pages-aggregator/index.mjs +2 -0
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.d.ts +47 -0
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +228 -0
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +220 -0
- package/dist/builtins/addon-widgets-aggregator/index.d.ts +1 -0
- package/dist/builtins/addon-widgets-aggregator/index.js +8 -0
- package/dist/builtins/addon-widgets-aggregator/index.mjs +2 -0
- package/dist/builtins/alerts/alerts.addon.d.ts +81 -0
- package/dist/builtins/alerts/alerts.addon.js +601 -0
- package/dist/builtins/alerts/alerts.addon.mjs +595 -0
- package/dist/builtins/alerts/index.d.ts +1 -0
- package/dist/builtins/alerts/index.js +4 -0
- package/dist/builtins/alerts/index.mjs +2 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +147 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2229 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2220 -0
- package/dist/builtins/backup-orchestrator/cron-helpers.d.ts +23 -0
- package/dist/builtins/backup-orchestrator/destination-policy.d.ts +72 -0
- package/dist/builtins/backup-orchestrator/download-helpers.d.ts +12 -0
- package/dist/builtins/backup-orchestrator/index.d.ts +2 -0
- package/dist/builtins/backup-orchestrator/index.js +8 -0
- package/dist/builtins/backup-orchestrator/index.mjs +2 -0
- package/dist/builtins/backup-orchestrator/manifest-store.d.ts +77 -0
- package/dist/builtins/console-logging/console-destination.d.ts +13 -0
- package/dist/builtins/console-logging/console-logging.addon.d.ts +25 -0
- package/dist/builtins/console-logging/index.d.ts +3 -0
- package/dist/builtins/console-logging/index.js +104 -0
- package/dist/builtins/console-logging/index.mjs +95 -0
- package/dist/builtins/device-manager/device-config-contribution.d.ts +32 -0
- package/dist/builtins/device-manager/device-event-propagator.d.ts +26 -0
- package/dist/builtins/device-manager/device-link-overlay.d.ts +23 -0
- package/dist/builtins/device-manager/device-link-resolver.d.ts +15 -0
- package/dist/builtins/device-manager/device-manager.addon.d.ts +452 -0
- package/dist/builtins/device-manager/device-manager.addon.js +3299 -0
- package/dist/builtins/device-manager/device-manager.addon.mjs +3292 -0
- package/dist/builtins/device-manager/index.d.ts +2 -0
- package/dist/builtins/device-manager/index.js +8 -0
- package/dist/builtins/device-manager/index.mjs +2 -0
- package/dist/builtins/hub-forwarder/hub-forwarder-destination.d.ts +44 -0
- package/dist/builtins/hub-forwarder/hub-forwarder.addon.d.ts +15 -0
- package/dist/builtins/hub-forwarder/index.d.ts +3 -0
- package/dist/builtins/hub-forwarder/index.js +154 -0
- package/dist/builtins/hub-forwarder/index.mjs +145 -0
- package/dist/builtins/local-auth/auth-schema.d.ts +26 -0
- package/dist/builtins/local-auth/index.d.ts +1 -0
- package/dist/builtins/local-auth/index.js +4 -0
- package/dist/builtins/local-auth/index.mjs +2 -0
- package/dist/builtins/local-auth/local-auth.addon.d.ts +18 -0
- package/dist/builtins/local-auth/local-auth.addon.js +8094 -0
- package/dist/builtins/local-auth/local-auth.addon.mjs +8063 -0
- package/dist/builtins/local-auth/oauth-grants.d.ts +45 -0
- package/dist/builtins/local-auth/oauth-session-manager.d.ts +50 -0
- package/dist/builtins/local-network/index.d.ts +2 -0
- package/dist/builtins/local-network/index.js +10 -0
- package/dist/builtins/local-network/index.mjs +2 -0
- package/dist/builtins/local-network/local-network.addon.d.ts +150 -0
- package/dist/builtins/local-network/local-network.addon.js +489 -0
- package/dist/builtins/local-network/local-network.addon.mjs +477 -0
- package/dist/builtins/native-metrics/index.d.ts +2 -0
- package/dist/builtins/native-metrics/native-metrics-provider.d.ts +48 -0
- package/dist/builtins/native-metrics/native-metrics.addon.d.ts +73 -0
- package/dist/builtins/native-metrics/native-metrics.addon.js +922 -0
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +914 -0
- package/dist/builtins/platform-probe/hardware-decode-accel-probe.d.ts +37 -0
- package/dist/builtins/platform-probe/hardware-encoder-probe.d.ts +13 -0
- package/dist/builtins/platform-probe/index.d.ts +22 -0
- package/dist/builtins/platform-probe/index.js +834 -0
- package/dist/builtins/platform-probe/index.mjs +822 -0
- package/dist/builtins/platform-probe/inference-config-resolver.d.ts +29 -0
- package/dist/builtins/platform-probe/intel-accelerators.d.ts +11 -0
- package/dist/builtins/platform-probe/platform-scorer.d.ts +30 -0
- package/dist/builtins/platform-probe/runtime-packages.d.ts +6 -0
- package/dist/builtins/remote-access-orchestrator/enabled-providers-reconcile.d.ts +96 -0
- package/dist/builtins/remote-access-orchestrator/index.d.ts +1 -0
- package/dist/builtins/remote-access-orchestrator/index.js +8 -0
- package/dist/builtins/remote-access-orchestrator/index.mjs +2 -0
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.d.ts +40 -0
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +214 -0
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +208 -0
- package/dist/builtins/shared/settle-sources.d.ts +22 -0
- package/dist/builtins/snapshot/index.d.ts +2 -0
- package/dist/builtins/snapshot/index.js +494 -0
- package/dist/builtins/snapshot/index.mjs +488 -0
- package/dist/builtins/snapshot/snapshot.addon.d.ts +120 -0
- package/dist/builtins/sqlite-storage/config-store.d.ts +8 -0
- package/dist/builtins/sqlite-storage/device-store.d.ts +23 -0
- package/dist/builtins/sqlite-storage/filesystem-browse-provider.d.ts +25 -0
- package/dist/builtins/sqlite-storage/filesystem-storage-provider.d.ts +83 -0
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.d.ts +32 -0
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +396 -0
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +388 -0
- package/dist/builtins/sqlite-storage/index.d.ts +8 -0
- package/dist/builtins/sqlite-storage/index.js +62 -0
- package/dist/builtins/sqlite-storage/index.mjs +49 -0
- package/dist/builtins/sqlite-storage/integration-registry.d.ts +27 -0
- package/dist/builtins/sqlite-storage/path-guard.d.ts +4 -0
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +102 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +14 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +644 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +636 -0
- package/dist/builtins/storage-orchestrator/index.d.ts +6 -0
- package/dist/builtins/storage-orchestrator/index.js +10 -0
- package/dist/builtins/storage-orchestrator/index.mjs +2 -0
- package/dist/builtins/storage-orchestrator/location-store.d.ts +49 -0
- package/dist/builtins/storage-orchestrator/provider-discovery.d.ts +10 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +103 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1138 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1128 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts +236 -0
- package/dist/builtins/storage-orchestrator/storage-pressure-manager.d.ts +38 -0
- package/dist/builtins/system-backup/system-backup.service.d.ts +137 -0
- package/dist/builtins/system-config/index.d.ts +1 -0
- package/dist/builtins/system-config/index.js +8 -0
- package/dist/builtins/system-config/index.mjs +2 -0
- package/dist/builtins/system-config/system-config.addon.d.ts +10 -0
- package/dist/builtins/system-config/system-config.addon.js +232 -0
- package/dist/builtins/system-config/system-config.addon.mjs +226 -0
- package/dist/builtins/winston-logging/index.d.ts +3 -0
- package/dist/builtins/winston-logging/index.js +156 -0
- package/dist/builtins/winston-logging/index.mjs +144 -0
- package/dist/builtins/winston-logging/winston-destination.d.ts +21 -0
- package/dist/builtins/winston-logging/winston-logging.addon.d.ts +19 -0
- package/dist/chunk-CNf5ZN-e.mjs +37 -0
- package/dist/chunk-Cek0wNdY.js +64 -0
- package/dist/download/model-download-service.d.ts +41 -0
- package/dist/download/model-downloader.d.ts +31 -0
- package/dist/events/event-bus.d.ts +10 -0
- package/dist/events/system-event-bus.d.ts +14 -0
- package/dist/feature/feature-manager.d.ts +11 -0
- package/dist/formatter-B7qW8bPJ.mjs +162 -0
- package/dist/formatter-DqAKDlvN.js +167 -0
- package/dist/http/authenticated-file-server.d.ts +53 -0
- package/dist/http/data-plane-registry.d.ts +23 -0
- package/dist/http/file-data-plane.d.ts +10 -0
- package/dist/http/reverse-proxy.d.ts +15 -0
- package/dist/index.d.ts +82 -0
- package/dist/index.js +93485 -0
- package/dist/index.mjs +93179 -0
- package/dist/intel-accelerators-Gg0P5mnl.js +20 -0
- package/dist/intel-accelerators-hGgpZ0pX.mjs +19 -0
- package/dist/kernel/addon-class-resolver.d.ts +4 -0
- package/dist/kernel/addon-engine-manager.d.ts +22 -0
- package/dist/kernel/addon-health-monitor.d.ts +154 -0
- package/dist/kernel/addon-installer.d.ts +208 -0
- package/dist/kernel/addon-loader.d.ts +106 -0
- package/dist/kernel/addon-manifest.d.ts +77 -0
- package/dist/kernel/capability-handle.d.ts +46 -0
- package/dist/kernel/capability-registry.d.ts +412 -0
- package/dist/kernel/config-manager.d.ts +212 -0
- package/dist/kernel/config-schema.d.ts +93 -0
- package/dist/kernel/custom-action-registry.d.ts +23 -0
- package/dist/kernel/deps/addon-deps-manager.d.ts +19 -0
- package/dist/kernel/deps/manifest-native-deps.d.ts +25 -0
- package/dist/kernel/deps/manifest-python-deps.d.ts +20 -0
- package/dist/kernel/device-registry.d.ts +29 -0
- package/dist/kernel/fs-utils.d.ts +41 -0
- package/dist/kernel/hwaccel/hwaccel-resolver.d.ts +19 -0
- package/dist/kernel/hwaccel/hwaccel-service.d.ts +4 -0
- package/dist/kernel/index.d.ts +74 -0
- package/dist/kernel/infra-capabilities.d.ts +13 -0
- package/dist/kernel/moleculer/addon-context-factory.d.ts +91 -0
- package/dist/kernel/moleculer/addon-data-plane-facility.d.ts +19 -0
- package/dist/kernel/moleculer/addon-runner.d.ts +1 -0
- package/dist/kernel/moleculer/addon-service-factory.d.ts +50 -0
- package/dist/kernel/moleculer/broker-factory.d.ts +50 -0
- package/dist/kernel/moleculer/cap-usage-registry.d.ts +46 -0
- package/dist/kernel/moleculer/capabilities-access.d.ts +21 -0
- package/dist/kernel/moleculer/child-addon-call-dispatch.d.ts +46 -0
- package/dist/kernel/moleculer/child-cap-dispatch.d.ts +20 -0
- package/dist/kernel/moleculer/cluster-secret.d.ts +15 -0
- package/dist/kernel/moleculer/core-cap-service.d.ts +50 -0
- package/dist/kernel/moleculer/crash-supervisor.d.ts +50 -0
- package/dist/kernel/moleculer/device-cap-proxy.d.ts +79 -0
- package/dist/kernel/moleculer/event-bus-core.d.ts +53 -0
- package/dist/kernel/moleculer/event-bus.d.ts +53 -0
- package/dist/kernel/moleculer/hub-log-forwarder.d.ts +36 -0
- package/dist/kernel/moleculer/hub-service.d.ts +35 -0
- package/dist/kernel/moleculer/node-registry.d.ts +126 -0
- package/dist/kernel/moleculer/process-context.d.ts +4 -0
- package/dist/kernel/moleculer/process-service.d.ts +72 -0
- package/dist/kernel/moleculer/provider-registry.d.ts +28 -0
- package/dist/kernel/moleculer/readiness-context.d.ts +62 -0
- package/dist/kernel/moleculer/readiness-service.d.ts +7 -0
- package/dist/kernel/moleculer/register-node-client.d.ts +35 -0
- package/dist/kernel/moleculer/remote-logger.d.ts +43 -0
- package/dist/kernel/moleculer/resilient-cap-call.d.ts +28 -0
- package/dist/kernel/moleculer/stream-probe-service.d.ts +9 -0
- package/dist/kernel/moleculer/trpc-links.d.ts +189 -0
- package/dist/kernel/moleculer/typed-array-serde.d.ts +25 -0
- package/dist/kernel/moleculer/worker-device-restore.d.ts +10 -0
- package/dist/kernel/provider-kind-drift.d.ts +12 -0
- package/dist/kernel/restart-coordinator.d.ts +90 -0
- package/dist/kernel/storage-location-registry.d.ts +40 -0
- package/dist/kernel/transport/cap-action-name.d.ts +100 -0
- package/dist/kernel/transport/cap-route-resolver.d.ts +148 -0
- package/dist/kernel/transport/cap-route.d.ts +148 -0
- package/dist/kernel/transport/child-cap-protocol.d.ts +136 -0
- package/dist/kernel/transport/create-local-transport.d.ts +7 -0
- package/dist/kernel/transport/frame-codec.d.ts +7 -0
- package/dist/kernel/transport/index.d.ts +27 -0
- package/dist/kernel/transport/local-child-client.d.ts +136 -0
- package/dist/kernel/transport/local-child-registry.d.ts +179 -0
- package/dist/kernel/transport/local-endpoint-path.d.ts +6 -0
- package/dist/kernel/transport/local-transport.d.ts +46 -0
- package/dist/kernel/transport/parent-unowned-call.d.ts +75 -0
- package/dist/kernel/transport/socket-channel.d.ts +27 -0
- package/dist/kernel/transport/uds-event-bridge.d.ts +36 -0
- package/dist/kernel/transport/uds-event-bus.d.ts +22 -0
- package/dist/kernel/transport/uds-local-transport.d.ts +18 -0
- package/dist/kernel/transport/uds-log-ingest.d.ts +28 -0
- package/dist/kernel/transport/uds-logger.d.ts +44 -0
- package/dist/kernel/utils/ring-buffer.d.ts +15 -0
- package/dist/kernel/workspace-detect.d.ts +9 -0
- package/dist/lifecycle/lifecycle-state-machine.d.ts +28 -0
- package/dist/logging/formatter.d.ts +30 -0
- package/dist/logging/log-manager.d.ts +54 -0
- package/dist/logging/log-ring-buffer.d.ts +47 -0
- package/dist/logging/partitioned-log-buffer.d.ts +35 -0
- package/dist/logging/scoped-logger.d.ts +17 -0
- package/dist/main-DNnMW7Z2.js +9983 -0
- package/dist/main-rtjOwPBR.mjs +9976 -0
- package/dist/manifest-python-deps-D1DbAQEv.js +6724 -0
- package/dist/manifest-python-deps-DZsKTbs1.mjs +6315 -0
- package/dist/network/network-quality.d.ts +11 -0
- package/dist/notification/notification-service.d.ts +37 -0
- package/dist/notification/toast-service.d.ts +22 -0
- package/dist/pipeline/engine-manager-resolver.d.ts +15 -0
- package/dist/pipeline/pipeline-runner.d.ts +8 -0
- package/dist/pipeline/pipeline-validator.d.ts +13 -0
- package/dist/process/resource-monitor.d.ts +11 -0
- package/dist/python/python-env-manager.d.ts +12 -0
- package/dist/repl/interfaces.d.ts +31 -0
- package/dist/repl/repl-engine.d.ts +8 -0
- package/dist/resource-monitor-ClDGFyf6.mjs +57 -0
- package/dist/resource-monitor-IIEanuJt.js +74 -0
- package/dist/settle-sources-Bhsy57y-.js +38 -0
- package/dist/settle-sources-CDtNC8ub.mjs +33 -0
- package/dist/storage/fs-storage-backend.d.ts +40 -0
- package/dist/storage/storage-location-manager.d.ts +23 -0
- package/dist/storage/storage-manager.d.ts +83 -0
- package/dist/tar-BgAEMRBR.js +5434 -0
- package/dist/tar-ByMOPNM0.mjs +5429 -0
- package/dist/tls/cert-manager.d.ts +26 -0
- package/dist/tls/index.d.ts +1 -0
- package/package.json +343 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ISsoBridgeProvider, TokenScope } from '@camstack/types';
|
|
2
|
+
import { OauthSessionManager } from './oauth-session-manager.js';
|
|
3
|
+
interface IssueCodeInput {
|
|
4
|
+
integrationId: string;
|
|
5
|
+
userId: string;
|
|
6
|
+
username: string;
|
|
7
|
+
scopes: TokenScope[];
|
|
8
|
+
redirectUri: string;
|
|
9
|
+
hubUrl: string;
|
|
10
|
+
}
|
|
11
|
+
interface TokenPair {
|
|
12
|
+
accessToken: string;
|
|
13
|
+
refreshToken: string;
|
|
14
|
+
expiresIn: number;
|
|
15
|
+
}
|
|
16
|
+
interface VerifiedAccess {
|
|
17
|
+
userId: string;
|
|
18
|
+
username: string;
|
|
19
|
+
scopes: TokenScope[];
|
|
20
|
+
}
|
|
21
|
+
/** OAuth account-linking grant logic. Pure over an injected sso-bridge
|
|
22
|
+
* signer so it is unit-testable without the capability registry.
|
|
23
|
+
*
|
|
24
|
+
* Authorization codes are short-lived (60 s). The `redirectUri`,
|
|
25
|
+
* `integrationId`, and a unique `jti` are embedded in the signed JWT
|
|
26
|
+
* so the HMAC signature is the real security boundary. Single-use is
|
|
27
|
+
* enforced by a `jti` consumed-set. The old in-process `pendingCodes`
|
|
28
|
+
* Map is gone — a hub restart no longer breaks in-flight exchanges,
|
|
29
|
+
* only risking a single replay within the remaining 60 s TTL. */
|
|
30
|
+
export declare function createOauthGrants(ssoBridge: ISsoBridgeProvider, sessionManager: OauthSessionManager): {
|
|
31
|
+
oauthIssueCode(input: IssueCodeInput): Promise<{
|
|
32
|
+
code: string;
|
|
33
|
+
}>;
|
|
34
|
+
oauthExchangeCode(input: {
|
|
35
|
+
code: string;
|
|
36
|
+
redirectUri: string;
|
|
37
|
+
}): Promise<TokenPair | null>;
|
|
38
|
+
oauthRefresh(input: {
|
|
39
|
+
refreshToken: string;
|
|
40
|
+
}): Promise<TokenPair | null>;
|
|
41
|
+
oauthVerifyAccessToken(input: {
|
|
42
|
+
token: string;
|
|
43
|
+
}): Promise<VerifiedAccess | null>;
|
|
44
|
+
};
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { TokenScope, SettingsStoreClient } from '@camstack/types';
|
|
2
|
+
export interface OauthSession {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly userId: string;
|
|
5
|
+
readonly username: string;
|
|
6
|
+
readonly integrationId: string;
|
|
7
|
+
readonly scopes: TokenScope[];
|
|
8
|
+
readonly createdAt: number;
|
|
9
|
+
readonly lastUsedAt: number;
|
|
10
|
+
readonly revokedAt: number | null;
|
|
11
|
+
}
|
|
12
|
+
interface CreateInput {
|
|
13
|
+
readonly userId: string;
|
|
14
|
+
readonly username: string;
|
|
15
|
+
readonly integrationId: string;
|
|
16
|
+
readonly scopes: TokenScope[];
|
|
17
|
+
}
|
|
18
|
+
export declare class OauthSessionManager {
|
|
19
|
+
private readonly store;
|
|
20
|
+
constructor(store: SettingsStoreClient);
|
|
21
|
+
/**
|
|
22
|
+
* Create a new OAuth session record. Generates a UUID as the session id,
|
|
23
|
+
* sets `createdAt` and `lastUsedAt` to now, `revokedAt` to null.
|
|
24
|
+
*/
|
|
25
|
+
create(input: CreateInput): Promise<OauthSession>;
|
|
26
|
+
/**
|
|
27
|
+
* Return all sessions — both active and revoked. Callers decide
|
|
28
|
+
* whether to filter by `revokedAt`.
|
|
29
|
+
*/
|
|
30
|
+
list(): Promise<OauthSession[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Look up a session by its id. Returns null when not found.
|
|
33
|
+
*/
|
|
34
|
+
getById(id: string): Promise<OauthSession | null>;
|
|
35
|
+
/**
|
|
36
|
+
* Mark a session as revoked by setting `revokedAt = now`.
|
|
37
|
+
*
|
|
38
|
+
* - Returns `true` on success (including idempotent re-revoke — the
|
|
39
|
+
* existing `revokedAt` timestamp is preserved; it is NOT updated).
|
|
40
|
+
* - Returns `false` when the session id is not found.
|
|
41
|
+
*/
|
|
42
|
+
markRevoked(id: string): Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Update `lastUsedAt` to now. No-op (does not throw) when the session
|
|
45
|
+
* id is not found — the caller (token-use hot path) should not fail
|
|
46
|
+
* for a missing session that may have been concurrently revoked.
|
|
47
|
+
*/
|
|
48
|
+
touch(id: string): Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
require("../../chunk-Cek0wNdY.js");
|
|
6
|
+
const require_builtins_local_network_local_network_addon = require("./local-network.addon.js");
|
|
7
|
+
exports.LocalNetworkAddon = require_builtins_local_network_local_network_addon.LocalNetworkAddon;
|
|
8
|
+
exports.classifyKind = require_builtins_local_network_local_network_addon.classifyKind;
|
|
9
|
+
exports.default = require_builtins_local_network_local_network_addon.LocalNetworkAddon;
|
|
10
|
+
exports.prefixLen = require_builtins_local_network_local_network_addon.prefixLen;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { ProviderRegistration, LocalInterface, ConnectionEndpoint, BaseAddon } from '@camstack/types';
|
|
2
|
+
/**
|
|
3
|
+
* Cached mesh-reachable endpoint, learned from the `mesh-network`
|
|
4
|
+
* provider via the `MeshNetworkChanged` event-tail + pull-reconcile.
|
|
5
|
+
* `null` when no mesh provider is joined / reachable.
|
|
6
|
+
*/
|
|
7
|
+
interface MeshEndpointCache {
|
|
8
|
+
/** Preferred mesh host — MagicDNS name when available, else raw mesh IP. */
|
|
9
|
+
readonly host: string;
|
|
10
|
+
/** Hub HTTPS port the mesh endpoint targets. */
|
|
11
|
+
readonly port: number;
|
|
12
|
+
}
|
|
13
|
+
interface LocalNetworkConfig {
|
|
14
|
+
/** Empty = "auto" (every non-loopback / non-link-local address
|
|
15
|
+
* participates). Non-empty restricts the candidate set to only
|
|
16
|
+
* those operator-pinned addresses. */
|
|
17
|
+
readonly allowedAddresses: readonly string[];
|
|
18
|
+
/** Sentinel — `true` after the first-boot auto-seed runs. Lets the
|
|
19
|
+
* addon distinguish "fresh install, never touched" (false → seed
|
|
20
|
+
* with LAN/Wi-Fi addresses) from "operator explicitly cleared the
|
|
21
|
+
* allowlist" (true + empty → respect operator's choice). */
|
|
22
|
+
readonly bootSeeded: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare class LocalNetworkAddon extends BaseAddon<LocalNetworkConfig> {
|
|
25
|
+
private pollTimer;
|
|
26
|
+
private lastSnapshotKey;
|
|
27
|
+
/** Optional public hostname tracked from `NetworkTunnelStarted`/
|
|
28
|
+
* `Stopped` events on the bus. */
|
|
29
|
+
private publicHostname;
|
|
30
|
+
/**
|
|
31
|
+
* Mesh-reachable endpoint (Tailscale MagicDNS / 100.x), learned from
|
|
32
|
+
* the `MeshNetworkChanged` event-tail and refreshed by a pull-reconcile
|
|
33
|
+
* before each `getConnectionEndpoints` build (events are lossy — D8).
|
|
34
|
+
* `null` when no mesh provider is joined.
|
|
35
|
+
*/
|
|
36
|
+
private meshEndpoint;
|
|
37
|
+
constructor();
|
|
38
|
+
protected onInitialize(): Promise<ProviderRegistration[]>;
|
|
39
|
+
protected onShutdown(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Other hub addons (e.g. cloudflare-tunnel) signal the active public
|
|
42
|
+
* FQDN by emitting `NetworkTunnelStarted` on the bus — handled in
|
|
43
|
+
* `onInitialize`. This setter exists for tests + future direct
|
|
44
|
+
* callers; cleared by passing an empty string.
|
|
45
|
+
*/
|
|
46
|
+
setPublicHostname(hostname: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Replace the cached mesh endpoint. Set from the `MeshNetworkChanged`
|
|
49
|
+
* event-tail + the pull-reconcile; exposed for tests + future direct
|
|
50
|
+
* callers. Pass `null` to clear (mesh left / no provider joined).
|
|
51
|
+
*/
|
|
52
|
+
setMeshEndpoint(endpoint: MeshEndpointCache | null): void;
|
|
53
|
+
/**
|
|
54
|
+
* Refresh the cached mesh endpoint from the authoritative forked
|
|
55
|
+
* `mesh-network` provider(s). `mesh-network` is a COLLECTION cap on a
|
|
56
|
+
* forked addon, so the hub builtin can't see it via `ctx.api` /
|
|
57
|
+
* `getCollectionEntries` — we resolve each provider by addonId through
|
|
58
|
+
* the hub-side `capabilityRegistry.getProviderByAddon` resolver (the
|
|
59
|
+
* same mechanism `device-manager` uses for cross-process exporter
|
|
60
|
+
* contributions). Best-effort: a provider that's absent / errors /
|
|
61
|
+
* not joined simply contributes nothing.
|
|
62
|
+
*/
|
|
63
|
+
private reconcileMeshEndpoint;
|
|
64
|
+
private enumerate;
|
|
65
|
+
private detectChanges;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Lift `os.networkInterfaces()` into our `LocalInterface[]` shape with
|
|
69
|
+
* kind classification + preferred flag. Pure — takes the raw result so
|
|
70
|
+
* tests can feed synthetic data.
|
|
71
|
+
*/
|
|
72
|
+
interface OsNetworkInterfaceInfo {
|
|
73
|
+
readonly family: string;
|
|
74
|
+
readonly address: string;
|
|
75
|
+
readonly cidr?: string | null;
|
|
76
|
+
readonly netmask: string;
|
|
77
|
+
readonly internal: boolean;
|
|
78
|
+
readonly mac: string;
|
|
79
|
+
}
|
|
80
|
+
export declare function enumerateOsInterfaces(ifaces: NodeJS.Dict<readonly OsNetworkInterfaceInfo[]>): readonly LocalInterface[];
|
|
81
|
+
/**
|
|
82
|
+
* Filter the interface list by the operator's allowlist. Empty
|
|
83
|
+
* allowlist = no-op (every interface passes); otherwise only entries
|
|
84
|
+
* whose `address` matches an allowlist entry remain. Loopback always
|
|
85
|
+
* survives so the SDK keeps `127.0.0.1` as the last-resort fallback.
|
|
86
|
+
*/
|
|
87
|
+
export declare function applyAllowlist(interfaces: readonly LocalInterface[], allowed: readonly string[]): readonly LocalInterface[];
|
|
88
|
+
/**
|
|
89
|
+
* Rank interfaces and pick the auto-selected outbound one. See the
|
|
90
|
+
* cap's `getPreferred` doc for the heuristic.
|
|
91
|
+
*/
|
|
92
|
+
export declare function pickPreferred(interfaces: readonly LocalInterface[]): LocalInterface | null;
|
|
93
|
+
/**
|
|
94
|
+
* Build the ordered candidate URL list. Priority schema:
|
|
95
|
+
* 0 — preferred LAN IPv4
|
|
96
|
+
* 10+ — other LAN IPv4
|
|
97
|
+
* 100 — public tunnel hostname (always HTTPS)
|
|
98
|
+
* 150 — mesh endpoint (Tailscale MagicDNS / 100.x, always HTTPS)
|
|
99
|
+
* 200+ — LAN IPv6
|
|
100
|
+
* 1000 — loopback (last resort)
|
|
101
|
+
*
|
|
102
|
+
* The mesh endpoint ranks just below a true public funnel (a Funnel is
|
|
103
|
+
* reachable by ANY client; the mesh needs the peer on the same tailnet)
|
|
104
|
+
* but above the IPv6 / loopback fallbacks — giving remote, mesh-joined
|
|
105
|
+
* clients a working candidate when no public tunnel is up.
|
|
106
|
+
*
|
|
107
|
+
* `scheme` controls LAN + loopback URLs. Browsers running over HTTPS
|
|
108
|
+
* block `http://` candidates as mixed content, so callers loaded over
|
|
109
|
+
* HTTPS should pass `scheme: 'https'` even when probing a LAN IP — the
|
|
110
|
+
* hub's cert manager already issues a SAN-multi cert covering local
|
|
111
|
+
* interfaces. The public tunnel + mesh endpoint always emit `https://`
|
|
112
|
+
* (the tunnel edge / the hub itself terminates TLS).
|
|
113
|
+
*/
|
|
114
|
+
export declare function buildEndpoints(interfaces: readonly LocalInterface[], port: number, includeLoopback: boolean, ipv4Only: boolean, publicHostname: string, scheme?: 'http' | 'https', meshEndpoint?: MeshEndpointCache | null): ConnectionEndpoint[];
|
|
115
|
+
/**
|
|
116
|
+
* First-boot heuristic: which addresses should the allowlist start
|
|
117
|
+
* with? Includes LAN + Wi-Fi IPv4 addresses + plausible IPv6:
|
|
118
|
+
*
|
|
119
|
+
* - **IPv4**: skip link-local (`169.254.*`), keep the rest.
|
|
120
|
+
* - **IPv6**: skip link-local (`fe80::*`), unspecified, and
|
|
121
|
+
* multicast. Keep ULAs (`fc00::/7` → `fc??:` / `fd??:`) and Global
|
|
122
|
+
* Unicast addresses (`2000::/3` → `2???`/`3???`). Privacy-extension
|
|
123
|
+
* temporary addresses get included by default; the operator can
|
|
124
|
+
* prune them from the Network Addresses tab if the rotating IPs
|
|
125
|
+
* become a nuisance.
|
|
126
|
+
*
|
|
127
|
+
* Skips docker/vpn/loopback/other entirely — those stay opt-in.
|
|
128
|
+
*/
|
|
129
|
+
export declare function autoSeedAllowlist(interfaces: readonly LocalInterface[]): string[];
|
|
130
|
+
/**
|
|
131
|
+
* Per-interface tooltip text surfaced on the "Unlikely usable" badge.
|
|
132
|
+
* Server-side so the UI doesn't re-derive the rationale (single source
|
|
133
|
+
* of truth). Returns `''` for plausible entries; the addon overlays
|
|
134
|
+
* this on the `LocalInterface.plausibleReason` field.
|
|
135
|
+
*/
|
|
136
|
+
export declare function explainNonPlausible(input: {
|
|
137
|
+
readonly kind: LocalInterface['kind'];
|
|
138
|
+
readonly family: 'IPv4' | 'IPv6';
|
|
139
|
+
readonly address: string;
|
|
140
|
+
readonly internal: boolean;
|
|
141
|
+
}): string;
|
|
142
|
+
/**
|
|
143
|
+
* Per-address gate used by `autoSeedAllowlist`. Exposed for tests so
|
|
144
|
+
* we can pin every classification rule without standing up the addon.
|
|
145
|
+
*/
|
|
146
|
+
export declare function isPlausibleAutoSeed(address: string, family: 'IPv4' | 'IPv6'): boolean;
|
|
147
|
+
export declare function classifyKind(name: string, address: string, internal: boolean): LocalInterface['kind'];
|
|
148
|
+
/** Convert an IPv4/IPv6 netmask string to its prefix length (CIDR). */
|
|
149
|
+
export declare function prefixLen(netmask: string): number;
|
|
150
|
+
export {};
|