sim 2.2.13-preview.230.1 → 2.2.13-preview.231.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.
@@ -22,6 +22,10 @@ export declare function saveToFile(body: ReadableStream<Uint8Array>, target: str
22
22
  export declare function streamToStdout(body: ReadableStream<Uint8Array>, output?: NodeJS.WriteStream): Promise<void>;
23
23
  /** Returns whether content can be written directly to an interactive terminal. */
24
24
  export declare function isTerminalSafeContentType(contentType: string | null): boolean;
25
+ /** Owner-specific selection uses the same bounded transfer and atomic output path as file reads. */
26
+ export declare function attachProjectFileDownload(files: Command): void;
27
+ /** Snapshot text comes from the caller's file reader, including the embedded workbench boundary. */
28
+ export declare function attachProjectFileSnapshotExport(files: Command): void;
25
29
  export declare function attachFileGet(files: Command): void;
26
30
  export declare function attachFileVersionDownload(versions: Command): void;
27
31
  /** Project source downloads share transfer protections without selecting a workspace. */
@@ -1345,6 +1345,64 @@ type CompleteTableImportResponseRef4 = {
1345
1345
  export type CompleteTableImportResponse = {
1346
1346
  data: CompleteTableImportResponseRef4;
1347
1347
  };
1348
+ /** `POST /api/v2/files/copy` */
1349
+ export type CopyFileItemsQuery = Record<string, unknown>;
1350
+ export type CopyFileItemsBody = {
1351
+ source: {
1352
+ owner: {
1353
+ entityType: 'workspace' | 'project';
1354
+ entityId: string;
1355
+ };
1356
+ fileIds?: Array<string>;
1357
+ folderIds?: Array<string>;
1358
+ };
1359
+ destination: {
1360
+ owner: {
1361
+ entityType: 'workspace' | 'project';
1362
+ entityId: string;
1363
+ };
1364
+ folderId?: string | null;
1365
+ };
1366
+ };
1367
+ export type CopyFileItemsResponse = {
1368
+ data: {
1369
+ files: Array<{
1370
+ id: string;
1371
+ name: string;
1372
+ size: number;
1373
+ type: string;
1374
+ width?: number | null;
1375
+ height?: number | null;
1376
+ uploadedBy: string;
1377
+ folderId: string | null;
1378
+ folderPath?: string | null;
1379
+ deletedAt: string | null;
1380
+ uploadedAt: string;
1381
+ updatedAt: string;
1382
+ contentUpdatedAt: string | null;
1383
+ revision: string;
1384
+ owner: {
1385
+ entityType: 'workspace' | 'project';
1386
+ entityId: string;
1387
+ };
1388
+ }>;
1389
+ folders: Array<{
1390
+ id: string;
1391
+ userId: string;
1392
+ name: string;
1393
+ parentId: string | null;
1394
+ path: string;
1395
+ sortOrder: number;
1396
+ deletedAt: string | null;
1397
+ createdAt: string;
1398
+ updatedAt: string;
1399
+ owner: {
1400
+ entityType: 'workspace' | 'project';
1401
+ entityId: string;
1402
+ };
1403
+ }>;
1404
+ };
1405
+ };
1348
1406
  /** `POST /api/v2/credentials/connections` */
1349
1407
  export type CreateCredentialConnectionQuery = Record<string, unknown>;
1350
1408
  export type CreateCredentialConnectionBody = {
@@ -3593,6 +3651,16 @@ export type DownloadFileVersionQuery = {
3593
3651
  };
3594
3652
  /** Non-JSON response (`binary`). */
3595
3653
  export type DownloadFileVersionResponse = never;
3654
+ /** `GET /api/v2/projects/[projectId]/files/bulk-download` */
3655
+ export type DownloadProjectFileItemsParams = {
3656
+ projectId: string;
3657
+ };
3658
+ export type DownloadProjectFileItemsQuery = {
3659
+ fileIds?: string;
3660
+ folderIds?: string;
3661
+ };
3662
+ /** Non-JSON response (`binary`). */
3663
+ export type DownloadProjectFileItemsResponse = never;
3596
3664
  /** `GET /api/v2/workflows/[workflowId]/runs/[runId]/files/[fileId]` */
3597
3665
  export type DownloadRunFileParams = {
3598
3666
  workflowId: string;
@@ -3775,6 +3843,17 @@ export type ExportKnowledgeBaseQuery = {
3775
3843
  };
3776
3844
  /** Non-JSON response (`binary`). */
3777
3845
  export type ExportKnowledgeBaseResponse = never;
3846
+ /** `POST /api/v2/projects/[projectId]/files/[fileId]/export` */
3847
+ export type ExportProjectFileSnapshotParams = {
3848
+ projectId: string;
3849
+ fileId: string;
3850
+ };
3851
+ export type ExportProjectFileSnapshotQuery = Record<string, unknown>;
3852
+ export type ExportProjectFileSnapshotBody = {
3853
+ content: string;
3854
+ };
3855
+ /** Non-JSON response (`binary`). */
3856
+ export type ExportProjectFileSnapshotResponse = never;
3778
3857
  /** `GET /api/v2/workflows/[workflowId]/export` */
3779
3858
  export type ExportWorkflowParams = {
3780
3859
  workflowId: string;
@@ -10147,6 +10226,21 @@ type UnzipFileResponseRef0 = {
10147
10226
  export type UnzipFileResponse = {
10148
10227
  data: UnzipFileResponseRef0;
10149
10228
  };
10229
+ /** `POST /api/v2/projects/[projectId]/files/[fileId]/unzip` */
10230
+ export type UnzipProjectFileParams = {
10231
+ projectId: string;
10232
+ fileId: string;
10233
+ };
10234
+ export type UnzipProjectFileQuery = Record<string, unknown>;
10235
+ type UnzipProjectFileResponseRef0 = UnzipProjectFileResponseRef1;
10236
+ type UnzipProjectFileResponseRef1 = {
10237
+ folderPath: string;
10238
+ extractedFileCount: number;
10239
+ skippedFileCount: number;
10240
+ };
10241
+ export type UnzipProjectFileResponse = {
10242
+ data: UnzipProjectFileResponseRef0;
10243
+ };
10150
10244
  /** `PATCH /api/v2/credentials/[credentialId]` */
10151
10245
  export type UpdateCredentialParams = {
10152
10246
  credentialId: string;
@@ -12139,6 +12233,26 @@ export declare const V2_OPERATIONS: {
12139
12233
  };
12140
12234
  };
12141
12235
  };
12236
+ readonly copyFileItems: {
12237
+ readonly method: 'POST';
12238
+ readonly path: '/api/v2/files/copy';
12239
+ readonly pathParams: readonly [];
12240
+ readonly responseMode: 'json';
12241
+ readonly summary: 'Copy File Items';
12242
+ readonly workspaceKeyUnsupported: true;
12243
+ readonly body: {
12244
+ readonly source: {
12245
+ readonly kind: 'object';
12246
+ readonly required: true;
12247
+ readonly describe: 'Selection to read under the source owner.';
12248
+ };
12249
+ readonly destination: {
12250
+ readonly kind: 'object';
12251
+ readonly required: true;
12252
+ readonly describe: 'Destination requiring file write access.';
12253
+ };
12254
+ };
12255
+ };
12142
12256
  readonly createCredentialConnection: {
12143
12257
  readonly method: 'POST';
12144
12258
  readonly path: '/api/v2/credentials/connections';
@@ -14008,6 +14122,27 @@ export declare const V2_OPERATIONS: {
14008
14122
  };
14009
14123
  };
14010
14124
  };
14125
+ readonly downloadProjectFileItems: {
14126
+ readonly method: 'GET';
14127
+ readonly path: '/api/v2/projects/[projectId]/files/bulk-download';
14128
+ readonly pathParams: readonly ['projectId'];
14129
+ readonly pathParamDocs: {
14130
+ readonly projectId: 'Project identifier.';
14131
+ };
14132
+ readonly responseMode: 'binary';
14133
+ readonly summary: 'Download Project File Items';
14134
+ readonly workspaceKeyUnsupported: true;
14135
+ readonly query: {
14136
+ readonly fileIds: {
14137
+ readonly kind: 'string';
14138
+ readonly describe: 'File identifiers to include, comma-separated. At most 100 entries.';
14139
+ };
14140
+ readonly folderIds: {
14141
+ readonly kind: 'string';
14142
+ readonly describe: 'Folder identifiers to include recursively, comma-separated. The resolved selection allows at most 100 files.';
14143
+ };
14144
+ };
14145
+ };
14011
14146
  readonly downloadRunFile: {
14012
14147
  readonly method: 'GET';
14013
14148
  readonly path: '/api/v2/workflows/[workflowId]/runs/[runId]/files/[fileId]';
@@ -14184,6 +14319,25 @@ export declare const V2_OPERATIONS: {
14184
14319
  };
14185
14320
  };
14186
14321
  };
14322
+ readonly exportProjectFileSnapshot: {
14323
+ readonly method: 'POST';
14324
+ readonly path: '/api/v2/projects/[projectId]/files/[fileId]/export';
14325
+ readonly pathParams: readonly ['projectId', 'fileId'];
14326
+ readonly pathParamDocs: {
14327
+ readonly projectId: 'Project identifier.';
14328
+ readonly fileId: 'File identifier within the Project.';
14329
+ };
14330
+ readonly responseMode: 'binary';
14331
+ readonly summary: 'Export Project File Snapshot';
14332
+ readonly workspaceKeyUnsupported: true;
14333
+ readonly body: {
14334
+ readonly content: {
14335
+ readonly kind: 'string';
14336
+ readonly required: true;
14337
+ readonly describe: 'Visible Markdown snapshot to export. This does not replace the stored file or create a version.';
14338
+ };
14339
+ };
14340
+ };
14187
14341
  readonly exportWorkflow: {
14188
14342
  readonly method: 'GET';
14189
14343
  readonly path: '/api/v2/workflows/[workflowId]/export';
@@ -19407,6 +19561,18 @@ export declare const V2_OPERATIONS: {
19407
19561
  };
19408
19562
  };
19409
19563
  };
19564
+ readonly unzipProjectFile: {
19565
+ readonly method: 'POST';
19566
+ readonly path: '/api/v2/projects/[projectId]/files/[fileId]/unzip';
19567
+ readonly pathParams: readonly ['projectId', 'fileId'];
19568
+ readonly pathParamDocs: {
19569
+ readonly projectId: 'Project identifier.';
19570
+ readonly fileId: 'File identifier within the Project.';
19571
+ };
19572
+ readonly responseMode: 'json';
19573
+ readonly summary: 'Unzip Project File';
19574
+ readonly workspaceKeyUnsupported: true;
19575
+ };
19410
19576
  readonly updateCredential: {
19411
19577
  readonly method: 'PATCH';
19412
19578
  readonly path: '/api/v2/credentials/[credentialId]';
package/dist/index.js CHANGED
@@ -10143,6 +10143,26 @@ var V2_OPERATIONS = {
10143
10143
  }
10144
10144
  }
10145
10145
  },
10146
+ copyFileItems: {
10147
+ method: "POST",
10148
+ path: "/api/v2/files/copy",
10149
+ pathParams: [],
10150
+ responseMode: "json",
10151
+ summary: "Copy File Items",
10152
+ workspaceKeyUnsupported: true,
10153
+ body: {
10154
+ source: {
10155
+ kind: "object",
10156
+ required: true,
10157
+ describe: "Selection to read under the source owner."
10158
+ },
10159
+ destination: {
10160
+ kind: "object",
10161
+ required: true,
10162
+ describe: "Destination requiring file write access."
10163
+ }
10164
+ }
10165
+ },
10146
10166
  createCredentialConnection: {
10147
10167
  method: "POST",
10148
10168
  path: "/api/v2/credentials/connections",
@@ -11736,6 +11756,25 @@ var V2_OPERATIONS = {
11736
11756
  workspaceId: { kind: "string", required: true, describe: "Workspace that owns the file." }
11737
11757
  }
11738
11758
  },
11759
+ downloadProjectFileItems: {
11760
+ method: "GET",
11761
+ path: "/api/v2/projects/[projectId]/files/bulk-download",
11762
+ pathParams: ["projectId"],
11763
+ pathParamDocs: { projectId: "Project identifier." },
11764
+ responseMode: "binary",
11765
+ summary: "Download Project File Items",
11766
+ workspaceKeyUnsupported: true,
11767
+ query: {
11768
+ fileIds: {
11769
+ kind: "string",
11770
+ describe: "File identifiers to include, comma-separated. At most 100 entries."
11771
+ },
11772
+ folderIds: {
11773
+ kind: "string",
11774
+ describe: "Folder identifiers to include recursively, comma-separated. The resolved selection allows at most 100 files."
11775
+ }
11776
+ }
11777
+ },
11739
11778
  downloadRunFile: {
11740
11779
  method: "GET",
11741
11780
  path: "/api/v2/workflows/[workflowId]/runs/[runId]/files/[fileId]",
@@ -11900,6 +11939,25 @@ var V2_OPERATIONS = {
11900
11939
  }
11901
11940
  }
11902
11941
  },
