@glyphteck/veyl 0.1.1 → 0.1.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.
package/dist/cli.js CHANGED
@@ -94733,7 +94733,12 @@ function createAccountSessionActions({ cloud, getSession, session } = {}) {
94733
94733
  throw new Error("cannot message self");
94734
94734
  }
94735
94735
  const link = await resolvePeerChat(readCloud(), active.chatPK, active.chatPrivKey, profile.chatPK, options);
94736
- const sent = await sendMsg(readCloud(), active.chatPK, active.chatPrivKey, profile.chatPK, payload, {
94736
+ const message = {
94737
+ ...payload,
94738
+ s: payload?.s || active.chatPK,
94739
+ cid: payload?.cid || makeCid()
94740
+ };
94741
+ const sent = await sendMsg(readCloud(), active.chatPK, active.chatPrivKey, profile.chatPK, message, {
94737
94742
  ...options,
94738
94743
  chatId: link.chatId,
94739
94744
  linkId: link.linkId,
@@ -133252,6 +133257,7 @@ async function runCommand(argv) {
133252
133257
  process.env.VEYL_VAULT_SECRET = parsed.options.secret;
133253
133258
  }
133254
133259
  const [area, command, ...args] = parsed.args;
133260
+ const shortArgs = command === undefined ? [] : [command, ...args];
133255
133261
  const veyl = createClient2({
133256
133262
  profile: parsed.options.profile,
133257
133263
  network: parsed.options.network
@@ -133267,21 +133273,21 @@ async function runCommand(argv) {
133267
133273
  }
133268
133274
  if (area === "create") {
133269
133275
  return parsed.options.passkey ? veyl.account.createPasskey({
133270
- username: args[0],
133276
+ username: shortArgs[0],
133271
133277
  network: parsed.options.network,
133272
133278
  webUrl: parsed.options.webUrl,
133273
133279
  saveCredential: parsed.options.saveCredential,
133274
133280
  onPasskeyUrl: (url) => console.error(`open ${url}`)
133275
- }) : veyl.account.create({ username: args[0], network: parsed.options.network, saveCredential: parsed.options.saveCredential });
133281
+ }) : veyl.account.create({ username: shortArgs[0], network: parsed.options.network, saveCredential: parsed.options.saveCredential });
133276
133282
  }
133277
133283
  if (area === "login") {
133278
133284
  return parsed.options.passkey ? veyl.account.loginPasskey({
133279
- username: args[0],
133285
+ username: shortArgs[0],
133280
133286
  network: parsed.options.network,
133281
133287
  webUrl: parsed.options.webUrl,
133282
133288
  saveCredential: parsed.options.saveCredential,
133283
133289
  onPasskeyUrl: (url) => console.error(`open ${url}`)
133284
- }) : veyl.account.login({ username: args[0] });
133290
+ }) : veyl.account.login({ username: shortArgs[0] });
133285
133291
  }
133286
133292
  if (area === "me") {
133287
133293
  return veyl.account.me();
@@ -133296,22 +133302,22 @@ async function runCommand(argv) {
133296
133302
  return veyl.money.balance();
133297
133303
  }
133298
133304
  if (area === "send") {
133299
- return veyl.money.send(args[0], args[1]);
133305
+ return veyl.money.send(shortArgs[0], shortArgs[1]);
133300
133306
  }
133301
133307
  if (area === "request") {
133302
- return veyl.money.request(args[0], args[1]);
133308
+ return veyl.money.request(shortArgs[0], shortArgs[1]);
133303
133309
  }
133304
133310
  if (area === "pay") {
133305
- return veyl.money.pay(args[0]);
133311
+ return veyl.money.pay(shortArgs[0]);
133306
133312
  }
133307
133313
  if (area === "txs") {
133308
133314
  return veyl.money.transactions();
133309
133315
  }
133310
133316
  if (area === "read") {
133311
- return veyl.chat.read(args[0]);
133317
+ return veyl.chat.read(shortArgs[0]);
133312
133318
  }
133313
133319
  if (area === "say" || area === "msg") {
133314
- return veyl.chat.send(args[0], args.slice(1).join(" "));
133320
+ return veyl.chat.send(shortArgs[0], shortArgs.slice(1).join(" "));
133315
133321
  }
133316
133322
  if (area === "listen") {
133317
133323
  const controller = new AbortController;
@@ -133389,14 +133395,15 @@ async function runCommand(argv) {
133389
133395
  async function main() {
133390
133396
  try {
133391
133397
  print2(await runCommand(process.argv.slice(2)));
133398
+ process.exit(0);
133392
133399
  } catch (error) {
133393
133400
  if (error instanceof ClientNotReadyError) {
133394
133401
  console.error(error.message);
133395
- process.exitCode = 2;
133402
+ process.exit(2);
133396
133403
  return;
133397
133404
  }
133398
133405
  console.error(error?.message || String(error));
133399
- process.exitCode = error?.code === "usage" ? 1 : 2;
133406
+ process.exit(error?.code === "usage" ? 1 : 2);
133400
133407
  }
133401
133408
  }
133402
133409
  main();
package/dist/index.js CHANGED
@@ -94732,7 +94732,12 @@ function createAccountSessionActions({ cloud, getSession, session } = {}) {
94732
94732
  throw new Error("cannot message self");
94733
94733
  }
94734
94734
  const link = await resolvePeerChat(readCloud(), active.chatPK, active.chatPrivKey, profile.chatPK, options);
94735
- const sent = await sendMsg(readCloud(), active.chatPK, active.chatPrivKey, profile.chatPK, payload, {
94735
+ const message = {
94736
+ ...payload,
94737
+ s: payload?.s || active.chatPK,
94738
+ cid: payload?.cid || makeCid()
94739
+ };
94740
+ const sent = await sendMsg(readCloud(), active.chatPK, active.chatPrivKey, profile.chatPK, message, {
94736
94741
  ...options,
94737
94742
  chatId: link.chatId,
94738
94743
  linkId: link.linkId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glyphteck/veyl",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "Programmable Bun client for Veyl accounts, vaults, chat, and wallet payments.",