@constructive-io/cli 8.1.1 → 8.3.3
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/server.js +2 -60
- package/esm/commands/server.js +2 -60
- package/package.json +14 -14
package/commands/server.js
CHANGED
|
@@ -19,7 +19,6 @@ 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
|
-
--scopedRouting Enable scoped routing (default: true)
|
|
23
22
|
--cwd <directory> Working directory (default: current directory)
|
|
24
23
|
|
|
25
24
|
Examples:
|
|
@@ -53,14 +52,6 @@ const questions = [
|
|
|
53
52
|
default: true,
|
|
54
53
|
useDefault: true
|
|
55
54
|
},
|
|
56
|
-
{
|
|
57
|
-
name: 'scopedRouting',
|
|
58
|
-
message: 'Enable scoped routing?',
|
|
59
|
-
type: 'confirm',
|
|
60
|
-
required: false,
|
|
61
|
-
default: true,
|
|
62
|
-
useDefault: true
|
|
63
|
-
},
|
|
64
55
|
{
|
|
65
56
|
name: 'origin',
|
|
66
57
|
message: 'CORS origin (exact URL or *)',
|
|
@@ -106,7 +97,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
106
97
|
selectedDb = database;
|
|
107
98
|
log.info(`📌 Using database: "${selectedDb}"`);
|
|
108
99
|
}
|
|
109
|
-
const { oppositeBaseNames, port, postgis, simpleInflection,
|
|
100
|
+
const { oppositeBaseNames, port, postgis, simpleInflection, origin } = await prompter.prompt(argv, questions);
|
|
110
101
|
// Warn when passing CORS override via CLI, especially in production
|
|
111
102
|
if (origin && origin.trim().length) {
|
|
112
103
|
const env = (process.env.NODE_ENV || 'development').toLowerCase();
|
|
@@ -119,51 +110,6 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
119
110
|
}
|
|
120
111
|
}
|
|
121
112
|
}
|
|
122
|
-
let selectedSchemas = [];
|
|
123
|
-
let authRole;
|
|
124
|
-
let roleName;
|
|
125
|
-
if (!scopedRouting) {
|
|
126
|
-
const db = await (0, pg_cache_1.getPgPool)({ database: selectedDb });
|
|
127
|
-
const result = await db.query(`
|
|
128
|
-
SELECT nspname
|
|
129
|
-
FROM pg_namespace
|
|
130
|
-
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
|
|
131
|
-
ORDER BY nspname;
|
|
132
|
-
`);
|
|
133
|
-
const schemaChoices = result.rows.map(row => ({
|
|
134
|
-
name: row.nspname,
|
|
135
|
-
value: row.nspname,
|
|
136
|
-
selected: true
|
|
137
|
-
}));
|
|
138
|
-
const { schemas } = await prompter.prompt(argv, [
|
|
139
|
-
{
|
|
140
|
-
type: 'checkbox',
|
|
141
|
-
name: 'schemas',
|
|
142
|
-
message: 'Select schemas to expose',
|
|
143
|
-
options: schemaChoices,
|
|
144
|
-
required: true
|
|
145
|
-
}
|
|
146
|
-
]);
|
|
147
|
-
selectedSchemas = schemas.filter(s => s.selected).map(s => s.value);
|
|
148
|
-
const { authRole: selectedAuthRole, roleName: selectedRoleName } = await prompter.prompt(argv, [
|
|
149
|
-
{
|
|
150
|
-
type: 'autocomplete',
|
|
151
|
-
name: 'authRole',
|
|
152
|
-
message: 'Select the authentication role',
|
|
153
|
-
options: ['postgres', 'authenticated', 'anonymous'],
|
|
154
|
-
required: true
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
type: 'autocomplete',
|
|
158
|
-
name: 'roleName',
|
|
159
|
-
message: 'Enter the default role name:',
|
|
160
|
-
options: ['postgres', 'authenticated', 'anonymous'],
|
|
161
|
-
required: true
|
|
162
|
-
}
|
|
163
|
-
]);
|
|
164
|
-
authRole = selectedAuthRole;
|
|
165
|
-
roleName = selectedRoleName;
|
|
166
|
-
}
|
|
167
113
|
const options = (0, graphql_env_1.getEnvOptions)({
|
|
168
114
|
pg: { database: selectedDb },
|
|
169
115
|
features: {
|
|
@@ -171,10 +117,6 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
171
117
|
simpleInflection,
|
|
172
118
|
postgis
|
|
173
119
|
},
|
|
174
|
-
api: {
|
|
175
|
-
enableScopedRouting: scopedRouting,
|
|
176
|
-
...(scopedRouting === false && { exposedSchemas: selectedSchemas, authRole, roleName })
|
|
177
|
-
},
|
|
178
120
|
server: {
|
|
179
121
|
port,
|
|
180
122
|
...(origin ? { origin } : {})
|
|
@@ -186,7 +128,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
186
128
|
}
|
|
187
129
|
// Debug: Log API routing configuration
|
|
188
130
|
const apiOpts = options.api || {};
|
|
189
|
-
log.debug(`📡 API Routing: isPublic=${apiOpts.isPublic},
|
|
131
|
+
log.debug(`📡 API Routing: isPublic=${apiOpts.isPublic}, scopedRoutingSchema=${apiOpts.scopedRoutingSchema}`);
|
|
190
132
|
if (apiOpts.isPublic === false) {
|
|
191
133
|
log.debug(` Header-based routing enabled (X-Api-Name, X-Database-Id, X-Meta-Schema)`);
|
|
192
134
|
}
|
package/esm/commands/server.js
CHANGED
|
@@ -17,7 +17,6 @@ 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
|
-
--scopedRouting Enable scoped routing (default: true)
|
|
21
20
|
--cwd <directory> Working directory (default: current directory)
|
|
22
21
|
|
|
23
22
|
Examples:
|
|
@@ -51,14 +50,6 @@ const questions = [
|
|
|
51
50
|
default: true,
|
|
52
51
|
useDefault: true
|
|
53
52
|
},
|
|
54
|
-
{
|
|
55
|
-
name: 'scopedRouting',
|
|
56
|
-
message: 'Enable scoped routing?',
|
|
57
|
-
type: 'confirm',
|
|
58
|
-
required: false,
|
|
59
|
-
default: true,
|
|
60
|
-
useDefault: true
|
|
61
|
-
},
|
|
62
53
|
{
|
|
63
54
|
name: 'origin',
|
|
64
55
|
message: 'CORS origin (exact URL or *)',
|
|
@@ -104,7 +95,7 @@ export default async (argv, prompter, _options) => {
|
|
|
104
95
|
selectedDb = database;
|
|
105
96
|
log.info(`📌 Using database: "${selectedDb}"`);
|
|
106
97
|
}
|
|
107
|
-
const { oppositeBaseNames, port, postgis, simpleInflection,
|
|
98
|
+
const { oppositeBaseNames, port, postgis, simpleInflection, origin } = await prompter.prompt(argv, questions);
|
|
108
99
|
// Warn when passing CORS override via CLI, especially in production
|
|
109
100
|
if (origin && origin.trim().length) {
|
|
110
101
|
const env = (process.env.NODE_ENV || 'development').toLowerCase();
|
|
@@ -117,51 +108,6 @@ export default async (argv, prompter, _options) => {
|
|
|
117
108
|
}
|
|
118
109
|
}
|
|
119
110
|
}
|
|
120
|
-
let selectedSchemas = [];
|
|
121
|
-
let authRole;
|
|
122
|
-
let roleName;
|
|
123
|
-
if (!scopedRouting) {
|
|
124
|
-
const db = await getPgPool({ database: selectedDb });
|
|
125
|
-
const result = await db.query(`
|
|
126
|
-
SELECT nspname
|
|
127
|
-
FROM pg_namespace
|
|
128
|
-
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
|
|
129
|
-
ORDER BY nspname;
|
|
130
|
-
`);
|
|
131
|
-
const schemaChoices = result.rows.map(row => ({
|
|
132
|
-
name: row.nspname,
|
|
133
|
-
value: row.nspname,
|
|
134
|
-
selected: true
|
|
135
|
-
}));
|
|
136
|
-
const { schemas } = await prompter.prompt(argv, [
|
|
137
|
-
{
|
|
138
|
-
type: 'checkbox',
|
|
139
|
-
name: 'schemas',
|
|
140
|
-
message: 'Select schemas to expose',
|
|
141
|
-
options: schemaChoices,
|
|
142
|
-
required: true
|
|
143
|
-
}
|
|
144
|
-
]);
|
|
145
|
-
selectedSchemas = schemas.filter(s => s.selected).map(s => s.value);
|
|
146
|
-
const { authRole: selectedAuthRole, roleName: selectedRoleName } = await prompter.prompt(argv, [
|
|
147
|
-
{
|
|
148
|
-
type: 'autocomplete',
|
|
149
|
-
name: 'authRole',
|
|
150
|
-
message: 'Select the authentication role',
|
|
151
|
-
options: ['postgres', 'authenticated', 'anonymous'],
|
|
152
|
-
required: true
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
type: 'autocomplete',
|
|
156
|
-
name: 'roleName',
|
|
157
|
-
message: 'Enter the default role name:',
|
|
158
|
-
options: ['postgres', 'authenticated', 'anonymous'],
|
|
159
|
-
required: true
|
|
160
|
-
}
|
|
161
|
-
]);
|
|
162
|
-
authRole = selectedAuthRole;
|
|
163
|
-
roleName = selectedRoleName;
|
|
164
|
-
}
|
|
165
111
|
const options = getEnvOptions({
|
|
166
112
|
pg: { database: selectedDb },
|
|
167
113
|
features: {
|
|
@@ -169,10 +115,6 @@ export default async (argv, prompter, _options) => {
|
|
|
169
115
|
simpleInflection,
|
|
170
116
|
postgis
|
|
171
117
|
},
|
|
172
|
-
api: {
|
|
173
|
-
enableScopedRouting: scopedRouting,
|
|
174
|
-
...(scopedRouting === false && { exposedSchemas: selectedSchemas, authRole, roleName })
|
|
175
|
-
},
|
|
176
118
|
server: {
|
|
177
119
|
port,
|
|
178
120
|
...(origin ? { origin } : {})
|
|
@@ -184,7 +126,7 @@ export default async (argv, prompter, _options) => {
|
|
|
184
126
|
}
|
|
185
127
|
// Debug: Log API routing configuration
|
|
186
128
|
const apiOpts = options.api || {};
|
|
187
|
-
log.debug(`📡 API Routing: isPublic=${apiOpts.isPublic},
|
|
129
|
+
log.debug(`📡 API Routing: isPublic=${apiOpts.isPublic}, scopedRoutingSchema=${apiOpts.scopedRoutingSchema}`);
|
|
188
130
|
if (apiOpts.isPublic === false) {
|
|
189
131
|
log.debug(` Header-based routing enabled (X-Api-Name, X-Database-Id, X-Meta-Schema)`);
|
|
190
132
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/cli",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.3",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "Constructive CLI",
|
|
6
6
|
"main": "index.js",
|
|
@@ -45,23 +45,23 @@
|
|
|
45
45
|
"ts-node": "^10.9.2"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@constructive-io/graphql-codegen": "^5.
|
|
49
|
-
"@constructive-io/graphql-env": "^3.
|
|
50
|
-
"@constructive-io/graphql-explorer": "^5.
|
|
51
|
-
"@constructive-io/graphql-server": "^5.
|
|
52
|
-
"@constructive-io/graphql-types": "^3.
|
|
48
|
+
"@constructive-io/graphql-codegen": "^5.2.3",
|
|
49
|
+
"@constructive-io/graphql-env": "^3.19.2",
|
|
50
|
+
"@constructive-io/graphql-explorer": "^5.1.3",
|
|
51
|
+
"@constructive-io/graphql-server": "^5.3.3",
|
|
52
|
+
"@constructive-io/graphql-types": "^3.18.2",
|
|
53
53
|
"@inquirerer/utils": "^3.3.9",
|
|
54
|
-
"@pgpmjs/core": "^7.
|
|
55
|
-
"@pgpmjs/logger": "^2.
|
|
56
|
-
"@pgpmjs/server-utils": "^3.
|
|
57
|
-
"@pgpmjs/types": "^2.
|
|
54
|
+
"@pgpmjs/core": "^7.4.2",
|
|
55
|
+
"@pgpmjs/logger": "^2.15.2",
|
|
56
|
+
"@pgpmjs/server-utils": "^3.16.2",
|
|
57
|
+
"@pgpmjs/types": "^2.37.2",
|
|
58
58
|
"appstash": "^0.7.0",
|
|
59
59
|
"find-and-require-package-json": "^0.9.1",
|
|
60
60
|
"inquirerer": "^4.9.1",
|
|
61
61
|
"js-yaml": "^4.1.0",
|
|
62
|
-
"pg-cache": "^3.
|
|
63
|
-
"pg-env": "^1.
|
|
64
|
-
"pgpm": "^5.
|
|
62
|
+
"pg-cache": "^3.16.2",
|
|
63
|
+
"pg-env": "^1.19.2",
|
|
64
|
+
"pgpm": "^5.2.3",
|
|
65
65
|
"shelljs": "^0.10.0",
|
|
66
66
|
"yanse": "^0.2.1"
|
|
67
67
|
},
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"postgres",
|
|
77
77
|
"graphile"
|
|
78
78
|
],
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "0e3ee42c44c9b35ffac4bf1faa6775eb69311ec4"
|
|
80
80
|
}
|