go-duck-cli 1.1.40 → 1.1.42
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/generators/postman.js +13 -2
- package/generators/swagger.js +64 -2
- package/package.json +1 -1
package/generators/postman.js
CHANGED
|
@@ -140,11 +140,11 @@ export const generatePostmanCollection = async (config, entities, outputDir, ope
|
|
|
140
140
|
{ key: "X-Tenant-ID", value: "{{tenant}}" }
|
|
141
141
|
],
|
|
142
142
|
url: {
|
|
143
|
-
raw: "http://{{host}}:{{port}}/api/audit",
|
|
143
|
+
raw: "http://{{host}}:{{port}}/api/admin/audit",
|
|
144
144
|
protocol: "http",
|
|
145
145
|
host: ["{{host}}"],
|
|
146
146
|
port: "{{port}}",
|
|
147
|
-
path: ["api", "audit"]
|
|
147
|
+
path: ["api", "admin", "audit"]
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
},
|
|
@@ -305,6 +305,17 @@ export const generatePostmanCollection = async (config, entities, outputDir, ope
|
|
|
305
305
|
}
|
|
306
306
|
];
|
|
307
307
|
|
|
308
|
+
if (entity.isSearchable && config.elasticsearch?.enabled) {
|
|
309
|
+
privateItems.push({
|
|
310
|
+
name: `Elasticsearch Search (${capitalized})`,
|
|
311
|
+
request: {
|
|
312
|
+
method: "GET",
|
|
313
|
+
header: [ { key: "Authorization", value: "Bearer {{token}}" }, { key: "X-Tenant-ID", value: "{{tenant}}" } ],
|
|
314
|
+
url: { raw: `http://{{host}}:{{port}}/api/search/${name}?q=Sample`, protocol: "http", host: ["{{host}}"], port: "{{port}}", path: ["api", "search", name], query: [ { key: "q", value: "Sample" } ] }
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
|
|
308
319
|
folder.item.push({ name: "Private (Auth Required) CRUD", item: privateItems });
|
|
309
320
|
restFolder.item.push(folder);
|
|
310
321
|
}
|
package/generators/swagger.js
CHANGED
|
@@ -208,7 +208,7 @@ export const generateSwaggerDocs = async (config, entities, outputDir, openEntit
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
// 2. Add System Paths
|
|
211
|
-
swagger.paths['/rpc/{table}'] = {
|
|
211
|
+
swagger.paths['/api/rpc/{table}'] = {
|
|
212
212
|
get: {
|
|
213
213
|
tags: ['Search Engine'],
|
|
214
214
|
summary: 'Generic PostgREST RPC Engine',
|
|
@@ -240,7 +240,7 @@ export const generateSwaggerDocs = async (config, entities, outputDir, openEntit
|
|
|
240
240
|
}
|
|
241
241
|
};
|
|
242
242
|
|
|
243
|
-
swagger.paths['/audit'] = {
|
|
243
|
+
swagger.paths['/api/admin/audit'] = {
|
|
244
244
|
get: {
|
|
245
245
|
tags: ['Observability'],
|
|
246
246
|
summary: 'Fetch Audit Trail',
|
|
@@ -249,6 +249,68 @@ export const generateSwaggerDocs = async (config, entities, outputDir, openEntit
|
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
251
|
|
|
252
|
+
swagger.paths['/management/tenant/assign'] = {
|
|
253
|
+
post: {
|
|
254
|
+
tags: ['Management'],
|
|
255
|
+
summary: 'Provision and Assign Tenant Database',
|
|
256
|
+
description: 'Creates a dedicated database for the specified tenant and runs all migrations.',
|
|
257
|
+
requestBody: {
|
|
258
|
+
required: true,
|
|
259
|
+
content: {
|
|
260
|
+
'application/json': {
|
|
261
|
+
schema: {
|
|
262
|
+
type: 'object',
|
|
263
|
+
properties: {
|
|
264
|
+
roleName: { type: 'string', example: 'tenant_1_admin', description: 'The realm role name mapped to this database context' },
|
|
265
|
+
dbName: { type: 'string', example: 'tenant_1', description: 'The physical name of the database to create and provision' }
|
|
266
|
+
},
|
|
267
|
+
required: ['roleName', 'dbName']
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
parameters: [
|
|
273
|
+
{ name: 'X-Tenant-ID', in: 'header', required: true, schema: { type: 'string', default: 'master_internal' }, description: 'SuperAdmin internal master bypass token' }
|
|
274
|
+
],
|
|
275
|
+
responses: {
|
|
276
|
+
200: { description: 'Success' },
|
|
277
|
+
401: { description: 'Unauthorized' },
|
|
278
|
+
403: { description: 'Forbidden (Requires SuperAdmin role)' }
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
if (config.elasticsearch?.enabled) {
|
|
284
|
+
swagger.paths['/api/search/{entity}'] = {
|
|
285
|
+
get: {
|
|
286
|
+
tags: ['Search Engine'],
|
|
287
|
+
summary: 'Elasticsearch Global Search',
|
|
288
|
+
description: 'High-performance full-text search with fuzzy matching across federated silos using Elasticsearch.',
|
|
289
|
+
parameters: [
|
|
290
|
+
...commonHeaders,
|
|
291
|
+
{ name: 'entity', in: 'path', required: true, schema: { type: 'string' }, description: 'The entity name to search (e.g., institute)' },
|
|
292
|
+
{ name: 'q', in: 'query', schema: { type: 'string' }, description: 'The search query (Spring-style fuzzy match)' }
|
|
293
|
+
],
|
|
294
|
+
responses: {
|
|
295
|
+
200: {
|
|
296
|
+
description: 'OK',
|
|
297
|
+
content: {
|
|
298
|
+
'application/json': {
|
|
299
|
+
schema: {
|
|
300
|
+
type: 'object',
|
|
301
|
+
properties: {
|
|
302
|
+
total: { type: 'integer', description: 'Total search hits matching query' },
|
|
303
|
+
hits: { type: 'array', items: { type: 'object' }, description: 'Search hits (matching source documents)' }
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
252
314
|
await fs.writeJson(path.join(docsDir, 'swagger.json'), swagger, { spaces: 2 });
|
|
253
315
|
console.log(chalk.gray(' Generated Swagger Documentation: swagger.json'));
|
|
254
316
|
};
|