11942
+ exportProjectFileSnapshot: {
11943
+ method: "POST",
11944
+ path: "/api/v2/projects/[projectId]/files/[fileId]/export",
11945
+ pathParams: ["projectId", "fileId"],
11946
+ pathParamDocs: {
11947
+ projectId: "Project identifier.",
11948
+ fileId: "File identifier within the Project."
11949
+ },
11950
+ responseMode: "binary",
11951
+ summary: "Export Project File Snapshot",
11952
+ workspaceKeyUnsupported: true,
11953
+ body: {
11954
+ content: {
11955
+ kind: "string",
11956
+ required: true,
11957
+ describe: "Visible Markdown snapshot to export. This does not replace the stored file or create a version."
11958
+ }
11959
+ }
11960
+ },
11903
11961
  exportWorkflow: {
11904
11962
  method: "GET",
11905
11963
  path: "/api/v2/workflows/[workflowId]/export",
@@ -16995,6 +17053,18 @@ var V2_OPERATIONS = {
16995
17053
  workspaceId: { kind: "string", required: true, describe: "Workspace that owns the archive." }
16996
17054
  }
16997
17055
  },
17056
+ unzipProjectFile: {
17057
+ method: "POST",
17058
+ path: "/api/v2/projects/[projectId]/files/[fileId]/unzip",
17059
+ pathParams: ["projectId", "fileId"],
17060
+ pathParamDocs: {
17061
+ projectId: "Project identifier.",
17062
+ fileId: "File identifier within the Project."
17063
+ },
17064
+ responseMode: "json",
17065
+ summary: "Unzip Project File",
17066
+ workspaceKeyUnsupported: true
17067
+ },
16998
17068
  updateCredential: {
16999
17069
  method: "PATCH",
17000
17070
  path: "/api/v2/credentials/[credentialId]",
@@ -19301,6 +19371,13 @@ var CLI_CONTRACT = {
19301
19371
  }
19302
19372
  }
