@chainpatrol/cli 0.27.0 → 1.1.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/CHANGELOG.md +54 -0
- package/dist/cli.js +8 -8
- package/dist/{get-2PCG3CQN.js → get-BZCAHKID.js} +49 -3
- package/dist/list-4YBWU2JZ.js +137 -0
- package/dist/{list-JG2R7EHK.js → list-N2TGW7MP.js} +20 -4
- package/dist/{run-SE2SUE64.js → run-RRG7D4SN.js} +0 -6
- package/dist/{types-M6QMFNUS.js → types-KUPHV2V3.js} +6 -1
- package/package.json +2 -2
- package/dist/list-FZD2FGJA.js +0 -83
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# @chainpatrol/cli
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 6def719: Surface `portalVisibility` (PUBLIC / PRIVATE / DISABLED) on the `/user/orgs`
|
|
8
|
+
and `/user/orgs/{slug}` API responses, on `UserOrg` in the SDK, and in the
|
|
9
|
+
`chainpatrol orgs list` / `chainpatrol orgs get` CLI output (human, markdown,
|
|
10
|
+
CSV, and JSON). Server-side changes in `@chainpatrol/external-trpc` and
|
|
11
|
+
`@chainpatrol/validation` back the new field; both are private packages and
|
|
12
|
+
don't need version bumps.
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 239bfdc: Remove non-zero exit throwing from `chainpatrol healthchecks run` when checks fail
|
|
17
|
+
or error, while preserving failure details in command output.
|
|
18
|
+
- Updated dependencies [6def719]
|
|
19
|
+
- @chainpatrol/sdk@1.1.0
|
|
20
|
+
|
|
21
|
+
## 1.0.0
|
|
22
|
+
|
|
23
|
+
### Major Changes
|
|
24
|
+
|
|
25
|
+
- 2c03d10: Rename the `TRIAL` organization subscription status to `POC` everywhere, matching the term we use in our CRM. The product status, API response payloads, and CLI flags now say `POC` in place of `TRIAL`.
|
|
26
|
+
|
|
27
|
+
**Breaking changes for SDK and CLI consumers:**
|
|
28
|
+
|
|
29
|
+
- `/user/orgs` and `/user/orgs/{slug}` now return `"subscriptionStatus": "POC"` instead of `"TRIAL"`.
|
|
30
|
+
- `chainpatrol orgs list --subscription-status POC` replaces `--subscription-status TRIAL` (the alias `TRIAL` is no longer accepted).
|
|
31
|
+
- `UserOrgsSubscriptionStatus` SDK type is now `"PROSPECT" | "POC" | "ACTIVE" | "INTEGRATION"`.
|
|
32
|
+
|
|
33
|
+
The underlying database column value is unchanged (`"trial"` via Prisma `@map`), so no data migration is required.
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Updated dependencies [2c03d10]
|
|
38
|
+
- @chainpatrol/sdk@1.0.0
|
|
39
|
+
|
|
40
|
+
## 0.28.0
|
|
41
|
+
|
|
42
|
+
### Minor Changes
|
|
43
|
+
|
|
44
|
+
- 5a1208e: Expose organization trademark registrations and legal documents (Letter of Authorization, Power of Attorney) on the API, SDK, and CLI so callers can answer questions like "which customers have their trademarks added?" from one place.
|
|
45
|
+
|
|
46
|
+
- `/user/orgs` and `/user/orgs/{slug}` now include `legalDocuments` (`{ letterOfAuthorization, powerOfAttorney }`, each `{ present, fileName, fileUrl }`) and `trademarkRegistrations` (full list with issuing office, registration number, page URL, and a `certificateFileUrl` link to the certificate PDF when uploaded).
|
|
47
|
+
- `/organization/brands` adds the same `legalDocuments` and `trademarkRegistrations` per brand, plus a `useOrganizationDocs` flag that signals brand-level fallback to org-level docs.
|
|
48
|
+
- `chainpatrol orgs list`, `chainpatrol orgs get`, and `chainpatrol brands list` print the new fields in human / markdown / CSV / JSON output, including the direct view links for the documents and certificates.
|
|
49
|
+
|
|
50
|
+
Backing work in `@chainpatrol/external-trpc` and `@chainpatrol/validation` adds the new Zod schemas and Kysely helpers; both are private packages and don't need version bumps.
|
|
51
|
+
|
|
52
|
+
### Patch Changes
|
|
53
|
+
|
|
54
|
+
- Updated dependencies [5a1208e]
|
|
55
|
+
- @chainpatrol/sdk@0.12.0
|
|
56
|
+
|
|
3
57
|
## 0.27.0
|
|
4
58
|
|
|
5
59
|
### Minor Changes
|
package/dist/cli.js
CHANGED
|
@@ -296,7 +296,7 @@ var HELP = {
|
|
|
296
296
|
"--org <slug> Single org. Mutually exclusive with --slugs and --all-my-orgs.",
|
|
297
297
|
"--slugs <list> Comma list of org slugs (cap 500). Response is the rollup across these orgs.",
|
|
298
298
|
"--all-my-orgs Shortcut for 'every org I can see'. Server resolves via the same logic as `orgs list` (org-scoped API keys are rejected). Cap 500 \u2014 narrow with --subscription-status / --service-active if you have more.",
|
|
299
|
-
"--subscription-status <list> With --all-my-orgs: only ACTIVE /
|
|
299
|
+
"--subscription-status <list> With --all-my-orgs: only ACTIVE / POC / PROSPECT / INTEGRATION (default: same set as `orgs list`).",
|
|
300
300
|
"--service-active <list> With --all-my-orgs: only orgs with the listed service(s) active. Allowed: reporting, reviewing, protection, takedowns, detection, darkWebMonitoring.",
|
|
301
301
|
"--brand-slug <slug> Filter by brand slug (requires brands-metrics flag; single-org only).",
|
|
302
302
|
"--from <iso> Start date (ISO 8601, e.g. 2026-01-01)",
|
|
@@ -544,7 +544,7 @@ var HELP = {
|
|
|
544
544
|
usage: "chainpatrol orgs list [filters]",
|
|
545
545
|
options: [
|
|
546
546
|
"--query <text> Partial name match (substring, case-insensitive)",
|
|
547
|
-
"--subscription-status <l> Comma-separated list (PROSPECT,
|
|
547
|
+
"--subscription-status <l> Comma-separated list (PROSPECT,POC,ACTIVE,INTEGRATION)",
|
|
548
548
|
"--service-active <l> Comma-separated services that must be active",
|
|
549
549
|
"--service-inactive <l> Comma-separated services that must be inactive",
|
|
550
550
|
"--service-automated <l> Services whose automation must be ON (only `takedowns` is accepted \u2014 the other services have no meaningful automation toggle)",
|
|
@@ -556,7 +556,7 @@ var HELP = {
|
|
|
556
556
|
examples: [
|
|
557
557
|
"chainpatrol orgs list --subscription-status ACTIVE",
|
|
558
558
|
"chainpatrol orgs list --service-active takedowns --service-manual takedowns",
|
|
559
|
-
"chainpatrol --json orgs list --subscription-status ACTIVE,
|
|
559
|
+
"chainpatrol --json orgs list --subscription-status ACTIVE,POC --service-active detection",
|
|
560
560
|
"chainpatrol --json orgs list --pending-approval-service protection,takedowns"
|
|
561
561
|
]
|
|
562
562
|
},
|
|
@@ -1243,7 +1243,7 @@ async function main() {
|
|
|
1243
1243
|
break;
|
|
1244
1244
|
}
|
|
1245
1245
|
if (subcommand === "types") {
|
|
1246
|
-
const { runAssetTypes } = await import("./types-
|
|
1246
|
+
const { runAssetTypes } = await import("./types-KUPHV2V3.js");
|
|
1247
1247
|
runAssetTypes({
|
|
1248
1248
|
json: jsonMode,
|
|
1249
1249
|
outputFormat: cliContext.outputFormat
|
|
@@ -1606,7 +1606,7 @@ async function main() {
|
|
|
1606
1606
|
}
|
|
1607
1607
|
case "orgs": {
|
|
1608
1608
|
if (subcommand === "list") {
|
|
1609
|
-
const { runOrgsList } = await import("./list-
|
|
1609
|
+
const { runOrgsList } = await import("./list-N2TGW7MP.js");
|
|
1610
1610
|
await runOrgsList({
|
|
1611
1611
|
query: cli.flags.query,
|
|
1612
1612
|
subscriptionStatus: cli.flags.subscriptionStatus,
|
|
@@ -1628,7 +1628,7 @@ async function main() {
|
|
|
1628
1628
|
if (subcommand === "get") {
|
|
1629
1629
|
const positionalSlug = action;
|
|
1630
1630
|
const slug = positionalSlug ?? await tryResolveOrg();
|
|
1631
|
-
const { runOrgsGet } = await import("./get-
|
|
1631
|
+
const { runOrgsGet } = await import("./get-BZCAHKID.js");
|
|
1632
1632
|
await runOrgsGet({
|
|
1633
1633
|
slug,
|
|
1634
1634
|
json: jsonMode,
|
|
@@ -1676,7 +1676,7 @@ async function main() {
|
|
|
1676
1676
|
"brands list --type must be ORGANIZATION or INDIVIDUAL (case-insensitive)."
|
|
1677
1677
|
);
|
|
1678
1678
|
}
|
|
1679
|
-
const { runBrandsList } = await import("./list-
|
|
1679
|
+
const { runBrandsList } = await import("./list-4YBWU2JZ.js");
|
|
1680
1680
|
await runBrandsList({
|
|
1681
1681
|
type: rawType,
|
|
1682
1682
|
json: jsonMode,
|
|
@@ -1713,7 +1713,7 @@ async function main() {
|
|
|
1713
1713
|
thresholds.minResults = cli.flags.minResults;
|
|
1714
1714
|
if (cli.flags.lookbackHours !== void 0)
|
|
1715
1715
|
thresholds.lookbackHours = cli.flags.lookbackHours;
|
|
1716
|
-
const { runHealthchecksRun } = await import("./run-
|
|
1716
|
+
const { runHealthchecksRun } = await import("./run-RRG7D4SN.js");
|
|
1717
1717
|
await runHealthchecksRun({
|
|
1718
1718
|
org,
|
|
1719
1719
|
id: action,
|
|
@@ -51,6 +51,17 @@ function summarizeIntegrations(org) {
|
|
|
51
51
|
if (org.integrations.moderation) parts.push("moderation-api");
|
|
52
52
|
return parts.length > 0 ? parts.join(" ") : "(none)";
|
|
53
53
|
}
|
|
54
|
+
function summarizeLegalDocuments(org) {
|
|
55
|
+
const loa = org.legalDocuments.letterOfAuthorization.present ? "yes" : "no";
|
|
56
|
+
const poa = org.legalDocuments.powerOfAttorney.present ? "yes" : "no";
|
|
57
|
+
return `LOA=${loa} POA=${poa}`;
|
|
58
|
+
}
|
|
59
|
+
function summarizeTrademarks(org) {
|
|
60
|
+
const count = org.trademarkRegistrations.length;
|
|
61
|
+
if (count === 0) return "none";
|
|
62
|
+
const labels = org.trademarkRegistrations.slice(0, 3).map((tm) => `${tm.brandName} (${tm.trademarkOffice} #${tm.registrationNumber})`);
|
|
63
|
+
return count > labels.length ? `${count} on file \u2014 ${labels.join(", ")}, +${count - labels.length} more` : `${count} on file \u2014 ${labels.join(", ")}`;
|
|
64
|
+
}
|
|
54
65
|
async function runOrgsGet(options) {
|
|
55
66
|
const slug = options.slug?.trim();
|
|
56
67
|
if (!slug) {
|
|
@@ -71,17 +82,26 @@ async function runOrgsGet(options) {
|
|
|
71
82
|
"",
|
|
72
83
|
`- Contact URL: ${organization.contactUrl ?? "(not set)"}`,
|
|
73
84
|
`- Subscription status: ${organization.subscriptionStatus}`,
|
|
85
|
+
`- Portal visibility: ${organization.portalVisibility}`,
|
|
74
86
|
`- Services: ${summarizeServices(organization)}`,
|
|
75
87
|
`- Integrations: ${summarizeIntegrations(organization)}`,
|
|
76
88
|
`- Obligatory admin approval: ${summarizeObligatoryAdminApproval(organization)}`,
|
|
77
|
-
`- Pending service approvals: ${summarizePendingApprovals(organization)}
|
|
78
|
-
|
|
89
|
+
`- Pending service approvals: ${summarizePendingApprovals(organization)}`,
|
|
90
|
+
`- Legal documents: ${summarizeLegalDocuments(organization)}`,
|
|
91
|
+
organization.legalDocuments.letterOfAuthorization.fileUrl ? ` - LOA: ${organization.legalDocuments.letterOfAuthorization.fileUrl}` : "",
|
|
92
|
+
organization.legalDocuments.powerOfAttorney.fileUrl ? ` - POA: ${organization.legalDocuments.powerOfAttorney.fileUrl}` : "",
|
|
93
|
+
`- Trademarks: ${summarizeTrademarks(organization)}`,
|
|
94
|
+
...organization.trademarkRegistrations.map(
|
|
95
|
+
(tm) => ` - #${tm.id} ${tm.brandName} \u2014 ${tm.trademarkOffice} #${tm.registrationNumber}` + (tm.registrationPageUrl ? ` \u2014 page: ${tm.registrationPageUrl}` : "") + (tm.certificateFileUrl ? ` \u2014 certificate: ${tm.certificateFileUrl}` : "")
|
|
96
|
+
)
|
|
97
|
+
].filter((line) => line !== "").join("\n"),
|
|
79
98
|
csv: toCsvRows([
|
|
80
99
|
{
|
|
81
100
|
slug: organization.slug,
|
|
82
101
|
name: organization.name,
|
|
83
102
|
contactUrl: organization.contactUrl ?? "",
|
|
84
103
|
subscriptionStatus: organization.subscriptionStatus,
|
|
104
|
+
portalVisibility: organization.portalVisibility,
|
|
85
105
|
reportingActive: organization.services.reporting.active,
|
|
86
106
|
reviewingActive: organization.services.reviewing.active,
|
|
87
107
|
protectionActive: organization.services.protection.active,
|
|
@@ -102,13 +122,20 @@ async function runOrgsGet(options) {
|
|
|
102
122
|
new Set(
|
|
103
123
|
organization.pendingServiceApprovals.map((approval) => approval.serviceType)
|
|
104
124
|
)
|
|
105
|
-
).join("|")
|
|
125
|
+
).join("|"),
|
|
126
|
+
letterOfAuthorizationPresent: organization.legalDocuments.letterOfAuthorization.present,
|
|
127
|
+
letterOfAuthorizationFileUrl: organization.legalDocuments.letterOfAuthorization.fileUrl ?? "",
|
|
128
|
+
powerOfAttorneyPresent: organization.legalDocuments.powerOfAttorney.present,
|
|
129
|
+
powerOfAttorneyFileUrl: organization.legalDocuments.powerOfAttorney.fileUrl ?? "",
|
|
130
|
+
trademarkRegistrationCount: organization.trademarkRegistrations.length,
|
|
131
|
+
trademarkBrandNames: organization.trademarkRegistrations.map((tm) => tm.brandName).join("|")
|
|
106
132
|
}
|
|
107
133
|
]),
|
|
108
134
|
human: () => {
|
|
109
135
|
console.log(`${organization.name} (slug: ${organization.slug})`);
|
|
110
136
|
console.log(` contactUrl: ${organization.contactUrl ?? "(not set)"}`);
|
|
111
137
|
console.log(` subscriptionStatus: ${organization.subscriptionStatus}`);
|
|
138
|
+
console.log(` portalVisibility: ${organization.portalVisibility}`);
|
|
112
139
|
console.log(` services: ${summarizeServices(organization)}`);
|
|
113
140
|
console.log(` integrations: ${summarizeIntegrations(organization)}`);
|
|
114
141
|
console.log(
|
|
@@ -117,6 +144,25 @@ async function runOrgsGet(options) {
|
|
|
117
144
|
console.log(
|
|
118
145
|
` pendingServiceApprovals: ${summarizePendingApprovals(organization)}`
|
|
119
146
|
);
|
|
147
|
+
console.log(` legalDocuments: ${summarizeLegalDocuments(organization)}`);
|
|
148
|
+
if (organization.legalDocuments.letterOfAuthorization.fileUrl) {
|
|
149
|
+
console.log(
|
|
150
|
+
` LOA: ${organization.legalDocuments.letterOfAuthorization.fileUrl}`
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
if (organization.legalDocuments.powerOfAttorney.fileUrl) {
|
|
154
|
+
console.log(` POA: ${organization.legalDocuments.powerOfAttorney.fileUrl}`);
|
|
155
|
+
}
|
|
156
|
+
console.log(` trademarks: ${summarizeTrademarks(organization)}`);
|
|
157
|
+
for (const tm of organization.trademarkRegistrations) {
|
|
158
|
+
const extras = [];
|
|
159
|
+
if (tm.registrationPageUrl) extras.push(`page=${tm.registrationPageUrl}`);
|
|
160
|
+
if (tm.certificateFileUrl) extras.push(`certificate=${tm.certificateFileUrl}`);
|
|
161
|
+
const extraStr = extras.length > 0 ? ` (${extras.join(", ")})` : "";
|
|
162
|
+
console.log(
|
|
163
|
+
` #${tm.id} ${tm.brandName} \u2014 ${tm.trademarkOffice} #${tm.registrationNumber}${extraStr}`
|
|
164
|
+
);
|
|
165
|
+
}
|
|
120
166
|
}
|
|
121
167
|
});
|
|
122
168
|
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import {
|
|
2
|
+
printOutput,
|
|
3
|
+
toCsvRows
|
|
4
|
+
} from "./chunk-VFT3TD3E.js";
|
|
5
|
+
import {
|
|
6
|
+
createApiClient
|
|
7
|
+
} from "./chunk-OFUIYMPD.js";
|
|
8
|
+
import "./chunk-EGWK6SRQ.js";
|
|
9
|
+
import "./chunk-U73SABXK.js";
|
|
10
|
+
|
|
11
|
+
// src/commands/brands/list.ts
|
|
12
|
+
function summarizeLegalDocs(brand) {
|
|
13
|
+
const loa = brand.legalDocuments.letterOfAuthorization.present ? "yes" : "no";
|
|
14
|
+
const poa = brand.legalDocuments.powerOfAttorney.present ? "yes" : "no";
|
|
15
|
+
const inheritance = brand.useOrganizationDocs ? " (inherits org docs)" : "";
|
|
16
|
+
return `LOA=${loa} POA=${poa}${inheritance}`;
|
|
17
|
+
}
|
|
18
|
+
function toRow(brand) {
|
|
19
|
+
return {
|
|
20
|
+
id: brand.id,
|
|
21
|
+
slug: brand.slug,
|
|
22
|
+
name: brand.name,
|
|
23
|
+
type: brand.type,
|
|
24
|
+
description: brand.description ?? "",
|
|
25
|
+
avatarUrl: brand.avatarUrl ?? "",
|
|
26
|
+
websiteUrl: brand.websiteUrl ?? "",
|
|
27
|
+
twitterHandle: brand.twitterHandle ?? "",
|
|
28
|
+
brandColors: brand.brandColors.join(", "),
|
|
29
|
+
includedTerms: brand.includedTerms.join(", "),
|
|
30
|
+
excludedTerms: brand.excludedTerms.join(", "),
|
|
31
|
+
tickers: brand.tickers.join(", "),
|
|
32
|
+
brandGroupId: brand.brandGroupId,
|
|
33
|
+
createdAt: brand.createdAt,
|
|
34
|
+
useOrganizationDocs: brand.useOrganizationDocs,
|
|
35
|
+
letterOfAuthorizationPresent: brand.legalDocuments.letterOfAuthorization.present,
|
|
36
|
+
letterOfAuthorizationFileUrl: brand.legalDocuments.letterOfAuthorization.fileUrl ?? "",
|
|
37
|
+
powerOfAttorneyPresent: brand.legalDocuments.powerOfAttorney.present,
|
|
38
|
+
powerOfAttorneyFileUrl: brand.legalDocuments.powerOfAttorney.fileUrl ?? "",
|
|
39
|
+
trademarkRegistrationCount: brand.trademarkRegistrations.length,
|
|
40
|
+
trademarkBrandNames: brand.trademarkRegistrations.map((tm) => tm.brandName).join("|")
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
async function runBrandsList(options) {
|
|
44
|
+
const outputFormat = options.outputFormat ?? (options.json ? "json" : "human");
|
|
45
|
+
const client = options.apiClient ?? createApiClient();
|
|
46
|
+
const result = await client.listOrganizationBrands();
|
|
47
|
+
const brands = options.type ? result.brands.filter((brand) => brand.type === options.type) : result.brands;
|
|
48
|
+
const rows = brands.map(toRow);
|
|
49
|
+
printOutput({
|
|
50
|
+
outputFormat,
|
|
51
|
+
json: options.type ? { ...result, brands } : result,
|
|
52
|
+
markdown: [
|
|
53
|
+
"# Organization brands",
|
|
54
|
+
"",
|
|
55
|
+
`- Returned: ${brands.length}${options.type ? ` (filtered to type=${options.type})` : ""}`,
|
|
56
|
+
"",
|
|
57
|
+
...brands.flatMap((brand) => {
|
|
58
|
+
const parts = [`slug=${brand.slug}`, `type=${brand.type}`];
|
|
59
|
+
if (brand.brandGroupId !== null) parts.push(`groupId=${brand.brandGroupId}`);
|
|
60
|
+
if (brand.websiteUrl) parts.push(`website=${brand.websiteUrl}`);
|
|
61
|
+
if (brand.twitterHandle) parts.push(`twitter=@${brand.twitterHandle}`);
|
|
62
|
+
if (brand.brandColors.length > 0)
|
|
63
|
+
parts.push(`colors=${brand.brandColors.join(", ")}`);
|
|
64
|
+
if (brand.includedTerms.length > 0)
|
|
65
|
+
parts.push(`included=${brand.includedTerms.join(", ")}`);
|
|
66
|
+
if (brand.excludedTerms.length > 0)
|
|
67
|
+
parts.push(`excluded=${brand.excludedTerms.join(", ")}`);
|
|
68
|
+
if (brand.tickers.length > 0) parts.push(`tickers=${brand.tickers.join(", ")}`);
|
|
69
|
+
parts.push(`legal=${summarizeLegalDocs(brand)}`);
|
|
70
|
+
parts.push(`trademarks=${brand.trademarkRegistrations.length}`);
|
|
71
|
+
const lines = [`- #${brand.id} ${brand.name} (${parts.join(", ")})`];
|
|
72
|
+
if (brand.legalDocuments.letterOfAuthorization.fileUrl) {
|
|
73
|
+
lines.push(` - LOA: ${brand.legalDocuments.letterOfAuthorization.fileUrl}`);
|
|
74
|
+
}
|
|
75
|
+
if (brand.legalDocuments.powerOfAttorney.fileUrl) {
|
|
76
|
+
lines.push(` - POA: ${brand.legalDocuments.powerOfAttorney.fileUrl}`);
|
|
77
|
+
}
|
|
78
|
+
for (const tm of brand.trademarkRegistrations) {
|
|
79
|
+
const extras = [];
|
|
80
|
+
if (tm.registrationPageUrl) extras.push(`page: ${tm.registrationPageUrl}`);
|
|
81
|
+
if (tm.certificateFileUrl) extras.push(`certificate: ${tm.certificateFileUrl}`);
|
|
82
|
+
const extraStr = extras.length > 0 ? ` \u2014 ${extras.join(", ")}` : "";
|
|
83
|
+
lines.push(
|
|
84
|
+
` - trademark #${tm.id} ${tm.brandName} \u2014 ${tm.trademarkOffice} #${tm.registrationNumber}${extraStr}`
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
return lines;
|
|
88
|
+
})
|
|
89
|
+
].join("\n"),
|
|
90
|
+
csv: toCsvRows(rows),
|
|
91
|
+
human: () => {
|
|
92
|
+
if (brands.length === 0) {
|
|
93
|
+
console.log(
|
|
94
|
+
options.type ? `No brands of type ${options.type} found.` : "No brands found."
|
|
95
|
+
);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
console.log(
|
|
99
|
+
`Organization brands \u2014 returned ${brands.length}${options.type ? ` (type=${options.type})` : ""}`
|
|
100
|
+
);
|
|
101
|
+
for (const brand of brands) {
|
|
102
|
+
const parts = [`slug=${brand.slug}`, `type=${brand.type}`];
|
|
103
|
+
if (brand.brandGroupId !== null) parts.push(`groupId=${brand.brandGroupId}`);
|
|
104
|
+
if (brand.websiteUrl) parts.push(`website=${brand.websiteUrl}`);
|
|
105
|
+
if (brand.twitterHandle) parts.push(`twitter=@${brand.twitterHandle}`);
|
|
106
|
+
if (brand.brandColors.length > 0)
|
|
107
|
+
parts.push(`colors=${brand.brandColors.join(", ")}`);
|
|
108
|
+
if (brand.includedTerms.length > 0)
|
|
109
|
+
parts.push(`included=${brand.includedTerms.join(", ")}`);
|
|
110
|
+
if (brand.excludedTerms.length > 0)
|
|
111
|
+
parts.push(`excluded=${brand.excludedTerms.join(", ")}`);
|
|
112
|
+
if (brand.tickers.length > 0) parts.push(`tickers=${brand.tickers.join(", ")}`);
|
|
113
|
+
parts.push(`legal=${summarizeLegalDocs(brand)}`);
|
|
114
|
+
parts.push(`trademarks=${brand.trademarkRegistrations.length}`);
|
|
115
|
+
console.log(`#${brand.id} ${brand.name} (${parts.join(", ")})`);
|
|
116
|
+
if (brand.legalDocuments.letterOfAuthorization.fileUrl) {
|
|
117
|
+
console.log(` LOA: ${brand.legalDocuments.letterOfAuthorization.fileUrl}`);
|
|
118
|
+
}
|
|
119
|
+
if (brand.legalDocuments.powerOfAttorney.fileUrl) {
|
|
120
|
+
console.log(` POA: ${brand.legalDocuments.powerOfAttorney.fileUrl}`);
|
|
121
|
+
}
|
|
122
|
+
for (const tm of brand.trademarkRegistrations) {
|
|
123
|
+
const extras = [];
|
|
124
|
+
if (tm.registrationPageUrl) extras.push(`page=${tm.registrationPageUrl}`);
|
|
125
|
+
if (tm.certificateFileUrl) extras.push(`certificate=${tm.certificateFileUrl}`);
|
|
126
|
+
const extraStr = extras.length > 0 ? ` (${extras.join(", ")})` : "";
|
|
127
|
+
console.log(
|
|
128
|
+
` trademark #${tm.id} ${tm.brandName} \u2014 ${tm.trademarkOffice} #${tm.registrationNumber}${extraStr}`
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
export {
|
|
136
|
+
runBrandsList
|
|
137
|
+
};
|
|
@@ -15,7 +15,7 @@ import "./chunk-U73SABXK.js";
|
|
|
15
15
|
// src/commands/orgs/list.ts
|
|
16
16
|
var VALID_SUBSCRIPTION_STATUSES = /* @__PURE__ */ new Set([
|
|
17
17
|
"PROSPECT",
|
|
18
|
-
"
|
|
18
|
+
"POC",
|
|
19
19
|
"ACTIVE",
|
|
20
20
|
"INTEGRATION"
|
|
21
21
|
]);
|
|
@@ -210,6 +210,15 @@ function summarizeIntegrations(org) {
|
|
|
210
210
|
if (org.integrations.moderation) parts.push("moderation-api");
|
|
211
211
|
return parts.length > 0 ? parts.join(" ") : "(none)";
|
|
212
212
|
}
|
|
213
|
+
function summarizeLegalDocuments(org) {
|
|
214
|
+
const loa = org.legalDocuments.letterOfAuthorization.present ? "yes" : "no";
|
|
215
|
+
const poa = org.legalDocuments.powerOfAttorney.present ? "yes" : "no";
|
|
216
|
+
return `LOA=${loa} POA=${poa}`;
|
|
217
|
+
}
|
|
218
|
+
function summarizeTrademarks(org) {
|
|
219
|
+
const count = org.trademarkRegistrations.length;
|
|
220
|
+
return count === 0 ? "0" : `${count}`;
|
|
221
|
+
}
|
|
213
222
|
async function runOrgsList(options) {
|
|
214
223
|
const client = options.apiClient ?? createApiClient();
|
|
215
224
|
const outputFormat = options.outputFormat ?? (options.json ? "json" : "human");
|
|
@@ -229,7 +238,7 @@ async function runOrgsList(options) {
|
|
|
229
238
|
`# Organizations (${organizations.length})`,
|
|
230
239
|
"",
|
|
231
240
|
...organizations.map(
|
|
232
|
-
(org) => `- \`${org.slug}\` \u2014 ${org.name} \u2014 ${org.subscriptionStatus} \u2014 contact: ${org.contactUrl ?? "(not set)"} \u2014 ${summarizeServices(org)} \u2014 integrations: ${summarizeIntegrations(org)} \u2014 admin-approval: ${summarizeObligatoryAdminApproval(org)} \u2014 pending-approval: ${summarizePendingApprovals(org)}`
|
|
241
|
+
(org) => `- \`${org.slug}\` \u2014 ${org.name} \u2014 ${org.subscriptionStatus} \u2014 portal: ${org.portalVisibility} \u2014 contact: ${org.contactUrl ?? "(not set)"} \u2014 ${summarizeServices(org)} \u2014 integrations: ${summarizeIntegrations(org)} \u2014 admin-approval: ${summarizeObligatoryAdminApproval(org)} \u2014 pending-approval: ${summarizePendingApprovals(org)} \u2014 legal: ${summarizeLegalDocuments(org)} \u2014 trademarks: ${summarizeTrademarks(org)}`
|
|
233
242
|
)
|
|
234
243
|
].join("\n"),
|
|
235
244
|
csv: toCsvRows(
|
|
@@ -238,6 +247,7 @@ async function runOrgsList(options) {
|
|
|
238
247
|
name: org.name,
|
|
239
248
|
contactUrl: org.contactUrl ?? "",
|
|
240
249
|
subscriptionStatus: org.subscriptionStatus,
|
|
250
|
+
portalVisibility: org.portalVisibility,
|
|
241
251
|
reportingActive: org.services.reporting.active,
|
|
242
252
|
reviewingActive: org.services.reviewing.active,
|
|
243
253
|
protectionActive: org.services.protection.active,
|
|
@@ -256,7 +266,13 @@ async function runOrgsList(options) {
|
|
|
256
266
|
obligatoryAdminApprovalAssetTypes: org.obligatoryAdminApproval.assetTypes.join("|"),
|
|
257
267
|
pendingServiceApprovals: Array.from(
|
|
258
268
|
new Set(org.pendingServiceApprovals.map((approval) => approval.serviceType))
|
|
259
|
-
).join("|")
|
|
269
|
+
).join("|"),
|
|
270
|
+
letterOfAuthorizationPresent: org.legalDocuments.letterOfAuthorization.present,
|
|
271
|
+
letterOfAuthorizationFileUrl: org.legalDocuments.letterOfAuthorization.fileUrl ?? "",
|
|
272
|
+
powerOfAttorneyPresent: org.legalDocuments.powerOfAttorney.present,
|
|
273
|
+
powerOfAttorneyFileUrl: org.legalDocuments.powerOfAttorney.fileUrl ?? "",
|
|
274
|
+
trademarkRegistrationCount: org.trademarkRegistrations.length,
|
|
275
|
+
trademarkBrandNames: org.trademarkRegistrations.map((tm) => tm.brandName).join("|")
|
|
260
276
|
}))
|
|
261
277
|
),
|
|
262
278
|
human: () => {
|
|
@@ -270,7 +286,7 @@ async function runOrgsList(options) {
|
|
|
270
286
|
for (const org of organizations) {
|
|
271
287
|
const contact = org.contactUrl ?? "(no contact)";
|
|
272
288
|
console.log(
|
|
273
|
-
` ${org.slug.padEnd(slugWidth)} ${org.name.padEnd(nameWidth)} ${org.subscriptionStatus.padEnd(11)} ${contact} ${summarizeServices(org)} integrations=${summarizeIntegrations(org)} admin-approval=${summarizeObligatoryAdminApproval(org)} pending-approval=${summarizePendingApprovals(org)}`
|
|
289
|
+
` ${org.slug.padEnd(slugWidth)} ${org.name.padEnd(nameWidth)} ${org.subscriptionStatus.padEnd(11)} portal=${org.portalVisibility.padEnd(8)} ${contact} ${summarizeServices(org)} integrations=${summarizeIntegrations(org)} admin-approval=${summarizeObligatoryAdminApproval(org)} pending-approval=${summarizePendingApprovals(org)} legal=${summarizeLegalDocuments(org)} trademarks=${summarizeTrademarks(org)}`
|
|
274
290
|
);
|
|
275
291
|
}
|
|
276
292
|
}
|
|
@@ -208,12 +208,6 @@ async function runHealthchecksRun(options) {
|
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
});
|
|
211
|
-
if (!overallOk) {
|
|
212
|
-
throw new CliExitError(
|
|
213
|
-
"One or more healthchecks failed or errored.",
|
|
214
|
-
ExitCode.CHECK_FAILED
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
211
|
}
|
|
218
212
|
export {
|
|
219
213
|
runHealthchecksRun
|
|
@@ -218,7 +218,12 @@ var ASSET_TYPES = [
|
|
|
218
218
|
label: "500px",
|
|
219
219
|
description: "A 500px photographer profile."
|
|
220
220
|
},
|
|
221
|
-
{ type: "LUMA", label: "Luma", description: "A Luma page or profile." }
|
|
221
|
+
{ type: "LUMA", label: "Luma", description: "A Luma page or profile." },
|
|
222
|
+
{
|
|
223
|
+
type: "SMARTMONEYMATCH",
|
|
224
|
+
label: "SmartMoneyMatch",
|
|
225
|
+
description: "A SmartMoneyMatch article or event page."
|
|
226
|
+
}
|
|
222
227
|
];
|
|
223
228
|
var ASSET_TYPE_LABELS = Object.freeze(
|
|
224
229
|
Object.fromEntries(ASSET_TYPES.map((entry) => [entry.type, entry.label]))
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@chainpatrol/cli",
|
|
3
3
|
"description": "The official ChainPatrol CLI — terminal interface for threat detection",
|
|
4
4
|
"author": "Umar Ahmed <umar@chainpatrol.io>",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "1.1.0",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"homepage": "https://chainpatrol.com/docs/cli",
|
|
8
8
|
"keywords": [
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"lint": "npx oxlint ."
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@chainpatrol/sdk": "
|
|
36
|
+
"@chainpatrol/sdk": "1.1.0",
|
|
37
37
|
"ink": "^7.0.1",
|
|
38
38
|
"meow": "^14.1.0",
|
|
39
39
|
"open": "^11.0.0",
|
package/dist/list-FZD2FGJA.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
printOutput,
|
|
3
|
-
toCsvRows
|
|
4
|
-
} from "./chunk-VFT3TD3E.js";
|
|
5
|
-
import {
|
|
6
|
-
createApiClient
|
|
7
|
-
} from "./chunk-OFUIYMPD.js";
|
|
8
|
-
import "./chunk-EGWK6SRQ.js";
|
|
9
|
-
import "./chunk-U73SABXK.js";
|
|
10
|
-
|
|
11
|
-
// src/commands/brands/list.ts
|
|
12
|
-
function toRow(brand) {
|
|
13
|
-
return {
|
|
14
|
-
id: brand.id,
|
|
15
|
-
slug: brand.slug,
|
|
16
|
-
name: brand.name,
|
|
17
|
-
type: brand.type,
|
|
18
|
-
description: brand.description ?? "",
|
|
19
|
-
avatarUrl: brand.avatarUrl ?? "",
|
|
20
|
-
websiteUrl: brand.websiteUrl ?? "",
|
|
21
|
-
twitterHandle: brand.twitterHandle ?? "",
|
|
22
|
-
brandColors: brand.brandColors.join(", "),
|
|
23
|
-
includedTerms: brand.includedTerms.join(", "),
|
|
24
|
-
excludedTerms: brand.excludedTerms.join(", "),
|
|
25
|
-
tickers: brand.tickers.join(", "),
|
|
26
|
-
brandGroupId: brand.brandGroupId,
|
|
27
|
-
createdAt: brand.createdAt
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
async function runBrandsList(options) {
|
|
31
|
-
const outputFormat = options.outputFormat ?? (options.json ? "json" : "human");
|
|
32
|
-
const client = options.apiClient ?? createApiClient();
|
|
33
|
-
const result = await client.listOrganizationBrands();
|
|
34
|
-
const brands = options.type ? result.brands.filter((brand) => brand.type === options.type) : result.brands;
|
|
35
|
-
const rows = brands.map(toRow);
|
|
36
|
-
printOutput({
|
|
37
|
-
outputFormat,
|
|
38
|
-
json: options.type ? { ...result, brands } : result,
|
|
39
|
-
markdown: [
|
|
40
|
-
"# Organization brands",
|
|
41
|
-
"",
|
|
42
|
-
`- Returned: ${brands.length}${options.type ? ` (filtered to type=${options.type})` : ""}`,
|
|
43
|
-
"",
|
|
44
|
-
...rows.map((row) => {
|
|
45
|
-
const parts = [`slug=${row.slug}`, `type=${row.type}`];
|
|
46
|
-
if (row.brandGroupId !== null) parts.push(`groupId=${row.brandGroupId}`);
|
|
47
|
-
if (row.websiteUrl) parts.push(`website=${row.websiteUrl}`);
|
|
48
|
-
if (row.twitterHandle) parts.push(`twitter=@${row.twitterHandle}`);
|
|
49
|
-
if (row.brandColors) parts.push(`colors=${row.brandColors}`);
|
|
50
|
-
if (row.includedTerms) parts.push(`included=${row.includedTerms}`);
|
|
51
|
-
if (row.excludedTerms) parts.push(`excluded=${row.excludedTerms}`);
|
|
52
|
-
if (row.tickers) parts.push(`tickers=${row.tickers}`);
|
|
53
|
-
return `- #${row.id} ${row.name} (${parts.join(", ")})`;
|
|
54
|
-
})
|
|
55
|
-
].join("\n"),
|
|
56
|
-
csv: toCsvRows(rows),
|
|
57
|
-
human: () => {
|
|
58
|
-
if (brands.length === 0) {
|
|
59
|
-
console.log(
|
|
60
|
-
options.type ? `No brands of type ${options.type} found.` : "No brands found."
|
|
61
|
-
);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
console.log(
|
|
65
|
-
`Organization brands \u2014 returned ${brands.length}${options.type ? ` (type=${options.type})` : ""}`
|
|
66
|
-
);
|
|
67
|
-
for (const row of rows) {
|
|
68
|
-
const parts = [`slug=${row.slug}`, `type=${row.type}`];
|
|
69
|
-
if (row.brandGroupId !== null) parts.push(`groupId=${row.brandGroupId}`);
|
|
70
|
-
if (row.websiteUrl) parts.push(`website=${row.websiteUrl}`);
|
|
71
|
-
if (row.twitterHandle) parts.push(`twitter=@${row.twitterHandle}`);
|
|
72
|
-
if (row.brandColors) parts.push(`colors=${row.brandColors}`);
|
|
73
|
-
if (row.includedTerms) parts.push(`included=${row.includedTerms}`);
|
|
74
|
-
if (row.excludedTerms) parts.push(`excluded=${row.excludedTerms}`);
|
|
75
|
-
if (row.tickers) parts.push(`tickers=${row.tickers}`);
|
|
76
|
-
console.log(`#${row.id} ${row.name} (${parts.join(", ")})`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
export {
|
|
82
|
-
runBrandsList
|
|
83
|
-
};
|