altair-graphql-core 4.2.0 → 4.4.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/build/config.d.ts +42 -30
- package/build/config.js +11 -16
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -4
- package/build/plugin/base.d.ts +1 -0
- package/build/plugin/base.js +1 -5
- package/build/plugin/context/context.interface.d.ts +3 -2
- package/build/plugin/context/context.interface.js +1 -2
- package/build/plugin/event/event.interfaces.d.ts +1 -0
- package/build/plugin/event/event.interfaces.js +1 -2
- package/build/plugin/panel.d.ts +1 -0
- package/build/plugin/panel.js +5 -9
- package/build/plugin/plugin.interfaces.d.ts +1 -0
- package/build/plugin/plugin.interfaces.js +5 -8
- package/build/plugin/ui-action.d.ts +1 -0
- package/build/plugin/ui-action.js +5 -9
- package/build/subscriptions/index.d.ts +1 -0
- package/build/subscriptions/index.js +9 -12
- package/build/subscriptions/providers/action-cable.d.ts +1 -0
- package/build/subscriptions/providers/action-cable.js +6 -13
- package/build/subscriptions/providers/app-sync.d.ts +1 -0
- package/build/subscriptions/providers/app-sync.js +14 -18
- package/build/subscriptions/providers/graphql-ws.d.ts +1 -0
- package/build/subscriptions/providers/graphql-ws.js +6 -10
- package/build/subscriptions/providers/ws.d.ts +1 -0
- package/build/subscriptions/providers/ws.js +6 -10
- package/build/subscriptions/subscription-provider.d.ts +1 -0
- package/build/subscriptions/subscription-provider.js +1 -5
- package/build/theme/defaults/dark.d.ts +1 -0
- package/build/theme/defaults/dark.js +16 -18
- package/build/theme/defaults/dracula.d.ts +1 -0
- package/build/theme/defaults/dracula.js +1 -3
- package/build/theme/defaults/light.d.ts +1 -0
- package/build/theme/defaults/light.js +1 -3
- package/build/theme/index.d.ts +1 -0
- package/build/theme/index.js +7 -23
- package/build/theme/theme.d.ts +1 -0
- package/build/theme/theme.js +31 -37
- package/build/types/shared.d.ts +1 -0
- package/build/types/shared.js +1 -2
- package/build/types/state/account.interfaces.d.ts +8 -0
- package/build/types/state/account.interfaces.js +1 -0
- package/build/types/state/collection.interfaces.d.ts +15 -4
- package/build/types/state/collection.interfaces.js +1 -2
- package/build/types/state/dialog.interfaces.d.ts +1 -0
- package/build/types/state/dialog.interfaces.js +1 -2
- package/build/types/state/docs.interfaces.d.ts +1 -0
- package/build/types/state/docs.interfaces.js +1 -2
- package/build/types/state/donation.interfaces.d.ts +1 -0
- package/build/types/state/donation.interfaces.js +1 -2
- package/build/types/state/environments.interfaces.d.ts +1 -0
- package/build/types/state/environments.interfaces.js +1 -2
- package/build/types/state/gql-schema.interfaces.d.ts +1 -0
- package/build/types/state/gql-schema.interfaces.js +1 -2
- package/build/types/state/header.interfaces.d.ts +1 -0
- package/build/types/state/header.interfaces.js +1 -2
- package/build/types/state/history.interfaces.d.ts +1 -0
- package/build/types/state/history.interfaces.js +1 -2
- package/build/types/state/layout.interfaces.d.ts +1 -0
- package/build/types/state/layout.interfaces.js +1 -2
- package/build/types/state/local.interfaces.d.ts +1 -0
- package/build/types/state/local.interfaces.js +1 -2
- package/build/types/state/per-window.interfaces.d.ts +1 -0
- package/build/types/state/per-window.interfaces.js +1 -2
- package/build/types/state/postrequest.interfaces.d.ts +1 -0
- package/build/types/state/postrequest.interfaces.js +1 -2
- package/build/types/state/prerequest.interfaces.d.ts +1 -0
- package/build/types/state/prerequest.interfaces.js +1 -2
- package/build/types/state/query.interfaces.d.ts +1 -0
- package/build/types/state/query.interfaces.js +1 -4
- package/build/types/state/settings.interfaces.d.ts +5 -0
- package/build/types/state/settings.interfaces.js +2 -4
- package/build/types/state/state.interfaces.d.ts +3 -0
- package/build/types/state/state.interfaces.js +1 -2
- package/build/types/state/stream.interfaces.d.ts +1 -0
- package/build/types/state/stream.interfaces.js +1 -2
- package/build/types/state/variable.interfaces.d.ts +1 -0
- package/build/types/state/variable.interfaces.js +1 -2
- package/build/types/state/window.interfaces.d.ts +4 -1
- package/build/types/state/window.interfaces.js +1 -2
- package/build/types/state/windows-meta.interfaces.d.ts +2 -0
- package/build/types/state/windows-meta.interfaces.js +1 -2
- package/build/utils/is_electron.d.ts +1 -0
- package/build/utils/is_electron.js +1 -3
- package/build/utils/logger.d.ts +1 -0
- package/build/utils/logger.js +7 -13
- package/package.json +2 -2
- package/tsconfig.json +3 -1
package/build/config.d.ts
CHANGED
|
@@ -3,39 +3,59 @@ import { IDictionary } from './types/shared';
|
|
|
3
3
|
import { IInitialEnvironments } from './types/state/environments.interfaces';
|
|
4
4
|
import { HttpVerb } from './types/state/query.interfaces';
|
|
5
5
|
import { SettingsState } from './types/state/settings.interfaces';
|
|
6
|
-
export interface
|
|
6
|
+
export interface AltairWindowOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Initial name of the window
|
|
9
|
+
*/
|
|
10
|
+
initialName?: string;
|
|
7
11
|
/**
|
|
8
12
|
* URL to set as the server endpoint
|
|
9
13
|
*/
|
|
10
14
|
endpointURL?: string;
|
|
11
15
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
* URL to set as the subscription endpoint
|
|
17
|
+
*/
|
|
14
18
|
subscriptionsEndpoint?: string;
|
|
15
19
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
* Initial query to be added
|
|
21
|
+
*/
|
|
18
22
|
initialQuery?: string;
|
|
19
23
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
* Initial variables to be added
|
|
25
|
+
*/
|
|
22
26
|
initialVariables?: string;
|
|
23
27
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
* Initial pre-request script to be added
|
|
29
|
+
*/
|
|
26
30
|
initialPreRequestScript?: string;
|
|
27
31
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
* Initial post-request script to be added
|
|
33
|
+
*/
|
|
30
34
|
initialPostRequestScript?: string;
|
|
31
35
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
* Initial headers object to be added
|
|
37
|
+
* @example
|
|
38
|
+
* {
|
|
39
|
+
* 'X-GraphQL-Token': 'asd7-237s-2bdk-nsdk4'
|
|
40
|
+
* }
|
|
41
|
+
*/
|
|
38
42
|
initialHeaders?: IDictionary;
|
|
43
|
+
/**
|
|
44
|
+
* Initial subscriptions provider
|
|
45
|
+
*
|
|
46
|
+
* @default "websocket"
|
|
47
|
+
*/
|
|
48
|
+
initialSubscriptionsProvider?: SubscriptionProviderIds;
|
|
49
|
+
/**
|
|
50
|
+
* Initial subscriptions connection params
|
|
51
|
+
*/
|
|
52
|
+
initialSubscriptionsPayload?: IDictionary;
|
|
53
|
+
/**
|
|
54
|
+
* HTTP method to use for making requests
|
|
55
|
+
*/
|
|
56
|
+
initialHttpMethod?: HttpVerb;
|
|
57
|
+
}
|
|
58
|
+
export interface AltairConfigOptions extends AltairWindowOptions {
|
|
39
59
|
/**
|
|
40
60
|
* Initial Environments to be added
|
|
41
61
|
* @example
|
|
@@ -64,16 +84,6 @@ export interface AltairConfigOptions {
|
|
|
64
84
|
* Initial app settings to use
|
|
65
85
|
*/
|
|
66
86
|
initialSettings?: Partial<SettingsState>;
|
|
67
|
-
/**
|
|
68
|
-
* Initial subscriptions provider
|
|
69
|
-
*
|
|
70
|
-
* @default "websocket"
|
|
71
|
-
*/
|
|
72
|
-
initialSubscriptionsProvider?: SubscriptionProviderIds;
|
|
73
|
-
/**
|
|
74
|
-
* Initial subscriptions connection params
|
|
75
|
-
*/
|
|
76
|
-
initialSubscriptionsPayload?: IDictionary;
|
|
77
87
|
/**
|
|
78
88
|
* Indicates if the state should be preserved for subsequent app loads
|
|
79
89
|
*
|
|
@@ -81,9 +91,9 @@ export interface AltairConfigOptions {
|
|
|
81
91
|
*/
|
|
82
92
|
preserveState?: boolean;
|
|
83
93
|
/**
|
|
84
|
-
*
|
|
94
|
+
* List of options for windows to be loaded
|
|
85
95
|
*/
|
|
86
|
-
|
|
96
|
+
initialWindows?: AltairWindowOptions[];
|
|
87
97
|
}
|
|
88
98
|
export declare class AltairConfig {
|
|
89
99
|
donation: {
|
|
@@ -133,8 +143,10 @@ export declare class AltairConfig {
|
|
|
133
143
|
initialSubscriptionsPayload: IDictionary<any>;
|
|
134
144
|
initialHttpMethod: "POST" | "GET" | "PUT" | "DELETE";
|
|
135
145
|
preserveState: boolean;
|
|
146
|
+
windows: AltairWindowOptions[];
|
|
136
147
|
};
|
|
137
|
-
constructor({ endpointURL, subscriptionsEndpoint, initialQuery, initialHeaders, initialEnvironments, initialVariables, initialPreRequestScript, initialPostRequestScript, instanceStorageNamespace, initialSettings, initialSubscriptionsProvider, initialSubscriptionsPayload, initialHttpMethod, preserveState, }?: AltairConfigOptions);
|
|
148
|
+
constructor({ endpointURL, subscriptionsEndpoint, initialQuery, initialHeaders, initialEnvironments, initialVariables, initialPreRequestScript, initialPostRequestScript, instanceStorageNamespace, initialSettings, initialSubscriptionsProvider, initialSubscriptionsPayload, initialHttpMethod, preserveState, initialWindows, }?: AltairConfigOptions);
|
|
138
149
|
}
|
|
139
150
|
export declare const setAltairConfig: (_config: AltairConfig) => void;
|
|
140
151
|
export declare const getAltairConfig: () => AltairConfig;
|
|
152
|
+
//# sourceMappingURL=config.d.ts.map
|
package/build/config.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getAltairConfig = exports.setAltairConfig = exports.AltairConfig = void 0;
|
|
7
|
-
const subscriptions_1 = require("./subscriptions");
|
|
8
|
-
const is_electron_1 = __importDefault(require("./utils/is_electron"));
|
|
1
|
+
import { WEBSOCKET_PROVIDER_ID } from './subscriptions';
|
|
2
|
+
import isElectron from './utils/is_electron';
|
|
9
3
|
const isTranslateMode = window.__ALTAIR_TRANSLATE__;
|
|
10
|
-
class AltairConfig {
|
|
11
|
-
constructor({ endpointURL, subscriptionsEndpoint, initialQuery, initialHeaders, initialEnvironments, initialVariables, initialPreRequestScript, initialPostRequestScript = '', instanceStorageNamespace, initialSettings, initialSubscriptionsProvider =
|
|
4
|
+
export class AltairConfig {
|
|
5
|
+
constructor({ endpointURL, subscriptionsEndpoint, initialQuery, initialHeaders, initialEnvironments, initialVariables, initialPreRequestScript, initialPostRequestScript = '', instanceStorageNamespace, initialSettings, initialSubscriptionsProvider = WEBSOCKET_PROVIDER_ID, initialSubscriptionsPayload = {}, initialHttpMethod = 'POST', preserveState = true, initialWindows = [], } = {}) {
|
|
12
6
|
this.donation = {
|
|
13
7
|
url: 'https://opencollective.com/altair/donate',
|
|
14
8
|
action_count_threshold: 50
|
|
@@ -16,7 +10,7 @@ class AltairConfig {
|
|
|
16
10
|
this.ga = 'UA-41432833-6';
|
|
17
11
|
this.add_query_depth_limit = 3;
|
|
18
12
|
this.tab_size = 2;
|
|
19
|
-
this.max_windows =
|
|
13
|
+
this.max_windows = isElectron ? 50 : 15;
|
|
20
14
|
this.default_language = isTranslateMode ? 'ach-UG' : 'en-US';
|
|
21
15
|
this.languages = {
|
|
22
16
|
'en-US': 'English',
|
|
@@ -36,7 +30,7 @@ class AltairConfig {
|
|
|
36
30
|
'ro-RO': 'Romanian',
|
|
37
31
|
'vi-VN': 'Vietnamese',
|
|
38
32
|
};
|
|
39
|
-
this.query_history_depth =
|
|
33
|
+
this.query_history_depth = isElectron ? 100 : 15;
|
|
40
34
|
this.defaultTheme = 'system';
|
|
41
35
|
this.themes = ['light', 'dark', 'dracula', 'system'];
|
|
42
36
|
this.isTranslateMode = isTranslateMode;
|
|
@@ -57,6 +51,7 @@ class AltairConfig {
|
|
|
57
51
|
initialSubscriptionsPayload: {},
|
|
58
52
|
initialHttpMethod: 'POST',
|
|
59
53
|
preserveState: true,
|
|
54
|
+
windows: [],
|
|
60
55
|
};
|
|
61
56
|
this.initialData.url = window.__ALTAIR_ENDPOINT_URL__ || endpointURL || '';
|
|
62
57
|
this.initialData.subscriptionsEndpoint = window.__ALTAIR_SUBSCRIPTIONS_ENDPOINT__ || subscriptionsEndpoint || '';
|
|
@@ -72,14 +67,14 @@ class AltairConfig {
|
|
|
72
67
|
this.initialData.initialSubscriptionsPayload = initialSubscriptionsPayload;
|
|
73
68
|
this.initialData.initialHttpMethod = initialHttpMethod;
|
|
74
69
|
this.initialData.preserveState = preserveState;
|
|
70
|
+
this.initialData.windows = initialWindows;
|
|
75
71
|
}
|
|
76
72
|
}
|
|
77
|
-
exports.AltairConfig = AltairConfig;
|
|
78
73
|
let config = new AltairConfig();
|
|
79
|
-
|
|
74
|
+
export const setAltairConfig = (_config) => {
|
|
80
75
|
config = _config;
|
|
81
76
|
};
|
|
82
|
-
|
|
77
|
+
export const getAltairConfig = () => {
|
|
83
78
|
return config;
|
|
84
79
|
};
|
|
85
|
-
window.getAltairConfig =
|
|
80
|
+
window.getAltairConfig = getAltairConfig;
|
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerPluginClass = void 0;
|
|
4
|
-
exports.registerPluginClass = (pluginClassName, pluginClass) => {
|
|
1
|
+
export const registerPluginClass = (pluginClassName, pluginClass) => {
|
|
5
2
|
window['AltairGraphQL'].plugins[pluginClassName] = pluginClass;
|
|
6
3
|
};
|
package/build/plugin/base.d.ts
CHANGED
package/build/plugin/base.js
CHANGED
|
@@ -31,8 +31,8 @@ export interface PluginContext {
|
|
|
31
31
|
* Since it is a method, the state can be generated when called.
|
|
32
32
|
* So we can ensure uniqueness of the state, as well as avoid passing values by references.
|
|
33
33
|
*/
|
|
34
|
-
getWindowState(windowId: string): Promise<PluginWindowState>;
|
|
35
|
-
getCurrentWindowState(): Promise<PluginWindowState>;
|
|
34
|
+
getWindowState(windowId: string): Promise<PluginWindowState | undefined>;
|
|
35
|
+
getCurrentWindowState(): Promise<PluginWindowState | undefined>;
|
|
36
36
|
/**
|
|
37
37
|
* panel has two locations: sidebar, header
|
|
38
38
|
*
|
|
@@ -75,3 +75,4 @@ export interface PluginContext {
|
|
|
75
75
|
export interface PluginContextGenerator {
|
|
76
76
|
createContext(pluginName: string, plugin: AltairPlugin): PluginContext;
|
|
77
77
|
}
|
|
78
|
+
//# sourceMappingURL=context.interface.d.ts.map
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -27,3 +27,4 @@ export interface PluginEventPayloadMap {
|
|
|
27
27
|
}
|
|
28
28
|
export declare type PluginEvent = keyof PluginEventPayloadMap;
|
|
29
29
|
export declare type PluginEventCallback<T extends PluginEvent> = (payload: PluginEventPayloadMap[T]) => void;
|
|
30
|
+
//# sourceMappingURL=event.interfaces.d.ts.map
|
package/build/plugin/panel.d.ts
CHANGED
package/build/plugin/panel.js
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.AltairPanel = exports.AltairPanelLocation = void 0;
|
|
4
|
-
const uuid_1 = require("uuid");
|
|
5
|
-
var AltairPanelLocation;
|
|
1
|
+
import { v4 as uuid } from 'uuid';
|
|
2
|
+
export var AltairPanelLocation;
|
|
6
3
|
(function (AltairPanelLocation) {
|
|
7
4
|
AltairPanelLocation["HEADER"] = "header";
|
|
8
5
|
AltairPanelLocation["SIDEBAR"] = "sidebar";
|
|
9
6
|
AltairPanelLocation["RESULT_PANE_BOTTOM"] = "result_pane_bottom";
|
|
10
|
-
})(AltairPanelLocation
|
|
7
|
+
})(AltairPanelLocation || (AltairPanelLocation = {}));
|
|
11
8
|
/**
|
|
12
9
|
* Used for dynamic panel elements. Can also be used for angular components in the future.
|
|
13
10
|
*/
|
|
14
|
-
class AltairPanel {
|
|
11
|
+
export class AltairPanel {
|
|
15
12
|
constructor(title, element, location) {
|
|
16
13
|
this.title = title;
|
|
17
14
|
this.element = element;
|
|
18
15
|
this.location = location;
|
|
19
|
-
this.id =
|
|
16
|
+
this.id = uuid();
|
|
20
17
|
this.isActive = false;
|
|
21
18
|
}
|
|
22
19
|
destroy() {
|
|
23
20
|
this.element = null;
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
|
-
exports.AltairPanel = AltairPanel;
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPlugin = exports.PluginType = exports.PluginSource = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Defines the repository of the plugin.
|
|
6
3
|
* Used to know where to get the plugin from.
|
|
7
4
|
*/
|
|
8
|
-
var PluginSource;
|
|
5
|
+
export var PluginSource;
|
|
9
6
|
(function (PluginSource) {
|
|
10
7
|
PluginSource["NPM"] = "npm";
|
|
11
8
|
PluginSource["GITHUB"] = "github";
|
|
12
9
|
PluginSource["URL"] = "url";
|
|
13
|
-
})(PluginSource
|
|
10
|
+
})(PluginSource || (PluginSource = {}));
|
|
14
11
|
/**
|
|
15
12
|
* Specifies the type of the plugin.
|
|
16
13
|
* Determines how the plugin would interact with Altair.
|
|
17
14
|
*/
|
|
18
|
-
var PluginType;
|
|
15
|
+
export var PluginType;
|
|
19
16
|
(function (PluginType) {
|
|
20
17
|
PluginType["HEADER"] = "header";
|
|
21
18
|
PluginType["SIDEBAR"] = "sidebar";
|
|
22
19
|
PluginType["ACTION_BUTTON"] = "action_button";
|
|
23
|
-
})(PluginType
|
|
24
|
-
|
|
20
|
+
})(PluginType || (PluginType = {}));
|
|
21
|
+
export const createPlugin = (name, manifest) => {
|
|
25
22
|
return {
|
|
26
23
|
name,
|
|
27
24
|
manifest,
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.AltairUiAction = exports.AltairUiActionLocation = void 0;
|
|
4
|
-
const uuid_1 = require("uuid");
|
|
5
|
-
var AltairUiActionLocation;
|
|
1
|
+
import { v4 as uuid } from 'uuid';
|
|
2
|
+
export var AltairUiActionLocation;
|
|
6
3
|
(function (AltairUiActionLocation) {
|
|
7
4
|
AltairUiActionLocation["RESULT_PANE"] = "result_pane";
|
|
8
|
-
})(AltairUiActionLocation
|
|
9
|
-
class AltairUiAction {
|
|
5
|
+
})(AltairUiActionLocation || (AltairUiActionLocation = {}));
|
|
6
|
+
export class AltairUiAction {
|
|
10
7
|
constructor(title, location, callback) {
|
|
11
8
|
this.title = title;
|
|
12
9
|
this.location = location;
|
|
13
10
|
this.callback = callback;
|
|
14
|
-
this.id =
|
|
11
|
+
this.id = uuid();
|
|
15
12
|
}
|
|
16
13
|
execute() {
|
|
17
14
|
this.callback();
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
|
-
exports.AltairUiAction = AltairUiAction;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
GRAPHQL_WS: exports.GRAPHQL_WS_PROVIDER_ID,
|
|
11
|
-
APP_SYNC: exports.APP_SYNC_PROVIDER_ID,
|
|
12
|
-
ACTION_CABLE: exports.ACTION_CABLE_PROVIDER_ID
|
|
1
|
+
export const WEBSOCKET_PROVIDER_ID = 'websocket';
|
|
2
|
+
export const GRAPHQL_WS_PROVIDER_ID = 'graphql-ws';
|
|
3
|
+
export const APP_SYNC_PROVIDER_ID = 'app-sync';
|
|
4
|
+
export const ACTION_CABLE_PROVIDER_ID = 'action-cable';
|
|
5
|
+
export const SUBSCRIPTION_PROVIDER_IDS = {
|
|
6
|
+
WEBSOCKET: WEBSOCKET_PROVIDER_ID,
|
|
7
|
+
GRAPHQL_WS: GRAPHQL_WS_PROVIDER_ID,
|
|
8
|
+
APP_SYNC: APP_SYNC_PROVIDER_ID,
|
|
9
|
+
ACTION_CABLE: ACTION_CABLE_PROVIDER_ID
|
|
13
10
|
};
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ActionCableSubscriptionProvider = void 0;
|
|
7
|
-
const subscription_provider_1 = require("../subscription-provider");
|
|
8
|
-
const rxjs_1 = require("rxjs");
|
|
9
|
-
const actioncable_1 = __importDefault(require("actioncable"));
|
|
10
|
-
class ActionCableSubscriptionProvider extends subscription_provider_1.SubscriptionProvider {
|
|
1
|
+
import { SubscriptionProvider } from '../subscription-provider';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import ActionCable from 'actioncable';
|
|
4
|
+
export class ActionCableSubscriptionProvider extends SubscriptionProvider {
|
|
11
5
|
execute(options) {
|
|
12
|
-
const cable =
|
|
13
|
-
return new
|
|
6
|
+
const cable = ActionCable.createConsumer(this.subscriptionUrl);
|
|
7
|
+
return new Observable((subscriber) => {
|
|
14
8
|
this.subscription = cable.subscriptions.create(Object.assign({}, {
|
|
15
9
|
channel: this.connectionParams.channel || 'GraphqlChannel',
|
|
16
10
|
channelId: Math.round(Date.now() + Math.random() * 100000).toString(16),
|
|
@@ -33,4 +27,3 @@ class ActionCableSubscriptionProvider extends subscription_provider_1.Subscripti
|
|
|
33
27
|
this.subscription?.unsubscribe();
|
|
34
28
|
}
|
|
35
29
|
}
|
|
36
|
-
exports.ActionCableSubscriptionProvider = ActionCableSubscriptionProvider;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const core_1 = require("@apollo/client/core");
|
|
9
|
-
const graphql_1 = require("graphql");
|
|
10
|
-
class AppSyncSubscriptionProvider extends subscription_provider_1.SubscriptionProvider {
|
|
1
|
+
import { SubscriptionProvider } from '../subscription-provider';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { createAuthLink } from 'aws-appsync-auth-link';
|
|
4
|
+
import { createSubscriptionHandshakeLink } from 'aws-appsync-subscription-link';
|
|
5
|
+
import { ApolloClient, ApolloLink, InMemoryCache } from '@apollo/client/core';
|
|
6
|
+
import { parse } from 'graphql';
|
|
7
|
+
export class AppSyncSubscriptionProvider extends SubscriptionProvider {
|
|
11
8
|
/**
|
|
12
9
|
{
|
|
13
10
|
"aws_project_region": "us-west-2",
|
|
@@ -26,19 +23,19 @@ class AppSyncSubscriptionProvider extends subscription_provider_1.SubscriptionPr
|
|
|
26
23
|
apiKey: this.connectionParams.aws_appsync_apiKey,
|
|
27
24
|
jwtToken: this.connectionParams.aws_appsync_jwtToken,
|
|
28
25
|
};
|
|
29
|
-
const link =
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
const link = ApolloLink.from([
|
|
27
|
+
createAuthLink({ url, region, auth }),
|
|
28
|
+
createSubscriptionHandshakeLink({ url, region, auth }),
|
|
32
29
|
]);
|
|
33
|
-
const client = new
|
|
30
|
+
const client = new ApolloClient({
|
|
34
31
|
link,
|
|
35
|
-
cache: new
|
|
32
|
+
cache: new InMemoryCache()
|
|
36
33
|
});
|
|
37
34
|
const subscription = client.subscribe({
|
|
38
|
-
query:
|
|
35
|
+
query: parse(options.query),
|
|
39
36
|
variables: options.variables
|
|
40
37
|
});
|
|
41
|
-
return new
|
|
38
|
+
return new Observable((subscriber) => {
|
|
42
39
|
this.subscription = subscription.subscribe({
|
|
43
40
|
next: (...args) => subscriber.next(...args),
|
|
44
41
|
error: (...args) => subscriber.error(...args),
|
|
@@ -52,4 +49,3 @@ class AppSyncSubscriptionProvider extends subscription_provider_1.SubscriptionPr
|
|
|
52
49
|
}
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
|
-
exports.AppSyncSubscriptionProvider = AppSyncSubscriptionProvider;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const rxjs_1 = require("rxjs");
|
|
6
|
-
const graphql_ws_1 = require("graphql-ws");
|
|
7
|
-
class GraphQLWsSubscriptionProvider extends subscription_provider_1.SubscriptionProvider {
|
|
1
|
+
import { SubscriptionProvider } from '../subscription-provider';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { createClient } from 'graphql-ws';
|
|
4
|
+
export class GraphQLWsSubscriptionProvider extends SubscriptionProvider {
|
|
8
5
|
createClient() {
|
|
9
|
-
this.client =
|
|
6
|
+
this.client = createClient({
|
|
10
7
|
url: this.subscriptionUrl,
|
|
11
8
|
connectionParams: this.connectionParams,
|
|
12
9
|
on: {
|
|
@@ -24,7 +21,7 @@ class GraphQLWsSubscriptionProvider extends subscription_provider_1.Subscription
|
|
|
24
21
|
if (!this.client) {
|
|
25
22
|
throw new Error('Could not create subscription client!');
|
|
26
23
|
}
|
|
27
|
-
return new
|
|
24
|
+
return new Observable((subscriber) => {
|
|
28
25
|
return this.client.subscribe({
|
|
29
26
|
query: options.query,
|
|
30
27
|
variables: options.variables,
|
|
@@ -41,4 +38,3 @@ class GraphQLWsSubscriptionProvider extends subscription_provider_1.Subscription
|
|
|
41
38
|
this.client = undefined;
|
|
42
39
|
}
|
|
43
40
|
}
|
|
44
|
-
exports.GraphQLWsSubscriptionProvider = GraphQLWsSubscriptionProvider;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const subscriptions_transport_ws_1 = require("subscriptions-transport-ws");
|
|
6
|
-
const rxjs_1 = require("rxjs");
|
|
7
|
-
class WebsocketSubscriptionProvider extends subscription_provider_1.SubscriptionProvider {
|
|
1
|
+
import { SubscriptionProvider } from '../subscription-provider';
|
|
2
|
+
import { SubscriptionClient } from 'subscriptions-transport-ws';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
export class WebsocketSubscriptionProvider extends SubscriptionProvider {
|
|
8
5
|
createClient() {
|
|
9
|
-
this.client = new
|
|
6
|
+
this.client = new SubscriptionClient(this.subscriptionUrl, {
|
|
10
7
|
reconnect: true,
|
|
11
8
|
connectionParams: this.connectionParams,
|
|
12
9
|
connectionCallback: this.extraOptions?.onConnected
|
|
@@ -17,7 +14,7 @@ class WebsocketSubscriptionProvider extends subscription_provider_1.Subscription
|
|
|
17
14
|
if (!this.client) {
|
|
18
15
|
throw new Error('Could not create subscription client!');
|
|
19
16
|
}
|
|
20
|
-
return new
|
|
17
|
+
return new Observable((subscriber) => {
|
|
21
18
|
return this.client.request({
|
|
22
19
|
query: options.query,
|
|
23
20
|
variables: options.variables,
|
|
@@ -35,4 +32,3 @@ class WebsocketSubscriptionProvider extends subscription_provider_1.Subscription
|
|
|
35
32
|
this.client = undefined;
|
|
36
33
|
}
|
|
37
34
|
}
|
|
38
|
-
exports.WebsocketSubscriptionProvider = WebsocketSubscriptionProvider;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SubscriptionProvider = void 0;
|
|
4
|
-
class SubscriptionProvider {
|
|
1
|
+
export class SubscriptionProvider {
|
|
5
2
|
constructor(subscriptionUrl, connectionParams, extraOptions) {
|
|
6
3
|
this.subscriptionUrl = subscriptionUrl;
|
|
7
4
|
this.connectionParams = connectionParams;
|
|
8
5
|
this.extraOptions = extraOptions;
|
|
9
6
|
}
|
|
10
7
|
}
|
|
11
|
-
exports.SubscriptionProvider = SubscriptionProvider;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const theme_1 = require("../theme");
|
|
1
|
+
import { foundations } from '../theme';
|
|
4
2
|
const theme = {
|
|
5
3
|
colors: {
|
|
6
|
-
bg:
|
|
4
|
+
bg: foundations.colors.black,
|
|
7
5
|
offBg: '#3f4349',
|
|
8
|
-
font:
|
|
9
|
-
offFont:
|
|
6
|
+
font: foundations.colors.white,
|
|
7
|
+
offFont: foundations.colors.lightGray,
|
|
10
8
|
border: '#565c64',
|
|
11
9
|
offBorder: '#565656',
|
|
12
10
|
headerBg: '#3f4349',
|
|
@@ -16,18 +14,18 @@ const theme = {
|
|
|
16
14
|
},
|
|
17
15
|
editor: {
|
|
18
16
|
colors: {
|
|
19
|
-
comment:
|
|
20
|
-
string:
|
|
21
|
-
number:
|
|
22
|
-
variable:
|
|
23
|
-
attribute:
|
|
24
|
-
keyword:
|
|
25
|
-
atom:
|
|
26
|
-
property:
|
|
27
|
-
definition:
|
|
28
|
-
punctuation:
|
|
29
|
-
cursor:
|
|
17
|
+
comment: foundations.colors.darkGray,
|
|
18
|
+
string: foundations.colors.orange,
|
|
19
|
+
number: foundations.colors.orange,
|
|
20
|
+
variable: foundations.colors.white,
|
|
21
|
+
attribute: foundations.colors.green,
|
|
22
|
+
keyword: foundations.colors.blue,
|
|
23
|
+
atom: foundations.colors.white,
|
|
24
|
+
property: foundations.colors.blue,
|
|
25
|
+
definition: foundations.colors.orange,
|
|
26
|
+
punctuation: foundations.colors.blue,
|
|
27
|
+
cursor: foundations.colors.blue,
|
|
30
28
|
}
|
|
31
29
|
},
|
|
32
30
|
};
|
|
33
|
-
|
|
31
|
+
export default theme;
|