19303
19373
  },
19374
+ copyFileItems: {
19375
+ command: "files copy",
19376
+ flags: {
19377
+ source: { json: true, describe: "Source owner and selected fileIds or folderIds" },
19378
+ destination: { json: true, describe: "Destination owner and optional folderId" }
19379
+ }
19380
+ },
19304
19381
  renameProjectFile: { command: "projects files rename" },
19305
19382
  listProjectFileFolders: {
19306
19383
  command: "projects files folders list",
@@ -20136,6 +20213,11 @@ var CLI_CONTRACT = {
20136
20213
  describe: "Unzip an archive into a new folder beside it",
20137
20214
  confirm: "This writes every file in the archive into the workspace."
20138
20215
  },
20216
+ unzipProjectFile: {
20217
+ command: "projects files unzip",
20218
+ describe: "Unzip an archive into a new folder beside it in the Project",
20219
+ confirm: "This writes every file in the archive into the Project."
20220
+ },
20139
20221
  bulkDownloadFiles: {
20140
20222
  command: "files bulk-download",
20141
20223
  describe: "Download files and folders as a zip archive",
@@ -20144,6 +20226,18 @@ var CLI_CONTRACT = {
20144
20226
  folderPaths: FOLDER_PATHS_FLAG
20145
20227
  }
20146
20228
  },
20229
+ downloadProjectFileItems: {
20230
+ command: "projects files bulk-download",
20231
+ describe: "Download Project files and folders as a zip archive",
20232
+ flags: {
20233
+ fileIds: { list: true },
20234
+ folderIds: { list: true }
20235
+ }
20236
+ },
20237
+ exportProjectFileSnapshot: {
20238
+ command: "projects files export",
20239
+ describe: "Export a visible Project Markdown snapshot with its embedded assets"
20240
+ },
20147
20241
  editFileContent: {
20148
20242
  command: "files edit",
20149
20243
  describe: "Apply one exact or anchor-based edit to a text file",
@@ -22777,6 +22871,22 @@ async function downloadToOutput(connect, operation, pathParams, options, scope,
22777
22871
  status: "saved"
22778
22872
  });
22779
22873
  }
