altair-static 4.4.2 → 4.5.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/dist/100.js +1 -1
- package/build/dist/3rdpartylicenses.txt +370 -0
- package/build/dist/779.js +1 -0
- package/build/dist/assets/i18n/default.json +1 -0
- package/build/dist/main.js +1 -1
- package/build/dist/styles.css +1 -1
- package/build/index.d.ts +357 -14
- package/build/index.js +91 -62
- package/package.json +9 -8
- package/src/{utils/get-altair-html.ts → get-altair-html.ts} +0 -0
- package/src/{utils/get-dist.ts → get-dist.ts} +1 -1
- package/src/index.test.ts +1 -1
- package/src/index.ts +5 -3
- package/build/index.test.d.ts +0 -2
- package/build/index.test.js +0 -67
- package/build/utils/get-altair-html.d.ts +0 -2
- package/build/utils/get-altair-html.js +0 -10
- package/build/utils/get-dist.d.ts +0 -5
- package/build/utils/get-dist.js +0 -9
package/build/index.test.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const fs_1 = require("fs");
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const index_1 = require("./index");
|
|
6
|
-
const getAltairHtml = require("./utils/get-altair-html");
|
|
7
|
-
const translateRenderedStrToObj = (result) => {
|
|
8
|
-
const resultObj = Function(`
|
|
9
|
-
let __options;
|
|
10
|
-
const AltairGraphQL = { init: (options) => { __options = options; } };
|
|
11
|
-
${result}
|
|
12
|
-
return __options;`)();
|
|
13
|
-
return resultObj;
|
|
14
|
-
};
|
|
15
|
-
describe('renderInitialOptions', () => {
|
|
16
|
-
it('should return expected string', () => {
|
|
17
|
-
const result = index_1.renderInitialOptions({
|
|
18
|
-
baseURL: '/',
|
|
19
|
-
initialQuery: `query {
|
|
20
|
-
Hello
|
|
21
|
-
}`,
|
|
22
|
-
endpointURL: 'https://example.com/graphql',
|
|
23
|
-
initialHeaders: {
|
|
24
|
-
'X-GraphQL-Token': 'asd7-237s-2bdk-nsdk4'
|
|
25
|
-
},
|
|
26
|
-
initialSettings: {
|
|
27
|
-
theme: 'dark'
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
expect(translateRenderedStrToObj(result)).toEqual({
|
|
31
|
-
initialQuery: `query {
|
|
32
|
-
Hello
|
|
33
|
-
}`,
|
|
34
|
-
endpointURL: 'https://example.com/graphql',
|
|
35
|
-
initialHeaders: {
|
|
36
|
-
'X-GraphQL-Token': 'asd7-237s-2bdk-nsdk4'
|
|
37
|
-
},
|
|
38
|
-
initialSettings: {
|
|
39
|
-
theme: 'dark'
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
expect(result).toMatchSnapshot();
|
|
43
|
-
});
|
|
44
|
-
it('should render boolean values correctly', () => {
|
|
45
|
-
const result = index_1.renderInitialOptions({
|
|
46
|
-
preserveState: false,
|
|
47
|
-
});
|
|
48
|
-
expect(translateRenderedStrToObj(result)).toEqual({
|
|
49
|
-
preserveState: false,
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
describe('renderAltair', () => {
|
|
54
|
-
it('should return expected string', () => {
|
|
55
|
-
getAltairHtml.default = jest.fn();
|
|
56
|
-
getAltairHtml.default.mockReturnValue(fs_1.readFileSync(path_1.resolve(__dirname, 'index.html'), 'utf8'));
|
|
57
|
-
expect(index_1.renderAltair({
|
|
58
|
-
baseURL: '/',
|
|
59
|
-
initialQuery: `query {
|
|
60
|
-
Hello
|
|
61
|
-
}`,
|
|
62
|
-
endpointURL: 'https://example.com/graphql',
|
|
63
|
-
initialVariables: '{ variable: 1 }'
|
|
64
|
-
})).toMatchSnapshot();
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
//# sourceMappingURL=index.test.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const fs_1 = require("fs");
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const get_dist_1 = require("./get-dist");
|
|
6
|
-
function getAltairHtml() {
|
|
7
|
-
return fs_1.readFileSync(path_1.resolve(get_dist_1.getDistDirectory(), 'index.html'), 'utf8');
|
|
8
|
-
}
|
|
9
|
-
exports.default = getAltairHtml;
|
|
10
|
-
//# sourceMappingURL=get-altair-html.js.map
|
package/build/utils/get-dist.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDistDirectory = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
/**
|
|
6
|
-
* Returns the path to Altair assets, for resolving the assets when rendering Altair
|
|
7
|
-
*/
|
|
8
|
-
exports.getDistDirectory = () => path_1.resolve(__dirname, '../dist');
|
|
9
|
-
//# sourceMappingURL=get-dist.js.map
|