@constructive-io/graphql-server 2.15.4 → 2.16.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/esm/index.js CHANGED
@@ -1,2 +1,8 @@
1
1
  export * from './server';
2
2
  export * from './schema';
3
+ // Export middleware for use in testing packages
4
+ export { createApiMiddleware, getSubdomain, getApiConfig } from './middleware/api';
5
+ export { createAuthenticateMiddleware } from './middleware/auth';
6
+ export { cors } from './middleware/cors';
7
+ export { graphile } from './middleware/graphile';
8
+ export { flush, flushService } from './middleware/flush';
@@ -58,7 +58,7 @@ export const getSubdomain = (reqDomains) => {
58
58
  };
59
59
  export const createApiMiddleware = (opts) => {
60
60
  return async (req, res, next) => {
61
- if (opts.api?.enableMetaApi === false) {
61
+ if (opts.api?.enableServicesApi === false) {
62
62
  const schemas = opts.api.exposedSchemas;
63
63
  const anonRole = opts.api.anonRole;
64
64
  const roleName = opts.api.roleName;
@@ -42,7 +42,9 @@ export const graphile = (opts) => {
42
42
  options.appendPlugins.push(PublicKeySignature(pubkey_challenge.data));
43
43
  }
44
44
  options.appendPlugins = options.appendPlugins ?? [];
45
- options.appendPlugins.push(...opts.graphile.appendPlugins);
45
+ if (opts.graphile?.appendPlugins) {
46
+ options.appendPlugins.push(...opts.graphile.appendPlugins);
47
+ }
46
48
  options.pgSettings = async function pgSettings(request) {
47
49
  const gqlReq = request;
48
50
  const settingsLabel = reqLabel(gqlReq);
@@ -72,11 +74,11 @@ export const graphile = (opts) => {
72
74
  options.graphiqlRoute = '/graphiql';
73
75
  options.graphileBuildOptions = {
74
76
  ...options.graphileBuildOptions,
75
- ...opts.graphile.graphileBuildOptions,
77
+ ...opts.graphile?.graphileBuildOptions,
76
78
  };
77
79
  const graphileOpts = {
78
80
  ...options,
79
- ...opts.graphile.overrideSettings,
81
+ ...opts.graphile?.overrideSettings,
80
82
  };
81
83
  log.info(`${label} Building PostGraphile handler key=${key} db=${dbname} schemas=${schemaLabel} role=${roleName} anon=${anonRole}`);
82
84
  const pgPool = getPgPool({
package/index.d.ts CHANGED
@@ -1,2 +1,7 @@
1
1
  export * from './server';
2
2
  export * from './schema';
3
+ export { createApiMiddleware, getSubdomain, getApiConfig } from './middleware/api';
4
+ export { createAuthenticateMiddleware } from './middleware/auth';
5
+ export { cors } from './middleware/cors';
6
+ export { graphile } from './middleware/graphile';
7
+ export { flush, flushService } from './middleware/flush';
package/index.js CHANGED
@@ -14,5 +14,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.flushService = exports.flush = exports.graphile = exports.cors = exports.createAuthenticateMiddleware = exports.getApiConfig = exports.getSubdomain = exports.createApiMiddleware = void 0;
17
18
  __exportStar(require("./server"), exports);
18
19
  __exportStar(require("./schema"), exports);
20
+ // Export middleware for use in testing packages
21
+ var api_1 = require("./middleware/api");
22
+ Object.defineProperty(exports, "createApiMiddleware", { enumerable: true, get: function () { return api_1.createApiMiddleware; } });
23
+ Object.defineProperty(exports, "getSubdomain", { enumerable: true, get: function () { return api_1.getSubdomain; } });
24
+ Object.defineProperty(exports, "getApiConfig", { enumerable: true, get: function () { return api_1.getApiConfig; } });
25
+ var auth_1 = require("./middleware/auth");
26
+ Object.defineProperty(exports, "createAuthenticateMiddleware", { enumerable: true, get: function () { return auth_1.createAuthenticateMiddleware; } });
27
+ var cors_1 = require("./middleware/cors");
28
+ Object.defineProperty(exports, "cors", { enumerable: true, get: function () { return cors_1.cors; } });
29
+ var graphile_1 = require("./middleware/graphile");
30
+ Object.defineProperty(exports, "graphile", { enumerable: true, get: function () { return graphile_1.graphile; } });
31
+ var flush_1 = require("./middleware/flush");
32
+ Object.defineProperty(exports, "flush", { enumerable: true, get: function () { return flush_1.flush; } });
33
+ Object.defineProperty(exports, "flushService", { enumerable: true, get: function () { return flush_1.flushService; } });
package/middleware/api.js CHANGED
@@ -65,7 +65,7 @@ const getSubdomain = (reqDomains) => {
65
65
  exports.getSubdomain = getSubdomain;
66
66
  const createApiMiddleware = (opts) => {
67
67
  return async (req, res, next) => {
68
- if (opts.api?.enableMetaApi === false) {
68
+ if (opts.api?.enableServicesApi === false) {
69
69
  const schemas = opts.api.exposedSchemas;
70
70
  const anonRole = opts.api.anonRole;
71
71
  const roleName = opts.api.roleName;
@@ -48,7 +48,9 @@ const graphile = (opts) => {
48
48
  options.appendPlugins.push((0, PublicKeySignature_1.default)(pubkey_challenge.data));
49
49
  }
50
50
  options.appendPlugins = options.appendPlugins ?? [];
51
- options.appendPlugins.push(...opts.graphile.appendPlugins);
51
+ if (opts.graphile?.appendPlugins) {
52
+ options.appendPlugins.push(...opts.graphile.appendPlugins);
53
+ }
52
54
  options.pgSettings = async function pgSettings(request) {
53
55
  const gqlReq = request;
54
56
  const settingsLabel = reqLabel(gqlReq);
@@ -78,11 +80,11 @@ const graphile = (opts) => {
78
80
  options.graphiqlRoute = '/graphiql';
79
81
  options.graphileBuildOptions = {
80
82
  ...options.graphileBuildOptions,
81
- ...opts.graphile.graphileBuildOptions,
83
+ ...opts.graphile?.graphileBuildOptions,
82
84
  };
83
85
  const graphileOpts = {
84
86
  ...options,
85
- ...opts.graphile.overrideSettings,
87
+ ...opts.graphile?.overrideSettings,
86
88
  };
87
89
  log.info(`${label} Building PostGraphile handler key=${key} db=${dbname} schemas=${schemaLabel} role=${roleName} anon=${anonRole}`);
88
90
  const pgPool = (0, pg_cache_1.getPgPool)({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/graphql-server",
3
- "version": "2.15.4",
3
+ "version": "2.16.0",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "Constructive GraphQL Server",
6
6
  "main": "index.js",
@@ -41,8 +41,8 @@
41
41
  "backend"
42
42
  ],
43
43
  "dependencies": {
44
- "@constructive-io/graphql-env": "^2.8.18",
45
- "@constructive-io/graphql-types": "^2.12.12",
44
+ "@constructive-io/graphql-env": "^2.8.19",
45
+ "@constructive-io/graphql-types": "^2.12.13",
46
46
  "@constructive-io/s3-utils": "^2.4.1",
47
47
  "@constructive-io/upload-names": "^2.3.6",
48
48
  "@constructive-io/url-domains": "^2.3.7",
@@ -54,15 +54,15 @@
54
54
  "express": "^5.2.1",
55
55
  "graphile-build": "^4.14.1",
56
56
  "graphile-cache": "^1.6.15",
57
- "graphile-i18n": "^0.4.12",
58
- "graphile-meta-schema": "^0.5.12",
59
- "graphile-plugin-connection-filter": "^2.6.12",
60
- "graphile-plugin-connection-filter-postgis": "^1.3.12",
61
- "graphile-plugin-fulltext-filter": "^2.3.12",
57
+ "graphile-i18n": "^0.4.14",
58
+ "graphile-meta-schema": "^0.5.14",
59
+ "graphile-plugin-connection-filter": "^2.6.14",
60
+ "graphile-plugin-connection-filter-postgis": "^1.3.14",
61
+ "graphile-plugin-fulltext-filter": "^2.3.14",
62
62
  "graphile-query": "^2.4.7",
63
- "graphile-search-plugin": "^0.4.13",
64
- "graphile-settings": "^2.12.13",
65
- "graphile-simple-inflector": "^0.4.13",
63
+ "graphile-search-plugin": "^0.4.15",
64
+ "graphile-settings": "^2.12.15",
65
+ "graphile-simple-inflector": "^0.4.15",
66
66
  "graphile-utils": "^4.14.1",
67
67
  "graphql": "15.10.1",
68
68
  "graphql-tag": "2.12.6",
@@ -82,10 +82,10 @@
82
82
  "@types/graphql-upload": "^8.0.12",
83
83
  "@types/pg": "^8.16.0",
84
84
  "@types/request-ip": "^0.0.41",
85
- "graphile-test": "2.13.12",
85
+ "graphile-test": "2.13.14",
86
86
  "makage": "^0.1.10",
87
87
  "nodemon": "^3.1.10",
88
88
  "ts-node": "^10.9.2"
89
89
  },
90
- "gitHead": "cb4af2cf6c23dad24cd951c232d3e2006b81aa3d"
90
+ "gitHead": "049ab1b8c49c5711ede9a47c8e8dbb7bbbdf5a1f"
91
91
  }