@kinotic-ai/core 5.0.0-beta.1 → 5.0.0-beta.11

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.d.ts CHANGED
@@ -1,4 +1,32 @@
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; one whose resolution is expensive — a network round-trip, a disk read — must cache
15
+ * the result internally and refresh only as expiry nears, since reconnects pay the cost of
16
+ * every resolve. Returning null means this resolver found nothing — in a
17
+ * {@link ChainedCredentialsResolver} the next resolver tries; at the top level the connect
18
+ * fails naming every resolver consulted.
19
+ */
20
+ interface CredentialsResolver {
21
+ /** Short name shown in the connect failure that lists the resolvers consulted. */
22
+ readonly name: string;
23
+ /**
24
+ * Resolves credentials for a connection to the given server, or null when this resolver
25
+ * has none to offer.
26
+ */
27
+ resolve(server: ServerInfo): Promise<ResolvedCredentials | null>;
28
+ }
29
+ /**
2
30
  * Structural shape of a WebSocket used by the underlying STOMP client.
3
31
  * Copied from the WebSocket interface to avoid pulling in the DOM typelib,
4
32
  * so this type stays usable in Node environments where `lib: dom` is not set.
@@ -28,25 +56,45 @@ declare class ServerInfo {
28
56
  port?: number | null;
29
57
  useSSL?: boolean | null;
30
58
  }
59
+ /**
60
+ * Builds the base URL of a server for the given scheme stem ({@code 'ws'} or {@code 'http'}):
61
+ * TLS appends {@code s}, and the port is omitted when absent so the scheme default applies.
62
+ */
63
+ declare function buildServerUrl(server: ServerInfo, scheme: "ws" | "http"): string;
64
+ /**
65
+ * Builds the WebSocket broker URL the STOMP client connects to for a given server — the
66
+ * single source of truth for the broker path, so a caller supplying its own
67
+ * {@link WebSocketFactory} never re-types it and drifts from core.
68
+ */
69
+ declare function buildBrokerUrl(server: ServerInfo): string;
31
70
  declare enum SessionKeepAliveMode {
32
71
  NONE = "NONE",
33
72
  ACTIVITY = "ACTIVITY",
34
73
  CONNECTION = "CONNECTION"
35
74
  }
36
75
  /**
37
- * ConnectionInfo provides the information needed to connect to the kinoitc server.
76
+ * Options for {@link IKinotic#connect}. Every field is optional: absent {@link server}
77
+ * fields resolve from the environment (the {@code KINOTIC_SERVER_HOST} /
78
+ * {@code KINOTIC_SERVER_PORT} / {@code KINOTIC_SERVER_USE_SSL} variables, the browser's own
79
+ * location, then {@code https://api.kinotic.ai}), and absent {@link credentials} resolve
80
+ * through the default {@link ChainedCredentialsResolver} (environment variables, then the
81
+ * browser session).
38
82
  *
39
- * Authentication is performed during the WebSocket upgrade (handshake), not in
40
- * the STOMP CONNECT frame. In the browser, log in via the REST endpoints first
41
- * and the established session cookie will be used. In Node, supply a
42
- * {@link WebSocketFactory} that attaches the required upgrade headers.
83
+ * Authentication is performed during the WebSocket upgrade (handshake), not in the STOMP
84
+ * CONNECT frame: the resolved credentials supply the upgrade headers, or none for
85
+ * session-cookie auth.
43
86
  */
