@oxygen-agent/cli 1.160.18 → 1.162.10
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
package/dist/index.js
CHANGED
|
@@ -137,6 +137,82 @@ function parseJsonArray(value) {
|
|
|
137
137
|
}
|
|
138
138
|
return parsed;
|
|
139
139
|
}
|
|
140
|
+
async function readDeleteRowIdsOption(options) {
|
|
141
|
+
const rowIdsJson = readOption(options.rowIdsJson);
|
|
142
|
+
const rowIdsFile = readOption(options.rowIdsFile);
|
|
143
|
+
if (rowIdsJson && rowIdsFile) {
|
|
144
|
+
throw new OxygenError("invalid_request", "Pass either --row-ids-json or --row-ids-file, not both.", {
|
|
145
|
+
exitCode: 1,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
if (!rowIdsJson && !rowIdsFile) {
|
|
149
|
+
throw new OxygenError("invalid_request", "Pass --row-ids-json or --row-ids-file.", {
|
|
150
|
+
exitCode: 1,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
if (rowIdsJson)
|
|
154
|
+
return normalizeDeleteRowIds(parseJsonArray(rowIdsJson));
|
|
155
|
+
const filePath = resolve(rowIdsFile ?? "");
|
|
156
|
+
const buffer = readFileSync(filePath);
|
|
157
|
+
const format = normalizeRowsFormat(options.format, inferRowsFileFormat(filePath));
|
|
158
|
+
if (format === "json") {
|
|
159
|
+
const text = buffer.toString("utf8");
|
|
160
|
+
const inlineIds = tryParseJsonStringArray(text);
|
|
161
|
+
if (inlineIds)
|
|
162
|
+
return normalizeDeleteRowIds(inlineIds);
|
|
163
|
+
if (!options.format && !text.trimStart().startsWith("[")) {
|
|
164
|
+
return normalizeDeleteRowIds(parsePlainRowIdList(text));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const sheet = readOption(options.sheet);
|
|
168
|
+
const rows = await parseRowsFileBuffer(buffer, format, sheet ? { sheet } : {});
|
|
169
|
+
const rowIdColumn = readOption(options.rowIdColumn) ?? "_row_id";
|
|
170
|
+
return normalizeDeleteRowIds(rows.map((row, index) => {
|
|
171
|
+
const value = row[rowIdColumn];
|
|
172
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
173
|
+
throw new OxygenError("invalid_request", `Row id column "${rowIdColumn}" must contain row UUID strings.`, {
|
|
174
|
+
details: { row_number: index + 1, column: rowIdColumn },
|
|
175
|
+
exitCode: 1,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
return value.trim();
|
|
179
|
+
}));
|
|
180
|
+
}
|
|
181
|
+
function tryParseJsonStringArray(value) {
|
|
182
|
+
let parsed;
|
|
183
|
+
try {
|
|
184
|
+
parsed = JSON.parse(value);
|
|
185
|
+
}
|
|
186
|
+
catch {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
if (!Array.isArray(parsed) || !parsed.every((entry) => typeof entry === "string"))
|
|
190
|
+
return null;
|
|
191
|
+
return parsed;
|
|
192
|
+
}
|
|
193
|
+
function parsePlainRowIdList(value) {
|
|
194
|
+
return value
|
|
195
|
+
.split(/[\n,]/)
|
|
196
|
+
.map((entry) => entry.trim())
|
|
197
|
+
.filter(Boolean);
|
|
198
|
+
}
|
|
199
|
+
function normalizeDeleteRowIds(values) {
|
|
200
|
+
const rowIds = values.map((value, index) => {
|
|
201
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
202
|
+
throw new OxygenError("invalid_request", "Row IDs must be non-empty strings.", {
|
|
203
|
+
details: { index },
|
|
204
|
+
exitCode: 1,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return value.trim();
|
|
208
|
+
});
|
|
209
|
+
if (rowIds.length === 0) {
|
|
210
|
+
throw new OxygenError("invalid_request", "Row ID list cannot be empty.", {
|
|
211
|
+
exitCode: 1,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
return rowIds;
|
|
215
|
+
}
|
|
140
216
|
function readCustomIntegrationManifest(options) {
|
|
141
217
|
const manifestPath = readOption(options.manifest);
|
|
142
218
|
const manifestJson = readOption(options.manifestJson);
|
|
@@ -766,6 +842,27 @@ export function createProgram() {
|
|
|
766
842
|
row_id: rowId,
|
|
767
843
|
},
|
|
768
844
|
}));
|
|
845
|
+
}))
|
|
846
|
+
.addCommand(new Command("delete-rows")
|
|
847
|
+
.description("Delete multiple workspace table rows.")
|
|
848
|
+
.argument("<table>", "Table id or slug.")
|
|
849
|
+
.option("--row-ids-json <json>", "JSON array of workspace row UUIDs.")
|
|
850
|
+
.option("--row-ids-file <path>", "File containing row UUIDs or rows with a _row_id column.")
|
|
851
|
+
.option("--row-id-column <key>", "Column to read from --row-ids-file. Defaults to _row_id.")
|
|
852
|
+
.option("--format <format>", "File format for --row-ids-file: json, jsonl, csv, or xlsx.")
|
|
853
|
+
.option("--sheet <name>", "Worksheet name when reading row IDs from an XLSX file.")
|
|
854
|
+
.option("--json", "Print a JSON envelope.")
|
|
855
|
+
.action(async (table, options) => {
|
|
856
|
+
await handleAsyncAction("tables delete-rows", options, async () => {
|
|
857
|
+
const rowIds = await readDeleteRowIdsOption(options);
|
|
858
|
+
return requestOxygen("/api/cli/tables/rows/delete", {
|
|
859
|
+
method: "POST",
|
|
860
|
+
body: {
|
|
861
|
+
table,
|
|
862
|
+
row_ids: rowIds,
|
|
863
|
+
},
|
|
864
|
+
});
|
|
865
|
+
});
|
|
769
866
|
}))
|
|
770
867
|
.addCommand(new Command("upsert")
|
|
771
868
|
.description("Insert or update rows in a workspace table by a column key.")
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const OXYGEN_VERSION = "1.
|
|
1
|
+
export declare const OXYGEN_VERSION = "1.162.10";
|
|
2
2
|
export declare const OXYGEN_MINIMUM_CLI_VERSION = "1.154.0";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const OXYGEN_VERSION = "1.
|
|
1
|
+
export const OXYGEN_VERSION = "1.162.10";
|
|
2
2
|
// Bump this only when deployed CLI/API contracts require a newer CLI.
|
|
3
3
|
// 1.154.0: LinkedIn → Sequencer rename moved the CLI/API/MCP surface
|
|
4
4
|
// (oxygen sequences|inbox|senders, /api/cli/{sequences,inbox,senders}) and
|