@jclvsh/iris 0.5.0 → 0.5.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/cli.js +13 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -24,7 +24,19 @@ const program = new Command()
|
|
|
24
24
|
.option("--json", "output as JSON (default)")
|
|
25
25
|
.option("--format <fmt>", "output format: json, table", "json");
|
|
26
26
|
try {
|
|
27
|
-
|
|
27
|
+
// Lazy client: defer the IrisClient constructor (which throws when
|
|
28
|
+
// IRIS_API_KEY is missing) until a command actually issues an HTTP call.
|
|
29
|
+
// `iris -V`, `iris --help`, `iris ai --help` etc. never touch the proxy,
|
|
30
|
+
// so they exit cleanly without an API key set.
|
|
31
|
+
let realClient = null;
|
|
32
|
+
const client = new Proxy({}, {
|
|
33
|
+
get(_target, prop, receiver) {
|
|
34
|
+
if (!realClient)
|
|
35
|
+
realClient = new IrisClient();
|
|
36
|
+
const value = Reflect.get(realClient, prop, receiver);
|
|
37
|
+
return typeof value === "function" ? value.bind(realClient) : value;
|
|
38
|
+
},
|
|
39
|
+
});
|
|
28
40
|
registerCampaignCommands(program, client);
|
|
29
41
|
registerContactCommands(program, client);
|
|
30
42
|
registerMessageCommands(program, client);
|