44
- declare class ConnectionInfo extends ServerInfo {
87
+ interface ConnectOptions {
88
+ /** The server to connect to; absent fields resolve from the environment. */
89
+ server?: Partial<ServerInfo>;
45
90
  /**
46
- * Optional factory used to create the underlying WebSocket. Use this in
47
- * Node to attach custom headers (such as Authorization) to the upgrade
48
- * request. If omitted, a default WebSocket is created and authentication
49
- * is expected to come from the session cookie.
91
+ * Finds the credentials this connection authenticates with, consulted on every
92
+ * (re)connect. Absent, the default resolution chain applies.
93
+ */
94
+ credentials?: CredentialsResolver;
95
+ /**
96
+ * Escape hatch: fully replaces socket construction and credential resolution. When set,
97
+ * {@link credentials} is ignored and the factory owns the upgrade request.
50
98
  */
51
99
  webSocketFactory?: WebSocketFactory;
52
100
  /**
@@ -60,7 +108,7 @@ declare class ConnectionInfo extends ServerInfo {
60
108
  * Defaults to {@link SessionKeepAliveMode.ACTIVITY}.
61
109
  * Use {@link SessionKeepAliveMode.NONE} to remove the session when the websocket connection closes.
62
110
  */
63
- sessionKeepAlive: SessionKeepAliveMode;
111
+ sessionKeepAlive?: SessionKeepAliveMode;
64
112
  }
65
113
  import { Optional } from "typescript-optional";
66
114
  import { Observable } from "rxjs";
@@ -76,7 +124,7 @@ interface Identifiable<T> {
76
124
  *
77
125
  * This is the base shape every participant shares, regardless of scope, and is what RPC-only
78
126
  * consumers work with directly. The Kinotic OS contract layers scope-typed participants on top
79
- * of it — see the participant types in {@code @kinotic-ai/os-api}.
127
+ * of it — see the participant types in {@code @kinotic-ai/management-api}.
80
128
  *
81
129
  * Mirrors the server {@code org.kinotic.core.api.security.Participant}.
82
130
  *
@@ -98,7 +146,7 @@ interface IParticipant extends Identifiable<string> {
98
146
  }
99
147
  /**
100
148
  * A logged-in participant on the RPC layer. Alias of {@link IParticipant}; the Kinotic OS contract
101
- * ({@code @kinotic-ai/os-api}) narrows this to scope-typed participants.
149
+ * ({@code @kinotic-ai/management-api}) narrows this to scope-typed participants.
102
150
  *
103
151
  * Created by Navid Mitchell on 6/2/20
104
152
  */
@@ -111,7 +159,7 @@ declare class ConnectedInfo {
111
159
  participant: Participant;
112
160
  }
113
161
  /**
114
- * Part of the low level portion of kinoitc representing data to be processed
162
+ * Part of the low level portion of kinotic representing data to be processed
115
163
  *
116
164
  * This is similar to a Stomp Frame but with more required information and no control plane semantics.
117
165
  *
@@ -167,7 +215,7 @@ interface IEvent {
167
215
  setHeader(key: string, value: string): void;
168
216
  }
169
217
  /**
170
- * Part of the low level portion of kinoitc representing a connection to a kinoitc server
218
+ * Part of the low level portion of kinotic representing a connection to a kinotic server
171
219
  * This is similar to a Stomp Client but with more required information and no control plane semantics.
172
220
  *
173
221
  * Created by Navid Mitchell on 2019-01-04.
@@ -179,15 +227,23 @@ interface IEventBus {
179
227
  */
180
228
  fatalErrors: Observable<Error>;
181
229
  /**
230
+ * Emits when the connection ends: an established connection drops before any reconnect, a fatal error
231
+ * closes it, or {@link disconnect} is called. The server releases everything it held for the connection
232
+ * at that moment: every request made on it is failed to its caller, and every invocation it was serving
233
+ * is failed to its requester.
234
+ */
235
+ connectionLost: Observable<void>;
236
+ /**
182
237
  * The {@link ServerInfo} used when connecting, if connected or null
183
238
  */
184
239
  serverInfo: ServerInfo | null;
185
240
  /**
186
- * Requests a connection to the given Stomp url
187
- * @param connectionInfo provides the information needed to connect to the kinoitc server
241
+ * Connects to a Kinotic server using fully resolved options — {@link IKinotic#connect}
242
+ * performs the resolution.
243
+ * @param options the resolved connection options
188
244
  * @return Promise containing the result of the initial connection attempt
189
245
  */
190
- connect(connectionInfo: ConnectionInfo): Promise<ConnectedInfo>;
246
+ connect(options: ConnectOptions): Promise<ConnectedInfo>;
191
247
  /**
192
248
  * Disconnects the client from the server
193
249
  * This will clear any subscriptions and close the connection
@@ -200,14 +256,15 @@ interface IEventBus {
200
256
  disconnect(force?: boolean): Promise<void>;
201
257
  /**
202
258
  * Determines if the connection is connected.
203
- * This means that there is an open connection to the Kinoitc server
259
+ * This means that there is an open connection to the Kinotic server
204
260
  * @return true if the connection is active false if not
205
261
  */
206
262
  isConnected(): boolean;
207
263
  /**
208
264
  * Determines if the connection is active.
209
265
  * This means {@link IEventBus#connect()} was called and was successful. The underlying connection may not be established yet.
210
- * If this is true and {@link IEventBus#isConnected} is false messages sent will be queued
266
+ * Subscriptions made while active are established once the connection comes up; sends require
267
+ * {@link IEventBus#isConnected}
211
268
  * @return true if the connection is active false if not
212
269
  */
213
270
  isConnectionActive(): boolean;
@@ -239,8 +296,11 @@ interface IEventBus {
239
296
  */
240
297
  requestStream(event: IEvent, sendControlEvents: boolean): Observable<IEvent>;
241
298
  /**
242
- * Send a single {@link IEvent} to the connected server
299
+ * Send a single {@link IEvent} to the connected server. Events are never held for a later
300
+ * connection, so the caller decides what an event it could not send means — see
301
+ * {@link isConnected}.
243
302
  * @param event to send
303
+ * @throws if the connection is not established
244
304
  */
245
305
  send(event: IEvent): void;
246
306
  }
@@ -253,7 +313,7 @@ declare enum EventConstants {
253
313
  CONTENT_LENGTH_HEADER = "content-length",
254
314
  REPLY_TO_HEADER = "reply-to",
255
315
  /**
256
- * Header provided by the server on connection to provide the {@link ConnectionInfo} as a JSON string
316
+ * Header provided by the server on connection to provide the {@link ConnectedInfo} as a JSON string
257
317
  */
258
318
  CONNECTED_INFO_HEADER = "connected-info",
259
319
  /**
@@ -332,9 +392,9 @@ interface ContextInterceptor<T extends ServiceContext> {
332
392
  intercept(event: IEvent, context: T): Promise<T> | T;
333
393
  }
334
394
  /**
335
- * `CRI` is a Kinoitc Resource Identifier used by Kinoitc to route requests appropriately.
395
+ * `CRI` is a Kinotic Resource Identifier used by Kinotic to route requests appropriately.
336
396
  *
337
- * The `CRI` is a URI where the parts are named differently for clarity as to their purpose within Kinoitc.
397
+ * The `CRI` is a URI where the parts are named differently for clarity as to their purpose within Kinotic.
338
398
  *
339
399
  * Will be in a format as follows where anything surrounded with `[]` is optional:
340
400
  *
@@ -372,7 +432,7 @@ interface CRI {
372
432
  * The zone this `CRI` is addressed in, or `null` if un-zoned.
373
433
  *
374
434
  * The zone is the isolation boundary routing is validated against, such as
375
- * `app.acme-org.orders-app` or `os-api`.
435
+ * `app.acme-org.orders-app` or `management-api`.
376
436
  *
377
437
  * For the following CRI, `zone` would be the portion specified by `zone`:
378
438
  *
@@ -491,6 +551,12 @@ declare class ServiceIdentifier {
491
551
  * @return the cri for this {@link ServiceIdentifier}
492
552
  */
493
553
  cri(): CRI;
554
+ /**
555
+ * The {@link CRI} of this service's shared, unscoped address. Every instance of a scoped
556
+ * service may listen here for the methods any instance can answer.
557
+ * @return the cri without the scope part
558
+ */
559
+ unscopedCri(): CRI;
494
560
  }
495
561
  import { Observable as Observable2 } from "rxjs";
496
562
  /**
@@ -613,11 +679,12 @@ interface IKinotic {
613
679
  */
614
680
  defaultZone: string | null;
615
681
  /**
616
- * Requests a connection to the given Stomp url
617
- * @param connectionInfo provides the information needed to connect to the kinoitc server
682
+ * Connects to a Kinotic server. Every option is optional: absent server fields and
683
+ * credentials resolve from the environment — see {@link ConnectOptions}.
684
+ * @param options overrides for the resolved connection, or nothing to resolve everything
618
685
  * @return Promise containing the result of the initial connection attempt
619
686
  */
620
- connect(connectionInfo: ConnectionInfo): Promise<ConnectedInfo>;
687
+ connect(options?: ConnectOptions): Promise<ConnectedInfo>;
621
688
  /**
622
689
  * Disconnects the client from the server
623
690
  * This will clear any subscriptions and close the connection
@@ -655,11 +722,12 @@ declare class KinoticSingleton implements IKinotic {
655
722
  get eventBus(): IEventBus;
656
723
  set eventBus(eventBus: IEventBus);
657
724
  /**
658
- * Requests a connection to the given Stomp url
659
- * @param connectionInfo provides the information needed to connect to the kinoitc server
725
+ * Connects to a Kinotic server. Every option is optional: absent server fields and
726
+ * credentials resolve from the environment — see {@link ConnectOptions}.
727
+ * @param options overrides for the resolved connection, or nothing to resolve everything
660
728
  * @return Promise containing the result of the initial connection attempt
661
729
  */
662
- connect(connectionInfo: ConnectionInfo): Promise<ConnectedInfo>;
730
+ connect(options?: ConnectOptions): Promise<ConnectedInfo>;
663
731
  /**
664
732
  * Disconnects the client from the server
665
733
  * This will clear any subscriptions and close the connection
@@ -689,6 +757,19 @@ declare const Kinotic: KinoticSingleton;
689
757
  */
690
758
  declare function Scope(value: Function, _context: ClassGetterDecoratorContext | ClassMethodDecoratorContext): void;
691
759
  /**
760
+ * Marks a method of a scoped published service that any instance may answer, because its
761
+ * result does not depend on which instance executes it - typically a read of shared state
762
+ * rather than of the instance's own.
763
+ *
764
+ * A scoped service normally listens only at its scoped address, so every invocation must name
765
+ * an instance. When at least one method carries ScopeOptional, each instance also listens on
766
+ * the service's shared unscoped address, where only the annotated methods may be invoked: an
767
+ * unscoped invocation of any other method is rejected, since it would execute on whichever
768
+ * instance happened to receive it.
769
+ */
770
+ declare function ScopeOptional(value: Function, _context: ClassMethodDecoratorContext): void;
771
+ declare function scopeOptionalMethodNames(instance: object): Set<string>;
772
+ /**
692
773
  * Sets the semantic version a service registers under.
693
774
  * @param version the version in X.Y.Z[-optional] format
694
775
  */
@@ -1042,6 +1123,16 @@ interface ICrudServiceProxy<T extends Identifiable<string>> extends IEditableDat
1042
1123
  */
1043
1124
  deleteById(id: string): Promise<void>;
1044
1125
  /**
1126
+ * Deletes the entity with the given id and waits for the deletion to be visible in search
1127
+ * results before returning.
1128
+ * Use this when you need read-your-write consistency immediately after deletion.
1129
+ *
1130
+ * @param id must not be {@literal null}.
1131
+ * @return a {@link Promise} signaling when the deletion is visible to search.
1132
+ * @throws IllegalArgumentException in case the given {@literal identity} is {@literal null}.
1133
+ */
1134
+ deleteByIdSync(id: string): Promise<void>;
1135
+ /**
1045
1136
  * Returns a {@link Page} of entities meeting the paging restriction provided in the {@code Pageable} object.
1046
1137
  *
1047
1138
  * @param pageable the page settings to be used
@@ -1072,6 +1163,7 @@ declare class CrudServiceProxy<T extends Identifiable<string>> implements ICrudS
1072
1163
  create(entity: T): Promise<T>;
1073
1164
  createSync(entity: T): Promise<T>;
1074
1165
  deleteById(id: string): Promise<void>;
1166
+ deleteByIdSync(id: string): Promise<void>;
1075
1167
  findAll(pageable: Pageable): Promise<IterablePage<T>>;
1076
1168
  findAllSinglePage(pageable: Pageable): Promise<Page<T>>;
1077
1169
  findById(id: string): Promise<T>;
@@ -1161,20 +1253,23 @@ declare class Event implements IEvent {
1161
1253
  */
1162
1254
  declare class EventBus implements IEventBus {
1163
1255
  serverInfo: ServerInfo | null;
1256
+ private readonly log;
1164
1257
  private stompConnectionManager;
1165
1258
  private connectionLifecycle;
1166
- private replyToCri;
1259
+ private disconnectRequests;
1167
1260
  private requestRepliesObservable;
1168
1261
  private requestRepliesSubject;
1169
1262
  private requestRepliesSubscription;
1170
1263
  private readonly activeCorrelationIds;
1171
1264
  private readonly recentlyReaped;
1265
+ private readonly connectionLostSubject;
1172
1266
  private static readonly REAP_DEBOUNCE_MS;
1173
1267
  constructor();
1174
1268
  get fatalErrors(): Observable3<Error>;
1269
+ get connectionLost(): Observable3<void>;
1175
1270
  isConnectionActive(): boolean;
1176
1271
  isConnected(): boolean;
1177
- connect(connectionInfo: ConnectionInfo): Promise<ConnectedInfo>;
1272
+ connect(options: ConnectOptions): Promise<ConnectedInfo>;
1178
1273
  disconnect(force?: boolean): Promise<void>;
1179
1274
  /** Runs connect and disconnect one at a time so they never overlap on the shared socket. */
1180
1275
  private serializeLifecycle;
@@ -1183,7 +1278,6 @@ declare class EventBus implements IEventBus {
1183
1278
  requestStream(event: IEvent, sendControlEvents?: boolean): Observable3<IEvent>;
1184
1279
  listen(_serverInfo: ServerInfo): Promise<void>;
1185
1280
  observe(cri: string): Observable3<IEvent>;
1186
- private cleanup;
1187
1281
  /**
1188
1282
  * Cancels a server stream whose reply arrived for a correlationId we no longer track. The server can't
1189
1283
  * detect this itself since all requests share one reply destination, so the cancel is sent to the
@@ -1191,8 +1285,14 @@ declare class EventBus implements IEventBus {
1191
1285
  */
1192
1286
  private cancelIfUnexpected;
1193
1287
  /**
1288
+ * Sends the control event that stops the server stream identified by the correlationId.
1289
+ * @param cri the service the stream originates from
1290
+ * @param correlationId the correlationId of the stream to cancel
1291
+ */
1292
+ private sendCancel;
1293
+ /**
1194
1294
  * Tears down the shared request-replies stream so the next request rebuilds it against the
1195
- * current {@link replyToCri}. Any in-flight requests are failed with the given reason since
1295
+ * connection's reply destination. Any in-flight requests are failed with the given reason since
1196
1296
  * their replies can no longer be delivered.
1197
1297
  */
1198
1298
  private resetRequestReplies;
@@ -1209,50 +1309,82 @@ declare class EventBus implements IEventBus {
1209
1309
  private _observe;
1210
1310
  }
1211
1311
  /**
1212
- * Supplies the headers attached to the WebSocket upgrade request when a Node/Bun
1213
- * client authenticates during the handshake. Implementations are consulted on every
1214
- * (re)connect, so a provider backing short-lived credentials can refresh them each time.
1312
+ * The error a service call fails with when the server answered it with an error reply. The reply body
1313
+ * describes the exception the server caught, so a caller can branch on which exception it was rather than
1314
+ * on a message written for people: a call that failed because the node serving it left the cluster carries
1315
+ * `RpcServiceUnavailableException`, one rejected because nothing served its address
1316
+ * `RpcMissingServiceException`.
1215
1317
  */
1216
- interface IAuthProvider {
1318
+ declare class RpcError extends Error {
1217
1319
  /**
1218
- * Returns the headers to attach to the WebSocket upgrade request.
1219
- * Invoked on every (re)connect.
1320
+ * The simple name of the exception the server caught, such as `RpcServiceUnavailableException`.
1220
1321
  */
1221
- getAuthHeaders(): Promise<Record<string, string>> | Record<string, string>;
1322
+ readonly exceptionName: string;
1323
+ /**
1324
+ * The fully qualified class name of the exception the server caught.
1325
+ */
1326
+ readonly exceptionClass: string;
1327
+ constructor(message: string, exceptionName: string, exceptionClass: string);
1328
+ /**
1329
+ * Builds the error an error reply carries. The body is the server's description of the exception when
1330
+ * it is JSON; otherwise the error header alone names the failure.
1331
+ * @param reply the error reply, which carries the error header
1332
+ */
1333
+ static fromEvent(reply: IEvent): RpcError;
1222
1334
  }
1223
1335
  /**
1224
- * Builds a {@link WebSocketFactory} that authenticates during the WebSocket upgrade
1225
- * by attaching the headers from {@link IAuthProvider#getAuthHeaders} to the request.
1226
- * The provider is consulted on every (re)connect, so short-lived credentials are
1227
- * refreshed each time. Supply the result as {@link ConnectionInfo#webSocketFactory}.
1228
- *
1229
- * For Node/Bun callers: the returned factory creates the socket with the runtime
1230
- * WebSocket's `headers` option, which the DOM `WebSocket` typings omit and the
1231
- * browser WebSocket does not support. Browser callers continue to omit
1232
- * `webSocketFactory` and authenticate via the session cookie from a prior REST login.
1233
- */
1234
- declare function createAuthenticatedWebSocketFactory(serverInfo: ServerInfo, authProvider: IAuthProvider): WebSocketFactory;
1235
- /**
1236
- * {@link IAuthProvider} that authenticates with HTTP Basic, sending
1237
- * `Authorization: Basic base64(login:passcode)` on every (re)connect.
1336
+ * Kinotic client credentials: a clientId/clientSecret pair presented as upgrade headers —
1337
+ * a user's email and password, or a machine identity's id and provisioned secret. Scope is
1338
+ * structural, determined by which ids are given: neither → SYSTEM, organizationId only →
1339
+ * ORGANIZATION, both → APPLICATION. For machines the ids are optional; when supplied they
1340
+ * must agree with the machine's own scope.
1238
1341
  */
1239
- declare class BasicAuthProvider implements IAuthProvider {
1240
- private readonly authHeader;
1241
- constructor(login: string, passcode: string);
1242
- getAuthHeaders(): Record<string, string>;
1342
+ declare class BasicCredentialsResolver implements CredentialsResolver {
1343
+ readonly name: string;
1344
+ private readonly credentials;
1345
+ constructor(clientId: string, clientSecret: string, organizationId?: string, applicationId?: string);
1346
+ resolve(_server: ServerInfo): Promise<ResolvedCredentials>;
1243
1347
  }
1244
1348
  /**
1245
- * {@link IAuthProvider} that authenticates with a bearer token, sending
1246
- * `Authorization: Bearer <token>` on every (re)connect.
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.
1349
+ * A bearer token presented as the {@code Authorization} upgrade header. The supplier form is
1350
+ * invoked on every (re)connect, so short-lived tokens can be refreshed each time.
1251
1351
  */
1252
- declare class BearerTokenAuthProvider implements IAuthProvider {
1352
+ declare class BearerCredentialsResolver implements CredentialsResolver {
1353
+ readonly name: string;
1253
1354
  private readonly token;
1254
1355
  constructor(token: string | (() => Promise<string> | string));
1255
- getAuthHeaders(): Promise<Record<string, string>>;
1356
+ resolve(_server: ServerInfo): Promise<ResolvedCredentials>;
1357
+ }
1358
+ /**
1359
+ * Consults each resolver in order and returns the first non-null result. The default
1360
+ * credential resolution every {@code Kinotic.connect()} without explicit credentials uses is
1361
+ * a chain; supply your own to control the sources or their order.
1362
+ */
1363
+ declare class ChainedCredentialsResolver implements CredentialsResolver {
1364
+ readonly name: string;
1365
+ private readonly resolvers;
1366
+ constructor(...resolvers: CredentialsResolver[]);
1367
+ resolve(server: ServerInfo): Promise<ResolvedCredentials | null>;
1368
+ }
1369
+ /**
1370
+ * Credentials from environment variables — the zero-code path for machines and services:
1371
+ * {@code KINOTIC_CLIENT_ID} + {@code KINOTIC_CLIENT_SECRET} (with optional
1372
+ * {@code KINOTIC_ORGANIZATION_ID} / {@code KINOTIC_APPLICATION_ID}) resolve as client
1373
+ * credentials, or {@code KINOTIC_TOKEN} as a bearer token. Resolves to null in a browser or
1374
+ * when none of the variables are set.
1375
+ */
1376
+ declare class EnvCredentialsResolver implements CredentialsResolver {
1377
+ readonly name: string;
1378
+ resolve(server: ServerInfo): Promise<ResolvedCredentials | null>;
1379
+ }
1380
+ /**
1381
+ * The browser's session cookie, established by a prior REST login. Resolves to credentials
1382
+ * with no headers — the cookie rides the upgrade request on its own — and only in an
1383
+ * environment that has one (a browser); elsewhere it passes to the next resolver.
1384
+ */
1385
+ declare class SessionCredentialsResolver implements CredentialsResolver {
1386
+ readonly name: string;
1387
+ resolve(_server: ServerInfo): Promise<ResolvedCredentials | null>;
1256
1388
  }
1257
1389
  /**
1258
1390
  * Some common constants used for the {@link Participant} and {@link Participant#getMetadata()}
@@ -1268,4 +1400,4 @@ declare class ParticipantConstants {
1268
1400
  /** The clientId TestSecurityService (clienttest profile) maps to the ANONYMOUS role in core package tests. */
1269
1401
  static readonly CLI_PARTICIPANT_ID: string;
1270
1402
  }
1271
- export { validateZone, validateLabel, receivesContext, isAdvertised, createCRI, createAuthenticatedWebSocketFactory, Zone, WebSocketFactory, Version, TextEventFactory, Sort, SessionKeepAliveMode, ServiceRegistry, ServiceContext, ServerInfo, Scope, 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, IAuthProvider, FunctionalIterablePage, EventConstants, EventBus, Event, Direction, DefaultCRI, DataSourceUtils, CursorPageable, CrudServiceProxyFactory, CrudServiceProxy, ContextInterceptor, Context, ConnectionInfo, ConnectedInfo, CRI, BearerTokenAuthProvider, BasicAuthProvider, AbstractIterablePage };
1403
+ export { validateZone, validateLabel, scopeOptionalMethodNames, receivesContext, isAdvertised, createCRI, buildServerUrl, buildBrokerUrl, Zone, WebSocketFactory, Version, TextEventFactory, Sort, SessionKeepAliveMode, SessionCredentialsResolver, ServiceRegistry, ServiceContext, ServerInfo, ScopeOptional, Scope, RpcError, 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 };