@pmate/cli 0.16.1 → 0.16.2

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.
Files changed (2) hide show
  1. package/dist/index.js +15 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -18908,9 +18908,16 @@ var BlockLogAppender = class {
18908
18908
  var Namespace = class {
18909
18909
  constructor(options) {
18910
18910
  this.options = options;
18911
- this.appender = new BlockLogAppender(options.chain, options.baseUrl.replace(/\/+$/, ""));
18912
18911
  this.indexerClient = new IndexerClient(options.indexerBaseUrl.replace(/\/+$/, ""));
18913
18912
  }
18913
+ getAppender() {
18914
+ if (!this.options.baseUrl) {
18915
+ throw new Error(
18916
+ "Missing store base URL. Provide --base-url or set PMATE_STORE_BASE_URL / BLOCKCHAIN_BASE_URL."
18917
+ );
18918
+ }
18919
+ return new BlockLogAppender(this.options.chain, this.options.baseUrl.replace(/\/+$/, ""));
18920
+ }
18914
18921
  table(name) {
18915
18922
  const descriptor = createDescriptor({
18916
18923
  chain: this.options.chain,
@@ -18951,7 +18958,7 @@ var Namespace = class {
18951
18958
  v: STORE_LOG_VERSION,
18952
18959
  data: { type: "create", after: data }
18953
18960
  };
18954
- await this.appender.append([log]);
18961
+ await this.getAppender().append([log]);
18955
18962
  },
18956
18963
  updateRow: async (data) => {
18957
18964
  const { id, ...value } = data;
@@ -18963,7 +18970,7 @@ var Namespace = class {
18963
18970
  v: STORE_LOG_VERSION,
18964
18971
  data: { type: "update", id, value }
18965
18972
  };
18966
- await this.appender.append([log]);
18973
+ await this.getAppender().append([log]);
18967
18974
  },
18968
18975
  deleteRow: async (id) => {
18969
18976
  const log = {
@@ -18974,7 +18981,7 @@ var Namespace = class {
18974
18981
  v: STORE_LOG_VERSION,
18975
18982
  data: { type: "delete", id }
18976
18983
  };
18977
- await this.appender.append([log]);
18984
+ await this.getAppender().append([log]);
18978
18985
  }
18979
18986
  };
18980
18987
  }
@@ -19017,7 +19024,7 @@ var Namespace = class {
19017
19024
  v: STORE_LOG_VERSION,
19018
19025
  data: { key, value }
19019
19026
  };
19020
- await this.appender.append([log]);
19027
+ await this.getAppender().append([log]);
19021
19028
  },
19022
19029
  delete: async (key) => {
19023
19030
  const log = {
@@ -19028,7 +19035,7 @@ var Namespace = class {
19028
19035
  v: STORE_LOG_VERSION,
19029
19036
  data: { key, value: null }
19030
19037
  };
19031
- await this.appender.append([log]);
19038
+ await this.getAppender().append([log]);
19032
19039
  }
19033
19040
  };
19034
19041
  }
@@ -19436,10 +19443,11 @@ var StoreCommandHandler = class {
19436
19443
  }
19437
19444
  }
19438
19445
  createNamespace(args) {
19446
+ const needsWriteBaseUrl = args.scope === "table" && (args.action === "create" || args.action === "update" || args.action === "delete") || args.scope === "kv" && (args.action === "set" || args.action === "delete");
19439
19447
  return new Namespace({
19440
19448
  chain: args.chain,
19441
19449
  ns: args.namespace,
19442
- baseUrl: this.resolveBaseUrl(args.baseUrl),
19450
+ baseUrl: needsWriteBaseUrl ? this.resolveBaseUrl(args.baseUrl) : args.baseUrl,
19443
19451
  indexerBaseUrl: this.resolveIndexerBaseUrl(args.indexerBaseUrl)
19444
19452
  });
19445
19453
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/cli",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "description": "CLI utilities for the pMate project",
5
5
  "license": "MIT",
6
6
  "bin": {