@kinotic-ai/core 5.0.0-beta.1 → 5.0.0-beta.10
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/README.md +2 -2
- package/dist/index.cjs +525 -293
- package/dist/index.d.cts +197 -68
- package/dist/index.d.ts +197 -68
- package/dist/index.js +519 -287
- 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 +28 -19
package/dist/index.d.cts
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
|
-
*
|
|
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
|
-
*
|
|
41
|
-
*
|
|
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
|
-
|
|
87
|
+
interface ConnectOptions {
|
|
88
|
+
/** The server to connect to; absent fields resolve from the environment. */
|
|
89
|
+
server?: Partial<ServerInfo>;
|
|
45
90
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
|
|
49
|
-
|
|
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
|
|
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/
|
|
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/
|
|
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
|
|
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
|
|
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.
|
|
@@ -183,11 +231,12 @@ interface IEventBus {
|
|
|
183
231
|
*/
|
|
184
232
|
serverInfo: ServerInfo | null;
|
|
185
233
|
/**
|
|
186
|
-
*
|
|
187
|
-
*
|
|
234
|
+
* Connects to a Kinotic server using fully resolved options — {@link IKinotic#connect}
|
|
235
|
+
* performs the resolution.
|
|
236
|
+
* @param options the resolved connection options
|
|
188
237
|
* @return Promise containing the result of the initial connection attempt
|
|
189
238
|
*/
|
|
190
|
-
connect(
|
|
239
|
+
connect(options: ConnectOptions): Promise<ConnectedInfo>;
|
|
191
240
|
/**
|
|
192
241
|
* Disconnects the client from the server
|
|
193
242
|
* This will clear any subscriptions and close the connection
|
|
@@ -200,14 +249,15 @@ interface IEventBus {
|
|
|
200
249
|
disconnect(force?: boolean): Promise<void>;
|
|
201
250
|
/**
|
|
202
251
|
* Determines if the connection is connected.
|
|
203
|
-
* This means that there is an open connection to the
|
|
252
|
+
* This means that there is an open connection to the Kinotic server
|
|
204
253
|
* @return true if the connection is active false if not
|
|
205
254
|
*/
|
|
206
255
|
isConnected(): boolean;
|
|
207
256
|
/**
|
|
208
257
|
* Determines if the connection is active.
|
|
209
258
|
* This means {@link IEventBus#connect()} was called and was successful. The underlying connection may not be established yet.
|
|
210
|
-
*
|
|
259
|
+
* Subscriptions made while active are established once the connection comes up; sends require
|
|
260
|
+
* {@link IEventBus#isConnected}
|
|
211
261
|
* @return true if the connection is active false if not
|
|
212
262
|
*/
|
|
213
263
|
isConnectionActive(): boolean;
|
|
@@ -239,8 +289,11 @@ interface IEventBus {
|
|
|
239
289
|
*/
|
|
240
290
|
requestStream(event: IEvent, sendControlEvents: boolean): Observable<IEvent>;
|
|
241
291
|
/**
|
|
242
|
-
* Send a single {@link IEvent} to the connected server
|
|
292
|
+
* Send a single {@link IEvent} to the connected server. Events are never held for a later
|
|
293
|
+
* connection, so the caller decides what an event it could not send means — see
|
|
294
|
+
* {@link isConnected}.
|
|
243
295
|
* @param event to send
|
|
296
|
+
* @throws if the connection is not established
|
|
244
297
|
*/
|
|
245
298
|
send(event: IEvent): void;
|
|
246
299
|
}
|
|
@@ -253,7 +306,7 @@ declare enum EventConstants {
|
|
|
253
306
|
CONTENT_LENGTH_HEADER = "content-length",
|
|
254
307
|
REPLY_TO_HEADER = "reply-to",
|
|
255
308
|
/**
|
|
256
|
-
* Header provided by the server on connection to provide the {@link
|
|
309
|
+
* Header provided by the server on connection to provide the {@link ConnectedInfo} as a JSON string
|
|
257
310
|
*/
|
|
258
311
|
CONNECTED_INFO_HEADER = "connected-info",
|
|
259
312
|
/**
|
|
@@ -332,9 +385,9 @@ interface ContextInterceptor<T extends ServiceContext> {
|
|
|
332
385
|
intercept(event: IEvent, context: T): Promise<T> | T;
|
|
333
386
|
}
|
|
334
387
|
/**
|
|
335
|
-
* `CRI` is a
|
|
388
|
+
* `CRI` is a Kinotic Resource Identifier used by Kinotic to route requests appropriately.
|
|
336
389
|
*
|
|
337
|
-
* The `CRI` is a URI where the parts are named differently for clarity as to their purpose within
|
|
390
|
+
* The `CRI` is a URI where the parts are named differently for clarity as to their purpose within Kinotic.
|
|
338
391
|
*
|
|
339
392
|
* Will be in a format as follows where anything surrounded with `[]` is optional:
|
|
340
393
|
*
|
|
@@ -372,7 +425,7 @@ interface CRI {
|
|
|
372
425
|
* The zone this `CRI` is addressed in, or `null` if un-zoned.
|
|
373
426
|
*
|
|
374
427
|
* The zone is the isolation boundary routing is validated against, such as
|
|
375
|
-
* `app.acme-org.orders-app` or `
|
|
428
|
+
* `app.acme-org.orders-app` or `management-api`.
|
|
376
429
|
*
|
|
377
430
|
* For the following CRI, `zone` would be the portion specified by `zone`:
|
|
378
431
|
*
|
|
@@ -491,6 +544,12 @@ declare class ServiceIdentifier {
|
|
|
491
544
|
* @return the cri for this {@link ServiceIdentifier}
|
|
492
545
|
*/
|
|
493
546
|
cri(): CRI;
|
|
547
|
+
/**
|
|
548
|
+
* The {@link CRI} of this service's shared, unscoped address. Every instance of a scoped
|
|
549
|
+
* service may listen here for the methods any instance can answer.
|
|
550
|
+
* @return the cri without the scope part
|
|
551
|
+
*/
|
|
552
|
+
unscopedCri(): CRI;
|
|
494
553
|
}
|
|
495
554
|
import { Observable as Observable2 } from "rxjs";
|
|
496
555
|
/**
|
|
@@ -613,11 +672,12 @@ interface IKinotic {
|
|
|
613
672
|
*/
|
|
614
673
|
defaultZone: string | null;
|
|
615
674
|
/**
|
|
616
|
-
*
|
|
617
|
-
*
|
|
675
|
+
* Connects to a Kinotic server. Every option is optional: absent server fields and
|
|
676
|
+
* credentials resolve from the environment — see {@link ConnectOptions}.
|
|
677
|
+
* @param options overrides for the resolved connection, or nothing to resolve everything
|
|
618
678
|
* @return Promise containing the result of the initial connection attempt
|
|
619
679
|
*/
|
|
620
|
-
connect(
|
|
680
|
+
connect(options?: ConnectOptions): Promise<ConnectedInfo>;
|
|
621
681
|
/**
|
|
622
682
|
* Disconnects the client from the server
|
|
623
683
|
* This will clear any subscriptions and close the connection
|
|
@@ -655,11 +715,12 @@ declare class KinoticSingleton implements IKinotic {
|
|
|
655
715
|
get eventBus(): IEventBus;
|
|
656
716
|
set eventBus(eventBus: IEventBus);
|
|
657
717
|
/**
|
|
658
|
-
*
|
|
659
|
-
*
|
|
718
|
+
* Connects to a Kinotic server. Every option is optional: absent server fields and
|
|
719
|
+
* credentials resolve from the environment — see {@link ConnectOptions}.
|
|
720
|
+
* @param options overrides for the resolved connection, or nothing to resolve everything
|
|
660
721
|
* @return Promise containing the result of the initial connection attempt
|
|
661
722
|
*/
|
|
662
|
-
connect(
|
|
723
|
+
connect(options?: ConnectOptions): Promise<ConnectedInfo>;
|
|
663
724
|
/**
|
|
664
725
|
* Disconnects the client from the server
|
|
665
726
|
* This will clear any subscriptions and close the connection
|
|
@@ -689,6 +750,19 @@ declare const Kinotic: KinoticSingleton;
|
|
|
689
750
|
*/
|
|
690
751
|
declare function Scope(value: Function, _context: ClassGetterDecoratorContext | ClassMethodDecoratorContext): void;
|
|
691
752
|
/**
|
|
753
|
+
* Marks a method of a scoped published service that any instance may answer, because its
|
|
754
|
+
* result does not depend on which instance executes it - typically a read of shared state
|
|
755
|
+
* rather than of the instance's own.
|
|
756
|
+
*
|
|
757
|
+
* A scoped service normally listens only at its scoped address, so every invocation must name
|
|
758
|
+
* an instance. When at least one method carries ScopeOptional, each instance also listens on
|
|
759
|
+
* the service's shared unscoped address, where only the annotated methods may be invoked: an
|
|
760
|
+
* unscoped invocation of any other method is rejected, since it would execute on whichever
|
|
761
|
+
* instance happened to receive it.
|
|
762
|
+
*/
|
|
763
|
+
declare function ScopeOptional(value: Function, _context: ClassMethodDecoratorContext): void;
|
|
764
|
+
declare function scopeOptionalMethodNames(instance: object): Set<string>;
|
|
765
|
+
/**
|
|
692
766
|
* Sets the semantic version a service registers under.
|
|
693
767
|
* @param version the version in X.Y.Z[-optional] format
|
|
694
768
|
*/
|
|
@@ -731,6 +805,35 @@ declare function receivesContext(serviceInstance: object, methodName: string): b
|
|
|
731
805
|
*/
|
|
732
806
|
declare function Publish(namespace?: string | null, name?: string, advertise?: boolean): <T extends new (...args: any[]) => object>(value: T, _context: ClassDecoratorContext<any>) => T;
|
|
733
807
|
/**
|
|
808
|
+
* What checkUiVersion found out about the commit a site serves, compared with the one an open
|
|
809
|
+
* tab was built from.
|
|
810
|
+
*/
|
|
811
|
+
interface UiVersionCheck {
|
|
812
|
+
/**
|
|
813
|
+
* True when the site serves a commit other than the one the tab was built from: the tab is
|
|
814
|
+
* behind, and a reload brings the published commit.
|
|
815
|
+
*/
|
|
816
|
+
stale: boolean;
|
|
817
|
+
/**
|
|
818
|
+
* The commit the site serves, or null when its version could not be read, in which case the
|
|
819
|
+
* tab is not reported stale.
|
|
820
|
+
*/
|
|
821
|
+
servedCommit: string | null;
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* Tells an open tab of a published UI whether the site has moved on to another commit. A
|
|
825
|
+
* publish switches a site to a new commit atomically while keeping the previous commit's assets,
|
|
826
|
+
* so a tab built from the previous commit keeps working; this is how it learns to offer a
|
|
827
|
+
* reload. The site publishes the commit it serves as `version.json` next to its `index.html`,
|
|
828
|
+
* never cached, and the build embeds the commit the tab was built from as `KINOTIC_UI_COMMIT`.
|
|
829
|
+
* @param builtCommit the commit the running tab was built from
|
|
830
|
+
* @param versionUrl where the site publishes the commit it serves; the root `version.json` unless
|
|
831
|
+
* the UI is served under a path
|
|
832
|
+
* @returns whether the tab is stale and which commit the site serves, never rejecting: a site
|
|
833
|
+
* whose version cannot be read leaves the tab not stale
|
|
834
|
+
*/
|
|
835
|
+
declare function checkUiVersion(builtCommit: string, versionUrl?: string): Promise<UiVersionCheck>;
|
|
836
|
+
/**
|
|
734
837
|
* Validates that the given zone satisfies the zone grammar
|
|
735
838
|
* @param zone the zone to validate
|
|
736
839
|
* @throws if the zone is empty or contains anything other than dot separated labels of
|
|
@@ -1042,6 +1145,16 @@ interface ICrudServiceProxy<T extends Identifiable<string>> extends IEditableDat
|
|
|
1042
1145
|
*/
|
|
1043
1146
|
deleteById(id: string): Promise<void>;
|
|
1044
1147
|
/**
|
|
1148
|
+
* Deletes the entity with the given id and waits for the deletion to be visible in search
|
|
1149
|
+
* results before returning.
|
|
1150
|
+
* Use this when you need read-your-write consistency immediately after deletion.
|
|
1151
|
+
*
|
|
1152
|
+
* @param id must not be {@literal null}.
|
|
1153
|
+
* @return a {@link Promise} signaling when the deletion is visible to search.
|
|
1154
|
+
* @throws IllegalArgumentException in case the given {@literal identity} is {@literal null}.
|
|
1155
|
+
*/
|
|
1156
|
+
deleteByIdSync(id: string): Promise<void>;
|
|
1157
|
+
/**
|
|
1045
1158
|
* Returns a {@link Page} of entities meeting the paging restriction provided in the {@code Pageable} object.
|
|
1046
1159
|
*
|
|
1047
1160
|
* @param pageable the page settings to be used
|
|
@@ -1072,6 +1185,7 @@ declare class CrudServiceProxy<T extends Identifiable<string>> implements ICrudS
|
|
|
1072
1185
|
create(entity: T): Promise<T>;
|
|
1073
1186
|
createSync(entity: T): Promise<T>;
|
|
1074
1187
|
deleteById(id: string): Promise<void>;
|
|
1188
|
+
deleteByIdSync(id: string): Promise<void>;
|
|
1075
1189
|
findAll(pageable: Pageable): Promise<IterablePage<T>>;
|
|
1076
1190
|
findAllSinglePage(pageable: Pageable): Promise<Page<T>>;
|
|
1077
1191
|
findById(id: string): Promise<T>;
|
|
@@ -1161,6 +1275,7 @@ declare class Event implements IEvent {
|
|
|
1161
1275
|
*/
|
|
1162
1276
|
declare class EventBus implements IEventBus {
|
|
1163
1277
|
serverInfo: ServerInfo | null;
|
|
1278
|
+
private readonly log;
|
|
1164
1279
|
private stompConnectionManager;
|
|
1165
1280
|
private connectionLifecycle;
|
|
1166
1281
|
private replyToCri;
|
|
@@ -1174,7 +1289,7 @@ declare class EventBus implements IEventBus {
|
|
|
1174
1289
|
get fatalErrors(): Observable3<Error>;
|
|
1175
1290
|
isConnectionActive(): boolean;
|
|
1176
1291
|
isConnected(): boolean;
|
|
1177
|
-
connect(
|
|
1292
|
+
connect(options: ConnectOptions): Promise<ConnectedInfo>;
|
|
1178
1293
|
disconnect(force?: boolean): Promise<void>;
|
|
1179
1294
|
/** Runs connect and disconnect one at a time so they never overlap on the shared socket. */
|
|
1180
1295
|
private serializeLifecycle;
|
|
@@ -1191,6 +1306,12 @@ declare class EventBus implements IEventBus {
|
|
|
1191
1306
|
*/
|
|
1192
1307
|
private cancelIfUnexpected;
|
|
1193
1308
|
/**
|
|
1309
|
+
* Sends the control event that stops the server stream identified by the correlationId.
|
|
1310
|
+
* @param cri the service the stream originates from
|
|
1311
|
+
* @param correlationId the correlationId of the stream to cancel
|
|
1312
|
+
*/
|
|
1313
|
+
private sendCancel;
|
|
1314
|
+
/**
|
|
1194
1315
|
* Tears down the shared request-replies stream so the next request rebuilds it against the
|
|
1195
1316
|
* current {@link replyToCri}. Any in-flight requests are failed with the given reason since
|
|
1196
1317
|
* their replies can no longer be delivered.
|
|
@@ -1209,50 +1330,58 @@ declare class EventBus implements IEventBus {
|
|
|
1209
1330
|
private _observe;
|
|
1210
1331
|
}
|
|
1211
1332
|
/**
|
|
1212
|
-
*
|
|
1213
|
-
*
|
|
1214
|
-
*
|
|
1333
|
+
* Kinotic client credentials: a clientId/clientSecret pair presented as upgrade headers —
|
|
1334
|
+
* a user's email and password, or a machine identity's id and provisioned secret. Scope is
|
|
1335
|
+
* structural, determined by which ids are given: neither → SYSTEM, organizationId only →
|
|
1336
|
+
* ORGANIZATION, both → APPLICATION. For machines the ids are optional; when supplied they
|
|
1337
|
+
* must agree with the machine's own scope.
|
|
1215
1338
|
*/
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
getAuthHeaders(): Promise<Record<string, string>> | Record<string, string>;
|
|
1339
|
+
declare class BasicCredentialsResolver implements CredentialsResolver {
|
|
1340
|
+
readonly name: string;
|
|
1341
|
+
private readonly credentials;
|
|
1342
|
+
constructor(clientId: string, clientSecret: string, organizationId?: string, applicationId?: string);
|
|
1343
|
+
resolve(_server: ServerInfo): Promise<ResolvedCredentials>;
|
|
1222
1344
|
}
|
|
1223
1345
|
/**
|
|
1224
|
-
*
|
|
1225
|
-
*
|
|
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.
|
|
1346
|
+
* A bearer token presented as the {@code Authorization} upgrade header. The supplier form is
|
|
1347
|
+
* invoked on every (re)connect, so short-lived tokens can be refreshed each time.
|
|
1233
1348
|
*/
|
|
1234
|
-
declare
|
|
1349
|
+
declare class BearerCredentialsResolver implements CredentialsResolver {
|
|
1350
|
+
readonly name: string;
|
|
1351
|
+
private readonly token;
|
|
1352
|
+
constructor(token: string | (() => Promise<string> | string));
|
|
1353
|
+
resolve(_server: ServerInfo): Promise<ResolvedCredentials>;
|
|
1354
|
+
}
|
|
1235
1355
|
/**
|
|
1236
|
-
*
|
|
1237
|
-
*
|
|
1356
|
+
* Consults each resolver in order and returns the first non-null result. The default
|
|
1357
|
+
* credential resolution every {@code Kinotic.connect()} without explicit credentials uses is
|
|
1358
|
+
* a chain; supply your own to control the sources or their order.
|
|
1238
1359
|
*/
|
|
1239
|
-
declare class
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1360
|
+
declare class ChainedCredentialsResolver implements CredentialsResolver {
|
|
1361
|
+
readonly name: string;
|
|
1362
|
+
private readonly resolvers;
|
|
1363
|
+
constructor(...resolvers: CredentialsResolver[]);
|
|
1364
|
+
resolve(server: ServerInfo): Promise<ResolvedCredentials | null>;
|
|
1243
1365
|
}
|
|
1244
1366
|
/**
|
|
1245
|
-
*
|
|
1246
|
-
*
|
|
1247
|
-
*
|
|
1248
|
-
*
|
|
1249
|
-
*
|
|
1250
|
-
* access token). The supplier may be async and is invoked on every (re)connect.
|
|
1367
|
+
* Credentials from environment variables — the zero-code path for machines and services:
|
|
1368
|
+
* {@code KINOTIC_CLIENT_ID} + {@code KINOTIC_CLIENT_SECRET} (with optional
|
|
1369
|
+
* {@code KINOTIC_ORGANIZATION_ID} / {@code KINOTIC_APPLICATION_ID}) resolve as client
|
|
1370
|
+
* credentials, or {@code KINOTIC_TOKEN} as a bearer token. Resolves to null in a browser or
|
|
1371
|
+
* when none of the variables are set.
|
|
1251
1372
|
*/
|
|
1252
|
-
declare class
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1373
|
+
declare class EnvCredentialsResolver implements CredentialsResolver {
|
|
1374
|
+
readonly name: string;
|
|
1375
|
+
resolve(server: ServerInfo): Promise<ResolvedCredentials | null>;
|
|
1376
|
+
}
|
|
1377
|
+
/**
|
|
1378
|
+
* The browser's session cookie, established by a prior REST login. Resolves to credentials
|
|
1379
|
+
* with no headers — the cookie rides the upgrade request on its own — and only in an
|
|
1380
|
+
* environment that has one (a browser); elsewhere it passes to the next resolver.
|
|
1381
|
+
*/
|
|
1382
|
+
declare class SessionCredentialsResolver implements CredentialsResolver {
|
|
1383
|
+
readonly name: string;
|
|
1384
|
+
resolve(_server: ServerInfo): Promise<ResolvedCredentials | null>;
|
|
1256
1385
|
}
|
|
1257
1386
|
/**
|
|
1258
1387
|
* Some common constants used for the {@link Participant} and {@link Participant#getMetadata()}
|
|
@@ -1268,4 +1397,4 @@ declare class ParticipantConstants {
|
|
|
1268
1397
|
/** The clientId TestSecurityService (clienttest profile) maps to the ANONYMOUS role in core package tests. */
|
|
1269
1398
|
static readonly CLI_PARTICIPANT_ID: string;
|
|
1270
1399
|
}
|
|
1271
|
-
export { validateZone, validateLabel, receivesContext, isAdvertised, createCRI,
|
|
1400
|
+
export { validateZone, validateLabel, scopeOptionalMethodNames, receivesContext, isAdvertised, createCRI, checkUiVersion, buildServerUrl, buildBrokerUrl, Zone, WebSocketFactory, Version, UiVersionCheck, TextEventFactory, Sort, SessionKeepAliveMode, SessionCredentialsResolver, ServiceRegistry, ServiceContext, ServerInfo, ScopeOptional, 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 };
|