@dainprotocol/cli 1.1.13 → 1.1.14

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.
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -50,7 +50,7 @@ var status_1 = __importDefault(require("./status"));
50
50
  var START_DEPLOY_URI = '/api/app/data/deployments/start-deploy';
51
51
  function deploy(options) {
52
52
  return __awaiter(this, void 0, void 0, function () {
53
- var config, spinner, basePath, deployPath, envArray, result, deploymentId, error_1;
53
+ var config, spinner, basePath, deployPath, envArray, result, deploymentId, dainJson, dainJsonObject, error_1;
54
54
  return __generator(this, function (_a) {
55
55
  switch (_a.label) {
56
56
  case 0:
@@ -60,7 +60,7 @@ function deploy(options) {
60
60
  deployPath = "".concat(basePath).concat(START_DEPLOY_URI);
61
61
  _a.label = 1;
62
62
  case 1:
63
- _a.trys.push([1, 7, , 8]);
63
+ _a.trys.push([1, 9, , 10]);
64
64
  return [4 /*yield*/, loadAndValidateEnvVariables()];
65
65
  case 2:
66
66
  envArray = _a.sent();
@@ -73,6 +73,14 @@ function deploy(options) {
73
73
  deploymentId = result.deploymentId.replace('codegen-', '');
74
74
  return [4 /*yield*/, recursiveStatusUntilRunning(JSON.stringify(config), deploymentId)];
75
75
  case 5:
76
+ _a.sent();
77
+ return [4 /*yield*/, fs_extra_1.default.readFile('./dain.json', 'utf-8')];
78
+ case 6:
79
+ dainJson = _a.sent();
80
+ dainJsonObject = JSON.parse(dainJson);
81
+ dainJsonObject['deployment-id'] = deploymentId;
82
+ return [4 /*yield*/, fs_extra_1.default.writeFile('./dain.json', JSON.stringify(dainJsonObject, null, 2))];
83
+ case 7:
76
84
  _a.sent();
77
85
  console.log('\n-----------------------');
78
86
  spinner.succeed("Deployment URL: ".concat(result.service.url));
@@ -84,17 +92,17 @@ function deploy(options) {
84
92
  return [4 /*yield*/, fetch(result.service.url, {
85
93
  method: 'GET',
86
94
  })];
87
- case 6:
95
+ case 8:
88
96
  _a.sent();
89
97
  process.exit(0);
90
- return [3 /*break*/, 8];
91
- case 7:
98
+ return [3 /*break*/, 10];
99
+ case 9:
92
100
  error_1 = _a.sent();
93
101
  spinner.fail('Deployment failed.');
94
102
  (0, utils_1.logError)('Error during deployment: ', error_1);
95
103
  process.exit(1);
96
- return [3 /*break*/, 8];
97
- case 8: return [2 /*return*/];
104
+ return [3 /*break*/, 10];
105
+ case 10: return [2 /*return*/];
98
106
  }
99
107
  });
100
108
  });
@@ -85,7 +85,9 @@ function status(options, preDefinedDeploymentId) {
85
85
  error_1 = _b.sent();
86
86
  spinner.fail('Failed to retrieve project status.');
87
87
  (0, utils_1.logError)('Error during status check', error_1);
88
- process.exit(1);
88
+ if (!preDefinedDeploymentId) {
89
+ process.exit(1);
90
+ }
89
91
  return [3 /*break*/, 5];
90
92
  case 5: return [2 /*return*/];
91
93
  }
@@ -26,13 +26,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
26
26
  }) : function(o, v) {
27
27
  o["default"] = v;
28
28
  });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
36
46
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
47
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
48
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -107,29 +107,6 @@ const getWeatherForecastConfig: ToolConfig = {
107
107
  `User / Agent ${agentInfo.id} requested forecast at ${locationName} (${latitude},${longitude})`
108
108
  );
109
109
 
110
- // Send early UI with map and loading state
111
- if (context.updateUI) {
112
- await context.updateUI({
113
- ui: new CardUIBuilder()
114
- .setRenderMode("page")
115
- .title(`Weather Forecast for ${locationName} ⏳`)
116
- .addChild(new MapUIBuilder()
117
- .setInitialView(latitude, longitude, 10)
118
- .setMapStyle('streets')
119
- .addMarkers([
120
- {
121
- latitude,
122
- longitude,
123
- title: locationName,
124
- description: 'Loading forecast data...',
125
- text: `${locationName} ⏳`,
126
- }
127
- ])
128
- .build())
129
- .content('Fetching weather forecast data...')
130
- .build()
131
- });
132
- }
133
110
 
134
111
  const response = await axios.get(
135
112
  `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&hourly=temperature_2m,relative_humidity_2m,wind_speed_10m`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dainprotocol/cli",
3
- "version": "1.1.13",
3
+ "version": "1.1.14",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -107,29 +107,6 @@ const getWeatherForecastConfig: ToolConfig = {
107
107
  `User / Agent ${agentInfo.id} requested forecast at ${locationName} (${latitude},${longitude})`
108
108
  );
109
109
 
110
- // Send early UI with map and loading state
111
- if (context.updateUI) {
112
- await context.updateUI({
113
- ui: new CardUIBuilder()
114
- .setRenderMode("page")
115
- .title(`Weather Forecast for ${locationName} ⏳`)
116
- .addChild(new MapUIBuilder()
117
- .setInitialView(latitude, longitude, 10)
118
- .setMapStyle('streets')
119
- .addMarkers([
120
- {
121
- latitude,
122
- longitude,
123
- title: locationName,
124
- description: 'Loading forecast data...',
125
- text: `${locationName} ⏳`,
126
- }
127
- ])
128
- .build())
129
- .content('Fetching weather forecast data...')
130
- .build()
131
- });
132
- }
133
110
 
134
111
  const response = await axios.get(
135
112
  `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&hourly=temperature_2m,relative_humidity_2m,wind_speed_10m`