altair-graphql-core 8.3.0 → 8.4.1
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/.turbo/turbo-bootstrap.log +2 -2
- package/build/ai/constants.d.ts +1 -1
- package/build/ai/constants.js +1 -1
- package/build/authorization/providers/basic.js +1 -1
- package/build/cjs/ai/constants.d.ts +1 -1
- package/build/cjs/ai/constants.js +1 -1
- package/build/cjs/authorization/providers/basic.js +1 -24
- package/build/cjs/config/index.d.ts +1 -1
- package/build/cjs/config/index.js +8 -6
- package/build/cjs/oauth2/helpers.spec.js +1 -1
- package/build/cjs/script/context.js +17 -7
- package/build/cjs/types/state/local.interfaces.d.ts +17 -0
- package/build/cjs/types/state/workspace.interface.d.ts +2 -2
- package/build/config/index.d.ts +1 -1
- package/build/config/index.js +8 -6
- package/build/oauth2/helpers.spec.js +1 -1
- package/build/types/state/local.interfaces.d.ts +17 -0
- package/build/types/state/workspace.interface.d.ts +2 -2
- package/package.json +7 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> altair-graphql-core@8.
|
|
2
|
+
> altair-graphql-core@8.4.1 bootstrap /home/runner/work/altair/altair/packages/altair-core
|
|
3
3
|
> pnpm build
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> altair-graphql-core@8.
|
|
6
|
+
> altair-graphql-core@8.4.1 build /home/runner/work/altair/altair/packages/altair-core
|
|
7
7
|
> node ./scripts/build.js
|
|
8
8
|
|
|
9
9
|
Generating types for partial-settings ...
|
package/build/ai/constants.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ export declare const maxGraphqlQueryTokens = 1000;
|
|
|
8
8
|
export declare const maxGraphqlQueryChars: number;
|
|
9
9
|
export declare const maxGraphqlVariablesTokens = 150;
|
|
10
10
|
export declare const maxGraphqlVariablesChars: number;
|
|
11
|
-
export declare const responseMaxTokens =
|
|
11
|
+
export declare const responseMaxTokens = 2500;
|
|
12
12
|
//# sourceMappingURL=constants.d.ts.map
|
package/build/ai/constants.js
CHANGED
|
@@ -10,5 +10,5 @@ export const maxGraphqlQueryTokens = 1000;
|
|
|
10
10
|
export const maxGraphqlQueryChars = maxGraphqlQueryTokens * avgCharsPerToken;
|
|
11
11
|
export const maxGraphqlVariablesTokens = 150;
|
|
12
12
|
export const maxGraphqlVariablesChars = maxGraphqlVariablesTokens * avgCharsPerToken;
|
|
13
|
-
export const responseMaxTokens =
|
|
13
|
+
export const responseMaxTokens = 2500;
|
|
14
14
|
//# sourceMappingURL=constants.js.map
|
|
@@ -8,7 +8,7 @@ export default class BasicAuthorizationProvider extends AuthorizationProvider {
|
|
|
8
8
|
}
|
|
9
9
|
return {
|
|
10
10
|
headers: {
|
|
11
|
-
Authorization: `Basic ${
|
|
11
|
+
Authorization: `Basic ${btoa(`${this.hydrate(options.data.username)}:${this.hydrate(options.data.password)}`)}`,
|
|
12
12
|
},
|
|
13
13
|
};
|
|
14
14
|
}
|
|
@@ -8,5 +8,5 @@ export declare const maxGraphqlQueryTokens = 1000;
|
|
|
8
8
|
export declare const maxGraphqlQueryChars: number;
|
|
9
9
|
export declare const maxGraphqlVariablesTokens = 150;
|
|
10
10
|
export declare const maxGraphqlVariablesChars: number;
|
|
11
|
-
export declare const responseMaxTokens =
|
|
11
|
+
export declare const responseMaxTokens = 2500;
|
|
12
12
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -13,5 +13,5 @@ exports.maxGraphqlQueryTokens = 1000;
|
|
|
13
13
|
exports.maxGraphqlQueryChars = exports.maxGraphqlQueryTokens * avgCharsPerToken;
|
|
14
14
|
exports.maxGraphqlVariablesTokens = 150;
|
|
15
15
|
exports.maxGraphqlVariablesChars = exports.maxGraphqlVariablesTokens * avgCharsPerToken;
|
|
16
|
-
exports.responseMaxTokens =
|
|
16
|
+
exports.responseMaxTokens = 2500;
|
|
17
17
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
const authorization_provider_1 = require("../authorization-provider");
|
|
27
4
|
class BasicAuthorizationProvider extends authorization_provider_1.AuthorizationProvider {
|
|
@@ -33,7 +10,7 @@ class BasicAuthorizationProvider extends authorization_provider_1.AuthorizationP
|
|
|
33
10
|
}
|
|
34
11
|
return {
|
|
35
12
|
headers: {
|
|
36
|
-
Authorization: `Basic ${
|
|
13
|
+
Authorization: `Basic ${btoa(`${this.hydrate(options.data.username)}:${this.hydrate(options.data.password)}`)}`,
|
|
37
14
|
},
|
|
38
15
|
};
|
|
39
16
|
}
|
|
@@ -66,7 +66,7 @@ export declare class AltairConfig {
|
|
|
66
66
|
initialAuthorization: AltairConfigOptions["initialAuthorization"];
|
|
67
67
|
};
|
|
68
68
|
constructor({ endpointURL, subscriptionsEndpoint, subscriptionsProtocol, initialQuery, initialHeaders, initialEnvironments, initialVariables, initialPreRequestScript, initialPostRequestScript, instanceStorageNamespace, initialSettings, persistedSettings, initialRequestHandlerId, initialRequestHandlerAdditionalParams, initialSubscriptionRequestHandlerId, initialSubscriptionsPayload, initialHttpMethod, preserveState, initialWindows, disableAccount, initialAuthorization, cspNonce, }?: AltairConfigOptions);
|
|
69
|
-
private
|
|
69
|
+
private getPossibleLocalSandBoxRoot;
|
|
70
70
|
private getLocalSandBoxUrl;
|
|
71
71
|
getUrlConfig(environment?: ConfigEnvironment): UrlConfig;
|
|
72
72
|
getUrlConfigWithLocal(environment?: ConfigEnvironment): Promise<UrlConfig>;
|
|
@@ -116,7 +116,7 @@ class AltairConfig {
|
|
|
116
116
|
this.initialData.disableAccount = disableAccount;
|
|
117
117
|
this.initialData.initialAuthorization = initialAuthorization;
|
|
118
118
|
}
|
|
119
|
-
|
|
119
|
+
getPossibleLocalSandBoxRoot() {
|
|
120
120
|
if (crx_1.isExtension) {
|
|
121
121
|
// we only support mv3 extensions now
|
|
122
122
|
// and mv3 extensions doesn't allow using iframe
|
|
@@ -132,20 +132,22 @@ class AltairConfig {
|
|
|
132
132
|
parseUrl(document.baseURI)?.origin === window.location.origin) {
|
|
133
133
|
// add iframe-sandbox path to base url
|
|
134
134
|
if (document.baseURI.endsWith('/')) {
|
|
135
|
-
return new URL(document.baseURI + 'iframe-sandbox
|
|
135
|
+
return new URL(document.baseURI + 'iframe-sandbox');
|
|
136
136
|
}
|
|
137
137
|
else {
|
|
138
138
|
// remove the last part of the url
|
|
139
139
|
return new URL(document.baseURI.slice(0, document.baseURI.lastIndexOf('/') + 1) +
|
|
140
|
-
'iframe-sandbox
|
|
140
|
+
'iframe-sandbox');
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
async getLocalSandBoxUrl() {
|
|
145
145
|
if (typeof this.localSandboxUrl === 'undefined') {
|
|
146
|
-
|
|
147
|
-
if (
|
|
148
|
-
|
|
146
|
+
const localSandboxRoot = this.getPossibleLocalSandBoxRoot()?.href ?? '';
|
|
147
|
+
if (localSandboxRoot) {
|
|
148
|
+
this.localSandboxUrl = localSandboxRoot + '/index.html';
|
|
149
|
+
const localSandboxTestUrl = localSandboxRoot + '/sandbox.png';
|
|
150
|
+
const res = await fetch(localSandboxTestUrl);
|
|
149
151
|
if (res.ok) {
|
|
150
152
|
this.useLocalSandboxUrl = true;
|
|
151
153
|
}
|
|
@@ -22,7 +22,7 @@ const helpers_1 = require("./helpers");
|
|
|
22
22
|
});
|
|
23
23
|
(0, globals_1.describe)('base64UrlEncode', () => {
|
|
24
24
|
(0, globals_1.it)('should encode a string to base64url', () => {
|
|
25
|
-
const out = (0, helpers_1.base64UrlEncode)(new TextEncoder().encode('hello world'));
|
|
25
|
+
const out = (0, helpers_1.base64UrlEncode)(new TextEncoder().encode('hello world').buffer);
|
|
26
26
|
(0, globals_1.expect)(out).toBe('aGVsbG8gd29ybGQ');
|
|
27
27
|
});
|
|
28
28
|
});
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.getGlobalContext = exports.importModuleHelper = exports.buildContextResponse = exports.ModuleImports = void 0;
|
|
27
37
|
const types_1 = require("./types");
|
|
@@ -24,10 +24,27 @@ export interface V3PluginStateEntry {
|
|
|
24
24
|
engine: PluginParentEngine;
|
|
25
25
|
isActive?: boolean;
|
|
26
26
|
}
|
|
27
|
+
export interface LoadingRequestStateEntry {
|
|
28
|
+
name: string;
|
|
29
|
+
id: string;
|
|
30
|
+
state: 'done' | 'error' | 'active' | 'pending';
|
|
31
|
+
source: 'collection' | 'window';
|
|
32
|
+
sourceId: string;
|
|
33
|
+
type: 'pre-request' | 'post-request' | 'query' | 'auth';
|
|
34
|
+
}
|
|
35
|
+
export interface TemporaryWindowStateEntry {
|
|
36
|
+
windowId: string;
|
|
37
|
+
loadingRequestState: LoadingRequestStateEntry[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* State for local (session) data.
|
|
41
|
+
* This would contain arbitrary global data that should be stored in memory and not persisted
|
|
42
|
+
*/
|
|
27
43
|
export interface LocalState {
|
|
28
44
|
closedWindows: PerWindowState[];
|
|
29
45
|
installedPlugins: IDictionary<V1PluginStateEntry | V3PluginStateEntry>;
|
|
30
46
|
panels: AltairPanel[];
|
|
31
47
|
uiActions: AltairUiAction[];
|
|
48
|
+
temporaryWindowStates: IDictionary<TemporaryWindowStateEntry>;
|
|
32
49
|
}
|
|
33
50
|
//# sourceMappingURL=local.interfaces.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ValueObject } from '../../utils/value-object';
|
|
2
2
|
export declare const WORKSPACES: {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
LOCAL: string;
|
|
4
|
+
REMOTE: string;
|
|
5
5
|
};
|
|
6
6
|
export declare class WorkspaceId extends ValueObject<string> {
|
|
7
7
|
constructor(props?: string);
|
package/build/config/index.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export declare class AltairConfig {
|
|
|
66
66
|
initialAuthorization: AltairConfigOptions["initialAuthorization"];
|
|
67
67
|
};
|
|
68
68
|
constructor({ endpointURL, subscriptionsEndpoint, subscriptionsProtocol, initialQuery, initialHeaders, initialEnvironments, initialVariables, initialPreRequestScript, initialPostRequestScript, instanceStorageNamespace, initialSettings, persistedSettings, initialRequestHandlerId, initialRequestHandlerAdditionalParams, initialSubscriptionRequestHandlerId, initialSubscriptionsPayload, initialHttpMethod, preserveState, initialWindows, disableAccount, initialAuthorization, cspNonce, }?: AltairConfigOptions);
|
|
69
|
-
private
|
|
69
|
+
private getPossibleLocalSandBoxRoot;
|
|
70
70
|
private getLocalSandBoxUrl;
|
|
71
71
|
getUrlConfig(environment?: ConfigEnvironment): UrlConfig;
|
|
72
72
|
getUrlConfigWithLocal(environment?: ConfigEnvironment): Promise<UrlConfig>;
|
package/build/config/index.js
CHANGED
|
@@ -110,7 +110,7 @@ export class AltairConfig {
|
|
|
110
110
|
this.initialData.disableAccount = disableAccount;
|
|
111
111
|
this.initialData.initialAuthorization = initialAuthorization;
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
getPossibleLocalSandBoxRoot() {
|
|
114
114
|
if (isExtension) {
|
|
115
115
|
// we only support mv3 extensions now
|
|
116
116
|
// and mv3 extensions doesn't allow using iframe
|
|
@@ -126,20 +126,22 @@ export class AltairConfig {
|
|
|
126
126
|
parseUrl(document.baseURI)?.origin === window.location.origin) {
|
|
127
127
|
// add iframe-sandbox path to base url
|
|
128
128
|
if (document.baseURI.endsWith('/')) {
|
|
129
|
-
return new URL(document.baseURI + 'iframe-sandbox
|
|
129
|
+
return new URL(document.baseURI + 'iframe-sandbox');
|
|
130
130
|
}
|
|
131
131
|
else {
|
|
132
132
|
// remove the last part of the url
|
|
133
133
|
return new URL(document.baseURI.slice(0, document.baseURI.lastIndexOf('/') + 1) +
|
|
134
|
-
'iframe-sandbox
|
|
134
|
+
'iframe-sandbox');
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
async getLocalSandBoxUrl() {
|
|
139
139
|
if (typeof this.localSandboxUrl === 'undefined') {
|
|
140
|
-
|
|
141
|
-
if (
|
|
142
|
-
|
|
140
|
+
const localSandboxRoot = this.getPossibleLocalSandBoxRoot()?.href ?? '';
|
|
141
|
+
if (localSandboxRoot) {
|
|
142
|
+
this.localSandboxUrl = localSandboxRoot + '/index.html';
|
|
143
|
+
const localSandboxTestUrl = localSandboxRoot + '/sandbox.png';
|
|
144
|
+
const res = await fetch(localSandboxTestUrl);
|
|
143
145
|
if (res.ok) {
|
|
144
146
|
this.useLocalSandboxUrl = true;
|
|
145
147
|
}
|
|
@@ -20,7 +20,7 @@ describe('oauth2 helpers', () => {
|
|
|
20
20
|
});
|
|
21
21
|
describe('base64UrlEncode', () => {
|
|
22
22
|
it('should encode a string to base64url', () => {
|
|
23
|
-
const out = base64UrlEncode(new TextEncoder().encode('hello world'));
|
|
23
|
+
const out = base64UrlEncode(new TextEncoder().encode('hello world').buffer);
|
|
24
24
|
expect(out).toBe('aGVsbG8gd29ybGQ');
|
|
25
25
|
});
|
|
26
26
|
});
|
|
@@ -24,10 +24,27 @@ export interface V3PluginStateEntry {
|
|
|
24
24
|
engine: PluginParentEngine;
|
|
25
25
|
isActive?: boolean;
|
|
26
26
|
}
|
|
27
|
+
export interface LoadingRequestStateEntry {
|
|
28
|
+
name: string;
|
|
29
|
+
id: string;
|
|
30
|
+
state: 'done' | 'error' | 'active' | 'pending';
|
|
31
|
+
source: 'collection' | 'window';
|
|
32
|
+
sourceId: string;
|
|
33
|
+
type: 'pre-request' | 'post-request' | 'query' | 'auth';
|
|
34
|
+
}
|
|
35
|
+
export interface TemporaryWindowStateEntry {
|
|
36
|
+
windowId: string;
|
|
37
|
+
loadingRequestState: LoadingRequestStateEntry[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* State for local (session) data.
|
|
41
|
+
* This would contain arbitrary global data that should be stored in memory and not persisted
|
|
42
|
+
*/
|
|
27
43
|
export interface LocalState {
|
|
28
44
|
closedWindows: PerWindowState[];
|
|
29
45
|
installedPlugins: IDictionary<V1PluginStateEntry | V3PluginStateEntry>;
|
|
30
46
|
panels: AltairPanel[];
|
|
31
47
|
uiActions: AltairUiAction[];
|
|
48
|
+
temporaryWindowStates: IDictionary<TemporaryWindowStateEntry>;
|
|
32
49
|
}
|
|
33
50
|
//# sourceMappingURL=local.interfaces.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ValueObject } from '../../utils/value-object';
|
|
2
2
|
export declare const WORKSPACES: {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
LOCAL: string;
|
|
4
|
+
REMOTE: string;
|
|
5
5
|
};
|
|
6
6
|
export declare class WorkspaceId extends ValueObject<string> {
|
|
7
7
|
constructor(props?: string);
|
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.
|
|
4
|
+
"version": "8.4.1",
|
|
5
5
|
"author": "Samuel Imolorhe <altair@sirmuel.design> (https://sirmuel.design)",
|
|
6
6
|
"bugs": "https://github.com/altair-graphql/altair/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -54,13 +54,14 @@
|
|
|
54
54
|
"eslint-config-prettier": "^9.1.0",
|
|
55
55
|
"eslint-plugin-prettier": "^5.1.3",
|
|
56
56
|
"jest": "^29.7.0",
|
|
57
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
57
58
|
"msw": "^2.3.1",
|
|
58
59
|
"prettier": "^3.2.5",
|
|
59
60
|
"react": "17.0.2",
|
|
60
61
|
"shx": "^0.3.4",
|
|
61
62
|
"ts-jest": "^29.1.2",
|
|
62
63
|
"ts-node": "9.1.1",
|
|
63
|
-
"typescript": "^5.
|
|
64
|
+
"typescript": "^5.8.0",
|
|
64
65
|
"typescript-json-schema": "0.50.1",
|
|
65
66
|
"undici": "^6.19.1"
|
|
66
67
|
},
|
|
@@ -80,6 +81,10 @@
|
|
|
80
81
|
"main": "./build/index.js",
|
|
81
82
|
"repository": "altair-graphql/altair.git",
|
|
82
83
|
"types": "./build/index.d.ts",
|
|
84
|
+
"publishConfig": {
|
|
85
|
+
"access": "public",
|
|
86
|
+
"provenance": true
|
|
87
|
+
},
|
|
83
88
|
"scripts": {
|
|
84
89
|
"build": "node ./scripts/build.js",
|
|
85
90
|
"bootstrap": "pnpm build",
|