22874
+ function attachProjectFileDownload(files) {
22875
+ const [command, connect] = apiCommand(files, "bulk-download", ["downloadProjectFileItems"]);
22876
+ command.argument("<projectId>", "Project that owns the files").allowExcessArguments(false).description(describeOperation(V2_OPERATIONS.downloadProjectFileItems, "Download Project files and recursive folder contents as a zip archive")).option("--file-ids <id...>", "File identifiers to include").option("--folder-ids <id...>", "Folder identifiers to include recursively").option("-o, --output-file <path>", "Write the archive to a file instead of stdout").option("--force", "Overwrite --output-file if it already exists").action(async (projectId, options) => {
22877
+ const input = await buildRequest("downloadProjectFileItems", [projectId], { ...options }, null);
22878
+ await downloadToOutput(connect, "downloadProjectFileItems", { projectId }, options, "owner", {
22879
+ query: input.query
22880
+ });
22881
+ });
22882
+ }
22883
+ function attachProjectFileSnapshotExport(files) {
22884
+ const [command, connect] = apiCommand(files, "export", ["exportProjectFileSnapshot"]);
22885
+ command.argument("<projectId>", "Project that owns the file").argument("<fileId>", "Markdown file whose visible snapshot to export").allowExcessArguments(false).description(describeOperation(V2_OPERATIONS.exportProjectFileSnapshot, "Export a visible Project Markdown snapshot with its embedded assets")).requiredOption("--content <text|@file|@->", "Visible Markdown content or a file to read").option("-o, --output-file <path>", "Write the export to a file instead of stdout").option("--force", "Overwrite --output-file if it already exists").action(async (projectId, fileId, options) => {
22886
+ const source = await readArgumentSource(options.content, "content");
22887
+ await downloadToOutput(connect, "exportProjectFileSnapshot", { projectId, fileId }, options, "owner", { body: { content: source.text } });
22888
+ });
22889
+ }
22780
22890
  function attachFileGet(files) {
22781
22891
  const [command, connect] = apiCommand(files, "get", ["downloadFile"]);
22782
22892
  command.argument("<fileId>", "File whose content to read").allowExcessArguments(false).description("Download a file’s content to stdout or a local file").option("-o, --output-file <path>", "Write content to a file instead of stdout").option("--force", "Overwrite --output-file if it already exists").action((fileId, options) => downloadToOutput(connect, "downloadFile", { fileId }, options, "workspace"));
@@ -24228,6 +24338,8 @@ function attachProtocolCommands(program) {
24228
24338
  const projectFiles = group(group(program, "projects"), "files");
24229
24339
  attachProjectFileUpload(projectFiles);
24230
24340
  attachProjectFileSource(projectFiles);
24341
+ attachProjectFileDownload(projectFiles);
24342
+ attachProjectFileSnapshotExport(projectFiles);
24231
24343
  attachProjectFileVersionSource(group(projectFiles, "versions"));
24232
24344
  const files = group(program, "files");
24233
24345
  attachFileUpload(files);
package/dist/runtime.js CHANGED
@@ -10192,6 +10192,26 @@ var V2_OPERATIONS = {
10192
10192
  }
10193
10193
  }
10194
10194
  },
