@cratis/chronicle 6.9.1 → 6.10.0
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/ChronicleClient.ts +52 -13
- package/ChronicleOptions.spec.ts +54 -0
- package/ChronicleOptions.ts +20 -5
- package/EventStore.ts +7 -1
- package/README.md +2 -3
- package/artifacts/DefaultClientArtifactsProvider.ts +4 -1
- package/connection/ChronicleConnection.auth.spec.ts +219 -0
- package/connection/ChronicleConnection.ts +70 -31
- package/connection/ChronicleServices.ts +1 -1
- package/connection/CompatibilityPreflight.ts +1 -1
- package/connection/RejectedChronicleCredentials.ts +10 -0
- package/connection/TokenProvider.spec.ts +5 -6
- package/connection/TokenProvider.ts +26 -17
- package/connection/clientVersion.spec.ts +27 -0
- package/connection/clientVersion.ts +9 -0
- package/connection/describeRequestError.spec.ts +22 -0
- package/connection/fetchOAuthAccessToken.ts +33 -2
- package/dist/ChronicleClient.d.ts +3 -0
- package/dist/ChronicleClient.d.ts.map +1 -1
- package/dist/ChronicleClient.js +55 -13
- package/dist/ChronicleClient.js.map +1 -1
- package/dist/ChronicleOptions.d.ts +5 -1
- package/dist/ChronicleOptions.d.ts.map +1 -1
- package/dist/ChronicleOptions.js +20 -5
- package/dist/ChronicleOptions.js.map +1 -1
- package/dist/EventStore.d.ts +2 -0
- package/dist/EventStore.d.ts.map +1 -1
- package/dist/EventStore.js +6 -1
- package/dist/EventStore.js.map +1 -1
- package/dist/artifacts/DefaultClientArtifactsProvider.d.ts.map +1 -1
- package/dist/artifacts/DefaultClientArtifactsProvider.js +4 -1
- package/dist/artifacts/DefaultClientArtifactsProvider.js.map +1 -1
- package/dist/connection/ChronicleConnection.d.ts +3 -3
- package/dist/connection/ChronicleConnection.d.ts.map +1 -1
- package/dist/connection/ChronicleConnection.js +74 -26
- package/dist/connection/ChronicleConnection.js.map +1 -1
- package/dist/connection/ChronicleServices.d.ts +1 -2
- package/dist/connection/ChronicleServices.d.ts.map +1 -1
- package/dist/connection/CompatibilityPreflight.js +1 -1
- package/dist/connection/CompatibilityPreflight.js.map +1 -1
- package/dist/connection/RejectedChronicleCredentials.d.ts +5 -0
- package/dist/connection/RejectedChronicleCredentials.d.ts.map +1 -0
- package/dist/connection/RejectedChronicleCredentials.js +10 -0
- package/dist/connection/RejectedChronicleCredentials.js.map +1 -0
- package/dist/connection/TokenProvider.d.ts +8 -6
- package/dist/connection/TokenProvider.d.ts.map +1 -1
- package/dist/connection/TokenProvider.js +25 -11
- package/dist/connection/TokenProvider.js.map +1 -1
- package/dist/connection/clientVersion.d.ts +3 -0
- package/dist/connection/clientVersion.d.ts.map +1 -0
- package/dist/connection/clientVersion.js +7 -0
- package/dist/connection/clientVersion.js.map +1 -0
- package/dist/connection/fetchOAuthAccessToken.d.ts +12 -0
- package/dist/connection/fetchOAuthAccessToken.d.ts.map +1 -1
- package/dist/connection/fetchOAuthAccessToken.js +37 -2
- package/dist/connection/fetchOAuthAccessToken.js.map +1 -1
- package/dist/externalServices/ExternalServiceBuilder.d.ts +1 -1
- package/dist/externalServices/ExternalServiceBuilder.d.ts.map +1 -1
- package/dist/externalServices/ExternalServiceBuilder.js +1 -1
- package/dist/externalServices/ExternalServiceBuilder.js.map +1 -1
- package/dist/externalServices/ExternalServices.d.ts.map +1 -1
- package/dist/externalServices/ExternalServices.js +3 -1
- package/dist/externalServices/ExternalServices.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/projections/Projections.d.ts.map +1 -1
- package/dist/projections/Projections.js +9 -7
- package/dist/projections/Projections.js.map +1 -1
- package/dist/projections/constantValueExpression.d.ts +3 -0
- package/dist/projections/constantValueExpression.d.ts.map +1 -0
- package/dist/projections/constantValueExpression.js +26 -0
- package/dist/projections/constantValueExpression.js.map +1 -0
- package/dist/projections/declarative/ChildrenBuilder.d.ts +2 -0
- package/dist/projections/declarative/ChildrenBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/ChildrenBuilder.js +5 -0
- package/dist/projections/declarative/ChildrenBuilder.js.map +1 -1
- package/dist/projections/declarative/FromBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/FromBuilder.js +3 -2
- package/dist/projections/declarative/FromBuilder.js.map +1 -1
- package/dist/projections/declarative/JoinBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/JoinBuilder.js +2 -1
- package/dist/projections/declarative/JoinBuilder.js.map +1 -1
- package/dist/projections/declarative/NestedBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/NestedBuilder.js +3 -1
- package/dist/projections/declarative/NestedBuilder.js.map +1 -1
- package/dist/projections/declarative/ProjectionBuilderCore.d.ts +5 -0
- package/dist/projections/declarative/ProjectionBuilderCore.d.ts.map +1 -1
- package/dist/projections/declarative/ProjectionBuilderCore.js +18 -2
- package/dist/projections/declarative/ProjectionBuilderCore.js.map +1 -1
- package/dist/projections/declarative/ProjectionBuilderFor.d.ts +6 -0
- package/dist/projections/declarative/ProjectionBuilderFor.d.ts.map +1 -1
- package/dist/projections/declarative/ProjectionBuilderFor.js +5 -0
- package/dist/projections/declarative/ProjectionBuilderFor.js.map +1 -1
- package/dist/projections/declarative/SetBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/SetBuilder.js +2 -1
- package/dist/projections/declarative/SetBuilder.js.map +1 -1
- package/dist/projections/modelBound/addFrom.d.ts.map +1 -1
- package/dist/projections/modelBound/addFrom.js +3 -2
- package/dist/projections/modelBound/addFrom.js.map +1 -1
- package/dist/projections/modelBound/childrenAndNestedBuilder.d.ts +20 -0
- package/dist/projections/modelBound/childrenAndNestedBuilder.d.ts.map +1 -1
- package/dist/projections/modelBound/childrenAndNestedBuilder.js +14 -11
- package/dist/projections/modelBound/childrenAndNestedBuilder.js.map +1 -1
- package/dist/projections/modelBound/childrenFrom.d.ts +4 -2
- package/dist/projections/modelBound/childrenFrom.d.ts.map +1 -1
- package/dist/projections/modelBound/childrenFrom.js +8 -4
- package/dist/projections/modelBound/childrenFrom.js.map +1 -1
- package/dist/projections/modelBound/clearWith.d.ts.map +1 -1
- package/dist/projections/modelBound/clearWith.js +3 -2
- package/dist/projections/modelBound/clearWith.js.map +1 -1
- package/dist/projections/modelBound/count.d.ts.map +1 -1
- package/dist/projections/modelBound/count.js +3 -2
- package/dist/projections/modelBound/count.js.map +1 -1
- package/dist/projections/modelBound/decrement.d.ts.map +1 -1
- package/dist/projections/modelBound/decrement.js +3 -2
- package/dist/projections/modelBound/decrement.js.map +1 -1
- package/dist/projections/modelBound/fromAll.d.ts.map +1 -1
- package/dist/projections/modelBound/fromAll.js +3 -2
- package/dist/projections/modelBound/fromAll.js.map +1 -1
- package/dist/projections/modelBound/fromEvery.d.ts.map +1 -1
- package/dist/projections/modelBound/fromEvery.js +3 -2
- package/dist/projections/modelBound/fromEvery.js.map +1 -1
- package/dist/projections/modelBound/increment.d.ts.map +1 -1
- package/dist/projections/modelBound/increment.js +3 -2
- package/dist/projections/modelBound/increment.js.map +1 -1
- package/dist/projections/modelBound/join.d.ts.map +1 -1
- package/dist/projections/modelBound/join.js +3 -2
- package/dist/projections/modelBound/join.js.map +1 -1
- package/dist/projections/modelBound/nested.d.ts.map +1 -1
- package/dist/projections/modelBound/nested.js +3 -2
- package/dist/projections/modelBound/nested.js.map +1 -1
- package/dist/projections/modelBound/noAutoMap.d.ts.map +1 -1
- package/dist/projections/modelBound/noAutoMap.js +3 -2
- package/dist/projections/modelBound/noAutoMap.js.map +1 -1
- package/dist/projections/modelBound/removedWith.d.ts.map +1 -1
- package/dist/projections/modelBound/removedWith.js +3 -2
- package/dist/projections/modelBound/removedWith.js.map +1 -1
- package/dist/projections/modelBound/removedWithJoin.d.ts.map +1 -1
- package/dist/projections/modelBound/removedWithJoin.js +3 -2
- package/dist/projections/modelBound/removedWithJoin.js.map +1 -1
- package/dist/projections/modelBound/setFrom.d.ts.map +1 -1
- package/dist/projections/modelBound/setFrom.js +3 -2
- package/dist/projections/modelBound/setFrom.js.map +1 -1
- package/dist/projections/modelBound/setFromContext.d.ts.map +1 -1
- package/dist/projections/modelBound/setFromContext.js +3 -2
- package/dist/projections/modelBound/setFromContext.js.map +1 -1
- package/dist/projections/modelBound/setValue.d.ts.map +1 -1
- package/dist/projections/modelBound/setValue.js +3 -2
- package/dist/projections/modelBound/setValue.js.map +1 -1
- package/dist/projections/modelBound/subtractFrom.d.ts.map +1 -1
- package/dist/projections/modelBound/subtractFrom.js +3 -2
- package/dist/projections/modelBound/subtractFrom.js.map +1 -1
- package/dist/projections/notSetPropertyPath.d.ts +3 -0
- package/dist/projections/notSetPropertyPath.d.ts.map +1 -0
- package/dist/projections/notSetPropertyPath.js +5 -0
- package/dist/projections/notSetPropertyPath.js.map +1 -0
- package/dist/reactors/Reactors.d.ts +4 -0
- package/dist/reactors/Reactors.d.ts.map +1 -1
- package/dist/reactors/Reactors.js +24 -6
- package/dist/reactors/Reactors.js.map +1 -1
- package/dist/reactors/reactor.d.ts +2 -2
- package/dist/reactors/reactor.js +2 -2
- package/dist/readModels/MaterializedReadModels.d.ts.map +1 -1
- package/dist/readModels/MaterializedReadModels.js +2 -4
- package/dist/readModels/MaterializedReadModels.js.map +1 -1
- package/dist/readModels/ReadModels.d.ts +2 -1
- package/dist/readModels/ReadModels.d.ts.map +1 -1
- package/dist/readModels/ReadModels.js +16 -10
- package/dist/readModels/ReadModels.js.map +1 -1
- package/dist/readModels/deserializeReadModel.d.ts +5 -0
- package/dist/readModels/deserializeReadModel.d.ts.map +1 -0
- package/dist/readModels/deserializeReadModel.js +84 -0
- package/dist/readModels/deserializeReadModel.js.map +1 -0
- package/dist/readModels/rootReadModelTypes.d.ts +5 -0
- package/dist/readModels/rootReadModelTypes.d.ts.map +1 -0
- package/dist/readModels/rootReadModelTypes.js +69 -0
- package/dist/readModels/rootReadModelTypes.js.map +1 -0
- package/dist/reducers/Reducers.d.ts +4 -0
- package/dist/reducers/Reducers.d.ts.map +1 -1
- package/dist/reducers/Reducers.js +24 -6
- package/dist/reducers/Reducers.js.map +1 -1
- package/dist/schemas/JsonSchemaGenerator.d.ts.map +1 -1
- package/dist/schemas/JsonSchemaGenerator.js +4 -4
- package/dist/schemas/JsonSchemaGenerator.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/TypeDiscoverer.d.ts +8 -1
- package/dist/types/TypeDiscoverer.d.ts.map +1 -1
- package/dist/types/TypeDiscoverer.js +25 -5
- package/dist/types/TypeDiscoverer.js.map +1 -1
- package/dist/types/TypeIntrospector.d.ts.map +1 -1
- package/dist/types/TypeIntrospector.js +3 -2
- package/dist/types/TypeIntrospector.js.map +1 -1
- package/dist/types/conceptValueType.d.ts +4 -0
- package/dist/types/conceptValueType.d.ts.map +1 -0
- package/dist/types/conceptValueType.js +10 -0
- package/dist/types/conceptValueType.js.map +1 -0
- package/dist/types/modelBoundProperty.d.ts +6 -0
- package/dist/types/modelBoundProperty.d.ts.map +1 -0
- package/dist/types/modelBoundProperty.js +53 -0
- package/dist/types/modelBoundProperty.js.map +1 -0
- package/externalServices/ExternalServiceBuilder.ts +4 -4
- package/externalServices/ExternalServices.spec.ts +87 -0
- package/externalServices/ExternalServices.ts +3 -1
- package/for_ChronicleClient/connectionAuthentication.spec.ts +67 -0
- package/index.ts +1 -0
- package/observation/observationDisposal.spec.ts +74 -0
- package/package.json +2 -1
- package/projections/Projections.childrenAndNested.spec.ts +2 -0
- package/projections/Projections.modelBoundCompleteness.spec.ts +47 -0
- package/projections/Projections.ts +9 -7
- package/projections/constantValueExpression.spec.ts +31 -0
- package/projections/constantValueExpression.ts +28 -0
- package/projections/declarative/ChildrenBuilder.spec.ts +46 -1
- package/projections/declarative/ChildrenBuilder.ts +6 -0
- package/projections/declarative/FromBuilder.ts +3 -2
- package/projections/declarative/JoinBuilder.ts +2 -1
- package/projections/declarative/NestedBuilder.ts +3 -1
- package/projections/declarative/ProjectionBuilderCore.ts +20 -2
- package/projections/declarative/ProjectionBuilderFor.spec.ts +61 -4
- package/projections/declarative/ProjectionBuilderFor.ts +7 -0
- package/projections/declarative/SetBuilder.ts +2 -1
- package/projections/modelBound/addFrom.ts +3 -2
- package/projections/modelBound/childrenAndNestedBuilder.ts +14 -11
- package/projections/modelBound/childrenFrom.ts +11 -5
- package/projections/modelBound/clearWith.ts +3 -2
- package/projections/modelBound/count.ts +3 -2
- package/projections/modelBound/decorators.standard.spec.ts +45 -0
- package/projections/modelBound/decrement.ts +3 -2
- package/projections/modelBound/fromAll.ts +3 -2
- package/projections/modelBound/fromEvery.ts +3 -2
- package/projections/modelBound/increment.ts +3 -2
- package/projections/modelBound/join.ts +3 -2
- package/projections/modelBound/nested.ts +3 -2
- package/projections/modelBound/noAutoMap.ts +3 -2
- package/projections/modelBound/removedWith.ts +3 -2
- package/projections/modelBound/removedWithJoin.ts +3 -2
- package/projections/modelBound/setFrom.ts +3 -2
- package/projections/modelBound/setFromContext.ts +3 -2
- package/projections/modelBound/setValue.ts +3 -2
- package/projections/modelBound/subtractFrom.ts +3 -2
- package/projections/notSetPropertyPath.ts +5 -0
- package/reactors/Reactors.ts +22 -7
- package/reactors/reactor.ts +2 -2
- package/readModels/MaterializedReadModels.spec.ts +22 -0
- package/readModels/MaterializedReadModels.ts +2 -4
- package/readModels/ReadModels.spec.ts +58 -1
- package/readModels/ReadModels.ts +17 -11
- package/readModels/conceptValueType.spec.ts +20 -0
- package/readModels/deserializeReadModel.spec.ts +84 -0
- package/readModels/deserializeReadModel.ts +82 -0
- package/readModels/discovery.spec.ts +27 -0
- package/readModels/rootReadModelTypes.spec.ts +115 -0
- package/readModels/rootReadModelTypes.ts +65 -0
- package/reducers/Reducers.ts +22 -7
- package/schemas/JsonSchemaGenerator.ts +4 -4
- package/schemas/legacyDesignMetadata.spec.ts +24 -2
- package/types/TypeDiscoverer.spec.ts +57 -0
- package/types/TypeDiscoverer.ts +27 -6
- package/types/TypeIntrospector.ts +3 -2
- package/types/conceptValueType.ts +11 -0
- package/types/modelBoundProperty.ts +53 -0
- package/dist/externalServices/ExternalServicesContracts.d.ts +0 -137
- package/dist/externalServices/ExternalServicesContracts.d.ts.map +0 -1
- package/dist/externalServices/ExternalServicesContracts.js +0 -654
- package/dist/externalServices/ExternalServicesContracts.js.map +0 -1
- package/externalServices/ExternalServicesContracts.ts +0 -709
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
|
-
import type
|
|
4
|
+
import { status, type Channel, type ChannelCredentials, type ChannelOptions } from '@grpc/grpc-js';
|
|
5
|
+
import { diag } from '@opentelemetry/api';
|
|
5
6
|
import {
|
|
6
7
|
ConnectionServiceDefinition,
|
|
7
8
|
ConstraintsDefinition,
|
|
@@ -9,6 +10,7 @@ import {
|
|
|
9
10
|
EventSequencesDefinition,
|
|
10
11
|
EventStoresDefinition,
|
|
11
12
|
EventTypesDefinition,
|
|
13
|
+
ExternalServicesDefinition,
|
|
12
14
|
FailedPartitionsDefinition,
|
|
13
15
|
IdentitiesDefinition,
|
|
14
16
|
JobsDefinition,
|
|
@@ -28,10 +30,9 @@ import {
|
|
|
28
30
|
import { ComplianceDefinition } from '../compliance/ComplianceContracts.js';
|
|
29
31
|
import { createChannel, createClientFactory } from 'nice-grpc';
|
|
30
32
|
import type { ClientMiddleware } from 'nice-grpc-common';
|
|
31
|
-
import { Metadata } from 'nice-grpc-common';
|
|
33
|
+
import { ClientError, Metadata } from 'nice-grpc-common';
|
|
32
34
|
import { EventStoreSubscriptionsDefinition } from '../eventStoreSubscriptions/contracts.js';
|
|
33
|
-
import {
|
|
34
|
-
import { AuthenticationMode, ChronicleConnectionString } from './ChronicleConnectionString.js';
|
|
35
|
+
import { ChronicleConnectionString, type ChronicleServerAddress } from './ChronicleConnectionString.js';
|
|
35
36
|
import { ChronicleServerAddressResolver } from './ChronicleServerAddressResolver.js';
|
|
36
37
|
import { ChronicleServices } from './ChronicleServices.js';
|
|
37
38
|
import { CompatibilityPreflight } from './CompatibilityPreflight.js';
|
|
@@ -94,7 +95,7 @@ export class ChronicleConnection implements ChronicleServices {
|
|
|
94
95
|
private _connections!: ConnectionServiceClient;
|
|
95
96
|
private _compatibility!: CompatibilityPreflight;
|
|
96
97
|
private readonly _connectionString: ChronicleConnectionString;
|
|
97
|
-
private readonly
|
|
98
|
+
private readonly _tokenProviders = new Map<string, ITokenProvider>();
|
|
98
99
|
private readonly _addressResolver: ChronicleServerAddressResolver;
|
|
99
100
|
private readonly _loadBalancerStrategy: ILoadBalancerStrategy;
|
|
100
101
|
private _isConnected = false;
|
|
@@ -111,7 +112,10 @@ export class ChronicleConnection implements ChronicleServices {
|
|
|
111
112
|
this._connectionString = ChronicleConnectionString.Default;
|
|
112
113
|
}
|
|
113
114
|
|
|
114
|
-
this.
|
|
115
|
+
if (!this._connectionString.apiKey && (!!this._connectionString.username !== !!this._connectionString.password)) {
|
|
116
|
+
throw new Error('Connection string must contain both username and password, or neither');
|
|
117
|
+
}
|
|
118
|
+
|
|
115
119
|
this._addressResolver = new ChronicleServerAddressResolver();
|
|
116
120
|
this._loadBalancerStrategy = createLoadBalancerStrategy(this._connectionString.loadBalancer, this._connectionString.skipTlsValidation);
|
|
117
121
|
|
|
@@ -273,11 +277,12 @@ export class ChronicleConnection implements ChronicleServices {
|
|
|
273
277
|
const candidates = await this._addressResolver.resolve(this._connectionString);
|
|
274
278
|
const selected = await this._loadBalancerStrategy.select(candidates);
|
|
275
279
|
const serverAddress = formatServerAddress(selected);
|
|
280
|
+
const tokenProvider = this.createTokenProvider(selected);
|
|
276
281
|
const credentials = this._options.credentials ?? this._connectionString.createCredentials();
|
|
277
282
|
|
|
278
283
|
this._channel = createChannel(serverAddress, credentials, channelOptions);
|
|
279
284
|
|
|
280
|
-
const factory = createClientFactory().use(this.createAuthMiddleware());
|
|
285
|
+
const factory = createClientFactory().use(this.createAuthMiddleware(tokenProvider));
|
|
281
286
|
this._connections = factory.create(ConnectionServiceDefinition, this._channel);
|
|
282
287
|
this._compatibility = new CompatibilityPreflight(this._connections, this._options.connectTimeout ?? 10_000);
|
|
283
288
|
const eventSequenceFactory = factory.use(this._compatibility.middleware());
|
|
@@ -307,33 +312,29 @@ export class ChronicleConnection implements ChronicleServices {
|
|
|
307
312
|
};
|
|
308
313
|
}
|
|
309
314
|
|
|
310
|
-
private createTokenProvider(): ITokenProvider {
|
|
315
|
+
private createTokenProvider(selected: ChronicleServerAddress): ITokenProvider {
|
|
311
316
|
const hasUsername = !!this._connectionString.username;
|
|
312
|
-
const hasPassword = !!this._connectionString.password;
|
|
313
317
|
const hasApiKey = !!this._connectionString.apiKey;
|
|
314
318
|
|
|
315
319
|
if (hasApiKey) {
|
|
316
320
|
return new NoOpTokenProvider();
|
|
317
321
|
}
|
|
318
322
|
|
|
319
|
-
if (hasUsername
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
if (hasUsername && hasPassword) {
|
|
324
|
-
return this.createOAuthTokenProvider(this._connectionString.username!, this._connectionString.password!);
|
|
323
|
+
if (hasUsername) {
|
|
324
|
+
return this.createOAuthTokenProvider(selected, this._connectionString.username!, this._connectionString.password!);
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
return this.createOAuthTokenProvider(
|
|
328
|
+
selected,
|
|
328
329
|
ChronicleConnectionString.DEVELOPMENT_CLIENT,
|
|
329
330
|
ChronicleConnectionString.DEVELOPMENT_CLIENT_SECRET
|
|
330
331
|
);
|
|
331
332
|
}
|
|
332
333
|
|
|
333
|
-
private createOAuthTokenProvider(username: string, password: string): ITokenProvider {
|
|
334
|
-
// Chronicle serves
|
|
335
|
-
//
|
|
336
|
-
const serverPort =
|
|
334
|
+
private createOAuthTokenProvider(selected: ChronicleServerAddress, username: string, password: string): ITokenProvider {
|
|
335
|
+
// Chronicle serves authentication on the selected kernel's port unless an explicit
|
|
336
|
+
// authority overrides it. Cache providers by endpoint across channel resets.
|
|
337
|
+
const serverPort = selected.port;
|
|
337
338
|
let authorityHost: string;
|
|
338
339
|
let authorityPort: number;
|
|
339
340
|
|
|
@@ -342,37 +343,75 @@ export class ChronicleConnection implements ChronicleServices {
|
|
|
342
343
|
authorityHost = authority.hostname;
|
|
343
344
|
authorityPort = authority.port ? parseInt(authority.port, 10) : serverPort;
|
|
344
345
|
} else {
|
|
345
|
-
authorityHost =
|
|
346
|
+
authorityHost = selected.host;
|
|
346
347
|
authorityPort = serverPort;
|
|
347
348
|
}
|
|
348
349
|
|
|
349
350
|
const scheme = this._connectionString.disableTls ? 'http' : 'https';
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
password,
|
|
354
|
-
this.
|
|
355
|
-
|
|
351
|
+
const endpoint = `${scheme}://${authorityHost.includes(':') && !authorityHost.startsWith('[') ? `[${authorityHost}]` : authorityHost}:${authorityPort}/connect/token`;
|
|
352
|
+
let provider = this._tokenProviders.get(endpoint);
|
|
353
|
+
if (!provider) {
|
|
354
|
+
provider = new OAuthTokenProvider(endpoint, username, password, this._connectionString.skipTlsValidation);
|
|
355
|
+
this._tokenProviders.set(endpoint, provider);
|
|
356
|
+
}
|
|
357
|
+
return provider;
|
|
356
358
|
}
|
|
357
359
|
|
|
358
|
-
private createAuthMiddleware(): ClientMiddleware {
|
|
359
|
-
const tokenProvider = this._tokenProvider;
|
|
360
|
+
private createAuthMiddleware(tokenProvider: ITokenProvider): ClientMiddleware {
|
|
360
361
|
const connectionString = this._connectionString;
|
|
362
|
+
const logger = diag.createComponentLogger({ namespace: '@cratis/chronicle/ChronicleConnection' });
|
|
363
|
+
const loggedFailures = new WeakSet<Error>();
|
|
361
364
|
|
|
362
365
|
return async function* authMiddleware(call, options) {
|
|
363
|
-
|
|
366
|
+
let token: string | undefined;
|
|
367
|
+
let tokenFailure: Error | undefined;
|
|
368
|
+
try {
|
|
369
|
+
token = await tokenProvider.getAccessToken();
|
|
370
|
+
} catch (error) {
|
|
371
|
+
tokenFailure = error instanceof Error ? error : new Error(String(error));
|
|
372
|
+
if (!loggedFailures.has(tokenFailure)) {
|
|
373
|
+
loggedFailures.add(tokenFailure);
|
|
374
|
+
logger.warn('Failed to obtain OAuth2 token; sending RPC without authorization', { error: tokenFailure.message });
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
if (!token) tokenFailure ??= tokenProvider.lastTokenFailure;
|
|
364
378
|
|
|
365
379
|
if (token) {
|
|
366
380
|
const metadata = options.metadata ? Metadata(options.metadata) : Metadata();
|
|
367
381
|
metadata.set('authorization', `Bearer ${token}`);
|
|
368
382
|
options.metadata = metadata;
|
|
369
|
-
} else if (connectionString.
|
|
383
|
+
} else if (connectionString.apiKey) {
|
|
370
384
|
const metadata = options.metadata ? Metadata(options.metadata) : Metadata();
|
|
371
385
|
metadata.set('api-key', connectionString.apiKey);
|
|
372
386
|
options.metadata = metadata;
|
|
373
387
|
}
|
|
374
388
|
|
|
375
|
-
|
|
389
|
+
try {
|
|
390
|
+
return yield* call.next(call.request, options);
|
|
391
|
+
} catch (error) {
|
|
392
|
+
if ((error as { code?: number })?.code !== status.UNAUTHENTICATED) throw error;
|
|
393
|
+
if (token && !call.responseStream && !call.requestStream) {
|
|
394
|
+
try {
|
|
395
|
+
const refreshed = await tokenProvider.refresh();
|
|
396
|
+
if (refreshed) {
|
|
397
|
+
const metadata = options.metadata ? Metadata(options.metadata) : Metadata();
|
|
398
|
+
metadata.set('authorization', `Bearer ${refreshed}`);
|
|
399
|
+
return yield* call.next(call.request, { ...options, metadata });
|
|
400
|
+
}
|
|
401
|
+
} catch (refreshError) {
|
|
402
|
+
tokenFailure = refreshError instanceof Error ? refreshError : new Error(String(refreshError));
|
|
403
|
+
}
|
|
404
|
+
tokenFailure ??= tokenProvider.lastTokenFailure;
|
|
405
|
+
}
|
|
406
|
+
if (tokenFailure) {
|
|
407
|
+
const original = error as ClientError;
|
|
408
|
+
const wrapped = new ClientError(original.path, original.code, `${tokenFailure.message}; Chronicle rejected the unauthenticated RPC`);
|
|
409
|
+
Object.defineProperty(wrapped, 'cause', { value: original });
|
|
410
|
+
Object.defineProperty(wrapped, 'tokenFailure', { value: tokenFailure });
|
|
411
|
+
throw wrapped;
|
|
412
|
+
}
|
|
413
|
+
throw error;
|
|
414
|
+
}
|
|
376
415
|
};
|
|
377
416
|
}
|
|
378
417
|
}
|
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
EventSequencesClient,
|
|
8
8
|
EventStoresClient,
|
|
9
9
|
EventTypesClient,
|
|
10
|
+
ExternalServicesClient,
|
|
10
11
|
FailedPartitionsClient,
|
|
11
12
|
IdentitiesClient,
|
|
12
13
|
JobsClient,
|
|
@@ -24,7 +25,6 @@ import type {
|
|
|
24
25
|
} from '@cratis/chronicle.contracts';
|
|
25
26
|
import type { ComplianceClient } from '../compliance/ComplianceContracts.js';
|
|
26
27
|
import type { EventStoreSubscriptionsClient } from '../eventStoreSubscriptions/contracts.js';
|
|
27
|
-
import type { ExternalServicesClient } from '../externalServices/ExternalServicesContracts.js';
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Represents all Chronicle gRPC services.
|
|
@@ -5,9 +5,9 @@ import { createRequire } from 'node:module';
|
|
|
5
5
|
import { chronicleDescriptorSet, type ConnectionServiceClient } from '@cratis/chronicle.contracts';
|
|
6
6
|
import { ClientError, Status, type ClientMiddleware } from 'nice-grpc-common';
|
|
7
7
|
import { IncompatibleChronicleServer } from './IncompatibleChronicleServer.js';
|
|
8
|
+
import { clientVersion } from './clientVersion.js';
|
|
8
9
|
|
|
9
10
|
const require = createRequire(import.meta.url);
|
|
10
|
-
const clientVersion = (require('@cratis/chronicle/package.json') as { version: string }).version;
|
|
11
11
|
const protocolVersion = (require('@cratis/chronicle.contracts/package.json') as { version: string }).version;
|
|
12
12
|
|
|
13
13
|
/** Verifies the installed wire contract before a channel can perform event-sequence operations. */
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/** Authentication failed permanently because the token endpoint rejected the credentials. */
|
|
5
|
+
export class RejectedChronicleCredentials extends Error {
|
|
6
|
+
constructor(message: string, options?: ErrorOptions) {
|
|
7
|
+
super(message, options);
|
|
8
|
+
this.name = 'RejectedChronicleCredentials';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -98,19 +98,18 @@ describe('OAuthTokenProvider', () => {
|
|
|
98
98
|
});
|
|
99
99
|
|
|
100
100
|
describe('when no token can be fetched', () => {
|
|
101
|
-
it('should
|
|
101
|
+
it('should report the endpoint and cause', async () => {
|
|
102
102
|
const { provider } = createProvider([new Error('unavailable')]);
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
// the session machinery's problem, not the token provider's.
|
|
106
|
-
expect(await provider.getAccessToken()).toBeUndefined();
|
|
104
|
+
await expect(provider.getAccessToken()).rejects.toThrow('https://localhost:35000/connect/token: unavailable');
|
|
107
105
|
});
|
|
108
106
|
|
|
109
107
|
it('should throttle further fetch attempts', async () => {
|
|
110
108
|
const { provider, fetchToken } = createProvider([new Error('unavailable')]);
|
|
111
109
|
|
|
110
|
+
await expect(provider.getAccessToken()).rejects.toThrow('unavailable');
|
|
112
111
|
expect(await provider.getAccessToken()).toBeUndefined();
|
|
113
|
-
expect(
|
|
112
|
+
expect(provider.lastTokenFailure?.message).toContain('unavailable');
|
|
114
113
|
|
|
115
114
|
// The second request arrives well inside the retry delay — one attempt,
|
|
116
115
|
// not one per RPC (the session answers a keepalive every second).
|
|
@@ -121,7 +120,7 @@ describe('OAuthTokenProvider', () => {
|
|
|
121
120
|
vi.useFakeTimers();
|
|
122
121
|
const { provider, fetchToken } = createProvider([new Error('unavailable'), token('token-1', longLifetime)]);
|
|
123
122
|
|
|
124
|
-
expect(
|
|
123
|
+
await expect(provider.getAccessToken()).rejects.toThrow('unavailable');
|
|
125
124
|
vi.advanceTimersByTime(5000);
|
|
126
125
|
|
|
127
126
|
expect(await provider.getAccessToken()).toBe('token-1');
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { fetchOAuthAccessToken, type OAuthTokenResponse } from './fetchOAuthAccessToken.js';
|
|
4
|
+
import { fetchOAuthAccessToken, OAuthTokenHttpError, type OAuthTokenResponse } from './fetchOAuthAccessToken.js';
|
|
6
5
|
|
|
7
6
|
// Refresh once the token has less than this long left before it expires.
|
|
8
7
|
const TOKEN_REFRESH_MARGIN_MS = 60_000;
|
|
@@ -19,12 +18,12 @@ export interface ITokenProvider {
|
|
|
19
18
|
/**
|
|
20
19
|
* Gets the current access token.
|
|
21
20
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* session machinery recovers from.
|
|
25
|
-
* @returns Promise resolving to the access token or undefined if not available.
|
|
21
|
+
* A failed fetch rejects with the token endpoint and cause; throttled calls return undefined.
|
|
22
|
+
* @returns Promise resolving to the access token or undefined when no token is available.
|
|
26
23
|
*/
|
|
27
24
|
getAccessToken(): Promise<string | undefined>;
|
|
25
|
+
/** Most recent token failure when no token could be obtained. */
|
|
26
|
+
readonly lastTokenFailure?: Error;
|
|
28
27
|
|
|
29
28
|
/**
|
|
30
29
|
* Refreshes the access token by clearing cached tokens and obtaining a new one.
|
|
@@ -58,15 +57,16 @@ export class NoOpTokenProvider implements ITokenProvider {
|
|
|
58
57
|
* auth endpoint does not turn every RPC into a fetch attempt.
|
|
59
58
|
*/
|
|
60
59
|
export class OAuthTokenProvider implements ITokenProvider {
|
|
61
|
-
private readonly _logger = diag.createComponentLogger({
|
|
62
|
-
namespace: '@cratis/chronicle/OAuthTokenProvider'
|
|
63
|
-
});
|
|
64
|
-
|
|
65
60
|
private _accessToken?: string;
|
|
66
61
|
private _expiresAt = 0;
|
|
67
62
|
private _lastFailedFetch?: number;
|
|
63
|
+
private _lastFetchError?: Error;
|
|
68
64
|
private _refreshPromise?: Promise<string | undefined>;
|
|
69
65
|
|
|
66
|
+
get lastTokenFailure(): Error | undefined {
|
|
67
|
+
return this._lastFetchError;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
70
|
/**
|
|
71
71
|
* Creates a new {@link OAuthTokenProvider}.
|
|
72
72
|
* @param tokenEndpoint - The OAuth2 token endpoint to request tokens from.
|
|
@@ -76,12 +76,12 @@ export class OAuthTokenProvider implements ITokenProvider {
|
|
|
76
76
|
* @param _fetchToken - Test-only seam replacing the OAuth2 token request.
|
|
77
77
|
*/
|
|
78
78
|
constructor(
|
|
79
|
-
|
|
79
|
+
private readonly _tokenEndpoint: string,
|
|
80
80
|
clientId: string,
|
|
81
81
|
clientSecret: string,
|
|
82
82
|
skipTlsValidation: boolean = true,
|
|
83
83
|
private readonly _fetchToken: () => Promise<OAuthTokenResponse> = () =>
|
|
84
|
-
fetchOAuthAccessToken(
|
|
84
|
+
fetchOAuthAccessToken(this._tokenEndpoint, clientId, clientSecret, skipTlsValidation)
|
|
85
85
|
) {}
|
|
86
86
|
|
|
87
87
|
async getAccessToken(): Promise<string | undefined> {
|
|
@@ -94,7 +94,9 @@ export class OAuthTokenProvider implements ITokenProvider {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
if (this.isThrottled()) {
|
|
97
|
-
|
|
97
|
+
const cached = this.cachedTokenWhileValid();
|
|
98
|
+
if (cached) return cached;
|
|
99
|
+
return undefined;
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
this._refreshPromise = this.fetchAndCacheAccessToken();
|
|
@@ -109,6 +111,7 @@ export class OAuthTokenProvider implements ITokenProvider {
|
|
|
109
111
|
this._accessToken = undefined;
|
|
110
112
|
this._expiresAt = 0;
|
|
111
113
|
this._lastFailedFetch = undefined;
|
|
114
|
+
this._lastFetchError = undefined;
|
|
112
115
|
return this.getAccessToken();
|
|
113
116
|
}
|
|
114
117
|
|
|
@@ -117,6 +120,11 @@ export class OAuthTokenProvider implements ITokenProvider {
|
|
|
117
120
|
}
|
|
118
121
|
|
|
119
122
|
private isThrottled(): boolean {
|
|
123
|
+
// Authentication rejections must be checked on each new connection attempt: the
|
|
124
|
+
// kernel may still be registering bootstrap clients during startup.
|
|
125
|
+
const failure = this._lastFetchError?.cause;
|
|
126
|
+
if (failure instanceof OAuthTokenHttpError && [400, 401].includes(failure.statusCode) &&
|
|
127
|
+
['invalid_client', 'unauthorized_client', 'invalid_grant'].includes(failure.errorCode ?? '')) return false;
|
|
120
128
|
return this._lastFailedFetch !== undefined && Date.now() - this._lastFailedFetch < FAILED_FETCH_RETRY_DELAY_MS;
|
|
121
129
|
}
|
|
122
130
|
|
|
@@ -130,13 +138,14 @@ export class OAuthTokenProvider implements ITokenProvider {
|
|
|
130
138
|
this._accessToken = response.access_token;
|
|
131
139
|
this._expiresAt = Date.now() + this.lifetimeSecondsFrom(response) * 1000;
|
|
132
140
|
this._lastFailedFetch = undefined;
|
|
141
|
+
this._lastFetchError = undefined;
|
|
133
142
|
return this._accessToken;
|
|
134
143
|
} catch (error) {
|
|
135
|
-
this._logger.warn('Failed to fetch OAuth2 token', {
|
|
136
|
-
error: error instanceof Error ? error.message : String(error)
|
|
137
|
-
});
|
|
138
144
|
this._lastFailedFetch = Date.now();
|
|
139
|
-
|
|
145
|
+
this._lastFetchError = new Error(`Failed to obtain OAuth2 token from ${this._tokenEndpoint}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
146
|
+
const cached = this.cachedTokenWhileValid();
|
|
147
|
+
if (cached) return cached;
|
|
148
|
+
throw this._lastFetchError;
|
|
140
149
|
}
|
|
141
150
|
}
|
|
142
151
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
5
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
6
|
+
import { ChronicleClient } from '../ChronicleClient.js';
|
|
7
|
+
import { ChronicleOptions } from '../ChronicleOptions.js';
|
|
8
|
+
import { KernelKeepAlive } from './KernelKeepAlive.js';
|
|
9
|
+
import { clientVersion } from './clientVersion.js';
|
|
10
|
+
|
|
11
|
+
const require = createRequire(import.meta.url);
|
|
12
|
+
|
|
13
|
+
describe('Chronicle client version', () => {
|
|
14
|
+
it('uses the installed package version for kernel keep-alive', async () => {
|
|
15
|
+
const expected = (require('@cratis/chronicle/package.json') as { version: string }).version;
|
|
16
|
+
const start = vi.spyOn(KernelKeepAlive.prototype, 'start').mockResolvedValue(undefined);
|
|
17
|
+
const client = new ChronicleClient(ChronicleOptions.fromConnectionString('chronicle://localhost:35000', { discoveryPatterns: [] }));
|
|
18
|
+
try {
|
|
19
|
+
await (client as unknown as { startKernelKeepAlive(): Promise<void> }).startKernelKeepAlive();
|
|
20
|
+
expect(clientVersion).toBe(expected);
|
|
21
|
+
expect(start.mock.calls[0][0].ClientVersion).toBe(expected);
|
|
22
|
+
} finally {
|
|
23
|
+
client.dispose();
|
|
24
|
+
start.mockRestore();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
5
|
+
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
|
|
8
|
+
/** Version of the installed Chronicle client package. */
|
|
9
|
+
export const clientVersion = (require('@cratis/chronicle/package.json') as { version: string }).version;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
import { describeRequestError } from './fetchOAuthAccessToken.js';
|
|
6
|
+
|
|
7
|
+
describe('when describing a token request error', () => {
|
|
8
|
+
it('should include the inner errors of an aggregate error with an empty message', () => {
|
|
9
|
+
const refused = Object.assign(new Error('connect ECONNREFUSED 127.0.0.1:35999'), { code: 'ECONNREFUSED' });
|
|
10
|
+
const refusedIpv6 = Object.assign(new Error('connect ECONNREFUSED ::1:35999'), { code: 'ECONNREFUSED' });
|
|
11
|
+
const error = Object.assign(new AggregateError([refusedIpv6, refused], ''), { code: 'ECONNREFUSED' });
|
|
12
|
+
expect(describeRequestError(error)).toBe('connect ECONNREFUSED ::1:35999; connect ECONNREFUSED 127.0.0.1:35999');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should keep the message of an ordinary error', () => {
|
|
16
|
+
expect(describeRequestError(new Error('socket hang up'))).toBe('socket hang up');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should name the code when there is no message', () => {
|
|
20
|
+
expect(describeRequestError(Object.assign(new Error(''), { code: 'ETIMEDOUT' }))).toBe('ETIMEDOUT');
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -7,6 +7,21 @@ import * as https from 'https';
|
|
|
7
7
|
/**
|
|
8
8
|
* The shape of a successful OAuth2 token response.
|
|
9
9
|
*/
|
|
10
|
+
export class OAuthTokenHttpError extends Error {
|
|
11
|
+
readonly errorCode?: string;
|
|
12
|
+
|
|
13
|
+
constructor(readonly statusCode: number, body: string) {
|
|
14
|
+
super(`Token request failed with status ${statusCode}: ${body}`);
|
|
15
|
+
this.name = 'OAuthTokenHttpError';
|
|
16
|
+
try {
|
|
17
|
+
const parsed = JSON.parse(body) as { error?: unknown };
|
|
18
|
+
if (parsed && typeof parsed.error === 'string') this.errorCode = parsed.error;
|
|
19
|
+
} catch {
|
|
20
|
+
// A proxy may return HTML or plain text instead of an OAuth error response.
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
10
25
|
export interface OAuthTokenResponse {
|
|
11
26
|
access_token: string;
|
|
12
27
|
|
|
@@ -58,7 +73,7 @@ export function fetchOAuthAccessToken(
|
|
|
58
73
|
|
|
59
74
|
response.on('end', () => {
|
|
60
75
|
if (response.statusCode !== 200) {
|
|
61
|
-
reject(new
|
|
76
|
+
reject(new OAuthTokenHttpError(response.statusCode ?? 0, data));
|
|
62
77
|
return;
|
|
63
78
|
}
|
|
64
79
|
|
|
@@ -77,10 +92,26 @@ export function fetchOAuthAccessToken(
|
|
|
77
92
|
});
|
|
78
93
|
|
|
79
94
|
request.on('error', error => {
|
|
80
|
-
reject(new Error(`Token request failed: ${error
|
|
95
|
+
reject(new Error(`Token request failed: ${describeRequestError(error)}`, { cause: error }));
|
|
81
96
|
});
|
|
82
97
|
|
|
83
98
|
request.write(body);
|
|
84
99
|
request.end();
|
|
85
100
|
});
|
|
86
101
|
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Describes a request error. Connecting to a host that resolves to several addresses, such as
|
|
105
|
+
* localhost, fails with an AggregateError whose own message is empty.
|
|
106
|
+
* @param error - The request error.
|
|
107
|
+
* @returns A description that names the failure.
|
|
108
|
+
*/
|
|
109
|
+
export function describeRequestError(error: Error): string {
|
|
110
|
+
const code = (error as NodeJS.ErrnoException).code;
|
|
111
|
+
const inner = error instanceof AggregateError
|
|
112
|
+
? error.errors.map(item => item instanceof Error ? item.message : String(item)).filter(Boolean).join('; ')
|
|
113
|
+
: '';
|
|
114
|
+
return [error.message, inner, code && !error.message.includes(code) && !inner.includes(code) ? code : '']
|
|
115
|
+
.filter(Boolean)
|
|
116
|
+
.join(' ') || 'unknown error';
|
|
117
|
+
}
|
|
@@ -32,6 +32,7 @@ export declare class ChronicleClient implements IChronicleClient {
|
|
|
32
32
|
private _keepAliveAbortController?;
|
|
33
33
|
private _healthCheckInFlight;
|
|
34
34
|
private _connectionFailure?;
|
|
35
|
+
private _consecutiveCredentialRejections;
|
|
35
36
|
/**
|
|
36
37
|
* Creates a new {@link ChronicleClient} using the provided options.
|
|
37
38
|
* @param options - The options to configure the client, including the connection string.
|
|
@@ -53,6 +54,8 @@ export declare class ChronicleClient implements IChronicleClient {
|
|
|
53
54
|
*/
|
|
54
55
|
private backOff;
|
|
55
56
|
private withReconnect;
|
|
57
|
+
private terminalConnectionError;
|
|
58
|
+
private hasOAuthCredentialRejection;
|
|
56
59
|
private shouldReconnect;
|
|
57
60
|
private toErrorMessage;
|
|
58
61
|
private startConnectionWatchdog;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChronicleClient.d.ts","sourceRoot":"","sources":["../ChronicleClient.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"ChronicleClient.d.ts","sourceRoot":"","sources":["../ChronicleClient.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAUzD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAK/C;;;;;;;;;;;;GAYG;AACH,qBAAa,eAAgB,YAAW,gBAAgB;IA0BxC,QAAQ,CAAC,OAAO,EAAE,gBAAgB;IAzB9C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAAQ;IACtD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAU;IAE/C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAsB;IAClD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsC;IAC9D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6B;IAExD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAErB;IAEH,OAAO,CAAC,eAAe,CAAC,CAAiC;IACzD,OAAO,CAAC,iBAAiB,CAAC,CAAgB;IAC1C,OAAO,CAAC,mBAAmB,CAAC,CAAgB;IAC5C,OAAO,CAAC,mBAAmB,CAAC,CAAgB;IAC5C,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,yBAAyB,CAAC,CAAkB;IACpD,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,kBAAkB,CAAC,CAAQ;IACnC,OAAO,CAAC,gCAAgC,CAAK;IAE7C;;;OAGG;IACH,YAAqB,OAAO,EAAE,gBAAgB,EA8C7C;IAED,kBAAkB;IACZ,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC,CAwDrH;IAED,kBAAkB;IACZ,cAAc,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAwBhD;IAED,kBAAkB;IAClB,OAAO,IAAI,IAAI,CAqBd;YAEa,gBAAgB;YA4ChB,eAAe;YAuBf,SAAS;IAmDvB;;;;OAIG;YACW,OAAO;YAcP,aAAa;IAyB3B,OAAO,CAAC,uBAAuB;IAW/B,OAAO,CAAC,2BAA2B;IAOnC,OAAO,CAAC,eAAe;IA2BvB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,uBAAuB;YAQjB,cAAc;YAkBd,oBAAoB;IAmClC,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,0BAA0B;YAQpB,yBAAyB;CAmB1C"}
|