sim 2.1.8-preview.100.1 → 2.1.8-preview.103.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/README.md +16 -1
- package/dist/index.js +72 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -220,11 +220,26 @@ will consume the result, and `text` for tab-separated shell output:
|
|
|
220
220
|
|
|
221
221
|
```bash
|
|
222
222
|
sim workflows list --output json
|
|
223
|
-
sim logs list --output json | jq -r '.[].runId'
|
|
223
|
+
sim logs list --output json | jq -r '.data[].runId'
|
|
224
224
|
SIM_OUTPUT=yaml sim tables get <tableId>
|
|
225
225
|
sim configure --set-output json
|
|
226
226
|
```
|
|
227
227
|
|
|
228
|
+
Paginated lists return `{ "data": [...], "nextCursor": "..." }` in JSON and YAML.
|
|
229
|
+
`nextCursor` is `null` when no pages remain. Resource lists and directory `ls`
|
|
230
|
+
fetch every page by default; use `--limit N` to cap them. Table rows (including
|
|
231
|
+
queries), logs, audit/billing events, workflow runs/versions, and knowledge
|
|
232
|
+
documents/chunks keep a default limit of 100. Use `--limit 0` to fetch every page
|
|
233
|
+
of those datasets, or pass the returned `nextCursor` to `--cursor` to continue
|
|
234
|
+
with another bounded result. Keep the same resource, filters, and sort order
|
|
235
|
+
when resuming; stop when `nextCursor` is `null`. Results accumulate in memory
|
|
236
|
+
before printing, so large datasets need an explicit limit or filter.
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
sim tables rows list <tableId> --limit 100 --output json
|
|
240
|
+
sim tables rows list <tableId> --limit 100 --cursor "$nextCursor" --output json
|
|
241
|
+
```
|
|
242
|
+
|
|
228
243
|
JSON-valued options accept inline JSON, a file prefixed with `@`, or stdin with
|
|
229
244
|
`@-`:
|
|
230
245
|
|
package/dist/index.js
CHANGED
|
@@ -4763,15 +4763,21 @@ function pageProgress() {
|
|
|
4763
4763
|
}
|
|
4764
4764
|
};
|
|
4765
4765
|
}
|
|
4766
|
-
|
|
4767
|
-
|
|
4766
|
+
function assertCursorAdvances(cursor, seenCursors) {
|
|
4767
|
+
if (cursor === null)
|
|
4768
|
+
return;
|
|
4769
|
+
if (seenCursors.has(cursor)) {
|
|
4770
|
+
throw new SimApiError("The API returned a repeated pagination cursor; cannot continue.", 0);
|
|
4771
|
+
}
|
|
4772
|
+
seenCursors.add(cursor);
|
|
4768
4773
|
}
|
|
4769
|
-
async function
|
|
4774
|
+
async function requestAllPages(client, path, options) {
|
|
4770
4775
|
const { query, pageSize, limit: requestedLimit, ...requestOptions } = options;
|
|
4771
4776
|
const limit = requestedLimit ?? Number.POSITIVE_INFINITY;
|
|
4772
4777
|
if (limit <= 0)
|
|
4773
|
-
return
|
|
4778
|
+
return [];
|
|
4774
4779
|
const items = [];
|
|
4780
|
+
const seenCursors = new Set;
|
|
4775
4781
|
const progress = pageProgress();
|
|
4776
4782
|
let cursor = null;
|
|
4777
4783
|
try {
|
|
@@ -4784,6 +4790,7 @@ async function requestPages(client, path, options) {
|
|
|
4784
4790
|
cursor
|
|
4785
4791
|
}
|
|
4786
4792
|
});
|
|
4793
|
+
assertCursorAdvances(page.nextCursor, seenCursors);
|
|
4787
4794
|
items.push(...page.data);
|
|
4788
4795
|
cursor = page.nextCursor;
|
|
4789
4796
|
if (cursor && items.length < limit)
|
|
@@ -4792,7 +4799,7 @@ async function requestPages(client, path, options) {
|
|
|
4792
4799
|
} finally {
|
|
4793
4800
|
progress.finish();
|
|
4794
4801
|
}
|
|
4795
|
-
return
|
|
4802
|
+
return items.slice(0, limit);
|
|
4796
4803
|
}
|
|
4797
4804
|
function resolvePath(template, params = {}) {
|
|
4798
4805
|
return template.replace(/\[([^\]]+)\]/g, (_match, key) => {
|
|
@@ -13201,6 +13208,11 @@ var V2_OPERATIONS = {
|
|
|
13201
13208
|
},
|
|
13202
13209
|
apiToken: { kind: "string", describe: "Write-only provider API token." },
|
|
13203
13210
|
domain: { kind: "string", describe: "Provider account domain." },
|
|
13211
|
+
atlassianProduct: {
|
|
13212
|
+
kind: "enum",
|
|
13213
|
+
values: ["jira", "confluence"],
|
|
13214
|
+
describe: "Atlassian product to verify; defaults to Jira on create and preserves the saved product on reconnect."
|
|
13215
|
+
},
|
|
13204
13216
|
signingSecret: { kind: "string", describe: "Write-only webhook signing secret." },
|
|
13205
13217
|
botToken: { kind: "string", describe: "Write-only bot token." },
|
|
13206
13218
|
clientId: { kind: "string", describe: "OAuth client identifier." },
|
|
@@ -16075,7 +16087,30 @@ function buildRequest(operation, positional, flags, workspaceId) {
|
|
|
16075
16087
|
}
|
|
16076
16088
|
|
|
16077
16089
|
// src/runtime/options.ts
|
|
16078
|
-
var
|
|
16090
|
+
var DEFAULT_PAGE_SIZE = 100;
|
|
16091
|
+
var COMPLETE_LIST_OPERATIONS = new Set([
|
|
16092
|
+
"listBlocks",
|
|
16093
|
+
"listChatDeployments",
|
|
16094
|
+
"listCredentials",
|
|
16095
|
+
"listCustomTools",
|
|
16096
|
+
"listFiles",
|
|
16097
|
+
"listKnowledgeBases",
|
|
16098
|
+
"listKnowledgeConnectors",
|
|
16099
|
+
"listMcpServers",
|
|
16100
|
+
"listSandboxes",
|
|
16101
|
+
"listSecrets",
|
|
16102
|
+
"listSkillEditors",
|
|
16103
|
+
"listSkills",
|
|
16104
|
+
"listTables",
|
|
16105
|
+
"listTools",
|
|
16106
|
+
"listWorkflowMcpServers",
|
|
16107
|
+
"listWorkflows",
|
|
16108
|
+
"listWorkspaceMembers",
|
|
16109
|
+
"listWorkspaces"
|
|
16110
|
+
]);
|
|
16111
|
+
function defaultListLimit(operation) {
|
|
16112
|
+
return COMPLETE_LIST_OPERATIONS.has(operation) ? 0 : 100;
|
|
16113
|
+
}
|
|
16079
16114
|
function describeField(flag, descriptor, name, field) {
|
|
16080
16115
|
return flag.describe ?? descriptor.describe ?? `Set ${name.replaceAll("-", " ") || field}`;
|
|
16081
16116
|
}
|
|
@@ -16088,15 +16123,21 @@ function withoutWireVocabulary(documented) {
|
|
|
16088
16123
|
}
|
|
16089
16124
|
var NON_PAGINATED_LIMIT_HINT = " (caps a --filter match only; omit it to act on every match, and note 0 is not accepted)";
|
|
16090
16125
|
function addFieldOption(command, operation, field, descriptor, slot, paginates, capsAFilter) {
|
|
16091
|
-
if (field === PROFILE_INJECTED_FIELD
|
|
16126
|
+
if (field === PROFILE_INJECTED_FIELD)
|
|
16127
|
+
return;
|
|
16128
|
+
if (field === "cursor") {
|
|
16129
|
+
if (paginates && defaultListLimit(operation) > 0) {
|
|
16130
|
+
command.option("--cursor <value>", "Continue from nextCursor returned by a previous result");
|
|
16131
|
+
}
|
|
16092
16132
|
return;
|
|
16133
|
+
}
|
|
16093
16134
|
const flag = flagSpecFor(operation, field);
|
|
16094
16135
|
if (flag.omit)
|
|
16095
16136
|
return;
|
|
16096
16137
|
const name = flagNameFor(operation, field);
|
|
16097
16138
|
const short = flag.short ? `-${flag.short}, ` : "";
|
|
16098
16139
|
if (paginates && field === "limit" && (descriptor.kind === "number" || descriptor.kind === "integer")) {
|
|
16099
|
-
command.option("--limit <n>", "Maximum items to return (0 for everything)", String(
|
|
16140
|
+
command.option("--limit <n>", "Maximum items to return (0 for everything)", String(defaultListLimit(operation)));
|
|
16100
16141
|
return;
|
|
16101
16142
|
}
|
|
16102
16143
|
const documented = `${describeField(flag, descriptor, name, field)}${capsAFilter && field === "limit" && (descriptor.kind === "number" || descriptor.kind === "integer") ? NON_PAGINATED_LIMIT_HINT : ""}`;
|
|
@@ -16456,11 +16497,10 @@ function unwrapResource(data) {
|
|
|
16456
16497
|
const [, value] = entries[0];
|
|
16457
16498
|
return value && typeof value === "object" && !Array.isArray(value) ? value : data;
|
|
16458
16499
|
}
|
|
16459
|
-
function renderPage(format,
|
|
16500
|
+
function renderPage(format, page, spec, envelope) {
|
|
16460
16501
|
writePageNote(spec, envelope);
|
|
16461
16502
|
writeEnvelopeTruncation(envelope);
|
|
16462
|
-
|
|
16463
|
-
printList(format, rows, spec.columns ? columnsFrom(spec.columns) : inferColumns(rows, spec.expand));
|
|
16503
|
+
printList(format, page.data, spec.columns ? columnsFrom(spec.columns) : inferColumns(page.data, spec.expand), page);
|
|
16464
16504
|
}
|
|
16465
16505
|
function writePageNote(spec, envelope) {
|
|
16466
16506
|
if (!spec.pageNote)
|
|
@@ -16505,12 +16545,6 @@ function writeEnvelopeTruncation(envelope) {
|
|
|
16505
16545
|
`));
|
|
16506
16546
|
}
|
|
16507
16547
|
}
|
|
16508
|
-
function writeCursorTruncation(count, truncated) {
|
|
16509
|
-
if (!truncated)
|
|
16510
|
-
return;
|
|
16511
|
-
process.stderr.write(source_default.dim(`showing the first ${count}; more results exist — re-run with --limit 0 for all
|
|
16512
|
-
`));
|
|
16513
|
-
}
|
|
16514
16548
|
function renderResult(operation, format, raw, spec, options = {}, envelope) {
|
|
16515
16549
|
writeEnvelopeTruncation(envelope);
|
|
16516
16550
|
if (spec.document) {
|
|
@@ -16647,8 +16681,8 @@ function bulkFailureMessage(operation, payload, body) {
|
|
|
16647
16681
|
var EXCLUSIVE_CAP_FIELDS = {
|
|
16648
16682
|
deleteTableRows: { cap: "limit", ids: "rowIds" }
|
|
16649
16683
|
};
|
|
16650
|
-
function readPagedLimit(raw) {
|
|
16651
|
-
const text = String(raw ??
|
|
16684
|
+
function readPagedLimit(raw, operation) {
|
|
16685
|
+
const text = String(raw ?? defaultListLimit(operation)).trim();
|
|
16652
16686
|
const value = text === "" ? Number.NaN : Number(text);
|
|
16653
16687
|
if (!Number.isInteger(value) || value < 0) {
|
|
16654
16688
|
throw new SimApiError("--limit must be a whole number of 0 or more (0 for everything)", 0);
|
|
@@ -16723,24 +16757,33 @@ async function executeOperation(operation, commandSpec, operationSpec, invocatio
|
|
|
16723
16757
|
const omitsWorkspace = commandSpec.allWorkspaces && requestFlags.allWorkspaces === true;
|
|
16724
16758
|
const needsWorkspace = (hasWorkspaceField || commandSpec.profileWorkspacePath === true) && !omitsWorkspace;
|
|
16725
16759
|
const paging = cursorSlot(operationSpec);
|
|
16726
|
-
const pagedLimit = paging ? readPagedLimit(requestFlags.limit) : 0;
|
|
16760
|
+
const pagedLimit = paging ? readPagedLimit(requestFlags.limit, operation) : 0;
|
|
16727
16761
|
const request = buildRequest(operation, positional, requestFlags, needsWorkspace ? client.requireWorkspace() : profile.workspaceId);
|
|
16728
16762
|
if (paging) {
|
|
16763
|
+
const initialCursor = request[paging]?.cursor;
|
|
16764
|
+
if (initialCursor !== undefined && (typeof initialCursor !== "string" || initialCursor.trim() === "")) {
|
|
16765
|
+
throw new SimApiError("--cursor must be a non-empty string", 0);
|
|
16766
|
+
}
|
|
16729
16767
|
const limit = pagedLimit === 0 ? Number.POSITIVE_INFINITY : pagedLimit;
|
|
16730
|
-
const pageSize = Math.min(Number.isFinite(limit) ? limit : DEFAULT_LIMIT, DEFAULT_LIMIT);
|
|
16731
|
-
const pageLimit = "limit" in (operationSpec[paging] ?? {}) ? { limit: pageSize } : {};
|
|
16732
16768
|
const rows = [];
|
|
16769
|
+
const seenCursors = new Set(initialCursor ? [initialCursor] : []);
|
|
16733
16770
|
const progress = pageProgress();
|
|
16734
|
-
let cursor = null;
|
|
16771
|
+
let cursor = initialCursor ?? null;
|
|
16735
16772
|
let envelope;
|
|
16736
16773
|
try {
|
|
16737
16774
|
do {
|
|
16775
|
+
const pageSize = Math.min(DEFAULT_PAGE_SIZE, limit - rows.length);
|
|
16776
|
+
const pageLimit = "limit" in (operationSpec[paging] ?? {}) ? { limit: pageSize } : {};
|
|
16738
16777
|
const page = await client.request(request.path, {
|
|
16739
16778
|
method: operationSpec.method,
|
|
16740
16779
|
headers: request.headers,
|
|
16741
16780
|
query: paging === "query" ? { ...request.query, ...pageLimit, cursor } : request.query,
|
|
16742
16781
|
body: paging === "body" ? { ...request.body ?? {}, ...pageLimit, ...cursor ? { cursor } : {} } : request.body
|
|
16743
16782
|
});
|
|
16783
|
+
if (page.data.length > pageSize) {
|
|
16784
|
+
throw new SimApiError(`The API returned ${page.data.length} items for a page limit of ${pageSize}; nextCursor would skip unreturned items.`, 0);
|
|
16785
|
+
}
|
|
16786
|
+
assertCursorAdvances(page.nextCursor, seenCursors);
|
|
16744
16787
|
envelope = foldPageEnvelope(envelope, page);
|
|
16745
16788
|
rows.push(...page.data);
|
|
16746
16789
|
cursor = page.nextCursor;
|
|
@@ -16750,7 +16793,7 @@ async function executeOperation(operation, commandSpec, operationSpec, invocatio
|
|
|
16750
16793
|
} finally {
|
|
16751
16794
|
progress.finish();
|
|
16752
16795
|
}
|
|
16753
|
-
renderPage(profile.output,
|
|
16796
|
+
renderPage(profile.output, { data: rows, nextCursor: cursor }, commandSpec, envelope);
|
|
16754
16797
|
return;
|
|
16755
16798
|
}
|
|
16756
16799
|
const result = await client.request(request.path, {
|
|
@@ -18102,11 +18145,11 @@ async function listResources(client, config, workspaceId, folderPath, search, li
|
|
|
18102
18145
|
const paginated = "cursor" in V2_OPERATIONS[config.resources].query;
|
|
18103
18146
|
if (!paginated) {
|
|
18104
18147
|
const page = await client.request(path, { query });
|
|
18105
|
-
return
|
|
18148
|
+
return page.data.slice(0, limit);
|
|
18106
18149
|
}
|
|
18107
|
-
return
|
|
18150
|
+
return requestAllPages(client, path, {
|
|
18108
18151
|
query,
|
|
18109
|
-
pageSize:
|
|
18152
|
+
pageSize: DEFAULT_PAGE_SIZE,
|
|
18110
18153
|
limit
|
|
18111
18154
|
});
|
|
18112
18155
|
}
|
|
@@ -18136,7 +18179,7 @@ function entriesFor(config, folders, resources) {
|
|
|
18136
18179
|
].sort((left, right) => left.name.localeCompare(right.name) || left.kind.localeCompare(right.kind));
|
|
18137
18180
|
}
|
|
18138
18181
|
function attachResourceDirectoryCommands(group, config) {
|
|
18139
|
-
group.command("ls").argument("[path]", "Folder path to list; defaults to the root folder").allowExcessArguments(false).description(`List ${config.kind} resources and child folders together`).option("--search <text>", "Filter folders and resources by name").addOption(new Option("--limit <n>", "Maximum combined items to return (0 for everything)").default(
|
|
18182
|
+
group.command("ls").argument("[path]", "Folder path to list; defaults to the root folder").allowExcessArguments(false).description(`List ${config.kind} resources and child folders together`).option("--search <text>", "Filter folders and resources by name").addOption(new Option("--limit <n>", "Maximum combined items to return (0 for everything)").default("0")).action(async (path, options, command) => {
|
|
18140
18183
|
const rawLimit = Number(options.limit);
|
|
18141
18184
|
if (!Number.isSafeInteger(rawLimit) || rawLimit < 0) {
|
|
18142
18185
|
throw new SimApiError("--limit must be a whole number of 0 or more (0 for everything)", 0);
|
|
@@ -18149,9 +18192,8 @@ function attachResourceDirectoryCommands(group, config) {
|
|
|
18149
18192
|
listFolders(client, config.folders, workspaceId, folderPath, options.search),
|
|
18150
18193
|
listResources(client, config, workspaceId, folderPath, options.search, limit)
|
|
18151
18194
|
]);
|
|
18152
|
-
const entries = entriesFor(config, folders, resources
|
|
18195
|
+
const entries = entriesFor(config, folders, resources);
|
|
18153
18196
|
const shown = entries.slice(0, limit);
|
|
18154
|
-
writeCursorTruncation(shown.length, resources.truncated || entries.length > limit);
|
|
18155
18197
|
printList(profile.output, shown, COLUMNS2);
|
|
18156
18198
|
});
|
|
18157
18199
|
group.command("mkdir").argument("<path>", "Folder path to create; the leading / is optional").allowExcessArguments(false).description(`Create a ${config.kind} directory at a path`).action(async (path, _options, command) => {
|