@kinotic-ai/core 5.0.0-beta.10 → 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.cts CHANGED
@@ -227,6 +227,13 @@ interface IEventBus {
227
227
  */
228
228
  fatalErrors: Observable<Error>;
229
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
+ /**
230
237
  * The {@link ServerInfo} used when connecting, if connected or null
231
238
  */
232
239
  serverInfo: ServerInfo | null;
@@ -805,35 +812,6 @@ declare function receivesContext(serviceInstance: object, methodName: string): b
805
812
  */
806
813
  declare function Publish(namespace?: string | null, name?: string, advertise?: boolean): <T extends new (...args: any[]) => object>(value: T, _context: ClassDecoratorContext<any>) => T;
807
814
  /**
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
- /**
837
815
  * Validates that the given zone satisfies the zone grammar
838
816
  * @param zone the zone to validate
839
817
  * @throws if the zone is empty or contains anything other than dot separated labels of
@@ -1278,15 +1256,17 @@ declare class EventBus implements IEventBus {
1278
1256
  private readonly log;
1279
1257
  private stompConnectionManager;
1280
1258
  private connectionLifecycle;
1281
- private replyToCri;
1259
+ private disconnectRequests;
1282
1260
  private requestRepliesObservable;
1283
1261
  private requestRepliesSubject;
1284
1262
  private requestRepliesSubscription;
1285
1263
  private readonly activeCorrelationIds;
1286
1264
  private readonly recentlyReaped;
1265
+ private readonly connectionLostSubject;
1287
1266
  private static readonly REAP_DEBOUNCE_MS;
1288
1267
  constructor();
1289
1268
  get fatalErrors(): Observable3<Error>;
1269
+ get connectionLost(): Observable3<void>;
1290
1270
  isConnectionActive(): boolean;
1291
1271
  isConnected(): boolean;
1292
1272
  connect(options: ConnectOptions): Promise<ConnectedInfo>;
@@ -1298,7 +1278,6 @@ declare class EventBus implements IEventBus {
1298
1278
  requestStream(event: IEvent, sendControlEvents?: boolean): Observable3<IEvent>;
1299
1279
  listen(_serverInfo: ServerInfo): Promise<void>;
1300
1280
  observe(cri: string): Observable3<IEvent>;
1301
- private cleanup;
1302
1281
  /**
1303
1282
  * Cancels a server stream whose reply arrived for a correlationId we no longer track. The server can't
1304
1283
  * detect this itself since all requests share one reply destination, so the cancel is sent to the
@@ -1313,7 +1292,7 @@ declare class EventBus implements IEventBus {
1313
1292
  private sendCancel;
1314
1293
  /**
1315
1294
  * Tears down the shared request-replies stream so the next request rebuilds it against the
1316
- * 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
1317
1296
  * their replies can no longer be delivered.
1318
1297
  */
1319
1298
  private resetRequestReplies;
@@ -1330,6 +1309,30 @@ declare class EventBus implements IEventBus {
1330
1309
  private _observe;
1331
1310
  }
1332
1311
  /**
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`.
1317
+ */
1318
+ declare class RpcError extends Error {
1319
+ /**
1320
+ * The simple name of the exception the server caught, such as `RpcServiceUnavailableException`.
1321
+ */
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;
1334
+ }
1335
+ /**
1333
1336
  * Kinotic client credentials: a clientId/clientSecret pair presented as upgrade headers —
1334
1337
  * a user's email and password, or a machine identity's id and provisioned secret. Scope is
1335
1338
  * structural, determined by which ids are given: neither → SYSTEM, organizationId only →
@@ -1397,4 +1400,4 @@ declare class ParticipantConstants {
1397
1400
  /** The clientId TestSecurityService (clienttest profile) maps to the ANONYMOUS role in core package tests. */
1398
1401
  static readonly CLI_PARTICIPANT_ID: string;
1399
1402
  }
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 };
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 };
package/dist/index.d.ts CHANGED
@@ -227,6 +227,13 @@ interface IEventBus {
227
227
  */
228
228
  fatalErrors: Observable<Error>;
229
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
+ /**
230
237
  * The {@link ServerInfo} used when connecting, if connected or null
231
238
  */
232
239
  serverInfo: ServerInfo | null;
@@ -805,35 +812,6 @@ declare function receivesContext(serviceInstance: object, methodName: string): b
805
812
  */
806
813
  declare function Publish(namespace?: string | null, name?: string, advertise?: boolean): <T extends new (...args: any[]) => object>(value: T, _context: ClassDecoratorContext<any>) => T;
807
814
  /**
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
- /**
837
815
  * Validates that the given zone satisfies the zone grammar
838
816
  * @param zone the zone to validate
839
817
  * @throws if the zone is empty or contains anything other than dot separated labels of
@@ -1278,15 +1256,17 @@ declare class EventBus implements IEventBus {
1278
1256
  private readonly log;
1279
1257
  private stompConnectionManager;
1280
1258
  private connectionLifecycle;
1281
- private replyToCri;
1259
+ private disconnectRequests;
1282
1260
  private requestRepliesObservable;
1283
1261
  private requestRepliesSubject;
1284
1262
  private requestRepliesSubscription;
1285
1263
  private readonly activeCorrelationIds;
1286
1264
  private readonly recentlyReaped;
1265
+ private readonly connectionLostSubject;
1287
1266
  private static readonly REAP_DEBOUNCE_MS;
1288
1267
  constructor();
1289
1268
  get fatalErrors(): Observable3<Error>;
1269
+ get connectionLost(): Observable3<void>;
1290
1270
  isConnectionActive(): boolean;
1291
1271
  isConnected(): boolean;
1292
1272
  connect(options: ConnectOptions): Promise<ConnectedInfo>;
@@ -1298,7 +1278,6 @@ declare class EventBus implements IEventBus {
1298
1278
  requestStream(event: IEvent, sendControlEvents?: boolean): Observable3<IEvent>;
1299
1279
  listen(_serverInfo: ServerInfo): Promise<void>;
1300
1280
  observe(cri: string): Observable3<IEvent>;
1301
- private cleanup;
1302
1281
  /**
1303
1282
  * Cancels a server stream whose reply arrived for a correlationId we no longer track. The server can't
1304
1283
  * detect this itself since all requests share one reply destination, so the cancel is sent to the
@@ -1313,7 +1292,7 @@ declare class EventBus implements IEventBus {
1313
1292
  private sendCancel;
1314
1293
  /**
1315
1294
  * Tears down the shared request-replies stream so the next request rebuilds it against the
1316
- * 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
1317
1296
  * their replies can no longer be delivered.
1318
1297
  */
1319
1298
  private resetRequestReplies;
@@ -1330,6 +1309,30 @@ declare class EventBus implements IEventBus {
1330
1309
  private _observe;
1331
1310
  }
1332
1311
  /**
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`.
1317
+ */
1318
+ declare class RpcError extends Error {
1319
+ /**
1320
+ * The simple name of the exception the server caught, such as `RpcServiceUnavailableException`.
1321
+ */
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;
1334
+ }
1335
+ /**
1333
1336
  * Kinotic client credentials: a clientId/clientSecret pair presented as upgrade headers —
1334
1337
  * a user's email and password, or a machine identity's id and provisioned secret. Scope is
1335
1338
  * structural, determined by which ids are given: neither → SYSTEM, organizationId only →
@@ -1397,4 +1400,4 @@ declare class ParticipantConstants {
1397
1400
  /** The clientId TestSecurityService (clienttest profile) maps to the ANONYMOUS role in core package tests. */
1398
1401
  static readonly CLI_PARTICIPANT_ID: string;
1399
1402
  }
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 };
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 };