@kinotic-ai/core 5.0.0-beta.0 → 5.0.0-beta.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/index.cjs +217 -99
- package/dist/index.d.cts +110 -61
- package/dist/index.d.ts +110 -61
- package/dist/index.js +217 -99
- package/dist/node/index.cjs +79 -0
- package/dist/node/index.d.cts +9 -0
- package/dist/node/index.d.ts +9 -0
- package/dist/node/index.js +14 -0
- package/package.json +14 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* The outcome of credential resolution: the headers to present on the WebSocket upgrade and
|
|
3
|
+
* the scope the caller belongs to. {@link authHeaders} undefined means the connection
|
|
4
|
+
* authenticates with the browser session cookie instead of headers.
|
|
5
|
+
*/
|
|
6
|
+
interface ResolvedCredentials {
|
|
7
|
+
authHeaders?: Record<string, string>;
|
|
8
|
+
organizationId?: string;
|
|
9
|
+
applicationId?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Finds the credentials a Kinotic connection authenticates with. Consulted on every
|
|
13
|
+
* (re)connect, so an implementation backing short-lived credentials can refresh them each
|
|
14
|
+
* time. Returning null means this resolver found nothing — in a
|
|
15
|
+
* {@link ChainedCredentialsResolver} the next resolver tries; at the top level the connect
|
|
16
|
+
* fails naming every resolver consulted.
|
|
17
|
+
*/
|
|
18
|
+
interface CredentialsResolver {
|
|
19
|
+
/** Short name shown in the connect failure that lists the resolvers consulted. */
|
|
20
|
+
readonly name: string;
|
|
21
|
+
/**
|
|
22
|
+
* Resolves credentials for a connection to the given server, or null when this resolver
|
|
23
|
+
* has none to offer.
|
|
24
|
+
*/
|
|
25
|
+
resolve(server: ServerInfo): Promise<ResolvedCredentials | null>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
2
28
|
* Structural shape of a WebSocket used by the underlying STOMP client.
|
|
3
29
|
* Copied from the WebSocket interface to avoid pulling in the DOM typelib,
|
|
4
30
|
* so this type stays usable in Node environments where `lib: dom` is not set.
|
|
@@ -34,19 +60,29 @@ declare enum SessionKeepAliveMode {
|
|
|
34
60
|
CONNECTION = "CONNECTION"
|
|
35
61
|
}
|
|
36
62
|
/**
|
|
37
|
-
*
|
|
63
|
+
* Options for {@link IKinotic#connect}. Every field is optional: absent server fields resolve
|
|
64
|
+
* from the environment (the {@code KINOTIC_SERVER_HOST} / {@code KINOTIC_SERVER_PORT} /
|
|
65
|
+
* {@code KINOTIC_SERVER_USE_SSL} variables, the browser's own location, then
|
|
66
|
+
* {@code https://api.kinotic.com}), and absent {@link credentials} resolve through the
|
|
67
|
+
* default {@link ChainedCredentialsResolver} (environment variables, then the browser
|
|
68
|
+
* session).
|
|
38
69
|
*
|
|
39
|
-
* Authentication is performed during the WebSocket upgrade (handshake), not in
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* {@link WebSocketFactory} that attaches the required upgrade headers.
|
|
70
|
+
* Authentication is performed during the WebSocket upgrade (handshake), not in the STOMP
|
|
71
|
+
* CONNECT frame: the resolved credentials supply the upgrade headers, or none for
|
|
72
|
+
* session-cookie auth.
|
|
43
73
|
*/
|
|
44
|
-
|
|
74
|
+
interface ConnectOptions {
|
|
75
|
+
host?: string;
|
|
76
|
+
port?: number | null;
|
|
77
|
+
useSSL?: boolean | null;
|
|
78
|
+
/**
|
|
79
|
+
* Finds the credentials this connection authenticates with, consulted on every
|
|
80
|
+
* (re)connect. Absent, the default resolution chain applies.
|
|
81
|
+
*/
|
|
82
|
+
credentials?: CredentialsResolver;
|
|
45
83
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* request. If omitted, a default WebSocket is created and authentication
|
|
49
|
-
* is expected to come from the session cookie.
|
|
84
|
+
* Escape hatch: fully replaces socket construction and credential resolution. When set,
|
|
85
|
+
* {@link credentials} is ignored and the factory owns the upgrade request.
|
|
50
86
|
*/
|
|
51
87
|
webSocketFactory?: WebSocketFactory;
|
|
52
88
|
/**
|
|
@@ -60,7 +96,7 @@ declare class ConnectionInfo extends ServerInfo {
|
|
|
60
96
|
* Defaults to {@link SessionKeepAliveMode.ACTIVITY}.
|
|
61
97
|
* Use {@link SessionKeepAliveMode.NONE} to remove the session when the websocket connection closes.
|
|
62
98
|
*/
|
|
63
|
-
sessionKeepAlive
|
|
99
|
+
sessionKeepAlive?: SessionKeepAliveMode;
|
|
64
100
|
}
|
|
65
101
|
import { Optional } from "typescript-optional";
|
|
66
102
|
import { Observable } from "rxjs";
|
|
@@ -183,11 +219,12 @@ interface IEventBus {
|
|
|
183
219
|
*/
|
|
184
220
|
serverInfo: ServerInfo | null;
|
|
185
221
|
/**
|
|
186
|
-
*
|
|
187
|
-
*
|
|
222
|
+
* Connects to a Kinotic server using fully resolved options — {@link IKinotic#connect}
|
|
223
|
+
* performs the resolution.
|
|
224
|
+
* @param options the resolved connection options
|
|
188
225
|
* @return Promise containing the result of the initial connection attempt
|
|
189
226
|
*/
|
|
190
|
-
connect(
|
|
227
|
+
connect(options: ConnectOptions): Promise<ConnectedInfo>;
|
|
191
228
|
/**
|
|
192
229
|
* Disconnects the client from the server
|
|
193
230
|
* This will clear any subscriptions and close the connection
|
|
@@ -253,7 +290,7 @@ declare enum EventConstants {
|
|
|
253
290
|
CONTENT_LENGTH_HEADER = "content-length",
|
|
254
291
|
REPLY_TO_HEADER = "reply-to",
|
|
255
292
|
/**
|
|
256
|
-
* Header provided by the server on connection to provide the {@link
|
|
293
|
+
* Header provided by the server on connection to provide the {@link ConnectedInfo} as a JSON string
|
|
257
294
|
*/
|
|
258
295
|
CONNECTED_INFO_HEADER = "connected-info",
|
|
259
296
|
/**
|
|
@@ -613,11 +650,12 @@ interface IKinotic {
|
|
|
613
650
|
*/
|
|
614
651
|
defaultZone: string | null;
|
|
615
652
|
/**
|
|
616
|
-
*
|
|
617
|
-
*
|
|
653
|
+
* Connects to a Kinotic server. Every option is optional: absent server fields and
|
|
654
|
+
* credentials resolve from the environment — see {@link ConnectOptions}.
|
|
655
|
+
* @param options overrides for the resolved connection, or nothing to resolve everything
|
|
618
656
|
* @return Promise containing the result of the initial connection attempt
|
|
619
657
|
*/
|
|
620
|
-
connect(
|
|
658
|
+
connect(options?: ConnectOptions): Promise<ConnectedInfo>;
|
|
621
659
|
/**
|
|
622
660
|
* Disconnects the client from the server
|
|
623
661
|
* This will clear any subscriptions and close the connection
|
|
@@ -655,11 +693,12 @@ declare class KinoticSingleton implements IKinotic {
|
|
|
655
693
|
get eventBus(): IEventBus;
|
|
656
694
|
set eventBus(eventBus: IEventBus);
|
|
657
695
|
/**
|
|
658
|
-
*
|
|
659
|
-
*
|
|
696
|
+
* Connects to a Kinotic server. Every option is optional: absent server fields and
|
|
697
|
+
* credentials resolve from the environment — see {@link ConnectOptions}.
|
|
698
|
+
* @param options overrides for the resolved connection, or nothing to resolve everything
|
|
660
699
|
* @return Promise containing the result of the initial connection attempt
|
|
661
700
|
*/
|
|
662
|
-
connect(
|
|
701
|
+
connect(options?: ConnectOptions): Promise<ConnectedInfo>;
|
|
663
702
|
/**
|
|
664
703
|
* Disconnects the client from the server
|
|
665
704
|
* This will clear any subscriptions and close the connection
|
|
@@ -1174,7 +1213,7 @@ declare class EventBus implements IEventBus {
|
|
|
1174
1213
|
get fatalErrors(): Observable3<Error>;
|
|
1175
1214
|
isConnectionActive(): boolean;
|
|
1176
1215
|
isConnected(): boolean;
|
|
1177
|
-
connect(
|
|
1216
|
+
connect(options: ConnectOptions): Promise<ConnectedInfo>;
|
|
1178
1217
|
disconnect(force?: boolean): Promise<void>;
|
|
1179
1218
|
/** Runs connect and disconnect one at a time so they never overlap on the shared socket. */
|
|
1180
1219
|
private serializeLifecycle;
|
|
@@ -1209,50 +1248,58 @@ declare class EventBus implements IEventBus {
|
|
|
1209
1248
|
private _observe;
|
|
1210
1249
|
}
|
|
1211
1250
|
/**
|
|
1212
|
-
*
|
|
1213
|
-
*
|
|
1214
|
-
*
|
|
1251
|
+
* Kinotic client credentials: a clientId/clientSecret pair presented as upgrade headers —
|
|
1252
|
+
* a user's email and password, or a machine identity's id and provisioned secret. Scope is
|
|
1253
|
+
* structural, determined by which ids are given: neither → SYSTEM, organizationId only →
|
|
1254
|
+
* ORGANIZATION, both → APPLICATION. For machines the ids are optional; when supplied they
|
|
1255
|
+
* must agree with the machine's own scope.
|
|
1215
1256
|
*/
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
getAuthHeaders(): Promise<Record<string, string>> | Record<string, string>;
|
|
1257
|
+
declare class BasicCredentialsResolver implements CredentialsResolver {
|
|
1258
|
+
readonly name: string;
|
|
1259
|
+
private readonly credentials;
|
|
1260
|
+
constructor(clientId: string, clientSecret: string, organizationId?: string, applicationId?: string);
|
|
1261
|
+
resolve(_server: ServerInfo): Promise<ResolvedCredentials>;
|
|
1222
1262
|
}
|
|
1223
1263
|
/**
|
|
1224
|
-
*
|
|
1225
|
-
*
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1264
|
+
* A bearer token presented as the {@code Authorization} upgrade header. The supplier form is
|
|
1265
|
+
* invoked on every (re)connect, so short-lived tokens can be refreshed each time.
|
|
1266
|
+
*/
|
|
1267
|
+
declare class BearerCredentialsResolver implements CredentialsResolver {
|
|
1268
|
+
readonly name: string;
|
|
1269
|
+
private readonly token;
|
|
1270
|
+
constructor(token: string | (() => Promise<string> | string));
|
|
1271
|
+
resolve(_server: ServerInfo): Promise<ResolvedCredentials>;
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* Consults each resolver in order and returns the first non-null result. The default
|
|
1275
|
+
* credential resolution every {@code Kinotic.connect()} without explicit credentials uses is
|
|
1276
|
+
* a chain; supply your own to control the sources or their order.
|
|
1233
1277
|
*/
|
|
1234
|
-
declare
|
|
1278
|
+
declare class ChainedCredentialsResolver implements CredentialsResolver {
|
|
1279
|
+
readonly name: string;
|
|
1280
|
+
private readonly resolvers;
|
|
1281
|
+
constructor(...resolvers: CredentialsResolver[]);
|
|
1282
|
+
resolve(server: ServerInfo): Promise<ResolvedCredentials | null>;
|
|
1283
|
+
}
|
|
1235
1284
|
/**
|
|
1236
|
-
*
|
|
1237
|
-
*
|
|
1285
|
+
* Credentials from environment variables — the zero-code path for machines and services:
|
|
1286
|
+
* {@code KINOTIC_CLIENT_ID} + {@code KINOTIC_CLIENT_SECRET} (with optional
|
|
1287
|
+
* {@code KINOTIC_ORGANIZATION_ID} / {@code KINOTIC_APPLICATION_ID}) resolve as client
|
|
1288
|
+
* credentials, or {@code KINOTIC_TOKEN} as a bearer token. Resolves to null in a browser or
|
|
1289
|
+
* when none of the variables are set.
|
|
1238
1290
|
*/
|
|
1239
|
-
declare class
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
getAuthHeaders(): Record<string, string>;
|
|
1291
|
+
declare class EnvCredentialsResolver implements CredentialsResolver {
|
|
1292
|
+
readonly name: string;
|
|
1293
|
+
resolve(_server: ServerInfo): Promise<ResolvedCredentials | null>;
|
|
1243
1294
|
}
|
|
1244
1295
|
/**
|
|
1245
|
-
*
|
|
1246
|
-
*
|
|
1247
|
-
*
|
|
1248
|
-
* Pass a string for a static token, or a supplier when the token is short-lived
|
|
1249
|
-
* and must be refreshed before each connect (for example, an OAuth device-grant
|
|
1250
|
-
* access token). The supplier may be async and is invoked on every (re)connect.
|
|
1296
|
+
* The browser's session cookie, established by a prior REST login. Resolves to credentials
|
|
1297
|
+
* with no headers — the cookie rides the upgrade request on its own — and only in an
|
|
1298
|
+
* environment that has one (a browser); elsewhere it passes to the next resolver.
|
|
1251
1299
|
*/
|
|
1252
|
-
declare class
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
getAuthHeaders(): Promise<Record<string, string>>;
|
|
1300
|
+
declare class SessionCredentialsResolver implements CredentialsResolver {
|
|
1301
|
+
readonly name: string;
|
|
1302
|
+
resolve(_server: ServerInfo): Promise<ResolvedCredentials | null>;
|
|
1256
1303
|
}
|
|
1257
1304
|
/**
|
|
1258
1305
|
* Some common constants used for the {@link Participant} and {@link Participant#getMetadata()}
|
|
@@ -1260,10 +1307,12 @@ declare class BearerTokenAuthProvider implements IAuthProvider {
|
|
|
1260
1307
|
*/
|
|
1261
1308
|
declare class ParticipantConstants {
|
|
1262
1309
|
static readonly PARTICIPANT_TYPE_METADATA_KEY: string;
|
|
1263
|
-
static readonly PARTICIPANT_TYPE_DEVICE: string;
|
|
1264
|
-
static readonly PARTICIPANT_TYPE_CLI: string;
|
|
1265
1310
|
static readonly PARTICIPANT_TYPE_USER: string;
|
|
1266
|
-
|
|
1311
|
+
/** A client (CLI, MCP host) acting on behalf of a user that authorized it. */
|
|
1312
|
+
static readonly PARTICIPANT_TYPE_DELEGATE: string;
|
|
1313
|
+
/** A non-human caller with its own credential — a platform daemon or an external API client. */
|
|
1314
|
+
static readonly PARTICIPANT_TYPE_MACHINE: string;
|
|
1315
|
+
/** The clientId TestSecurityService (clienttest profile) maps to the ANONYMOUS role in core package tests. */
|
|
1267
1316
|
static readonly CLI_PARTICIPANT_ID: string;
|
|
1268
1317
|
}
|
|
1269
|
-
export { validateZone, validateLabel, receivesContext, isAdvertised, createCRI,
|
|
1318
|
+
export { validateZone, validateLabel, receivesContext, isAdvertised, createCRI, Zone, WebSocketFactory, Version, TextEventFactory, Sort, SessionKeepAliveMode, SessionCredentialsResolver, ServiceRegistry, ServiceContext, ServerInfo, Scope, ResolvedCredentials, Publish, ParticipantConstants, Participant, Pageable, Page, Order, OffsetPageable, NullHandling, KinoticSingleton, KinoticPlugin, Kinotic, JsonEventFactory, IterablePage, Identifiable, IWebSocket, IServiceRegistry, IServiceProxy, IParticipant, IKinotic, IEventFactory, IEventBus, IEvent, IEditableDataSource, IDataSource, ICrudServiceProxyFactory, ICrudServiceProxy, FunctionalIterablePage, EventConstants, EventBus, Event, EnvCredentialsResolver, Direction, DefaultCRI, DataSourceUtils, CursorPageable, CrudServiceProxyFactory, CrudServiceProxy, CredentialsResolver, ContextInterceptor, Context, ConnectedInfo, ConnectOptions, ChainedCredentialsResolver, CRI, BearerCredentialsResolver, BasicCredentialsResolver, AbstractIterablePage };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* The outcome of credential resolution: the headers to present on the WebSocket upgrade and
|
|
3
|
+
* the scope the caller belongs to. {@link authHeaders} undefined means the connection
|
|
4
|
+
* authenticates with the browser session cookie instead of headers.
|
|
5
|
+
*/
|
|
6
|
+
interface ResolvedCredentials {
|
|
7
|
+
authHeaders?: Record<string, string>;
|
|
8
|
+
organizationId?: string;
|
|
9
|
+
applicationId?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Finds the credentials a Kinotic connection authenticates with. Consulted on every
|
|
13
|
+
* (re)connect, so an implementation backing short-lived credentials can refresh them each
|
|
14
|
+
* time. Returning null means this resolver found nothing — in a
|
|
15
|
+
* {@link ChainedCredentialsResolver} the next resolver tries; at the top level the connect
|
|
16
|
+
* fails naming every resolver consulted.
|
|
17
|
+
*/
|
|
18
|
+
interface CredentialsResolver {
|
|
19
|
+
/** Short name shown in the connect failure that lists the resolvers consulted. */
|
|
20
|
+
readonly name: string;
|
|
21
|
+
/**
|
|
22
|
+
* Resolves credentials for a connection to the given server, or null when this resolver
|
|
23
|
+
* has none to offer.
|
|
24
|
+
*/
|
|
25
|
+
resolve(server: ServerInfo): Promise<ResolvedCredentials | null>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
2
28
|
* Structural shape of a WebSocket used by the underlying STOMP client.
|
|
3
29
|
* Copied from the WebSocket interface to avoid pulling in the DOM typelib,
|
|
4
30
|
* so this type stays usable in Node environments where `lib: dom` is not set.
|
|
@@ -34,19 +60,29 @@ declare enum SessionKeepAliveMode {
|
|
|
34
60
|
CONNECTION = "CONNECTION"
|
|
35
61
|
}
|
|
36
62
|
/**
|
|
37
|
-
*
|
|
63
|
+
* Options for {@link IKinotic#connect}. Every field is optional: absent server fields resolve
|
|
64
|
+
* from the environment (the {@code KINOTIC_SERVER_HOST} / {@code KINOTIC_SERVER_PORT} /
|
|
65
|
+
* {@code KINOTIC_SERVER_USE_SSL} variables, the browser's own location, then
|
|
66
|
+
* {@code https://api.kinotic.com}), and absent {@link credentials} resolve through the
|
|
67
|
+
* default {@link ChainedCredentialsResolver} (environment variables, then the browser
|
|
68
|
+
* session).
|
|
38
69
|
*
|
|
39
|
-
* Authentication is performed during the WebSocket upgrade (handshake), not in
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* {@link WebSocketFactory} that attaches the required upgrade headers.
|
|
70
|
+
* Authentication is performed during the WebSocket upgrade (handshake), not in the STOMP
|
|
71
|
+
* CONNECT frame: the resolved credentials supply the upgrade headers, or none for
|
|
72
|
+
* session-cookie auth.
|
|
43
73
|
*/
|
|
44
|
-
|
|
74
|
+
interface ConnectOptions {
|
|
75
|
+
host?: string;
|
|
76
|
+
port?: number | null;
|
|
77
|
+
useSSL?: boolean | null;
|
|
78
|
+
/**
|
|
79
|
+
* Finds the credentials this connection authenticates with, consulted on every
|
|
80
|
+
* (re)connect. Absent, the default resolution chain applies.
|
|
81
|
+
*/
|
|
82
|
+
credentials?: CredentialsResolver;
|
|
45
83
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* request. If omitted, a default WebSocket is created and authentication
|
|
49
|
-
* is expected to come from the session cookie.
|
|
84
|
+
* Escape hatch: fully replaces socket construction and credential resolution. When set,
|
|
85
|
+
* {@link credentials} is ignored and the factory owns the upgrade request.
|
|
50
86
|
*/
|
|
51
87
|
webSocketFactory?: WebSocketFactory;
|
|
52
88
|
/**
|
|
@@ -60,7 +96,7 @@ declare class ConnectionInfo extends ServerInfo {
|
|
|
60
96
|
* Defaults to {@link SessionKeepAliveMode.ACTIVITY}.
|
|
61
97
|
* Use {@link SessionKeepAliveMode.NONE} to remove the session when the websocket connection closes.
|
|
62
98
|
*/
|
|
63
|
-
sessionKeepAlive
|
|
99
|
+
sessionKeepAlive?: SessionKeepAliveMode;
|
|
64
100
|
}
|
|
65
101
|
import { Optional } from "typescript-optional";
|
|
66
102
|
import { Observable } from "rxjs";
|
|
@@ -183,11 +219,12 @@ interface IEventBus {
|
|
|
183
219
|
*/
|
|
184
220
|
serverInfo: ServerInfo | null;
|
|
185
221
|
/**
|
|
186
|
-
*
|
|
187
|
-
*
|
|
222
|
+
* Connects to a Kinotic server using fully resolved options — {@link IKinotic#connect}
|
|
223
|
+
* performs the resolution.
|
|
224
|
+
* @param options the resolved connection options
|
|
188
225
|
* @return Promise containing the result of the initial connection attempt
|
|
189
226
|
*/
|
|
190
|
-
connect(
|
|
227
|
+
connect(options: ConnectOptions): Promise<ConnectedInfo>;
|
|
191
228
|
/**
|
|
192
229
|
* Disconnects the client from the server
|
|
193
230
|
* This will clear any subscriptions and close the connection
|
|
@@ -253,7 +290,7 @@ declare enum EventConstants {
|
|
|
253
290
|
CONTENT_LENGTH_HEADER = "content-length",
|
|
254
291
|
REPLY_TO_HEADER = "reply-to",
|
|
255
292
|
/**
|
|
256
|
-
* Header provided by the server on connection to provide the {@link
|
|
293
|
+
* Header provided by the server on connection to provide the {@link ConnectedInfo} as a JSON string
|
|
257
294
|
*/
|
|
258
295
|
CONNECTED_INFO_HEADER = "connected-info",
|
|
259
296
|
/**
|
|
@@ -613,11 +650,12 @@ interface IKinotic {
|
|
|
613
650
|
*/
|
|
614
651
|
defaultZone: string | null;
|
|
615
652
|
/**
|
|
616
|
-
*
|
|
617
|
-
*
|
|
653
|
+
* Connects to a Kinotic server. Every option is optional: absent server fields and
|
|
654
|
+
* credentials resolve from the environment — see {@link ConnectOptions}.
|
|
655
|
+
* @param options overrides for the resolved connection, or nothing to resolve everything
|
|
618
656
|
* @return Promise containing the result of the initial connection attempt
|
|
619
657
|
*/
|
|
620
|
-
connect(
|
|
658
|
+
connect(options?: ConnectOptions): Promise<ConnectedInfo>;
|
|
621
659
|
/**
|
|
622
660
|
* Disconnects the client from the server
|
|
623
661
|
* This will clear any subscriptions and close the connection
|
|
@@ -655,11 +693,12 @@ declare class KinoticSingleton implements IKinotic {
|
|
|
655
693
|
get eventBus(): IEventBus;
|
|
656
694
|
set eventBus(eventBus: IEventBus);
|
|
657
695
|
/**
|
|
658
|
-
*
|
|
659
|
-
*
|
|
696
|
+
* Connects to a Kinotic server. Every option is optional: absent server fields and
|
|
697
|
+
* credentials resolve from the environment — see {@link ConnectOptions}.
|
|
698
|
+
* @param options overrides for the resolved connection, or nothing to resolve everything
|
|
660
699
|
* @return Promise containing the result of the initial connection attempt
|
|
661
700
|
*/
|
|
662
|
-
connect(
|
|
701
|
+
connect(options?: ConnectOptions): Promise<ConnectedInfo>;
|
|
663
702
|
/**
|
|
664
703
|
* Disconnects the client from the server
|
|
665
704
|
* This will clear any subscriptions and close the connection
|
|
@@ -1174,7 +1213,7 @@ declare class EventBus implements IEventBus {
|
|
|
1174
1213
|
get fatalErrors(): Observable3<Error>;
|
|
1175
1214
|
isConnectionActive(): boolean;
|
|
1176
1215
|
isConnected(): boolean;
|
|
1177
|
-
connect(
|
|
1216
|
+
connect(options: ConnectOptions): Promise<ConnectedInfo>;
|
|
1178
1217
|
disconnect(force?: boolean): Promise<void>;
|
|
1179
1218
|
/** Runs connect and disconnect one at a time so they never overlap on the shared socket. */
|
|
1180
1219
|
private serializeLifecycle;
|
|
@@ -1209,50 +1248,58 @@ declare class EventBus implements IEventBus {
|
|
|
1209
1248
|
private _observe;
|
|
1210
1249
|
}
|
|
1211
1250
|
/**
|
|
1212
|
-
*
|
|
1213
|
-
*
|
|
1214
|
-
*
|
|
1251
|
+
* Kinotic client credentials: a clientId/clientSecret pair presented as upgrade headers —
|
|
1252
|
+
* a user's email and password, or a machine identity's id and provisioned secret. Scope is
|
|
1253
|
+
* structural, determined by which ids are given: neither → SYSTEM, organizationId only →
|
|
1254
|
+
* ORGANIZATION, both → APPLICATION. For machines the ids are optional; when supplied they
|
|
1255
|
+
* must agree with the machine's own scope.
|
|
1215
1256
|
*/
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
getAuthHeaders(): Promise<Record<string, string>> | Record<string, string>;
|
|
1257
|
+
declare class BasicCredentialsResolver implements CredentialsResolver {
|
|
1258
|
+
readonly name: string;
|
|
1259
|
+
private readonly credentials;
|
|
1260
|
+
constructor(clientId: string, clientSecret: string, organizationId?: string, applicationId?: string);
|
|
1261
|
+
resolve(_server: ServerInfo): Promise<ResolvedCredentials>;
|
|
1222
1262
|
}
|
|
1223
1263
|
/**
|
|
1224
|
-
*
|
|
1225
|
-
*
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1264
|
+
* A bearer token presented as the {@code Authorization} upgrade header. The supplier form is
|
|
1265
|
+
* invoked on every (re)connect, so short-lived tokens can be refreshed each time.
|
|
1266
|
+
*/
|
|
1267
|
+
declare class BearerCredentialsResolver implements CredentialsResolver {
|
|
1268
|
+
readonly name: string;
|
|
1269
|
+
private readonly token;
|
|
1270
|
+
constructor(token: string | (() => Promise<string> | string));
|
|
1271
|
+
resolve(_server: ServerInfo): Promise<ResolvedCredentials>;
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* Consults each resolver in order and returns the first non-null result. The default
|
|
1275
|
+
* credential resolution every {@code Kinotic.connect()} without explicit credentials uses is
|
|
1276
|
+
* a chain; supply your own to control the sources or their order.
|
|
1233
1277
|
*/
|
|
1234
|
-
declare
|
|
1278
|
+
declare class ChainedCredentialsResolver implements CredentialsResolver {
|
|
1279
|
+
readonly name: string;
|
|
1280
|
+
private readonly resolvers;
|
|
1281
|
+
constructor(...resolvers: CredentialsResolver[]);
|
|
1282
|
+
resolve(server: ServerInfo): Promise<ResolvedCredentials | null>;
|
|
1283
|
+
}
|
|
1235
1284
|
/**
|
|
1236
|
-
*
|
|
1237
|
-
*
|
|
1285
|
+
* Credentials from environment variables — the zero-code path for machines and services:
|
|
1286
|
+
* {@code KINOTIC_CLIENT_ID} + {@code KINOTIC_CLIENT_SECRET} (with optional
|
|
1287
|
+
* {@code KINOTIC_ORGANIZATION_ID} / {@code KINOTIC_APPLICATION_ID}) resolve as client
|
|
1288
|
+
* credentials, or {@code KINOTIC_TOKEN} as a bearer token. Resolves to null in a browser or
|
|
1289
|
+
* when none of the variables are set.
|
|
1238
1290
|
*/
|
|
1239
|
-
declare class
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
getAuthHeaders(): Record<string, string>;
|
|
1291
|
+
declare class EnvCredentialsResolver implements CredentialsResolver {
|
|
1292
|
+
readonly name: string;
|
|
1293
|
+
resolve(_server: ServerInfo): Promise<ResolvedCredentials | null>;
|
|
1243
1294
|
}
|
|
1244
1295
|
/**
|
|
1245
|
-
*
|
|
1246
|
-
*
|
|
1247
|
-
*
|
|
1248
|
-
* Pass a string for a static token, or a supplier when the token is short-lived
|
|
1249
|
-
* and must be refreshed before each connect (for example, an OAuth device-grant
|
|
1250
|
-
* access token). The supplier may be async and is invoked on every (re)connect.
|
|
1296
|
+
* The browser's session cookie, established by a prior REST login. Resolves to credentials
|
|
1297
|
+
* with no headers — the cookie rides the upgrade request on its own — and only in an
|
|
1298
|
+
* environment that has one (a browser); elsewhere it passes to the next resolver.
|
|
1251
1299
|
*/
|
|
1252
|
-
declare class
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
getAuthHeaders(): Promise<Record<string, string>>;
|
|
1300
|
+
declare class SessionCredentialsResolver implements CredentialsResolver {
|
|
1301
|
+
readonly name: string;
|
|
1302
|
+
resolve(_server: ServerInfo): Promise<ResolvedCredentials | null>;
|
|
1256
1303
|
}
|
|
1257
1304
|
/**
|
|
1258
1305
|
* Some common constants used for the {@link Participant} and {@link Participant#getMetadata()}
|
|
@@ -1260,10 +1307,12 @@ declare class BearerTokenAuthProvider implements IAuthProvider {
|
|
|
1260
1307
|
*/
|
|
1261
1308
|
declare class ParticipantConstants {
|
|
1262
1309
|
static readonly PARTICIPANT_TYPE_METADATA_KEY: string;
|
|
1263
|
-
static readonly PARTICIPANT_TYPE_DEVICE: string;
|
|
1264
|
-
static readonly PARTICIPANT_TYPE_CLI: string;
|
|
1265
1310
|
static readonly PARTICIPANT_TYPE_USER: string;
|
|
1266
|
-
|
|
1311
|
+
/** A client (CLI, MCP host) acting on behalf of a user that authorized it. */
|
|
1312
|
+
static readonly PARTICIPANT_TYPE_DELEGATE: string;
|
|
1313
|
+
/** A non-human caller with its own credential — a platform daemon or an external API client. */
|
|
1314
|
+
static readonly PARTICIPANT_TYPE_MACHINE: string;
|
|
1315
|
+
/** The clientId TestSecurityService (clienttest profile) maps to the ANONYMOUS role in core package tests. */
|
|
1267
1316
|
static readonly CLI_PARTICIPANT_ID: string;
|
|
1268
1317
|
}
|
|
1269
|
-
export { validateZone, validateLabel, receivesContext, isAdvertised, createCRI,
|
|
1318
|
+
export { validateZone, validateLabel, receivesContext, isAdvertised, createCRI, Zone, WebSocketFactory, Version, TextEventFactory, Sort, SessionKeepAliveMode, SessionCredentialsResolver, ServiceRegistry, ServiceContext, ServerInfo, Scope, ResolvedCredentials, Publish, ParticipantConstants, Participant, Pageable, Page, Order, OffsetPageable, NullHandling, KinoticSingleton, KinoticPlugin, Kinotic, JsonEventFactory, IterablePage, Identifiable, IWebSocket, IServiceRegistry, IServiceProxy, IParticipant, IKinotic, IEventFactory, IEventBus, IEvent, IEditableDataSource, IDataSource, ICrudServiceProxyFactory, ICrudServiceProxy, FunctionalIterablePage, EventConstants, EventBus, Event, EnvCredentialsResolver, Direction, DefaultCRI, DataSourceUtils, CursorPageable, CrudServiceProxyFactory, CrudServiceProxy, CredentialsResolver, ContextInterceptor, Context, ConnectedInfo, ConnectOptions, ChainedCredentialsResolver, CRI, BearerCredentialsResolver, BasicCredentialsResolver, AbstractIterablePage };
|