@constructive-io/graphql-server 2.10.10 → 2.10.12
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/run.js +1 -5
- package/esm/scripts/create-bucket.js +13 -14
- package/esm/server.js +10 -2
- package/package.json +11 -12
- package/run.js +1 -5
- package/scripts/create-bucket.d.ts +1 -1
- package/scripts/create-bucket.js +13 -14
- package/server.d.ts +0 -1
- package/server.js +10 -2
package/esm/run.js
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
// Minimal script to create a bucket in MinIO using @constructive-io/s3-utils
|
|
2
2
|
// Avoid strict type coupling between different @aws-sdk/client-s3 versions
|
|
3
|
-
// Loads graphql/server/.env by default when running via ts-node from this workspace
|
|
4
|
-
import 'dotenv/config';
|
|
5
3
|
import { S3Client } from '@aws-sdk/client-s3';
|
|
6
4
|
import { createS3Bucket } from '@constructive-io/s3-utils';
|
|
7
|
-
|
|
8
|
-
const REGION = process.env.AWS_REGION || 'us-east-1';
|
|
9
|
-
const ACCESS_KEY = process.env.AWS_ACCESS_KEY || process.env.AWS_ACCESS_KEY_ID || 'minioadmin';
|
|
10
|
-
const SECRET_KEY = process.env.AWS_SECRET_KEY ||
|
|
11
|
-
process.env.AWS_SECRET_ACCESS_KEY ||
|
|
12
|
-
'minioadmin';
|
|
13
|
-
const ENDPOINT = process.env.MINIO_ENDPOINT || 'http://localhost:9000';
|
|
5
|
+
import { getEnvOptions } from '@constructive-io/graphql-env';
|
|
14
6
|
(async () => {
|
|
15
7
|
try {
|
|
8
|
+
const opts = getEnvOptions();
|
|
9
|
+
const { cdn } = opts;
|
|
10
|
+
const bucket = cdn?.bucketName || 'test-bucket';
|
|
11
|
+
const region = cdn?.awsRegion || 'us-east-1';
|
|
12
|
+
const accessKey = cdn?.awsAccessKey || 'minioadmin';
|
|
13
|
+
const secretKey = cdn?.awsSecretKey || 'minioadmin';
|
|
14
|
+
const endpoint = cdn?.minioEndpoint || 'http://localhost:9000';
|
|
16
15
|
const client = new S3Client({
|
|
17
|
-
region
|
|
18
|
-
credentials: { accessKeyId:
|
|
19
|
-
endpoint
|
|
16
|
+
region,
|
|
17
|
+
credentials: { accessKeyId: accessKey, secretAccessKey: secretKey },
|
|
18
|
+
endpoint,
|
|
20
19
|
forcePathStyle: true,
|
|
21
20
|
});
|
|
22
21
|
// Hint downstream to apply MinIO policies
|
|
23
22
|
process.env.IS_MINIO = 'true';
|
|
24
|
-
const res = await createS3Bucket(client,
|
|
25
|
-
console.log(`[create-bucket] ${
|
|
23
|
+
const res = await createS3Bucket(client, bucket);
|
|
24
|
+
console.log(`[create-bucket] ${bucket}:`, res);
|
|
26
25
|
client.destroy();
|
|
27
26
|
}
|
|
28
27
|
catch (e) {
|
package/esm/server.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import 'dotenv/config';
|
|
2
1
|
import { getEnvOptions } from '@constructive-io/graphql-env';
|
|
3
2
|
import { Logger } from '@pgpmjs/logger';
|
|
4
3
|
import { healthz, poweredBy, trustProxy } from '@pgpmjs/server-utils';
|
|
@@ -53,7 +52,16 @@ class Server {
|
|
|
53
52
|
}
|
|
54
53
|
listen() {
|
|
55
54
|
const { server } = this.opts;
|
|
56
|
-
this.app.listen(server?.port, server?.host, () => log.info(`listening at http://${server?.host}:${server?.port}`));
|
|
55
|
+
const httpServer = this.app.listen(server?.port, server?.host, () => log.info(`listening at http://${server?.host}:${server?.port}`));
|
|
56
|
+
httpServer.on('error', (err) => {
|
|
57
|
+
if (err.code === 'EADDRINUSE') {
|
|
58
|
+
this.error(`Port ${server?.port ?? 'unknown'} is already in use`, err);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.error('Server failed to start', err);
|
|
62
|
+
}
|
|
63
|
+
throw err;
|
|
64
|
+
});
|
|
57
65
|
}
|
|
58
66
|
async flush(databaseId) {
|
|
59
67
|
await flushService(this.opts, databaseId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/graphql-server",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.12",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "Constructive GraphQL Server",
|
|
6
6
|
"main": "index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"backend"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@constructive-io/graphql-env": "^2.8.
|
|
42
|
+
"@constructive-io/graphql-env": "^2.8.8",
|
|
43
43
|
"@constructive-io/graphql-types": "^2.12.6",
|
|
44
44
|
"@constructive-io/s3-utils": "^2.3.6",
|
|
45
45
|
"@constructive-io/upload-names": "^2.3.4",
|
|
@@ -49,19 +49,18 @@
|
|
|
49
49
|
"@pgpmjs/server-utils": "^2.8.8",
|
|
50
50
|
"@pgpmjs/types": "^2.12.6",
|
|
51
51
|
"cors": "^2.8.5",
|
|
52
|
-
"dotenv": "^17.2.3",
|
|
53
52
|
"express": "^5.1.0",
|
|
54
53
|
"graphile-build": "^4.14.1",
|
|
55
54
|
"graphile-cache": "^1.6.8",
|
|
56
|
-
"graphile-i18n": "^0.2.
|
|
57
|
-
"graphile-meta-schema": "^0.3.
|
|
58
|
-
"graphile-plugin-connection-filter": "^2.4.
|
|
59
|
-
"graphile-plugin-connection-filter-postgis": "^1.1.
|
|
60
|
-
"graphile-plugin-fulltext-filter": "^2.1.
|
|
55
|
+
"graphile-i18n": "^0.2.17",
|
|
56
|
+
"graphile-meta-schema": "^0.3.17",
|
|
57
|
+
"graphile-plugin-connection-filter": "^2.4.17",
|
|
58
|
+
"graphile-plugin-connection-filter-postgis": "^1.1.17",
|
|
59
|
+
"graphile-plugin-fulltext-filter": "^2.1.17",
|
|
61
60
|
"graphile-query": "^2.4.6",
|
|
62
|
-
"graphile-search-plugin": "^0.2.
|
|
63
|
-
"graphile-settings": "^2.9.
|
|
64
|
-
"graphile-simple-inflector": "^0.2.
|
|
61
|
+
"graphile-search-plugin": "^0.2.17",
|
|
62
|
+
"graphile-settings": "^2.9.12",
|
|
63
|
+
"graphile-simple-inflector": "^0.2.17",
|
|
65
64
|
"graphile-utils": "^4.14.1",
|
|
66
65
|
"graphql": "15.10.1",
|
|
67
66
|
"graphql-tag": "2.12.6",
|
|
@@ -84,5 +83,5 @@
|
|
|
84
83
|
"nodemon": "^3.1.10",
|
|
85
84
|
"ts-node": "^10.9.2"
|
|
86
85
|
},
|
|
87
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "9a4f31663554bed9c6cc785a3eb283d0a5d27620"
|
|
88
87
|
}
|
package/run.js
CHANGED
|
@@ -3,8 +3,4 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const graphql_env_1 = require("@constructive-io/graphql-env");
|
|
5
5
|
const server_1 = require("./server");
|
|
6
|
-
(0, server_1.GraphQLServer)((0, graphql_env_1.getEnvOptions)(
|
|
7
|
-
pg: {
|
|
8
|
-
database: process.env.PGDATABASE,
|
|
9
|
-
},
|
|
10
|
-
}));
|
|
6
|
+
(0, server_1.GraphQLServer)((0, graphql_env_1.getEnvOptions)());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
package/scripts/create-bucket.js
CHANGED
|
@@ -2,29 +2,28 @@
|
|
|
2
2
|
// Minimal script to create a bucket in MinIO using @constructive-io/s3-utils
|
|
3
3
|
// Avoid strict type coupling between different @aws-sdk/client-s3 versions
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
// Loads graphql/server/.env by default when running via ts-node from this workspace
|
|
6
|
-
require("dotenv/config");
|
|
7
5
|
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
8
6
|
const s3_utils_1 = require("@constructive-io/s3-utils");
|
|
9
|
-
const
|
|
10
|
-
const REGION = process.env.AWS_REGION || 'us-east-1';
|
|
11
|
-
const ACCESS_KEY = process.env.AWS_ACCESS_KEY || process.env.AWS_ACCESS_KEY_ID || 'minioadmin';
|
|
12
|
-
const SECRET_KEY = process.env.AWS_SECRET_KEY ||
|
|
13
|
-
process.env.AWS_SECRET_ACCESS_KEY ||
|
|
14
|
-
'minioadmin';
|
|
15
|
-
const ENDPOINT = process.env.MINIO_ENDPOINT || 'http://localhost:9000';
|
|
7
|
+
const graphql_env_1 = require("@constructive-io/graphql-env");
|
|
16
8
|
(async () => {
|
|
17
9
|
try {
|
|
10
|
+
const opts = (0, graphql_env_1.getEnvOptions)();
|
|
11
|
+
const { cdn } = opts;
|
|
12
|
+
const bucket = cdn?.bucketName || 'test-bucket';
|
|
13
|
+
const region = cdn?.awsRegion || 'us-east-1';
|
|
14
|
+
const accessKey = cdn?.awsAccessKey || 'minioadmin';
|
|
15
|
+
const secretKey = cdn?.awsSecretKey || 'minioadmin';
|
|
16
|
+
const endpoint = cdn?.minioEndpoint || 'http://localhost:9000';
|
|
18
17
|
const client = new client_s3_1.S3Client({
|
|
19
|
-
region
|
|
20
|
-
credentials: { accessKeyId:
|
|
21
|
-
endpoint
|
|
18
|
+
region,
|
|
19
|
+
credentials: { accessKeyId: accessKey, secretAccessKey: secretKey },
|
|
20
|
+
endpoint,
|
|
22
21
|
forcePathStyle: true,
|
|
23
22
|
});
|
|
24
23
|
// Hint downstream to apply MinIO policies
|
|
25
24
|
process.env.IS_MINIO = 'true';
|
|
26
|
-
const res = await (0, s3_utils_1.createS3Bucket)(client,
|
|
27
|
-
console.log(`[create-bucket] ${
|
|
25
|
+
const res = await (0, s3_utils_1.createS3Bucket)(client, bucket);
|
|
26
|
+
console.log(`[create-bucket] ${bucket}:`, res);
|
|
28
27
|
client.destroy();
|
|
29
28
|
}
|
|
30
29
|
catch (e) {
|
package/server.d.ts
CHANGED
package/server.js
CHANGED
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Server = exports.GraphQLServer = void 0;
|
|
7
|
-
require("dotenv/config");
|
|
8
7
|
const graphql_env_1 = require("@constructive-io/graphql-env");
|
|
9
8
|
const logger_1 = require("@pgpmjs/logger");
|
|
10
9
|
const server_utils_1 = require("@pgpmjs/server-utils");
|
|
@@ -60,7 +59,16 @@ class Server {
|
|
|
60
59
|
}
|
|
61
60
|
listen() {
|
|
62
61
|
const { server } = this.opts;
|
|
63
|
-
this.app.listen(server?.port, server?.host, () => log.info(`listening at http://${server?.host}:${server?.port}`));
|
|
62
|
+
const httpServer = this.app.listen(server?.port, server?.host, () => log.info(`listening at http://${server?.host}:${server?.port}`));
|
|
63
|
+
httpServer.on('error', (err) => {
|
|
64
|
+
if (err.code === 'EADDRINUSE') {
|
|
65
|
+
this.error(`Port ${server?.port ?? 'unknown'} is already in use`, err);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
this.error('Server failed to start', err);
|
|
69
|
+
}
|
|
70
|
+
throw err;
|
|
71
|
+
});
|
|
64
72
|
}
|
|
65
73
|
async flush(databaseId) {
|
|
66
74
|
await (0, flush_1.flushService)(this.opts, databaseId);
|