@vuu-ui/vuu-data-remote 4.0.0-alpha.20 → 4.0.0-alpha.22

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.
@@ -1,39 +0,0 @@
1
- export type User = {
2
- userName: string;
3
- };
4
- export interface AuthProvider {
5
- login: (username?: string, password?: string) => Promise<{
6
- authorizations: string[];
7
- token: string;
8
- user: User;
9
- websocket?: boolean;
10
- }>;
11
- logout: () => void;
12
- }
13
- /**
14
- * The Vuu AuthProvider is a simple Demoware auth provider that
15
- * grabs username and pasdsword from. a simple login form and
16
- * exchanges these for a Vuu Token. Password is manipulated in
17
- * plain text, hence not suitable for real world usage.
18
- *
19
- * This AuthProvider is used by the login panel, which sets
20
- * user credentials in cookies.
21
- * It is then used by the application itself to retrieve the
22
- * credentials and login to vuu.
23
- */
24
- export declare class VuuAuthProvider implements AuthProvider {
25
- private authEndpoint;
26
- constructor(authEndpoint: string);
27
- login: (username?: string, password?: string) => Promise<{
28
- authorizations: string[];
29
- user: {
30
- userName: string;
31
- };
32
- token: string;
33
- }>;
34
- private getVuuTokenWithUsernameAndPassword;
35
- private clear;
36
- private redirectToLoginPage;
37
- private redirectToApplication;
38
- logout(): void;
39
- }
@@ -1,21 +0,0 @@
1
- import { ValueOf } from "@vuu-ui/vuu-utils";
2
- import { User, type AuthProvider } from "./VuuAuthProvider";
3
- export declare const VuuAuthTokenIssuePolicy: {
4
- readonly BearerToken: "bearer-token";
5
- readonly UsernamePassword: "username-password";
6
- };
7
- export type VuuAuthTokenIssuePolicy = ValueOf<typeof VuuAuthTokenIssuePolicy>;
8
- export interface VuuAuthenticatorConstructorOptions {
9
- authProvider: AuthProvider;
10
- authTokenIssuePolicy?: VuuAuthTokenIssuePolicy;
11
- websocketUrl: string;
12
- }
13
- export declare class VuuAuthenticator {
14
- private authProvider;
15
- private authTokenIssuePolicy;
16
- private websocketUrl;
17
- constructor({ authProvider, authTokenIssuePolicy, websocketUrl, }: VuuAuthenticatorConstructorOptions);
18
- private openWebsocketConnection;
19
- login: () => Promise<[User, string[]] | never>;
20
- logout: () => void;
21
- }
@@ -1,15 +0,0 @@
1
- import type { VuuUser } from "@vuu-ui/vuu-protocol-types";
2
- /**
3
- * The auth token returned from authn call encodes (Base64) a VuuUser
4
- * within the first part of the token.
5
- */
6
- export declare const parseVuuUserFromToken: (token: string) => VuuUser;
7
- export type AuthenticationResponse = {
8
- token: string;
9
- user: VuuUser;
10
- };
11
- export declare const getVuuAuthToken: (authUrl: string, token: string) => Promise<{
12
- authorizations: string[];
13
- token: string;
14
- }>;
15
- export declare const authenticate: (username: string, password: string, authUrl?: string) => Promise<AuthenticationResponse>;
@@ -1,36 +0,0 @@
1
- import { ConnectOptions, DataSourceCallbackMessage, ServerAPI } from "@vuu-ui/vuu-data-types";
2
- import { EventEmitter } from "@vuu-ui/vuu-utils";
3
- import { ConnectionStatus, WebSocketConnectionEvents } from "./WebSocketConnection";
4
- import { ConnectionQualityMetrics } from "@vuu-ui/vuu-data-types";
5
- export type PostMessageToClientCallback = (msg: DataSourceCallbackMessage) => void;
6
- export type ConnectionEvents = WebSocketConnectionEvents & {
7
- "connection-metrics": (message: ConnectionQualityMetrics) => void;
8
- };
9
- declare class ConnectionManager extends EventEmitter<ConnectionEvents> {
10
- #private;
11
- private constructor();
12
- static get instance(): ConnectionManager;
13
- get connectionStatus(): ConnectionStatus;
14
- get connected(): boolean;
15
- /**
16
- * Open a connection to the VuuServer. This method opens the websocket connection
17
- * and logs in. It can be called from whichever client code has access to the auth
18
- * token (eg. the login page, or just a hardcoded login script in a sample).
19
- * This will unblock any DataSources which may have already tried to subscribe to data,
20
- * but lacked access to the auth token.
21
- *
22
- * @param serverUrl
23
- * @param token
24
- */
25
- connect(options: ConnectOptions, throwOnRejected?: boolean): Promise<"connected" | "connection-failed" | "reconnected" | "rejected">;
26
- disableActiveSubscriptions(): void;
27
- enableActiveSubscriptions(): void;
28
- private handleMessageFromWorker;
29
- get serverAPI(): Promise<ServerAPI>;
30
- private connectedServerAPI;
31
- private asyncRequest;
32
- disconnect(): Promise<"disconnected" | "rejected">;
33
- destroy(): void;
34
- }
35
- declare const _default: ConnectionManager;
36
- export default _default;
@@ -1,9 +0,0 @@
1
- import { ConnectOptions, VuuUIMessageIn, VuuUIMessageOut, WithRequestId } from "@vuu-ui/vuu-data-types";
2
- import { SelectRequest, VuuCreateVisualLink, VuuRemoveVisualLink, VuuRpcMenuRequest, VuuRpcServiceRequest } from "@vuu-ui/vuu-protocol-types";
3
- export declare class DedicatedWorker {
4
- #private;
5
- constructor(onMessage: (msg: VuuUIMessageIn) => void);
6
- connect(options: ConnectOptions): Promise<"connected" | "reconnected" | "rejected">;
7
- send(message: VuuUIMessageOut | WithRequestId<VuuCreateVisualLink | VuuRemoveVisualLink | VuuRpcServiceRequest | VuuRpcMenuRequest | SelectRequest>): Promise<void>;
8
- terminate(): Promise<void>;
9
- }
@@ -1,28 +0,0 @@
1
- import { VuuAuthenticator } from "./VuuAuthenticator";
2
- interface RetryOptions {
3
- interval: number;
4
- next: () => void;
5
- remaining: number;
6
- }
7
- declare class RetryOptionsImpl implements RetryOptions {
8
- private retryIntervals;
9
- private ind;
10
- constructor(retryIntervals: number[]);
11
- next(): void;
12
- get remaining(): number;
13
- get interval(): number;
14
- }
15
- export declare function RetryOptions(retryIntervals: number[]): RetryOptionsImpl;
16
- export declare class RetryGenerator {
17
- private vuuAuth;
18
- private options;
19
- constructor(vuuAuth: VuuAuthenticator, options: RetryOptions);
20
- [Symbol.asyncIterator](): AsyncGenerator<"connected" | "connection-failed">;
21
- }
22
- export declare class LostConnectionHandler {
23
- private vuuAuth;
24
- private retryIntervals;
25
- constructor(vuuAuth: VuuAuthenticator, retryIntervals?: number[]);
26
- reconnect(): Promise<"connected" | "connection-failed">;
27
- }
28
- export {};
@@ -1,39 +0,0 @@
1
- export type User = {
2
- userName: string;
3
- };
4
- export interface AuthProvider {
5
- login: (username?: string, password?: string) => Promise<{
6
- authorizations: string[];
7
- token: string;
8
- user: User;
9
- websocket?: boolean;
10
- }>;
11
- logout: () => void;
12
- }
13
- /**
14
- * The Vuu AuthProvider is a simple Demoware auth provider that
15
- * grabs username and pasdsword from. a simple login form and
16
- * exchanges these for a Vuu Token. Password is manipulated in
17
- * plain text, hence not suitable for real world usage.
18
- *
19
- * This AuthProvider is used by the login panel, which sets
20
- * user credentials in cookies.
21
- * It is then used by the application itself to retrieve the
22
- * credentials and login to vuu.
23
- */
24
- export declare class VuuAuthProvider implements AuthProvider {
25
- private authEndpoint;
26
- constructor(authEndpoint: string);
27
- login: (username?: string, password?: string) => Promise<{
28
- authorizations: string[];
29
- user: {
30
- userName: string;
31
- };
32
- token: string;
33
- }>;
34
- private getVuuTokenWithUsernameAndPassword;
35
- private clear;
36
- private redirectToLoginPage;
37
- private redirectToApplication;
38
- logout(): void;
39
- }
@@ -1,21 +0,0 @@
1
- import { ValueOf } from "@vuu-ui/vuu-utils";
2
- import { User, type AuthProvider } from "./VuuAuthProvider";
3
- export declare const VuuAuthTokenIssuePolicy: {
4
- readonly BearerToken: "bearer-token";
5
- readonly UsernamePassword: "username-password";
6
- };
7
- export type VuuAuthTokenIssuePolicy = ValueOf<typeof VuuAuthTokenIssuePolicy>;
8
- export interface VuuAuthenticatorConstructorOptions {
9
- authProvider: AuthProvider;
10
- authTokenIssuePolicy?: VuuAuthTokenIssuePolicy;
11
- websocketUrl: string;
12
- }
13
- export declare class VuuAuthenticator {
14
- private authProvider;
15
- private authTokenIssuePolicy;
16
- private websocketUrl;
17
- constructor({ authProvider, authTokenIssuePolicy, websocketUrl, }: VuuAuthenticatorConstructorOptions);
18
- private openWebsocketConnection;
19
- login: () => Promise<[User, string[]] | never>;
20
- logout: () => void;
21
- }
@@ -1,74 +0,0 @@
1
- import type { CopyOption, DataSource, DataSourceBase, SessionType, DataSourceCallbackMessage, DataSourceConstructorProps, DataSourceStatus, DataSourceSubscribeCallback, DataSourceSubscribeProps, DeleteRowMode, OptimizeStrategy, SessionDataSourceOverrides, TableSchema, WithBaseFilter, WithFullConfig } from "@vuu-ui/vuu-data-types";
2
- import type { MenuRpcResponse } from "@vuu-ui/vuu-data-types";
3
- import type { LinkDescriptorWithLabel, RpcResult, RpcResultError, RpcResultSuccess, SelectRequest, VuuGroupBy, VuuMenu, VuuRange, VuuRowDataItemType, VuuRpcMenuRequest, VuuRpcResponse, VuuRpcServiceRequest, VuuTable } from "@vuu-ui/vuu-protocol-types";
4
- import { BaseDataSource, Range } from "@vuu-ui/vuu-utils";
5
- type RangeRequest = (range: VuuRange) => void;
6
- export declare class VuuDataSource extends BaseDataSource implements DataSourceBase {
7
- #private;
8
- private bufferSize;
9
- private server;
10
- rangeRequest: RangeRequest;
11
- readonly isRemote = true;
12
- table: VuuTable;
13
- constructor({ session, sessionTableMessageColumn, ...props }: DataSourceConstructorProps);
14
- subscribe(subscribeProps: DataSourceSubscribeProps, callback: DataSourceSubscribeCallback): Promise<void>;
15
- handleMessageFromServer: (message: DataSourceCallbackMessage) => void;
16
- handleSessionMessageFromServer: (msg: DataSourceCallbackMessage) => void;
17
- unsubscribe(): void;
18
- suspend(escalateToDisable?: boolean, escalateDelay?: number | undefined): void;
19
- /**
20
- * Tell the server we wish to resume receiving messages. Server will send a
21
- * snapshot of rows currently in cache. This can be used to update with
22
- * latest data, e.g after an edit session during which we might have ignored
23
- * some updates.
24
- */
25
- private sendResumeMessage;
26
- isSessionDataSourceOf(dataSource: DataSource): boolean;
27
- resume(callback?: DataSourceSubscribeCallback): void;
28
- freeze(): void;
29
- unfreeze(): void;
30
- disable(): void;
31
- enable(callback?: DataSourceSubscribeCallback): void;
32
- select(selectRequest: Omit<SelectRequest, "vpId">): Promise<void>;
33
- openTreeNode(keyOrIndex: string | number): void;
34
- closeTreeNode(keyOrIndex: string | number): void;
35
- get columns(): string[];
36
- set columns(columns: string[]);
37
- get tableSchema(): TableSchema | undefined;
38
- set tableSchema(tableSchema: TableSchema | undefined);
39
- get links(): LinkDescriptorWithLabel[] | undefined;
40
- get maxRangeEnd(): number;
41
- get menu(): VuuMenu | undefined;
42
- get status(): DataSourceStatus;
43
- get optimize(): OptimizeStrategy;
44
- set optimize(optimize: OptimizeStrategy);
45
- private revertDebounce;
46
- get selectedRowsCount(): number;
47
- private rawRangeRequest;
48
- private debounceRangeRequest;
49
- private throttleRangeRequest;
50
- get config(): WithBaseFilter<WithFullConfig>;
51
- set config(config: WithBaseFilter<WithFullConfig>);
52
- set impendingConfig(config: WithBaseFilter<WithFullConfig>);
53
- get groupBy(): VuuGroupBy;
54
- set groupBy(groupBy: VuuGroupBy);
55
- get range(): Range;
56
- set range(range: Range);
57
- get title(): string;
58
- set title(title: string);
59
- get visualLink(): LinkDescriptorWithLabel | undefined;
60
- set visualLink(visualLink: LinkDescriptorWithLabel | undefined);
61
- remoteProcedureCall<T extends VuuRpcResponse = VuuRpcResponse>(): Promise<T>;
62
- createSessionDataSource(copyOption: CopyOption, sessionType?: SessionType, overrides?: SessionDataSourceOverrides): Promise<VuuDataSource | undefined>;
63
- beginEditSession(): Promise<VuuDataSource>;
64
- editCell(key: string, column: string, data: VuuRowDataItemType): Promise<RpcResultError | RpcResultSuccess>;
65
- endEditSession(saveChanges?: boolean, force?: boolean): Promise<void>;
66
- rpcRequest(rpcRequest: Omit<VuuRpcServiceRequest, "context">): Promise<RpcResultError | RpcResultSuccess>;
67
- menuRpcCall(rpcRequest: Omit<VuuRpcMenuRequest, "vpId">): Promise<MenuRpcResponse<any> | undefined>;
68
- insertRow(): Promise<string>;
69
- deleteRow(key: string, mode?: DeleteRowMode): Promise<true | string>;
70
- deleteSelectedRows(mode?: DeleteRowMode): Promise<RpcResultSuccess | RpcResultError>;
71
- addRow(rowData?: Record<string, VuuRowDataItemType>): Promise<RpcResult>;
72
- undoRowChange(key: string): Promise<RpcResultSuccess | RpcResultError>;
73
- }
74
- export {};
@@ -1,54 +0,0 @@
1
- import { WebSocketProtocol } from "@vuu-ui/vuu-data-types";
2
- import { InvalidSessionReason, InvalidTokenReason, LoginErrorMessage, VuuClientMessage, VuuServerMessage } from "@vuu-ui/vuu-protocol-types";
3
- import { EventEmitter } from "@vuu-ui/vuu-utils";
4
- export type ConnectionPhase = "initial-connection" | "post-disconnect-reconnection";
5
- export type ConnectingStatus = "connecting" | "reconnecting";
6
- export type ConnectedStatus = "connected" | "reconnected";
7
- export type ConnectionStatus = ConnectingStatus | ConnectedStatus | "closed" | "websocket-open" | "disconnected" | "failed" | "inactive";
8
- export declare const isInvalidTokenReason: (text: string) => text is InvalidTokenReason;
9
- export declare const isInvalidSessionReason: (text: string) => text is InvalidSessionReason;
10
- export declare const isWebSocketConnectionStatus: (msg: unknown) => msg is ConnectionStatus;
11
- export declare const isConnected: (status: ConnectionStatus) => status is ConnectedStatus;
12
- export type LoginRejectedMessage = {
13
- type: "LOGIN_REJECTED";
14
- reason: LoginErrorMessage;
15
- };
16
- export declare const isLoginRejectedMessage: (message: object) => message is LoginRejectedMessage;
17
- export type VuuServerMessageCallback = (msg: VuuServerMessage | LoginRejectedMessage) => void;
18
- export type WebSocketConnectionConfig = {
19
- url: string;
20
- protocols: WebSocketProtocol;
21
- callback: VuuServerMessageCallback;
22
- connectionTimeout?: number;
23
- };
24
- export type WebSocketConnectionCloseReason = LoginErrorMessage | "failure" | "shutdown";
25
- export type WebSocketConnectionEvents = {
26
- "connection-status": (status: ConnectionStatus) => void;
27
- };
28
- export declare class WebSocketConnection extends EventEmitter<WebSocketConnectionEvents> {
29
- #private;
30
- constructor({ callback, connectionTimeout, protocols, url, }: WebSocketConnectionConfig);
31
- get connectionTimeout(): number;
32
- get protocols(): WebSocketProtocol;
33
- get isClosed(): boolean;
34
- get isDisconnected(): boolean;
35
- get connectionPhase(): ConnectionPhase;
36
- get connectionStatus(): ConnectionStatus;
37
- private set connectionStatus(value);
38
- get confirmedOpen(): boolean;
39
- /**
40
- * We are 'confirmedOpen' when we see the first message transmitted
41
- * from the server. This ensures that even if we have one or more
42
- * proxies in our route to the endPoint, all connections have been
43
- * opened successfully.
44
- * First time in here (on our initial successful connection) we switch
45
- * from 'connect' phase to 'reconnect' phase. We may have different
46
- * retry configurations for these two phases.
47
- */
48
- private set confirmedOpen(value);
49
- get url(): string;
50
- openWebSocket(): Promise<unknown>;
51
- private receive;
52
- send: (msg: VuuClientMessage) => void;
53
- close(reason?: WebSocketConnectionCloseReason): void;
54
- }
@@ -1,15 +0,0 @@
1
- import type { VuuUser } from "@vuu-ui/vuu-protocol-types";
2
- /**
3
- * The auth token returned from authn call encodes (Base64) a VuuUser
4
- * within the first part of the token.
5
- */
6
- export declare const parseVuuUserFromToken: (token: string) => VuuUser;
7
- export type AuthenticationResponse = {
8
- token: string;
9
- user: VuuUser;
10
- };
11
- export declare const getVuuAuthToken: (authUrl: string, token: string) => Promise<{
12
- authorizations: string[];
13
- token: string;
14
- }>;
15
- export declare const authenticate: (username: string, password: string, authUrl?: string) => Promise<AuthenticationResponse>;
@@ -1,41 +0,0 @@
1
- export declare const connectionId: {
2
- readonly nextValue: number;
3
- };
4
- export declare const msgType: {
5
- connect: string;
6
- connectionStatus: string;
7
- getFilterData: string;
8
- rowData: string;
9
- rowSet: string;
10
- select: string;
11
- selectAll: string;
12
- selectNone: string;
13
- selected: string;
14
- snapshot: string;
15
- update: string;
16
- createLink: string;
17
- disable: string;
18
- enable: string;
19
- suspend: string;
20
- resume: string;
21
- addSubscription: string;
22
- closeTreeNode: string;
23
- columnList: string;
24
- data: string;
25
- openTreeNode: string;
26
- aggregate: string;
27
- filter: string;
28
- filterQuery: string;
29
- filterData: string;
30
- getSearchData: string;
31
- groupBy: string;
32
- modifySubscription: string;
33
- searchData: string;
34
- setGroupState: string;
35
- size: string;
36
- sort: string;
37
- subscribed: string;
38
- tableList: string;
39
- unsubscribe: string;
40
- viewRangeChanged: string;
41
- };
@@ -1,6 +0,0 @@
1
- import type { DataSourceCallbackMessage, DataSourceConfig, DataSourceConfigMessage, DataSourceDataSizeMessage, WithRequestId } from "@vuu-ui/vuu-data-types";
2
- import type { SelectSuccessWithRowCount } from "@vuu-ui/vuu-protocol-types";
3
- export declare const isSizeOnly: (message: DataSourceCallbackMessage) => message is DataSourceDataSizeMessage;
4
- export declare const toDataSourceConfig: (message: DataSourceConfigMessage) => DataSourceConfig;
5
- export declare const shouldMessageBeRoutedToDataSource: (message: unknown) => message is Exclude<DataSourceCallbackMessage, WithRequestId<SelectSuccessWithRowCount>>;
6
- export declare const isDataSourceConfigMessage: (message: DataSourceCallbackMessage) => message is DataSourceConfigMessage;
@@ -1,11 +0,0 @@
1
- export { authenticate, getVuuAuthToken, parseVuuUserFromToken, } from "./authenticate";
2
- export * from "./ConnectionManager";
3
- export { default as ConnectionManager } from "./ConnectionManager";
4
- export * from "./constants";
5
- export * from "./data-source";
6
- export { LostConnectionHandler, RetryOptions } from "./LostConnectionHandler";
7
- export * from "./message-utils";
8
- export { VuuAuthenticator, VuuAuthTokenIssuePolicy } from "./VuuAuthenticator";
9
- export { VuuAuthProvider, type AuthProvider } from "./VuuAuthProvider";
10
- export * from "./VuuDataSource";
11
- export { isConnected, type ConnectionStatus } from "./WebSocketConnection";