@dataworks-technology/cli 1.0.1 → 1.1.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.
package/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  <div align="center">
4
4
  <picture>
5
- <source media="(prefers-color-scheme: dark)" srcset="https://unpkg.com/@dataworks-technology/cli@latest/.github/.assets/dataworks-light.svg">
6
- <source media="(prefers-color-scheme: light)" srcset="https://unpkg.com/@dataworks-technology/cli@latest/.github/.assets/dataworks-dark.svg">
7
- <img alt="Dataworks Logo" src="https://unpkg.com/@dataworks-technology/cli@latest/.github/.assets/dataworks-dark.svg" width="200">
5
+ <source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/npm/@dataworks-technology/cli@latest/.github/.assets/dataworks-light.svg">
6
+ <source media="(prefers-color-scheme: light)" srcset="https://cdn.jsdelivr.net/npm/@dataworks-technology/cli@latest/.github/.assets/dataworks-dark.svg">
7
+ <img alt="Dataworks Logo" src="https://cdn.jsdelivr.net/npm/@dataworks-technology/cli@latest/.github/.assets/dataworks-dark.svg" width="200">
8
8
  </picture>
9
9
  </div>
10
10
 
@@ -36,7 +36,7 @@ The `dw` binary turns the public GraphQL contract published by `@dataworks-techn
36
36
  ## Prerequisites
37
37
 
38
38
  - [Node.js](https://nodejs.org/) 22 or newer to run the published CLI
39
- - A Dataworks account and Cognito client ID for the target environment
39
+ - A Dataworks account
40
40
  - [Bun](https://bun.sh/) for repository development
41
41
 
42
42
  ---
@@ -53,13 +53,16 @@ The `dw` binary turns the public GraphQL contract published by `@dataworks-techn
53
53
  2. **Authenticate:**
54
54
 
55
55
  ```sh
56
- export DW_UAT_CLIENT_ID=<uat-cognito-client-id>
57
56
  dw auth login --environment uat
58
57
  dw auth status --json
59
58
  ```
60
59
 
61
60
  The CLI opens Dataworks Managed Login in your browser and never receives your password. Sessions are stored in the operating-system credential store, never in the Dataworks config file. If a browser cannot be opened automatically, pass `--no-browser` and visit the displayed URL on the same computer. Headless jobs can provide a protected `DW_SESSION_JSON` secret instead.
62
61
 
62
+ The public UAT and Live Cognito client IDs are built in. Override them with
63
+ `--client-id`, `DW_UAT_CLIENT_ID`, `DW_LIVE_CLIENT_ID`, or `DW_CLIENT_ID` when
64
+ testing a different app client.
65
+
63
66
  3. **Select a tenant.** Run the command without an ID to choose interactively, or
64
67
  pass an ID for noninteractive use. The selection is saved to your local profile.
65
68
 
