@api-now/cli 1.14.6 → 1.15.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 +32 -1
  2. package/dist/index.js +1319 -54
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -11,7 +11,7 @@ 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
17
  - **Developer Formatting Options**: Toggle outputs between human-friendly ASCII tables and machine-readable JSON.
@@ -334,6 +334,37 @@ cat ./api.json | apinow api oas --stdin --domain ./domain.json
334
334
  apinow api oas <file_id> -o ./openapi.json
335
335
  ```
336
336
 
337
+ #### Generate TypeScript Client SDK (`api sdk`)
338
+
339
+ 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.
340
+
341
+ ```bash
342
+ # Generate SDK files into the current working directory from a remote API model
343
+ apinow api sdk --file <file_id> [--org <org_id>]
344
+
345
+ # Generate SDK files into a designated output directory
346
+ apinow api sdk <file_id> -o ./src/sdk
347
+
348
+ # Generate SDK from local API model and Data Domain schema files
349
+ apinow api sdk ./api.json --domain ./domain.json -o ./sdk
350
+
351
+ # Generate SDK from schema piped via STDIN
352
+ cat ./api.json | apinow api sdk --stdin --domain ./domain.json -o ./sdk
353
+
354
+ # Generate a standalone npm package with package.json and tsconfig.json
355
+ apinow api sdk <file_id> --standalone --package-name @my-org/my-api-sdk -o ./packages/my-api-sdk
356
+
357
+ # Bake a base URL directly into the generated SDK client
358
+ apinow api sdk <file_id> --base-url https://api.example.com/v1
359
+
360
+ # Read the base URL automatically from an active deployment
361
+ apinow api sdk <file_id> --deployment <deployment_id>
362
+ ```
363
+
364
+ > [!TIP]
365
+ > **Base URL Resolution & Interactive Mode**:
366
+ > 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.
367
+
337
368
  ### 7. Schema Validation (`validate`)
338
369
 
339
370
  Validate local or remote Data Domain and API Model schemas against syntax, modeling rules, and naming conventions.