@ductape/cli 0.3.33 → 0.3.34
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/dist/commands/resources.js +17 -12
- package/package.json +1 -1
|
@@ -8,16 +8,21 @@ import { printJson } from '../lib/output.js';
|
|
|
8
8
|
import { DuctapeOperationError } from '../lib/operation-error.js';
|
|
9
9
|
import { readCanonicalTopicFile, topicBodyForTransport, validateEventTopicsProject, } from '../lib/event-topics.js';
|
|
10
10
|
const CRUD_VERBS = ['create', 'list', 'get', 'update', 'delete', 'connect'];
|
|
11
|
-
// Modules whose SDK exposes a real
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
|
|
11
|
+
// Modules whose SDK exposes a real `list` method (ductape.graph.list / ductape.databases.list /
|
|
12
|
+
// ductape.vector.list — each internally calls a differently-named service method, e.g.
|
|
13
|
+
// GraphsService.fetchAll(), but the public/proxy-facing key is `list`) that decrypts/resolves
|
|
14
|
+
// secret-backed env fields per-env, the same way their single-resource `fetch` does.
|
|
15
|
+
// `resources <module> list` must route through the SDK for these instead of the raw-product-
|
|
16
|
+
// document shortcut below, which plucks the component array straight off the unmodified product
|
|
17
|
+
// document — any secret-backed field (connection_url/username/password) is still in its raw
|
|
18
|
+
// encrypted-at-rest form there, never resolved to a $Secret{} reference. IMPORTANT: the proxy
|
|
19
|
+
// method name must stay `list`, not the internal service method name (`fetchAll`) — the sdk-proxy
|
|
20
|
+
// dispatcher does a literal `moduleObject[method]` lookup against `ductape.graph`/`.databases`/
|
|
21
|
+
// `.vector`, none of which have a `fetchAll` property (only `list`); calling `fetchAll` throws
|
|
22
|
+
// "not callable" (graph) or is rejected by the backend's method allowlist entirely (databases,
|
|
23
|
+
// vector — allowlisted differently per module, `list` not `fetchAll`). Other modules are left on
|
|
24
|
+
// the shortcut below, unverified.
|
|
25
|
+
const MODULES_WITH_DECRYPTING_LIST = new Set(['graph', 'databases', 'vector']);
|
|
21
26
|
export function resolveResourceProductTag(override, linkedProductTag) {
|
|
22
27
|
return override?.trim() || linkedProductTag;
|
|
23
28
|
}
|
|
@@ -306,7 +311,7 @@ export async function runResourceCrud(typeName, verb, opts, extraArgs) {
|
|
|
306
311
|
// body) destructures product's string as `options` and fails with "No database connection
|
|
307
312
|
// established", not a useful error about the definition update. The definition updater is a
|
|
308
313
|
// separate method, databases.updateDatabase(product, database, data).
|
|
309
|
-
const proxyMethod = (module === 'models' || module === 'feature'
|
|
314
|
+
const proxyMethod = (module === 'models' || module === 'feature') && method === 'list'
|
|
310
315
|
? 'fetchAll'
|
|
311
316
|
: module === 'databases' && method === 'update'
|
|
312
317
|
? 'updateDatabase'
|
|
@@ -346,7 +351,7 @@ export async function runResourceCrud(typeName, verb, opts, extraArgs) {
|
|
|
346
351
|
body: payload,
|
|
347
352
|
});
|
|
348
353
|
const proxy = getSdkProxy(session);
|
|
349
|
-
if (crud === 'list' && !
|
|
354
|
+
if (crud === 'list' && !MODULES_WITH_DECRYPTING_LIST.has(module)) {
|
|
350
355
|
const product = await proxy.execute('product', 'fetch', [productTag]);
|
|
351
356
|
const catalogue = listComponentsFromProduct(module, product);
|
|
352
357
|
if (catalogue !== undefined) {
|
package/package.json
CHANGED