@project-ajax/cli 0.0.11 → 0.0.12

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.
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.impl.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.impl.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C,UAAU,WAAW;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,MAAM,iGAgFjB,CAAC"}
1
+ {"version":3,"file":"deploy.impl.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.impl.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C,UAAU,WAAW;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,MAAM,iGAqFjB,CAAC"}
@@ -63,6 +63,9 @@ const deploy = buildHandler(async function(flags) {
63
63
  const { workerId: workerId2 } = Result.unwrap(result);
64
64
  await this.config.update({ workerId: workerId2 });
65
65
  this.io.writeErr("\u2713 Successfully deployed worker");
66
+ const workerUrl = `${this.config.baseUrl}/__workers__/${workerId2}`;
67
+ this.io.writeErr("");
68
+ this.io.writeErr(`Worker Dashboard: ${workerUrl}`);
66
69
  } else {
67
70
  this.io.writeErr("\u2717 Failed to deploy worker");
68
71
  this.io.writeErr(result.error.message);
@@ -1 +1 @@
1
- {"version":3,"file":"exec.impl.d.ts","sourceRoot":"","sources":["../../src/commands/exec.impl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAM/C,UAAU,SAAU,SAAQ,WAAW;IACtC,MAAM,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,IAAI,2HA2Jf,CAAC"}
1
+ {"version":3,"file":"exec.impl.d.ts","sourceRoot":"","sources":["../../src/commands/exec.impl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA4B/C,UAAU,SAAU,SAAQ,WAAW;IACtC,MAAM,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,IAAI,2HAmKf,CAAC"}
@@ -2,6 +2,15 @@ import { Result } from "../api/result.js";
2
2
  import { buildAuthedHandler } from "../handler.js";
3
3
  import { chunkEvery } from "../utils/array.js";
4
4
  const usageHint = `Usage: workers exec <capabilityName> <capabilityFunction> [<argName1>=<value1> <argName2>=<value2>...]`;
5
+ function formatIdForUrl(id) {
6
+ return id.replace(/-/g, "");
7
+ }
8
+ function getCollectionId(result) {
9
+ if (typeof result === "object" && result !== null && "collectionId" in result && typeof result.collectionId === "string") {
10
+ return result.collectionId;
11
+ }
12
+ return void 0;
13
+ }
5
14
  const exec = buildAuthedHandler(async function(flags, ...args) {
6
15
  const { workerId } = this.config;
7
16
  if (!workerId) {
@@ -39,6 +48,7 @@ const exec = buildAuthedHandler(async function(flags, ...args) {
39
48
  if (Result.isSuccess(result)) {
40
49
  const decoder = new TextDecoder();
41
50
  let buffer = "";
51
+ let capabilityResult;
42
52
  const allOutput = [];
43
53
  const onBodyLine = async (jsonLine) => {
44
54
  try {
@@ -58,6 +68,7 @@ const exec = buildAuthedHandler(async function(flags, ...args) {
58
68
  });
59
69
  break;
60
70
  case "result":
71
+ capabilityResult = parsedLine.result;
61
72
  this.io.writeOut(JSON.stringify(parsedLine.result, null, 2));
62
73
  break;
63
74
  case "error":
@@ -80,6 +91,7 @@ const exec = buildAuthedHandler(async function(flags, ...args) {
80
91
  if (buffer) {
81
92
  await onBodyLine(buffer);
82
93
  }
94
+ showUrls(this, workerId, getCollectionId(capabilityResult));
83
95
  return;
84
96
  } else {
85
97
  this.io.writeErr(`
@@ -107,6 +119,7 @@ ${usageHint}`);
107
119
  if (Result.isSuccess(result)) {
108
120
  const data = Result.unwrap(result);
109
121
  this.io.writeOut(JSON.stringify(data.result, null, 2));
122
+ showUrls(this, workerId, getCollectionId(data.result));
110
123
  } else {
111
124
  this.io.writeErr(`
112
125
  \u2717 Failed to execute capability`);
@@ -115,6 +128,19 @@ ${usageHint}`);
115
128
  }
116
129
  }
117
130
  });
131
+ function showUrls(context, workerId, collectionId) {
132
+ const baseUrl = context.config.baseUrl;
133
+ context.io.writeErr("");
134
+ const workerUrl = `${baseUrl}/__workers__/${workerId}`;
135
+ context.io.writeErr(`Worker Dashboard: ${workerUrl}`);
136
+ context.io.writeErr(" View execution state, logs, and debugging info");
137
+ if (collectionId) {
138
+ context.io.writeErr("");
139
+ const databaseUrl = `${baseUrl}/${formatIdForUrl(collectionId)}`;
140
+ context.io.writeErr(`Synced Database: ${databaseUrl}`);
141
+ context.io.writeErr(" View the synced data in Notion");
142
+ }
143
+ }
118
144
  function usageError() {
119
145
  return new Error(`Invalid arguments provided. ${usageHint}`);
120
146
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@project-ajax/cli",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "A CLI for the Project Ajax platform",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",