10195
+ copyFileItems: {
10196
+ method: "POST",
10197
+ path: "/api/v2/files/copy",
10198
+ pathParams: [],
10199
+ responseMode: "json",
10200
+ summary: "Copy File Items",
10201
+ workspaceKeyUnsupported: true,
10202
+ body: {
10203
+ source: {
10204
+ kind: "object",
10205
+ required: true,
10206
+ describe: "Selection to read under the source owner."
10207
+ },
10208
+ destination: {
10209
+ kind: "object",
10210
+ required: true,
10211
+ describe: "Destination requiring file write access."
10212
+ }
10213
+ }
10214
+ },
10195
10215
  createCredentialConnection: {
10196
10216
  method: "POST",
10197
10217
  path: "/api/v2/credentials/connections",
@@ -11785,6 +11805,25 @@ var V2_OPERATIONS = {
11785
11805
  workspaceId: { kind: "string", required: true, describe: "Workspace that owns the file." }
11786
11806
  }
11787
11807
  },
11808
+ downloadProjectFileItems: {
11809
+ method: "GET",
11810
+ path: "/api/v2/projects/[projectId]/files/bulk-download",
11811
+ pathParams: ["projectId"],
11812
+ pathParamDocs: { projectId: "Project identifier." },
11813
+ responseMode: "binary",
11814
+ summary: "Download Project File Items",
11815
+ workspaceKeyUnsupported: true,
11816
+ query: {
11817
+ fileIds: {
11818
+ kind: "string",
11819
+ describe: "File identifiers to include, comma-separated. At most 100 entries."
11820
+ },
11821
+ folderIds: {
11822
+ kind: "string",
11823
+ describe: "Folder identifiers to include recursively, comma-separated. The resolved selection allows at most 100 files."
11824
+ }
11825
+ }
11826
+ },
11788
11827
  downloadRunFile: {
11789
11828
  method: "GET",
11790
11829
  path: "/api/v2/workflows/[workflowId]/runs/[runId]/files/[fileId]",
@@ -11949,6 +11988,25 @@ var V2_OPERATIONS = {
11949
11988
  }
11950
11989
  }
