altair-graphql-core 8.0.2 → 8.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/authorization/authorization-provider.d.ts +7 -3
- package/build/authorization/input.d.ts +11 -0
- package/build/authorization/input.js +2 -0
- package/build/authorization/providers/api-key.d.ts +9 -6
- package/build/authorization/providers/api-key.js +2 -2
- package/build/authorization/providers/api-key.spec.js +4 -4
- package/build/authorization/providers/basic.d.ts +8 -5
- package/build/authorization/providers/bearer.d.ts +7 -4
- package/build/authorization/providers/oauth2.d.ts +7 -4
- package/build/cjs/authorization/authorization-provider.d.ts +7 -3
- package/build/cjs/authorization/input.d.ts +11 -0
- package/build/cjs/authorization/input.js +3 -0
- package/build/cjs/authorization/providers/api-key.d.ts +9 -6
- package/build/cjs/authorization/providers/api-key.js +2 -2
- package/build/cjs/authorization/providers/api-key.spec.js +4 -4
- package/build/cjs/authorization/providers/basic.d.ts +8 -5
- package/build/cjs/authorization/providers/bearer.d.ts +7 -4
- package/build/cjs/authorization/providers/oauth2.d.ts +7 -4
- package/build/cjs/config/index.d.ts +2 -1
- package/build/cjs/config/index.js +3 -1
- package/build/cjs/config/options.d.ts +5 -0
- package/build/cjs/plugin/v3/parent-engine.js +1 -1
- package/build/cjs/types/state/window.interfaces.d.ts +2 -0
- package/build/config/index.d.ts +2 -1
- package/build/config/index.js +3 -1
- package/build/config/options.d.ts +5 -0
- package/build/plugin/v3/parent-engine.js +1 -1
- package/build/types/state/window.interfaces.d.ts +2 -0
- package/package.json +2 -2
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { AuthorizationResult } from '../types/state/authorization.interface';
|
|
2
|
-
export interface AuthorizationProviderExecuteOptions<T =
|
|
3
|
-
data: T | undefined;
|
|
2
|
+
export interface AuthorizationProviderExecuteOptions<T extends BaseAuthorizationProviderInput = BaseAuthorizationProviderInput> {
|
|
3
|
+
data: T['data'] | undefined;
|
|
4
4
|
}
|
|
5
|
-
export
|
|
5
|
+
export interface BaseAuthorizationProviderInput {
|
|
6
|
+
type: string;
|
|
7
|
+
data: unknown;
|
|
8
|
+
}
|
|
9
|
+
export declare abstract class AuthorizationProvider<T extends BaseAuthorizationProviderInput = BaseAuthorizationProviderInput> {
|
|
6
10
|
private hydrator;
|
|
7
11
|
constructor(hydrator: (data: string) => string);
|
|
8
12
|
hydrate(data: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ApiKeyAuthorizationProviderInput } from './providers/api-key';
|
|
2
|
+
import { BasicAuthorizationProviderInput } from './providers/basic';
|
|
3
|
+
import { BearerAuthorizationProviderInput } from './providers/bearer';
|
|
4
|
+
import { OAuth2AuthorizationProviderInput } from './providers/oauth2';
|
|
5
|
+
interface NoneAuthorizationProviderInput {
|
|
6
|
+
type: 'none';
|
|
7
|
+
data?: undefined;
|
|
8
|
+
}
|
|
9
|
+
export type AuthorizationProviderInput = NoneAuthorizationProviderInput | ApiKeyAuthorizationProviderInput | BasicAuthorizationProviderInput | BearerAuthorizationProviderInput | OAuth2AuthorizationProviderInput;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { AuthorizationResult } from '../../types/state/authorization.interface';
|
|
2
|
-
import { AuthorizationProvider, AuthorizationProviderExecuteOptions } from '../authorization-provider';
|
|
3
|
-
export interface
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { AuthorizationProvider, AuthorizationProviderExecuteOptions, BaseAuthorizationProviderInput } from '../authorization-provider';
|
|
3
|
+
export interface ApiKeyAuthorizationProviderInput extends BaseAuthorizationProviderInput {
|
|
4
|
+
type: 'api-key';
|
|
5
|
+
data: {
|
|
6
|
+
headerName: string;
|
|
7
|
+
headerValue: string;
|
|
8
|
+
};
|
|
6
9
|
}
|
|
7
|
-
export default class ApiKeyAuthorizationProvider extends AuthorizationProvider<
|
|
8
|
-
execute(options: AuthorizationProviderExecuteOptions<
|
|
10
|
+
export default class ApiKeyAuthorizationProvider extends AuthorizationProvider<ApiKeyAuthorizationProviderInput> {
|
|
11
|
+
execute(options: AuthorizationProviderExecuteOptions<ApiKeyAuthorizationProviderInput>): Promise<AuthorizationResult>;
|
|
9
12
|
}
|
|
10
13
|
//# sourceMappingURL=api-key.d.ts.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { AuthorizationProvider, } from '../authorization-provider';
|
|
2
2
|
export default class ApiKeyAuthorizationProvider extends AuthorizationProvider {
|
|
3
3
|
async execute(options) {
|
|
4
|
-
if (!options.data?.
|
|
4
|
+
if (!options.data?.headerName || !options.data?.headerValue) {
|
|
5
5
|
return {
|
|
6
6
|
headers: {},
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
return {
|
|
10
10
|
headers: {
|
|
11
|
-
[options.data.
|
|
11
|
+
[options.data.headerName]: this.hydrate(options.data.headerValue),
|
|
12
12
|
},
|
|
13
13
|
};
|
|
14
14
|
}
|
|
@@ -5,8 +5,8 @@ describe('basic', () => {
|
|
|
5
5
|
const authProvider = new ApiKeyAuthorizationProvider((x) => x);
|
|
6
6
|
const res = await authProvider.execute({
|
|
7
7
|
data: {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
headerName: 'X-API-Key',
|
|
9
|
+
headerValue: 'api_1a2s3d4f5g6h7j8k9l0',
|
|
10
10
|
},
|
|
11
11
|
});
|
|
12
12
|
expect(res).toEqual({
|
|
@@ -19,8 +19,8 @@ describe('basic', () => {
|
|
|
19
19
|
const authProvider = new ApiKeyAuthorizationProvider((x) => x.replace(/(^{{)|(}}$)/g, ''));
|
|
20
20
|
const res = await authProvider.execute({
|
|
21
21
|
data: {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
headerName: 'X-API-Key',
|
|
23
|
+
headerValue: '{{api_1a2s3d4f5g6h7j8k9l0}}',
|
|
24
24
|
},
|
|
25
25
|
});
|
|
26
26
|
expect(res).toEqual({
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { AuthorizationResult } from '../../types/state/authorization.interface';
|
|
2
2
|
import { AuthorizationProvider, AuthorizationProviderExecuteOptions } from '../authorization-provider';
|
|
3
|
-
export interface
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export interface BasicAuthorizationProviderInput {
|
|
4
|
+
type: 'basic';
|
|
5
|
+
data: {
|
|
6
|
+
username: string;
|
|
7
|
+
password: string;
|
|
8
|
+
};
|
|
6
9
|
}
|
|
7
|
-
export default class BasicAuthorizationProvider extends AuthorizationProvider<
|
|
8
|
-
execute(options: AuthorizationProviderExecuteOptions<
|
|
10
|
+
export default class BasicAuthorizationProvider extends AuthorizationProvider<BasicAuthorizationProviderInput> {
|
|
11
|
+
execute(options: AuthorizationProviderExecuteOptions<BasicAuthorizationProviderInput>): Promise<AuthorizationResult>;
|
|
9
12
|
}
|
|
10
13
|
//# sourceMappingURL=basic.d.ts.map
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { AuthorizationResult } from '../../types/state/authorization.interface';
|
|
2
2
|
import { AuthorizationProvider, AuthorizationProviderExecuteOptions } from '../authorization-provider';
|
|
3
|
-
export interface
|
|
4
|
-
|
|
3
|
+
export interface BearerAuthorizationProviderInput {
|
|
4
|
+
type: 'bearer';
|
|
5
|
+
data: {
|
|
6
|
+
token: string;
|
|
7
|
+
};
|
|
5
8
|
}
|
|
6
|
-
export default class BearerAuthorizationProvider extends AuthorizationProvider<
|
|
7
|
-
execute(options: AuthorizationProviderExecuteOptions<
|
|
9
|
+
export default class BearerAuthorizationProvider extends AuthorizationProvider<BearerAuthorizationProviderInput> {
|
|
10
|
+
execute(options: AuthorizationProviderExecuteOptions<BearerAuthorizationProviderInput>): Promise<AuthorizationResult>;
|
|
8
11
|
}
|
|
9
12
|
//# sourceMappingURL=bearer.d.ts.map
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { AccessTokenResponse } from '../../oauth2';
|
|
2
2
|
import { AuthorizationResult } from '../../types/state/authorization.interface';
|
|
3
3
|
import { AuthorizationProvider, AuthorizationProviderExecuteOptions } from '../authorization-provider';
|
|
4
|
-
export interface
|
|
5
|
-
|
|
4
|
+
export interface OAuth2AuthorizationProviderInput {
|
|
5
|
+
type: 'oauth2';
|
|
6
|
+
data: {
|
|
7
|
+
accessTokenResponse: AccessTokenResponse;
|
|
8
|
+
};
|
|
6
9
|
}
|
|
7
|
-
export default class OAuth2AuthorizationProvider extends AuthorizationProvider<
|
|
8
|
-
execute(options: AuthorizationProviderExecuteOptions<
|
|
10
|
+
export default class OAuth2AuthorizationProvider extends AuthorizationProvider<OAuth2AuthorizationProviderInput> {
|
|
11
|
+
execute(options: AuthorizationProviderExecuteOptions<OAuth2AuthorizationProviderInput>): Promise<AuthorizationResult>;
|
|
9
12
|
}
|
|
10
13
|
//# sourceMappingURL=oauth2.d.ts.map
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { AuthorizationResult } from '../types/state/authorization.interface';
|
|
2
|
-
export interface AuthorizationProviderExecuteOptions<T =
|
|
3
|
-
data: T | undefined;
|
|
2
|
+
export interface AuthorizationProviderExecuteOptions<T extends BaseAuthorizationProviderInput = BaseAuthorizationProviderInput> {
|
|
3
|
+
data: T['data'] | undefined;
|
|
4
4
|
}
|
|
5
|
-
export
|
|
5
|
+
export interface BaseAuthorizationProviderInput {
|
|
6
|
+
type: string;
|
|
7
|
+
data: unknown;
|
|
8
|
+
}
|
|
9
|
+
export declare abstract class AuthorizationProvider<T extends BaseAuthorizationProviderInput = BaseAuthorizationProviderInput> {
|
|
6
10
|
private hydrator;
|
|
7
11
|
constructor(hydrator: (data: string) => string);
|
|
8
12
|
hydrate(data: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ApiKeyAuthorizationProviderInput } from './providers/api-key';
|
|
2
|
+
import { BasicAuthorizationProviderInput } from './providers/basic';
|
|
3
|
+
import { BearerAuthorizationProviderInput } from './providers/bearer';
|
|
4
|
+
import { OAuth2AuthorizationProviderInput } from './providers/oauth2';
|
|
5
|
+
interface NoneAuthorizationProviderInput {
|
|
6
|
+
type: 'none';
|
|
7
|
+
data?: undefined;
|
|
8
|
+
}
|
|
9
|
+
export type AuthorizationProviderInput = NoneAuthorizationProviderInput | ApiKeyAuthorizationProviderInput | BasicAuthorizationProviderInput | BearerAuthorizationProviderInput | OAuth2AuthorizationProviderInput;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { AuthorizationResult } from '../../types/state/authorization.interface';
|
|
2
|
-
import { AuthorizationProvider, AuthorizationProviderExecuteOptions } from '../authorization-provider';
|
|
3
|
-
export interface
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { AuthorizationProvider, AuthorizationProviderExecuteOptions, BaseAuthorizationProviderInput } from '../authorization-provider';
|
|
3
|
+
export interface ApiKeyAuthorizationProviderInput extends BaseAuthorizationProviderInput {
|
|
4
|
+
type: 'api-key';
|
|
5
|
+
data: {
|
|
6
|
+
headerName: string;
|
|
7
|
+
headerValue: string;
|
|
8
|
+
};
|
|
6
9
|
}
|
|
7
|
-
export default class ApiKeyAuthorizationProvider extends AuthorizationProvider<
|
|
8
|
-
execute(options: AuthorizationProviderExecuteOptions<
|
|
10
|
+
export default class ApiKeyAuthorizationProvider extends AuthorizationProvider<ApiKeyAuthorizationProviderInput> {
|
|
11
|
+
execute(options: AuthorizationProviderExecuteOptions<ApiKeyAuthorizationProviderInput>): Promise<AuthorizationResult>;
|
|
9
12
|
}
|
|
10
13
|
//# sourceMappingURL=api-key.d.ts.map
|
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const authorization_provider_1 = require("../authorization-provider");
|
|
4
4
|
class ApiKeyAuthorizationProvider extends authorization_provider_1.AuthorizationProvider {
|
|
5
5
|
async execute(options) {
|
|
6
|
-
if (!options.data?.
|
|
6
|
+
if (!options.data?.headerName || !options.data?.headerValue) {
|
|
7
7
|
return {
|
|
8
8
|
headers: {},
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
return {
|
|
12
12
|
headers: {
|
|
13
|
-
[options.data.
|
|
13
|
+
[options.data.headerName]: this.hydrate(options.data.headerValue),
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
16
|
}
|
|
@@ -10,8 +10,8 @@ const api_key_1 = __importDefault(require("./api-key"));
|
|
|
10
10
|
const authProvider = new api_key_1.default((x) => x);
|
|
11
11
|
const res = await authProvider.execute({
|
|
12
12
|
data: {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
headerName: 'X-API-Key',
|
|
14
|
+
headerValue: 'api_1a2s3d4f5g6h7j8k9l0',
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
17
|
(0, globals_1.expect)(res).toEqual({
|
|
@@ -24,8 +24,8 @@ const api_key_1 = __importDefault(require("./api-key"));
|
|
|
24
24
|
const authProvider = new api_key_1.default((x) => x.replace(/(^{{)|(}}$)/g, ''));
|
|
25
25
|
const res = await authProvider.execute({
|
|
26
26
|
data: {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
headerName: 'X-API-Key',
|
|
28
|
+
headerValue: '{{api_1a2s3d4f5g6h7j8k9l0}}',
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
31
|
(0, globals_1.expect)(res).toEqual({
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { AuthorizationResult } from '../../types/state/authorization.interface';
|
|
2
2
|
import { AuthorizationProvider, AuthorizationProviderExecuteOptions } from '../authorization-provider';
|
|
3
|
-
export interface
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export interface BasicAuthorizationProviderInput {
|
|
4
|
+
type: 'basic';
|
|
5
|
+
data: {
|
|
6
|
+
username: string;
|
|
7
|
+
password: string;
|
|
8
|
+
};
|
|
6
9
|
}
|
|
7
|
-
export default class BasicAuthorizationProvider extends AuthorizationProvider<
|
|
8
|
-
execute(options: AuthorizationProviderExecuteOptions<
|
|
10
|
+
export default class BasicAuthorizationProvider extends AuthorizationProvider<BasicAuthorizationProviderInput> {
|
|
11
|
+
execute(options: AuthorizationProviderExecuteOptions<BasicAuthorizationProviderInput>): Promise<AuthorizationResult>;
|
|
9
12
|
}
|
|
10
13
|
//# sourceMappingURL=basic.d.ts.map
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { AuthorizationResult } from '../../types/state/authorization.interface';
|
|
2
2
|
import { AuthorizationProvider, AuthorizationProviderExecuteOptions } from '../authorization-provider';
|
|
3
|
-
export interface
|
|
4
|
-
|
|
3
|
+
export interface BearerAuthorizationProviderInput {
|
|
4
|
+
type: 'bearer';
|
|
5
|
+
data: {
|
|
6
|
+
token: string;
|
|
7
|
+
};
|
|
5
8
|
}
|
|
6
|
-
export default class BearerAuthorizationProvider extends AuthorizationProvider<
|
|
7
|
-
execute(options: AuthorizationProviderExecuteOptions<
|
|
9
|
+
export default class BearerAuthorizationProvider extends AuthorizationProvider<BearerAuthorizationProviderInput> {
|
|
10
|
+
execute(options: AuthorizationProviderExecuteOptions<BearerAuthorizationProviderInput>): Promise<AuthorizationResult>;
|
|
8
11
|
}
|
|
9
12
|
//# sourceMappingURL=bearer.d.ts.map
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { AccessTokenResponse } from '../../oauth2';
|
|
2
2
|
import { AuthorizationResult } from '../../types/state/authorization.interface';
|
|
3
3
|
import { AuthorizationProvider, AuthorizationProviderExecuteOptions } from '../authorization-provider';
|
|
4
|
-
export interface
|
|
5
|
-
|
|
4
|
+
export interface OAuth2AuthorizationProviderInput {
|
|
5
|
+
type: 'oauth2';
|
|
6
|
+
data: {
|
|
7
|
+
accessTokenResponse: AccessTokenResponse;
|
|
8
|
+
};
|
|
6
9
|
}
|
|
7
|
-
export default class OAuth2AuthorizationProvider extends AuthorizationProvider<
|
|
8
|
-
execute(options: AuthorizationProviderExecuteOptions<
|
|
10
|
+
export default class OAuth2AuthorizationProvider extends AuthorizationProvider<OAuth2AuthorizationProviderInput> {
|
|
11
|
+
execute(options: AuthorizationProviderExecuteOptions<OAuth2AuthorizationProviderInput>): Promise<AuthorizationResult>;
|
|
9
12
|
}
|
|
10
13
|
//# sourceMappingURL=oauth2.d.ts.map
|
|
@@ -61,8 +61,9 @@ export declare class AltairConfig {
|
|
|
61
61
|
preserveState: boolean;
|
|
62
62
|
windows: AltairWindowOptions[];
|
|
63
63
|
disableAccount: boolean;
|
|
64
|
+
initialAuthorization: import("../authorization/input").AuthorizationProviderInput | undefined;
|
|
64
65
|
};
|
|
65
|
-
constructor({ endpointURL, subscriptionsEndpoint, subscriptionsProtocol, initialQuery, initialHeaders, initialEnvironments, initialVariables, initialPreRequestScript, initialPostRequestScript, instanceStorageNamespace, initialSettings, persistedSettings, initialRequestHandlerId, initialRequestHandlerAdditionalParams, initialSubscriptionRequestHandlerId, initialSubscriptionsPayload, initialHttpMethod, preserveState, initialWindows, disableAccount, }?: AltairConfigOptions);
|
|
66
|
+
constructor({ endpointURL, subscriptionsEndpoint, subscriptionsProtocol, initialQuery, initialHeaders, initialEnvironments, initialVariables, initialPreRequestScript, initialPostRequestScript, instanceStorageNamespace, initialSettings, persistedSettings, initialRequestHandlerId, initialRequestHandlerAdditionalParams, initialSubscriptionRequestHandlerId, initialSubscriptionsPayload, initialHttpMethod, preserveState, initialWindows, disableAccount, initialAuthorization, }?: AltairConfigOptions);
|
|
66
67
|
private getPossibleLocalSandBoxUrl;
|
|
67
68
|
private getLocalSandBoxUrl;
|
|
68
69
|
getUrlConfig(environment?: ConfigEnvironment): UrlConfig;
|
|
@@ -17,7 +17,7 @@ const parseUrl = (url) => {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
class AltairConfig {
|
|
20
|
-
constructor({ endpointURL, subscriptionsEndpoint, subscriptionsProtocol, initialQuery, initialHeaders, initialEnvironments, initialVariables, initialPreRequestScript, initialPostRequestScript = '', instanceStorageNamespace, initialSettings, persistedSettings, initialRequestHandlerId = types_1.HTTP_HANDLER_ID, initialRequestHandlerAdditionalParams = {}, initialSubscriptionRequestHandlerId = types_1.WEBSOCKET_HANDLER_ID, initialSubscriptionsPayload = {}, initialHttpMethod = 'POST', preserveState = true, initialWindows = [], disableAccount = false, } = {}) {
|
|
20
|
+
constructor({ endpointURL, subscriptionsEndpoint, subscriptionsProtocol, initialQuery, initialHeaders, initialEnvironments, initialVariables, initialPreRequestScript, initialPostRequestScript = '', instanceStorageNamespace, initialSettings, persistedSettings, initialRequestHandlerId = types_1.HTTP_HANDLER_ID, initialRequestHandlerAdditionalParams = {}, initialSubscriptionRequestHandlerId = types_1.WEBSOCKET_HANDLER_ID, initialSubscriptionsPayload = {}, initialHttpMethod = 'POST', preserveState = true, initialWindows = [], disableAccount = false, initialAuthorization, } = {}) {
|
|
21
21
|
this.useLocalSandboxUrl = false;
|
|
22
22
|
this.donation = {
|
|
23
23
|
url: 'https://opencollective.com/altair/donate',
|
|
@@ -74,6 +74,7 @@ class AltairConfig {
|
|
|
74
74
|
preserveState: true,
|
|
75
75
|
windows: [],
|
|
76
76
|
disableAccount: false,
|
|
77
|
+
initialAuthorization: undefined,
|
|
77
78
|
};
|
|
78
79
|
this.initialData.url =
|
|
79
80
|
window.__ALTAIR_ENDPOINT_URL__ ?? endpointURL ?? '';
|
|
@@ -110,6 +111,7 @@ class AltairConfig {
|
|
|
110
111
|
this.initialData.preserveState = preserveState;
|
|
111
112
|
this.initialData.windows = initialWindows;
|
|
112
113
|
this.initialData.disableAccount = disableAccount;
|
|
114
|
+
this.initialData.initialAuthorization = initialAuthorization;
|
|
113
115
|
}
|
|
114
116
|
getPossibleLocalSandBoxUrl() {
|
|
115
117
|
// check document base url
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AuthorizationProviderInput } from '../authorization/input';
|
|
1
2
|
import { RequestHandlerIds } from '../request/types';
|
|
2
3
|
import { IDictionary } from '../types/shared';
|
|
3
4
|
import { IInitialEnvironments } from '../types/state/environments.interfaces';
|
|
@@ -69,6 +70,10 @@ export interface AltairWindowOptions {
|
|
|
69
70
|
* HTTP method to use for making requests
|
|
70
71
|
*/
|
|
71
72
|
initialHttpMethod?: HttpVerb;
|
|
73
|
+
/**
|
|
74
|
+
* Initial authorization type and data
|
|
75
|
+
*/
|
|
76
|
+
initialAuthorization?: AuthorizationProviderInput;
|
|
72
77
|
}
|
|
73
78
|
export interface AltairConfigOptions extends AltairWindowOptions {
|
|
74
79
|
/**
|
|
@@ -97,7 +97,7 @@ class PluginParentEngine {
|
|
|
97
97
|
const htmlClasses = Array.from(document.documentElement.classList);
|
|
98
98
|
// Get the styles that are applicable to the current theme of the page
|
|
99
99
|
// Doesn't work crossorigin cases. e.g. when loading from CDN. Fallback to theme instead.
|
|
100
|
-
const styles = getCssStyles(htmlClasses);
|
|
100
|
+
const styles = getCssStyles(htmlClasses).filter((s) => s.trim().length > 0);
|
|
101
101
|
return { styleUrls, styles, htmlClasses, theme: this.opts?.theme };
|
|
102
102
|
});
|
|
103
103
|
}
|
|
@@ -28,6 +28,8 @@ export interface ExportWindowState {
|
|
|
28
28
|
preRequestScriptEnabled?: boolean;
|
|
29
29
|
postRequestScript?: string;
|
|
30
30
|
postRequestScriptEnabled?: boolean;
|
|
31
|
+
authorizationType?: string;
|
|
32
|
+
authorizationData?: any;
|
|
31
33
|
/**
|
|
32
34
|
* ID of the collection this query belongs to
|
|
33
35
|
*/
|
package/build/config/index.d.ts
CHANGED
|
@@ -61,8 +61,9 @@ export declare class AltairConfig {
|
|
|
61
61
|
preserveState: boolean;
|
|
62
62
|
windows: AltairWindowOptions[];
|
|
63
63
|
disableAccount: boolean;
|
|
64
|
+
initialAuthorization: import("../authorization/input").AuthorizationProviderInput | undefined;
|
|
64
65
|
};
|
|
65
|
-
constructor({ endpointURL, subscriptionsEndpoint, subscriptionsProtocol, initialQuery, initialHeaders, initialEnvironments, initialVariables, initialPreRequestScript, initialPostRequestScript, instanceStorageNamespace, initialSettings, persistedSettings, initialRequestHandlerId, initialRequestHandlerAdditionalParams, initialSubscriptionRequestHandlerId, initialSubscriptionsPayload, initialHttpMethod, preserveState, initialWindows, disableAccount, }?: AltairConfigOptions);
|
|
66
|
+
constructor({ endpointURL, subscriptionsEndpoint, subscriptionsProtocol, initialQuery, initialHeaders, initialEnvironments, initialVariables, initialPreRequestScript, initialPostRequestScript, instanceStorageNamespace, initialSettings, persistedSettings, initialRequestHandlerId, initialRequestHandlerAdditionalParams, initialSubscriptionRequestHandlerId, initialSubscriptionsPayload, initialHttpMethod, preserveState, initialWindows, disableAccount, initialAuthorization, }?: AltairConfigOptions);
|
|
66
67
|
private getPossibleLocalSandBoxUrl;
|
|
67
68
|
private getLocalSandBoxUrl;
|
|
68
69
|
getUrlConfig(environment?: ConfigEnvironment): UrlConfig;
|
package/build/config/index.js
CHANGED
|
@@ -11,7 +11,7 @@ const parseUrl = (url) => {
|
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
13
|
export class AltairConfig {
|
|
14
|
-
constructor({ endpointURL, subscriptionsEndpoint, subscriptionsProtocol, initialQuery, initialHeaders, initialEnvironments, initialVariables, initialPreRequestScript, initialPostRequestScript = '', instanceStorageNamespace, initialSettings, persistedSettings, initialRequestHandlerId = HTTP_HANDLER_ID, initialRequestHandlerAdditionalParams = {}, initialSubscriptionRequestHandlerId = WEBSOCKET_HANDLER_ID, initialSubscriptionsPayload = {}, initialHttpMethod = 'POST', preserveState = true, initialWindows = [], disableAccount = false, } = {}) {
|
|
14
|
+
constructor({ endpointURL, subscriptionsEndpoint, subscriptionsProtocol, initialQuery, initialHeaders, initialEnvironments, initialVariables, initialPreRequestScript, initialPostRequestScript = '', instanceStorageNamespace, initialSettings, persistedSettings, initialRequestHandlerId = HTTP_HANDLER_ID, initialRequestHandlerAdditionalParams = {}, initialSubscriptionRequestHandlerId = WEBSOCKET_HANDLER_ID, initialSubscriptionsPayload = {}, initialHttpMethod = 'POST', preserveState = true, initialWindows = [], disableAccount = false, initialAuthorization, } = {}) {
|
|
15
15
|
this.useLocalSandboxUrl = false;
|
|
16
16
|
this.donation = {
|
|
17
17
|
url: 'https://opencollective.com/altair/donate',
|
|
@@ -68,6 +68,7 @@ export class AltairConfig {
|
|
|
68
68
|
preserveState: true,
|
|
69
69
|
windows: [],
|
|
70
70
|
disableAccount: false,
|
|
71
|
+
initialAuthorization: undefined,
|
|
71
72
|
};
|
|
72
73
|
this.initialData.url =
|
|
73
74
|
window.__ALTAIR_ENDPOINT_URL__ ?? endpointURL ?? '';
|
|
@@ -104,6 +105,7 @@ export class AltairConfig {
|
|
|
104
105
|
this.initialData.preserveState = preserveState;
|
|
105
106
|
this.initialData.windows = initialWindows;
|
|
106
107
|
this.initialData.disableAccount = disableAccount;
|
|
108
|
+
this.initialData.initialAuthorization = initialAuthorization;
|
|
107
109
|
}
|
|
108
110
|
getPossibleLocalSandBoxUrl() {
|
|
109
111
|
// check document base url
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AuthorizationProviderInput } from '../authorization/input';
|
|
1
2
|
import { RequestHandlerIds } from '../request/types';
|
|
2
3
|
import { IDictionary } from '../types/shared';
|
|
3
4
|
import { IInitialEnvironments } from '../types/state/environments.interfaces';
|
|
@@ -69,6 +70,10 @@ export interface AltairWindowOptions {
|
|
|
69
70
|
* HTTP method to use for making requests
|
|
70
71
|
*/
|
|
71
72
|
initialHttpMethod?: HttpVerb;
|
|
73
|
+
/**
|
|
74
|
+
* Initial authorization type and data
|
|
75
|
+
*/
|
|
76
|
+
initialAuthorization?: AuthorizationProviderInput;
|
|
72
77
|
}
|
|
73
78
|
export interface AltairConfigOptions extends AltairWindowOptions {
|
|
74
79
|
/**
|
|
@@ -94,7 +94,7 @@ export class PluginParentEngine {
|
|
|
94
94
|
const htmlClasses = Array.from(document.documentElement.classList);
|
|
95
95
|
// Get the styles that are applicable to the current theme of the page
|
|
96
96
|
// Doesn't work crossorigin cases. e.g. when loading from CDN. Fallback to theme instead.
|
|
97
|
-
const styles = getCssStyles(htmlClasses);
|
|
97
|
+
const styles = getCssStyles(htmlClasses).filter((s) => s.trim().length > 0);
|
|
98
98
|
return { styleUrls, styles, htmlClasses, theme: this.opts?.theme };
|
|
99
99
|
});
|
|
100
100
|
}
|
|
@@ -28,6 +28,8 @@ export interface ExportWindowState {
|
|
|
28
28
|
preRequestScriptEnabled?: boolean;
|
|
29
29
|
postRequestScript?: string;
|
|
30
30
|
postRequestScriptEnabled?: boolean;
|
|
31
|
+
authorizationType?: string;
|
|
32
|
+
authorizationData?: any;
|
|
31
33
|
/**
|
|
32
34
|
* ID of the collection this query belongs to
|
|
33
35
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "altair-graphql-core",
|
|
3
3
|
"description": "Several of the core logic for altair graphql client",
|
|
4
|
-
"version": "8.0.
|
|
4
|
+
"version": "8.0.4",
|
|
5
5
|
"author": "Samuel Imolorhe <altair@sirmuel.design> (https://sirmuel.design)",
|
|
6
6
|
"bugs": "https://github.com/altair-graphql/altair/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"test": "jest"
|
|
81
81
|
},
|
|
82
82
|
"types": "./build/index.d.ts",
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "004f645d1cae032787fccf7166dc193b775e9660"
|
|
84
84
|
}
|