genlayer 0.1.3 → 0.1.4

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 CHANGED
@@ -1,5 +1,12 @@
1
1
 
2
2
 
3
+ ## 0.1.4 (2024-11-12)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * changing linux command to fix display issue and fixing waiting simulator issue ([#127](https://github.com/yeagerai/genlayer-cli/issues/127)) ([721eebf](https://github.com/yeagerai/genlayer-cli/commit/721eebfea758a0897f23afd60b5767c59d593eb1))
9
+
3
10
  ## 0.1.3 (2024-11-08)
4
11
 
5
12
  ## 0.1.2 (2024-11-08)
package/dist/index.js CHANGED
@@ -39699,7 +39699,7 @@ var {
39699
39699
  } = import_index.default;
39700
39700
 
39701
39701
  // package.json
39702
- var version = "0.1.3";
39702
+ var version = "0.1.4";
39703
39703
 
39704
39704
  // src/lib/config/text.ts
39705
39705
  var CLI_DESCRIPTION = "GenLayer CLI is a development environment for the GenLayer ecosystem. It allows developers to interact with the protocol by creating accounts, sending transactions, and working with Intelligent Contracts by testing, debugging, and deploying them.";
@@ -39767,7 +39767,7 @@ var DOCKER_IMAGES_AND_CONTAINERS_NAME_PREFIX = "genlayer-simulator-";
39767
39767
  var DEFAULT_RUN_SIMULATOR_COMMAND = (simulatorLocation) => ({
39768
39768
  darwin: `osascript -e 'tell application "Terminal" to do script "cd ${simulatorLocation} && docker compose build && docker compose up"'`,
39769
39769
  win32: `start cmd.exe /c "cd /d ${simulatorLocation} && docker compose build && docker compose up && pause"`,
39770
- linux: `x-terminal-emulator -e bash -c 'cd ${simulatorLocation} && docker compose build && docker compose up; echo "Press enter to exit"; read'`
39770
+ linux: `nohup bash -c 'cd ${simulatorLocation} && docker compose build && docker compose up -d'`
39771
39771
  });
39772
39772
  var DEFAULT_PULL_OLLAMA_COMMAND = (simulatorLocation) => ({
39773
39773
  darwin: `cd ${simulatorLocation} && docker exec ollama ollama pull llama3`,
@@ -40572,7 +40572,7 @@ var SimulatorService = class {
40572
40572
  console.log("Waiting for the simulator to start up...");
40573
40573
  try {
40574
40574
  const response = yield rpcClient.request({ method: "ping", params: [] });
40575
- if (((_a = response == null ? void 0 : response.result) == null ? void 0 : _a.status) === "OK" || ((_c = (_b = response == null ? void 0 : response.result) == null ? void 0 : _b.data) == null ? void 0 : _c.status) === "OK") {
40575
+ if ((response == null ? void 0 : response.result) === "OK" || ((_a = response == null ? void 0 : response.result) == null ? void 0 : _a.status) === "OK" || ((_c = (_b = response == null ? void 0 : response.result) == null ? void 0 : _b.data) == null ? void 0 : _c.status) === "OK") {
40576
40576
  return { initialized: true };
40577
40577
  }
40578
40578
  if (retries > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genlayer",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "GenLayer Command Line Tool",
5
5
  "main": "src/index.ts",
6
6
  "bin": {
@@ -4,7 +4,7 @@ export const DOCKER_IMAGES_AND_CONTAINERS_NAME_PREFIX = "genlayer-simulator-";
4
4
  export const DEFAULT_RUN_SIMULATOR_COMMAND = (simulatorLocation: string) => ({
5
5
  darwin: `osascript -e 'tell application "Terminal" to do script "cd ${simulatorLocation} && docker compose build && docker compose up"'`,
6
6
  win32: `start cmd.exe /c "cd /d ${simulatorLocation} && docker compose build && docker compose up && pause"`,
7
- linux: `x-terminal-emulator -e bash -c 'cd ${simulatorLocation} && docker compose build && docker compose up; echo "Press enter to exit"; read'`,
7
+ linux: `nohup bash -c 'cd ${simulatorLocation} && docker compose build && docker compose up -d'`,
8
8
  });
9
9
  export const DEFAULT_PULL_OLLAMA_COMMAND = (simulatorLocation: string) => ({
10
10
  darwin: `cd ${simulatorLocation} && docker exec ollama ollama pull llama3`,
@@ -221,7 +221,7 @@ export class SimulatorService implements ISimulatorService {
221
221
  const response = await rpcClient.request({method: "ping", params: []});
222
222
 
223
223
  //Compatibility with current simulator version
224
- if (response?.result?.status === "OK" || response?.result?.data?.status === "OK") {
224
+ if (response?.result === "OK" || response?.result?.status === "OK" || response?.result?.data?.status === "OK") {
225
225
  return { initialized: true };
226
226
  }
227
227
  if (retries > 0) {
@@ -104,20 +104,27 @@ describe("SimulatorService - Basic Tests", () => {
104
104
  expect(fs.existsSync).toHaveBeenCalled();
105
105
  });
106
106
 
107
- test("should return initialized true when simulator responds with OK", async () => {
107
+ test("should return initialized true when simulator responds with OK (result.status = OK)", async () => {
108
108
  vi.mocked(rpcClient.request).mockResolvedValueOnce({ result: {status: 'OK'} });
109
109
  const result = await simulatorService.waitForSimulatorToBeReady(STARTING_TIMEOUT_ATTEMPTS);
110
110
  expect(result).toEqual({ initialized: true });
111
111
  expect(rpcClient.request).toHaveBeenCalledWith({ method: "ping", params: [] });
112
112
  });
113
113
 
114
- test("should return initialized true when simulator responds with OK (different json structure)", async () => {
114
+ test("should return initialized true when simulator responds with OK (result.data.status = OK)", async () => {
115
115
  vi.mocked(rpcClient.request).mockResolvedValueOnce({ result: {data: {status: 'OK'}} });
116
116
  const result = await simulatorService.waitForSimulatorToBeReady(STARTING_TIMEOUT_ATTEMPTS);
117
117
  expect(result).toEqual({ initialized: true });
118
118
  expect(rpcClient.request).toHaveBeenCalledWith({ method: "ping", params: [] });
119
119
  });
120
120
 
121
+ test("should return initialized true when simulator responds with OK (result = OK)", async () => {
122
+ vi.mocked(rpcClient.request).mockResolvedValueOnce({ result: 'OK' });
123
+ const result = await simulatorService.waitForSimulatorToBeReady(STARTING_TIMEOUT_ATTEMPTS);
124
+ expect(result).toEqual({ initialized: true });
125
+ expect(rpcClient.request).toHaveBeenCalledWith({ method: "ping", params: [] });
126
+ });
127
+
121
128
  test("should return initialized false with errorCode TIMEOUT after retries", async () => {
122
129
  vi.mocked(rpcClient.request).mockResolvedValue(undefined);
123
130
  const result = await simulatorService.waitForSimulatorToBeReady(1);