11951
11990
  },
11991
+ exportProjectFileSnapshot: {
11992
+ method: "POST",
11993
+ path: "/api/v2/projects/[projectId]/files/[fileId]/export",
11994
+ pathParams: ["projectId", "fileId"],
11995
+ pathParamDocs: {
11996
+ projectId: "Project identifier.",
11997
+ fileId: "File identifier within the Project."
11998
+ },
11999
+ responseMode: "binary",
12000
+ summary: "Export Project File Snapshot",
12001
+ workspaceKeyUnsupported: true,
12002
+ body: {
12003
+ content: {
12004
+ kind: "string",
12005
+ required: true,
12006
+ describe: "Visible Markdown snapshot to export. This does not replace the stored file or create a version."
12007
+ }
12008
+ }
12009
+ },
11952
12010
  exportWorkflow: {
11953
12011
  method: "GET",
11954
12012
  path: "/api/v2/workflows/[workflowId]/export",
@@ -17044,6 +17102,18 @@ var V2_OPERATIONS = {
17044
17102
  workspaceId: { kind: "string", required: true, describe: "Workspace that owns the archive." }
17045
17103
  }
17046
17104
  },
17105
+ unzipProjectFile: {
17106
+ method: "POST",
17107
+ path: "/api/v2/projects/[projectId]/files/[fileId]/unzip",
17108
+ pathParams: ["projectId", "fileId"],
17109
+ pathParamDocs: {
17110
+ projectId: "Project identifier.",
17111
+ fileId: "File identifier within the Project."
17112
+ },
17113
+ responseMode: "json",
17114
+ summary: "Unzip Project File",
17115
+ workspaceKeyUnsupported: true
17116
+ },
17047
17117
  updateCredential: {
17048
17118
  method: "PATCH",
17049
17119
  path: "/api/v2/credentials/[credentialId]",
@@ -19350,6 +19420,13 @@ var CLI_CONTRACT = {
19350
19420
  }
19351
19421
  }
19352
19422
  },
19423
+ copyFileItems: {
19424
+ command: "files copy",
19425
+ flags: {
19426
+ source: { json: true, describe: "Source owner and selected fileIds or folderIds" },
19427
+ destination: { json: true, describe: "Destination owner and optional folderId" }
19428
+ }
19429
+ },
19353
19430
  renameProjectFile: { command: "projects files rename" },
