@propper-ai/cli 0.3.2 → 0.4.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.
package/README.md CHANGED
@@ -37,6 +37,7 @@ propper sign agreements create --name "NDA" --input-json @nda.json
37
37
  propper sign audit certificate --agreement-id ag_123 --output-file audit.pdf
38
38
  propper docgen batches list
39
39
  propper locker risks list
40
+ propper click templates list
40
41
  ```
41
42
 
42
43
  ## Authentication
@@ -136,6 +137,10 @@ propper docgen approvals | batches | delivery-configs | documents | templates ..
136
137
 
137
138
  # locker (Propper Locker API, /v1/locker)
138
139
  propper locker chat | documents | risks | settings ...
140
+
141
+ # click (Propper Click API — consent / clickwrap)
142
+ propper click templates | deployments | acceptances | analytics | render |
143
+ users | identity | verification | validation ...
139
144
  ```
140
145
 
141
146
  Run any group bare (`propper`, `propper sign`, `propper sign agreements`) to see
@@ -5,7 +5,7 @@ import {
5
5
  UsageError,
6
6
  callOperation,
7
7
  manifest
8
- } from "../chunk-CBIH6V3I.js";
8
+ } from "../chunk-XSRXBEWN.js";
9
9
 
10
10
  // src/bin/propper.ts
11
11
  import { CommanderError } from "commander";
@@ -31,14 +31,23 @@ function collectionRows(data) {
31
31
  if (data !== null && typeof data === "object" && !Array.isArray(data)) {
32
32
  const obj = data;
33
33
  const arrayKeys = Object.keys(obj).filter((k) => isObjectArray(obj[k]));
34
- const key = arrayKeys.length === 1 ? arrayKeys[0] : COLLECTION_KEYS.find((k) => arrayKeys.includes(k));
35
- if (key !== void 0) return obj[key];
34
+ const conventional = COLLECTION_KEYS.find((k) => arrayKeys.includes(k));
35
+ if (conventional !== void 0) return obj[conventional];
36
+ const soleKey = arrayKeys.length === 1 ? arrayKeys[0] : void 0;
37
+ if (soleKey !== void 0 && !hasScalarContent(obj, soleKey)) {
38
+ return obj[soleKey];
39
+ }
36
40
  }
37
41
  return null;
38
42
  }
39
43
  function isEmpty(value) {
40
44
  return value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0;
41
45
  }
46
+ function hasScalarContent(obj, excludeKey) {
47
+ return Object.entries(obj).some(
48
+ ([k, v]) => k !== excludeKey && (typeof v === "string" || typeof v === "number" || typeof v === "boolean") && !isEmpty(v)
49
+ );
50
+ }
42
51
  function scalar(value) {
43
52
  if (value === null || value === void 0) return "";
44
53
  if (typeof value === "object") return JSON.stringify(value);
@@ -61,6 +70,35 @@ function toTable(data) {
61
70
  for (const row of data) table.push(columns.map((c) => tableCell(row[c])));
62
71
  return table.toString();
63
72
  }
73
+ var MAX_VALUE_WIDTH = 60;
74
+ var longestLine = (s) => Math.max(0, ...s.split("\n").map((l) => l.length));
75
+ function objectValueCell(value) {
76
+ if (value === null || value === void 0) return "";
77
+ if (Array.isArray(value)) {
78
+ return value.length === 0 ? "" : `${value.length} item${value.length === 1 ? "" : "s"}`;
79
+ }
80
+ if (typeof value === "object") return JSON.stringify(value);
81
+ return String(value);
82
+ }
83
+ function toObjectTable(obj) {
84
+ const entries = Object.entries(obj);
85
+ const shown = entries.filter(([, v]) => !isEmpty(v));
86
+ const rows = (shown.length > 0 ? shown : entries).map(
87
+ ([k, v]) => [k, objectValueCell(v)]
88
+ );
89
+ const keyWidth = Math.max("field".length, ...rows.map(([k]) => k.length));
90
+ const valueWidth = Math.min(
91
+ MAX_VALUE_WIDTH,
92
+ Math.max("value".length, ...rows.map(([, v]) => longestLine(v)))
93
+ );
94
+ const table = new Table({
95
+ head: ["field", "value"],
96
+ colWidths: [keyWidth + 2, valueWidth + 2],
97
+ wordWrap: true
98
+ });
99
+ for (const row of rows) table.push(row);
100
+ return table.toString();
101
+ }
64
102
  function toText(data) {
65
103
  const rows = collectionRows(data);
66
104
  if (rows) {
@@ -81,8 +119,11 @@ function formatOutput(data, format) {
81
119
  return yamlStringify(data).trimEnd();
82
120
  case "table": {
83
121
  const rows = collectionRows(data);
84
- if (!rows) return JSON.stringify(data, null, 2);
85
- return rows.length > 0 ? toTable(rows) : "(no items)";
122
+ if (rows) return rows.length > 0 ? toTable(rows) : "(no items)";
123
+ if (data !== null && typeof data === "object" && !Array.isArray(data)) {
124
+ return toObjectTable(data);
125
+ }
126
+ return JSON.stringify(data, null, 2);
86
127
  }
87
128
  case "text":
88
129
  return toText(data);
@@ -194,7 +235,7 @@ import { Command } from "commander";
194
235
  // package.json
195
236
  var package_default = {
196
237
  name: "@propper-ai/cli",
197
- version: "0.3.2",
238
+ version: "0.4.0",
198
239
  description: "Propper CLI \u2014 an AWS-style, OpenAPI-generated command-line interface for the Propper Sign + Auth APIs",
199
240
  type: "module",
200
241
  license: "MIT",