@constructive-io/cli 5.6.20 → 5.6.22
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/commands/codegen.js +15 -21
- package/commands/server.js +7 -7
- package/esm/commands/codegen.js +15 -21
- package/esm/commands/server.js +7 -7
- package/package.json +7 -7
package/commands/codegen.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const generate_1 = require("@constructive-io/graphql-codegen/cli/commands/generate");
|
|
4
4
|
const usage = `
|
|
5
5
|
Constructive GraphQL Codegen:
|
|
6
6
|
|
|
@@ -20,29 +20,23 @@ exports.default = async (argv, _prompter, _options) => {
|
|
|
20
20
|
console.log(usage);
|
|
21
21
|
process.exit(0);
|
|
22
22
|
}
|
|
23
|
-
const cwd = argv.cwd || process.cwd();
|
|
24
23
|
const endpoint = argv.endpoint || '';
|
|
25
|
-
const outDir = argv.out || '
|
|
24
|
+
const outDir = argv.out || 'codegen';
|
|
26
25
|
const auth = argv.auth || '';
|
|
27
26
|
const configPath = argv.config || '';
|
|
28
27
|
const dryRun = !!(argv['dry-run'] || argv.dryRun);
|
|
29
28
|
const verbose = !!(argv.verbose || argv.v);
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (verbose)
|
|
44
|
-
args.push('-v');
|
|
45
|
-
const res = (0, child_process_1.spawnSync)(process.execPath, [bin, ...args], { cwd, stdio: 'inherit' });
|
|
46
|
-
if ((res.status ?? 0) !== 0)
|
|
47
|
-
process.exit(res.status ?? 1);
|
|
29
|
+
const result = await (0, generate_1.generateCommand)({
|
|
30
|
+
config: configPath,
|
|
31
|
+
endpoint,
|
|
32
|
+
output: outDir,
|
|
33
|
+
authorization: auth,
|
|
34
|
+
verbose,
|
|
35
|
+
dryRun,
|
|
36
|
+
});
|
|
37
|
+
if (!result.success) {
|
|
38
|
+
console.error('x', result.message);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
console.log('[ok]', result.message);
|
|
48
42
|
};
|
package/commands/server.js
CHANGED
|
@@ -19,7 +19,7 @@ Options:
|
|
|
19
19
|
--simpleInflection Use simple inflection (default: true)
|
|
20
20
|
--oppositeBaseNames Use opposite base names (default: false)
|
|
21
21
|
--postgis Enable PostGIS extension (default: true)
|
|
22
|
-
--
|
|
22
|
+
--servicesApi Enable Services API (default: true)
|
|
23
23
|
--cwd <directory> Working directory (default: current directory)
|
|
24
24
|
|
|
25
25
|
Examples:
|
|
@@ -54,8 +54,8 @@ const questions = [
|
|
|
54
54
|
useDefault: true
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
|
-
name: '
|
|
58
|
-
message: 'Enable
|
|
57
|
+
name: 'servicesApi',
|
|
58
|
+
message: 'Enable Services API?',
|
|
59
59
|
type: 'confirm',
|
|
60
60
|
required: false,
|
|
61
61
|
default: true,
|
|
@@ -106,7 +106,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
106
106
|
selectedDb = database;
|
|
107
107
|
log.info(`📌 Using database: "${selectedDb}"`);
|
|
108
108
|
}
|
|
109
|
-
const { oppositeBaseNames, port, postgis, simpleInflection,
|
|
109
|
+
const { oppositeBaseNames, port, postgis, simpleInflection, servicesApi, origin } = await prompter.prompt(argv, questions);
|
|
110
110
|
// Warn when passing CORS override via CLI, especially in production
|
|
111
111
|
if (origin && origin.trim().length) {
|
|
112
112
|
const env = (process.env.NODE_ENV || 'development').toLowerCase();
|
|
@@ -122,7 +122,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
122
122
|
let selectedSchemas = [];
|
|
123
123
|
let authRole;
|
|
124
124
|
let roleName;
|
|
125
|
-
if (!
|
|
125
|
+
if (!servicesApi) {
|
|
126
126
|
const db = await (0, pg_cache_1.getPgPool)({ database: selectedDb });
|
|
127
127
|
const result = await db.query(`
|
|
128
128
|
SELECT nspname
|
|
@@ -172,8 +172,8 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
172
172
|
postgis
|
|
173
173
|
},
|
|
174
174
|
api: {
|
|
175
|
-
|
|
176
|
-
...(
|
|
175
|
+
enableServicesApi: servicesApi,
|
|
176
|
+
...(servicesApi === false && { exposedSchemas: selectedSchemas, authRole, roleName })
|
|
177
177
|
},
|
|
178
178
|
server: {
|
|
179
179
|
port,
|
package/esm/commands/codegen.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { generateCommand } from '@constructive-io/graphql-codegen/cli/commands/generate';
|
|
2
2
|
const usage = `
|
|
3
3
|
Constructive GraphQL Codegen:
|
|
4
4
|
|
|
@@ -18,29 +18,23 @@ export default async (argv, _prompter, _options) => {
|
|
|
18
18
|
console.log(usage);
|
|
19
19
|
process.exit(0);
|
|
20
20
|
}
|
|
21
|
-
const cwd = argv.cwd || process.cwd();
|
|
22
21
|
const endpoint = argv.endpoint || '';
|
|
23
|
-
const outDir = argv.out || '
|
|
22
|
+
const outDir = argv.out || 'codegen';
|
|
24
23
|
const auth = argv.auth || '';
|
|
25
24
|
const configPath = argv.config || '';
|
|
26
25
|
const dryRun = !!(argv['dry-run'] || argv.dryRun);
|
|
27
26
|
const verbose = !!(argv.verbose || argv.v);
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (verbose)
|
|
42
|
-
args.push('-v');
|
|
43
|
-
const res = spawnSync(process.execPath, [bin, ...args], { cwd, stdio: 'inherit' });
|
|
44
|
-
if ((res.status ?? 0) !== 0)
|
|
45
|
-
process.exit(res.status ?? 1);
|
|
27
|
+
const result = await generateCommand({
|
|
28
|
+
config: configPath,
|
|
29
|
+
endpoint,
|
|
30
|
+
output: outDir,
|
|
31
|
+
authorization: auth,
|
|
32
|
+
verbose,
|
|
33
|
+
dryRun,
|
|
34
|
+
});
|
|
35
|
+
if (!result.success) {
|
|
36
|
+
console.error('x', result.message);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
console.log('[ok]', result.message);
|
|
46
40
|
};
|
package/esm/commands/server.js
CHANGED
|
@@ -17,7 +17,7 @@ Options:
|
|
|
17
17
|
--simpleInflection Use simple inflection (default: true)
|
|
18
18
|
--oppositeBaseNames Use opposite base names (default: false)
|
|
19
19
|
--postgis Enable PostGIS extension (default: true)
|
|
20
|
-
--
|
|
20
|
+
--servicesApi Enable Services API (default: true)
|
|
21
21
|
--cwd <directory> Working directory (default: current directory)
|
|
22
22
|
|
|
23
23
|
Examples:
|
|
@@ -52,8 +52,8 @@ const questions = [
|
|
|
52
52
|
useDefault: true
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
name: '
|
|
56
|
-
message: 'Enable
|
|
55
|
+
name: 'servicesApi',
|
|
56
|
+
message: 'Enable Services API?',
|
|
57
57
|
type: 'confirm',
|
|
58
58
|
required: false,
|
|
59
59
|
default: true,
|
|
@@ -104,7 +104,7 @@ export default async (argv, prompter, _options) => {
|
|
|
104
104
|
selectedDb = database;
|
|
105
105
|
log.info(`📌 Using database: "${selectedDb}"`);
|
|
106
106
|
}
|
|
107
|
-
const { oppositeBaseNames, port, postgis, simpleInflection,
|
|
107
|
+
const { oppositeBaseNames, port, postgis, simpleInflection, servicesApi, origin } = await prompter.prompt(argv, questions);
|
|
108
108
|
// Warn when passing CORS override via CLI, especially in production
|
|
109
109
|
if (origin && origin.trim().length) {
|
|
110
110
|
const env = (process.env.NODE_ENV || 'development').toLowerCase();
|
|
@@ -120,7 +120,7 @@ export default async (argv, prompter, _options) => {
|
|
|
120
120
|
let selectedSchemas = [];
|
|
121
121
|
let authRole;
|
|
122
122
|
let roleName;
|
|
123
|
-
if (!
|
|
123
|
+
if (!servicesApi) {
|
|
124
124
|
const db = await getPgPool({ database: selectedDb });
|
|
125
125
|
const result = await db.query(`
|
|
126
126
|
SELECT nspname
|
|
@@ -170,8 +170,8 @@ export default async (argv, prompter, _options) => {
|
|
|
170
170
|
postgis
|
|
171
171
|
},
|
|
172
172
|
api: {
|
|
173
|
-
|
|
174
|
-
...(
|
|
173
|
+
enableServicesApi: servicesApi,
|
|
174
|
+
...(servicesApi === false && { exposedSchemas: selectedSchemas, authRole, roleName })
|
|
175
175
|
},
|
|
176
176
|
server: {
|
|
177
177
|
port,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/cli",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.22",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "Constructive CLI",
|
|
6
6
|
"main": "index.js",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@constructive-io/graphql-codegen": "^2.23.3",
|
|
50
|
-
"@constructive-io/graphql-env": "^2.8.
|
|
51
|
-
"@constructive-io/graphql-explorer": "^2.13.
|
|
52
|
-
"@constructive-io/graphql-server": "^2.
|
|
50
|
+
"@constructive-io/graphql-env": "^2.8.19",
|
|
51
|
+
"@constructive-io/graphql-explorer": "^2.13.16",
|
|
52
|
+
"@constructive-io/graphql-server": "^2.16.1",
|
|
53
53
|
"@inquirerer/utils": "^3.1.3",
|
|
54
|
-
"@pgpmjs/core": "^4.
|
|
54
|
+
"@pgpmjs/core": "^4.15.0",
|
|
55
55
|
"@pgpmjs/logger": "^1.3.7",
|
|
56
56
|
"@pgpmjs/server-utils": "^2.8.15",
|
|
57
57
|
"@pgpmjs/types": "^2.14.1",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"minimist": "^1.2.8",
|
|
62
62
|
"pg-cache": "^1.6.15",
|
|
63
63
|
"pg-env": "^1.2.5",
|
|
64
|
-
"pgpm": "^2.10.
|
|
64
|
+
"pgpm": "^2.10.14",
|
|
65
65
|
"shelljs": "^0.10.0",
|
|
66
66
|
"yanse": "^0.1.11"
|
|
67
67
|
},
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"postgres",
|
|
77
77
|
"graphile"
|
|
78
78
|
],
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "15e8f92ee6ec7bfebd6647dec743e4235b0362ac"
|
|
80
80
|
}
|