19354
19431
  listProjectFileFolders: {
19355
19432
  command: "projects files folders list",
@@ -20185,6 +20262,11 @@ var CLI_CONTRACT = {
20185
20262
  describe: "Unzip an archive into a new folder beside it",
20186
20263
  confirm: "This writes every file in the archive into the workspace."
20187
20264
  },
20265
+ unzipProjectFile: {
20266
+ command: "projects files unzip",
20267
+ describe: "Unzip an archive into a new folder beside it in the Project",
20268
+ confirm: "This writes every file in the archive into the Project."
20269
+ },
20188
20270
  bulkDownloadFiles: {
20189
20271
  command: "files bulk-download",
20190
20272
  describe: "Download files and folders as a zip archive",
@@ -20193,6 +20275,18 @@ var CLI_CONTRACT = {
20193
20275
  folderPaths: FOLDER_PATHS_FLAG
20194
20276
  }
20195
20277
  },
20278
+ downloadProjectFileItems: {
20279
+ command: "projects files bulk-download",
20280
+ describe: "Download Project files and folders as a zip archive",
20281
+ flags: {
20282
+ fileIds: { list: true },
20283
+ folderIds: { list: true }
20284
+ }
20285
+ },
20286
+ exportProjectFileSnapshot: {
20287
+ command: "projects files export",
20288
+ describe: "Export a visible Project Markdown snapshot with its embedded assets"
20289
+ },
20196
20290
  editFileContent: {
20197
20291
  command: "files edit",
20198
20292
  describe: "Apply one exact or anchor-based edit to a text file",
@@ -22826,6 +22920,22 @@ async function downloadToOutput(connect, operation, pathParams, options, scope,
22826
22920
  status: "saved"
22827
22921
  });
22828
22922
  }
22923
+ function attachProjectFileDownload(files) {
22924
+ const [command, connect] = apiCommand(files, "bulk-download", ["downloadProjectFileItems"]);
22925
+ command.argument("<projectId>", "Project that owns the files").allowExcessArguments(false).description(describeOperation(V2_OPERATIONS.downloadProjectFileItems, "Download Project files and recursive folder contents as a zip archive")).option("--file-ids <id...>", "File identifiers to include").option("--folder-ids <id...>", "Folder identifiers to include recursively").option("-o, --output-file <path>", "Write the archive to a file instead of stdout").option("--force", "Overwrite --output-file if it already exists").action(async (projectId, options) => {
22926
+ const input = await buildRequest("downloadProjectFileItems", [projectId], { ...options }, null);
22927
+ await downloadToOutput(connect, "downloadProjectFileItems", { projectId }, options, "owner", {
22928
+ query: input.query
22929
+ });
22930
+ });
22931
+ }
22932
+ function attachProjectFileSnapshotExport(files) {
22933
+ const [command, connect] = apiCommand(files, "export", ["exportProjectFileSnapshot"]);
22934
+ command.argument("<projectId>", "Project that owns the file").argument("<fileId>", "Markdown file whose visible snapshot to export").allowExcessArguments(false).description(describeOperation(V2_OPERATIONS.exportProjectFileSnapshot, "Export a visible Project Markdown snapshot with its embedded assets")).requiredOption("--content <text|@file|@->", "Visible Markdown content or a file to read").option("-o, --output-file <path>", "Write the export to a file instead of stdout").option("--force", "Overwrite --output-file if it already exists").action(async (projectId, fileId, options) => {
22935
+ const source = await readArgumentSource(options.content, "content");
22936
+ await downloadToOutput(connect, "exportProjectFileSnapshot", { projectId, fileId }, options, "owner", { body: { content: source.text } });
22937
+ });
22938
+ }
22829
22939
  function attachFileGet(files) {
22830
22940
  const [command, connect] = apiCommand(files, "get", ["downloadFile"]);
22831
22941
  command.argument("<fileId>", "File whose content to read").allowExcessArguments(false).description("Download a file’s content to stdout or a local file").option("-o, --output-file <path>", "Write content to a file instead of stdout").option("--force", "Overwrite --output-file if it already exists").action((fileId, options) => downloadToOutput(connect, "downloadFile", { fileId }, options, "workspace"));
@@ -24277,6 +24387,8 @@ function attachProtocolCommands(program) {
24277
24387
  const projectFiles = group(group(program, "projects"), "files");
24278
24388
  attachProjectFileUpload(projectFiles);
24279
24389
  attachProjectFileSource(projectFiles);
24390
+ attachProjectFileDownload(projectFiles);
24391
+ attachProjectFileSnapshotExport(projectFiles);
24280
24392
  attachProjectFileVersionSource(group(projectFiles, "versions"));
24281
24393
  const files = group(program, "files");
24282
24394
  attachFileUpload(files);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim",
3
- "version": "2.2.13-preview.230.1",
3
+ "version": "2.2.13-preview.231.1",
4
4
  "description": "Sim CLI - talk to the Sim API from your terminal",
5
5
  "type": "module",
6
6
  "imports": {