@ductape/cli 0.3.13 → 0.3.15

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.
@@ -1,4 +1,4 @@
1
- import { buildCrudParams, listResourceTypes, proxyMethodForVerb, resolveResourceType, } from '../lib/resources.js';
1
+ import { buildCrudParams, listComponentsFromProduct, listResourceTypes, proxyMethodForVerb, resolveResourceType, } from '../lib/resources.js';
2
2
  import { resolveResourceSchema } from '../lib/forms/index.js';
3
3
  import { isInteractive, promptTag } from '../lib/forms/prompt.js';
4
4
  import { toInteractiveOpts } from '../lib/interactive-opts.js';
@@ -302,6 +302,14 @@ export async function runResourceCrud(typeName, verb, opts, extraArgs) {
302
302
  body: payload,
303
303
  });
304
304
  const proxy = getSdkProxy(session);
305
+ if (crud === 'list') {
306
+ const product = await proxy.execute('product', 'fetch', [productTag]);
307
+ const catalogue = listComponentsFromProduct(module, product);
308
+ if (catalogue !== undefined) {
309
+ printJson(catalogue, Boolean(opts.json));
310
+ return;
311
+ }
312
+ }
305
313
  if (crud === 'list' && module === 'sessions') {
306
314
  printJson(await listSessionsWithProductFallback(proxy, productTag), Boolean(opts.json));
307
315
  return;
@@ -10,3 +10,4 @@ export declare function buildCrudParams(module: SDKModule, method: string, produ
10
10
  body?: unknown;
11
11
  }): unknown[];
12
12
  export declare function listResourceTypes(): string[];
13
+ export declare function listComponentsFromProduct(module: SDKModule, value: unknown): unknown[] | undefined;
@@ -85,8 +85,8 @@ export function buildCrudParams(module, method, productTag, args) {
85
85
  return [{ product: productTag, tag, ...(body ?? {}) }];
86
86
  }
87
87
  }
88
- if ((module === 'storage' || module === 'databases') && method === 'create') {
89
- // databases.create and storage.create expect a single config object with product embedded,
88
+ if ((module === 'storage' || module === 'databases' || module === 'graph') && method === 'create') {
89
+ // These create methods expect a single config object with product embedded,
90
90
  // not the default (productTag, data) two-argument form.
91
91
  const payload = body && typeof body === 'object'
92
92
  ? { product: productTag, ...body }
@@ -170,3 +170,28 @@ export function listResourceTypes() {
170
170
  'app',
171
171
  ];
172
172
  }
173
+ const PRODUCT_COMPONENT_KEYS = {
174
+ graph: ['graphs'],
175
+ databases: ['databases'],
176
+ storage: ['storage'],
177
+ vector: ['vectors', 'vector_databases'],
178
+ caches: ['caches'],
179
+ notifications: ['notifications'],
180
+ messageBrokers: ['message_brokers', 'messageBrokers', 'brokers'],
181
+ sessions: ['sessions'],
182
+ quotas: ['quota', 'quotas'],
183
+ health: ['healthchecks'],
184
+ fallback: ['fallback', 'fallbacks'],
185
+ models: ['models'],
186
+ };
187
+ export function listComponentsFromProduct(module, value) {
188
+ const keys = PRODUCT_COMPONENT_KEYS[module];
189
+ if (!keys || !value || typeof value !== 'object')
190
+ return undefined;
191
+ const envelope = value;
192
+ const product = envelope.data && typeof envelope.data === 'object'
193
+ ? envelope.data
194
+ : envelope;
195
+ const key = keys.find((candidate) => Array.isArray(product[candidate]));
196
+ return key ? product[key] : [];
197
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ductape/cli",
3
- "version": "0.3.13",
3
+ "version": "0.3.15",
4
4
  "description": "Ductape CLI — local platform, login, link projects, and manage resources via the proxy (Workbench-compatible)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",