dataiku-sdk 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/src/cli.js +1301 -14
  2. package/dist/src/client.d.ts +46 -0
  3. package/dist/src/client.js +158 -0
  4. package/dist/src/index.d.ts +13 -0
  5. package/dist/src/index.js +13 -0
  6. package/dist/src/resources/api-deployer.d.ts +66 -0
  7. package/dist/src/resources/api-deployer.js +79 -0
  8. package/dist/src/resources/api-services.d.ts +38 -0
  9. package/dist/src/resources/api-services.js +50 -0
  10. package/dist/src/resources/applications.d.ts +56 -0
  11. package/dist/src/resources/applications.js +67 -0
  12. package/dist/src/resources/bundles.d.ts +53 -0
  13. package/dist/src/resources/bundles.js +103 -0
  14. package/dist/src/resources/continuous-activities.d.ts +27 -0
  15. package/dist/src/resources/continuous-activities.js +22 -0
  16. package/dist/src/resources/datasets.d.ts +6 -0
  17. package/dist/src/resources/datasets.js +15 -0
  18. package/dist/src/resources/discussions.d.ts +26 -0
  19. package/dist/src/resources/discussions.js +29 -0
  20. package/dist/src/resources/meanings.d.ts +41 -0
  21. package/dist/src/resources/meanings.js +33 -0
  22. package/dist/src/resources/metrics.d.ts +44 -0
  23. package/dist/src/resources/metrics.js +31 -0
  24. package/dist/src/resources/project-library.d.ts +38 -0
  25. package/dist/src/resources/project-library.js +82 -0
  26. package/dist/src/resources/projects.d.ts +70 -0
  27. package/dist/src/resources/projects.js +97 -0
  28. package/dist/src/resources/recipes.js +10 -8
  29. package/dist/src/resources/scenarios.d.ts +3 -0
  30. package/dist/src/resources/scenarios.js +8 -1
  31. package/dist/src/resources/statistics.d.ts +56 -0
  32. package/dist/src/resources/statistics.js +51 -0
  33. package/dist/src/resources/streaming-endpoints.d.ts +45 -0
  34. package/dist/src/resources/streaming-endpoints.js +36 -0
  35. package/dist/src/resources/webapps.d.ts +27 -0
  36. package/dist/src/resources/webapps.js +36 -0
  37. package/dist/src/resources/workspaces.d.ts +59 -0
  38. package/dist/src/resources/workspaces.js +31 -0
  39. package/package.json +5 -5
package/dist/src/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createHash, } from "node:crypto";
3
- import { readFileSync, } from "node:fs";
3
+ import { readFileSync, writeFileSync, } from "node:fs";
4
4
  import { mkdir, writeFile, } from "node:fs/promises";
5
5
  import { dirname, join, resolve, } from "node:path";
6
6
  import { fileURLToPath, } from "node:url";
@@ -1064,7 +1064,7 @@ function resolveSqlInput(args, flags) {
1064
1064
  }
1065
1065
  return query;
1066
1066
  }
