@erdoai/cli 0.59.1 → 0.60.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 (2) hide show
  1. package/dist/index.js +40 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -870,6 +870,9 @@ var ErdoClient = class {
870
870
  getEventPipeline(slug) {
871
871
  return this.request("GET", `/v1/event-pipelines/${encodeURIComponent(slug)}`);
872
872
  }
873
+ updateEventPipeline(slug, body) {
874
+ return this.request("PUT", `/v1/event-pipelines/${encodeURIComponent(slug)}`, body);
875
+ }
873
876
  listEventPipelineExecutions(slug, limit, offset) {
874
877
  const q = new URLSearchParams();
875
878
  if (limit) q.set("limit", String(limit));
@@ -4093,6 +4096,43 @@ pipelinesCmd.command("get <slug>").description("Show one event pipeline \u2014 s
4093
4096
  fail(e);
4094
4097
  }
4095
4098
  });
4099
+ pipelinesCmd.command("update <slug>").description(
4100
+ "Update an event pipeline's editable fields \u2014 omitted fields keep their current values (merge). Use get first for the current transform/actions; --transform-js/--pipeline accept @file"
4101
+ ).option("--name <name>", "new name").option("--description <description>", "new description").option("--state <state>", "new state: active, disabled, or proposed").option("--transform-js <jsOr@file>", "new transform \u2014 function transform(event) { \u2026 } (or @path to a file)").option(
4102
+ "--pipeline <jsonOr@file>",
4103
+ `replacement ordered actions array as JSON (or @path to a file), e.g. '[{"type":"dataset.write","key_column":"email","dataset_slug":"acme-leads"}]'`
4104
+ ).action(
4105
+ async (slug, opts) => {
4106
+ const body = {};
4107
+ if (opts.name !== void 0) body.name = opts.name;
4108
+ if (opts.description !== void 0) body.description = opts.description;
4109
+ if (opts.state !== void 0) body.state = opts.state;
4110
+ const transformJs = readMaybeFile(opts.transformJs);
4111
+ if (transformJs !== void 0) body.transform_js = transformJs;
4112
+ const pipelineRaw = readMaybeFile(opts.pipeline);
4113
+ if (pipelineRaw !== void 0) {
4114
+ try {
4115
+ const steps = JSON.parse(pipelineRaw);
4116
+ if (!Array.isArray(steps)) throw new Error("not a JSON array");
4117
+ body.pipeline = steps;
4118
+ } catch (e) {
4119
+ fail(new Error(`--pipeline must be a JSON array of actions: ${e instanceof Error ? e.message : String(e)}`));
4120
+ }
4121
+ }
4122
+ if (Object.keys(body).length === 0) {
4123
+ fail(
4124
+ new Error(
4125
+ "nothing to update \u2014 pass at least one of --name, --description, --state, --transform-js, --pipeline"
4126
+ )
4127
+ );
4128
+ }
4129
+ try {
4130
+ print(await new ErdoClient().updateEventPipeline(slug, body));
4131
+ } catch (e) {
4132
+ fail(e);
4133
+ }
4134
+ }
4135
+ );
4096
4136
  filterCmd.command("add <slug>").description("Add a filter to a dataset (default-on unless --no-default)").requiredOption(
4097
4137
  "--where <condition>",
4098
4138
  "a '<column> <operator> <value>' condition (repeatable, AND-combined). A filter KEEPS matching rows, so exclude by matching what you want to keep: --where 'email not_contains @example.com' (label 'Exclude test submissions') hides the test rows; --where 'email contains @acme.com' would keep ONLY @acme.com rows. Operators: " + OPERATORS.join(", ") + " (for 'between' use 'col between 10,100')",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.59.1",
3
+ "version": "0.60.0",
4
4
  "description": "Erdo CLI — drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {