@dayofweek/dcli 1.0.4 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/dcli.js CHANGED
@@ -128,6 +128,26 @@ read
128
128
  const result = await client.listContacts(opts);
129
129
  output(result);
130
130
  });
131
+ read
132
+ .command("entity-types")
133
+ .description("List available entity types")
134
+ .action(async () => {
135
+ const client = getClient();
136
+ const result = await client.listEntityTypes();
137
+ output(result);
138
+ });
139
+ read
140
+ .command("catalog")
141
+ .description("Search or browse the produce catalog")
142
+ .option("--search <query>", "Search by name")
143
+ .option("--parent <conceptId>", "List children of a category")
144
+ .option("--type <nodeType>", "Filter by type (category, produce, variety)")
145
+ .option("--limit <count>", "Max results", parseInt)
146
+ .action(async (opts) => {
147
+ const client = getClient();
148
+ const result = await client.searchCatalog(opts);
149
+ output(result);
150
+ });
131
151
  // ── Agent Commands ───────────────────────────────────────────────────────────
132
152
  const agent = program.command("agent").description("Submit and view proposals");
133
153
  agent
package/dist/client.d.ts CHANGED
@@ -41,6 +41,13 @@ export declare class DayOfWeekClient {
41
41
  entity?: string;
42
42
  limit?: number;
43
43
  }): Promise<any[]>;
44
+ listEntityTypes(): Promise<any[]>;
45
+ searchCatalog(opts?: {
46
+ search?: string;
47
+ parent?: string;
48
+ type?: string;
49
+ limit?: number;
50
+ }): Promise<any[]>;
44
51
  listProposals(opts?: {
45
52
  status?: string;
46
53
  source?: string;
package/dist/client.js CHANGED
@@ -64,6 +64,22 @@ export class DayOfWeekClient {
64
64
  const qs = params.toString();
65
65
  return this.get(`/contacts${qs ? `?${qs}` : ""}`);
66
66
  }
67
+ async listEntityTypes() {
68
+ return this.get("/entity-types");
69
+ }
70
+ async searchCatalog(opts) {
71
+ const params = new URLSearchParams();
72
+ if (opts?.search)
73
+ params.set("search", opts.search);
74
+ if (opts?.parent)
75
+ params.set("parent", opts.parent);
76
+ if (opts?.type)
77
+ params.set("type", opts.type);
78
+ if (opts?.limit)
79
+ params.set("limit", String(opts.limit));
80
+ const qs = params.toString();
81
+ return this.get(`/catalog${qs ? `?${qs}` : ""}`);
82
+ }
67
83
  // ── Proposals ─────────────────────────────────────────────────────────────
68
84
  async listProposals(opts) {
69
85
  const params = new URLSearchParams();
@@ -91,11 +107,7 @@ export class DayOfWeekClient {
91
107
  }
92
108
  // ── Schema ────────────────────────────────────────────────────────────────
93
109
  async getSchema() {
94
- // Schema endpoint doesn't require auth
95
- const res = await fetch(`${this.baseUrl}/schema`);
96
- if (!res.ok)
97
- throw new ApiError(res.status, await res.text());
98
- return res.json();
110
+ return this.get("/schema");
99
111
  }
100
112
  // ── HTTP helpers ──────────────────────────────────────────────────────────
101
113
  async get(path) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dayofweek/dcli",
3
- "version": "1.0.4",
3
+ "version": "1.1.1",
4
4
  "description": "CLI for the Day of Week AgTech platform — read data and submit proposals for review",
5
5
  "license": "MIT",
6
6
  "type": "module",