1067
- const CODE_RUN_USAGE = "dss code run (--file PATH | --stdin) [--env ENV] [--timeout MS] [--keep] [--full-log] [--project-key KEY]";
1067
+ const CODE_RUN_USAGE = "dss code run (--file PATH | --stdin) [--env ENV] [--timeout MS] [--keep] [--full-log] [--max-log-bytes N] [--project-key KEY]";
1068
1068
  function resolveCodeInput(args, flags) {
1069
1069
  if (args.length > 0) {
1070
1070
  throw new UsageError(`code run takes no positional arguments; pass the script via --file PATH or --stdin. Usage: ${CODE_RUN_USAGE}`);
@@ -1119,6 +1119,23 @@ function formatLineDiff(remoteName, localPath, remoteContent, localContent) {
1119
1119
  return lines.join("\n");
1120
1120
  }
1121
1121
  let outputFieldProjection;
1122
+ /**
1123
+ * Non-fatal diagnostics queued during a command and flushed to stderr as one
1124
+ * JSON envelope, so agents get a loud, machine-parseable signal (e.g. truncated
1125
+ * exports) without polluting the stdout result contract.
1126
+ */
1127
+ let pendingCliWarnings = [];
1128
+ function enqueueCliWarning(warning) {
1129
+ pendingCliWarnings.push(warning);
1130
+ }
1131
+ /** Emit queued warnings as a single `{ warnings: [...] }` object on stderr. Idempotent. */
1132
+ function flushCliWarnings() {
1133
+ if (pendingCliWarnings.length === 0)
1134
+ return;
1135
+ const warnings = pendingCliWarnings;
1136
+ pendingCliWarnings = [];
1137
+ process.stderr.write(`${JSON.stringify({ warnings, }, null, 2)}\n`);
1138
+ }
1122
1139
  function resolveFieldPath(source, field) {
1123
1140
  let current = source;
1124
1141
  for (const segment of field.split(".")) {
@@ -1148,6 +1165,7 @@ function projectResultFields(result, fields) {
1148
1165
  return pickResultFields(result, fields);
1149
1166
  }
1150
1167
  function writeCommandResult(result) {
1168
+ flushCliWarnings();
1151
1169
  const projected = outputFieldProjection
1152
1170
  ? projectResultFields(result, outputFieldProjection)
1153
1171
  : result;
@@ -1495,6 +1513,7 @@ const FLAG_ALIASES = {
1495
1513
  "extra-ca-certs": "ca-cert",
1496
1514
  explain: "plan",
1497
1515
  "zone-name": "zone",
1516
+ rows: "max-rows",
1498
1517
  };
1499
1518
  const VALUE_FLAGS = new Set([
1500
1519
  "fields",
@@ -1535,6 +1554,7 @@ const VALUE_FLAGS = new Set([
1535
1554
  "max-edges",
1536
1555
  "max-lines",
1537
1556
  "max-log-lines",
1557
+ "max-log-bytes",
1538
1558
  "listed",
1539
1559
  "max-nodes",
1540
1560
  "max-rows",
@@ -1729,6 +1749,1227 @@ const commands = {
1729
1749
  "dss project map --include-raw",
1730
1750
  ],
1731
1751
  },
1752
+ create: {
1753
+ handler: (c, a, f) => {
1754
+ requireArgs(a, 2, "dss project create <projectKey> <name> [--owner LOGIN] [--data JSON|--data-file PATH|--stdin]");
1755
+ return c.projects.createProject(a[0], a[1], f["owner"], jsonInput(f));
1756
+ },
1757
+ usage: "dss project create <projectKey> <name> [--owner LOGIN] [--data JSON|--data-file PATH|--stdin]",
1758
+ description: "Create a new project (optionally with owner login and settings).",
1759
+ examples: ["dss project create MY_PROJ MyProject",],
1760
+ },
1761
+ delete: {
1762
+ handler: async (c, a, f) => {
1763
+ requireArgs(a, 1, "dss project delete <projectKey> [--drop-data]");
1764
+ await c.projects.deleteProject(a[0], f["drop-data"] === true);
1765
+ return { deleted: a[0], };
1766
+ },
1767
+ usage: "dss project delete <projectKey> [--drop-data]",
1768
+ description: "Delete a project (destructive). --drop-data also clears managed datasets.",
1769
+ examples: ["dss project delete MY_PROJ",],
1770
+ },
1771
+ duplicate: {
1772
+ handler: (c, a, f) => {
1773
+ requireArgs(a, 3, "dss project duplicate <sourceKey> <targetKey> <targetName> [--data JSON|--data-file PATH|--stdin]");
1774
+ return c.projects.duplicate(a[0], a[1], a[2], jsonInput(f));
1775
+ },
1776
+ usage: "dss project duplicate <sourceKey> <targetKey> <targetName> [--data JSON|--data-file PATH|--stdin]",
1777
+ description: "Duplicate a project into a new project key.",
1778
+ examples: ["dss project duplicate SRC NEW NewProject",],
1779
+ },
1780
+ export: {
1781
+ handler: async (c, a, f) => {
1782
+ requireArgs(a, 1, "dss project export <projectKey> --output PATH [--data JSON|--data-file PATH|--stdin]");
1783
+ const out = f["output"];
1784
+ if (!out)
1785
+ throw new UsageError("--output PATH is required.", "missing_required_flag");
1786
+ await c.projects.exportArchive(a[0], out, jsonInput(f));
1787
+ return { path: out, };
1788
+ },
1789
+ usage: "dss project export <projectKey> --output PATH [--data JSON|--data-file PATH|--stdin]",
1790
+ description: "Export a project to a local archive (.zip).",
1791
+ examples: ["dss project export MY_PROJ --output ./my_proj.zip",],
1792
+ },
1793
+ import: {
1794
+ handler: async (c, a) => {
1795
+ requireArgs(a, 1, "dss project import <filePath>");
1796
+ return c.projects.importProjectFromArchive(a[0]);
1797
+ },
1798
+ usage: "dss project import <filePath>",
1799
+ description: "Upload a project archive to prepare an import (returns a temporary import id).",
1800
+ examples: ["dss project import ./my_proj.zip",],
1801
+ },
1802
+ "permissions-get": {
1803
+ handler: (c, _a, f) => c.projects.getPermissions(f["project-key"]),
1804
+ usage: "dss project permissions-get [--project-key KEY]",
1805
+ description: "Get a project's permissions.",
1806
+ examples: ["dss project permissions-get --project-key MY_PROJ",],
1807
+ },
1808
+ "permissions-set": {
1809
+ handler: async (c, _a, f) => {
1810
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (permissions object).");
1811
+ await c.projects.setPermissions(f["project-key"], body);
1812
+ return { updated: true, };
1813
+ },
1814
+ usage: "dss project permissions-set (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
1815
+ description: "Replace a project's permissions.",
1816
+ examples: ["dss project permissions-set --data-file perms.json --project-key MY_PROJ",],
1817
+ },
1818
+ "settings-get": {
1819
+ handler: (c, _a, f) => c.projects.getSettings(f["project-key"]),
1820
+ usage: "dss project settings-get [--project-key KEY]",
1821
+ description: "Get a project's settings.",
1822
+ examples: ["dss project settings-get --project-key MY_PROJ",],
1823
+ },
1824
+ "settings-set": {
1825
+ handler: async (c, _a, f) => {
1826
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (settings object).");
1827
+ await c.projects.setSettings(f["project-key"], body);
1828
+ return { updated: true, };
1829
+ },
1830
+ usage: "dss project settings-set (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
1831
+ description: "Replace a project's settings.",
1832
+ examples: ["dss project settings-set --data-file settings.json --project-key MY_PROJ",],
1833
+ },
1834
+ },
1835
+ app: {
1836
+ list: {
1837
+ handler: (c) => c.applications.listApps(),
1838
+ usage: "dss app list",
1839
+ description: "List all Dataiku App templates.",
1840
+ examples: ["dss app list",],
1841
+ },
1842
+ manifest: {
1843
+ handler: (c, a) => {
1844
+ requireArgs(a, 1, "dss app manifest <appId>");
1845
+ return c.applications.getAppManifest(a[0]);
1846
+ },
1847
+ usage: "dss app manifest <appId>",
1848
+ description: "Get the manifest of a Dataiku App template.",
1849
+ examples: ["dss app manifest my-app",],
1850
+ },
1851
+ instances: {
1852
+ handler: (c, a) => {
1853
+ requireArgs(a, 1, "dss app instances <appId>");
1854
+ return c.applications.listInstances(a[0]);
1855
+ },
1856
+ usage: "dss app instances <appId>",
1857
+ description: "List instances created from a Dataiku App template.",
1858
+ examples: ["dss app instances my-app",],
1859
+ },
1860
+ "create-instance": {
1861
+ handler: (c, a, f) => {
1862
+ requireArgs(a, 1, "dss app create-instance <appId> (--data JSON|--data-file PATH|--stdin)");
1863
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (instance creation payload).");
1864
+ return c.applications.createInstance(a[0], body);
1865
+ },
1866
+ usage: "dss app create-instance <appId> (--data JSON|--data-file PATH|--stdin)",
1867
+ description: "Create an app instance from a Dataiku App template.",
1868
+ examples: ['dss app create-instance my-app --data \'{"targetProjectKey":"NEWPROJ"}\'',],
1869
+ },
1870
+ "instance-manifest": {
1871
+ handler: (c, _a, f) => c.applications.getInstanceManifest(f["project-key"]),
1872
+ usage: "dss app instance-manifest [--project-key KEY]",
1873
+ description: "Get the app manifest of an app-instance project.",
1874
+ examples: ["dss app instance-manifest --project-key MYINSTANCE",],
1875
+ },
1876
+ "save-instance-manifest": {
1877
+ handler: (c, _a, f) => {
1878
+ const manifest = requiredJsonInput(f, "--data, --data-file, or --stdin is required (manifest JSON).");
1879
+ return c.applications.saveInstanceManifest(manifest, f["project-key"]);
1880
+ },
1881
+ usage: "dss app save-instance-manifest (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
1882
+ description: "Save the app manifest of an app-instance project (homepage sections, use-as-recipe settings).",
1883
+ examples: ["dss app save-instance-manifest --data-file manifest.json --project-key MYINSTANCE",],
1884
+ },
1885
+ "delete-instance": {
1886
+ handler: async (c, _a, f) => {
1887
+ await c.applications.deleteInstance(f["project-key"]);
1888
+ return { deleted: true, };
1889
+ },
1890
+ usage: "dss app delete-instance [--project-key KEY]",
1891
+ description: "Delete an app-instance project (destructive: removes the instance project).",
1892
+ examples: ["dss app delete-instance --project-key MYINSTANCE",],
1893
+ },
1894
+ "business-app-instance-permissions": {
1895
+ handler: (c, a) => {
1896
+ requireArgs(a, 3, "dss app business-app-instance-permissions <businessAppId> <instanceProjectKey> <userLogin>");
1897
+ return c.applications.getBusinessAppInstanceUserPermissions(a[0], a[1], a[2]);
1898
+ },
1899
+ usage: "dss app business-app-instance-permissions <businessAppId> <instanceProjectKey> <userLogin>",
1900
+ description: "Get a user's effective permissions on a Business App instance.",
1901
+ examples: ["dss app business-app-instance-permissions my-bapp INSTANCEPROJ alice",],
1902
+ },
1903
+ },
1904
+ "business-app": {
1905
+ list: {
1906
+ handler: (c) => c.applications.listBusinessApps(),
1907
+ usage: "dss business-app list",
1908
+ description: "List all Business Apps.",
1909
+ examples: ["dss business-app list",],
1910
+ },
1911
+ get: {
1912
+ handler: (c, a) => {
1913
+ requireArgs(a, 1, "dss business-app get <id>");
1914
+ return c.applications.getBusinessApp(a[0]);
1915
+ },
1916
+ usage: "dss business-app get <id>",
1917
+ description: "Get Business App details.",
1918
+ examples: ["dss business-app get my-bapp",],
1919
+ },
1920
+ settings: {
1921
+ handler: (c, a) => {
1922
+ requireArgs(a, 1, "dss business-app settings <id>");
1923
+ return c.applications.getBusinessAppSettings(a[0]);
1924
+ },
1925
+ usage: "dss business-app settings <id>",
1926
+ description: "Get Business App settings.",
1927
+ examples: ["dss business-app settings my-bapp",],
1928
+ },
1929
+ "save-settings": {
1930
+ handler: (c, a, f) => {
1931
+ requireArgs(a, 1, "dss business-app save-settings <id> (--data JSON|--data-file PATH|--stdin)");
1932
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (settings JSON).");
1933
+ return c.applications.saveBusinessAppSettings(a[0], body);
1934
+ },
1935
+ usage: "dss business-app save-settings <id> (--data JSON|--data-file PATH|--stdin)",
1936
+ description: "Save Business App settings (admin only; includes connection remapping).",
1937
+ examples: ["dss business-app save-settings my-bapp --data-file settings.json",],
1938
+ },
1939
+ instances: {
1940
+ handler: (c, a) => {
1941
+ requireArgs(a, 1, "dss business-app instances <id>");
1942
+ return c.applications.listBusinessAppInstances(a[0]);
1943
+ },
1944
+ usage: "dss business-app instances <id>",
1945
+ description: "List instances of a Business App.",
1946
+ examples: ["dss business-app instances my-bapp",],
1947
+ },
1948
+ "create-instance": {
1949
+ handler: (c, a, f) => {
1950
+ requireArgs(a, 1, "dss business-app create-instance <id> (--data JSON|--data-file PATH|--stdin)");
1951
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (instance payload).");
1952
+ return c.applications.createBusinessAppInstance(a[0], body);
1953
+ },
1954
+ usage: "dss business-app create-instance <id> (--data JSON|--data-file PATH|--stdin)",
1955
+ description: "Create an instance of a Business App.",
1956
+ examples: ["dss business-app create-instance my-bapp --data '{}'",],
1957
+ },
1958
+ "upgrade-instance": {
1959
+ handler: (c, a) => {
1960
+ requireArgs(a, 2, "dss business-app upgrade-instance <id> <projectKey>");
1961
+ return c.applications.upgradeBusinessAppInstance(a[0], a[1]);
1962
+ },
1963
+ usage: "dss business-app upgrade-instance <id> <projectKey>",
1964
+ description: "Upgrade a Business App instance to the latest version.",
1965
+ examples: ["dss business-app upgrade-instance my-bapp INSTANCEPROJ",],
1966
+ },
1967
+ "install-from-archive": {
1968
+ handler: async (c, a) => {
1969
+ requireArgs(a, 1, "dss business-app install-from-archive <filePath>");
1970
+ await c.applications.installBusinessAppFromArchive(a[0]);
1971
+ return { installed: true, };
1972
+ },
1973
+ usage: "dss business-app install-from-archive <filePath>",
1974
+ description: "Install or upgrade a Business App from a zip archive (admin only).",
1975
+ examples: ["dss business-app install-from-archive ./my-bapp.zip",],
1976
+ },
1977
+ },
1978
+ webapp: {
1979
+ list: {
1980
+ handler: (c, _a, f) => c.webapps.list(f["project-key"]),
1981
+ usage: "dss webapp list [--project-key KEY]",
1982
+ description: "List webapps in a project.",
1983
+ examples: ["dss webapp list",],
1984
+ },
1985
+ "get-settings": {
1986
+ handler: (c, a, f) => {
1987
+ requireArgs(a, 1, "dss webapp get-settings <webappId> [--project-key KEY]");
1988
+ return c.webapps.getSettings(a[0], f["project-key"]);
1989
+ },
1990
+ usage: "dss webapp get-settings <webappId> [--project-key KEY]",
1991
+ description: "Get a webapp's settings.",
1992
+ examples: ["dss webapp get-settings WEBAPP_ID",],
1993
+ },
1994
+ create: {
1995
+ handler: (c, _a, f) => {
1996
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (webapp definition).");
1997
+ return c.webapps.create(body, f["project-key"]);
1998
+ },
1999
+ usage: "dss webapp create (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
2000
+ description: "Create a webapp from a JSON definition.",
2001
+ examples: ["dss webapp create --data-file webapp.json",],
2002
+ },
2003
+ "update-settings": {
2004
+ handler: (c, a, f) => {
2005
+ requireArgs(a, 1, "dss webapp update-settings <webappId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]");
2006
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (webapp settings).");
2007
+ return c.webapps.updateSettings(a[0], body, f["project-key"]);
2008
+ },
2009
+ usage: "dss webapp update-settings <webappId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
2010
+ description: "Replace a webapp's settings.",
2011
+ examples: ["dss webapp update-settings WEBAPP_ID --data-file webapp.json",],
2012
+ },
2013
+ "stop-backend": {
2014
+ handler: async (c, a, f) => {
2015
+ requireArgs(a, 1, "dss webapp stop-backend <webappId> [--project-key KEY]");
2016
+ await c.webapps.stopBackend(a[0], f["project-key"]);
2017
+ return { stopped: true, };
2018
+ },
2019
+ usage: "dss webapp stop-backend <webappId> [--project-key KEY]",
2020
+ description: "Stop a webapp's backend.",
2021
+ examples: ["dss webapp stop-backend WEBAPP_ID",],
2022
+ },
2023
+ "restart-backend": {
2024
+ handler: async (c, a, f) => {
2025
+ requireArgs(a, 1, "dss webapp restart-backend <webappId> [--project-key KEY]");
2026
+ await c.webapps.startOrRestartBackend(a[0], f["project-key"]);
2027
+ return { restarted: true, };
2028
+ },
2029
+ usage: "dss webapp restart-backend <webappId> [--project-key KEY]",
2030
+ description: "Start or restart a webapp's backend.",
2031
+ examples: ["dss webapp restart-backend WEBAPP_ID",],
2032
+ },
2033
+ "backend-state": {
2034
+ handler: (c, a, f) => {
2035
+ requireArgs(a, 1, "dss webapp backend-state <webappId> [--project-key KEY]");
2036
+ return c.webapps.getBackendState(a[0], f["project-key"]);
2037
+ },
2038
+ usage: "dss webapp backend-state <webappId> [--project-key KEY]",
2039
+ description: "Get a webapp backend's runtime state.",
2040
+ examples: ["dss webapp backend-state WEBAPP_ID",],
2041
+ },
2042
+ },
2043
+ "api-service": {
2044
+ list: {
2045
+ handler: (c, _a, f) => c.apiServices.list(f["project-key"]),
2046
+ usage: "dss api-service list [--project-key KEY]",
2047
+ description: "List API services in a project.",
2048
+ examples: ["dss api-service list",],
2049
+ },
2050
+ create: {
2051
+ handler: (c, a, f) => {
2052
+ requireArgs(a, 1, "dss api-service create <serviceId> [--project-key KEY]");
2053
+ return c.apiServices.create(a[0], f["project-key"]);
2054
+ },
2055
+ usage: "dss api-service create <serviceId> [--project-key KEY]",
2056
+ description: "Create an empty API service.",
2057
+ examples: ["dss api-service create my-service",],
2058
+ },
2059
+ "get-settings": {
2060
+ handler: (c, a, f) => {
2061
+ requireArgs(a, 1, "dss api-service get-settings <serviceId> [--project-key KEY]");
2062
+ return c.apiServices.getSettings(a[0], f["project-key"]);
2063
+ },
2064
+ usage: "dss api-service get-settings <serviceId> [--project-key KEY]",
2065
+ description: "Get an API service's settings (endpoint definitions).",
2066
+ examples: ["dss api-service get-settings my-service",],
2067
+ },
2068
+ "save-settings": {
2069
+ handler: (c, a, f) => {
2070
+ requireArgs(a, 1, "dss api-service save-settings <serviceId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]");
2071
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (service settings).");
2072
+ return c.apiServices.saveSettings(a[0], body, f["project-key"]);
2073
+ },
2074
+ usage: "dss api-service save-settings <serviceId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
2075
+ description: "Save an API service's settings.",
2076
+ examples: ["dss api-service save-settings my-service --data-file service.json",],
2077
+ },
2078
+ "list-packages": {
2079
+ handler: (c, a, f) => {
2080
+ requireArgs(a, 1, "dss api-service list-packages <serviceId> [--project-key KEY]");
2081
+ return c.apiServices.listPackages(a[0], f["project-key"]);
2082
+ },
2083
+ usage: "dss api-service list-packages <serviceId> [--project-key KEY]",
2084
+ description: "List deployable packages of an API service.",
2085
+ examples: ["dss api-service list-packages my-service",],
2086
+ },
2087
+ "package-summary": {
2088
+ handler: (c, a, f) => {
2089
+ requireArgs(a, 2, "dss api-service package-summary <serviceId> <packageId> [--project-key KEY]");
2090
+ return c.apiServices.getPackageSummary(a[0], a[1], f["project-key"]);
2091
+ },
2092
+ usage: "dss api-service package-summary <serviceId> <packageId> [--project-key KEY]",
2093
+ description: "Get a package summary.",
2094
+ examples: ["dss api-service package-summary my-service v1",],
2095
+ },
2096
+ "create-package": {
2097
+ handler: (c, a, f) => {
2098
+ requireArgs(a, 2, "dss api-service create-package <serviceId> <packageId> [--project-key KEY]");
2099
+ return c.apiServices.createPackage(a[0], a[1], f["project-key"]);
2100
+ },
2101
+ usage: "dss api-service create-package <serviceId> <packageId> [--project-key KEY]",
2102
+ description: "Build a deployable package from the current service state.",
2103
+ examples: ["dss api-service create-package my-service v1",],
2104
+ },
2105
+ "delete-package": {
2106
+ handler: async (c, a, f) => {
2107
+ requireArgs(a, 2, "dss api-service delete-package <serviceId> <packageId> [--project-key KEY]");
2108
+ await c.apiServices.deletePackage(a[0], a[1], f["project-key"]);
2109
+ return { deleted: true, };
2110
+ },
2111
+ usage: "dss api-service delete-package <serviceId> <packageId> [--project-key KEY]",
2112
+ description: "Delete an API service package.",
2113
+ examples: ["dss api-service delete-package my-service v1",],
2114
+ },
2115
+ "download-package": {
2116
+ handler: async (c, a, f) => {
2117
+ requireArgs(a, 2, "dss api-service download-package <serviceId> <packageId> --output PATH [--project-key KEY]");
2118
+ const out = f["output"];
2119
+ if (!out)
2120
+ throw new UsageError("--output PATH is required.", "missing_required_flag");
2121
+ const res = await c.apiServices.downloadPackageArchive(a[0], a[1], f["project-key"]);
2122
+ const buf = Buffer.from(await res.arrayBuffer());
2123
+ writeFileSync(out, buf);
2124
+ return { path: out, bytes: buf.length, };
2125
+ },
2126
+ usage: "dss api-service download-package <serviceId> <packageId> --output PATH [--project-key KEY]",
2127
+ description: "Download an API service package archive to a local file.",
2128
+ examples: ["dss api-service download-package my-service v1 --output ./pkg.zip",],
2129
+ },
2130
+ "publish-package": {
2131
+ handler: (c, a, f) => {
2132
+ requireArgs(a, 2, "dss api-service publish-package <serviceId> <packageId> [--project-key KEY]");
2133
+ return c.apiServices.publishPackage(a[0], a[1], f["project-key"]);
2134
+ },
2135
+ usage: "dss api-service publish-package <serviceId> <packageId> [--project-key KEY]",
2136
+ description: "Publish a package to the API Deployer.",
2137
+ examples: ["dss api-service publish-package my-service v1",],
2138
+ },
2139
+ },
2140
+ "api-deployer": {
2141
+ "list-infras": {
2142
+ handler: (c) => c.apiDeployer.listInfras(),
2143
+ usage: "dss api-deployer list-infras",
2144
+ description: "List API Deployer infrastructures.",
2145
+ examples: ["dss api-deployer list-infras",],
2146
+ },
2147
+ "create-infra": {
2148
+ handler: (c, _a, f) => {
2149
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (infra settings).");
2150
+ return c.apiDeployer.createInfra(body);
2151
+ },
2152
+ usage: "dss api-deployer create-infra (--data JSON|--data-file PATH|--stdin)",
2153
+ description: "Create an API Deployer infrastructure.",
2154
+ examples: ["dss api-deployer create-infra --data-file infra.json",],
2155
+ },
2156
+ "get-infra": {
2157
+ handler: (c, a) => {
2158
+ requireArgs(a, 1, "dss api-deployer get-infra <infraId>");
2159
+ return c.apiDeployer.getInfra(a[0]);
2160
+ },
2161
+ usage: "dss api-deployer get-infra <infraId>",
2162
+ description: "Get an API Deployer infrastructure status.",
2163
+ examples: ["dss api-deployer get-infra prod-infra",],
2164
+ },
2165
+ "delete-infra": {
2166
+ handler: async (c, a) => {
2167
+ requireArgs(a, 1, "dss api-deployer delete-infra <infraId>");
2168
+ await c.apiDeployer.deleteInfra(a[0]);
2169
+ return { deleted: true, };
2170
+ },
2171
+ usage: "dss api-deployer delete-infra <infraId>",
2172
+ description: "Delete an API Deployer infrastructure.",
2173
+ examples: ["dss api-deployer delete-infra prod-infra",],
2174
+ },
2175
+ "list-stages": {
2176
+ handler: (c) => c.apiDeployer.listStages(),
2177
+ usage: "dss api-deployer list-stages",
2178
+ description: "List API Deployer lifecycle stages.",
2179
+ examples: ["dss api-deployer list-stages",],
2180
+ },
2181
+ "list-services": {
2182
+ handler: (c) => c.apiDeployer.listServices(),
2183
+ usage: "dss api-deployer list-services",
2184
+ description: "List published API Deployer services.",
2185
+ examples: ["dss api-deployer list-services",],
2186
+ },
2187
+ "create-service": {
2188
+ handler: (c, _a, f) => {
2189
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (service definition).");
2190
+ return c.apiDeployer.createService(body);
2191
+ },
2192
+ usage: "dss api-deployer create-service (--data JSON|--data-file PATH|--stdin)",
2193
+ description: "Create a published API Deployer service.",
2194
+ examples: ['dss api-deployer create-service --data \'{"id":"my-service"}\'',],
2195
+ },
2196
+ "get-service": {
2197
+ handler: (c, a) => {
2198
+ requireArgs(a, 1, "dss api-deployer get-service <serviceId>");
2199
+ return c.apiDeployer.getService(a[0]);
2200
+ },
2201
+ usage: "dss api-deployer get-service <serviceId>",
2202
+ description: "Get a published service's status (versions + deployments).",
2203
+ examples: ["dss api-deployer get-service my-service",],
2204
+ },
2205
+ "delete-service": {
2206
+ handler: async (c, a) => {
2207
+ requireArgs(a, 1, "dss api-deployer delete-service <serviceId>");
2208
+ await c.apiDeployer.deleteService(a[0]);
2209
+ return { deleted: true, };
2210
+ },
2211
+ usage: "dss api-deployer delete-service <serviceId>",
2212
+ description: "Delete a published API Deployer service.",
2213
+ examples: ["dss api-deployer delete-service my-service",],
2214
+ },
2215
+ "publish-version": {
2216
+ handler: async (c, a) => {
2217
+ requireArgs(a, 2, "dss api-deployer publish-version <serviceId> <archive.zip>");
2218
+ await c.apiDeployer.publishServiceVersion(a[0], a[1]);
2219
+ return { published: true, };
2220
+ },
2221
+ usage: "dss api-deployer publish-version <serviceId> <archive.zip>",
2222
+ description: "Publish (upload) a service version package to the API Deployer.",
2223
+ examples: ["dss api-deployer publish-version my-service ./pkg.zip",],
2224
+ },
2225
+ "delete-version": {
2226
+ handler: async (c, a) => {
2227
+ requireArgs(a, 2, "dss api-deployer delete-version <serviceId> <version>");
2228
+ await c.apiDeployer.deleteServiceVersion(a[0], a[1]);
2229
+ return { deleted: true, };
2230
+ },
2231
+ usage: "dss api-deployer delete-version <serviceId> <version>",
2232
+ description: "Delete a published service version.",
2233
+ examples: ["dss api-deployer delete-version my-service v1",],
2234
+ },
2235
+ "list-deployments": {
2236
+ handler: (c) => c.apiDeployer.listDeployments(),
2237
+ usage: "dss api-deployer list-deployments",
2238
+ description: "List API Deployer deployments.",
2239
+ examples: ["dss api-deployer list-deployments",],
2240
+ },
2241
+ "create-deployment": {
2242
+ handler: (c, _a, f) => {
2243
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (deployment settings).");
2244
+ return c.apiDeployer.createDeployment(body);
2245
+ },
2246
+ usage: "dss api-deployer create-deployment (--data JSON|--data-file PATH|--stdin)",
2247
+ description: "Create an API Deployer deployment (maps a service version to an infra).",
2248
+ examples: ["dss api-deployer create-deployment --data-file deployment.json",],
2249
+ },
2250
+ "get-deployment": {
2251
+ handler: (c, a) => {
2252
+ requireArgs(a, 1, "dss api-deployer get-deployment <deploymentId>");
2253
+ return c.apiDeployer.getDeployment(a[0]);
2254
+ },
2255
+ usage: "dss api-deployer get-deployment <deploymentId>",
2256
+ description: "Get an API Deployer deployment.",
2257
+ examples: ["dss api-deployer get-deployment my-deployment",],
2258
+ },
2259
+ "deployment-status": {
2260
+ handler: (c, a) => {
2261
+ requireArgs(a, 1, "dss api-deployer deployment-status <deploymentId>");
2262
+ return c.apiDeployer.getDeploymentStatus(a[0]);
2263
+ },
2264
+ usage: "dss api-deployer deployment-status <deploymentId>",
2265
+ description: "Get an API Deployer deployment's full health/status.",
2266
+ examples: ["dss api-deployer deployment-status my-deployment",],
2267
+ },
2268
+ "deployment-settings": {
2269
+ handler: (c, a) => {
2270
+ requireArgs(a, 1, "dss api-deployer deployment-settings <deploymentId>");
2271
+ return c.apiDeployer.getDeploymentSettings(a[0]);
2272
+ },
2273
+ usage: "dss api-deployer deployment-settings <deploymentId>",
2274
+ description: "Get an API Deployer deployment's settings.",
2275
+ examples: ["dss api-deployer deployment-settings my-deployment",],
2276
+ },
2277
+ "save-deployment-settings": {
2278
+ handler: async (c, a, f) => {
2279
+ requireArgs(a, 1, "dss api-deployer save-deployment-settings <deploymentId> (--data JSON|--data-file PATH|--stdin)");
2280
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (deployment settings).");
2281
+ await c.apiDeployer.saveDeploymentSettings(a[0], body);
2282
+ return { saved: true, };
2283
+ },
2284
+ usage: "dss api-deployer save-deployment-settings <deploymentId> (--data JSON|--data-file PATH|--stdin)",
2285
+ description: "Save an API Deployer deployment's settings.",
2286
+ examples: ["dss api-deployer save-deployment-settings my-deployment --data-file settings.json",],
2287
+ },
2288
+ deploy: {
2289
+ handler: (c, a) => {
2290
+ requireArgs(a, 1, "dss api-deployer deploy <deploymentId>");
2291
+ return c.apiDeployer.startDeploymentUpdate(a[0]);
2292
+ },
2293
+ usage: "dss api-deployer deploy <deploymentId>",
2294
+ description: "Apply a deployment's settings to its infrastructure (start update).",
2295
+ examples: ["dss api-deployer deploy my-deployment",],
2296
+ },
2297
+ "delete-deployment": {
2298
+ handler: async (c, a) => {
2299
+ requireArgs(a, 1, "dss api-deployer delete-deployment <deploymentId>");
2300
+ await c.apiDeployer.deleteDeployment(a[0]);
2301
+ return { deleted: true, };
2302
+ },
2303
+ usage: "dss api-deployer delete-deployment <deploymentId>",
2304
+ description: "Delete an API Deployer deployment.",
2305
+ examples: ["dss api-deployer delete-deployment my-deployment",],
2306
+ },
2307
+ },
2308
+ bundle: {
2309
+ "list-exported": {
2310
+ handler: (c, _a, f) => c.bundles.listExported(f["project-key"]),
2311
+ usage: "dss bundle list-exported [--project-key KEY]",
2312
+ description: "List bundles exported from a project on the Design node.",
2313
+ examples: ["dss bundle list-exported",],
2314
+ },
2315
+ export: {
2316
+ handler: async (c, a, f) => {
2317
+ requireArgs(a, 1, "dss bundle export <bundleId> [--project-key KEY]");
2318
+ await c.bundles.exportBundle(a[0], f["project-key"]);
2319
+ return { exported: a[0], };
2320
+ },
2321
+ usage: "dss bundle export <bundleId> [--project-key KEY]",
2322
+ description: "Create (or overwrite) an exported Design-node bundle.",
2323
+ examples: ["dss bundle export v1",],
2324
+ },
2325
+ "delete-exported": {
2326
+ handler: async (c, a, f) => {
2327
+ requireArgs(a, 1, "dss bundle delete-exported <bundleId> [--project-key KEY]");
2328
+ await c.bundles.deleteExported(a[0], f["project-key"]);
2329
+ return { deleted: true, };
2330
+ },
2331
+ usage: "dss bundle delete-exported <bundleId> [--project-key KEY]",
2332
+ description: "Delete an exported Design-node bundle.",
2333
+ examples: ["dss bundle delete-exported v1",],
2334
+ },
2335
+ "download-exported": {
2336
+ handler: async (c, a, f) => {
2337
+ requireArgs(a, 1, "dss bundle download-exported <bundleId> --output PATH [--project-key KEY]");
2338
+ const out = f["output"];
2339
+ if (!out)
2340
+ throw new UsageError("--output PATH is required.", "missing_required_flag");
2341
+ const res = await c.bundles.downloadExportedArchive(a[0], f["project-key"]);
2342
+ const buf = Buffer.from(await res.arrayBuffer());
2343
+ writeFileSync(out, buf);
2344
+ return { path: out, bytes: buf.length, };
2345
+ },
2346
+ usage: "dss bundle download-exported <bundleId> --output PATH [--project-key KEY]",
2347
+ description: "Download an exported Design-node bundle archive to a local file.",
2348
+ examples: ["dss bundle download-exported v1 --output ./bundle.zip",],
2349
+ },
2350
+ publish: {
2351
+ handler: (c, a, f) => {
2352
+ requireArgs(a, 1, "dss bundle publish <bundleId> [--project-key KEY]");
2353
+ return c.bundles.publish(a[0], f["project-key"]);
2354
+ },
2355
+ usage: "dss bundle publish <bundleId> [--project-key KEY]",
2356
+ description: "Publish a Design-node bundle to the Project Deployer.",
2357
+ examples: ["dss bundle publish v1",],
2358
+ },
2359
+ "list-imported": {
2360
+ handler: (c, _a, f) => c.bundles.listImported(f["project-key"]),
2361
+ usage: "dss bundle list-imported [--project-key KEY]",
2362
+ description: "List bundles imported into a project on the Automation node.",
2363
+ examples: ["dss bundle list-imported",],
2364
+ },
2365
+ "import-from-archive": {
2366
+ handler: (c, a, f) => {
2367
+ requireArgs(a, 1, "dss bundle import-from-archive <serverArchivePath> [--project-key KEY]");
2368
+ return c.bundles.importFromArchive(a[0], f["project-key"]);
2369
+ },
2370
+ usage: "dss bundle import-from-archive <serverArchivePath> [--project-key KEY]",
2371
+ description: "Import a server-side bundle archive into an Automation-node project.",
2372
+ examples: ["dss bundle import-from-archive /data/bundles/v1.zip",],
2373
+ },
2374
+ "import-from-stream": {
2375
+ handler: async (c, a, f) => {
2376
+ requireArgs(a, 1, "dss bundle import-from-stream <filePath> [--project-key KEY]");
2377
+ await c.bundles.importFromStream(a[0], f["project-key"]);
2378
+ return { imported: true, };
2379
+ },
2380
+ usage: "dss bundle import-from-stream <filePath> [--project-key KEY]",
2381
+ description: "Upload and import a local bundle archive into an Automation-node project.",
2382
+ examples: ["dss bundle import-from-stream ./v1.zip",],
2383
+ },
2384
+ activate: {
2385
+ handler: (c, a, f) => {
2386
+ requireArgs(a, 1, "dss bundle activate <bundleId> [--project-key KEY]");
2387
+ return c.bundles.activate(a[0], f["project-key"]);
2388
+ },
2389
+ usage: "dss bundle activate <bundleId> [--project-key KEY]",
2390
+ description: "Activate an imported Automation-node bundle.",
2391
+ examples: ["dss bundle activate v1",],
2392
+ },
2393
+ preload: {
2394
+ handler: (c, a, f) => {
2395
+ requireArgs(a, 1, "dss bundle preload <bundleId> [--project-key KEY]");
2396
+ return c.bundles.preload(a[0], f["project-key"]);
2397
+ },
2398
+ usage: "dss bundle preload <bundleId> [--project-key KEY]",
2399
+ description: "Preload an imported Automation-node bundle (stage data/models).",
2400
+ examples: ["dss bundle preload v1",],
2401
+ },
2402
+ "delete-imported": {
2403
+ handler: async (c, a, f) => {
2404
+ requireArgs(a, 1, "dss bundle delete-imported <bundleId> [--project-key KEY]");
2405
+ await c.bundles.deleteImported(a[0], f["project-key"]);
2406
+ return { deleted: true, };
2407
+ },
2408
+ usage: "dss bundle delete-imported <bundleId> [--project-key KEY]",
2409
+ description: "Delete an imported Automation-node bundle.",
2410
+ examples: ["dss bundle delete-imported v1",],
2411
+ },
2412
+ },
2413
+ "project-deployer": {
2414
+ "list-projects": {
2415
+ handler: (c) => c.projectDeployer.listProjects(),
2416
+ usage: "dss project-deployer list-projects",
2417
+ description: "List published projects on the Project Deployer.",
2418
+ examples: ["dss project-deployer list-projects",],
2419
+ },
2420
+ "create-project": {
2421
+ handler: (c, _a, f) => {
2422
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (published project settings).");
2423
+ return c.projectDeployer.createProject(body);
2424
+ },
2425
+ usage: "dss project-deployer create-project (--data JSON|--data-file PATH|--stdin)",
2426
+ description: "Create a published project on the Project Deployer.",
2427
+ examples: ["dss project-deployer create-project --data-file project.json",],
2428
+ },
2429
+ "upload-bundle": {
2430
+ handler: async (c, a) => {
2431
+ requireArgs(a, 1, "dss project-deployer upload-bundle <filePath>");
2432
+ await c.projectDeployer.uploadBundle(a[0]);
2433
+ return { uploaded: true, };
2434
+ },
2435
+ usage: "dss project-deployer upload-bundle <filePath>",
2436
+ description: "Upload a project bundle archive to the Project Deployer.",
2437
+ examples: ["dss project-deployer upload-bundle ./v1.zip",],
2438
+ },
2439
+ "project-status": {
2440
+ handler: (c, a) => {
2441
+ requireArgs(a, 1, "dss project-deployer project-status <publishedProjectKey>");
2442
+ return c.projectDeployer.getProjectStatus(a[0]);
2443
+ },
2444
+ usage: "dss project-deployer project-status <publishedProjectKey>",
2445
+ description: "Get a published project's status and available bundles.",
2446
+ examples: ["dss project-deployer project-status MYPROJ",],
2447
+ },
2448
+ "list-deployments": {
2449
+ handler: (c) => c.projectDeployer.listDeployments(),
2450
+ usage: "dss project-deployer list-deployments",
2451
+ description: "List Project Deployer deployments.",
2452
+ examples: ["dss project-deployer list-deployments",],
2453
+ },
2454
+ "create-deployment": {
2455
+ handler: (c, _a, f) => {
2456
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (deployment settings).");
2457
+ return c.projectDeployer.createDeployment(body);
2458
+ },
2459
+ usage: "dss project-deployer create-deployment (--data JSON|--data-file PATH|--stdin)",
2460
+ description: "Create a Project Deployer deployment (bundle to infra mapping).",
2461
+ examples: ["dss project-deployer create-deployment --data-file deployment.json",],
2462
+ },
2463
+ "get-deployment": {
2464
+ handler: (c, a) => {
2465
+ requireArgs(a, 1, "dss project-deployer get-deployment <deploymentId>");
2466
+ return c.projectDeployer.getDeployment(a[0]);
2467
+ },
2468
+ usage: "dss project-deployer get-deployment <deploymentId>",
2469
+ description: "Get a Project Deployer deployment.",
2470
+ examples: ["dss project-deployer get-deployment my-deployment",],
2471
+ },
2472
+ "deployment-status": {
2473
+ handler: (c, a) => {
2474
+ requireArgs(a, 1, "dss project-deployer deployment-status <deploymentId>");
2475
+ return c.projectDeployer.getDeploymentStatus(a[0]);
2476
+ },
2477
+ usage: "dss project-deployer deployment-status <deploymentId>",
2478
+ description: "Get a Project Deployer deployment's full health/status.",
2479
+ examples: ["dss project-deployer deployment-status my-deployment",],
2480
+ },
2481
+ "save-deployment-settings": {
2482
+ handler: async (c, a, f) => {
2483
+ requireArgs(a, 1, "dss project-deployer save-deployment-settings <deploymentId> (--data JSON|--data-file PATH|--stdin)");
2484
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (deployment settings).");
2485
+ await c.projectDeployer.saveDeploymentSettings(a[0], body);
2486
+ return { saved: true, };
2487
+ },
2488
+ usage: "dss project-deployer save-deployment-settings <deploymentId> (--data JSON|--data-file PATH|--stdin)",
2489
+ description: "Save a Project Deployer deployment's settings (e.g. bundleId).",
2490
+ examples: [
2491
+ "dss project-deployer save-deployment-settings my-deployment --data-file settings.json",
2492
+ ],
2493
+ },
2494
+ deploy: {
2495
+ handler: (c, a) => {
2496
+ requireArgs(a, 1, "dss project-deployer deploy <deploymentId>");
2497
+ return c.projectDeployer.startUpdate(a[0]);
2498
+ },
2499
+ usage: "dss project-deployer deploy <deploymentId>",
2500
+ description: "Apply a deployment to the Automation node (start update).",
2501
+ examples: ["dss project-deployer deploy my-deployment",],
2502
+ },
2503
+ "delete-deployment": {
2504
+ handler: async (c, a) => {
2505
+ requireArgs(a, 1, "dss project-deployer delete-deployment <deploymentId>");
2506
+ await c.projectDeployer.deleteDeployment(a[0]);
2507
+ return { deleted: true, };
2508
+ },
2509
+ usage: "dss project-deployer delete-deployment <deploymentId>",
2510
+ description: "Delete a Project Deployer deployment.",
2511
+ examples: ["dss project-deployer delete-deployment my-deployment",],
2512
+ },
2513
+ "list-infras": {
2514
+ handler: (c) => c.projectDeployer.listInfras(),
2515
+ usage: "dss project-deployer list-infras",
2516
+ description: "List Project Deployer infrastructures.",
2517
+ examples: ["dss project-deployer list-infras",],
2518
+ },
2519
+ "create-infra": {
2520
+ handler: (c, _a, f) => {
2521
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (infra settings).");
2522
+ return c.projectDeployer.createInfra(body);
2523
+ },
2524
+ usage: "dss project-deployer create-infra (--data JSON|--data-file PATH|--stdin)",
2525
+ description: "Create a Project Deployer infrastructure.",
2526
+ examples: ["dss project-deployer create-infra --data-file infra.json",],
2527
+ },
2528
+ },
2529
+ "project-library": {
2530
+ list: {
2531
+ handler: (c, _a, f) => c.projectLibrary.listContents(f["project-key"]),
2532
+ usage: "dss project-library list [--project-key KEY]",
2533
+ description: "List the project code library (lib/) contents.",
2534
+ examples: ["dss project-library list",],
2535
+ },
2536
+ get: {
2537
+ handler: (c, a, f) => {
2538
+ requireArgs(a, 1, "dss project-library get <path> [--project-key KEY]");
2539
+ return c.projectLibrary.getFile(a[0], f["project-key"]);
2540
+ },
2541
+ usage: "dss project-library get <path> [--project-key KEY]",
2542
+ description: "Print the text content of a project library file.",
2543
+ examples: ["dss project-library get python/mylib/utils.py",],
2544
+ },
2545
+ "get-bytes": {
2546
+ handler: async (c, a, f) => {
2547
+ requireArgs(a, 1, "dss project-library get-bytes <path> --output PATH [--project-key KEY]");
2548
+ const out = f["output"];
2549
+ if (!out)
2550
+ throw new UsageError("--output PATH is required.", "missing_required_flag");
2551
+ const bytes = await c.projectLibrary.getFileBytes(a[0], f["project-key"]);
2552
+ writeFileSync(out, bytes);
2553
+ return { path: out, bytes: bytes.length, };
2554
+ },
2555
+ usage: "dss project-library get-bytes <path> --output PATH [--project-key KEY]",
2556
+ description: "Download a project library file's raw bytes to a local file.",
2557
+ examples: ["dss project-library get-bytes static/logo.png --output ./logo.png",],
2558
+ },
2559
+ "create-file": {
2560
+ handler: async (c, a, f) => {
2561
+ requireArgs(a, 1, "dss project-library create-file <path> [--project-key KEY]");
2562
+ await c.projectLibrary.addFile(a[0], f["project-key"]);
2563
+ return { created: a[0], };
2564
+ },
2565
+ usage: "dss project-library create-file <path> [--project-key KEY]",
2566
+ description: "Create an empty file in the project library.",
2567
+ examples: ["dss project-library create-file python/mylib/new.py",],
2568
+ },
2569
+ "create-folder": {
2570
+ handler: async (c, a, f) => {
2571
+ requireArgs(a, 1, "dss project-library create-folder <path> [--project-key KEY]");
2572
+ await c.projectLibrary.addFolder(a[0], f["project-key"]);
2573
+ return { created: a[0], };
2574
+ },
2575
+ usage: "dss project-library create-folder <path> [--project-key KEY]",
2576
+ description: "Create a folder in the project library.",
2577
+ examples: ["dss project-library create-folder python/mylib",],
2578
+ },
2579
+ put: {
2580
+ handler: async (c, a, f) => {
2581
+ requireArgs(a, 1, "dss project-library put <path> (--content TEXT|--file PATH|--stdin) [--project-key KEY]");
2582
+ const content = typeof f["content"] === "string"
2583
+ ? f["content"]
2584
+ : typeof f["file"] === "string"
2585
+ ? readFileSync(f["file"], "utf-8")
2586
+ : await readStdinText();
2587
+ await c.projectLibrary.addOrUpdateFile(a[0], content, f["project-key"]);
2588
+ return { updated: a[0], };
2589
+ },
2590
+ usage: "dss project-library put <path> (--content TEXT|--file PATH|--stdin) [--project-key KEY]",
2591
+ description: "Create or overwrite a project library file with raw text content.",
2592
+ examples: ["dss project-library put python/mylib/utils.py --file ./utils.py",],
2593
+ },
2594
+ delete: {
2595
+ handler: async (c, a, f) => {
2596
+ requireArgs(a, 1, "dss project-library delete <path> [--project-key KEY]");
2597
+ await c.projectLibrary.deleteFile(a[0], f["project-key"]);
2598
+ return { deleted: a[0], };
2599
+ },
2600
+ usage: "dss project-library delete <path> [--project-key KEY]",
2601
+ description: "Delete a project library file or folder.",
2602
+ examples: ["dss project-library delete python/mylib/old.py",],
2603
+ },
2604
+ rename: {
2605
+ handler: async (c, a, f) => {
2606
+ requireArgs(a, 2, "dss project-library rename <path> <new-name> [--project-key KEY]");
2607
+ await c.projectLibrary.rename(a[0], a[1], f["project-key"]);
2608
+ return { renamed: a[0], to: a[1], };
2609
+ },
2610
+ usage: "dss project-library rename <path> <new-name> [--project-key KEY]",
2611
+ description: "Rename a project library file or folder within its parent.",
2612
+ examples: ["dss project-library rename python/mylib/old.py new.py",],
2613
+ },
2614
+ move: {
2615
+ handler: async (c, a, f) => {
2616
+ requireArgs(a, 2, "dss project-library move <path> <destination-folder> [--project-key KEY]");
2617
+ await c.projectLibrary.move(a[0], a[1], f["project-key"]);
2618
+ return { moved: a[0], to: a[1], };
2619
+ },
2620
+ usage: "dss project-library move <path> <destination-folder> [--project-key KEY]",
2621
+ description: "Move a project library file or folder into another folder.",
2622
+ examples: ["dss project-library move python/old.py python/mylib",],
2623
+ },
2624
+ },
2625
+ "streaming-endpoint": {
2626
+ list: {
2627
+ handler: (c, _a, f) => c.streamingEndpoints.list(f["project-key"]),
2628
+ usage: "dss streaming-endpoint list [--project-key KEY]",
2629
+ description: "List streaming endpoints in a project.",
2630
+ examples: ["dss streaming-endpoint list",],
2631
+ },
2632
+ get: {
2633
+ handler: (c, a, f) => {
2634
+ requireArgs(a, 1, "dss streaming-endpoint get <id> [--project-key KEY]");
2635
+ return c.streamingEndpoints.getSettings(a[0], f["project-key"]);
2636
+ },
2637
+ usage: "dss streaming-endpoint get <id> [--project-key KEY]",
2638
+ description: "Get a streaming endpoint's settings.",
2639
+ examples: ["dss streaming-endpoint get my-stream",],
2640
+ },
2641
+ create: {
2642
+ handler: (c, a, f) => {
2643
+ requireArgs(a, 2, "dss streaming-endpoint create <id> <type> [--data JSON|--data-file PATH|--stdin] [--project-key KEY]");
2644
+ const body = jsonInput(f) ?? {};
2645
+ return c.streamingEndpoints.create(a[0], a[1], body, f["project-key"]);
2646
+ },
2647
+ usage: "dss streaming-endpoint create <id> <type> [--data JSON|--data-file PATH|--stdin] [--project-key KEY]",
2648
+ description: "Create a streaming endpoint of the given type.",
2649
+ examples: ["dss streaming-endpoint create my-stream kafka",],
2650
+ },
2651
+ "update-settings": {
2652
+ handler: async (c, a, f) => {
2653
+ requireArgs(a, 1, "dss streaming-endpoint update-settings <id> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]");
2654
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (endpoint settings).");
2655
+ await c.streamingEndpoints.updateSettings(a[0], body, f["project-key"]);
2656
+ return { updated: a[0], };
2657
+ },
2658
+ usage: "dss streaming-endpoint update-settings <id> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
2659
+ description: "Replace a streaming endpoint's settings.",
2660
+ examples: ["dss streaming-endpoint update-settings my-stream --data-file settings.json",],
2661
+ },
2662
+ delete: {
2663
+ handler: async (c, a, f) => {
2664
+ requireArgs(a, 1, "dss streaming-endpoint delete <id> [--project-key KEY]");
2665
+ await c.streamingEndpoints.delete(a[0], f["project-key"]);
2666
+ return { deleted: a[0], };
2667
+ },
2668
+ usage: "dss streaming-endpoint delete <id> [--project-key KEY]",
2669
+ description: "Delete a streaming endpoint.",
2670
+ examples: ["dss streaming-endpoint delete my-stream",],
2671
+ },
2672
+ },
2673
+ "continuous-activity": {
2674
+ list: {
2675
+ handler: (c, _a, f) => c.continuousActivities.list(f["project-key"]),
2676
+ usage: "dss continuous-activity list [--project-key KEY]",
2677
+ description: "List continuous activities in a project.",
2678
+ examples: ["dss continuous-activity list",],
2679
+ },
2680
+ status: {
2681
+ handler: (c, a, f) => {
2682
+ requireArgs(a, 1, "dss continuous-activity status <recipeId> [--project-key KEY]");
2683
+ return c.continuousActivities.getStatus(a[0], f["project-key"]);
2684
+ },
2685
+ usage: "dss continuous-activity status <recipeId> [--project-key KEY]",
2686
+ description: "Get a continuous recipe's desired and effective state.",
2687
+ examples: ["dss continuous-activity status compute_stream",],
2688
+ },
2689
+ start: {
2690
+ handler: (c, a, f) => {
2691
+ requireArgs(a, 1, "dss continuous-activity start <recipeId> [--data JSON|--data-file PATH|--stdin] [--project-key KEY]");
2692
+ return c.continuousActivities.start(a[0], jsonInput(f), f["project-key"]);
2693
+ },
2694
+ usage: "dss continuous-activity start <recipeId> [--data JSON|--data-file PATH|--stdin] [--project-key KEY]",
2695
+ description: "Start a continuous recipe (optional loop restart params via JSON).",
2696
+ examples: ["dss continuous-activity start compute_stream",],
2697
+ },
2698
+ stop: {
2699
+ handler: async (c, a, f) => {
2700
+ requireArgs(a, 1, "dss continuous-activity stop <recipeId> [--project-key KEY]");
2701
+ await c.continuousActivities.stop(a[0], f["project-key"]);
2702
+ return { stopped: a[0], };
2703
+ },
2704
+ usage: "dss continuous-activity stop <recipeId> [--project-key KEY]",
2705
+ description: "Stop a continuous recipe.",
2706
+ examples: ["dss continuous-activity stop compute_stream",],
2707
+ },
2708
+ },
2709
+ statistics: {
2710
+ "list-worksheets": {
2711
+ handler: (c, a, f) => {
2712
+ requireArgs(a, 1, "dss statistics list-worksheets <dataset> [--project-key KEY]");
2713
+ return c.statistics.listWorksheets(a[0], f["project-key"]);
2714
+ },
2715
+ usage: "dss statistics list-worksheets <dataset> [--project-key KEY]",
2716
+ description: "List EDA statistics worksheets for a dataset.",
2717
+ examples: ["dss statistics list-worksheets customers",],
2718
+ },
2719
+ "get-worksheet": {
2720
+ handler: (c, a, f) => {
2721
+ requireArgs(a, 2, "dss statistics get-worksheet <dataset> <worksheetId> [--project-key KEY]");
2722
+ return c.statistics.getWorksheet(a[0], a[1], f["project-key"]);
2723
+ },
2724
+ usage: "dss statistics get-worksheet <dataset> <worksheetId> [--project-key KEY]",
2725
+ description: "Get one statistics worksheet definition.",
2726
+ examples: ["dss statistics get-worksheet customers ws_1",],
2727
+ },
2728
+ "create-worksheet": {
2729
+ handler: (c, a, f) => {
2730
+ requireArgs(a, 1, "dss statistics create-worksheet <dataset> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]");
2731
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (worksheet definition).");
2732
+ return c.statistics.createWorksheet(a[0], body, f["project-key"]);
2733
+ },
2734
+ usage: "dss statistics create-worksheet <dataset> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
2735
+ description: "Create a statistics worksheet from a JSON definition.",
2736
+ examples: ["dss statistics create-worksheet customers --data-file ws.json",],
2737
+ },
2738
+ "update-worksheet": {
2739
+ handler: (c, a, f) => {
2740
+ requireArgs(a, 2, "dss statistics update-worksheet <dataset> <worksheetId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]");
2741
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (worksheet definition).");
2742
+ return c.statistics.updateWorksheet(a[0], a[1], body, f["project-key"]);
2743
+ },
2744
+ usage: "dss statistics update-worksheet <dataset> <worksheetId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
2745
+ description: "Replace a statistics worksheet definition.",
2746
+ examples: ["dss statistics update-worksheet customers ws_1 --data-file ws.json",],
2747
+ },
2748
+ "delete-worksheet": {
2749
+ handler: async (c, a, f) => {
2750
+ requireArgs(a, 2, "dss statistics delete-worksheet <dataset> <worksheetId> [--project-key KEY]");
2751
+ await c.statistics.deleteWorksheet(a[0], a[1], f["project-key"]);
2752
+ return { deleted: a[1], };
2753
+ },
2754
+ usage: "dss statistics delete-worksheet <dataset> <worksheetId> [--project-key KEY]",
2755
+ description: "Delete a statistics worksheet.",
2756
+ examples: ["dss statistics delete-worksheet customers ws_1",],
2757
+ },
2758
+ "run-worksheet": {
2759
+ handler: (c, a, f) => {
2760
+ requireArgs(a, 2, "dss statistics run-worksheet <dataset> <worksheetId> [--project-key KEY]");
2761
+ return c.statistics.runWorksheet(a[0], a[1], f["project-key"]);
2762
+ },
2763
+ usage: "dss statistics run-worksheet <dataset> <worksheetId> [--project-key KEY]",
2764
+ description: "Run a statistics worksheet and return the DSS future response.",
2765
+ examples: ["dss statistics run-worksheet customers ws_1",],
2766
+ },
2767
+ "run-card": {
2768
+ handler: (c, a, f) => {
2769
+ requireArgs(a, 2, "dss statistics run-card <dataset> <worksheetId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]");
2770
+ const card = requiredJsonInput(f, "--data, --data-file, or --stdin is required (card settings).");
2771
+ return c.statistics.runCard(a[0], a[1], card, f["project-key"]);
2772
+ },
2773
+ usage: "dss statistics run-card <dataset> <worksheetId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
2774
+ description: "Run a single card in a worksheet context.",
2775
+ examples: ["dss statistics run-card customers ws_1 --data-file card.json",],
2776
+ },
2777
+ "run-computation": {
2778
+ handler: (c, a, f) => {
2779
+ requireArgs(a, 2, "dss statistics run-computation <dataset> <worksheetId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]");
2780
+ const computation = requiredJsonInput(f, "--data, --data-file, or --stdin is required (computation settings).");
2781
+ return c.statistics.runComputation(a[0], a[1], computation, f["project-key"]);
2782
+ },
2783
+ usage: "dss statistics run-computation <dataset> <worksheetId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
2784
+ description: "Run a single computation in a worksheet context.",
2785
+ examples: ["dss statistics run-computation customers ws_1 --data-file comp.json",],
2786
+ },
2787
+ },
2788
+ discussion: {
2789
+ list: {
2790
+ handler: (c, a, f) => {
2791
+ requireArgs(a, 2, "dss discussion list <objectType> <objectId> [--project-key KEY]");
2792
+ return c.discussions.list(a[0], a[1], f["project-key"]);
2793
+ },
2794
+ usage: "dss discussion list <objectType> <objectId> [--project-key KEY]",
2795
+ description: "List discussions attached to a project object.",
2796
+ examples: ["dss discussion list DATASET customers",],
2797
+ },
2798
+ get: {
2799
+ handler: (c, a, f) => {
2800
+ requireArgs(a, 3, "dss discussion get <objectType> <objectId> <discussionId> [--project-key KEY]");
2801
+ return c.discussions.get(a[0], a[1], a[2], f["project-key"]);
2802
+ },
2803
+ usage: "dss discussion get <objectType> <objectId> <discussionId> [--project-key KEY]",
2804
+ description: "Get one discussion with its replies.",
2805
+ examples: ["dss discussion get DATASET customers d123",],
2806
+ },
2807
+ create: {
2808
+ handler: (c, a, f) => {
2809
+ requireArgs(a, 2, "dss discussion create <objectType> <objectId> --topic TEXT --reply TEXT [--project-key KEY]");
2810
+ const topic = f["topic"];
2811
+ const reply = f["reply"];
2812
+ if (!topic || !reply) {
2813
+ throw new UsageError("--topic and --reply are required.", "missing_required_flag");
2814
+ }
2815
+ return c.discussions.create(a[0], a[1], topic, reply, f["project-key"]);
2816
+ },
2817
+ usage: "dss discussion create <objectType> <objectId> --topic TEXT --reply TEXT [--project-key KEY]",
2818
+ description: "Create a discussion with its first reply.",
2819
+ examples: ["dss discussion create DATASET customers --topic Schema --reply Please-review",],
2820
+ },
2821
+ reply: {
2822
+ handler: (c, a, f) => {
2823
+ requireArgs(a, 3, "dss discussion reply <objectType> <objectId> <discussionId> --text TEXT [--project-key KEY]");
2824
+ const text = f["text"];
2825
+ if (!text)
2826
+ throw new UsageError("--text is required.", "missing_required_flag");
2827
+ return c.discussions.reply(a[0], a[1], a[2], text, f["project-key"]);
2828
+ },
2829
+ usage: "dss discussion reply <objectType> <objectId> <discussionId> --text TEXT [--project-key KEY]",
2830
+ description: "Add a reply to an existing discussion.",
2831
+ examples: ["dss discussion reply DATASET customers d123 --text Done",],
2832
+ },
2833
+ },
2834
+ meaning: {
2835
+ list: {
2836
+ handler: (c) => c.meanings.list(),
2837
+ usage: "dss meaning list",
2838
+ description: "List user-defined meanings (column semantic types) on the instance.",
2839
+ examples: ["dss meaning list",],
2840
+ },
2841
+ get: {
2842
+ handler: (c, a) => {
2843
+ requireArgs(a, 1, "dss meaning get <meaningId>");
2844
+ return c.meanings.get(a[0]);
2845
+ },
2846
+ usage: "dss meaning get <meaningId>",
2847
+ description: "Get a user-defined meaning definition.",
2848
+ examples: ["dss meaning get customer_type",],
2849
+ },
2850
+ create: {
2851
+ handler: (c, a, f) => {
2852
+ requireArgs(a, 3, "dss meaning create <id> <label> <type> [--data JSON|--data-file PATH|--stdin]");
2853
+ return c.meanings.create(a[0], a[1], a[2], jsonInput(f) ?? {});
2854
+ },
2855
+ usage: "dss meaning create <id> <label> <type> [--data JSON|--data-file PATH|--stdin]",
2856
+ description: "Create a user-defined meaning (type e.g. VALUES_LIST, VALUES_MAPPING, PATTERN).",
2857
+ examples: ["dss meaning create vip VIP VALUES_LIST",],
2858
+ },
2859
+ update: {
2860
+ handler: (c, a, f) => {
2861
+ requireArgs(a, 1, "dss meaning update <meaningId> (--data JSON|--data-file PATH|--stdin)");
2862
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (meaning definition).");
2863
+ return c.meanings.update(a[0], body);
2864
+ },
2865
+ usage: "dss meaning update <meaningId> (--data JSON|--data-file PATH|--stdin)",
2866
+ description: "Replace a user-defined meaning definition.",
2867
+ examples: ["dss meaning update vip --data-file meaning.json",],
2868
+ },
2869
+ },
2870
+ workspace: {
2871
+ list: {
2872
+ handler: (c) => c.workspaces.list(),
2873
+ usage: "dss workspace list",
2874
+ description: "List collaboration workspaces on the instance.",
2875
+ examples: ["dss workspace list",],
2876
+ },
2877
+ get: {
2878
+ handler: (c, a) => {
2879
+ requireArgs(a, 1, "dss workspace get <workspaceKey>");
2880
+ return c.workspaces.get(a[0]);
2881
+ },
2882
+ usage: "dss workspace get <workspaceKey>",
2883
+ description: "Get a workspace's settings.",
2884
+ examples: ["dss workspace get MY_WS",],
2885
+ },
2886
+ create: {
2887
+ handler: (c, _a, f) => {
2888
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (workspace definition).");
2889
+ return c.workspaces.create(body);
2890
+ },
2891
+ usage: "dss workspace create (--data JSON|--data-file PATH|--stdin)",
2892
+ description: "Create a collaboration workspace.",
2893
+ examples: ["dss workspace create --data-file ws.json",],
2894
+ },
2895
+ "update-settings": {
2896
+ handler: async (c, a, f) => {
2897
+ requireArgs(a, 1, "dss workspace update-settings <workspaceKey> (--data JSON|--data-file PATH|--stdin)");
2898
+ const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (workspace settings).");
2899
+ await c.workspaces.updateSettings(a[0], body);
2900
+ return { updated: a[0], };
2901
+ },
2902
+ usage: "dss workspace update-settings <workspaceKey> (--data JSON|--data-file PATH|--stdin)",
2903
+ description: "Replace a workspace's settings (admin).",
2904
+ examples: ["dss workspace update-settings MY_WS --data-file ws.json",],
2905
+ },
2906
+ delete: {
2907
+ handler: async (c, a) => {
2908
+ requireArgs(a, 1, "dss workspace delete <workspaceKey>");
2909
+ await c.workspaces.delete(a[0]);
2910
+ return { deleted: a[0], };
2911
+ },
2912
+ usage: "dss workspace delete <workspaceKey>",
2913
+ description: "Delete a workspace (admin).",
2914
+ examples: ["dss workspace delete MY_WS",],
2915
+ },
2916
+ "list-objects": {
2917
+ handler: (c, a) => {
2918
+ requireArgs(a, 1, "dss workspace list-objects <workspaceKey>");
2919
+ return c.workspaces.listObjects(a[0]);
2920
+ },
2921
+ usage: "dss workspace list-objects <workspaceKey>",
2922
+ description: "List objects shared in a workspace.",
2923
+ examples: ["dss workspace list-objects MY_WS",],
2924
+ },
2925
+ "add-object": {
2926
+ handler: (c, a, f) => {
2927
+ requireArgs(a, 1, "dss workspace add-object <workspaceKey> (--data JSON|--data-file PATH|--stdin)");
2928
+ const object = requiredJsonInput(f, "--data, --data-file, or --stdin is required (object definition).");
2929
+ return c.workspaces.addObject(a[0], object);
2930
+ },
2931
+ usage: "dss workspace add-object <workspaceKey> (--data JSON|--data-file PATH|--stdin)",
2932
+ description: "Add an object (link or DSS object) to a workspace.",
2933
+ examples: ["dss workspace add-object MY_WS --data-file object.json",],
2934
+ },
2935
+ },
2936
+ metrics: {
2937
+ "dataset-get": {
2938
+ handler: (c, a, f) => {
2939
+ requireArgs(a, 1, "dss metrics dataset-get <dataset> [--project-key KEY]");
2940
+ return c.metrics.getDatasetMetrics(a[0], f["project-key"]);
2941
+ },
2942
+ usage: "dss metrics dataset-get <dataset> [--project-key KEY]",
2943
+ description: "Get the last computed metric values for a dataset.",
2944
+ examples: ["dss metrics dataset-get customers",],
2945
+ },
2946
+ "dataset-compute": {
2947
+ handler: (c, a, f) => {
2948
+ requireArgs(a, 1, "dss metrics dataset-compute <dataset> [--project-key KEY]");
2949
+ return c.metrics.computeDatasetMetrics(a[0], f["project-key"]);
2950
+ },
2951
+ usage: "dss metrics dataset-compute <dataset> [--project-key KEY]",
2952
+ description: "Compute the DSS-configured metrics for a dataset.",
2953
+ examples: ["dss metrics dataset-compute customers",],
2954
+ },
2955
+ "dataset-history": {
2956
+ handler: (c, a, f) => {
2957
+ requireArgs(a, 2, "dss metrics dataset-history <dataset> <metricId> [--project-key KEY]");
2958
+ return c.metrics.getDatasetMetricHistory(a[0], a[1], f["project-key"]);
2959
+ },
2960
+ usage: "dss metrics dataset-history <dataset> <metricId> [--project-key KEY]",
2961
+ description: "Get the history of one dataset metric.",
2962
+ examples: ["dss metrics dataset-history customers records:COUNT_RECORDS",],
2963
+ },
2964
+ "folder-get": {
2965
+ handler: (c, a, f) => {
2966
+ requireArgs(a, 1, "dss metrics folder-get <folderId> [--project-key KEY]");
2967
+ return c.metrics.getFolderMetrics(a[0], f["project-key"]);
2968
+ },
2969
+ usage: "dss metrics folder-get <folderId> [--project-key KEY]",
2970
+ description: "Get the last computed metric values for a managed folder.",
2971
+ examples: ["dss metrics folder-get aBcDeFgH",],
2972
+ },
1732
2973
  },
1733
2974
  doctor: {
1734
2975
  run: {
@@ -2666,6 +3907,36 @@ const commands = {
2666
3907
  description: "List all datasets in a project.",
2667
3908
  examples: ["dss dataset list", "dss dataset list --project-key MYPROJ",],
2668
3909
  },
3910
+ rename: {
3911
+ handler: async (c, a, f) => {
3912
+ requireArgs(a, 2, "dss dataset rename <oldName> <newName> [--project-key KEY]");
3913
+ await c.datasets.rename(a[0], a[1], f["project-key"]);
3914
+ return { renamed: a[0], to: a[1], };
3915
+ },
3916
+ usage: "dss dataset rename <oldName> <newName> [--project-key KEY]",
3917
+ description: "Rename a dataset (updates downstream flow references).",
3918
+ examples: ["dss dataset rename old_ds new_ds",],
3919
+ },
3920
+ "list-partitions": {
3921
+ handler: (c, a, f) => {
3922
+ requireArgs(a, 1, "dss dataset list-partitions <name> [--project-key KEY]");
3923
+ return c.datasets.listPartitions(a[0], f["project-key"]);
3924
+ },
3925
+ usage: "dss dataset list-partitions <name> [--project-key KEY]",
3926
+ description: "List the partitions of a partitioned dataset.",
3927
+ examples: ["dss dataset list-partitions events",],
3928
+ },
3929
+ clear: {
3930
+ handler: async (c, a, f) => {
3931
+ requireArgs(a, 1, "dss dataset clear <name> [--partitions SPEC] [--project-key KEY]");
3932
+ const partitions = f["partitions"];
3933
+ await c.datasets.clear(a[0], partitions, f["project-key"]);
3934
+ return { cleared: a[0], partitions: partitions ?? "ALL", };
3935
+ },
3936
+ usage: "dss dataset clear <name> [--partitions SPEC] [--project-key KEY]",
3937
+ description: "Clear a dataset's data (all, or a partition spec); keeps the dataset.",
3938
+ examples: ["dss dataset clear staging", "dss dataset clear events --partitions 2024-01",],
3939
+ },
2669
3940
  get: {
2670
3941
  handler: (c, a, f) => {
2671
3942
  requireArgs(a, 1, "dss dataset get <name>");
@@ -2737,9 +4008,9 @@ const commands = {
2737
4008
  timeoutMs: num(f["timeout"]),
2738
4009
  });
2739
4010
  },
2740
- usage: "dss dataset preview <name> [--max-rows N] [--project-key KEY] [--timeout MS]",
2741
- description: "Preview dataset rows.",
2742
- examples: ["dss dataset preview orders", "dss dataset preview orders --max-rows 5",],
4011
+ usage: "dss dataset preview <name> [--max-rows N|--rows N] [--project-key KEY] [--timeout MS]",
4012
+ description: "Preview dataset rows (--rows is an alias for --max-rows).",
4013
+ examples: ["dss dataset preview orders", "dss dataset preview orders --rows 5",],
2743
4014
  },
2744
4015
  metadata: {
2745
4016
  handler: (c, a, f) => {
@@ -2751,16 +4022,28 @@ const commands = {
2751
4022
  examples: ["dss dataset metadata orders",],
2752
4023
  },
2753
4024
  download: {
2754
- handler: (c, a, f) => {
4025
+ handler: async (c, a, f) => {
2755
4026
  requireArgs(a, 1, "dss dataset download <name>");
2756
- return c.datasets.download(a[0], {
4027
+ const result = await c.datasets.download(a[0], {
2757
4028
  outputPath: f["output"],
2758
4029
  projectKey: f["project-key"],
2759
4030
  limit: num(f["limit"]),
2760
4031
  });
4032
+ if (result.truncated) {
4033
+ enqueueCliWarning({
4034
+ code: "dataset_download_truncated",
4035
+ message: `Download of '${a[0]}' stopped at the ${result.limit}-row cap; the dataset has more rows. `
4036
+ + "Re-run with --limit N for more, or read inside a recipe (get_dataframe) for the full data.",
4037
+ dataset: a[0],
4038
+ rows: result.rows,
4039
+ limit: result.limit,
4040
+ path: result.path,
4041
+ });
4042
+ }
4043
+ return result;
2761
4044
  },
2762
4045
  usage: "dss dataset download <name> [--output PATH] [--limit N] [--project-key KEY]",
2763
- description: "Download up to --limit rows (default 100k) as CSV; returns { path, rows, truncated, limit } so truncation is visible.",
4046
+ description: "Download up to --limit rows (default 100k) as CSV; returns { path, rows, truncated, limit }. When truncated, a dataset_download_truncated warning is also written to stderr so the cap is never silent.",
2764
4047
  examples: ["dss dataset download orders", "dss dataset download orders --output ./data/",],
2765
4048
  },
2766
4049
  create: {
@@ -4452,6 +5735,7 @@ const commands = {
4452
5735
  projectKey: f["project-key"],
4453
5736
  timeoutMs: num(f["timeout"]),
4454
5737
  keepScenario: f["keep"] === true,
5738
+ maxLogBytes: num(f["max-log-bytes"]),
4455
5739
  });
4456
5740
  const result = {
4457
5741
  outcome: run.outcome,
@@ -4460,6 +5744,8 @@ const commands = {
4460
5744
  elapsedMs: run.elapsedMs,
4461
5745
  pollCount: run.pollCount,
4462
5746
  output: run.output ?? "",
5747
+ logTruncated: run.logTruncated,
5748
+ maxLogBytes: run.maxLogBytes,
4463
5749
  };
4464
5750
  if (f["full-log"] === true || run.output === undefined) {
4465
5751
  result.log = run.log;
@@ -4467,7 +5753,7 @@ const commands = {
4467
5753
  return result;
4468
5754
  },
4469
5755
  usage: CODE_RUN_USAGE,
4470
- description: "Run one-off Python in a DSS code env via a throwaway custom-python scenario; returns the script's captured output (stdout+stderr) plus outcome/success. Pass --full-log for the raw DSS run log. Exits 4 on a non-SUCCESS outcome.",
5756
+ description: "Run one-off Python in a DSS code env via a throwaway custom-python scenario; returns the script's captured output (stdout+stderr) plus outcome/success. Log retrieval is capped by --max-log-bytes (default 1048576); pass --full-log to include the capped raw DSS run log. Exits 4 on a non-SUCCESS outcome.",
4471
5757
  examples: [
4472
5758
  "dss code run --file inspect.py",
4473
5759
  "dss code run --file inspect.py --env py39_pandas",
@@ -4743,8 +6029,8 @@ function missingActionError(resource, validActions, usage) {
4743
6029
  function unknownResourceError(resource) {
4744
6030
  return new UsageError(`Unknown resource: ${resource}.`, "usage_error", COMMANDS_RUN_HINT, { resource, validResources: RESOURCE_NAMES, });
4745
6031
  }
4746
- function unknownActionError(resource, action, validActions) {
4747
- return new UsageError(`Unknown action: ${resource} ${action ?? ""}`.trim(), "usage_error", COMMANDS_RUN_HINT, { resource, action, validActions, });
6032
+ function unknownActionError(resource, action, validActions, hint) {
6033
+ return new UsageError(`Unknown action: ${resource} ${action ?? ""}`.trim(), "usage_error", hint ?? COMMANDS_RUN_HINT, { resource, action, validActions, });
4748
6034
  }
4749
6035
  function requireArgs(args, count, usage) {
4750
6036
  if (args.length < count) {
@@ -5364,7 +6650,7 @@ function inferSideEffect(resource, action) {
5364
6650
  return "write";
5365
6651
  if (READ_ACTIONS.has(action))
5366
6652
  return "read";
5367
- if (/^(create|clone|restore|update|delete|set|save|upload|run|build|abort|move|refresh|clear|unload|install|login|logout|add|remove)/
6653
+ if (/^(create|clone|restore|update|delete|set|save|upload|run|build|abort|move|refresh|clear|unload|install|login|logout|add|remove|publish|activate|deploy|import|export|preload|upgrade|stop|restart|duplicate|put|rename|reply|compute)/
5368
6654
  .test(action)) {
5369
6655
  return "write";
5370
6656
  }
@@ -6774,8 +8060,9 @@ async function main() {
6774
8060
  }
6775
8061
  currentCommandContext.action = action;
6776
8062
  const authMeta = AUTH_ACTIONS[action];
6777
- if (!authMeta)
6778
- throw unknownActionError("auth", action, validActions);
8063
+ if (!authMeta) {
8064
+ throw unknownActionError("auth", action, validActions, "auth only supports 'login'. To check credentials/connectivity, run 'dss doctor'.");
8065
+ }
6779
8066
  const result = await authMeta.handler(flags);
6780
8067
  writeCommandResult(result);
6781
8068
  return;