lnlink-server 1.0.7 → 1.0.8

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 (56) hide show
  1. package/dist/app.js +129 -129
  2. package/dist/build-info.json +2 -1
  3. package/dist/index.js +89 -41
  4. package/dist/index.js.map +2 -2
  5. package/dist/package.json +2 -1
  6. package/package.json +2 -1
  7. package/dist/node_modules/debug/.coveralls.yml +0 -1
  8. package/dist/node_modules/debug/.eslintrc +0 -11
  9. package/dist/node_modules/debug/.travis.yml +0 -14
  10. package/dist/node_modules/debug/CHANGELOG.md +0 -362
  11. package/dist/node_modules/debug/LICENSE +0 -19
  12. package/dist/node_modules/debug/Makefile +0 -50
  13. package/dist/node_modules/debug/README.md +0 -312
  14. package/dist/node_modules/debug/component.json +0 -19
  15. package/dist/node_modules/debug/karma.conf.js +0 -70
  16. package/dist/node_modules/debug/node.js +0 -1
  17. package/dist/node_modules/debug/package.json +0 -49
  18. package/dist/node_modules/debug/src/browser.js +0 -185
  19. package/dist/node_modules/debug/src/debug.js +0 -202
  20. package/dist/node_modules/debug/src/index.js +0 -10
  21. package/dist/node_modules/debug/src/inspector-log.js +0 -15
  22. package/dist/node_modules/debug/src/node.js +0 -248
  23. package/dist/node_modules/depd/History.md +0 -96
  24. package/dist/node_modules/depd/LICENSE +0 -22
  25. package/dist/node_modules/depd/Readme.md +0 -280
  26. package/dist/node_modules/depd/index.js +0 -522
  27. package/dist/node_modules/depd/lib/browser/index.js +0 -77
  28. package/dist/node_modules/depd/lib/compat/callsite-tostring.js +0 -103
  29. package/dist/node_modules/depd/lib/compat/event-listener-count.js +0 -22
  30. package/dist/node_modules/depd/lib/compat/index.js +0 -79
  31. package/dist/node_modules/depd/package.json +0 -41
  32. package/dist/node_modules/http-errors/HISTORY.md +0 -132
  33. package/dist/node_modules/http-errors/LICENSE +0 -23
  34. package/dist/node_modules/http-errors/README.md +0 -135
  35. package/dist/node_modules/http-errors/index.js +0 -260
  36. package/dist/node_modules/http-errors/package.json +0 -48
  37. package/dist/node_modules/inherits/LICENSE +0 -16
  38. package/dist/node_modules/inherits/README.md +0 -42
  39. package/dist/node_modules/inherits/inherits.js +0 -7
  40. package/dist/node_modules/inherits/inherits_browser.js +0 -23
  41. package/dist/node_modules/inherits/package.json +0 -29
  42. package/dist/node_modules/ms/index.js +0 -152
  43. package/dist/node_modules/ms/license.md +0 -21
  44. package/dist/node_modules/ms/package.json +0 -37
  45. package/dist/node_modules/ms/readme.md +0 -51
  46. package/dist/node_modules/setprototypeof/LICENSE +0 -13
  47. package/dist/node_modules/setprototypeof/README.md +0 -26
  48. package/dist/node_modules/setprototypeof/index.d.ts +0 -2
  49. package/dist/node_modules/setprototypeof/index.js +0 -15
  50. package/dist/node_modules/setprototypeof/package.json +0 -25
  51. package/dist/node_modules/statuses/HISTORY.md +0 -65
  52. package/dist/node_modules/statuses/LICENSE +0 -23
  53. package/dist/node_modules/statuses/README.md +0 -127
  54. package/dist/node_modules/statuses/codes.json +0 -66
  55. package/dist/node_modules/statuses/index.js +0 -113
  56. package/dist/node_modules/statuses/package.json +0 -48