@@ -1 +1 @@
1
- {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/lib/environment.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,MAAM,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;AAEvE,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,oBAAoB,CAE1E;AAED,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,oBAAoB,EACjC,gBAAgB,CAAC,EAAE,MAAM,GACxB,iBAAiB,CAmBnB;AAED,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,oBAAoB,GAChC,oBAAoB,CAWtB"}
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/lib/environment.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,MAAM,CAAC;AAOlD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;AAEvE,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,oBAAoB,CAE1E;AAED,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,oBAAoB,EACjC,gBAAgB,CAAC,EAAE,MAAM,GACxB,iBAAiB,CAWnB;AAED,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,oBAAoB,GAChC,oBAAoB,CAWtB"}
@@ -1,4 +1,7 @@
1
- import { CliError } from "./errors.js";
1
+ const defaultClientIds = {
2
+ uat: "4hldq2bchmkumaf2jibm719jq2",
3
+ live: "7oug1a58uuof6vg56tg0hbdf58",
4
+ };
2
5
  export function isEnvironment(value) {
3
6
  return value === "uat" || value === "live";
4
7
  }
@@ -6,10 +9,7 @@ export function resolveEnvironment(environment, clientIdOverride) {
6
9
  const clientId = clientIdOverride?.trim() ||
7
10
  process.env[`DW_${environment.toUpperCase()}_CLIENT_ID`]?.trim() ||
8
11
  process.env.DW_CLIENT_ID?.trim() ||
9
- "";
10
- if (!clientId) {
11
- throw new CliError(`No Cognito client ID is configured for ${environment}. Set DW_${environment.toUpperCase()}_CLIENT_ID or DW_CLIENT_ID.`, "CLIENT_ID_REQUIRED", 2);
12
- }
12
+ defaultClientIds[environment];
13
13
  return {
14
14
  ...resolveEndpoints(environment),
15
15
  clientId,
@@ -1 +1 @@
1
- {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/lib/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AA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nC,CAAC;AAeF,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,MAAM,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,WAAiC,EACjC,gBAAyB;IAEzB,MAAM,QAAQ,GACZ,gBAAgB,EAAE,IAAI,EAAE;QACxB,OAAO,CAAC,GAAG,CAAC,MAAM,WAAW,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE,IAAI,EAAE;QAChE,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE;QAChC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAEhC,OAAO;QACL,GAAG,gBAAgB,CAAC,WAAW,CAAC;QAChC,QAAQ;KACT,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,WAAiC;IAEjC,MAAM,MAAM,GAAG,WAAW,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC;IAC/D,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,eAAe,EAAE,8CAA8C;QAC/D,WAAW,EAAE,0BAA0B,WAAW,mCAAmC;QACrF,SAAS,EAAE,mBAAmB,MAAM,kBAAkB;QACtD,QAAQ,EAAE,mBAAmB,MAAM,wBAAwB;QAC3D,WAAW,EAAE,oBAAoB,MAAM,kBAAkB;QACzD,UAAU,EAAE,kBAAkB,MAAM,yBAAyB;KAC9D,CAAC;AACJ,CAAC"}
@@ -11514,5 +11514,5 @@
11514
11514
  ]
11515
11515
  }
11516
11516
  },
11517
- "version": "1.0.1"
11517
+ "version": "1.1.0"
11518
11518
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataworks-technology/cli",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "The official command-line interface for the Dataworks Data Engine",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,17 +1,46 @@
1
1
  ---
2
2
  name: dataworks-cli
3
- description: Use the Dataworks `dw` CLI safely for public Data Engine queries, mutations, ingest, error reporting, and subscriptions.
3
+ description: Route every request to inspect, query, create, update, delete, ingest, monitor, subscribe to, or otherwise act on Dataworks through the `dw` CLI. Use whenever a user asks for any action involving Dataworks data, tenants, authentication, the Data Engine API, events, adaptors, datasets, or related resources.
4
4
  ---
5
5
 
6
6
  # Dataworks CLI
7
7
 
8
- Use `dw commands --json` to discover the installed command contract and
9
- `dw <command> --help` before constructing a call. Prefer generated `dw data ...`
10
- commands over raw GraphQL.
8
+ Use `dw` as the operational interface for every Dataworks action. Do not call a
9
+ Dataworks HTTP or GraphQL endpoint directly, or use an SDK instead, when the CLI
10
+ can perform the action.
11
11
 
12
- Authenticate with `dw auth login --environment uat|live`. Never print, log, or
13
- write `DW_PASSWORD`, `DW_SESSION_JSON`, tokens, or API keys. Use `--json` for
14
- finite machine-readable results; parse subscriptions as NDJSON.
12
+ ## Route the request
13
+
14
+ 1. Run `dw --version` to verify the CLI is available. If it is missing, ask to
15
+ install it with `npm install --global @dataworks-technology/cli`.
16
+ 2. Run `dw commands --json` to discover the installed command contract.
17
+ 3. Run `dw <command> --help` before constructing the exact call.
18
+ 4. Prefer the narrowest matching command:
19
+ - Data Engine entities: `dw data ...`
20
+ - Authentication and session state: `dw auth ...`
21
+ - Tenant discovery and persistence: `dw tenant select ...`
22
+ - Metric ingestion: `dw ingest`
23
+ - Realtime events: `dw events subscribe`
24
+ - Datasource errors: `dw report-error`
25
+ - Raw GraphQL: `dw graphql ...`, only when no generated command exists
26
+ 5. If no CLI command supports the request, report the missing capability and
27
+ ask before using any non-CLI alternative.
28
+
29
+ ## Authenticate and select a tenant
30
+
31
+ Authenticate with `dw auth login --environment uat|live` and inspect the session
32
+ with `dw auth status --json`. Never print, log, or write `DW_PASSWORD`,
33
+ `DW_SESSION_JSON`, tokens, or API keys.
34
+
35
+ Use `dw tenant select --json` to list authorized tenants, `dw tenant select` for
36
+ interactive selection, or `dw tenant select <id>` for a direct selection. The
37
+ selected tenant persists for subsequent commands. Use `--tenant` only for an
38
+ explicit one-command override.
39
+
40
+ ## Execute safely
41
+
42
+ Use `--json` for finite machine-readable results. Treat subscription output as
43
+ NDJSON and process it incrementally.
15
44
 
16
45
  Before any mutation:
17
46
 
@@ -21,6 +50,8 @@ Before any mutation:
21
50
  3. Add `--yes` only after approval. Never infer approval from the presence of
22
51
  credentials.
23
52
 
24
- Use `--tenant` only when the user explicitly requests an authorized tenant
25
- override. For bulk ingest, default to strict validation; use `--best-effort`
26
- only when dropping invalid metrics is acceptable and report all dropped items.
53
+ For bulk ingest, default to strict validation. Use `--best-effort` only when
54
+ dropping invalid metrics is acceptable, and report every dropped item.
55
+
56
+ Report the command used, the selected environment and tenant when relevant, and
57
+ the result without exposing credentials or unredacted sensitive values.