@ductape/cli 0.3.32 → 0.3.33
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 +12 -2
- package/package.json +1 -1
|
@@ -8,6 +8,16 @@ 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 fetchAll(product) that decrypts/resolves secret-backed env
|
|
12
|
+
// fields per-env, the same way their single-resource `fetch` does. `resources <module> list` must
|
|
13
|
+
// route through the SDK for these instead of the raw-product-document shortcut below, which plucks
|
|
14
|
+
// the component array straight off the unmodified product document — any secret-backed field
|
|
15
|
+
// (connection_url/username/password) is still in its raw encrypted-at-rest form there, never
|
|
16
|
+
// resolved to a $Secret{} reference. Confirmed by reading source: graphs.service.ts fetchAll() ->
|
|
17
|
+
// products.service.ts fetchGraphs() decrypts each env; databases.service.ts fetchAllDatabases() ->
|
|
18
|
+
// fetchDatabases() decrypts connection_url; vector-database.service.ts fetchAll() has the same
|
|
19
|
+
// per-env resolution. Other modules are left on the shortcut below, unverified.
|
|
20
|
+
const MODULES_WITH_DECRYPTING_FETCH_ALL = new Set(['graph', 'databases', 'vector']);
|
|
11
21
|
export function resolveResourceProductTag(override, linkedProductTag) {
|
|
12
22
|
return override?.trim() || linkedProductTag;
|
|
13
23
|
}
|
|
@@ -296,7 +306,7 @@ export async function runResourceCrud(typeName, verb, opts, extraArgs) {
|
|
|
296
306
|
// body) destructures product's string as `options` and fails with "No database connection
|
|
297
307
|
// established", not a useful error about the definition update. The definition updater is a
|
|
298
308
|
// separate method, databases.updateDatabase(product, database, data).
|
|
299
|
-
const proxyMethod = (module === 'models' || module === 'feature') && method === 'list'
|
|
309
|
+
const proxyMethod = (module === 'models' || module === 'feature' || MODULES_WITH_DECRYPTING_FETCH_ALL.has(module)) && method === 'list'
|
|
300
310
|
? 'fetchAll'
|
|
301
311
|
: module === 'databases' && method === 'update'
|
|
302
312
|
? 'updateDatabase'
|
|
@@ -336,7 +346,7 @@ export async function runResourceCrud(typeName, verb, opts, extraArgs) {
|
|
|
336
346
|
body: payload,
|
|
337
347
|
});
|
|
338
348
|
const proxy = getSdkProxy(session);
|
|
339
|
-
if (crud === 'list') {
|
|
349
|
+
if (crud === 'list' && !MODULES_WITH_DECRYPTING_FETCH_ALL.has(module)) {
|
|
340
350
|
const product = await proxy.execute('product', 'fetch', [productTag]);
|
|
341
351
|
const catalogue = listComponentsFromProduct(module, product);
|
|
342
352
|
if (catalogue !== undefined) {
|
package/package.json
CHANGED