@genesislcap/foundation-comms 14.187.1-accessibility.1 → 14.187.1-alpha-3406925.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/dts/connect/connect.d.ts +11 -6
- package/dist/dts/connect/connect.d.ts.map +1 -1
- package/dist/dts/connect/http.connect.d.ts +2 -2
- package/dist/dts/connect/http.connect.d.ts.map +1 -1
- package/dist/dts/connect/message.d.ts +11 -0
- package/dist/dts/connect/message.d.ts.map +1 -1
- package/dist/dts/connect/socket.d.ts +6 -2
- package/dist/dts/connect/socket.d.ts.map +1 -1
- package/dist/dts/datasource/datasource.config.d.ts +44 -0
- package/dist/dts/datasource/datasource.config.d.ts.map +1 -0
- package/dist/dts/datasource/datasource.d.ts +49 -19
- package/dist/dts/datasource/datasource.d.ts.map +1 -1
- package/dist/dts/datasource/datasource.mixins.d.ts +367 -0
- package/dist/dts/datasource/datasource.mixins.d.ts.map +1 -0
- package/dist/dts/datasource/datasource.types.d.ts +14 -22
- package/dist/dts/datasource/datasource.types.d.ts.map +1 -1
- package/dist/dts/datasource/entityDatasource.d.ts +5 -8
- package/dist/dts/datasource/entityDatasource.d.ts.map +1 -1
- package/dist/dts/datasource/index.d.ts +2 -0
- package/dist/dts/datasource/index.d.ts.map +1 -1
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/resources/genesis/config.d.ts +81 -0
- package/dist/dts/resources/genesis/config.d.ts.map +1 -0
- package/dist/dts/resources/genesis/genesis.d.ts +69 -0
- package/dist/dts/resources/genesis/genesis.d.ts.map +1 -0
- package/dist/dts/resources/genesis/index.d.ts +4 -0
- package/dist/dts/resources/genesis/index.d.ts.map +1 -0
- package/dist/dts/resources/genesis/types.d.ts +19 -0
- package/dist/dts/resources/genesis/types.d.ts.map +1 -0
- package/dist/dts/resources/index.d.ts +2 -0
- package/dist/dts/resources/index.d.ts.map +1 -0
- package/dist/dts/testing/mocks/auth/auth.d.ts +3 -0
- package/dist/dts/testing/mocks/auth/auth.d.ts.map +1 -1
- package/dist/dts/testing/mocks/connect/connect.d.ts +3 -2
- package/dist/dts/testing/mocks/connect/connect.d.ts.map +1 -1
- package/dist/dts/testing/mocks/connect/socket.d.ts +1 -0
- package/dist/dts/testing/mocks/connect/socket.d.ts.map +1 -1
- package/dist/dts/testing/mocks/datasource/datasource.d.ts +22 -4
- package/dist/dts/testing/mocks/datasource/datasource.d.ts.map +1 -1
- package/dist/dts/testing/mocks/index.d.ts +1 -0
- package/dist/dts/testing/mocks/index.d.ts.map +1 -1
- package/dist/dts/testing/mocks/resources/genesis/genesis.d.ts +16 -0
- package/dist/dts/testing/mocks/resources/genesis/genesis.d.ts.map +1 -0
- package/dist/dts/testing/mocks/resources/genesis/index.d.ts +2 -0
- package/dist/dts/testing/mocks/resources/genesis/index.d.ts.map +1 -0
- package/dist/dts/testing/mocks/resources/index.d.ts +2 -0
- package/dist/dts/testing/mocks/resources/index.d.ts.map +1 -0
- package/dist/esm/connect/connect.js +12 -15
- package/dist/esm/connect/http.connect.js +5 -3
- package/dist/esm/connect/message.js +2 -0
- package/dist/esm/connect/socket.js +19 -6
- package/dist/esm/datasource/datasource.config.js +41 -0
- package/dist/esm/datasource/datasource.js +133 -58
- package/dist/esm/datasource/datasource.mixins.js +86 -0
- package/dist/esm/datasource/datasource.types.js +2 -18
- package/dist/esm/datasource/entityDatasource.js +6 -0
- package/dist/esm/datasource/index.js +2 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/resources/genesis/config.js +51 -0
- package/dist/esm/resources/genesis/genesis.js +114 -0
- package/dist/esm/resources/genesis/index.js +3 -0
- package/dist/esm/resources/genesis/types.js +4 -0
- package/dist/esm/resources/index.js +1 -0
- package/dist/esm/testing/mocks/auth/auth.js +10 -0
- package/dist/esm/testing/mocks/connect/connect.js +9 -2
- package/dist/esm/testing/mocks/connect/socket.js +2 -0
- package/dist/esm/testing/mocks/datasource/datasource.js +59 -0
- package/dist/esm/testing/mocks/index.js +1 -0
- package/dist/esm/testing/mocks/resources/genesis/genesis.js +25 -0
- package/dist/esm/testing/mocks/resources/genesis/index.js +1 -0
- package/dist/esm/testing/mocks/resources/index.js +1 -0
- package/dist/foundation-comms.api.json +11047 -6292
- package/dist/foundation-comms.d.ts +696 -37
- package/docs/api/foundation-comms.connect.connect.md +2 -2
- package/docs/api/foundation-comms.connect.getavailableresources.md +2 -2
- package/docs/api/foundation-comms.connect.host.md +11 -0
- package/docs/api/foundation-comms.connect.md +1 -0
- package/docs/api/foundation-comms.datasource.init.md +2 -2
- package/docs/api/foundation-comms.datasource.md +3 -2
- package/docs/api/{foundation-comms.datasource.fieldmetadata.md → foundation-comms.datasource.status.md} +3 -4
- package/docs/api/foundation-comms.datasourceconfig.eventemitter.md +18 -0
- package/docs/api/foundation-comms.datasourceconfig.md +2 -1
- package/docs/api/foundation-comms.datasourceeventhandler.md +353 -0
- package/docs/api/foundation-comms.datasourcemetadata.availableindexes.md +11 -0
- package/docs/api/foundation-comms.datasourcemetadata.fetchmetadatarequired.md +11 -0
- package/docs/api/foundation-comms.datasourcemetadata.fieldmetadata.md +11 -0
- package/docs/api/foundation-comms.datasourcemetadata.md +24 -0
- package/docs/api/foundation-comms.datasourcemetadata.originalfielddef.md +11 -0
- package/docs/api/foundation-comms.datasourcemetadata.requestfields.md +11 -0
- package/docs/api/foundation-comms.datasourcestatus.md +21 -0
- package/docs/api/foundation-comms.datasourcestatuschanged.md +13 -0
- package/docs/api/foundation-comms.datasourcestatuschangedevent.md +15 -0
- package/docs/api/foundation-comms.defaultconnect.connect.md +2 -2
- package/docs/api/foundation-comms.defaultconnect.getavailableresources.md +2 -2
- package/docs/api/foundation-comms.defaultconnect.host.md +11 -0
- package/docs/api/foundation-comms.defaultconnect.md +1 -0
- package/docs/api/foundation-comms.defaultdatasource._constructor_.md +3 -2
- package/docs/api/foundation-comms.defaultdatasource.availableindexes.md +2 -1
- package/docs/api/foundation-comms.defaultdatasource.fetchandapplymetadata.md +22 -0
- package/docs/api/{foundation-comms.defaultdatasource._stream.md → foundation-comms.defaultdatasource.fetchmetadatarequired.md} +4 -3
- package/docs/api/foundation-comms.defaultdatasource.fieldmetadata.md +1 -0
- package/docs/api/foundation-comms.defaultdatasource.initialized.md +3 -1
- package/docs/api/foundation-comms.defaultdatasource.md +10 -7
- package/docs/api/foundation-comms.defaultdatasource.originalfielddef.md +2 -1
- package/docs/api/foundation-comms.defaultdatasource.requestfields.md +2 -1
- package/docs/api/foundation-comms.defaultdatasource.resources.md +11 -0
- package/docs/api/foundation-comms.defaultdatasource.status.md +12 -0
- package/docs/api/foundation-comms.defaultdatasource.stream.md +1 -1
- package/docs/api/foundation-comms.defaultdatasource.validresourcename.md +5 -0
- package/docs/api/foundation-comms.defaultdatasourceconfig.md +1 -1
- package/docs/api/foundation-comms.defaultgenesisresources._constructor_.md +21 -0
- package/docs/api/foundation-comms.defaultgenesisresources.config.md +11 -0
- package/docs/api/foundation-comms.defaultgenesisresources.connect.md +11 -0
- package/docs/api/foundation-comms.defaultgenesisresources.destroy.md +17 -0
- package/docs/api/foundation-comms.defaultgenesisresources.getresources.md +15 -0
- package/docs/api/foundation-comms.defaultgenesisresources.getresourcetypefor.md +24 -0
- package/docs/api/foundation-comms.defaultgenesisresources.isvalidresource.md +24 -0
- package/docs/api/foundation-comms.defaultgenesisresources.md +40 -0
- package/docs/api/foundation-comms.defaultgenesisresources.postloadedmessage.md +15 -0
- package/docs/api/foundation-comms.defaultgenesisresources.resources.md +11 -0
- package/docs/api/foundation-comms.defaultgenesisresources.resourcespromise.md +11 -0
- package/docs/api/foundation-comms.defaultgenesisresourcesconfig.md +13 -0
- package/docs/api/foundation-comms.defaulthttpconnect.getavailableresources.md +2 -2
- package/docs/api/foundation-comms.defaultsocket._constructor_.md +2 -1
- package/docs/api/foundation-comms.defaultsocket.config.md +11 -0
- package/docs/api/foundation-comms.defaultsocket.connect.md +2 -2
- package/docs/api/foundation-comms.defaultsocket.host.md +11 -0
- package/docs/api/foundation-comms.defaultsocket.md +3 -1
- package/docs/api/foundation-comms.eventmessagetype.md +2 -0
- package/docs/api/foundation-comms.genesisresources.destroy.md +13 -0
- package/docs/api/foundation-comms.genesisresources.getresourcetypefor.md +13 -0
- package/docs/api/foundation-comms.genesisresources.isvalidresource.md +13 -0
- package/docs/api/foundation-comms.genesisresources.md +26 -0
- package/docs/api/foundation-comms.genesisresourceschannel.md +33 -0
- package/docs/api/foundation-comms.genesisresourceschannelid.md +12 -0
- package/docs/api/foundation-comms.genesisresourcesconfig.md +21 -0
- package/docs/api/foundation-comms.genesisresourcesconfig.throwwhenunavailable.md +13 -0
- package/docs/api/foundation-comms.genesisresourcesconfig.throwwhenunknown.md +13 -0
- package/docs/api/foundation-comms.genesisresourcesevents.md +17 -0
- package/docs/api/foundation-comms.genesisresourcesmock.destroy.md +15 -0
- package/docs/api/foundation-comms.genesisresourcesmock.getresourcetypefor.md +24 -0
- package/docs/api/foundation-comms.genesisresourcesmock.isvalidresource.md +24 -0
- package/docs/api/foundation-comms.genesisresourcesmock.md +30 -0
- package/docs/api/foundation-comms.genesisresourcesmock.nextisvalidresourceresponse.md +11 -0
- package/docs/api/foundation-comms.genesisresourcesmock.nextresourcetypeforresponse.md +11 -0
- package/docs/api/foundation-comms.genesisresourcesmock.resources.md +11 -0
- package/docs/api/foundation-comms.getgenesisresources.md +30 -0
- package/docs/api/foundation-comms.getgenesisresourceschannel.md +39 -0
- package/docs/api/foundation-comms.md +19 -2
- package/docs/api/foundation-comms.resourceitem.md +15 -0
- package/docs/api/foundation-comms.resourcesmessage.md +18 -0
- package/docs/api/foundation-comms.socket.host.md +11 -0
- package/docs/api/foundation-comms.socket.md +6 -0
- package/docs/api-report.md +550 -25
- package/package.json +13 -12
@@ -0,0 +1,69 @@
|
|
1
|
+
import { Connect, ResourcesMessage } from '../../connect';
|
2
|
+
import type { ResourceType } from '../../datasource';
|
3
|
+
import { GenesisResourcesConfig } from './config';
|
4
|
+
import type { ResourceItem } from './types';
|
5
|
+
/**
|
6
|
+
* GenesisResources DI interface.
|
7
|
+
* @remarks
|
8
|
+
* A lazy shared Genesis Resources lookup system. N number of callers can request information in succession, but only
|
9
|
+
* the first will invoke the server request, and each caller will receive their results when that returns.
|
10
|
+
* @public
|
11
|
+
*/
|
12
|
+
export interface GenesisResources {
|
13
|
+
/**
|
14
|
+
* Checks if the resource exists
|
15
|
+
* @param resourceName - The name of the resource to check.
|
16
|
+
*/
|
17
|
+
isValidResource: (resourceName: string) => Promise<boolean>;
|
18
|
+
/**
|
19
|
+
* Gets the type of resource
|
20
|
+
* @param resourceName - The name of the resource to get the type for.
|
21
|
+
*/
|
22
|
+
getResourceTypeFor: (resourceName: string) => Promise<ResourceType>;
|
23
|
+
/**
|
24
|
+
* Destroy and garbage collect
|
25
|
+
*/
|
26
|
+
destroy: () => void;
|
27
|
+
}
|
28
|
+
/**
|
29
|
+
* Default GenesisResources implementation.
|
30
|
+
* @public
|
31
|
+
*/
|
32
|
+
export declare class DefaultGenesisResources implements GenesisResources {
|
33
|
+
protected connect: Connect;
|
34
|
+
protected config: GenesisResourcesConfig;
|
35
|
+
protected resources: ResourceItem[];
|
36
|
+
protected resourcesPromise: Promise<ResourcesMessage>;
|
37
|
+
constructor(connect: Connect, config: GenesisResourcesConfig);
|
38
|
+
/** {@inheritDoc GenesisResources.isValidResource} */
|
39
|
+
isValidResource(resourceName: string): Promise<boolean>;
|
40
|
+
/** {@inheritDoc GenesisResources.getResourceTypeFor} */
|
41
|
+
getResourceTypeFor(resourceName: string): Promise<ResourceType>;
|
42
|
+
/** {@inheritDoc GenesisResources.destroy} */
|
43
|
+
destroy(): void;
|
44
|
+
protected getResources(): Promise<void>;
|
45
|
+
protected postLoadedMessage(): void;
|
46
|
+
}
|
47
|
+
/**
|
48
|
+
* GenesisResources DI key.
|
49
|
+
* @internal
|
50
|
+
* @privateRemarks
|
51
|
+
* Marked as internal to stop api-extractor becoming confused cross-linking tokens with the same name.
|
52
|
+
*/
|
53
|
+
export declare const GenesisResources: import("@microsoft/fast-foundation").InterfaceSymbol<GenesisResources>;
|
54
|
+
/**
|
55
|
+
* Gets GenesisResources from the DI container.
|
56
|
+
*
|
57
|
+
* @remarks
|
58
|
+
* A utility method for host applications that are not using decorators or the DI container.
|
59
|
+
*
|
60
|
+
* @example
|
61
|
+
* ```ts
|
62
|
+
* import { getGenesisResources } from '@genesislcap/foundation-comms';
|
63
|
+
* ...
|
64
|
+
* const genesisResources = getGenesisResources();
|
65
|
+
* ```
|
66
|
+
* @public
|
67
|
+
*/
|
68
|
+
export declare function getGenesisResources(): GenesisResources;
|
69
|
+
//# sourceMappingURL=genesis.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"genesis.d.ts","sourceRoot":"","sources":["../../../../src/resources/genesis/genesis.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,sBAAsB,EAA8B,MAAM,UAAU,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,eAAe,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5D;;;OAGG;IACH,kBAAkB,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IACpE;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;GAGG;AACH,qBAAa,uBAAwB,YAAW,gBAAgB;IAKnD,SAAS,CAAC,OAAO,EAAE,OAAO;IACX,SAAS,CAAC,MAAM,EAAE,sBAAsB;IALlE,SAAS,CAAC,SAAS,EAAE,YAAY,EAAE,CAAC;IACpC,SAAS,CAAC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;gBAGjC,OAAO,EAAE,OAAO,EACD,MAAM,EAAE,sBAAsB;IAGlE,qDAAqD;IAC/C,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAU7D,wDAAwD;IAClD,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAarE,6CAA6C;IAC7C,OAAO;cAKS,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAyB7C,SAAS,CAAC,iBAAiB;CAU5B;AAED;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,wEAE5B,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,IAAI,gBAAgB,CAEtD"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/resources/genesis/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/**
|
2
|
+
* @public
|
3
|
+
*/
|
4
|
+
export type ResourceItem = {
|
5
|
+
RESOURCE_NAME: string;
|
6
|
+
RESOURCE_TYPE: string;
|
7
|
+
};
|
8
|
+
/**
|
9
|
+
* @public
|
10
|
+
*/
|
11
|
+
export declare const GenesisResourcesChannelId = "genesis-resources";
|
12
|
+
/**
|
13
|
+
* @public
|
14
|
+
*/
|
15
|
+
export type GenesisResourcesEvents = {
|
16
|
+
'resources-loaded': ResourceItem[];
|
17
|
+
'resources-unloaded': void;
|
18
|
+
};
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/resources/genesis/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,sBAAsB,CAAC;AAE7D;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,kBAAkB,EAAE,YAAY,EAAE,CAAC;IACnC,oBAAoB,EAAE,IAAI,CAAC;CAC5B,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import type { User } from '@genesislcap/foundation-user';
|
2
|
+
import { SetUserProperties } from '@genesislcap/foundation-user/dist/esm';
|
2
3
|
import type { Auth, AuthInfo, LoginResult, LogoutResult } from '../../../';
|
3
4
|
/**
|
4
5
|
* @internal
|
@@ -14,5 +15,7 @@ export declare class AuthMock implements Auth {
|
|
14
15
|
login(credentials: AuthInfo): Promise<LoginResult>;
|
15
16
|
logout(): Promise<LogoutResult>;
|
16
17
|
reAuthFromSession(): Promise<boolean>;
|
18
|
+
setTestUser(properties?: Partial<SetUserProperties>): void;
|
19
|
+
resetTestUser(): void;
|
17
20
|
}
|
18
21
|
//# sourceMappingURL=auth.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../../src/testing/mocks/auth/auth.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../../src/testing/mocks/auth/auth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE1E,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE3E;;GAEG;AACH,qBAAa,QAAS,YAAW,IAAI;IACvB,SAAS,UAAS;IAClB,gBAAgB,EAAE,WAAW,CAAQ;IACrC,WAAW,EAAE,IAAI,CAAQ;IACzB,UAAU,EAAE,OAAO,CAAS;IAExC,eAAe,EAAE,WAAW,CAAC;IAC7B,gBAAgB,EAAE,YAAY,CAAC;IAC/B,gBAAgB,EAAE,OAAO,CAAC;IAEpB,KAAK,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC;IAIlD,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IAI/B,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;IAI3C,WAAW,CAAC,UAAU,GAAE,OAAO,CAAC,iBAAiB,CAAM;IAWvD,aAAa;CAId"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { BehaviorSubject, Observable } from 'rxjs';
|
2
|
-
import type { CommitParams, Connect, Message, Metadata, RequestParams, SocketMock, SocketObservable } from '../../../';
|
2
|
+
import type { CommitParams, Connect, Message, Metadata, RequestParams, SocketMock, ResourcesMessage, SocketObservable } from '../../../';
|
3
3
|
/**
|
4
4
|
* @internal
|
5
5
|
*/
|
@@ -7,6 +7,7 @@ export declare class ConnectMock implements Connect {
|
|
7
7
|
isConnected: boolean;
|
8
8
|
isWorking: boolean;
|
9
9
|
socket: SocketMock;
|
10
|
+
get host(): string;
|
10
11
|
get isConnectedSubject(): BehaviorSubject<boolean>;
|
11
12
|
get isConnected$(): Observable<boolean>;
|
12
13
|
send<T>(message: Message<any>, needsHandling?: boolean): Promise<any>;
|
@@ -22,7 +23,7 @@ export declare class ConnectMock implements Connect {
|
|
22
23
|
disconnect(): void;
|
23
24
|
getMetadata(resourceName: string): Promise<Metadata>;
|
24
25
|
request(resourceName: string, params?: RequestParams): Promise<Message>;
|
25
|
-
getAvailableResources(params?: RequestParams): Promise<
|
26
|
+
getAvailableResources(params?: RequestParams): Promise<ResourcesMessage>;
|
26
27
|
snapshot(resourceName: string, params?: any): Promise<Message>;
|
27
28
|
stream(resourceName: string, onMessage: Function, onError: Function, params?: any): SocketObservable<Message>;
|
28
29
|
streamState(resourceName: string, onMessage: Function, onError: Function, params?: any, initialState?: any[]): Observable<any[]>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../../../../src/testing/mocks/connect/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAQ,UAAU,EAAE,MAAM,MAAM,CAAC;AACzD,OAAO,KAAK,EACV,YAAY,EACZ,OAAO,EACP,OAAO,EACP,QAAQ,EACR,aAAa,EACb,UAAU,EACV,gBAAgB,EACjB,MAAM,WAAW,CAAC;AAEnB;;GAEG;AACH,qBAAa,WAAY,YAAW,OAAO;IACzC,WAAW,EAAE,OAAO,CAAQ;IAC5B,SAAS,EAAE,OAAO,CAAS;IAC3B,MAAM,EAAE,UAAU,CAAC;IAEnB,IAAI,kBAAkB,IAAI,eAAe,CAAC,OAAO,CAAC,CAEjD;IAED,IAAI,YAAY,IAAI,UAAU,CAAC,OAAO,CAAC,CAEtC;IAED,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAIrE,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAIrC,QAAQ,IAAI,OAAO;IAInB,YAAY,EAAE,QAAQ,CAAC;IACvB,cAAc,EAAE,GAAG,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,aAAa,CAAC;IAC7B,aAAa,EAAE,GAAG,EAAE,CAAC;IAErB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvE,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../../../../src/testing/mocks/connect/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAQ,UAAU,EAAE,MAAM,MAAM,CAAC;AACzD,OAAO,KAAK,EACV,YAAY,EACZ,OAAO,EACP,OAAO,EACP,QAAQ,EACR,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,WAAW,CAAC;AAEnB;;GAEG;AACH,qBAAa,WAAY,YAAW,OAAO;IACzC,WAAW,EAAE,OAAO,CAAQ;IAC5B,SAAS,EAAE,OAAO,CAAS;IAC3B,MAAM,EAAE,UAAU,CAAC;IAEnB,IAAI,IAAI,WAEP;IAED,IAAI,kBAAkB,IAAI,eAAe,CAAC,OAAO,CAAC,CAEjD;IAED,IAAI,YAAY,IAAI,UAAU,CAAC,OAAO,CAAC,CAEtC;IAED,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAIrE,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAIrC,QAAQ,IAAI,OAAO;IAInB,YAAY,EAAE,QAAQ,CAAC;IACvB,cAAc,EAAE,GAAG,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,aAAa,CAAC;IAC7B,aAAa,EAAE,GAAG,EAAE,CAAC;IAErB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvE,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKvC,UAAU,IAAI,IAAI;IAElB,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIpD,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;IAKjE,qBAAqB,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAK9E,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;IAI9D,MAAM,CACJ,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,QAAQ,EACjB,MAAM,CAAC,EAAE,GAAG,GACX,gBAAgB,CAAC,OAAO,CAAC;IAI5B,WAAW,CACT,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,QAAQ,EACjB,MAAM,CAAC,EAAE,GAAG,EACZ,YAAY,CAAC,EAAE,GAAG,EAAE,GACnB,UAAU,CAAC,GAAG,EAAE,CAAC;IAIpB,yBAAyB,CACvB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,QAAQ,EACjB,MAAM,CAAC,EAAE,GAAG,GACX,gBAAgB,CAAC,OAAO,CAAC;IAI5B,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAIrD,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAIxD,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAIpD,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAGlD"}
|
@@ -13,6 +13,7 @@ export declare class SocketMock implements Socket {
|
|
13
13
|
isConnected: boolean;
|
14
14
|
isConnectedSubject: BehaviorSubject<boolean>;
|
15
15
|
isReconnecting: boolean;
|
16
|
+
host: string;
|
16
17
|
nextMessage: Message;
|
17
18
|
socketMessagesSubject: SocketSubject<Message<any>>;
|
18
19
|
connect(host: string, options?: SocketConnectOptions, reconnectOptions?: SocketReconnectOptions): Promise<boolean>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../../../../src/testing/mocks/connect/socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAQ,UAAU,EAAE,MAAM,MAAM,CAAC;AACzD,OAAO,KAAK,EACV,OAAO,EACP,MAAM,EACN,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD;;GAEG;AACH,qBAAa,UAAW,YAAW,MAAM;IAChC,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,sBAAsB,EAAE,OAAO,CAAC;IAChC,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,kBAAkB,EAAE,eAAe,CAAC,OAAO,CAAC,CAA6B;IACzE,cAAc,EAAE,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../../../../src/testing/mocks/connect/socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAQ,UAAU,EAAE,MAAM,MAAM,CAAC;AACzD,OAAO,KAAK,EACV,OAAO,EACP,MAAM,EACN,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD;;GAEG;AACH,qBAAa,UAAW,YAAW,MAAM;IAChC,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,sBAAsB,EAAE,OAAO,CAAC;IAChC,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,kBAAkB,EAAE,eAAe,CAAC,OAAO,CAAC,CAA6B;IACzE,cAAc,EAAE,OAAO,CAAC;IACxB,IAAI,EAAE,MAAM,CAAe;IAE3B,WAAW,EAAE,OAAO,CAAC;IACrB,qBAAqB,8BAAgC;IAErD,OAAO,CACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,oBAAoB,EAC9B,gBAAgB,CAAC,EAAE,sBAAsB,GACxC,OAAO,CAAC,OAAO,CAAC;IAKZ,UAAU,IAAI,IAAI;IAElB,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,GAAG,GAAG,CAAC;IAItD,aAAa,CAAC,CAAC,EACpB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EACrB,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,QAAQ,EACjB,UAAU,CAAC,EAAE,QAAQ,GACpB,UAAU,CAAC,OAAO,CAAC;IAItB,4BAA4B,CAAC,CAAC,EAC5B,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EACrB,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,QAAQ,GAChB,UAAU,CAAC,OAAO,CAAC;IAIf,cAAc,IAAI,aAAa,CAAC,OAAO,CAAC;IAI/C,KAAK,IAAI,IAAI;CAGd"}
|
@@ -1,16 +1,34 @@
|
|
1
|
-
import { SocketObservable } from '../../../connect';
|
2
|
-
import type { Datasource, DatasourceOptions, Dataview, ResourceType } from '../../../datasource';
|
3
|
-
import { FieldMetadata, FilteredDataServerResult, RequestServerResult } from '../../../metadata';
|
1
|
+
import { Message, SocketObservable } from '../../../connect';
|
2
|
+
import type { Datasource, DatasourceOptions, DatasourceStatus, Dataview, ResourceType } from '../../../datasource';
|
3
|
+
import { FieldMetadata, FilteredDataServerResult, IndexDetail, Metadata, MetadataDetail, RequestServerResult } from '../../../metadata';
|
4
4
|
/**
|
5
5
|
* @internal
|
6
6
|
*/
|
7
7
|
export declare class DatasourceMock implements Datasource {
|
8
|
-
|
8
|
+
status: DatasourceStatus;
|
9
|
+
fetchMetadataRequired: boolean;
|
10
|
+
protected fetchingMetadata: boolean;
|
11
|
+
originalFieldDef: MetadataDetail[];
|
9
12
|
fieldMetadata: FieldMetadata[];
|
13
|
+
requestFields: MetadataDetail[];
|
14
|
+
availableIndexes: IndexDetail[];
|
15
|
+
initialized: boolean;
|
10
16
|
readOnly: boolean;
|
11
17
|
resourceType: ResourceType;
|
12
18
|
stream: SocketObservable<FilteredDataServerResult | RequestServerResult>;
|
13
19
|
init(options: DatasourceOptions, fetchMeta: boolean): Promise<boolean>;
|
20
|
+
/**
|
21
|
+
* Convenience method to avoid you having to prime connect etc.
|
22
|
+
* @param meta - The metadata to set.
|
23
|
+
*/
|
24
|
+
setMetadata(meta: Metadata): void;
|
25
|
+
unsetMedata(): void;
|
26
|
+
/**
|
27
|
+
* Convenience method to avoid you having to prime connect etc.
|
28
|
+
* @param message - The Message to stream.
|
29
|
+
*/
|
30
|
+
setStream(message: Message): void;
|
31
|
+
unsetStream(): void;
|
14
32
|
deinit(): void;
|
15
33
|
destroy(): void;
|
16
34
|
validResourceName(resourceName: string): boolean;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../../../../src/testing/mocks/datasource/datasource.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../../../../src/testing/mocks/datasource/datasource.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,aAAa,EACb,wBAAwB,EACxB,WAAW,EACX,QAAQ,EACR,cAAc,EACd,mBAAmB,EAEpB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,qBAAa,cAAe,YAAW,UAAU;IACnC,MAAM,EAAE,gBAAgB,CAAC;IACzB,qBAAqB,UAAQ;IACzC,SAAS,CAAC,gBAAgB,UAAS;IACvB,gBAAgB,EAAE,cAAc,EAAE,CAAM;IACxC,aAAa,EAAE,aAAa,EAAE,CAAM;IACpC,aAAa,EAAE,cAAc,EAAE,CAAM;IACrC,gBAAgB,EAAE,WAAW,EAAE,CAAM;IAEjD,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,EAAE,gBAAgB,CAAC,wBAAwB,GAAG,mBAAmB,CAAC,CAAC;IAEzE,IAAI,CAAC,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAItE;;;OAGG;IACH,WAAW,CAAC,IAAI,EAAE,QAAQ;IAQ1B,WAAW;IAQX;;;OAGG;IACH,SAAS,CAAC,OAAO,EAAE,OAAO;IAI1B,WAAW;IAIX,MAAM;IAEN,OAAO;IAEP,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAMhD,WAAW,CAAC,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAI5D,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG;IAErB,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM;IAE/B,UAAU,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC,WAAW,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE;IAIhC,OAAO,CAAC,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAE9B,QAAQ,CAAC,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAE/B,SAAS,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlE,WAAW,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC,UAAU,CAAC,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvC,UAAU,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1C,UAAU,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAGtD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/mocks/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/mocks/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { ResourceType } from '../../../../datasource';
|
2
|
+
import type { GenesisResources, ResourceItem } from '../../../../resources';
|
3
|
+
/**
|
4
|
+
* @public
|
5
|
+
*/
|
6
|
+
export declare class GenesisResourcesMock implements GenesisResources {
|
7
|
+
resources: ResourceItem[];
|
8
|
+
nextIsValidResourceResponse: boolean;
|
9
|
+
nextResourceTypeForResponse: ResourceType;
|
10
|
+
/** {@inheritDoc GenesisResources.isValidResource} */
|
11
|
+
isValidResource(resourceName: string): Promise<boolean>;
|
12
|
+
/** {@inheritDoc GenesisResources.getResourceTypeFor} */
|
13
|
+
getResourceTypeFor(resourceName: string): Promise<ResourceType>;
|
14
|
+
destroy(): void;
|
15
|
+
}
|
16
|
+
//# sourceMappingURL=genesis.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"genesis.d.ts","sourceRoot":"","sources":["../../../../../../src/testing/mocks/resources/genesis/genesis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE5E;;GAEG;AACH,qBAAa,oBAAqB,YAAW,gBAAgB;IAC3D,SAAS,EAAE,YAAY,EAAE,CAAM;IAC/B,2BAA2B,EAAE,OAAO,CAAQ;IAC5C,2BAA2B,EAAE,YAAY,CAA2B;IAEpE,qDAAqD;IAC/C,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI7D,wDAAwD;IAClD,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAIrE,OAAO;CACR"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/testing/mocks/resources/genesis/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/testing/mocks/resources/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { __awaiter, __decorate, __param } from "tslib";
|
2
|
-
import { FORCE_HTTP } from '@genesislcap/foundation-utils';
|
3
|
-
import { observable
|
2
|
+
import { FORCE_HTTP, GENESIS_SOCKET_URL } from '@genesislcap/foundation-utils';
|
3
|
+
import { observable } from '@microsoft/fast-element';
|
4
4
|
import { DI } from '@microsoft/fast-foundation';
|
5
5
|
import { scan } from 'rxjs';
|
6
6
|
import { MetaCache } from '../metadata';
|
@@ -8,7 +8,7 @@ import { logger } from '../utils';
|
|
8
8
|
import { ConnectEventsEmitter } from './connect.events';
|
9
9
|
import { ConnectConfig } from './connect.types';
|
10
10
|
import { HttpConnect } from './http.connect';
|
11
|
-
import { EventMessageType, MessageBuilder } from './message';
|
11
|
+
import { EventMessageType, MessageBuilder, } from './message';
|
12
12
|
import { Socket } from './socket';
|
13
13
|
import { updateState } from './updateState';
|
14
14
|
/**
|
@@ -26,6 +26,9 @@ let DefaultConnect = class DefaultConnect {
|
|
26
26
|
var _a;
|
27
27
|
return (_a = this.socket.isConnectedSubject) === null || _a === void 0 ? void 0 : _a.asObservable();
|
28
28
|
}
|
29
|
+
get host() {
|
30
|
+
return this.socket.host;
|
31
|
+
}
|
29
32
|
constructor(socket, messageBuilder, metaCache, events, config) {
|
30
33
|
this.socket = socket;
|
31
34
|
this.messageBuilder = messageBuilder;
|
@@ -46,14 +49,9 @@ let DefaultConnect = class DefaultConnect {
|
|
46
49
|
send(message, needsHandling) {
|
47
50
|
return this.socket.send(message, needsHandling);
|
48
51
|
}
|
49
|
-
connect(host) {
|
52
|
+
connect(host = GENESIS_SOCKET_URL) {
|
50
53
|
return __awaiter(this, void 0, void 0, function* () {
|
51
54
|
this.socket.reset();
|
52
|
-
if (!this.config.isWebSocketExpression.test(host)) {
|
53
|
-
logger.error(`Specified host (${host}) is not valid WebSocket url. Connection will not proceed.`);
|
54
|
-
logger.warn(`Make sure the host url starts with wss:// or ws://`);
|
55
|
-
return;
|
56
|
-
}
|
57
55
|
return this.socket.connect(host, this.config.connect, this.config.reconnect);
|
58
56
|
});
|
59
57
|
}
|
@@ -186,9 +184,11 @@ let DefaultConnect = class DefaultConnect {
|
|
186
184
|
return this.socket.send(requestMessage);
|
187
185
|
}
|
188
186
|
getAvailableResources(params) {
|
189
|
-
|
190
|
-
|
191
|
-
|
187
|
+
return __awaiter(this, void 0, void 0, function* () {
|
188
|
+
const requestMessage = this.messageBuilder.createResourcesMessage(params);
|
189
|
+
logger.debug(`${requestMessage.MESSAGE_TYPE} (resources) message created -> `, requestMessage);
|
190
|
+
return this.socket.send(requestMessage);
|
191
|
+
});
|
192
192
|
}
|
193
193
|
commitEvent(eventName, params) {
|
194
194
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -203,9 +203,6 @@ let DefaultConnect = class DefaultConnect {
|
|
203
203
|
__decorate([
|
204
204
|
observable
|
205
205
|
], DefaultConnect.prototype, "isWorking", void 0);
|
206
|
-
__decorate([
|
207
|
-
volatile
|
208
|
-
], DefaultConnect.prototype, "isConnected", null);
|
209
206
|
DefaultConnect = __decorate([
|
210
207
|
__param(0, Socket),
|
211
208
|
__param(1, MessageBuilder),
|
@@ -192,9 +192,11 @@ let DefaultHttpConnect = class DefaultHttpConnect {
|
|
192
192
|
return this.send(requestMessage);
|
193
193
|
}
|
194
194
|
getAvailableResources(params) {
|
195
|
-
|
196
|
-
|
197
|
-
|
195
|
+
return __awaiter(this, void 0, void 0, function* () {
|
196
|
+
const requestMessage = this.messageBuilder.createResourcesMessage(params);
|
197
|
+
logger.debug(`HTTP MODE! - ${requestMessage.MESSAGE_TYPE} (getResources) message created -> `, requestMessage);
|
198
|
+
return this.send(requestMessage);
|
199
|
+
});
|
198
200
|
}
|
199
201
|
commitEvent(eventName, params) {
|
200
202
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -39,6 +39,8 @@ export var EventMessageType;
|
|
39
39
|
EventMessageType["META_REQUEST"] = "META_REQUEST";
|
40
40
|
EventMessageType["JSON_SCHEMA_REQUEST"] = "JSON_SCHEMA_REQUEST";
|
41
41
|
EventMessageType["RESOURCES_REQUEST"] = "RESOURCES_REQUEST";
|
42
|
+
EventMessageType["RESOURCES_REQUEST_ACK"] = "RESOURCES_REQUEST_ACK";
|
43
|
+
EventMessageType["RESOURCES_REQUEST_NACK"] = "RESOURCES_REQUEST_NACK";
|
42
44
|
EventMessageType["EVENT_CHANGE_USER_PASSWORD"] = "EVENT_CHANGE_USER_PASSWORD";
|
43
45
|
EventMessageType["EVENT_SELF_SERVICE_PASSWORD_RESET"] = "EVENT_SELF_SERVICE_PASSWORD_RESET";
|
44
46
|
EventMessageType["EVENT_PASSWORD_RESET_ACTION"] = "EVENT_PASSWORD_RESET_ACTION";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { __awaiter, __decorate, __param } from "tslib";
|
2
2
|
import { User } from '@genesislcap/foundation-user';
|
3
|
-
import { JSONSerializer, UUID } from '@genesislcap/foundation-utils';
|
3
|
+
import { GENESIS_SOCKET_URL, JSONSerializer, UUID } from '@genesislcap/foundation-utils';
|
4
4
|
import { DOM, observable } from '@microsoft/fast-element';
|
5
5
|
import { DI } from '@microsoft/fast-foundation';
|
6
6
|
import { Observable, of, Subject, Subscription, takeUntil, throwError } from 'rxjs';
|
@@ -8,6 +8,7 @@ import { filter, mergeMap, switchMap, takeWhile } from 'rxjs/operators';
|
|
8
8
|
import { WebSocketSubject } from 'rxjs/webSocket';
|
9
9
|
import { Session } from '../session';
|
10
10
|
import { logger } from '../utils';
|
11
|
+
import { ConnectConfig } from './connect.types';
|
11
12
|
import { EventMessageType, MessageBuilder, MessageType, } from './message';
|
12
13
|
import { exponentialScheduler, linearScheduler, MAX_RECONNECT_ATTEMPTS, retryInterval, SocketReconnectStrategy, } from './reconnectStrategy';
|
13
14
|
import { SocketStatus } from './socket.status';
|
@@ -111,17 +112,22 @@ let DefaultSocket = class DefaultSocket {
|
|
111
112
|
set hasValidSession(value) {
|
112
113
|
logger.deprecated('set hasValidSession', 'Please refrain from calling this API as this state is managed internally.', '15.0.0');
|
113
114
|
}
|
115
|
+
get host() {
|
116
|
+
var _a;
|
117
|
+
return (_a = this.url) !== null && _a !== void 0 ? _a : GENESIS_SOCKET_URL;
|
118
|
+
}
|
114
119
|
constructor(messageBuilder, session, serializer, uuid, status,
|
115
120
|
/**
|
116
121
|
* Temp putting the user in place to bridge the hasValidSession logic.
|
117
122
|
*/
|
118
|
-
user) {
|
123
|
+
user, config) {
|
119
124
|
this.messageBuilder = messageBuilder;
|
120
125
|
this.session = session;
|
121
126
|
this.serializer = serializer;
|
122
127
|
this.uuid = uuid;
|
123
128
|
this.status = status;
|
124
129
|
this.user = user;
|
130
|
+
this.config = config;
|
125
131
|
this.defaultInterval = 10000;
|
126
132
|
this.secondsMultiplier = 1000;
|
127
133
|
this.heartbeatIsEnabled = true;
|
@@ -136,10 +142,16 @@ let DefaultSocket = class DefaultSocket {
|
|
136
142
|
var _a, _b;
|
137
143
|
return (_b = (_a = this.connectOptions) === null || _a === void 0 ? void 0 : _a.enableMessageLogging) !== null && _b !== void 0 ? _b : false;
|
138
144
|
}
|
139
|
-
connect(host, connectOptions, reconnectOptions) {
|
145
|
+
connect(host = GENESIS_SOCKET_URL, connectOptions, reconnectOptions) {
|
146
|
+
var _a;
|
140
147
|
this.url = host;
|
141
|
-
this.connectOptions = connectOptions;
|
142
|
-
this.reconnectOptions = reconnectOptions;
|
148
|
+
this.connectOptions = connectOptions !== null && connectOptions !== void 0 ? connectOptions : this.config.connect;
|
149
|
+
this.reconnectOptions = reconnectOptions !== null && reconnectOptions !== void 0 ? reconnectOptions : this.config.reconnect;
|
150
|
+
if (!((_a = this.config.isWebSocketExpression) === null || _a === void 0 ? void 0 : _a.test(this.host))) {
|
151
|
+
logger.error(`Specified host (${this.host}) is not valid WebSocket url. Connection will not proceed.`);
|
152
|
+
logger.warn(`Make sure the host url starts with wss:// or ws://`);
|
153
|
+
return;
|
154
|
+
}
|
143
155
|
return new Promise((resolve) => {
|
144
156
|
var _a, _b, _c, _d;
|
145
157
|
logger.info(`${this.isReconnecting ? 'Reconnecting' : 'Connecting'} to ${this.url}`);
|
@@ -493,7 +505,8 @@ DefaultSocket = __decorate([
|
|
493
505
|
__param(2, JSONSerializer),
|
494
506
|
__param(3, UUID),
|
495
507
|
__param(4, SocketStatus),
|
496
|
-
__param(5, User)
|
508
|
+
__param(5, User),
|
509
|
+
__param(6, ConnectConfig)
|
497
510
|
], DefaultSocket);
|
498
511
|
export { DefaultSocket };
|
499
512
|
/**
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { DI } from '@microsoft/fast-foundation';
|
2
|
+
import { criteriaFiltersToFields } from './criteriaFiltersToFields';
|
3
|
+
import { dataServerResultFilter } from './dataServerResultFilter';
|
4
|
+
/**
|
5
|
+
* Default values for a DatasourceConfig
|
6
|
+
* @public
|
7
|
+
*/
|
8
|
+
export class DatasourceDefaults {
|
9
|
+
}
|
10
|
+
DatasourceDefaults.MAX_ROWS_250 = 250;
|
11
|
+
DatasourceDefaults.MAX_VIEW_1000 = 1000;
|
12
|
+
DatasourceDefaults.REQ_REP_POLLING_INTERVAL_MS = 10000;
|
13
|
+
DatasourceDefaults.DATASERVER_ROW_ID = 'ROW_REF';
|
14
|
+
DatasourceDefaults.REQUEST_SERVER_ROW_ID = 'RECORD_ID';
|
15
|
+
/**
|
16
|
+
* Default DatasourceConfig DI implementation.
|
17
|
+
* @public
|
18
|
+
*/
|
19
|
+
export const defaultDatasourceConfig = {
|
20
|
+
options: {
|
21
|
+
criteria: '',
|
22
|
+
isSnapshot: false,
|
23
|
+
maxRows: DatasourceDefaults.MAX_ROWS_250,
|
24
|
+
maxView: DatasourceDefaults.MAX_VIEW_1000,
|
25
|
+
pollingInterval: DatasourceDefaults.REQ_REP_POLLING_INTERVAL_MS,
|
26
|
+
movingView: false,
|
27
|
+
orderBy: '',
|
28
|
+
resourceName: '',
|
29
|
+
reverse: false,
|
30
|
+
},
|
31
|
+
criteriaToFields: criteriaFiltersToFields,
|
32
|
+
dataServerResultFilter: dataServerResultFilter,
|
33
|
+
};
|
34
|
+
/**
|
35
|
+
* DatasourceConfig DI key.
|
36
|
+
*
|
37
|
+
* @internal
|
38
|
+
* @privateRemarks
|
39
|
+
* Marked as internal to stop api-extractor becoming confused cross-linking tokens with the same name.
|
40
|
+
*/
|
41
|
+
export const DatasourceConfig = DI.createInterface((x) => x.instance(defaultDatasourceConfig));
|