altair-fastify-plugin 4.3.1 → 4.4.2

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.
Files changed (2) hide show
  1. package/dist/index.js +12 -5
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -5,19 +5,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const altair_static_1 = require("altair-static");
7
7
  const fastify_plugin_1 = __importDefault(require("fastify-plugin"));
8
- const fastify_static_1 = __importDefault(require("fastify-static"));
8
+ const static_1 = __importDefault(require("@fastify/static"));
9
9
  const fastifyAltairPlugin = (fastify, { path = '/altair', baseURL = '/altair/', endpointURL = '/graphql', ...renderOptions } = {}, done) => {
10
- fastify.register(fastify_static_1.default, {
11
- root: altair_static_1.getDistDirectory(),
10
+ fastify.register(static_1.default, {
11
+ root: (0, altair_static_1.getDistDirectory)(),
12
12
  prefix: baseURL,
13
13
  });
14
- const altairPage = altair_static_1.renderAltair({ baseURL, endpointURL, ...renderOptions });
14
+ const altairPage = (0, altair_static_1.renderAltair)({ baseURL, endpointURL, ...renderOptions });
15
15
  fastify.get(path, (_req, res) => {
16
16
  res.type('text/html').send(altairPage);
17
17
  });
18
+ if (renderOptions.serveInitialOptionsInSeperateRequest) {
19
+ const initialOptions = (0, altair_static_1.renderInitialOptions)(renderOptions);
20
+ const initOptPath = path + '/initial_options.js';
21
+ fastify.get(initOptPath, (_req, res) => {
22
+ res.type('application/javascript').send(initialOptions);
23
+ });
24
+ }
18
25
  done();
19
26
  };
20
- exports.default = fastify_plugin_1.default(fastifyAltairPlugin, {
27
+ exports.default = (0, fastify_plugin_1.default)(fastifyAltairPlugin, {
21
28
  fastify: '>= 3.x',
22
29
  name: 'altair-fastify-plugin',
23
30
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "altair-fastify-plugin",
3
- "version": "4.3.1",
3
+ "version": "4.4.2",
4
4
  "description": "Fastify Plugin of Altair GraphQL Client",
5
5
  "keywords": [
6
6
  "graphql",
@@ -31,12 +31,12 @@
31
31
  "test": "echo \"Error: no test specified\" && exit 0"
32
32
  },
33
33
  "dependencies": {
34
- "altair-static": "^4.3.1",
35
- "fastify-plugin": "^2.3.4",
36
- "fastify-static": "^3.2.1"
34
+ "@fastify/static": "^5.0.0",
35
+ "altair-static": "^4.4.2",
36
+ "fastify-plugin": "^2.3.4"
37
37
  },
38
38
  "devDependencies": {
39
- "fastify": "^3.5.1",
39
+ "fastify": "^3.29.0",
40
40
  "mercurius": "^6.0.0",
41
41
  "ts-node": "^9.0.0",
42
42
  "typescript": "^4.0.3"
@@ -44,5 +44,5 @@
44
44
  "peerDependencies": {
45
45
  "fastify": "^3.1.1"
46
46
  },
47
- "gitHead": "a3015132ac38bd025ef6a7ba46f1ed36f1508a57"
47
+ "gitHead": "44bf6dbb486b9afb51be1cb56228903346f515d4"
48
48
  }