@api-now/cli 1.14.6 → 1.16.0

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.
Files changed (3) hide show
  1. package/README.md +82 -1
  2. package/dist/index.js +1444 -65
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -11,9 +11,10 @@ The **API NOW! CLI** is a robust, cross-platform command-line tool designed to m
11
11
  - **Default Organization Management**: List organizations and pin a default workspace ID.
12
12
  - **Metadata and Media Uploads**: Create, list, and read blueprints, domains, and multimedia assets.
13
13
  - **Data Domain Management & Publishing**: Search, list, create, mutate via declarative JSON patch diffing, transition lifecycles (`draft`, `committed`, `published`), bump versions, run pre-publish validation, and publish domains directly to the Data Catalog.
14
- - **API Model Management**: Search, list, create, and read API Model files and schemas with immediate parent folder resolution.
14
+ - **API Model Management & Code Generation**: Search, list, create, and read API Model files, generate OpenAPI Specifications (OAS 3.1), and generate type-safe TypeScript client SDKs.
15
15
  - **Local & Remote Schema Validation**: Validate Data Domain and API Model schemas from local files, STDIN, or directly from remote organization files.
16
16
  - **Data Catalog Publishing**: Publish schemas and datasets to the global/private catalog with automatic semantic versioning support, deprecation, and unpublishing.
17
+ - **Deployment Management**: List deployments filtered by API ID, inspect environments (production, staging, development), deployment statuses, model versions, and base URIs with robust permission and error handling.
17
18
  - **Developer Formatting Options**: Toggle outputs between human-friendly ASCII tables and machine-readable JSON.
18
19
 
19
20
  ---
@@ -334,6 +335,37 @@ cat ./api.json | apinow api oas --stdin --domain ./domain.json
334
335
  apinow api oas <file_id> -o ./openapi.json
335
336
  ```
336
337
 
338
+ #### Generate TypeScript Client SDK (`api sdk`)
339
+
340
+ Generate a type-safe TypeScript client SDK from an API model (live cloud model, local schema file, or STDIN). Supports generating raw source files directly into a project or a complete standalone npm package.
341
+
342
+ ```bash
343
+ # Generate SDK files into the current working directory from a remote API model
344
+ apinow api sdk --file <file_id> [--org <org_id>]
345
+
346
+ # Generate SDK files into a designated output directory
347
+ apinow api sdk <file_id> -o ./src/sdk
348
+
349
+ # Generate SDK from local API model and Data Domain schema files
350
+ apinow api sdk ./api.json --domain ./domain.json -o ./sdk
351
+
352
+ # Generate SDK from schema piped via STDIN
353
+ cat ./api.json | apinow api sdk --stdin --domain ./domain.json -o ./sdk
354
+
355
+ # Generate a standalone npm package with package.json and tsconfig.json
356
+ apinow api sdk <file_id> --standalone --package-name @my-org/my-api-sdk -o ./packages/my-api-sdk
357
+
358
+ # Bake a base URL directly into the generated SDK client
359
+ apinow api sdk <file_id> --base-url https://api.example.com/v1
360
+
361
+ # Read the base URL automatically from an active deployment
362
+ apinow api sdk <file_id> --deployment <deployment_id>
363
+ ```
364
+
365
+ > [!TIP]
366
+ > **Base URL Resolution & Interactive Mode**:
367
+ > When generating an SDK for a remote API model without specifying `--base-url` or `--deployment`, the CLI in interactive TTY mode will prompt you to select an active deployment, enter a custom base URL, or skip baking the base URL so that consumers configure it at client initialization.
368
+
337
369
  ### 7. Schema Validation (`validate`)
338
370
 
339
371
  Validate local or remote Data Domain and API Model schemas against syntax, modeling rules, and naming conventions.
@@ -394,6 +426,55 @@ apinow runtime users update --api <api_file_id_or_slug> --user-id <user_id> --pr
394
426
  apinow runtime users update --api api-123 --user-id user-123 --property role=admin tier=premium --org org-123
395
427
  ```
396
428
 
429
+ ### 10. Deployments (`deployment`)
430
+
431
+ Manage API deployments in your organizations.
432
+
433
+ #### List Deployments (`deployment list`)
434
+
435
+ List all deployments for a specific API model file. Filter deployments by providing the API ID as a positional argument or with the `--api` option (alias: `--file`, `--id`).
436
+
437
+ > [!NOTE]
438
+ > Viewing deployments requires appropriate organization permissions. If your user account or token does not have permission to view deployments, the command returns an error (`CLI_ERR_FORBIDDEN`).
439
+
440
+ ```bash
441
+ # List deployments for an API by ID (positional argument)
442
+ apinow deployment list <api_file_id> [--org <org_id>]
443
+
444
+ # List deployments using the --api flag
445
+ apinow deployment list --api <api_file_id> [--org <org_id>]
446
+
447
+ # List deployments using the --file flag alias
448
+ apinow deployment list --file <api_file_id> [--org <org_id>]
449
+
450
+ # Limit the number of deployment records returned
451
+ apinow deployment list <api_file_id> --limit 10
452
+
453
+ # Output deployment details in machine-readable JSON format
454
+ apinow deployment list <api_file_id> --format json
455
+ ```
456
+
457
+ #### Read Deployment Details (`deployment read` / `deployment get`)
458
+
459
+ Read the detailed status and configuration of a specific deployment (including environments, base URI, portal URI, versions, and CORS settings).
460
+
461
+ ```bash
462
+ # Read deployment details by ID (positional argument)
463
+ apinow deployment read <deployment_id> [--org <org_id>]
464
+
465
+ # Using the 'get' alias
466
+ apinow deployment get <deployment_id> [--org <org_id>]
467
+
468
+ # Read deployment using the --id flag
469
+ apinow deployment read --id <deployment_id> [--org <org_id>]
470
+
471
+ # Read deployment using the --deployment flag alias
472
+ apinow deployment get --deployment <deployment_id> [--org <org_id>]
473
+
474
+ # Output deployment details in machine-readable JSON format
475
+ apinow deployment read <deployment_id> --format json
476
+ ```
477
+
397
478
  ---
398
479
 
399
480
  ## Development