@claypi/cli 0.1.0 → 0.1.1
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/dist/index.js +375 -209
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -61387,6 +61387,31 @@ function clearDefaultProfile() {
|
|
|
61387
61387
|
writeConfig({ ...existing, profiles: rest });
|
|
61388
61388
|
}
|
|
61389
61389
|
|
|
61390
|
+
// src/auth/credentials-file.ts
|
|
61391
|
+
var import_node_fs4 = require("fs");
|
|
61392
|
+
var CREDENTIALS_FILE_PATH = "/mnt/session/uploads/.clay-credentials";
|
|
61393
|
+
function parseDotenv(content) {
|
|
61394
|
+
const out = {};
|
|
61395
|
+
for (const line of content.split("\n")) {
|
|
61396
|
+
const trimmed = line.trim();
|
|
61397
|
+
if (trimmed === "" || trimmed.startsWith("#")) continue;
|
|
61398
|
+
const eq = trimmed.indexOf("=");
|
|
61399
|
+
if (eq <= 0) continue;
|
|
61400
|
+
out[trimmed.slice(0, eq).trim()] = trimmed.slice(eq + 1).trim();
|
|
61401
|
+
}
|
|
61402
|
+
return out;
|
|
61403
|
+
}
|
|
61404
|
+
function credentialFromFile(key) {
|
|
61405
|
+
let content;
|
|
61406
|
+
try {
|
|
61407
|
+
content = (0, import_node_fs4.readFileSync)(CREDENTIALS_FILE_PATH, "utf-8");
|
|
61408
|
+
} catch {
|
|
61409
|
+
return void 0;
|
|
61410
|
+
}
|
|
61411
|
+
const value = parseDotenv(content)[key]?.trim();
|
|
61412
|
+
return value === void 0 || value === "" ? void 0 : value;
|
|
61413
|
+
}
|
|
61414
|
+
|
|
61390
61415
|
// src/auth/api-key-provider.ts
|
|
61391
61416
|
var ApiKeyProvider = class {
|
|
61392
61417
|
getApiKey() {
|
|
@@ -61398,6 +61423,10 @@ var ApiKeyProvider = class {
|
|
|
61398
61423
|
if (fromEnv !== void 0 && fromEnv !== "") {
|
|
61399
61424
|
return Promise.resolve(fromEnv);
|
|
61400
61425
|
}
|
|
61426
|
+
const fromFile = credentialFromFile("CLAY_API_KEY");
|
|
61427
|
+
if (fromFile !== void 0) {
|
|
61428
|
+
return Promise.resolve(fromFile);
|
|
61429
|
+
}
|
|
61401
61430
|
return Promise.reject(new MissingApiKeyError());
|
|
61402
61431
|
}
|
|
61403
61432
|
};
|
|
@@ -61418,11 +61447,18 @@ function normalizeBaseUrl(raw) {
|
|
|
61418
61447
|
}
|
|
61419
61448
|
return trimmed.replace(/\/+$/, "");
|
|
61420
61449
|
}
|
|
61450
|
+
function resolveBaseUrl() {
|
|
61451
|
+
const fromEnv = process.env.CLAY_API_URL?.trim();
|
|
61452
|
+
if (fromEnv !== void 0 && fromEnv !== "") {
|
|
61453
|
+
return normalizeBaseUrl(fromEnv);
|
|
61454
|
+
}
|
|
61455
|
+
return normalizeBaseUrl(credentialFromFile("CLAY_API_URL"));
|
|
61456
|
+
}
|
|
61421
61457
|
|
|
61422
61458
|
// src/version.ts
|
|
61423
|
-
var
|
|
61459
|
+
var import_node_fs5 = require("fs");
|
|
61424
61460
|
var import_node_path3 = require("path");
|
|
61425
|
-
var pkg = JSON.parse((0,
|
|
61461
|
+
var pkg = JSON.parse((0, import_node_fs5.readFileSync)((0, import_node_path3.join)(__dirname, "..", "package.json"), "utf8"));
|
|
61426
61462
|
var CLI_VERSION = pkg.version;
|
|
61427
61463
|
|
|
61428
61464
|
// src/clients/cli-attribution-headers.ts
|
|
@@ -61483,7 +61519,7 @@ var PUBLIC_API_V0_PREFIX = "/public/v0";
|
|
|
61483
61519
|
var cache = /* @__PURE__ */ new Map();
|
|
61484
61520
|
function createPublicApiClient(contract, apiKey) {
|
|
61485
61521
|
return initClient(contract, {
|
|
61486
|
-
baseUrl: `${
|
|
61522
|
+
baseUrl: `${resolveBaseUrl()}${PUBLIC_API_V0_PREFIX}`,
|
|
61487
61523
|
baseHeaders: {
|
|
61488
61524
|
[CLAY_API_KEY_HEADER]: apiKey,
|
|
61489
61525
|
...cliAttributionHeaders()
|
|
@@ -61518,7 +61554,7 @@ async function v3Client(contract, options = {}) {
|
|
|
61518
61554
|
}
|
|
61519
61555
|
const apiKey = await tokenProvider.getApiKey();
|
|
61520
61556
|
const client = initClient(contract, {
|
|
61521
|
-
baseUrl: `${
|
|
61557
|
+
baseUrl: `${resolveBaseUrl()}/v3`,
|
|
61522
61558
|
baseHeaders: {
|
|
61523
61559
|
[CLAY_API_KEY_HEADER]: apiKey,
|
|
61524
61560
|
...cliAttributionHeaders()
|
|
@@ -75861,12 +75897,12 @@ function captureWorkerThreadEvents(worker, options) {
|
|
|
75861
75897
|
|
|
75862
75898
|
// ../../node_modules/@sentry/node/node_modules/@sentry/node-core/build/esm/integrations/context.js
|
|
75863
75899
|
var import_node_child_process = require("child_process");
|
|
75864
|
-
var
|
|
75900
|
+
var import_node_fs6 = require("fs");
|
|
75865
75901
|
var os = __toESM(require("os"), 1);
|
|
75866
75902
|
var import_node_path4 = require("path");
|
|
75867
75903
|
var import_node_util = require("util");
|
|
75868
|
-
var readFileAsync = (0, import_node_util.promisify)(
|
|
75869
|
-
var readDirAsync = (0, import_node_util.promisify)(
|
|
75904
|
+
var readFileAsync = (0, import_node_util.promisify)(import_node_fs6.readFile);
|
|
75905
|
+
var readDirAsync = (0, import_node_util.promisify)(import_node_fs6.readdir);
|
|
75870
75906
|
var INTEGRATION_NAME12 = "Context";
|
|
75871
75907
|
var _nodeContextIntegration = ((options = {}) => {
|
|
75872
75908
|
let cachedContext;
|
|
@@ -76149,7 +76185,7 @@ function getCloudResourceContext() {
|
|
|
76149
76185
|
}
|
|
76150
76186
|
|
|
76151
76187
|
// ../../node_modules/@sentry/node/node_modules/@sentry/node-core/build/esm/integrations/contextlines.js
|
|
76152
|
-
var
|
|
76188
|
+
var import_node_fs7 = require("fs");
|
|
76153
76189
|
var import_node_readline = require("readline");
|
|
76154
76190
|
var LRU_FILE_CONTENTS_CACHE = new LRUMap(10);
|
|
76155
76191
|
var LRU_FILE_CONTENTS_FS_READ_FAILED = new LRUMap(20);
|
|
@@ -76220,7 +76256,7 @@ function makeLineReaderRanges(lines, linecontext) {
|
|
|
76220
76256
|
}
|
|
76221
76257
|
function getContextLinesFromFile(path7, ranges, output) {
|
|
76222
76258
|
return new Promise((resolve2, _reject) => {
|
|
76223
|
-
const stream = (0,
|
|
76259
|
+
const stream = (0, import_node_fs7.createReadStream)(path7);
|
|
76224
76260
|
const lineReaded = (0, import_node_readline.createInterface)({
|
|
76225
76261
|
input: stream
|
|
76226
76262
|
});
|
|
@@ -76824,7 +76860,7 @@ var localVariablesIntegration = (options = {}) => {
|
|
|
76824
76860
|
};
|
|
76825
76861
|
|
|
76826
76862
|
// ../../node_modules/@sentry/node/node_modules/@sentry/node-core/build/esm/integrations/modules.js
|
|
76827
|
-
var
|
|
76863
|
+
var import_node_fs8 = require("fs");
|
|
76828
76864
|
var import_node_path5 = require("path");
|
|
76829
76865
|
|
|
76830
76866
|
// ../../node_modules/@sentry/node/node_modules/@sentry/node-core/build/esm/utils/detection.js
|
|
@@ -76904,11 +76940,11 @@ function collectRequireModules() {
|
|
|
76904
76940
|
}
|
|
76905
76941
|
const pkgfile = (0, import_node_path5.join)(orig, "package.json");
|
|
76906
76942
|
seen.add(orig);
|
|
76907
|
-
if (!(0,
|
|
76943
|
+
if (!(0, import_node_fs8.existsSync)(pkgfile)) {
|
|
76908
76944
|
return updir();
|
|
76909
76945
|
}
|
|
76910
76946
|
try {
|
|
76911
|
-
const info = JSON.parse((0,
|
|
76947
|
+
const info = JSON.parse((0, import_node_fs8.readFileSync)(pkgfile, "utf8"));
|
|
76912
76948
|
infos[info.name] = info.version;
|
|
76913
76949
|
} catch {
|
|
76914
76950
|
}
|
|
@@ -76926,7 +76962,7 @@ function _getModules() {
|
|
|
76926
76962
|
function getPackageJson() {
|
|
76927
76963
|
try {
|
|
76928
76964
|
const filePath = (0, import_node_path5.join)(process.cwd(), "package.json");
|
|
76929
|
-
const packageJson = JSON.parse((0,
|
|
76965
|
+
const packageJson = JSON.parse((0, import_node_fs8.readFileSync)(filePath, "utf8"));
|
|
76930
76966
|
return packageJson;
|
|
76931
76967
|
} catch {
|
|
76932
76968
|
return {};
|
|
@@ -82756,6 +82792,25 @@ function applyClaySettings(cmd) {
|
|
|
82756
82792
|
return cmd;
|
|
82757
82793
|
}
|
|
82758
82794
|
|
|
82795
|
+
// ../../libs/api-contract/src/public-api-v0/pagination.ts
|
|
82796
|
+
var DEFAULT_PAGE_LIMIT = 20;
|
|
82797
|
+
var MAX_PAGE_LIMIT = 100;
|
|
82798
|
+
function paginatedQuerySchema({
|
|
82799
|
+
defaultLimit = DEFAULT_PAGE_LIMIT,
|
|
82800
|
+
maxLimit = MAX_PAGE_LIMIT
|
|
82801
|
+
} = {}) {
|
|
82802
|
+
return external_exports.object({
|
|
82803
|
+
cursor: external_exports.string().optional(),
|
|
82804
|
+
limit: external_exports.coerce.number().int().min(1).max(maxLimit).default(defaultLimit)
|
|
82805
|
+
});
|
|
82806
|
+
}
|
|
82807
|
+
function paginatedResponse(itemSchema) {
|
|
82808
|
+
return external_exports.object({
|
|
82809
|
+
data: external_exports.array(itemSchema),
|
|
82810
|
+
cursor: external_exports.string().optional()
|
|
82811
|
+
});
|
|
82812
|
+
}
|
|
82813
|
+
|
|
82759
82814
|
// ../../libs/api-contract/src/common/interfaces.ts
|
|
82760
82815
|
var SerializedTimestamp = external_exports.object({
|
|
82761
82816
|
createdAt: external_exports.string(),
|
|
@@ -82862,58 +82917,60 @@ var tablesSummaryContract = {
|
|
|
82862
82917
|
}
|
|
82863
82918
|
};
|
|
82864
82919
|
|
|
82865
|
-
// src/commands/
|
|
82866
|
-
var
|
|
82867
|
-
|
|
82868
|
-
|
|
82869
|
-
|
|
82870
|
-
|
|
82871
|
-
|
|
82872
|
-
get cursor() {
|
|
82873
|
-
return this.currentCursor;
|
|
82874
|
-
}
|
|
82875
|
-
advance(nextCursor, pageItemCount) {
|
|
82876
|
-
if (nextCursor === this.currentCursor) {
|
|
82877
|
-
throw new IncompatibleApiServerError(
|
|
82878
|
-
"Clay API returned the same pagination cursor twice in a row; aborting auto-pagination."
|
|
82879
|
-
);
|
|
82880
|
-
}
|
|
82881
|
-
this.itemsFetched += pageItemCount;
|
|
82882
|
-
this.pagesFetched += 1;
|
|
82883
|
-
if (this.itemsFetched >= MAX_AUTO_PAGINATE_ITEMS) {
|
|
82884
|
-
throw new IncompatibleApiServerError(
|
|
82885
|
-
`Auto-pagination stopped after ${MAX_AUTO_PAGINATE_ITEMS} items without reaching the end of the result set; narrow the request to fetch fewer rows.`
|
|
82886
|
-
);
|
|
82920
|
+
// src/commands/flag-parsers.ts
|
|
82921
|
+
var import_node_fs9 = require("fs");
|
|
82922
|
+
function parsePositiveIntegerFlag(flagName, max) {
|
|
82923
|
+
return (value) => {
|
|
82924
|
+
const n = Number.parseInt(value, 10);
|
|
82925
|
+
if (!Number.isInteger(n) || n < 1 || String(n) !== value.trim()) {
|
|
82926
|
+
throw new InvalidArgumentError(`${flagName} must be a positive integer`);
|
|
82887
82927
|
}
|
|
82888
|
-
if (
|
|
82889
|
-
throw new
|
|
82890
|
-
`Clay API returned ${MAX_AUTO_PAGINATE_PAGES} pages without reaching the end of the result set; aborting auto-pagination.`
|
|
82891
|
-
);
|
|
82928
|
+
if (max && n > max) {
|
|
82929
|
+
throw new InvalidArgumentError(`${flagName} must be less than or equal to ${max}`);
|
|
82892
82930
|
}
|
|
82893
|
-
|
|
82931
|
+
return n;
|
|
82932
|
+
};
|
|
82933
|
+
}
|
|
82934
|
+
var parseLimitFlag = parsePositiveIntegerFlag("--limit");
|
|
82935
|
+
function parseLimitFlagWithMax(max) {
|
|
82936
|
+
return parsePositiveIntegerFlag("--limit", max);
|
|
82937
|
+
}
|
|
82938
|
+
function parseBooleanFlag(flagName) {
|
|
82939
|
+
return (value) => {
|
|
82940
|
+
if (value === "true") return true;
|
|
82941
|
+
if (value === "false") return false;
|
|
82942
|
+
throw new InvalidArgumentError(`${flagName} must be true or false`);
|
|
82943
|
+
};
|
|
82944
|
+
}
|
|
82945
|
+
function readJsonFlag(flagName, source) {
|
|
82946
|
+
const display = source === "-" ? "stdin" : source;
|
|
82947
|
+
let raw;
|
|
82948
|
+
try {
|
|
82949
|
+
raw = source === "-" ? (0, import_node_fs9.readFileSync)(0, "utf8") : (0, import_node_fs9.readFileSync)(source, "utf8");
|
|
82950
|
+
} catch (err) {
|
|
82951
|
+
throw new InvalidArgumentError(`${flagName}: could not read ${display} (${err.message})`);
|
|
82894
82952
|
}
|
|
82895
|
-
|
|
82896
|
-
|
|
82897
|
-
|
|
82898
|
-
|
|
82899
|
-
|
|
82900
|
-
|
|
82901
|
-
|
|
82902
|
-
|
|
82903
|
-
throw new InvalidArgumentError("must be a positive integer");
|
|
82953
|
+
const trimmed = raw.trim();
|
|
82954
|
+
if (trimmed === "") {
|
|
82955
|
+
throw new InvalidArgumentError(`${flagName}: ${display} is empty`);
|
|
82956
|
+
}
|
|
82957
|
+
try {
|
|
82958
|
+
return JSON.parse(trimmed);
|
|
82959
|
+
} catch (err) {
|
|
82960
|
+
throw new InvalidArgumentError(`${flagName}: not valid JSON (${err.message})`);
|
|
82904
82961
|
}
|
|
82905
|
-
return n;
|
|
82906
82962
|
}
|
|
82963
|
+
|
|
82964
|
+
// src/commands/tables/list.ts
|
|
82907
82965
|
function buildListCommand() {
|
|
82908
82966
|
const cmd = new Command("list");
|
|
82909
82967
|
cmd.description(
|
|
82910
82968
|
"List tables in the workspace pinned to your API key. Each row carries an `apiEnabled` flag for whether the table is enabled for public-API sync."
|
|
82911
82969
|
).option(
|
|
82912
82970
|
"--limit <n>",
|
|
82913
|
-
`
|
|
82914
|
-
|
|
82915
|
-
|
|
82916
|
-
).option("--api-enabled", "Only return tables enabled for the public API.").addHelpText(
|
|
82971
|
+
`Max tables to return per page. Defaults to ${DEFAULT_PAGE_LIMIT}.`,
|
|
82972
|
+
parseLimitFlagWithMax(MAX_PAGE_LIMIT)
|
|
82973
|
+
).option("--cursor <token>", "Resume from a previous response's `cursor` to fetch the next page.").option("--api-enabled", "Only return tables enabled for the public API.").addHelpText(
|
|
82917
82974
|
"after",
|
|
82918
82975
|
`
|
|
82919
82976
|
Output (success, exit 0):
|
|
@@ -82926,49 +82983,48 @@ Output (success, exit 0):
|
|
|
82926
82983
|
"workbook": { "id": <string>, "name": <string> } | null,
|
|
82927
82984
|
"apiEnabled": <boolean>
|
|
82928
82985
|
}
|
|
82929
|
-
]
|
|
82986
|
+
],
|
|
82987
|
+
"cursor": <string|undefined>
|
|
82930
82988
|
}
|
|
82931
82989
|
|
|
82990
|
+
Pagination:
|
|
82991
|
+
--limit <n> max tables per call. Defaults to ${DEFAULT_PAGE_LIMIT}.
|
|
82992
|
+
--cursor <token> resume from a previous response's \`cursor\`
|
|
82993
|
+
When more results exist, the response includes a top-level \`cursor\`; pass it back via
|
|
82994
|
+
--cursor to fetch the next page.
|
|
82995
|
+
|
|
82932
82996
|
Common errors:
|
|
82933
|
-
validation_error (exit 2) --limit is not a positive integer.
|
|
82997
|
+
validation_error (exit 2) --limit is not a positive integer or exceeds ${MAX_PAGE_LIMIT}.
|
|
82934
82998
|
auth_forbidden (exit 3) Key lacks the cli:all scope, or the workspace is not in the public-API beta.
|
|
82935
82999
|
|
|
82936
83000
|
Examples:
|
|
82937
83001
|
$ clay tables list
|
|
82938
83002
|
$ clay tables list --api-enabled | jq -r '.data[].id'
|
|
82939
|
-
$ clay tables list --limit
|
|
83003
|
+
$ clay tables list --limit 50 --cursor "$CURSOR"
|
|
83004
|
+
$ clay tables list --api-enabled | jq -r '.data[] | select(.apiEnabled) | .name'
|
|
82940
83005
|
`
|
|
82941
83006
|
).action(async (opts) => {
|
|
82942
83007
|
const workspaceId = await currentWorkspaceId();
|
|
82943
83008
|
const client = await v3Client(tablesSummaryContract);
|
|
82944
|
-
const
|
|
82945
|
-
|
|
82946
|
-
|
|
82947
|
-
|
|
82948
|
-
|
|
82949
|
-
|
|
82950
|
-
|
|
82951
|
-
|
|
82952
|
-
|
|
82953
|
-
|
|
82954
|
-
...pager.cursor === void 0 ? {} : { cursor: pager.cursor },
|
|
82955
|
-
...opts.apiEnabled === true ? { apiEnabled: "true" } : {}
|
|
82956
|
-
}
|
|
82957
|
-
})
|
|
82958
|
-
);
|
|
82959
|
-
accumulated.push(...page.data);
|
|
82960
|
-
if (page.cursor === void 0) break;
|
|
82961
|
-
if (accumulated.length >= opts.limit) break;
|
|
82962
|
-
pager.advance(page.cursor, page.data.length);
|
|
82963
|
-
}
|
|
83009
|
+
const page = await unwrap(
|
|
83010
|
+
client.listTablesSummary({
|
|
83011
|
+
params: { workspaceId },
|
|
83012
|
+
query: {
|
|
83013
|
+
cursor: opts.cursor,
|
|
83014
|
+
limit: opts.limit ?? DEFAULT_PAGE_LIMIT,
|
|
83015
|
+
apiEnabled: opts.apiEnabled === true ? "true" : void 0
|
|
83016
|
+
}
|
|
83017
|
+
})
|
|
83018
|
+
);
|
|
82964
83019
|
writeJson({
|
|
82965
|
-
data:
|
|
83020
|
+
data: page.data.map((t) => ({
|
|
82966
83021
|
id: t.id,
|
|
82967
83022
|
name: t.name,
|
|
82968
83023
|
description: t.description,
|
|
82969
83024
|
workbook: t.workbook,
|
|
82970
83025
|
apiEnabled: t.apiEnabled
|
|
82971
|
-
}))
|
|
83026
|
+
})),
|
|
83027
|
+
cursor: page.cursor
|
|
82972
83028
|
});
|
|
82973
83029
|
});
|
|
82974
83030
|
return cmd;
|
|
@@ -83105,25 +83161,6 @@ var StructuredQueryRequest = external_exports.preprocess((raw, ctx) => {
|
|
|
83105
83161
|
return raw;
|
|
83106
83162
|
}, StructuredQueryRequestShape);
|
|
83107
83163
|
|
|
83108
|
-
// ../../libs/api-contract/src/public-api-v0/pagination.ts
|
|
83109
|
-
var DEFAULT_PAGE_LIMIT = 20;
|
|
83110
|
-
var MAX_PAGE_LIMIT = 100;
|
|
83111
|
-
function paginatedQuerySchema({
|
|
83112
|
-
defaultLimit = DEFAULT_PAGE_LIMIT,
|
|
83113
|
-
maxLimit = MAX_PAGE_LIMIT
|
|
83114
|
-
} = {}) {
|
|
83115
|
-
return external_exports.object({
|
|
83116
|
-
cursor: external_exports.string().optional(),
|
|
83117
|
-
limit: external_exports.coerce.number().int().min(1).max(maxLimit).default(defaultLimit)
|
|
83118
|
-
});
|
|
83119
|
-
}
|
|
83120
|
-
function paginatedResponse(itemSchema) {
|
|
83121
|
-
return external_exports.object({
|
|
83122
|
-
data: external_exports.array(itemSchema),
|
|
83123
|
-
cursor: external_exports.string().optional()
|
|
83124
|
-
});
|
|
83125
|
-
}
|
|
83126
|
-
|
|
83127
83164
|
// ../../libs/api-contract/src/public-api-v0/tables-contract.ts
|
|
83128
83165
|
var c = initContract();
|
|
83129
83166
|
var CellSuccessSchema = external_exports.object({
|
|
@@ -83175,44 +83212,6 @@ var publicApiTablesContract = c.router({
|
|
|
83175
83212
|
}
|
|
83176
83213
|
});
|
|
83177
83214
|
|
|
83178
|
-
// src/commands/flag-parsers.ts
|
|
83179
|
-
var import_node_fs8 = require("fs");
|
|
83180
|
-
function parsePositiveIntegerFlag(flagName) {
|
|
83181
|
-
return (value) => {
|
|
83182
|
-
const n = Number.parseInt(value, 10);
|
|
83183
|
-
if (!Number.isInteger(n) || n < 1 || String(n) !== value.trim()) {
|
|
83184
|
-
throw new InvalidArgumentError(`${flagName} must be a positive integer`);
|
|
83185
|
-
}
|
|
83186
|
-
return n;
|
|
83187
|
-
};
|
|
83188
|
-
}
|
|
83189
|
-
var parseLimitFlag = parsePositiveIntegerFlag("--limit");
|
|
83190
|
-
function parseBooleanFlag(flagName) {
|
|
83191
|
-
return (value) => {
|
|
83192
|
-
if (value === "true") return true;
|
|
83193
|
-
if (value === "false") return false;
|
|
83194
|
-
throw new InvalidArgumentError(`${flagName} must be true or false`);
|
|
83195
|
-
};
|
|
83196
|
-
}
|
|
83197
|
-
function readJsonFlag(flagName, source) {
|
|
83198
|
-
const display = source === "-" ? "stdin" : source;
|
|
83199
|
-
let raw;
|
|
83200
|
-
try {
|
|
83201
|
-
raw = source === "-" ? (0, import_node_fs8.readFileSync)(0, "utf8") : (0, import_node_fs8.readFileSync)(source, "utf8");
|
|
83202
|
-
} catch (err) {
|
|
83203
|
-
throw new InvalidArgumentError(`${flagName}: could not read ${display} (${err.message})`);
|
|
83204
|
-
}
|
|
83205
|
-
const trimmed = raw.trim();
|
|
83206
|
-
if (trimmed === "") {
|
|
83207
|
-
throw new InvalidArgumentError(`${flagName}: ${display} is empty`);
|
|
83208
|
-
}
|
|
83209
|
-
try {
|
|
83210
|
-
return JSON.parse(trimmed);
|
|
83211
|
-
} catch (err) {
|
|
83212
|
-
throw new InvalidArgumentError(`${flagName}: not valid JSON (${err.message})`);
|
|
83213
|
-
}
|
|
83214
|
-
}
|
|
83215
|
-
|
|
83216
83215
|
// src/commands/tables/projection.ts
|
|
83217
83216
|
function projectCell(cell) {
|
|
83218
83217
|
if (cell.status === "success") {
|
|
@@ -83254,7 +83253,7 @@ function projectQueryResponse(response) {
|
|
|
83254
83253
|
}
|
|
83255
83254
|
|
|
83256
83255
|
// src/commands/tables/query.ts
|
|
83257
|
-
function
|
|
83256
|
+
function parseLimit(raw) {
|
|
83258
83257
|
const n = Number.parseInt(raw, 10);
|
|
83259
83258
|
if (!Number.isInteger(n) || String(n) !== raw.trim()) {
|
|
83260
83259
|
throw new InvalidArgumentError("must be an integer");
|
|
@@ -83283,7 +83282,7 @@ function buildQueryCommand() {
|
|
|
83283
83282
|
).requiredOption(
|
|
83284
83283
|
"--query <file|->",
|
|
83285
83284
|
"Path to a JSON file containing the structured query. Use - to read from stdin."
|
|
83286
|
-
).option("--limit <n>", "Max rows to return (1-100, default 50).",
|
|
83285
|
+
).option("--limit <n>", "Max rows to return (1-100, default 50).", parseLimit).option("--cursor <token>", "Resume from a previous response's `cursor` to fetch the next page.").addHelpText(
|
|
83287
83286
|
"after",
|
|
83288
83287
|
`
|
|
83289
83288
|
Output (success, exit 0):
|
|
@@ -84036,6 +84035,8 @@ var MutateSmartleadMasterInboxForwardEmailRequest = external_exports.object({
|
|
|
84036
84035
|
message_id: external_exports.string(),
|
|
84037
84036
|
stats_id: external_exports.string(),
|
|
84038
84037
|
to_emails: external_exports.string(),
|
|
84038
|
+
cc_emails: external_exports.string().optional(),
|
|
84039
|
+
bcc_emails: external_exports.string().optional(),
|
|
84039
84040
|
forward_email_subject: external_exports.string().optional(),
|
|
84040
84041
|
forward_email_body: external_exports.string().optional()
|
|
84041
84042
|
})
|
|
@@ -84424,7 +84425,9 @@ var ImageDataTypeSettings = external_exports.object({
|
|
|
84424
84425
|
lowercaseUrl: external_exports.boolean().optional()
|
|
84425
84426
|
});
|
|
84426
84427
|
var DateDataTypeSettings = external_exports.object({
|
|
84427
|
-
type: external_exports.literal("date" /* DATE */)
|
|
84428
|
+
type: external_exports.literal("date" /* DATE */),
|
|
84429
|
+
// 'date' stores a timezone-less calendar day (YYYY-MM-DD); 'datetime' (default) stores a UTC instant.
|
|
84430
|
+
precision: external_exports.enum(["date", "datetime"]).optional()
|
|
84428
84431
|
});
|
|
84429
84432
|
var SelectDataTypeSettings = external_exports.object({
|
|
84430
84433
|
type: external_exports.literal("select" /* SELECT */),
|
|
@@ -85007,6 +85010,8 @@ var ActionFieldSettings = external_exports.object({
|
|
|
85007
85010
|
customRateLimitRules: RateLimitRulesV1.nullish(),
|
|
85008
85011
|
batchRunSettings: BatchRunSettings.optional(),
|
|
85009
85012
|
delaySettings: DelaySettings.nullish(),
|
|
85013
|
+
// `JAVASCRIPT_V1` is deprecated: its raw-JS evaluation path has been removed and no live cells use
|
|
85014
|
+
// it. The value is kept in the enum so stored field settings carrying it remain parseable
|
|
85010
85015
|
formulaEvaluationType: external_exports.enum(["JAVASCRIPT_V1", "LEGACY_CLAYSCRIPT"]).optional(),
|
|
85011
85016
|
inputsBinding: external_exports.array(InputsBinding).optional(),
|
|
85012
85017
|
optionalPathsInInputs: external_exports.record(external_exports.string(), external_exports.array(external_exports.union([external_exports.string(), external_exports.number()])).array()).optional(),
|
|
@@ -86371,64 +86376,95 @@ function buildListCommand2() {
|
|
|
86371
86376
|
])
|
|
86372
86377
|
).option(
|
|
86373
86378
|
"--limit <n>",
|
|
86374
|
-
|
|
86375
|
-
|
|
86376
|
-
).addHelpText(
|
|
86379
|
+
`Max tools to return per page. Defaults to ${DEFAULT_PAGE_LIMIT}.`,
|
|
86380
|
+
parseLimitFlagWithMax(MAX_PAGE_LIMIT)
|
|
86381
|
+
).option("--cursor <token>", "Resume from a previous response's `cursor` to fetch the next page.").addHelpText(
|
|
86377
86382
|
"after",
|
|
86378
86383
|
`
|
|
86379
86384
|
Output (success, exit 0):
|
|
86380
86385
|
{
|
|
86381
86386
|
"data": [
|
|
86382
86387
|
{ "id": "function:tbl_abc", "name": <string>, "description": <string|null> }
|
|
86383
|
-
]
|
|
86388
|
+
],
|
|
86389
|
+
"cursor": <string|undefined>
|
|
86384
86390
|
}
|
|
86385
86391
|
|
|
86386
86392
|
${TOOL_INTEGRATION_VALUES_HELP}
|
|
86387
86393
|
|
|
86394
|
+
Pagination:
|
|
86395
|
+
--limit <n> max tools per call. Defaults to ${DEFAULT_PAGE_LIMIT}.
|
|
86396
|
+
--cursor <token> resume from a previous response's \`cursor\`
|
|
86397
|
+
When more results exist, the response includes a top-level \`cursor\`; pass it back via
|
|
86398
|
+
--cursor to fetch the next page.
|
|
86399
|
+
|
|
86388
86400
|
Common errors:
|
|
86389
|
-
|
|
86401
|
+
validation_error (exit 2) --limit is not a positive integer or exceeds ${MAX_PAGE_LIMIT}.
|
|
86402
|
+
auth_forbidden (exit 3) Key lacks the cli:all scope (or 'all').
|
|
86390
86403
|
|
|
86391
86404
|
Examples:
|
|
86392
86405
|
$ clay tools list
|
|
86393
86406
|
$ clay tools list --integration api
|
|
86394
86407
|
$ clay tools list --integration mcp
|
|
86395
86408
|
$ clay tools list --limit 10 | jq -r '.data[].id'
|
|
86409
|
+
$ clay tools list --limit 10 --cursor "$CURSOR"
|
|
86396
86410
|
`
|
|
86397
86411
|
).action(async (opts) => {
|
|
86398
86412
|
const workspaceId = await currentWorkspaceId();
|
|
86399
86413
|
const client = await v3Client(toolsContract);
|
|
86400
|
-
const
|
|
86401
|
-
|
|
86402
|
-
|
|
86403
|
-
|
|
86404
|
-
|
|
86405
|
-
|
|
86406
|
-
|
|
86407
|
-
|
|
86408
|
-
|
|
86409
|
-
|
|
86410
|
-
...pager.cursor !== void 0 ? { cursor: pager.cursor } : {},
|
|
86411
|
-
limit: pageSize
|
|
86412
|
-
}
|
|
86413
|
-
})
|
|
86414
|
-
);
|
|
86415
|
-
accumulated.push(...result.data);
|
|
86416
|
-
if (result.cursor === void 0) break;
|
|
86417
|
-
if (opts.limit !== void 0 && accumulated.length >= opts.limit) break;
|
|
86418
|
-
pager.advance(result.cursor, result.data.length);
|
|
86419
|
-
}
|
|
86420
|
-
const trimmed = opts.limit === void 0 ? accumulated : accumulated.slice(0, opts.limit);
|
|
86414
|
+
const result = await unwrap(
|
|
86415
|
+
client.listTools({
|
|
86416
|
+
params: { workspaceId },
|
|
86417
|
+
query: {
|
|
86418
|
+
integration: opts.integration,
|
|
86419
|
+
cursor: opts.cursor,
|
|
86420
|
+
limit: opts.limit ?? DEFAULT_PAGE_LIMIT
|
|
86421
|
+
}
|
|
86422
|
+
})
|
|
86423
|
+
);
|
|
86421
86424
|
writeJson({
|
|
86422
|
-
data:
|
|
86425
|
+
data: result.data.map((tool) => ({
|
|
86423
86426
|
id: tool.id,
|
|
86424
86427
|
name: tool.name,
|
|
86425
86428
|
description: tool.description
|
|
86426
|
-
}))
|
|
86429
|
+
})),
|
|
86430
|
+
cursor: result.cursor
|
|
86427
86431
|
});
|
|
86428
86432
|
});
|
|
86429
86433
|
return cmd;
|
|
86430
86434
|
}
|
|
86431
86435
|
|
|
86436
|
+
// src/commands/pagination.ts
|
|
86437
|
+
var MAX_AUTO_PAGINATE_ITEMS = 1e4;
|
|
86438
|
+
var MAX_AUTO_PAGINATE_PAGES = 500;
|
|
86439
|
+
var CursorPager = class {
|
|
86440
|
+
currentCursor;
|
|
86441
|
+
itemsFetched = 0;
|
|
86442
|
+
pagesFetched = 1;
|
|
86443
|
+
get cursor() {
|
|
86444
|
+
return this.currentCursor;
|
|
86445
|
+
}
|
|
86446
|
+
advance(nextCursor, pageItemCount) {
|
|
86447
|
+
if (nextCursor === this.currentCursor) {
|
|
86448
|
+
throw new IncompatibleApiServerError(
|
|
86449
|
+
"Clay API returned the same pagination cursor twice in a row; aborting auto-pagination."
|
|
86450
|
+
);
|
|
86451
|
+
}
|
|
86452
|
+
this.itemsFetched += pageItemCount;
|
|
86453
|
+
this.pagesFetched += 1;
|
|
86454
|
+
if (this.itemsFetched >= MAX_AUTO_PAGINATE_ITEMS) {
|
|
86455
|
+
throw new IncompatibleApiServerError(
|
|
86456
|
+
`Auto-pagination stopped after ${MAX_AUTO_PAGINATE_ITEMS} items without reaching the end of the result set; narrow the request to fetch fewer rows.`
|
|
86457
|
+
);
|
|
86458
|
+
}
|
|
86459
|
+
if (this.pagesFetched >= MAX_AUTO_PAGINATE_PAGES) {
|
|
86460
|
+
throw new IncompatibleApiServerError(
|
|
86461
|
+
`Clay API returned ${MAX_AUTO_PAGINATE_PAGES} pages without reaching the end of the result set; aborting auto-pagination.`
|
|
86462
|
+
);
|
|
86463
|
+
}
|
|
86464
|
+
this.currentCursor = nextCursor;
|
|
86465
|
+
}
|
|
86466
|
+
};
|
|
86467
|
+
|
|
86432
86468
|
// src/commands/tools/runs/projection.ts
|
|
86433
86469
|
function projectInlineStart(response) {
|
|
86434
86470
|
return {
|
|
@@ -86608,9 +86644,9 @@ function buildListCommand3() {
|
|
|
86608
86644
|
const cmd = new Command("list");
|
|
86609
86645
|
cmd.description("List recent async tool runs and their statuses.").option(
|
|
86610
86646
|
"--limit <n>",
|
|
86611
|
-
|
|
86612
|
-
|
|
86613
|
-
).addHelpText(
|
|
86647
|
+
`Max runs to return per page. Defaults to ${DEFAULT_PAGE_LIMIT}.`,
|
|
86648
|
+
parseLimitFlagWithMax(MAX_PAGE_LIMIT)
|
|
86649
|
+
).option("--cursor <token>", "Resume from a previous response's `cursor` to fetch the next page.").addHelpText(
|
|
86614
86650
|
"after",
|
|
86615
86651
|
`
|
|
86616
86652
|
Output (success, exit 0):
|
|
@@ -86623,49 +86659,48 @@ Output (success, exit 0):
|
|
|
86623
86659
|
"total": <number>,
|
|
86624
86660
|
"finished": <number>
|
|
86625
86661
|
}
|
|
86626
|
-
]
|
|
86662
|
+
],
|
|
86663
|
+
"cursor": <string|undefined>
|
|
86627
86664
|
}
|
|
86628
86665
|
|
|
86666
|
+
Pagination:
|
|
86667
|
+
--limit <n> max runs per call. Defaults to ${DEFAULT_PAGE_LIMIT}.
|
|
86668
|
+
--cursor <token> resume from a previous response's \`cursor\`
|
|
86669
|
+
When more results exist, the response includes a top-level \`cursor\`; pass it back via
|
|
86670
|
+
--cursor to fetch the next page.
|
|
86671
|
+
|
|
86629
86672
|
Common errors:
|
|
86630
|
-
|
|
86673
|
+
validation_error (exit 2) --limit is not a positive integer or exceeds ${MAX_PAGE_LIMIT}.
|
|
86674
|
+
auth_forbidden (exit 3) Key lacks the cli:all scope (or 'all').
|
|
86631
86675
|
|
|
86632
86676
|
Examples:
|
|
86633
86677
|
$ clay tools runs list
|
|
86634
86678
|
$ clay tools runs list --limit 10 | jq -r '.data[].toolRunId'
|
|
86679
|
+
$ clay tools runs list --limit 10 --cursor "$CURSOR"
|
|
86635
86680
|
$ clay tools runs list | jq '.data[] | select(.status == "in_progress")'
|
|
86636
86681
|
`
|
|
86637
86682
|
).action(async (opts) => {
|
|
86638
86683
|
const workspaceId = await currentWorkspaceId();
|
|
86639
86684
|
const client = await v3Client(toolsContract);
|
|
86640
|
-
const
|
|
86641
|
-
|
|
86642
|
-
|
|
86643
|
-
|
|
86644
|
-
|
|
86645
|
-
|
|
86646
|
-
|
|
86647
|
-
|
|
86648
|
-
|
|
86649
|
-
...pager.cursor !== void 0 ? { cursor: pager.cursor } : {},
|
|
86650
|
-
limit: pageSize
|
|
86651
|
-
}
|
|
86652
|
-
})
|
|
86653
|
-
);
|
|
86654
|
-
accumulated.push(...result.data);
|
|
86655
|
-
if (result.cursor === void 0) break;
|
|
86656
|
-
if (opts.limit !== void 0 && accumulated.length >= opts.limit) break;
|
|
86657
|
-
pager.advance(result.cursor, result.data.length);
|
|
86658
|
-
}
|
|
86659
|
-
const trimmed = opts.limit === void 0 ? accumulated : accumulated.slice(0, opts.limit);
|
|
86685
|
+
const result = await unwrap(
|
|
86686
|
+
client.listToolRuns({
|
|
86687
|
+
params: { workspaceId },
|
|
86688
|
+
query: {
|
|
86689
|
+
cursor: opts.cursor,
|
|
86690
|
+
limit: opts.limit ?? DEFAULT_PAGE_LIMIT
|
|
86691
|
+
}
|
|
86692
|
+
})
|
|
86693
|
+
);
|
|
86660
86694
|
writeJson({
|
|
86661
|
-
data:
|
|
86695
|
+
data: result.data.map(projectRunListItem),
|
|
86696
|
+
cursor: result.cursor
|
|
86662
86697
|
});
|
|
86663
86698
|
});
|
|
86664
86699
|
return cmd;
|
|
86665
86700
|
}
|
|
86666
86701
|
|
|
86667
86702
|
// src/commands/tools/runs/input.ts
|
|
86668
|
-
var
|
|
86703
|
+
var import_node_fs10 = require("fs");
|
|
86669
86704
|
function readRunToolRequest(source) {
|
|
86670
86705
|
const raw = readUtf8Source("--input", source);
|
|
86671
86706
|
let parsed;
|
|
@@ -86688,7 +86723,7 @@ function readRunToolRequest(source) {
|
|
|
86688
86723
|
function readJsonlFile(source) {
|
|
86689
86724
|
let buf;
|
|
86690
86725
|
try {
|
|
86691
|
-
buf = (0,
|
|
86726
|
+
buf = (0, import_node_fs10.readFileSync)(source);
|
|
86692
86727
|
} catch (err) {
|
|
86693
86728
|
throw new InvalidArgumentError(`--bulk: could not read ${source} (${err.message})`);
|
|
86694
86729
|
}
|
|
@@ -86729,7 +86764,7 @@ function validateJsonl(buf) {
|
|
|
86729
86764
|
function readUtf8Source(flagName, source) {
|
|
86730
86765
|
const display = source === "-" ? "stdin" : source;
|
|
86731
86766
|
try {
|
|
86732
|
-
return source === "-" ? (0,
|
|
86767
|
+
return source === "-" ? (0, import_node_fs10.readFileSync)(0, "utf8") : (0, import_node_fs10.readFileSync)(source, "utf8");
|
|
86733
86768
|
} catch (err) {
|
|
86734
86769
|
throw new InvalidArgumentError(`${flagName}: could not read ${display} (${err.message})`);
|
|
86735
86770
|
}
|
|
@@ -87903,7 +87938,8 @@ var TCNodeConfig = external_exports.discriminatedUnion("nodeType", [
|
|
|
87903
87938
|
...TCNodeConfigShared,
|
|
87904
87939
|
modelId: external_exports.string().optional(),
|
|
87905
87940
|
claygentId: external_exports.string().optional(),
|
|
87906
|
-
claygentVersionId: external_exports.string().optional()
|
|
87941
|
+
claygentVersionId: external_exports.string().optional(),
|
|
87942
|
+
authAccountId: external_exports.string().nullable().optional()
|
|
87907
87943
|
}),
|
|
87908
87944
|
TCForkNodeConfig.unwrap().extend({
|
|
87909
87945
|
nodeType: external_exports.literal("fork"),
|
|
@@ -87935,7 +87971,8 @@ var TCNodeConfig = external_exports.discriminatedUnion("nodeType", [
|
|
|
87935
87971
|
// When mode is 'agent', either mapConfig.agentConfig or claygentId must be present.
|
|
87936
87972
|
// This invariant is enforced at runtime in claygent-node-execution.service.ts.
|
|
87937
87973
|
claygentId: external_exports.string().optional(),
|
|
87938
|
-
claygentVersionId: external_exports.string().optional()
|
|
87974
|
+
claygentVersionId: external_exports.string().optional(),
|
|
87975
|
+
authAccountId: external_exports.string().nullable().optional()
|
|
87939
87976
|
}),
|
|
87940
87977
|
external_exports.object({
|
|
87941
87978
|
nodeType: external_exports.literal("reduce"),
|
|
@@ -88421,6 +88458,117 @@ var TCWorkflowSnapshotContent = external_exports.object({
|
|
|
88421
88458
|
containsCycles: external_exports.boolean()
|
|
88422
88459
|
});
|
|
88423
88460
|
|
|
88461
|
+
// ../../libs/terracotta/src/step-outputs.ts
|
|
88462
|
+
var ModelAwareUsageSchema = external_exports.custom();
|
|
88463
|
+
var ConditionalEvaluationSchema = external_exports.object({
|
|
88464
|
+
mode: external_exports.enum(["rules", "code", "agentic"]).optional(),
|
|
88465
|
+
matchedRuleIndex: external_exports.number().nullable(),
|
|
88466
|
+
matchedRuleName: external_exports.string().nullable(),
|
|
88467
|
+
usedDefault: external_exports.boolean(),
|
|
88468
|
+
targetNodeId: external_exports.string(),
|
|
88469
|
+
targetNodeName: external_exports.string(),
|
|
88470
|
+
reasoning: external_exports.string().optional(),
|
|
88471
|
+
modelId: external_exports.string().optional()
|
|
88472
|
+
});
|
|
88473
|
+
var ToolResultSchema = external_exports.object({
|
|
88474
|
+
success: external_exports.boolean(),
|
|
88475
|
+
result: external_exports.unknown().optional(),
|
|
88476
|
+
metadata: external_exports.unknown().optional()
|
|
88477
|
+
});
|
|
88478
|
+
var ToolCallErrorSchema = external_exports.object({
|
|
88479
|
+
toolName: external_exports.string(),
|
|
88480
|
+
toolCallId: external_exports.string(),
|
|
88481
|
+
errorMessage: external_exports.string(),
|
|
88482
|
+
failureCount: external_exports.number()
|
|
88483
|
+
});
|
|
88484
|
+
var StepOutputsBaseSchema = external_exports.object({
|
|
88485
|
+
usage: ModelAwareUsageSchema.optional(),
|
|
88486
|
+
error: external_exports.string().optional(),
|
|
88487
|
+
isTerminal: external_exports.boolean().optional()
|
|
88488
|
+
});
|
|
88489
|
+
var AgentStepOutputsSchema = StepOutputsBaseSchema.extend({
|
|
88490
|
+
structuredOutputs: external_exports.record(external_exports.unknown()).optional(),
|
|
88491
|
+
reasoning: external_exports.string().optional(),
|
|
88492
|
+
stepsTaken: external_exports.array(external_exports.string()).optional(),
|
|
88493
|
+
toolResult: ToolResultSchema.optional(),
|
|
88494
|
+
summarizedToolResults: external_exports.string().optional(),
|
|
88495
|
+
nodeId: external_exports.string().optional(),
|
|
88496
|
+
nodeName: external_exports.string().optional(),
|
|
88497
|
+
nextNodeId: external_exports.string().optional(),
|
|
88498
|
+
toolCallError: ToolCallErrorSchema.optional(),
|
|
88499
|
+
entryOutput: external_exports.record(external_exports.unknown()).optional(),
|
|
88500
|
+
executedAt: external_exports.string().optional(),
|
|
88501
|
+
failedToolName: external_exports.string().optional()
|
|
88502
|
+
}).catchall(external_exports.unknown());
|
|
88503
|
+
var CodeStepOutputsSchema = StepOutputsBaseSchema.extend({
|
|
88504
|
+
structuredOutputs: external_exports.record(external_exports.unknown()).optional(),
|
|
88505
|
+
capturedStdout: external_exports.string().optional(),
|
|
88506
|
+
explicitTransition: CodeTransition.optional(),
|
|
88507
|
+
executedAt: external_exports.string().optional()
|
|
88508
|
+
}).catchall(external_exports.unknown());
|
|
88509
|
+
var ConditionalStepOutputsSchema = StepOutputsBaseSchema.extend({
|
|
88510
|
+
conditionalEvaluation: ConditionalEvaluationSchema.optional(),
|
|
88511
|
+
resolvedVariables: external_exports.record(external_exports.unknown()).optional(),
|
|
88512
|
+
matchedRuleIndex: external_exports.number().nullable().optional(),
|
|
88513
|
+
usedDefault: external_exports.boolean().optional(),
|
|
88514
|
+
mode: external_exports.enum(["rules", "code", "agentic"]).optional(),
|
|
88515
|
+
modelId: external_exports.string().optional(),
|
|
88516
|
+
reasoning: external_exports.string().optional()
|
|
88517
|
+
}).catchall(external_exports.unknown());
|
|
88518
|
+
var ToolStepOutputsSchema = StepOutputsBaseSchema.extend({
|
|
88519
|
+
toolResult: ToolResultSchema.optional()
|
|
88520
|
+
}).catchall(external_exports.unknown());
|
|
88521
|
+
var MapStepOutputsSchema = StepOutputsBaseSchema.extend({
|
|
88522
|
+
dataListId: external_exports.string().optional(),
|
|
88523
|
+
totalEntries: external_exports.number().optional(),
|
|
88524
|
+
totalChunks: external_exports.number().optional(),
|
|
88525
|
+
successCount: external_exports.number().optional(),
|
|
88526
|
+
failedCount: external_exports.number().optional(),
|
|
88527
|
+
tokensUsed: external_exports.number().optional(),
|
|
88528
|
+
creditsUsed: external_exports.number().optional(),
|
|
88529
|
+
results: external_exports.array(external_exports.unknown()).optional(),
|
|
88530
|
+
errors: external_exports.unknown().optional(),
|
|
88531
|
+
autoGathered: external_exports.boolean().optional(),
|
|
88532
|
+
entryOutput: external_exports.record(external_exports.unknown()).optional()
|
|
88533
|
+
}).catchall(external_exports.unknown());
|
|
88534
|
+
var ReduceStepOutputsSchema = StepOutputsBaseSchema.extend({
|
|
88535
|
+
dataListId: external_exports.string().optional(),
|
|
88536
|
+
reduceInitiated: external_exports.boolean().optional(),
|
|
88537
|
+
sourceDataListId: external_exports.string().optional(),
|
|
88538
|
+
outputDataListId: external_exports.string().optional(),
|
|
88539
|
+
keyCount: external_exports.number().optional(),
|
|
88540
|
+
totalKeys: external_exports.number().optional(),
|
|
88541
|
+
successCount: external_exports.number().optional(),
|
|
88542
|
+
failedCount: external_exports.number().optional(),
|
|
88543
|
+
tokensUsed: external_exports.number().optional(),
|
|
88544
|
+
creditsUsed: external_exports.number().optional(),
|
|
88545
|
+
results: external_exports.array(external_exports.unknown()).optional(),
|
|
88546
|
+
autoGathered: external_exports.boolean().optional(),
|
|
88547
|
+
errors: external_exports.unknown().optional()
|
|
88548
|
+
}).catchall(external_exports.unknown());
|
|
88549
|
+
var CollectStepOutputsSchema = StepOutputsBaseSchema.extend({
|
|
88550
|
+
dataListId: external_exports.string().optional(),
|
|
88551
|
+
results: external_exports.array(external_exports.unknown()).optional(),
|
|
88552
|
+
totalCount: external_exports.number().optional(),
|
|
88553
|
+
successCount: external_exports.number().optional(),
|
|
88554
|
+
failedCount: external_exports.number().optional(),
|
|
88555
|
+
tokensUsed: external_exports.number().optional(),
|
|
88556
|
+
creditsUsed: external_exports.number().optional(),
|
|
88557
|
+
errors: external_exports.unknown().optional(),
|
|
88558
|
+
rawErrors: external_exports.array(external_exports.unknown()).optional()
|
|
88559
|
+
}).catchall(external_exports.unknown());
|
|
88560
|
+
var ForkJoinStepOutputsSchema = StepOutputsBaseSchema.catchall(external_exports.unknown());
|
|
88561
|
+
var TCWorkflowRunStepOutputsSchema = external_exports.union([
|
|
88562
|
+
AgentStepOutputsSchema,
|
|
88563
|
+
CodeStepOutputsSchema,
|
|
88564
|
+
ConditionalStepOutputsSchema,
|
|
88565
|
+
ToolStepOutputsSchema,
|
|
88566
|
+
MapStepOutputsSchema,
|
|
88567
|
+
ReduceStepOutputsSchema,
|
|
88568
|
+
CollectStepOutputsSchema,
|
|
88569
|
+
ForkJoinStepOutputsSchema
|
|
88570
|
+
]);
|
|
88571
|
+
|
|
88424
88572
|
// ../../libs/terracotta/src/types.ts
|
|
88425
88573
|
var TCContextDropletContentType = /* @__PURE__ */ ((TCContextDropletContentType2) => {
|
|
88426
88574
|
TCContextDropletContentType2["tool_result"] = "tool_result";
|
|
@@ -88781,6 +88929,8 @@ var SerializedWorkflowRun = external_exports.object({
|
|
|
88781
88929
|
workflowSnapshotId: external_exports.string(),
|
|
88782
88930
|
batchId: external_exports.string().nullable(),
|
|
88783
88931
|
streamId: external_exports.string().nullable(),
|
|
88932
|
+
triggerId: external_exports.string().nullish(),
|
|
88933
|
+
trigger: SerializedTrigger.nullish(),
|
|
88784
88934
|
runStatus: TCWorkflowRunStatus2,
|
|
88785
88935
|
runState: TCWorkflowRunState,
|
|
88786
88936
|
maxUninterruptedSteps: external_exports.number(),
|
|
@@ -88833,7 +88983,7 @@ var BaseWorkflowRunStepFields = {
|
|
|
88833
88983
|
data: TCWorkflowRunStepData,
|
|
88834
88984
|
functionExecutionMetadata: TCWorkflowRunStepFunctionExecutionMetadata.nullable().optional(),
|
|
88835
88985
|
stepInputs: external_exports.record(external_exports.unknown()).nullable(),
|
|
88836
|
-
stepOutputs:
|
|
88986
|
+
stepOutputs: TCWorkflowRunStepOutputsSchema.nullable(),
|
|
88837
88987
|
creditUsageMetadata: WorkflowCreditUsageMetadata.nullable(),
|
|
88838
88988
|
status: TCWorkflowRunStepStatus,
|
|
88839
88989
|
inCurrentStatusSince: external_exports.number(),
|
|
@@ -88844,6 +88994,7 @@ var BaseWorkflowRunStepFields = {
|
|
|
88844
88994
|
nodeName: external_exports.string().nullable(),
|
|
88845
88995
|
// Enriched fields (present when API computes them)
|
|
88846
88996
|
stepType: WorkflowRunStepType.optional(),
|
|
88997
|
+
nodeType: TCWorkflowNodeType.optional(),
|
|
88847
88998
|
statusDetail: StepStatusDetail.nullable().optional(),
|
|
88848
88999
|
statusDetailLabel: external_exports.string().nullable().optional()
|
|
88849
89000
|
};
|
|
@@ -88904,6 +89055,7 @@ var SerializedWorkflow = external_exports.object({
|
|
|
88904
89055
|
var SerializedWorkflows = external_exports.object({
|
|
88905
89056
|
workflows: external_exports.array(SerializedWorkflow)
|
|
88906
89057
|
});
|
|
89058
|
+
var WORKFLOW_LIST_DEFAULT_PAGE_SIZE = 50;
|
|
88907
89059
|
var WORKFLOW_LIST_MAX_PAGE_SIZE = 200;
|
|
88908
89060
|
var ListWorkflowsQuerySchema = external_exports.object({
|
|
88909
89061
|
cursor: external_exports.string().optional(),
|
|
@@ -89206,9 +89358,9 @@ function buildListCommand6() {
|
|
|
89206
89358
|
const cmd = new Command("list");
|
|
89207
89359
|
cmd.description("List workflows in the workspace.").option(
|
|
89208
89360
|
"--limit <n>",
|
|
89209
|
-
|
|
89210
|
-
|
|
89211
|
-
).addHelpText(
|
|
89361
|
+
`The number of workflows returned (1 - ${WORKFLOW_LIST_MAX_PAGE_SIZE}). Defaults to ${WORKFLOW_LIST_DEFAULT_PAGE_SIZE}`,
|
|
89362
|
+
parseLimitFlagWithMax(WORKFLOW_LIST_MAX_PAGE_SIZE)
|
|
89363
|
+
).option("--cursor <string>", "Resume from a previous response's `cursor` to fetch the next page.").addHelpText(
|
|
89212
89364
|
"after",
|
|
89213
89365
|
`
|
|
89214
89366
|
Output (success, exit 0):
|
|
@@ -89219,11 +89371,18 @@ Output (success, exit 0):
|
|
|
89219
89371
|
"name": <string>,
|
|
89220
89372
|
"url": <string>
|
|
89221
89373
|
}
|
|
89222
|
-
]
|
|
89374
|
+
],
|
|
89375
|
+
"cursor": <string|undefined>
|
|
89223
89376
|
}
|
|
89224
89377
|
|
|
89378
|
+
Pagination:
|
|
89379
|
+
--limit <n> max workflows per call. Defaults to ${WORKFLOW_LIST_DEFAULT_PAGE_SIZE}.
|
|
89380
|
+
--cursor <token> resume from a previous response's \`cursor\`
|
|
89381
|
+
When more results exist, the response includes a top-level \`cursor\`; pass it back via
|
|
89382
|
+
--cursor to fetch the next page.
|
|
89383
|
+
|
|
89225
89384
|
Common errors:
|
|
89226
|
-
validation_error (exit 2) --limit is not a positive integer.
|
|
89385
|
+
validation_error (exit 2) --limit is not a positive integer or exceeds ${WORKFLOW_LIST_MAX_PAGE_SIZE}.
|
|
89227
89386
|
auth_forbidden (exit 3) Key lacks the terracotta:cli scope.
|
|
89228
89387
|
|
|
89229
89388
|
Examples:
|
|
@@ -89234,15 +89393,22 @@ Examples:
|
|
|
89234
89393
|
).action(async (opts) => {
|
|
89235
89394
|
const workspaceId = await currentWorkspaceId();
|
|
89236
89395
|
const client = await v3Client(terracottaWorkflowsContract);
|
|
89237
|
-
const result = await unwrap(
|
|
89238
|
-
|
|
89239
|
-
|
|
89396
|
+
const result = await unwrap(
|
|
89397
|
+
client.listWorkflows({
|
|
89398
|
+
params: { workspaceId },
|
|
89399
|
+
query: { limit: opts.limit ?? WORKFLOW_LIST_DEFAULT_PAGE_SIZE, cursor: opts.cursor ?? void 0 }
|
|
89400
|
+
})
|
|
89401
|
+
);
|
|
89402
|
+
writeJson({
|
|
89403
|
+
data: result.workflows.map((workflow) => projectWorkflow(workflow, workspaceId)),
|
|
89404
|
+
cursor: result.nextCursor ?? void 0
|
|
89405
|
+
});
|
|
89240
89406
|
});
|
|
89241
89407
|
return cmd;
|
|
89242
89408
|
}
|
|
89243
89409
|
|
|
89244
89410
|
// src/commands/workflows/runs/download-file.ts
|
|
89245
|
-
var
|
|
89411
|
+
var import_node_fs11 = require("fs");
|
|
89246
89412
|
var import_node_path7 = require("path");
|
|
89247
89413
|
|
|
89248
89414
|
// ../../libs/api-contract/src/terracotta/code-tool/interfaces.ts
|
|
@@ -89354,7 +89520,7 @@ Examples:
|
|
|
89354
89520
|
const outputPath = opts.output ?? (0, import_node_path7.basename)(opts.path);
|
|
89355
89521
|
const bytes = Buffer.from(result.fileData, "base64");
|
|
89356
89522
|
try {
|
|
89357
|
-
(0,
|
|
89523
|
+
(0, import_node_fs11.writeFileSync)(outputPath, bytes);
|
|
89358
89524
|
} catch (err) {
|
|
89359
89525
|
throw new FileWriteError(
|
|
89360
89526
|
`Could not write to ${outputPath}: ${err instanceof Error ? err.message : String(err)}`
|