@equinor/fusion-framework-module-signalr 5.0.3 → 5.0.4
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/CHANGELOG.md +7 -0
- package/dist/esm/SignalRModule.js +3 -12
- package/dist/esm/SignalRModule.js.map +1 -1
- package/dist/esm/SignalRModuleConfigurator.js +14 -36
- package/dist/esm/SignalRModuleConfigurator.js.map +1 -1
- package/dist/esm/SignalRModuleProvider.js +12 -23
- package/dist/esm/SignalRModuleProvider.js.map +1 -1
- package/dist/esm/lib/Topic.js +4 -2
- package/dist/esm/lib/Topic.js.map +1 -1
- package/dist/esm/lib/utils/configure-from-framework.js +9 -19
- package/dist/esm/lib/utils/configure-from-framework.js.map +1 -1
- package/dist/esm/lib/utils/enable-signalr.js +1 -1
- package/dist/esm/lib/utils/enable-signalr.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +3 -3
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { SignalRConfigurator } from './SignalRModuleConfigurator';
|
|
11
2
|
import { SignalRModuleProvider } from './SignalRModuleProvider';
|
|
12
3
|
export const moduleKey = 'signalR';
|
|
13
4
|
export const module = {
|
|
14
5
|
name: moduleKey,
|
|
15
6
|
configure: () => new SignalRConfigurator(),
|
|
16
|
-
initialize: (init) =>
|
|
17
|
-
const config =
|
|
7
|
+
initialize: async (init) => {
|
|
8
|
+
const config = await init.config.createConfig(init);
|
|
18
9
|
return new SignalRModuleProvider(config);
|
|
19
|
-
}
|
|
10
|
+
},
|
|
20
11
|
};
|
|
21
12
|
export default module;
|
|
22
13
|
//# sourceMappingURL=SignalRModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignalRModule.js","sourceRoot":"","sources":["../../src/SignalRModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SignalRModule.js","sourceRoot":"","sources":["../../src/SignalRModule.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAE7F,OAAO,EAAyB,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAIvF,MAAM,CAAC,MAAM,SAAS,GAAqB,SAAS,CAAC;AAIrD,MAAM,CAAC,MAAM,MAAM,GAAkB;IACnC,IAAI,EAAE,SAAS;IACf,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,mBAAmB,EAAE;IAC1C,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACzB,MAAM,MAAM,GAAG,MAAO,IAAI,CAAC,MAA8B,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAC7E,OAAO,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,63 +1,41 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
11
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
13
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
14
|
-
};
|
|
15
|
-
var _SignalRConfigurator_builderCallbacks, _SignalRConfigurator_hubs;
|
|
16
1
|
import { ModuleConfigBuilder, } from '@equinor/fusion-framework-module';
|
|
17
2
|
/**
|
|
18
3
|
* builder utility class for generating configuration
|
|
19
4
|
*/
|
|
20
5
|
export class SignalRModuleConfigBuilder extends ModuleConfigBuilder {
|
|
21
|
-
addHub(name, config) {
|
|
22
|
-
|
|
23
|
-
this._config.addHub(name, config);
|
|
24
|
-
});
|
|
6
|
+
async addHub(name, config) {
|
|
7
|
+
this._config.addHub(name, config);
|
|
25
8
|
}
|
|
26
9
|
}
|
|
27
10
|
export class SignalRConfigurator {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
_SignalRConfigurator_hubs.set(this, {});
|
|
31
|
-
}
|
|
11
|
+
#builderCallbacks = [];
|
|
12
|
+
#hubs = {};
|
|
32
13
|
/**
|
|
33
14
|
* register SignalR hub configuration.
|
|
34
15
|
*/
|
|
35
16
|
addHub(name, config) {
|
|
36
|
-
|
|
17
|
+
this.#hubs[name] = config;
|
|
37
18
|
}
|
|
38
19
|
/**
|
|
39
20
|
* add callback for building config on when configurator is creating config.
|
|
40
21
|
* {@link SignalRConfigurator.createConfig}
|
|
41
22
|
*/
|
|
42
23
|
onCreateConfig(cb) {
|
|
43
|
-
|
|
24
|
+
this.#builderCallbacks.push(cb);
|
|
44
25
|
}
|
|
45
26
|
/**
|
|
46
27
|
* normally executed in `init` phase of module, which creates configuration to the module provider.
|
|
47
28
|
* cycles threw all registered configuration builders.
|
|
48
29
|
* await all registered hub configurations.
|
|
49
30
|
*/
|
|
50
|
-
createConfig(init) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return { hubs: __classPrivateFieldGet(this, _SignalRConfigurator_hubs, "f") };
|
|
59
|
-
});
|
|
31
|
+
async createConfig(init) {
|
|
32
|
+
/** trigger all builder callbacks */
|
|
33
|
+
for (const cb of this.#builderCallbacks) {
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
|
+
const builder = new SignalRModuleConfigBuilder(init, this);
|
|
36
|
+
await Promise.resolve(cb(builder));
|
|
37
|
+
}
|
|
38
|
+
return { hubs: this.#hubs };
|
|
60
39
|
}
|
|
61
40
|
}
|
|
62
|
-
_SignalRConfigurator_builderCallbacks = new WeakMap(), _SignalRConfigurator_hubs = new WeakMap();
|
|
63
41
|
//# sourceMappingURL=SignalRModuleConfigurator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignalRModuleConfigurator.js","sourceRoot":"","sources":["../../src/SignalRModuleConfigurator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SignalRModuleConfigurator.js","sourceRoot":"","sources":["../../src/SignalRModuleConfigurator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,GAEpB,MAAM,kCAAkC,CAAC;AAwC1C;;GAEG;AACH,MAAM,OAAO,0BAGX,SAAQ,mBAAgD;IACxD,KAAK,CAAC,MAAM,CAAC,IAAY,EAAE,MAAwB;QACjD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;CACF;AAED,MAAM,OAAO,mBAAmB;IAC9B,iBAAiB,GAA8C,EAAE,CAAC;IAElE,KAAK,GAAqC,EAAE,CAAC;IAE7C;;OAEG;IACI,MAAM,CAAC,IAAY,EAAE,MAAwB;QAClD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACI,cAAc,CAAI,EAAyC;QAChE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,YAAY,CACvB,IAA2E;QAE3E,oCAAoC;QACpC,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACxC,8DAA8D;YAC9D,MAAM,OAAO,GAAG,IAAI,0BAA0B,CAA2B,IAAI,EAAE,IAAI,CAAC,CAAC;YACrF,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -1,38 +1,28 @@
|
|
|
1
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _SignalRModuleProvider_config, _SignalRModuleProvider_hubConnections;
|
|
13
1
|
import { HubConnectionBuilder, AbortError } from '@microsoft/signalr';
|
|
14
2
|
import { Observable, shareReplay } from 'rxjs';
|
|
15
3
|
import { Topic } from './lib/Topic';
|
|
16
4
|
export class SignalRModuleProvider {
|
|
5
|
+
#config;
|
|
6
|
+
#hubConnections = {};
|
|
17
7
|
constructor(config) {
|
|
18
|
-
|
|
19
|
-
_SignalRModuleProvider_hubConnections.set(this, {});
|
|
20
|
-
__classPrivateFieldSet(this, _SignalRModuleProvider_config, config, "f");
|
|
8
|
+
this.#config = config;
|
|
21
9
|
}
|
|
22
10
|
connect(hubId, methodName) {
|
|
23
11
|
return new Topic(methodName, this._createHubConnection(hubId));
|
|
24
12
|
}
|
|
25
13
|
_createHubConnection(hubId) {
|
|
26
14
|
const LOG_LEVEL_CRITICAL = 5;
|
|
27
|
-
if (hubId in
|
|
28
|
-
return
|
|
15
|
+
if (hubId in this.#hubConnections) {
|
|
16
|
+
return this.#hubConnections[hubId];
|
|
29
17
|
}
|
|
30
|
-
const config =
|
|
18
|
+
const config = this.#config.hubs[hubId];
|
|
31
19
|
if (!config) {
|
|
32
20
|
throw Error(`could not find any configuration for hub [${hubId}]`);
|
|
33
21
|
}
|
|
34
|
-
|
|
35
|
-
const builder = new HubConnectionBuilder().withUrl(config.url,
|
|
22
|
+
this.#hubConnections[hubId] = new Observable((observer) => {
|
|
23
|
+
const builder = new HubConnectionBuilder().withUrl(config.url, {
|
|
24
|
+
...config.options,
|
|
25
|
+
});
|
|
36
26
|
config.automaticReconnect && builder.withAutomaticReconnect();
|
|
37
27
|
builder.configureLogging(config.logLevel || LOG_LEVEL_CRITICAL);
|
|
38
28
|
const connection = builder.build();
|
|
@@ -52,7 +42,7 @@ export class SignalRModuleProvider {
|
|
|
52
42
|
const teardown = () => {
|
|
53
43
|
connection.stop();
|
|
54
44
|
observer.complete();
|
|
55
|
-
delete
|
|
45
|
+
delete this.#hubConnections[hubId];
|
|
56
46
|
};
|
|
57
47
|
return teardown;
|
|
58
48
|
}).pipe(shareReplay({
|
|
@@ -61,9 +51,8 @@ export class SignalRModuleProvider {
|
|
|
61
51
|
/** when no subscribers, teardown observable */
|
|
62
52
|
refCount: true,
|
|
63
53
|
}));
|
|
64
|
-
return
|
|
54
|
+
return this.#hubConnections[hubId];
|
|
65
55
|
}
|
|
66
56
|
}
|
|
67
|
-
_SignalRModuleProvider_config = new WeakMap(), _SignalRModuleProvider_hubConnections = new WeakMap();
|
|
68
57
|
export default SignalRModuleProvider;
|
|
69
58
|
//# sourceMappingURL=SignalRModuleProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignalRModuleProvider.js","sourceRoot":"","sources":["../../src/SignalRModuleProvider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SignalRModuleProvider.js","sourceRoot":"","sources":["../../src/SignalRModuleProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAsB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAI/C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAUpC,MAAM,OAAO,qBAAqB;IAChC,OAAO,CAAgB;IACvB,eAAe,GAA8C,EAAE,CAAC;IAEhE,YAAY,MAAqB;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAEM,OAAO,CAAI,KAAa,EAAE,UAAkB;QACjD,OAAO,IAAI,KAAK,CAAI,UAAU,EAAE,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC;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,CAAC;gBACpB,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YACrC,CAAC,CAAC;YAEF,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC,CAAC,IAAI,CACL,WAAW,CAAC;YACV,6DAA6D;YAC7D,UAAU,EAAE,CAAC;YACb,+CAA+C;YAC/C,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAC;QAEF,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;CACF;AAED,eAAe,qBAAqB,CAAC"}
|
package/dist/esm/lib/Topic.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
export class Topic extends Observable {
|
|
3
|
+
topic;
|
|
4
|
+
hubConnection;
|
|
5
|
+
connection;
|
|
3
6
|
constructor(topic, hubConnection) {
|
|
4
7
|
super((subscriber) => {
|
|
5
8
|
const hubConnectionSubscription = hubConnection.subscribe((connection) => {
|
|
@@ -24,11 +27,10 @@ export class Topic extends Observable {
|
|
|
24
27
|
}
|
|
25
28
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
29
|
invoke(...args) {
|
|
27
|
-
var _a;
|
|
28
30
|
if (!this.connection) {
|
|
29
31
|
throw new Error('No hub connection awaitable');
|
|
30
32
|
}
|
|
31
|
-
return
|
|
33
|
+
return this.connection?.invoke(this.topic, args);
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
//# sourceMappingURL=Topic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Topic.js","sourceRoot":"","sources":["../../../src/lib/Topic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,MAAM,OAAO,KAAS,SAAQ,UAAa;
|
|
1
|
+
{"version":3,"file":"Topic.js","sourceRoot":"","sources":["../../../src/lib/Topic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,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,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;CACF"}
|
|
@@ -1,34 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export const configureFromFramework = (args, builder) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
-
const authProvider = yield builder.requireInstance('auth');
|
|
12
|
-
const serviceDiscovery = yield builder.requireInstance('serviceDiscovery');
|
|
13
|
-
const service = yield serviceDiscovery.resolveService(args.name);
|
|
1
|
+
export const configureFromFramework = async (args, builder) => {
|
|
2
|
+
const authProvider = await builder.requireInstance('auth');
|
|
3
|
+
const serviceDiscovery = await builder.requireInstance('serviceDiscovery');
|
|
4
|
+
const service = await serviceDiscovery.resolveService(args.name);
|
|
14
5
|
builder.addHub(args.name, {
|
|
15
6
|
url: new URL(args.path, service.uri).toString(),
|
|
16
7
|
options: {
|
|
17
|
-
accessTokenFactory: () =>
|
|
18
|
-
var _a;
|
|
8
|
+
accessTokenFactory: async () => {
|
|
19
9
|
if (!service.scopes) {
|
|
20
10
|
throw Error(`service [${service.name}] does not have authentication scopes, please configure an endpoint with scopes`);
|
|
21
11
|
}
|
|
22
|
-
const token =
|
|
23
|
-
scopes:
|
|
12
|
+
const token = await authProvider.acquireAccessToken({
|
|
13
|
+
scopes: service.scopes ?? service.defaultScopes,
|
|
24
14
|
});
|
|
25
15
|
if (!token) {
|
|
26
16
|
throw Error('failed to acquire access token');
|
|
27
17
|
}
|
|
28
18
|
return token;
|
|
29
|
-
}
|
|
19
|
+
},
|
|
30
20
|
},
|
|
31
21
|
automaticReconnect: true,
|
|
32
22
|
});
|
|
33
|
-
}
|
|
23
|
+
};
|
|
34
24
|
//# sourceMappingURL=configure-from-framework.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure-from-framework.js","sourceRoot":"","sources":["../../../../src/lib/utils/configure-from-framework.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"configure-from-framework.js","sourceRoot":"","sources":["../../../../src/lib/utils/configure-from-framework.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACzC,IAAqD,EACrD,OAAyE,EACzE,EAAE;IACF,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC3D,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;IAC3E,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;QACxB,GAAG,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;QAC/C,OAAO,EAAE;YACP,kBAAkB,EAAE,KAAK,IAAI,EAAE;gBAC7B,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;oBACpB,MAAM,KAAK,CACT,YAAY,OAAO,CAAC,IAAI,iFAAiF,CAC1G,CAAC;gBACJ,CAAC;gBACD,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,kBAAkB,CAAC;oBAClD,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,aAAa;iBAChD,CAAC,CAAC;gBACH,IAAI,CAAC,KAAK,EAAE,CAAC;oBACX,MAAM,KAAK,CAAC,gCAAgC,CAAC,CAAC;gBAChD,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;SACF;QACD,kBAAkB,EAAE,IAAI;KACzB,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -42,7 +42,7 @@ configurator, name, optionsOrCallback) {
|
|
|
42
42
|
configurator.addConfig({
|
|
43
43
|
module,
|
|
44
44
|
configure: (signalRConfigurator) => {
|
|
45
|
-
signalRConfigurator.onCreateConfig((builder) => configureFromFramework(
|
|
45
|
+
signalRConfigurator.onCreateConfig((builder) => configureFromFramework({ name, ...optionsOrCallback }, builder));
|
|
46
46
|
},
|
|
47
47
|
});
|
|
48
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enable-signalr.js","sourceRoot":"","sources":["../../../../src/lib/utils/enable-signalr.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAiBpE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,aAAa;AAC3B,8DAA8D;AAC9D,YAA4C,EAC5C,IAAY,EACZ,iBAAyF;IAEzF,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE,CAAC;QAC5C,YAAY,CAAC,SAAS,CAAC;YACrB,MAAM;YACN,SAAS,EAAE,CAAC,mBAAmB,EAAE,EAAE;gBACjC,mBAAmB,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;YACxD,CAAC;SACF,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,YAAY,CAAC,SAAS,CAAC;YACrB,MAAM;YACN,SAAS,EAAE,CAAC,mBAAmB,EAAE,EAAE;gBACjC,mBAAmB,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE,CAC7C,sBAAsB,
|
|
1
|
+
{"version":3,"file":"enable-signalr.js","sourceRoot":"","sources":["../../../../src/lib/utils/enable-signalr.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAiBpE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,aAAa;AAC3B,8DAA8D;AAC9D,YAA4C,EAC5C,IAAY,EACZ,iBAAyF;IAEzF,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE,CAAC;QAC5C,YAAY,CAAC,SAAS,CAAC;YACrB,MAAM;YACN,SAAS,EAAE,CAAC,mBAAmB,EAAE,EAAE;gBACjC,mBAAmB,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;YACxD,CAAC;SACF,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,YAAY,CAAC,SAAS,CAAC;YACrB,MAAM;YACN,SAAS,EAAE,CAAC,mBAAmB,EAAE,EAAE;gBACjC,mBAAmB,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE,CAC7C,sBAAsB,CAAC,EAAE,IAAI,EAAE,GAAG,iBAAiB,EAAE,EAAE,OAAO,CAAC,CAChE,CAAC;YACJ,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
package/dist/esm/version.js
CHANGED