altair-graphql-core 5.0.8 → 5.0.12
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/cjs/config.d.ts +159 -0
- package/build/cjs/config.js +106 -0
- package/build/cjs/index.d.ts +3 -0
- package/build/cjs/index.js +7 -0
- package/build/cjs/plugin/base.d.ts +11 -0
- package/build/cjs/plugin/base.js +9 -0
- package/build/cjs/plugin/context/context.interface.d.ts +78 -0
- package/build/cjs/plugin/context/context.interface.js +2 -0
- package/build/cjs/plugin/event/event.interfaces.d.ts +30 -0
- package/build/cjs/plugin/event/event.interfaces.js +2 -0
- package/build/cjs/plugin/panel.d.ts +18 -0
- package/build/cjs/plugin/panel.js +26 -0
- package/build/cjs/plugin/plugin.interfaces.d.ts +66 -0
- package/build/cjs/plugin/plugin.interfaces.js +37 -0
- package/build/cjs/plugin/ui-action.d.ts +12 -0
- package/build/cjs/plugin/ui-action.js +20 -0
- package/build/cjs/subscriptions/index.d.ts +20 -0
- package/build/cjs/subscriptions/index.js +15 -0
- package/build/cjs/subscriptions/providers/action-cable.d.ts +9 -0
- package/build/cjs/subscriptions/providers/action-cable.js +36 -0
- package/build/cjs/subscriptions/providers/app-sync.d.ts +19 -0
- package/build/cjs/subscriptions/providers/app-sync.js +55 -0
- package/build/cjs/subscriptions/providers/graphql-sse.d.ts +11 -0
- package/build/cjs/subscriptions/providers/graphql-sse.js +43 -0
- package/build/cjs/subscriptions/providers/graphql-ws.d.ts +11 -0
- package/build/cjs/subscriptions/providers/graphql-ws.js +56 -0
- package/build/cjs/subscriptions/providers/ws.d.ts +11 -0
- package/build/cjs/subscriptions/providers/ws.js +41 -0
- package/build/cjs/subscriptions/subscription-provider.d.ts +21 -0
- package/build/cjs/subscriptions/subscription-provider.js +11 -0
- package/build/cjs/theme/defaults/dark.d.ts +4 -0
- package/build/cjs/theme/defaults/dark.js +33 -0
- package/build/cjs/theme/defaults/dracula.d.ts +4 -0
- package/build/cjs/theme/defaults/dracula.js +28 -0
- package/build/cjs/theme/defaults/light.d.ts +4 -0
- package/build/cjs/theme/defaults/light.js +4 -0
- package/build/cjs/theme/index.d.ts +197 -0
- package/build/cjs/theme/index.js +27 -0
- package/build/cjs/theme/theme.d.ts +108 -0
- package/build/cjs/theme/theme.js +147 -0
- package/build/cjs/types/shared.d.ts +15 -0
- package/build/cjs/types/shared.js +2 -0
- package/build/cjs/types/state/account.interfaces.d.ts +17 -0
- package/build/cjs/types/state/account.interfaces.js +7 -0
- package/build/cjs/types/state/collection.interfaces.d.ts +48 -0
- package/build/cjs/types/state/collection.interfaces.js +2 -0
- package/build/cjs/types/state/dialog.interfaces.d.ts +8 -0
- package/build/cjs/types/state/dialog.interfaces.js +2 -0
- package/build/cjs/types/state/docs.interfaces.d.ts +22 -0
- package/build/cjs/types/state/docs.interfaces.js +2 -0
- package/build/cjs/types/state/donation.interfaces.d.ts +4 -0
- package/build/cjs/types/state/donation.interfaces.js +2 -0
- package/build/cjs/types/state/environments.interfaces.d.ts +22 -0
- package/build/cjs/types/state/environments.interfaces.js +2 -0
- package/build/cjs/types/state/gql-schema.interfaces.d.ts +9 -0
- package/build/cjs/types/state/gql-schema.interfaces.js +2 -0
- package/build/cjs/types/state/header.interfaces.d.ts +7 -0
- package/build/cjs/types/state/header.interfaces.js +2 -0
- package/build/cjs/types/state/history.interfaces.d.ts +7 -0
- package/build/cjs/types/state/history.interfaces.js +2 -0
- package/build/cjs/types/state/layout.interfaces.d.ts +8 -0
- package/build/cjs/types/state/layout.interfaces.js +2 -0
- package/build/cjs/types/state/local.interfaces.d.ts +21 -0
- package/build/cjs/types/state/local.interfaces.js +2 -0
- package/build/cjs/types/state/per-window.interfaces.d.ts +26 -0
- package/build/cjs/types/state/per-window.interfaces.js +2 -0
- package/build/cjs/types/state/postrequest.interfaces.d.ts +5 -0
- package/build/cjs/types/state/postrequest.interfaces.js +2 -0
- package/build/cjs/types/state/prerequest.interfaces.d.ts +5 -0
- package/build/cjs/types/state/prerequest.interfaces.js +2 -0
- package/build/cjs/types/state/query.interfaces.d.ts +50 -0
- package/build/cjs/types/state/query.interfaces.js +4 -0
- package/build/cjs/types/state/settings.interfaces.d.ts +97 -0
- package/build/cjs/types/state/settings.interfaces.js +4 -0
- package/build/cjs/types/state/state.interfaces.d.ts +19 -0
- package/build/cjs/types/state/state.interfaces.js +2 -0
- package/build/cjs/types/state/stream.interfaces.d.ts +8 -0
- package/build/cjs/types/state/stream.interfaces.js +2 -0
- package/build/cjs/types/state/variable.interfaces.d.ts +11 -0
- package/build/cjs/types/state/variable.interfaces.js +2 -0
- package/build/cjs/types/state/window.interfaces.d.ts +38 -0
- package/build/cjs/types/state/window.interfaces.js +2 -0
- package/build/cjs/types/state/windows-meta.interfaces.d.ts +12 -0
- package/build/cjs/types/state/windows-meta.interfaces.js +2 -0
- package/build/cjs/types/state/workspace.interface.d.ts +9 -0
- package/build/cjs/types/state/workspace.interface.js +14 -0
- package/build/cjs/utils/is_electron.d.ts +3 -0
- package/build/cjs/utils/is_electron.js +6 -0
- package/build/cjs/utils/logger.d.ts +6 -0
- package/build/cjs/utils/logger.js +46 -0
- package/build/cjs/utils/value-object.d.ts +7 -0
- package/build/cjs/utils/value-object.js +22 -0
- package/build/config.d.ts +18 -18
- package/build/config.js +25 -11
- package/build/plugin/event/event.interfaces.d.ts +2 -2
- package/build/plugin/event/event.interfaces.js +0 -1
- package/build/plugin/plugin.interfaces.d.ts +17 -1
- package/build/plugin/plugin.interfaces.js +4 -1
- package/build/subscriptions/index.d.ts +1 -1
- package/build/subscriptions/providers/action-cable.js +2 -2
- package/build/subscriptions/providers/app-sync.js +3 -3
- package/build/subscriptions/providers/graphql-sse.js +2 -2
- package/build/subscriptions/providers/graphql-ws.js +3 -3
- package/build/subscriptions/providers/ws.js +2 -2
- package/build/subscriptions/subscription-provider.d.ts +5 -5
- package/build/theme/defaults/dark.d.ts +1 -1
- package/build/theme/defaults/dark.js +9 -9
- package/build/theme/defaults/dracula.js +2 -2
- package/build/theme/index.d.ts +165 -165
- package/build/theme/theme.d.ts +3 -3
- package/build/theme/theme.js +39 -39
- package/build/types/shared.d.ts +14 -3
- package/build/types/state/account.interfaces.d.ts +9 -0
- package/build/types/state/account.interfaces.js +3 -1
- package/build/types/state/collection.interfaces.d.ts +10 -13
- package/build/types/state/docs.interfaces.d.ts +14 -12
- package/build/types/state/environments.interfaces.js +0 -1
- package/build/types/state/header.interfaces.d.ts +1 -1
- package/build/types/state/local.interfaces.d.ts +9 -7
- package/build/types/state/query.interfaces.d.ts +6 -5
- package/build/types/state/settings.interfaces.d.ts +1 -1
- package/build/types/state/stream.interfaces.d.ts +1 -1
- package/build/types/state/window.interfaces.d.ts +4 -4
- package/build/types/state/workspace.interface.d.ts +9 -0
- package/build/types/state/workspace.interface.js +10 -0
- package/build/utils/logger.js +1 -1
- package/build/utils/value-object.d.ts +7 -0
- package/build/utils/value-object.js +18 -0
- package/package.json +6 -6
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +3 -7
- package/.prettierrc +0 -1
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { SubscriptionProviderIds } from './subscriptions';
|
|
2
|
+
import { IDictionary } from './types/shared';
|
|
3
|
+
import { IInitialEnvironments } from './types/state/environments.interfaces';
|
|
4
|
+
import { HttpVerb } from './types/state/query.interfaces';
|
|
5
|
+
import { SettingsState } from './types/state/settings.interfaces';
|
|
6
|
+
export interface AltairWindowOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Initial name of the window
|
|
9
|
+
*/
|
|
10
|
+
initialName?: string;
|
|
11
|
+
/**
|
|
12
|
+
* URL to set as the server endpoint
|
|
13
|
+
*/
|
|
14
|
+
endpointURL?: string;
|
|
15
|
+
/**
|
|
16
|
+
* URL to set as the subscription endpoint. This can be relative or absolute.
|
|
17
|
+
*/
|
|
18
|
+
subscriptionsEndpoint?: string;
|
|
19
|
+
/**
|
|
20
|
+
* URL protocol for the subscription endpoint. This is used if the specified subscriptions endpoint is relative.
|
|
21
|
+
* e.g. wss
|
|
22
|
+
*/
|
|
23
|
+
subscriptionsProtocol?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Initial query to be added
|
|
26
|
+
*/
|
|
27
|
+
initialQuery?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Initial variables to be added
|
|
30
|
+
*/
|
|
31
|
+
initialVariables?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Initial pre-request script to be added
|
|
34
|
+
*/
|
|
35
|
+
initialPreRequestScript?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Initial post-request script to be added
|
|
38
|
+
*/
|
|
39
|
+
initialPostRequestScript?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Initial headers object to be added
|
|
42
|
+
* @example
|
|
43
|
+
* {
|
|
44
|
+
* 'X-GraphQL-Token': 'asd7-237s-2bdk-nsdk4'
|
|
45
|
+
* }
|
|
46
|
+
*/
|
|
47
|
+
initialHeaders?: IDictionary;
|
|
48
|
+
/**
|
|
49
|
+
* Initial subscriptions provider
|
|
50
|
+
*
|
|
51
|
+
* @default "websocket"
|
|
52
|
+
*/
|
|
53
|
+
initialSubscriptionsProvider?: SubscriptionProviderIds;
|
|
54
|
+
/**
|
|
55
|
+
* Initial subscriptions connection params
|
|
56
|
+
*/
|
|
57
|
+
initialSubscriptionsPayload?: IDictionary;
|
|
58
|
+
/**
|
|
59
|
+
* HTTP method to use for making requests
|
|
60
|
+
*/
|
|
61
|
+
initialHttpMethod?: HttpVerb;
|
|
62
|
+
}
|
|
63
|
+
export interface AltairConfigOptions extends AltairWindowOptions {
|
|
64
|
+
/**
|
|
65
|
+
* Initial Environments to be added
|
|
66
|
+
* @example
|
|
67
|
+
* {
|
|
68
|
+
* base: {
|
|
69
|
+
* title: 'Environment',
|
|
70
|
+
* variables: {}
|
|
71
|
+
* },
|
|
72
|
+
* subEnvironments: [
|
|
73
|
+
* {
|
|
74
|
+
* title: 'sub-1',
|
|
75
|
+
* variables: {}
|
|
76
|
+
* }
|
|
77
|
+
* ]
|
|
78
|
+
* }
|
|
79
|
+
*/
|
|
80
|
+
initialEnvironments?: IInitialEnvironments;
|
|
81
|
+
/**
|
|
82
|
+
* Namespace for storing the data for the altair instance.
|
|
83
|
+
* Use this when you have multiple altair instances running on the same domain.
|
|
84
|
+
* @example
|
|
85
|
+
* instanceStorageNamespace: 'altair_dev_'
|
|
86
|
+
*/
|
|
87
|
+
instanceStorageNamespace?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Initial app settings to use
|
|
90
|
+
*/
|
|
91
|
+
initialSettings?: Partial<SettingsState>;
|
|
92
|
+
/**
|
|
93
|
+
* Indicates if the state should be preserved for subsequent app loads
|
|
94
|
+
*
|
|
95
|
+
* @default true
|
|
96
|
+
*/
|
|
97
|
+
preserveState?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* List of options for windows to be loaded
|
|
100
|
+
*/
|
|
101
|
+
initialWindows?: AltairWindowOptions[];
|
|
102
|
+
}
|
|
103
|
+
export declare class AltairConfig {
|
|
104
|
+
donation: {
|
|
105
|
+
url: string;
|
|
106
|
+
action_count_threshold: number;
|
|
107
|
+
};
|
|
108
|
+
ga: string;
|
|
109
|
+
add_query_depth_limit: number;
|
|
110
|
+
tab_size: number;
|
|
111
|
+
max_windows: number;
|
|
112
|
+
default_language: string;
|
|
113
|
+
languages: {
|
|
114
|
+
'en-US': string;
|
|
115
|
+
'fr-FR': string;
|
|
116
|
+
'es-ES': string;
|
|
117
|
+
'cs-CZ': string;
|
|
118
|
+
'de-DE': string;
|
|
119
|
+
'pt-BR': string;
|
|
120
|
+
'ru-RU': string;
|
|
121
|
+
'uk-UA': string;
|
|
122
|
+
'zh-CN': string;
|
|
123
|
+
'ja-JP': string;
|
|
124
|
+
'sr-SP': string;
|
|
125
|
+
'it-IT': string;
|
|
126
|
+
'pl-PL': string;
|
|
127
|
+
'ko-KR': string;
|
|
128
|
+
'ro-RO': string;
|
|
129
|
+
'vi-VN': string;
|
|
130
|
+
};
|
|
131
|
+
query_history_depth: number;
|
|
132
|
+
disableLineNumbers: boolean;
|
|
133
|
+
defaultTheme: string;
|
|
134
|
+
themes: string[];
|
|
135
|
+
isTranslateMode: any;
|
|
136
|
+
isWebApp: any;
|
|
137
|
+
initialData: {
|
|
138
|
+
url: string;
|
|
139
|
+
subscriptionsEndpoint: string;
|
|
140
|
+
subscriptionsProtocol: string;
|
|
141
|
+
query: string;
|
|
142
|
+
variables: string;
|
|
143
|
+
headers: IDictionary<any>;
|
|
144
|
+
environments: IInitialEnvironments;
|
|
145
|
+
preRequestScript: string;
|
|
146
|
+
postRequestScript: string;
|
|
147
|
+
instanceStorageNamespace: string;
|
|
148
|
+
settings: Partial<SettingsState> | undefined;
|
|
149
|
+
initialSubscriptionsProvider: SubscriptionProviderIds | undefined;
|
|
150
|
+
initialSubscriptionsPayload: IDictionary<any>;
|
|
151
|
+
initialHttpMethod: "POST" | "GET" | "PUT" | "DELETE";
|
|
152
|
+
preserveState: boolean;
|
|
153
|
+
windows: AltairWindowOptions[];
|
|
154
|
+
};
|
|
155
|
+
constructor({ endpointURL, subscriptionsEndpoint, subscriptionsProtocol, initialQuery, initialHeaders, initialEnvironments, initialVariables, initialPreRequestScript, initialPostRequestScript, instanceStorageNamespace, initialSettings, initialSubscriptionsProvider, initialSubscriptionsPayload, initialHttpMethod, preserveState, initialWindows, }?: AltairConfigOptions);
|
|
156
|
+
}
|
|
157
|
+
export declare const setAltairConfig: (_config: AltairConfig) => void;
|
|
158
|
+
export declare const getAltairConfig: () => AltairConfig;
|
|
159
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
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"));
|
|
9
|
+
const isTranslateMode = window.__ALTAIR_TRANSLATE__;
|
|
10
|
+
class AltairConfig {
|
|
11
|
+
constructor({ endpointURL, subscriptionsEndpoint, subscriptionsProtocol, initialQuery, initialHeaders, initialEnvironments, initialVariables, initialPreRequestScript, initialPostRequestScript = '', instanceStorageNamespace, initialSettings, initialSubscriptionsProvider = subscriptions_1.WEBSOCKET_PROVIDER_ID, initialSubscriptionsPayload = {}, initialHttpMethod = 'POST', preserveState = true, initialWindows = [], } = {}) {
|
|
12
|
+
this.donation = {
|
|
13
|
+
url: 'https://opencollective.com/altair/donate',
|
|
14
|
+
action_count_threshold: 50,
|
|
15
|
+
};
|
|
16
|
+
this.ga = 'UA-41432833-6';
|
|
17
|
+
this.add_query_depth_limit = 3;
|
|
18
|
+
this.tab_size = 2;
|
|
19
|
+
this.max_windows = is_electron_1.default ? 50 : 15;
|
|
20
|
+
this.default_language = isTranslateMode ? 'ach-UG' : 'en-US';
|
|
21
|
+
this.languages = {
|
|
22
|
+
'en-US': 'English',
|
|
23
|
+
'fr-FR': 'French',
|
|
24
|
+
'es-ES': 'Español',
|
|
25
|
+
'cs-CZ': 'Czech',
|
|
26
|
+
'de-DE': 'German',
|
|
27
|
+
'pt-BR': 'Brazilian',
|
|
28
|
+
'ru-RU': 'Russian',
|
|
29
|
+
'uk-UA': 'Ukrainian',
|
|
30
|
+
'zh-CN': 'Chinese Simplified',
|
|
31
|
+
'ja-JP': 'Japanese',
|
|
32
|
+
'sr-SP': 'Serbian',
|
|
33
|
+
'it-IT': 'Italian',
|
|
34
|
+
'pl-PL': 'Polish',
|
|
35
|
+
'ko-KR': 'Korean',
|
|
36
|
+
'ro-RO': 'Romanian',
|
|
37
|
+
'vi-VN': 'Vietnamese',
|
|
38
|
+
};
|
|
39
|
+
this.query_history_depth = is_electron_1.default ? 100 : 15;
|
|
40
|
+
this.disableLineNumbers = false;
|
|
41
|
+
this.defaultTheme = 'system';
|
|
42
|
+
this.themes = ['light', 'dark', 'dracula', 'system'];
|
|
43
|
+
this.isTranslateMode = isTranslateMode;
|
|
44
|
+
this.isWebApp = window.__ALTAIR_WEB_APP__;
|
|
45
|
+
this.initialData = {
|
|
46
|
+
url: '',
|
|
47
|
+
subscriptionsEndpoint: '',
|
|
48
|
+
subscriptionsProtocol: '',
|
|
49
|
+
query: '',
|
|
50
|
+
variables: '',
|
|
51
|
+
// Force type of header, since initial value inference is wrong
|
|
52
|
+
headers: null,
|
|
53
|
+
environments: {},
|
|
54
|
+
preRequestScript: '',
|
|
55
|
+
postRequestScript: '',
|
|
56
|
+
instanceStorageNamespace: 'altair_',
|
|
57
|
+
settings: undefined,
|
|
58
|
+
initialSubscriptionsProvider: undefined,
|
|
59
|
+
initialSubscriptionsPayload: {},
|
|
60
|
+
initialHttpMethod: 'POST',
|
|
61
|
+
preserveState: true,
|
|
62
|
+
windows: [],
|
|
63
|
+
};
|
|
64
|
+
this.initialData.url =
|
|
65
|
+
window.__ALTAIR_ENDPOINT_URL__ || endpointURL || '';
|
|
66
|
+
this.initialData.subscriptionsEndpoint =
|
|
67
|
+
window.__ALTAIR_SUBSCRIPTIONS_ENDPOINT__ ||
|
|
68
|
+
subscriptionsEndpoint ||
|
|
69
|
+
'';
|
|
70
|
+
this.initialData.subscriptionsProtocol = subscriptionsProtocol || '';
|
|
71
|
+
this.initialData.query =
|
|
72
|
+
window.__ALTAIR_INITIAL_QUERY__ || initialQuery || '';
|
|
73
|
+
this.initialData.variables =
|
|
74
|
+
window.__ALTAIR_INITIAL_VARIABLES__ || initialVariables || '';
|
|
75
|
+
this.initialData.headers =
|
|
76
|
+
window.__ALTAIR_INITIAL_HEADERS__ || initialHeaders || '';
|
|
77
|
+
this.initialData.environments = initialEnvironments || {};
|
|
78
|
+
this.initialData.preRequestScript =
|
|
79
|
+
window.__ALTAIR_INITIAL_PRE_REQUEST_SCRIPT__ ||
|
|
80
|
+
initialPreRequestScript ||
|
|
81
|
+
'';
|
|
82
|
+
this.initialData.postRequestScript = initialPostRequestScript;
|
|
83
|
+
this.initialData.instanceStorageNamespace =
|
|
84
|
+
window.__ALTAIR_INSTANCE_STORAGE_NAMESPACE__ ||
|
|
85
|
+
instanceStorageNamespace ||
|
|
86
|
+
'altair_';
|
|
87
|
+
this.initialData.settings = initialSettings;
|
|
88
|
+
this.initialData.initialSubscriptionsProvider =
|
|
89
|
+
initialSubscriptionsProvider;
|
|
90
|
+
this.initialData.initialSubscriptionsPayload = initialSubscriptionsPayload;
|
|
91
|
+
this.initialData.initialHttpMethod = initialHttpMethod;
|
|
92
|
+
this.initialData.preserveState = preserveState;
|
|
93
|
+
this.initialData.windows = initialWindows;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.AltairConfig = AltairConfig;
|
|
97
|
+
let config = new AltairConfig();
|
|
98
|
+
const setAltairConfig = (_config) => {
|
|
99
|
+
config = _config;
|
|
100
|
+
};
|
|
101
|
+
exports.setAltairConfig = setAltairConfig;
|
|
102
|
+
const getAltairConfig = () => {
|
|
103
|
+
return config;
|
|
104
|
+
};
|
|
105
|
+
exports.getAltairConfig = getAltairConfig;
|
|
106
|
+
window.getAltairConfig = exports.getAltairConfig;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerPluginClass = void 0;
|
|
4
|
+
const registerPluginClass = (pluginClassName, pluginClass) => {
|
|
5
|
+
window['AltairGraphQL'].plugins[pluginClassName] = pluginClass;
|
|
6
|
+
};
|
|
7
|
+
exports.registerPluginClass = registerPluginClass;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PluginContext } from './context/context.interface';
|
|
2
|
+
export declare abstract class PluginBase {
|
|
3
|
+
protected ctx: PluginContext;
|
|
4
|
+
constructor(ctx: PluginContext);
|
|
5
|
+
abstract initialize(ctx: PluginContext): void;
|
|
6
|
+
abstract destroy(): void;
|
|
7
|
+
}
|
|
8
|
+
export interface PluginConstructor<T extends PluginBase = PluginBase> {
|
|
9
|
+
new (): T;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { SubscriptionProviderData } from '../../subscriptions';
|
|
2
|
+
import { ICustomTheme } from '../../theme';
|
|
3
|
+
import { ExportWindowState } from '../../types/state/window.interfaces';
|
|
4
|
+
import { PluginEvent, PluginEventCallback } from '../event/event.interfaces';
|
|
5
|
+
import { AltairPanel, AltairPanelLocation } from '../panel';
|
|
6
|
+
import { AltairPlugin } from '../plugin.interfaces';
|
|
7
|
+
import { AltairUiAction, AltairUiActionLocation } from '../ui-action';
|
|
8
|
+
export interface CreatePanelOptions {
|
|
9
|
+
title?: string;
|
|
10
|
+
location?: AltairPanelLocation;
|
|
11
|
+
}
|
|
12
|
+
export interface CreateActionOptions {
|
|
13
|
+
title: string;
|
|
14
|
+
location?: AltairUiActionLocation;
|
|
15
|
+
execute: (data: PluginWindowState) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface PluginWindowState extends ExportWindowState {
|
|
18
|
+
windowId: string;
|
|
19
|
+
sdl: string;
|
|
20
|
+
queryResult: string;
|
|
21
|
+
requestStartTime: number;
|
|
22
|
+
requestEndTime: number;
|
|
23
|
+
responseTime: number;
|
|
24
|
+
responseStatus: number;
|
|
25
|
+
}
|
|
26
|
+
export interface PluginContext {
|
|
27
|
+
app: {
|
|
28
|
+
/**
|
|
29
|
+
* Returns an allowed set of data from the state visible to plugins
|
|
30
|
+
*
|
|
31
|
+
* Since it is a method, the state can be generated when called.
|
|
32
|
+
* So we can ensure uniqueness of the state, as well as avoid passing values by references.
|
|
33
|
+
*/
|
|
34
|
+
getWindowState(windowId: string): Promise<PluginWindowState | undefined>;
|
|
35
|
+
getCurrentWindowState(): Promise<PluginWindowState | undefined>;
|
|
36
|
+
/**
|
|
37
|
+
* panel has two locations: sidebar, header
|
|
38
|
+
*
|
|
39
|
+
* Each call creates a new panel. Instead, plugin should create panel only once (@initialize)
|
|
40
|
+
* Panel can be destroyed when the plugin is unused.
|
|
41
|
+
*
|
|
42
|
+
* returns panel instance (includes destroy() method)
|
|
43
|
+
*/
|
|
44
|
+
createPanel(element: HTMLElement, options?: CreatePanelOptions): AltairPanel;
|
|
45
|
+
destroyPanel(panel: AltairPanel): void;
|
|
46
|
+
/**
|
|
47
|
+
* action has 1 location for now: resultpane
|
|
48
|
+
*
|
|
49
|
+
* Each call creates a new action. Instead, plugins should create action once, when needed
|
|
50
|
+
* Action can be destroyed when the plugin decides to.
|
|
51
|
+
*
|
|
52
|
+
* returns action instance (includes destroy() method)
|
|
53
|
+
*/
|
|
54
|
+
createAction(options: CreateActionOptions): AltairUiAction;
|
|
55
|
+
destroyAction(uiAction: AltairUiAction): void;
|
|
56
|
+
isElectron(): boolean;
|
|
57
|
+
createWindow(data: ExportWindowState): void;
|
|
58
|
+
setQuery(windowId: string, query: string): void;
|
|
59
|
+
setVariables(windowId: string, variables: string): void;
|
|
60
|
+
setEndpoint(windowId: string, url: string): void;
|
|
61
|
+
addSubscriptionProvider(providerData: SubscriptionProviderData): void;
|
|
62
|
+
executeCommand(): void;
|
|
63
|
+
};
|
|
64
|
+
events: {
|
|
65
|
+
on<E extends PluginEvent>(event: E, callback: PluginEventCallback<E>): {
|
|
66
|
+
unsubscribe: () => void;
|
|
67
|
+
};
|
|
68
|
+
off(): void;
|
|
69
|
+
};
|
|
70
|
+
theme: {
|
|
71
|
+
add(name: string, theme: ICustomTheme): void;
|
|
72
|
+
enable(name: string, darkMode?: boolean): Promise<void>;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export interface PluginContextGenerator {
|
|
76
|
+
createContext(pluginName: string, plugin: AltairPlugin): PluginContext;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=context.interface.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface PluginEventPayloadMap {
|
|
2
|
+
'app-ready': boolean;
|
|
3
|
+
'current-window.change': {
|
|
4
|
+
windowId: string;
|
|
5
|
+
};
|
|
6
|
+
'query.change': {
|
|
7
|
+
windowId: string;
|
|
8
|
+
data: string;
|
|
9
|
+
};
|
|
10
|
+
'query-result.change': {
|
|
11
|
+
windowId: string;
|
|
12
|
+
data: any;
|
|
13
|
+
};
|
|
14
|
+
'query-result-meta.change': {
|
|
15
|
+
windowId: string;
|
|
16
|
+
data: {
|
|
17
|
+
requestStartTime: number;
|
|
18
|
+
requestEndTime: number;
|
|
19
|
+
responseTime: number;
|
|
20
|
+
responseStatus: number;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
'sdl.change': {
|
|
24
|
+
windowId: string;
|
|
25
|
+
data: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export type PluginEvent = keyof PluginEventPayloadMap;
|
|
29
|
+
export type PluginEventCallback<T extends PluginEvent> = (payload: PluginEventPayloadMap[T]) => void;
|
|
30
|
+
//# sourceMappingURL=event.interfaces.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare enum AltairPanelLocation {
|
|
2
|
+
HEADER = "header",
|
|
3
|
+
SIDEBAR = "sidebar",
|
|
4
|
+
RESULT_PANE_BOTTOM = "result_pane_bottom"
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Used for dynamic panel elements. Can also be used for angular components in the future.
|
|
8
|
+
*/
|
|
9
|
+
export declare class AltairPanel {
|
|
10
|
+
title: string;
|
|
11
|
+
element: HTMLElement;
|
|
12
|
+
location: AltairPanelLocation;
|
|
13
|
+
id: string;
|
|
14
|
+
isActive: boolean;
|
|
15
|
+
constructor(title: string, element: HTMLElement, location: AltairPanelLocation);
|
|
16
|
+
destroy(): void;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=panel.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AltairPanel = exports.AltairPanelLocation = void 0;
|
|
4
|
+
const uuid_1 = require("uuid");
|
|
5
|
+
var AltairPanelLocation;
|
|
6
|
+
(function (AltairPanelLocation) {
|
|
7
|
+
AltairPanelLocation["HEADER"] = "header";
|
|
8
|
+
AltairPanelLocation["SIDEBAR"] = "sidebar";
|
|
9
|
+
AltairPanelLocation["RESULT_PANE_BOTTOM"] = "result_pane_bottom";
|
|
10
|
+
})(AltairPanelLocation = exports.AltairPanelLocation || (exports.AltairPanelLocation = {}));
|
|
11
|
+
/**
|
|
12
|
+
* Used for dynamic panel elements. Can also be used for angular components in the future.
|
|
13
|
+
*/
|
|
14
|
+
class AltairPanel {
|
|
15
|
+
constructor(title, element, location) {
|
|
16
|
+
this.title = title;
|
|
17
|
+
this.element = element;
|
|
18
|
+
this.location = location;
|
|
19
|
+
this.id = (0, uuid_1.v4)();
|
|
20
|
+
this.isActive = false;
|
|
21
|
+
}
|
|
22
|
+
destroy() {
|
|
23
|
+
this.element = null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.AltairPanel = AltairPanel;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the repository of the plugin.
|
|
3
|
+
* Used to know where to get the plugin from.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum PluginSource {
|
|
6
|
+
NPM = "npm",
|
|
7
|
+
GITHUB = "github",
|
|
8
|
+
URL = "url"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Specifies the type of the plugin.
|
|
12
|
+
* Determines how the plugin would interact with Altair.
|
|
13
|
+
*/
|
|
14
|
+
export declare enum PluginType {
|
|
15
|
+
HEADER = "header",
|
|
16
|
+
SIDEBAR = "sidebar",
|
|
17
|
+
ACTION_BUTTON = "action_button"
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Specifies the capabilities (functionalities) available to the plugin.
|
|
21
|
+
* In the future, this would be used to request the necessary permissions from the user.
|
|
22
|
+
*/
|
|
23
|
+
export type PluginCapabilities = 'query:read' | 'query:write' | 'header:read' | 'header:write' | 'environment:read' | 'environment:write';
|
|
24
|
+
/**
|
|
25
|
+
* Plugin Manifest Structure
|
|
26
|
+
*/
|
|
27
|
+
export interface PluginManifest {
|
|
28
|
+
manifest_version: number;
|
|
29
|
+
name: string;
|
|
30
|
+
display_name: string;
|
|
31
|
+
version: string;
|
|
32
|
+
description: string;
|
|
33
|
+
author_email?: string;
|
|
34
|
+
author?: string;
|
|
35
|
+
type?: PluginType;
|
|
36
|
+
plugin_class?: string;
|
|
37
|
+
scripts: string[];
|
|
38
|
+
styles?: string[];
|
|
39
|
+
capabilities?: PluginCapabilities[];
|
|
40
|
+
}
|
|
41
|
+
export interface AltairPlugin {
|
|
42
|
+
name: string;
|
|
43
|
+
display_name: string;
|
|
44
|
+
capabilities: PluginCapabilities[];
|
|
45
|
+
type?: PluginType;
|
|
46
|
+
plugin_class?: string;
|
|
47
|
+
manifest: PluginManifest;
|
|
48
|
+
}
|
|
49
|
+
export declare const createPlugin: (name: string, manifest: PluginManifest) => AltairPlugin;
|
|
50
|
+
export interface RemotePluginListItem {
|
|
51
|
+
name: string;
|
|
52
|
+
version: string;
|
|
53
|
+
description: string;
|
|
54
|
+
author: string | null;
|
|
55
|
+
created_at: number;
|
|
56
|
+
updated_at: number;
|
|
57
|
+
homepage: string | null;
|
|
58
|
+
summary: string | null;
|
|
59
|
+
manifest: PluginManifest;
|
|
60
|
+
}
|
|
61
|
+
export interface RemotePluginListResponse {
|
|
62
|
+
page: number;
|
|
63
|
+
total: number;
|
|
64
|
+
items: RemotePluginListItem[];
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=plugin.interfaces.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createPlugin = exports.PluginType = exports.PluginSource = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Defines the repository of the plugin.
|
|
6
|
+
* Used to know where to get the plugin from.
|
|
7
|
+
*/
|
|
8
|
+
var PluginSource;
|
|
9
|
+
(function (PluginSource) {
|
|
10
|
+
PluginSource["NPM"] = "npm";
|
|
11
|
+
PluginSource["GITHUB"] = "github";
|
|
12
|
+
PluginSource["URL"] = "url";
|
|
13
|
+
})(PluginSource = exports.PluginSource || (exports.PluginSource = {}));
|
|
14
|
+
/**
|
|
15
|
+
* Specifies the type of the plugin.
|
|
16
|
+
* Determines how the plugin would interact with Altair.
|
|
17
|
+
*/
|
|
18
|
+
var PluginType;
|
|
19
|
+
(function (PluginType) {
|
|
20
|
+
PluginType["HEADER"] = "header";
|
|
21
|
+
PluginType["SIDEBAR"] = "sidebar";
|
|
22
|
+
PluginType["ACTION_BUTTON"] = "action_button";
|
|
23
|
+
})(PluginType = exports.PluginType || (exports.PluginType = {}));
|
|
24
|
+
const createPlugin = (name, manifest) => {
|
|
25
|
+
return {
|
|
26
|
+
name,
|
|
27
|
+
manifest,
|
|
28
|
+
type: manifest.type,
|
|
29
|
+
display_name: manifest.display_name || name,
|
|
30
|
+
plugin_class: manifest.plugin_class,
|
|
31
|
+
capabilities: Array.from(new Set([
|
|
32
|
+
...(manifest.capabilities || []),
|
|
33
|
+
...['query:read', 'query:write'],
|
|
34
|
+
])),
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
exports.createPlugin = createPlugin;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum AltairUiActionLocation {
|
|
2
|
+
RESULT_PANE = "result_pane"
|
|
3
|
+
}
|
|
4
|
+
export declare class AltairUiAction {
|
|
5
|
+
title: string;
|
|
6
|
+
location: AltairUiActionLocation;
|
|
7
|
+
callback: () => void;
|
|
8
|
+
id: string;
|
|
9
|
+
constructor(title: string, location: AltairUiActionLocation, callback: () => void);
|
|
10
|
+
execute(): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ui-action.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AltairUiAction = exports.AltairUiActionLocation = void 0;
|
|
4
|
+
const uuid_1 = require("uuid");
|
|
5
|
+
var AltairUiActionLocation;
|
|
6
|
+
(function (AltairUiActionLocation) {
|
|
7
|
+
AltairUiActionLocation["RESULT_PANE"] = "result_pane";
|
|
8
|
+
})(AltairUiActionLocation = exports.AltairUiActionLocation || (exports.AltairUiActionLocation = {}));
|
|
9
|
+
class AltairUiAction {
|
|
10
|
+
constructor(title, location, callback) {
|
|
11
|
+
this.title = title;
|
|
12
|
+
this.location = location;
|
|
13
|
+
this.callback = callback;
|
|
14
|
+
this.id = (0, uuid_1.v4)();
|
|
15
|
+
}
|
|
16
|
+
execute() {
|
|
17
|
+
this.callback();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.AltairUiAction = AltairUiAction;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SubscriptionProviderConstructor } from './subscription-provider';
|
|
2
|
+
export declare const WEBSOCKET_PROVIDER_ID = "websocket";
|
|
3
|
+
export declare const GRAPHQL_WS_PROVIDER_ID = "graphql-ws";
|
|
4
|
+
export declare const APP_SYNC_PROVIDER_ID = "app-sync";
|
|
5
|
+
export declare const ACTION_CABLE_PROVIDER_ID = "action-cable";
|
|
6
|
+
export declare const GRAPHQL_SSE_ID = "graphql-sse";
|
|
7
|
+
export declare const SUBSCRIPTION_PROVIDER_IDS: {
|
|
8
|
+
readonly WEBSOCKET: "websocket";
|
|
9
|
+
readonly GRAPHQL_WS: "graphql-ws";
|
|
10
|
+
readonly APP_SYNC: "app-sync";
|
|
11
|
+
readonly ACTION_CABLE: "action-cable";
|
|
12
|
+
readonly GRAPHQL_SSE: "graphql-sse";
|
|
13
|
+
};
|
|
14
|
+
export type SubscriptionProviderIds = typeof SUBSCRIPTION_PROVIDER_IDS[keyof typeof SUBSCRIPTION_PROVIDER_IDS];
|
|
15
|
+
export interface SubscriptionProviderData {
|
|
16
|
+
id: string;
|
|
17
|
+
getProviderClass: () => Promise<SubscriptionProviderConstructor>;
|
|
18
|
+
copyTag?: string;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SUBSCRIPTION_PROVIDER_IDS = exports.GRAPHQL_SSE_ID = exports.ACTION_CABLE_PROVIDER_ID = exports.APP_SYNC_PROVIDER_ID = exports.GRAPHQL_WS_PROVIDER_ID = exports.WEBSOCKET_PROVIDER_ID = void 0;
|
|
4
|
+
exports.WEBSOCKET_PROVIDER_ID = 'websocket';
|
|
5
|
+
exports.GRAPHQL_WS_PROVIDER_ID = 'graphql-ws';
|
|
6
|
+
exports.APP_SYNC_PROVIDER_ID = 'app-sync';
|
|
7
|
+
exports.ACTION_CABLE_PROVIDER_ID = 'action-cable';
|
|
8
|
+
exports.GRAPHQL_SSE_ID = 'graphql-sse';
|
|
9
|
+
exports.SUBSCRIPTION_PROVIDER_IDS = {
|
|
10
|
+
WEBSOCKET: exports.WEBSOCKET_PROVIDER_ID,
|
|
11
|
+
GRAPHQL_WS: exports.GRAPHQL_WS_PROVIDER_ID,
|
|
12
|
+
APP_SYNC: exports.APP_SYNC_PROVIDER_ID,
|
|
13
|
+
ACTION_CABLE: exports.ACTION_CABLE_PROVIDER_ID,
|
|
14
|
+
GRAPHQL_SSE: exports.GRAPHQL_SSE_ID,
|
|
15
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SubscriptionProvider, SubscriptionProviderExecuteOptions } from '../subscription-provider';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
export declare class ActionCableSubscriptionProvider extends SubscriptionProvider {
|
|
4
|
+
subscription?: any;
|
|
5
|
+
channel?: string;
|
|
6
|
+
execute(options: SubscriptionProviderExecuteOptions): Observable<unknown>;
|
|
7
|
+
close(): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=action-cable.d.ts.map
|