@constructive-io/graphql-server 2.10.35 → 2.11.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/scripts/create-bucket.js +17 -8
- package/package.json +17 -17
- package/scripts/create-bucket.js +17 -8
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
// Minimal script to create a bucket in MinIO using @constructive-io/s3-utils
|
|
1
|
+
// Minimal script to create a bucket in MinIO/S3 using @constructive-io/s3-utils
|
|
2
2
|
// Avoid strict type coupling between different @aws-sdk/client-s3 versions
|
|
3
3
|
import { S3Client } from '@aws-sdk/client-s3';
|
|
4
4
|
import { createS3Bucket } from '@constructive-io/s3-utils';
|
|
5
5
|
import { getEnvOptions } from '@constructive-io/graphql-env';
|
|
6
|
+
import { Logger } from '@pgpmjs/logger';
|
|
7
|
+
const log = new Logger('create-bucket');
|
|
6
8
|
(async () => {
|
|
7
9
|
try {
|
|
8
10
|
const opts = getEnvOptions();
|
|
9
11
|
const { cdn } = opts;
|
|
12
|
+
const provider = cdn?.provider || 'minio';
|
|
13
|
+
const isMinio = provider === 'minio';
|
|
10
14
|
const bucket = cdn?.bucketName || 'test-bucket';
|
|
11
15
|
const region = cdn?.awsRegion || 'us-east-1';
|
|
12
16
|
const accessKey = cdn?.awsAccessKey || 'minioadmin';
|
|
@@ -15,17 +19,22 @@ import { getEnvOptions } from '@constructive-io/graphql-env';
|
|
|
15
19
|
const client = new S3Client({
|
|
16
20
|
region,
|
|
17
21
|
credentials: { accessKeyId: accessKey, secretAccessKey: secretKey },
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
...(isMinio ? {
|
|
23
|
+
endpoint,
|
|
24
|
+
forcePathStyle: true,
|
|
25
|
+
} : {}),
|
|
20
26
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
const res = await createS3Bucket(client, bucket, { provider });
|
|
28
|
+
if (res.success) {
|
|
29
|
+
log.success(`${bucket} (provider: ${provider})`);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
log.error(`Failed to create bucket ${bucket}`);
|
|
33
|
+
}
|
|
25
34
|
client.destroy();
|
|
26
35
|
}
|
|
27
36
|
catch (e) {
|
|
28
|
-
|
|
37
|
+
log.error('error', e);
|
|
29
38
|
process.exitCode = 1;
|
|
30
39
|
}
|
|
31
40
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/graphql-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "Constructive GraphQL Server",
|
|
6
6
|
"main": "index.js",
|
|
@@ -39,35 +39,35 @@
|
|
|
39
39
|
"backend"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@constructive-io/graphql-env": "^2.8.
|
|
43
|
-
"@constructive-io/graphql-types": "^2.12.
|
|
44
|
-
"@constructive-io/s3-utils": "^2.
|
|
42
|
+
"@constructive-io/graphql-env": "^2.8.12",
|
|
43
|
+
"@constructive-io/graphql-types": "^2.12.9",
|
|
44
|
+
"@constructive-io/s3-utils": "^2.4.0",
|
|
45
45
|
"@constructive-io/upload-names": "^2.3.5",
|
|
46
46
|
"@constructive-io/url-domains": "^2.3.6",
|
|
47
47
|
"@graphile-contrib/pg-many-to-many": "^1.0.2",
|
|
48
48
|
"@pgpmjs/logger": "^1.3.5",
|
|
49
|
-
"@pgpmjs/server-utils": "^2.8.
|
|
50
|
-
"@pgpmjs/types": "^2.
|
|
49
|
+
"@pgpmjs/server-utils": "^2.8.12",
|
|
50
|
+
"@pgpmjs/types": "^2.13.0",
|
|
51
51
|
"cors": "^2.8.5",
|
|
52
52
|
"express": "^5.2.1",
|
|
53
53
|
"graphile-build": "^4.14.1",
|
|
54
|
-
"graphile-cache": "^1.6.
|
|
55
|
-
"graphile-i18n": "^0.2.
|
|
56
|
-
"graphile-meta-schema": "^0.3.
|
|
57
|
-
"graphile-plugin-connection-filter": "^2.4.
|
|
58
|
-
"graphile-plugin-connection-filter-postgis": "^1.1.
|
|
59
|
-
"graphile-plugin-fulltext-filter": "^2.1.
|
|
54
|
+
"graphile-cache": "^1.6.12",
|
|
55
|
+
"graphile-i18n": "^0.2.41",
|
|
56
|
+
"graphile-meta-schema": "^0.3.41",
|
|
57
|
+
"graphile-plugin-connection-filter": "^2.4.41",
|
|
58
|
+
"graphile-plugin-connection-filter-postgis": "^1.1.42",
|
|
59
|
+
"graphile-plugin-fulltext-filter": "^2.1.41",
|
|
60
60
|
"graphile-query": "^2.4.6",
|
|
61
|
-
"graphile-search-plugin": "^0.2.
|
|
62
|
-
"graphile-settings": "^2.
|
|
63
|
-
"graphile-simple-inflector": "^0.2.
|
|
61
|
+
"graphile-search-plugin": "^0.2.41",
|
|
62
|
+
"graphile-settings": "^2.10.0",
|
|
63
|
+
"graphile-simple-inflector": "^0.2.41",
|
|
64
64
|
"graphile-utils": "^4.14.1",
|
|
65
65
|
"graphql": "15.10.1",
|
|
66
66
|
"graphql-tag": "2.12.6",
|
|
67
67
|
"graphql-upload": "^13.0.0",
|
|
68
68
|
"lru-cache": "^11.2.4",
|
|
69
69
|
"pg": "^8.16.3",
|
|
70
|
-
"pg-cache": "^1.6.
|
|
70
|
+
"pg-cache": "^1.6.12",
|
|
71
71
|
"pg-query-context": "^2.3.6",
|
|
72
72
|
"postgraphile": "^4.14.1",
|
|
73
73
|
"request-ip": "^3.3.0"
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"nodemon": "^3.1.10",
|
|
84
84
|
"ts-node": "^10.9.2"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "f04912cac2edf6435c6add5a6ec65a11d6b79df2"
|
|
87
87
|
}
|
package/scripts/create-bucket.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Minimal script to create a bucket in MinIO using @constructive-io/s3-utils
|
|
2
|
+
// Minimal script to create a bucket in MinIO/S3 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
5
|
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
6
6
|
const s3_utils_1 = require("@constructive-io/s3-utils");
|
|
7
7
|
const graphql_env_1 = require("@constructive-io/graphql-env");
|
|
8
|
+
const logger_1 = require("@pgpmjs/logger");
|
|
9
|
+
const log = new logger_1.Logger('create-bucket');
|
|
8
10
|
(async () => {
|
|
9
11
|
try {
|
|
10
12
|
const opts = (0, graphql_env_1.getEnvOptions)();
|
|
11
13
|
const { cdn } = opts;
|
|
14
|
+
const provider = cdn?.provider || 'minio';
|
|
15
|
+
const isMinio = provider === 'minio';
|
|
12
16
|
const bucket = cdn?.bucketName || 'test-bucket';
|
|
13
17
|
const region = cdn?.awsRegion || 'us-east-1';
|
|
14
18
|
const accessKey = cdn?.awsAccessKey || 'minioadmin';
|
|
@@ -17,17 +21,22 @@ const graphql_env_1 = require("@constructive-io/graphql-env");
|
|
|
17
21
|
const client = new client_s3_1.S3Client({
|
|
18
22
|
region,
|
|
19
23
|
credentials: { accessKeyId: accessKey, secretAccessKey: secretKey },
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
...(isMinio ? {
|
|
25
|
+
endpoint,
|
|
26
|
+
forcePathStyle: true,
|
|
27
|
+
} : {}),
|
|
22
28
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
const res = await (0, s3_utils_1.createS3Bucket)(client, bucket, { provider });
|
|
30
|
+
if (res.success) {
|
|
31
|
+
log.success(`${bucket} (provider: ${provider})`);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
log.error(`Failed to create bucket ${bucket}`);
|
|
35
|
+
}
|
|
27
36
|
client.destroy();
|
|
28
37
|
}
|
|
29
38
|
catch (e) {
|
|
30
|
-
|
|
39
|
+
log.error('error', e);
|
|
31
40
|
process.exitCode = 1;
|
|
32
41
|
}
|
|
33
42
|
})();
|