@loxtep/sdk 0.9.24 → 0.9.25
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/CHANGELOG.md +18 -0
- package/README.md +1 -0
- package/dist/cli/commands/data-plane-cmd.d.ts +59 -0
- package/dist/cli/commands/data-plane-cmd.d.ts.map +1 -0
- package/dist/cli/commands/data-plane-cmd.js +604 -0
- package/dist/cli/commands/data-plane-cmd.js.map +1 -0
- package/dist/cli/commands/data-products-cmd.d.ts +3 -1
- package/dist/cli/commands/data-products-cmd.d.ts.map +1 -1
- package/dist/cli/commands/data-products-cmd.js +21 -2
- package/dist/cli/commands/data-products-cmd.js.map +1 -1
- package/dist/cli/commands/define-cmd.d.ts.map +1 -1
- package/dist/cli/commands/define-cmd.js +3 -1
- package/dist/cli/commands/define-cmd.js.map +1 -1
- package/dist/cli/commands/queue-cmd.d.ts +4 -1
- package/dist/cli/commands/queue-cmd.d.ts.map +1 -1
- package/dist/cli/commands/queue-cmd.js +20 -0
- package/dist/cli/commands/queue-cmd.js.map +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +32 -6
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +28 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/client/data-products-types.d.ts +61 -0
- package/dist/client/data-products-types.d.ts.map +1 -1
- package/dist/client/data-products-types.js +12 -1
- package/dist/client/data-products-types.js.map +1 -1
- package/dist/client/data-products.d.ts +13 -1
- package/dist/client/data-products.d.ts.map +1 -1
- package/dist/client/data-products.js +190 -9
- package/dist/client/data-products.js.map +1 -1
- package/dist/client/define.d.ts +3 -0
- package/dist/client/define.d.ts.map +1 -1
- package/dist/client/define.js +1 -0
- package/dist/client/define.js.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/loxtep-client.d.ts +3 -1
- package/dist/client/loxtep-client.d.ts.map +1 -1
- package/dist/client/loxtep-client.js +11 -0
- package/dist/client/loxtep-client.js.map +1 -1
- package/dist/client/quality-rules.d.ts +32 -0
- package/dist/client/quality-rules.d.ts.map +1 -0
- package/dist/client/quality-rules.js +67 -0
- package/dist/client/quality-rules.js.map +1 -0
- package/dist/client/queues.d.ts.map +1 -1
- package/dist/client/queues.js +10 -4
- package/dist/client/queues.js.map +1 -1
- package/dist/client/semantic-layer.d.ts +4 -0
- package/dist/client/semantic-layer.d.ts.map +1 -1
- package/dist/client/semantic-layer.js +8 -0
- package/dist/client/semantic-layer.js.map +1 -1
- package/dist/http/client.d.ts +6 -0
- package/dist/http/client.d.ts.map +1 -1
- package/dist/http/client.js +17 -1
- package/dist/http/client.js.map +1 -1
- package/docs/data-plane-cli.md +201 -0
- package/docs/quick-reference.md +14 -0
- package/package.json +1 -1
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# Data plane CLI
|
|
2
|
+
|
|
3
|
+
Commands added in `@loxtep/sdk` 0.9.25. They call the existing Loxtep REST API
|
|
4
|
+
through the workspace client. Organization, project, and instance come from
|
|
5
|
+
`loxtep attach` and `~/.loxtep`. `--instance <uuid>` overrides
|
|
6
|
+
`x-loxtep-instance-id` for that command.
|
|
7
|
+
|
|
8
|
+
Source in this checkout is 0.9.25. The published npm package and the deployed
|
|
9
|
+
data-products service are separate. A queued rebuild is acceptance of a job,
|
|
10
|
+
not a finished table.
|
|
11
|
+
|
|
12
|
+
Stage targets used while checking these commands:
|
|
13
|
+
|
|
14
|
+
| Name | Id |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| EventLog | `fc5773cd-889c-57ba-ac0f-1d6ec96fc684` |
|
|
17
|
+
| EventDataLog | `b1b6b3ab-43d8-580a-a1ec-9e2113e19016` |
|
|
18
|
+
| Instance | `a9da8b2d-5ef0-44ba-80c9-9039f5b9a8f0` |
|
|
19
|
+
| Project | `ee84d9f6-97da-45d2-a07a-fb0d31ac9f4a` |
|
|
20
|
+
|
|
21
|
+
Production is outside this work. Do not reset MongoDB capture identities,
|
|
22
|
+
retained queues, checkpoints, or namespace exclusions.
|
|
23
|
+
|
|
24
|
+
## Iceberg rebuild
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
loxtep data-products iceberg rebuild <product-id> \
|
|
28
|
+
--backfill-from <z/eid|checkpoint|start_of_queue> \
|
|
29
|
+
[--start-checkpoint <z/eid>] \
|
|
30
|
+
[--end-checkpoint <z/eid>] \
|
|
31
|
+
[--dry-run] [--confirm] [--wait 30s] [--interval 5s] [--json]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Scope is required. The CLI rejects a missing `--backfill-from`, and it rejects
|
|
35
|
+
`start`, `all`, `now`, and the enable windows `1h`, `6h`, `1d`, `7d`, `30d`.
|
|
36
|
+
`checkpoint` needs `--start-checkpoint` beginning with `z/`. `start_of_queue` is
|
|
37
|
+
sent only when that token is typed. Omitting `--end-checkpoint` is evergreen
|
|
38
|
+
and the receipt says `end_bound: evergreen`.
|
|
39
|
+
|
|
40
|
+
`--confirm` is required for a real rebuild. `--dry-run` does not require it.
|
|
41
|
+
The HTTP body still sends `confirm: true` because the API schema requires that
|
|
42
|
+
literal. The receipt says `confirm_sent_for_api_gate: true` and
|
|
43
|
+
`destructive: false` for a dry run.
|
|
44
|
+
|
|
45
|
+
A dry run in the data-products service skips schema-stamp persistence, the
|
|
46
|
+
partition write, and `POST /api/iceberg/config`. It still asks the instance
|
|
47
|
+
worker to plan. The response includes `pending_mutations` for the writes a real
|
|
48
|
+
rebuild would make. That read-only control plane is in source. It is live only
|
|
49
|
+
after the data-products service that contains it is deployed.
|
|
50
|
+
|
|
51
|
+
Exit 0 means the dry run was accepted, or a real rebuild was accepted with
|
|
52
|
+
`completed: false`. Exit 1 is validation, HTTP failure, `already_running`, or
|
|
53
|
+
`endpoint_missing`. `--wait` polls `GET .../iceberg/health` for the same
|
|
54
|
+
`job_id` (or `backfill_job_id` on that overlay). Exit 0 from `--wait` means that
|
|
55
|
+
job reached `completed`. Exit 2 is a timeout: the JSON still has `job_id` and
|
|
56
|
+
the last status, and the command does not POST again and does not cancel.
|
|
57
|
+
A different current job is `job_not_current` (exit 1). A completed status with
|
|
58
|
+
no matching job id is not treated as success.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
loxtep data-products iceberg rebuild b1b6b3ab-43d8-580a-a1ec-9e2113e19016 \
|
|
62
|
+
--backfill-from z/2026/10/10/00/00/1 \
|
|
63
|
+
--dry-run --json
|
|
64
|
+
|
|
65
|
+
loxtep data-products iceberg status b1b6b3ab-43d8-580a-a1ec-9e2113e19016 \
|
|
66
|
+
--job-id <accepted-job-id> --wait 30s --json
|
|
67
|
+
|
|
68
|
+
loxtep data-products iceberg cancel b1b6b3ab-43d8-580a-a1ec-9e2113e19016 --json
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Cancel calls `POST .../iceberg/rebuild/cancel`. When the instance has no cancel
|
|
72
|
+
route, the error code stays `endpoint_missing`. That is not a cancelled job.
|
|
73
|
+
|
|
74
|
+
## Enable, config, and inspection
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
loxtep data-products iceberg enable <product-id> \
|
|
78
|
+
--config '<json>' | --file <path> \
|
|
79
|
+
[--backfill-from now|1h|6h|1d|7d|30d|all]
|
|
80
|
+
|
|
81
|
+
loxtep data-products iceberg config <product-id>
|
|
82
|
+
loxtep data-products iceberg config <product-id> --put --file <path>
|
|
83
|
+
loxtep data-products iceberg health <product-id>
|
|
84
|
+
loxtep data-products iceberg files <product-id>
|
|
85
|
+
loxtep data-products iceberg snapshots <product-id>
|
|
86
|
+
loxtep data-products iceberg schema <product-id> --json
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Enable history windows are only `now`, `1h`, `6h`, `1d`, `7d`, `30d`, and `all`.
|
|
90
|
+
Omitting the window sends no history. A `z/` event id is not accepted on enable.
|
|
91
|
+
The command does not invent a partition; `--config` or `--file` supplies
|
|
92
|
+
`iceberg_config`.
|
|
93
|
+
|
|
94
|
+
There is no `GET /iceberg/config`. `config` without `--put` reads
|
|
95
|
+
`GET /dataproducts/{id}/iceberg` and prints `iceberg_config`. `--put` writes
|
|
96
|
+
`PUT /dataproducts/{id}/iceberg/config`.
|
|
97
|
+
|
|
98
|
+
`schema` prints four blocks:
|
|
99
|
+
|
|
100
|
+
- `catalog` — the product schema, including fields such as `event_type`.
|
|
101
|
+
- `physical` — Iceberg metadata fields, partition, file and snapshot counts, plus the configured partition from status.
|
|
102
|
+
- `materialization` — assessment status, rebuild and backfill status, writer sync.
|
|
103
|
+
- `inspection` — `ok` when metadata was read (including `schema_mismatch`), `empty_ok`, `unknown` for `unknown` and `managed_s3_tables`, `unreadable`, or `not_applicable`.
|
|
104
|
+
|
|
105
|
+
`schema_mismatch` stays a materialization status. The catalog field is not removed.
|
|
106
|
+
|
|
107
|
+
## SQL receipt
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
loxtep data-products query <product-id> "SELECT event_type FROM t LIMIT 10" --receipt
|
|
111
|
+
loxtep data-products query <product-id> --file ./query.sql --json
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`data_products.query` still returns rows, and only when the native status is
|
|
115
|
+
`completed`. Any other status, including a missing status, throws
|
|
116
|
+
`WarehouseQueryError` and does not rewrite the status to completed. The error
|
|
117
|
+
includes `query_id` when the body has one.
|
|
118
|
+
|
|
119
|
+
`--receipt` and `--json` print `query_id`, `status`, columns, rows, `row_count`,
|
|
120
|
+
`execution_time_ms`, `error`, `error_code`, `tables_referenced`, `recovery`,
|
|
121
|
+
`iceberg_health_status`, and `completion_evidence` (`native` or `missing`).
|
|
122
|
+
Failed and unfinished queries exit 1. Warehouse execute is synchronous. There
|
|
123
|
+
is no second poll URL.
|
|
124
|
+
|
|
125
|
+
SDK:
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
const receipt = await client.build.data_products.query_receipt(productId, sql);
|
|
129
|
+
const rows = await client.build.data_products.query(productId, sql);
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Python `DataProductsApi.query` still returns rows only. The Python CLI delegates
|
|
133
|
+
unknown commands to the Node CLI.
|
|
134
|
+
|
|
135
|
+
## Read-only export
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
loxtep data-products export <product-id> \
|
|
139
|
+
--start <eid> | --from-beginning \
|
|
140
|
+
[--end <eid>] [--limit 100] [--max-pages 1] \
|
|
141
|
+
[--instance <uuid>] [--json]
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
This pages `GET /observe/trace/{queue}/events`. It does not open a reader, commit
|
|
145
|
+
a checkpoint, or trigger a workflow. The result says `read_only: true` and
|
|
146
|
+
`checkpoint_committed: false`. The trace API has no limit or cursor of its own,
|
|
147
|
+
so the client slices the page. `truncated` is true when the page is longer than
|
|
148
|
+
`--limit` or `--max-pages` stops the loop. `next_start` may repeat the last
|
|
149
|
+
included event id because trace start is inclusive. If the server sends `next`
|
|
150
|
+
or `next_start`, that cursor is preferred.
|
|
151
|
+
|
|
152
|
+
`--from-beginning` sends `start=0`. With neither `--start` nor
|
|
153
|
+
`--from-beginning`, the command exits 1 and does not fetch. Export and queue
|
|
154
|
+
reads require an instance id. A queue name missing from that instance's list is
|
|
155
|
+
`not_visible`. An empty list for that instance is `empty_on_selected_instance`.
|
|
156
|
+
Neither result is an empty checkpoint.
|
|
157
|
+
|
|
158
|
+
`data_products.replay()` remains the path that delivers events to a destination.
|
|
159
|
+
Iceberg rebuild is the history-delivery path. Export is not replay.
|
|
160
|
+
|
|
161
|
+
## Governance
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
loxtep data-contracts update <contract-id> --schema-version-id <uuid> --json
|
|
165
|
+
loxtep quality-rules list [--data-product-id <uuid>] [--rule-type <type>] [--severity <level>]
|
|
166
|
+
loxtep quality-rules get <id> [--data-product-id <uuid>]
|
|
167
|
+
loxtep quality-rules create --file <json>
|
|
168
|
+
loxtep quality-rules update <id> --file <json>
|
|
169
|
+
loxtep quality-rules delete <id>
|
|
170
|
+
loxtep define glossary <product-id>
|
|
171
|
+
loxtep define apply-glossary <product-id> [--mapping-revision N]
|
|
172
|
+
loxtep data-products primary-entity <product-id>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Contract update is `PUT /dataproducts/datacontracts/{id}` with
|
|
176
|
+
`schema_version_id`. Quality rules use `/dataproducts/quality-rules`. There is
|
|
177
|
+
no GET-by-id route, so `get` scans the list and returns `not_in_list` when the
|
|
178
|
+
id is absent. Create allows `uniqueness`. The list filter enum on the service
|
|
179
|
+
may omit it.
|
|
180
|
+
|
|
181
|
+
Glossary apply posts `/semantic-layer/glossary/bindings` with
|
|
182
|
+
`{ data_product_id, mapping_revision? }`. `define glossary` reads the product
|
|
183
|
+
lexicon. Primary entity is read from `schema.entities`. Changing it goes through
|
|
184
|
+
`define submit-shape`, then approve and apply. The command does not write a key.
|
|
185
|
+
A source trigger or delivery id is not treated as a unique lookup key.
|
|
186
|
+
|
|
187
|
+
## Release and deploy
|
|
188
|
+
|
|
189
|
+
1. Data-products dry-run and warehouse schema-mismatch behavior ship with the
|
|
190
|
+
platform service. Until that service is deployed, a CLI dry run can still hit
|
|
191
|
+
the previous handler.
|
|
192
|
+
2. Publish Node `@loxtep/sdk` 0.9.25 with tag `v0.9.25`. Python stays 0.7.2
|
|
193
|
+
unless `data_products.py` changes. Do not use a bare `v*` tag for a Python-only
|
|
194
|
+
release.
|
|
195
|
+
3. After npm publish, install the global CLI and run `hash -r`. Confirm
|
|
196
|
+
`loxtep --version` and `loxtep data-products iceberg --help` (or `loxtep --help`)
|
|
197
|
+
show 0.9.25 and the new commands. A pnpm global shim can keep pointing at an
|
|
198
|
+
older copy after install.
|
|
199
|
+
4. Stage checks of EventLog and EventDataLog come after the package is installed
|
|
200
|
+
and the data-products deploy is confirmed. Cancel may still return
|
|
201
|
+
`endpoint_missing` until the instance cancel route exists.
|
package/docs/quick-reference.md
CHANGED
|
@@ -229,6 +229,19 @@ in application code.
|
|
|
229
229
|
|
|
230
230
|
---
|
|
231
231
|
|
|
232
|
+
## Data plane
|
|
233
|
+
|
|
234
|
+
Iceberg rebuild, inspection, SQL receipts, and read-only export are in
|
|
235
|
+
[Data plane CLI](./data-plane-cli.md). A queued rebuild is not a finished table.
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
pnpm exec loxtep data-products iceberg rebuild <id> --backfill-from z/2026/10/10/00/00/1 --dry-run --json
|
|
239
|
+
pnpm exec loxtep data-products query <id> "SELECT 1" --receipt
|
|
240
|
+
pnpm exec loxtep data-products export <id> --start z/2026/10/10/00/00/1 --limit 100 --json
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
232
245
|
## Further Reading
|
|
233
246
|
|
|
234
247
|
| Resource | Description |
|
|
@@ -236,3 +249,4 @@ in application code.
|
|
|
236
249
|
| [Getting Started Guide](./getting-started.md) | Zero-to-first-event walkthrough |
|
|
237
250
|
| [Event Replay Cookbook](./event-replay-cookbook.md) | Replay patterns (`build.data_products`, `observe`) |
|
|
238
251
|
| [Code-first CLI guide](./code-first-cli.md) | `loxtep init` through deploy |
|
|
252
|
+
| [Data plane CLI](./data-plane-cli.md) | Iceberg rebuild, SQL receipts, read-only export |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loxtep/sdk",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.25",
|
|
4
4
|
"description": "Loxtep SDK for Node.js — the Enterprise Context Layer: data products, workflows, projects, queues, and machine-usable context for AI",
|
|
5
5
|
"author": "Loxtep <engineering@loxtep.io>",
|
|
6
6
|
"homepage": "https://loxtep.io",
|