@@ -1,5 +1,5 @@
1
1
  {
2
- "buildTime": "2026-02-04T01:47:26.492Z",
2
+ "buildTime": "2026-02-04T10:13:35.044Z",
3
3
  "mode": "development",
4
4
  "bundle": "single",
5
5
  "external": "all",
@@ -25,6 +25,7 @@
25
25
  "form-data",
26
26
  "http-errors",
27
27
  "jest",
28
+ "lnlink-server",
28
29
  "long",
29
30
  "module-alias",
30
31
  "morgan",
package/dist/index.js CHANGED
@@ -7054,7 +7054,7 @@ var require_package = __commonJS({
7054
7054
  "package.json"(exports2, module2) {
7055
7055
  module2.exports = {
7056
7056
  name: "lnlink-server",
7057
- version: "1.0.7",
7057
+ version: "1.0.8",
7058
7058
  private: false,
7059
7059
  main: "dist/index.js",
7060
7060
  files: [
@@ -7105,6 +7105,7 @@ var require_package = __commonJS({
7105
7105
  "form-data": "^4.0.2",
7106
7106
  "http-errors": "~1.6.3",
7107
7107
  jest: "^29.6.2",
7108
+ "lnlink-server": "1.0.7",
7108
7109
  long: "^5.2.3",
7109
7110
  "module-alias": "^2.2.3",
7110
7111
  morgan: "~1.9.1",
@@ -13450,54 +13451,101 @@ var require_eventProcessor = __commonJS({
13450
13451
  msg: RESPONSE_MESSAGES.INVALID_JSON
13451
13452
  });
13452
13453
  }
13453
- if (!obj.method) {
13454
+ const executeCall = /* @__PURE__ */ __name(async (method, params = {}, node_type = "lnd") => {
13455
+ if (!method) {
13456
+ return {
13457
+ code: ERROR_CODES.MISSING_METHOD,
13458
+ data: null,
13459
+ msg: RESPONSE_MESSAGES.MISSING_METHOD
13460
+ };
13461
+ }
13462
+ const toLineMethod = toLine(method);
13463
+ logger2.info(`parseAndExecute method: ${method} node_type: ${node_type},from: ${nip19.npubEncode(subFrom)}`);
13464
+ const { authValid, lnlinkUser } = await preCallAuth(toLineMethod, "", subFrom, "");
13465
+ if (!authValid) {
13466
+ return {
13467
+ code: ERROR_CODES.FORBIDDEN,
13468
+ data: null,
13469
+ msg: RESPONSE_MESSAGES.READONLY_FORBIDDEN
13470
+ };
13471
+ }
13472
+ const callParams = {
13473
+ ...params,
13474
+ event_id: eventId,
13475
+ lnlinkUser
13476
+ };
13477
+ let proxy = null;
13478
+ if (node_type === "lnd") {
13479
+ if (!lndProxies[toLineMethod]) {
13480
+ return {
13481
+ code: ERROR_CODES.METHOD_NOT_SUPPORTED,
13482
+ data: null,
13483
+ msg: `Method '${toLineMethod}' not supported`
13484
+ };
13485
+ }
13486
+ proxy = await lndProxies[toLineMethod]();
13487
+ } else if (node_type === "rgb") {
13488
+ if (!rgbProxies[toLineMethod]) {
13489
+ return {
13490
+ code: ERROR_CODES.METHOD_NOT_SUPPORTED,
13491
+ data: null,
13492
+ msg: `Method '${toLineMethod}' not supported`
13493
+ };
13494
+ }
13495
+ proxy = await rgbProxies[toLineMethod]();
13496
+ } else {
13497
+ return {
13498
+ code: ERROR_CODES.METHOD_NOT_SUPPORTED,
13499
+ data: null,
13500
+ msg: `Node type '${node_type}' not supported`
13501
+ };
13502
+ }
13503
+ logger2.info(`Executing ${node_type}.${toLineMethod}...`);
13504
+ const ret = await proxy.method(callParams);
13505
+ logger2.info(`Executed ${node_type}.${toLineMethod} successfully`);
13506
+ return {
13507
+ code: 0,
13508
+ data: ret,
13509
+ msg: RESPONSE_MESSAGES.SUCCESS
13510
+ };
13511
+ }, "executeCall");
13512
+ if (obj.method) {
13513
+ const {
13514
+ method,
13515
+ params,
13516
+ node_type = "lnd"
13517
+ } = obj;
13518
+ const result = await executeCall(method, params, node_type);
13519
+ return JSON.stringify(result);
13520
+ }
13521
+ if (!Array.isArray(obj.method_list)) {
13454
13522
  return JSON.stringify({
13455
13523
  code: ERROR_CODES.MISSING_METHOD,
13456
13524
  data: null,
13457
13525
  msg: RESPONSE_MESSAGES.MISSING_METHOD
13458
13526
  });
13459
13527
  }
13460
- const {
13461
- method,
13462
- params,
13463
- node_type = "lnd"
13464
- } = obj;
13465
- const toLineMethod = toLine(method);
13466
- logger2.info(`parseAndExecute method: ${method} node_type: ${node_type},from: ${nip19.npubEncode(subFrom)}`);
13467
- const { authValid, lnlinkUser } = await preCallAuth(toLineMethod, "", subFrom, "");
13468
- if (!authValid) {
13469
- return JSON.stringify({
13470
- code: ERROR_CODES.FORBIDDEN,
13471
- data: null,
13472
- msg: RESPONSE_MESSAGES.READONLY_FORBIDDEN
13473
- });
13474
- }
13475
- const callParams = {
13476
- ...params,
13477
- event_id: eventId,
13478
- lnlinkUser
13479
- };
13480
- let proxy = null;
13481
- if (node_type === "lnd") {
13482
- if (!lndProxies[toLineMethod]) {
13483
- return JSON.stringify({
13484
- code: ERROR_CODES.METHOD_NOT_SUPPORTED,
13485
- data: null,
13486
- msg: `Method '${toLineMethod}' not supported`
13487
- });
13528
+ const results = await Promise.allSettled(
13529
+ obj.method_list.map((item) => executeCall(item?.method, item?.params, item?.node_type))
13530
+ );
13531
+ const responseList = results.map((result, index) => {
13532
+ const method = obj.method_list[index]?.method;
13533
+ if (result.status === "fulfilled") {
13534
+ return {
13535
+ method,
13536
+ ...result.value
13537
+ };
13488
13538
  }
13489
- proxy = await lndProxies[toLineMethod]();
13490
- } else if (node_type === "rgb") {
13491
- proxy = await rgbProxies[toLineMethod]();
13492
- }
13493
- logger2.info(`Executing ${node_type}.${toLineMethod}...`);
13494
- const ret = await proxy.method(callParams);
13495
- logger2.info(`Executed ${node_type}.${toLineMethod} successfully`);
13496
- return JSON.stringify({
13497
- code: 0,
13498
- data: ret,
13499
- msg: RESPONSE_MESSAGES.SUCCESS
13539
+ const error = result.reason || {};
13540
+ const errorMessage = error instanceof Error ? error.message : String(error || RESPONSE_MESSAGES.INTERNAL_ERROR);
13541
+ return {
13542
+ method,
13543
+ code: error.code || ERROR_CODES.INTERNAL_ERROR,
13544
+ data: null,
13545
+ msg: errorMessage
13546
+ };
13500
13547
  });
13548
+ return JSON.stringify(responseList);
13501
13549
  } catch (e) {
13502
13550
  const code = e.code || ERROR_CODES.INTERNAL_ERROR;
13503
13551
  return JSON.stringify({