@owneraio/finp2p-sdk-js 0.28.25 → 0.28.41

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 (205) hide show
  1. package/README.md +71 -1
  2. package/lib/OwneraAPI/__tests__/apiErrorShape.test.d.ts +1 -0
  3. package/lib/OwneraAPI/__tests__/apiErrorShape.test.js +264 -0
  4. package/lib/OwneraAPI/__tests__/apiErrorShape.test.js.map +1 -0
  5. package/lib/OwneraAPI/finp2p-node-api/__tests__/approvalsConfig.test.js +5 -12
  6. package/lib/OwneraAPI/finp2p-node-api/__tests__/approvalsConfig.test.js.map +1 -1
  7. package/lib/OwneraAPI/finp2p-node-api/__tests__/createIntentMetadata.test.d.ts +1 -0
  8. package/lib/OwneraAPI/finp2p-node-api/__tests__/createIntentMetadata.test.js +56 -0
  9. package/lib/OwneraAPI/finp2p-node-api/__tests__/createIntentMetadata.test.js.map +1 -0
  10. package/lib/OwneraAPI/finp2p-node-api/__tests__/dryRunExecute.test.d.ts +1 -0
  11. package/lib/OwneraAPI/finp2p-node-api/__tests__/dryRunExecute.test.js +75 -0
  12. package/lib/OwneraAPI/finp2p-node-api/__tests__/dryRunExecute.test.js.map +1 -0
  13. package/lib/OwneraAPI/finp2p-node-api/__tests__/pathEncoding.test.d.ts +1 -0
  14. package/lib/OwneraAPI/finp2p-node-api/__tests__/pathEncoding.test.js +348 -0
  15. package/lib/OwneraAPI/finp2p-node-api/__tests__/pathEncoding.test.js.map +1 -0
  16. package/lib/OwneraAPI/finp2p-node-api/__tests__/rejectIntent.test.d.ts +1 -0
  17. package/lib/OwneraAPI/finp2p-node-api/__tests__/rejectIntent.test.js +97 -0
  18. package/lib/OwneraAPI/finp2p-node-api/__tests__/rejectIntent.test.js.map +1 -0
  19. package/lib/OwneraAPI/finp2p-node-api/certificates.js +15 -6
  20. package/lib/OwneraAPI/finp2p-node-api/certificates.js.map +1 -1
  21. package/lib/OwneraAPI/finp2p-node-api/custodies.js +13 -2
  22. package/lib/OwneraAPI/finp2p-node-api/custodies.js.map +1 -1
  23. package/lib/OwneraAPI/finp2p-node-api/documents.js +22 -9
  24. package/lib/OwneraAPI/finp2p-node-api/documents.js.map +1 -1
  25. package/lib/OwneraAPI/finp2p-node-api/investorAccounts.d.ts +13 -0
  26. package/lib/OwneraAPI/finp2p-node-api/investorAccounts.js +71 -0
  27. package/lib/OwneraAPI/finp2p-node-api/investorAccounts.js.map +1 -0
  28. package/lib/OwneraAPI/finp2p-node-api/ledgers.js +13 -2
  29. package/lib/OwneraAPI/finp2p-node-api/ledgers.js.map +1 -1
  30. package/lib/OwneraAPI/finp2p-node-api/messages.js +12 -3
  31. package/lib/OwneraAPI/finp2p-node-api/messages.js.map +1 -1
  32. package/lib/OwneraAPI/finp2p-node-api/operations.js +37 -15
  33. package/lib/OwneraAPI/finp2p-node-api/operations.js.map +1 -1
  34. package/lib/OwneraAPI/finp2p-node-api/policies.js +14 -5
  35. package/lib/OwneraAPI/finp2p-node-api/policies.js.map +1 -1
  36. package/lib/OwneraAPI/finp2p-node-api/profiles.js +95 -49
  37. package/lib/OwneraAPI/finp2p-node-api/profiles.js.map +1 -1
  38. package/lib/OwneraAPI/finp2p-node-api/tokens.js +20 -0
  39. package/lib/OwneraAPI/finp2p-node-api/tokens.js.map +1 -1
  40. package/lib/OwneraAPI/index.js +2 -0
  41. package/lib/OwneraAPI/index.js.map +1 -1
  42. package/lib/OwneraAPI/oss-api/__tests__/buildGraphQLQuery.test.d.ts +1 -0
  43. package/lib/OwneraAPI/oss-api/__tests__/buildGraphQLQuery.test.js +253 -0
  44. package/lib/OwneraAPI/oss-api/__tests__/buildGraphQLQuery.test.js.map +1 -0
  45. package/lib/OwneraAPI/oss-api/__tests__/getAllExecutionPlans.test.js +52 -0
  46. package/lib/OwneraAPI/oss-api/__tests__/getAllExecutionPlans.test.js.map +1 -1
  47. package/lib/OwneraAPI/oss-api/__tests__/ossQueryEscaping.test.d.ts +1 -0
  48. package/lib/OwneraAPI/oss-api/__tests__/ossQueryEscaping.test.js +347 -0
  49. package/lib/OwneraAPI/oss-api/__tests__/ossQueryEscaping.test.js.map +1 -0
  50. package/lib/OwneraAPI/oss-api/filterUtils.d.ts +20 -0
  51. package/lib/OwneraAPI/oss-api/filterUtils.js +57 -5
  52. package/lib/OwneraAPI/oss-api/filterUtils.js.map +1 -1
  53. package/lib/OwneraAPI/oss-api/oss.js +188 -75
  54. package/lib/OwneraAPI/oss-api/oss.js.map +1 -1
  55. package/lib/OwneraAPI/oss-api/queryUtils.d.ts +1 -0
  56. package/lib/OwneraAPI/oss-api/queryUtils.js +6 -5
  57. package/lib/OwneraAPI/oss-api/queryUtils.js.map +1 -1
  58. package/lib/OwneraAPI/oss-api/queryValidation.d.ts +3 -1
  59. package/lib/OwneraAPI/oss-api/queryValidation.js +21 -2
  60. package/lib/OwneraAPI/oss-api/queryValidation.js.map +1 -1
  61. package/lib/OwneraAPI/payment-adapter-api/__tests__/updateBalance.test.d.ts +1 -0
  62. package/lib/OwneraAPI/payment-adapter-api/__tests__/updateBalance.test.js +42 -0
  63. package/lib/OwneraAPI/payment-adapter-api/__tests__/updateBalance.test.js.map +1 -0
  64. package/lib/OwneraAPI/payment-adapter-api/vanilla/__tests__/payouts.test.d.ts +1 -0
  65. package/lib/OwneraAPI/payment-adapter-api/vanilla/__tests__/payouts.test.js +73 -0
  66. package/lib/OwneraAPI/payment-adapter-api/vanilla/__tests__/payouts.test.js.map +1 -0
  67. package/lib/OwneraAPI/payment-adapter-api/vanilla/payouts.js +23 -11
  68. package/lib/OwneraAPI/payment-adapter-api/vanilla/payouts.js.map +1 -1
  69. package/lib/OwneraAPI/payment-adapter-api/vanilla/update-balance.d.ts +1 -1
  70. package/lib/OwneraAPI/payment-adapter-api/vanilla/update-balance.js +3 -1
  71. package/lib/OwneraAPI/payment-adapter-api/vanilla/update-balance.js.map +1 -1
  72. package/lib/OwneraAPI/utils.d.ts +39 -0
  73. package/lib/OwneraAPI/utils.js +125 -73
  74. package/lib/OwneraAPI/utils.js.map +1 -1
  75. package/lib/core/__tests__/consoleLogger.test.d.ts +1 -0
  76. package/lib/core/__tests__/consoleLogger.test.js +269 -0
  77. package/lib/core/__tests__/consoleLogger.test.js.map +1 -0
  78. package/lib/core/__tests__/createAssetNameUniqueness.test.d.ts +1 -0
  79. package/lib/core/__tests__/createAssetNameUniqueness.test.js +95 -0
  80. package/lib/core/__tests__/createAssetNameUniqueness.test.js.map +1 -0
  81. package/lib/core/__tests__/custodianPrecedence.test.d.ts +1 -0
  82. package/lib/core/__tests__/custodianPrecedence.test.js +683 -0
  83. package/lib/core/__tests__/custodianPrecedence.test.js.map +1 -0
  84. package/lib/core/__tests__/executeIntentSettlementAssets.test.d.ts +1 -0
  85. package/lib/core/__tests__/executeIntentSettlementAssets.test.js +128 -0
  86. package/lib/core/__tests__/executeIntentSettlementAssets.test.js.map +1 -0
  87. package/lib/core/__tests__/logException.test.d.ts +1 -0
  88. package/lib/core/__tests__/logException.test.js +49 -0
  89. package/lib/core/__tests__/logException.test.js.map +1 -0
  90. package/lib/core/__tests__/multiplyDecimalStrings.test.d.ts +1 -0
  91. package/lib/core/__tests__/multiplyDecimalStrings.test.js +37 -0
  92. package/lib/core/__tests__/multiplyDecimalStrings.test.js.map +1 -0
  93. package/lib/core/__tests__/settlementExecutionAmount.test.d.ts +1 -0
  94. package/lib/core/__tests__/settlementExecutionAmount.test.js +300 -0
  95. package/lib/core/__tests__/settlementExecutionAmount.test.js.map +1 -0
  96. package/lib/core/asset.js +21 -27
  97. package/lib/core/asset.js.map +1 -1
  98. package/lib/core/custodian.d.ts +30 -0
  99. package/lib/core/custodian.js +49 -0
  100. package/lib/core/custodian.js.map +1 -0
  101. package/lib/core/index.d.ts +1 -0
  102. package/lib/core/index.js +3 -1
  103. package/lib/core/index.js.map +1 -1
  104. package/lib/core/intents/__tests__/intentErrorCode.test.d.ts +1 -0
  105. package/lib/core/intents/__tests__/intentErrorCode.test.js +111 -0
  106. package/lib/core/intents/__tests__/intentErrorCode.test.js.map +1 -0
  107. package/lib/core/intents/__tests__/intentHandleReject.test.d.ts +1 -0
  108. package/lib/core/intents/__tests__/intentHandleReject.test.js +50 -0
  109. package/lib/core/intents/__tests__/intentHandleReject.test.js.map +1 -0
  110. package/lib/core/intents/__tests__/loanIntentAdditionalAccounts.test.d.ts +1 -0
  111. package/lib/core/intents/__tests__/loanIntentAdditionalAccounts.test.js +185 -0
  112. package/lib/core/intents/__tests__/loanIntentAdditionalAccounts.test.js.map +1 -0
  113. package/lib/core/intents/__tests__/loanIntentCustodianPrecedence.test.d.ts +1 -0
  114. package/lib/core/intents/__tests__/loanIntentCustodianPrecedence.test.js +85 -0
  115. package/lib/core/intents/__tests__/loanIntentCustodianPrecedence.test.js.map +1 -0
  116. package/lib/core/intents/__tests__/loanIntentMetadata.test.d.ts +1 -0
  117. package/lib/core/intents/__tests__/loanIntentMetadata.test.js +81 -0
  118. package/lib/core/intents/__tests__/loanIntentMetadata.test.js.map +1 -0
  119. package/lib/core/intents/__tests__/moveIntentSegregatedAccounts.test.d.ts +1 -0
  120. package/lib/core/intents/__tests__/moveIntentSegregatedAccounts.test.js +203 -0
  121. package/lib/core/intents/__tests__/moveIntentSegregatedAccounts.test.js.map +1 -0
  122. package/lib/core/intents/createIntent/createIntent.js +4 -3
  123. package/lib/core/intents/createIntent/createIntent.js.map +1 -1
  124. package/lib/core/intents/createIntent/createMoveIntentReq.d.ts +27 -0
  125. package/lib/core/intents/createIntent/createMoveIntentReq.js +91 -0
  126. package/lib/core/intents/createIntent/createMoveIntentReq.js.map +1 -0
  127. package/lib/core/intents/createIntent/helpers.d.ts +32 -2
  128. package/lib/core/intents/createIntent/helpers.js +78 -1
  129. package/lib/core/intents/createIntent/helpers.js.map +1 -1
  130. package/lib/core/intents/createLoanIntent.js +64 -19
  131. package/lib/core/intents/createLoanIntent.js.map +1 -1
  132. package/lib/core/intents/executeIntent.js +102 -41
  133. package/lib/core/intents/executeIntent.js.map +1 -1
  134. package/lib/core/intents/executeLoanIntent.js +48 -23
  135. package/lib/core/intents/executeLoanIntent.js.map +1 -1
  136. package/lib/core/intents/executeMoveIntent.d.ts +19 -0
  137. package/lib/core/intents/executeMoveIntent.js +134 -0
  138. package/lib/core/intents/executeMoveIntent.js.map +1 -0
  139. package/lib/core/intents/executePrivateIntent.js +46 -13
  140. package/lib/core/intents/executePrivateIntent.js.map +1 -1
  141. package/lib/core/intents/executeRedemptionIntent.d.ts +1 -0
  142. package/lib/core/intents/executeRedemptionIntent.js +23 -9
  143. package/lib/core/intents/executeRedemptionIntent.js.map +1 -1
  144. package/lib/core/intents/executeTransferRequest.d.ts +5 -0
  145. package/lib/core/intents/executeTransferRequest.js +14 -3
  146. package/lib/core/intents/executeTransferRequest.js.map +1 -1
  147. package/lib/core/intents/getIntent.js +18 -0
  148. package/lib/core/intents/getIntent.js.map +1 -1
  149. package/lib/core/intents/index.d.ts +3 -0
  150. package/lib/core/intents/index.js +7 -1
  151. package/lib/core/intents/index.js.map +1 -1
  152. package/lib/core/intents/transfer.js +7 -2
  153. package/lib/core/intents/transfer.js.map +1 -1
  154. package/lib/core/intents/updateMoveIntentReq.d.ts +28 -0
  155. package/lib/core/intents/updateMoveIntentReq.js +94 -0
  156. package/lib/core/intents/updateMoveIntentReq.js.map +1 -0
  157. package/lib/core/intents/utils.d.ts +15 -7
  158. package/lib/core/intents/utils.js +36 -26
  159. package/lib/core/intents/utils.js.map +1 -1
  160. package/lib/core/logger.js +128 -22
  161. package/lib/core/logger.js.map +1 -1
  162. package/lib/core/normalizers/__tests__/normalizeOperationResponse.test.d.ts +1 -0
  163. package/lib/core/normalizers/__tests__/normalizeOperationResponse.test.js +60 -0
  164. package/lib/core/normalizers/__tests__/normalizeOperationResponse.test.js.map +1 -0
  165. package/lib/core/normalizers/normalizeOperationResponse.d.ts +6 -0
  166. package/lib/core/normalizers/normalizeOperationResponse.js +4 -5
  167. package/lib/core/normalizers/normalizeOperationResponse.js.map +1 -1
  168. package/lib/core/sdk.d.ts +4 -0
  169. package/lib/core/sdk.js +2 -2
  170. package/lib/core/sdk.js.map +1 -1
  171. package/lib/core/user.d.ts +2 -2
  172. package/lib/core/user.js +60 -2
  173. package/lib/core/user.js.map +1 -1
  174. package/lib/core/utils.d.ts +17 -1
  175. package/lib/core/utils.js +75 -16
  176. package/lib/core/utils.js.map +1 -1
  177. package/lib/index.d.ts +1 -0
  178. package/lib/index.js +3 -1
  179. package/lib/index.js.map +1 -1
  180. package/lib/types/Core/Intents.d.ts +243 -2
  181. package/lib/types/Core/Intents.js +9 -0
  182. package/lib/types/Core/Intents.js.map +1 -1
  183. package/lib/types/Core/OwneraAPI.d.ts +21 -1
  184. package/lib/types/Core/User.d.ts +62 -4
  185. package/lib/types/InvestorAccounts/InvestorAccounts.d.ts +171 -0
  186. package/lib/types/InvestorAccounts/InvestorAccounts.js +35 -0
  187. package/lib/types/InvestorAccounts/InvestorAccounts.js.map +1 -0
  188. package/lib/types/InvestorAccounts/index.d.ts +1 -0
  189. package/lib/types/InvestorAccounts/index.js +18 -0
  190. package/lib/types/InvestorAccounts/index.js.map +1 -0
  191. package/lib/types/Operations/Operations.d.ts +11 -0
  192. package/lib/types/Oss/Oss.d.ts +18 -1
  193. package/lib/types/Oss/OssSchemas.d.ts +89 -2
  194. package/lib/types/Oss/OssSchemas.js.map +1 -1
  195. package/lib/types/Oss/utils.d.ts +32 -0
  196. package/lib/types/PaymentAdapter/PaymentAdapter.d.ts +7 -0
  197. package/lib/types/PaymentAdapter/index.d.ts +33 -1
  198. package/lib/types/Profiles/Accounts.d.ts +32 -0
  199. package/lib/types/Profiles/Intents.d.ts +58 -3
  200. package/lib/types/Profiles/Profiles.d.ts +71 -2
  201. package/lib/types/Tokens/Tokens.d.ts +111 -1
  202. package/lib/types/index.d.ts +1 -0
  203. package/lib/types/index.js +1 -0
  204. package/lib/types/index.js.map +1 -1
  205. package/package.json +1 -1
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  const utils_1 = require("../../core/intents/utils");
24
24
  const utils_2 = require("../utils");
25
25
  const queryUtils_1 = require("./queryUtils");
26
+ const filterUtils_1 = require("./filterUtils");
26
27
  const queryValidation_1 = require("./queryValidation");
27
28
  const executeDynamicQueryWithExternal_1 = require("./executeDynamicQueryWithExternal");
28
29
  const externalQueryHandler_1 = require("./externalQueryHandler");
@@ -218,6 +219,36 @@ const loanIntentFragment = `
218
219
  }
219
220
  }
220
221
  `;
222
+ // Move intent read model: a source asset and the allowed destination assets.
223
+ // Both are top-level on the MoveIntent type (not wrapped in `asset`), matching
224
+ // the other intent fragments' shape — see MoveIntentSchemaOss.
225
+ //
226
+ // VERSION FLOOR: the custody-offered selections below (`sourceToSegregatedAccount`
227
+ // and `destinationAssets.fromSegregatedAccount`) require an OSS that carries
228
+ // oss #547. GraphQL rejects the *whole document* for an unknown field, so
229
+ // against an older OSS this fragment 500s every query that embeds
230
+ // intentDetailsFragment — not just move intents. Do not ship this SDK build to
231
+ // an environment whose OSS predates #547.
232
+ //
233
+ // `MoveDestination.ledgerIdentifier` is intentionally not selected: nothing in
234
+ // the SDK consumes it, and every added selection is another version coupling.
235
+ const moveIntentFragment = `
236
+ sourceAsset {
237
+ resourceId
238
+ }
239
+ destinationAssets {
240
+ resourceId
241
+ fromSegregatedAccount {
242
+ finId
243
+ orgId
244
+ }
245
+ }
246
+ sourceToSegregatedAccount {
247
+ finId
248
+ orgId
249
+ }
250
+ signaturePolicyType
251
+ `;
221
252
  const intentDetailsFragment = `
222
253
  ...on PrimarySale { ${primarySaleFragment} }
223
254
  ...on RedemptionIntent { ${redemptionIntentFragment} }
@@ -226,6 +257,7 @@ const intentDetailsFragment = `
226
257
  ...on PrivateOfferIntent { ${privateIntentFragment} }
227
258
  ...on RequestForTransferIntent { ${transferIntentFragment} }
228
259
  ...on LoanIntent { ${loanIntentFragment} }
260
+ ...on MoveIntent { ${moveIntentFragment} }
229
261
  `;
230
262
  // TODO remove comment when API stabilized
231
263
  const intentFragment = `
@@ -238,6 +270,11 @@ const intentFragment = `
238
270
  intent {
239
271
  ${intentDetailsFragment}
240
272
  }
273
+ customMetadata {
274
+ key
275
+ value
276
+ }
277
+ rejectReason
241
278
  `;
242
279
  // Data-layer fragments for the Financial Asset (assetHeader / pricing / referenceData feeds).
243
280
  const assetDataItemFragment = `
@@ -477,6 +514,11 @@ const planInstructionDetailsFragment = `
477
514
  amount
478
515
  }
479
516
  `;
517
+ // Filter values of the hand-written queries that used to be interpolated raw. Each value goes through
518
+ // String(), as the template literal did, so a missing id is still a lookup that matches nothing. Only
519
+ // the escaping is new. Values that were already escaped keep the strict formatFilterValue.
520
+ const gqlString = (value) => (0, filterUtils_1.formatFilterValue)(String(value));
521
+ const gqlStringList = (values) => (0, filterUtils_1.formatFilterArray)(Array.from(values, (v) => String(v)));
480
522
  // pagination fragments
481
523
  const pageInfoFragment = `
482
524
  pageInfo {
@@ -485,10 +527,6 @@ pageInfo {
485
527
  totalCount
486
528
  totalLeft
487
529
  }`;
488
- // this allows to get by default the 100 first results
489
- const paginateFragment = ({ after, limit, skip }) => `
490
- paginate: {limit: ${limit || 10000}, skip: ${skip || 0}, after: "${after || ''}"},
491
- `;
492
530
  // execution plan fragments
493
531
  const termFragment = `
494
532
  term {
@@ -903,8 +941,10 @@ const GQL_INTENT_TYPE_MAP = {
903
941
  BUYING: 'buyingIntent',
904
942
  SELLING: 'sellingIntent',
905
943
  LOAN: 'loanIntent',
944
+ REDEMPTION_INTENT: 'redemptionIntent',
906
945
  PRIVATE_OFFER: 'privateOfferIntent',
907
946
  REQUEST_FOR_TRANSFER: 'requestForTransferIntent',
947
+ MOVE_INTENT: 'moveIntent',
908
948
  };
909
949
  const normalizeAllowedIntents = (allowedIntents) => allowedIntents.map((intent) => GQL_INTENT_TYPE_MAP[intent] || intent);
910
950
  const mapAsset = (asset) => ({
@@ -929,9 +969,6 @@ const mapAsset = (asset) => ({
929
969
  financialIdentifier: asset.financialIdentifier,
930
970
  decimalPlaces: asset.decimalPlaces,
931
971
  });
932
- const stringifyArrayForQuery = (arr) => {
933
- return `[` + arr.map((s) => `\\"${s}\\"`) + `]`;
934
- };
935
972
  /**
936
973
  * Transforms raw GraphQL data nodes into API-formatted objects using schema path mappings
937
974
  * @param nodes - Raw GraphQL data nodes
@@ -1093,22 +1130,22 @@ query getAssets {
1093
1130
  assets
1094
1131
  (
1095
1132
  filter: [
1096
- ${!!(filter === null || filter === void 0 ? void 0 : filter.assetIds) ? `{ key: "id", operator: IN, value: "${stringifyArrayForQuery(filter.assetIds)}"},` : ''}
1097
- ${!!(filter === null || filter === void 0 ? void 0 : filter.name) ? `{ key: "name", operator: EQ, value: "${filter.name}" },` : ''}
1133
+ ${!!(filter === null || filter === void 0 ? void 0 : filter.assetIds) ? `{ key: "id", operator: IN, value: ${gqlStringList(filter.assetIds)}},` : ''}
1134
+ ${!!(filter === null || filter === void 0 ? void 0 : filter.name) ? `{ key: "name", operator: EQ, value: ${gqlString(filter.name)} },` : ''}
1098
1135
  ${Array.isArray(filter === null || filter === void 0 ? void 0 : filter.symbol)
1099
- ? `{ key: "symbol", operator: IN, value: "${stringifyArrayForQuery(filter.symbol)}" },`
1136
+ ? `{ key: "symbol", operator: IN, value: ${gqlStringList(filter.symbol)} },`
1100
1137
  : (filter === null || filter === void 0 ? void 0 : filter.symbol)
1101
- ? `{ key: "symbol", operator: EQ, value: "${filter.symbol}" },`
1138
+ ? `{ key: "symbol", operator: EQ, value: ${gqlString(filter.symbol)} },`
1102
1139
  : ''}
1103
- ${!!(filter === null || filter === void 0 ? void 0 : filter.excludeType) ? `{ key: "type", operator: NEQ, value: "${filter.excludeType}" },` : ''}
1140
+ ${!!(filter === null || filter === void 0 ? void 0 : filter.excludeType) ? `{ key: "type", operator: NEQ, value: ${gqlString(filter.excludeType)} },` : ''}
1104
1141
  ${Array.isArray(filter === null || filter === void 0 ? void 0 : filter.type)
1105
- ? `{ key: "type", operator: IN, value: "${stringifyArrayForQuery(filter.type)}" },`
1142
+ ? `{ key: "type", operator: IN, value: ${gqlStringList(filter.type)} },`
1106
1143
  : (filter === null || filter === void 0 ? void 0 : filter.type)
1107
- ? `{ key: "type", operator: EQ, value: "${filter.type}" },`
1144
+ ? `{ key: "type", operator: EQ, value: ${gqlString(filter.type)} },`
1108
1145
  : ''}
1109
1146
  ],
1110
- ${paginateFragment({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })}
1111
- orderBy: {field: ${((_a = filter === null || filter === void 0 ? void 0 : filter.orderBy) === null || _a === void 0 ? void 0 : _a.field) || 'NAME'}, direction: ${((_b = filter === null || filter === void 0 ? void 0 : filter.orderBy) === null || _b === void 0 ? void 0 : _b.direction) || 'ASC'}},
1147
+ ${(0, queryUtils_1.paginateFragment)({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })}
1148
+ orderBy: {field: ${(0, filterUtils_1.formatEnumValue)(((_a = filter === null || filter === void 0 ? void 0 : filter.orderBy) === null || _a === void 0 ? void 0 : _a.field) || 'NAME')}, direction: ${(0, filterUtils_1.formatEnumValue)(((_b = filter === null || filter === void 0 ? void 0 : filter.orderBy) === null || _b === void 0 ? void 0 : _b.direction) || 'ASC')}},
1112
1149
  )
1113
1150
  {
1114
1151
  nodes {
@@ -1154,9 +1191,9 @@ query financialAssets {
1154
1191
  financialAssets
1155
1192
  (
1156
1193
  filter: [
1157
- ${!!(filter === null || filter === void 0 ? void 0 : filter.identifierValues) ? `{ key: "identifierValue", operator: IN, value: "${stringifyArrayForQuery(filter.identifierValues)}" },` : ''}
1194
+ ${!!(filter === null || filter === void 0 ? void 0 : filter.identifierValues) ? `{ key: "identifierValue", operator: IN, value: ${gqlStringList(filter.identifierValues)} },` : ''}
1158
1195
  ],
1159
- ${paginateFragment({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })}
1196
+ ${(0, queryUtils_1.paginateFragment)({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })}
1160
1197
  )
1161
1198
  {
1162
1199
  nodes {
@@ -1228,10 +1265,10 @@ query assetDatas {
1228
1265
  assetDatas
1229
1266
  (
1230
1267
  filter: [
1231
- ${!!(filter === null || filter === void 0 ? void 0 : filter.identifierValue) ? `{ key: "identifierValue", operator: EQ, value: "${filter.identifierValue}" },` : ''}
1232
- ${!!(filter === null || filter === void 0 ? void 0 : filter.dataType) ? `{ key: "dataType", operator: EQ, value: "${filter.dataType}" },` : ''}
1268
+ ${!!(filter === null || filter === void 0 ? void 0 : filter.identifierValue) ? `{ key: "identifierValue", operator: EQ, value: ${gqlString(filter.identifierValue)} },` : ''}
1269
+ ${!!(filter === null || filter === void 0 ? void 0 : filter.dataType) ? `{ key: "dataType", operator: EQ, value: ${gqlString(filter.dataType)} },` : ''}
1233
1270
  ],
1234
- ${paginateFragment({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })}
1271
+ ${(0, queryUtils_1.paginateFragment)({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })}
1235
1272
  )
1236
1273
  {
1237
1274
  nodes {
@@ -1275,12 +1312,14 @@ query assetDatas {
1275
1312
  var _a, _b;
1276
1313
  const { retry, filter } = request;
1277
1314
  const intentFilterFragments = [
1278
- `{ key: "type", operator: IN, value: "${stringifyArrayForQuery(filter.intentTypes)}" }`,
1279
- filter.intentStatus ? `{ key: "status", operator: EQ, value: "${filter.intentStatus}" }` : '',
1315
+ `{ key: "type", operator: IN, value: ${gqlStringList(filter.intentTypes)} }`,
1316
+ filter.intentStatus ? `{ key: "status", operator: EQ, value: ${gqlString(filter.intentStatus)} }` : '',
1280
1317
  ]
1281
1318
  .filter(Boolean)
1282
1319
  .join(',');
1283
- const assetFilterFragments = [(filter === null || filter === void 0 ? void 0 : filter.type) ? `{ key: "type", operator: EQ, value: "${filter.type}" }` : '']
1320
+ const assetFilterFragments = [
1321
+ (filter === null || filter === void 0 ? void 0 : filter.type) ? `{ key: "type", operator: EQ, value: ${gqlString(filter.type)} }` : '',
1322
+ ]
1284
1323
  .filter(Boolean)
1285
1324
  .join(',');
1286
1325
  const query = `
@@ -1288,8 +1327,8 @@ query assetDatas {
1288
1327
  assets
1289
1328
  (
1290
1329
  filter: [${assetFilterFragments}],
1291
- ${paginateFragment({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })}
1292
- orderBy: {field: ${((_a = filter === null || filter === void 0 ? void 0 : filter.orderBy) === null || _a === void 0 ? void 0 : _a.field) || 'NAME'}, direction: ${((_b = filter === null || filter === void 0 ? void 0 : filter.orderBy) === null || _b === void 0 ? void 0 : _b.direction) || 'ASC'}},
1330
+ ${(0, queryUtils_1.paginateFragment)({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })}
1331
+ orderBy: {field: ${(0, filterUtils_1.formatEnumValue)(((_a = filter === null || filter === void 0 ? void 0 : filter.orderBy) === null || _a === void 0 ? void 0 : _a.field) || 'NAME')}, direction: ${(0, filterUtils_1.formatEnumValue)(((_b = filter === null || filter === void 0 ? void 0 : filter.orderBy) === null || _b === void 0 ? void 0 : _b.direction) || 'ASC')}},
1293
1332
  )
1294
1333
  {
1295
1334
  nodes {
@@ -1371,8 +1410,8 @@ query assetDatas {
1371
1410
  }),
1372
1411
  getAssetsWithSpecificIntents: (request) => __awaiter(void 0, void 0, void 0, function* () {
1373
1412
  const { assetIds, intentIds, fields, assetFields } = request;
1374
- const assetFilterFragment = `{ key: "id", operator: IN, value: "${stringifyArrayForQuery(assetIds)}" }`;
1375
- const intentFilterFragment = `{ key: "id", operator: IN, value: "${stringifyArrayForQuery(intentIds)}" }`;
1413
+ const assetFilterFragment = `{ key: "id", operator: IN, value: ${gqlStringList(assetIds)} }`;
1414
+ const intentFilterFragment = `{ key: "id", operator: IN, value: ${gqlStringList(intentIds)} }`;
1376
1415
  const query = `
1377
1416
  query getAssetsWithSpecificIntents {
1378
1417
  assets(filter: [${assetFilterFragment}]) {
@@ -1414,11 +1453,11 @@ query assetDatas {
1414
1453
  const { assetId, intentId } = request;
1415
1454
  const query = `
1416
1455
  query getLoanIntent {
1417
- assets (filter: {operator: EQ, key: "id", value: "${assetId}"}) {
1456
+ assets (filter: {operator: EQ, key: "id", value: ${gqlString(assetId)}}) {
1418
1457
  nodes {
1419
1458
  id
1420
1459
  name
1421
- intents (filter: {operator: EQ, key: "id", value: "${intentId}"}) {
1460
+ intents (filter: {operator: EQ, key: "id", value: ${gqlString(intentId)}}) {
1422
1461
  nodes {
1423
1462
  ${intentFragment}
1424
1463
  }
@@ -1506,11 +1545,11 @@ query assetDatas {
1506
1545
  const query = `
1507
1546
  query getIssuerAssets {
1508
1547
  issuers (
1509
- filter:{key:"id", operator:EQ, value: "${issuerId}"},
1548
+ filter:{key:"id", operator:EQ, value: ${gqlString(issuerId)}},
1510
1549
  ) {
1511
1550
  nodes {
1512
1551
  assets (
1513
- ${paginateFragment({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })}
1552
+ ${(0, queryUtils_1.paginateFragment)({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })}
1514
1553
  ) {
1515
1554
  nodes {
1516
1555
  ${assetFragment}
@@ -1552,7 +1591,7 @@ query assetDatas {
1552
1591
  getOutbox: (request) => __awaiter(void 0, void 0, void 0, function* () {
1553
1592
  const query = `
1554
1593
  query getOutbox {
1555
- issuers (filter: {key: "id", operator: EQ, value: "${request.userId}"}){
1594
+ issuers (filter: {key: "id", operator: EQ, value: ${gqlString(request.userId)}}){
1556
1595
  nodes {
1557
1596
  id
1558
1597
  outbox {
@@ -1618,6 +1657,8 @@ query getAllOutbox {
1618
1657
  // model - certificate
1619
1658
  getProfileCertificates: (request) => __awaiter(void 0, void 0, void 0, function* () {
1620
1659
  const { profileId, profileType } = request;
1660
+ // profileType is written unquoted as the root field name
1661
+ (0, queryValidation_1.validateGraphQLTypeName)(profileType);
1621
1662
  const query = `
1622
1663
  query getProfileCertificates ($profileId: String!) {
1623
1664
  ${profileType} (filter: { key: "id", operator: EQ, value: $profileId }) {
@@ -1734,9 +1775,9 @@ query getUsers {
1734
1775
  users
1735
1776
  (
1736
1777
  filter: [
1737
- ${userIds.length > 0 ? `{ key: "id", operator: IN, value: "${stringifyArrayForQuery(userIds)}"},` : ''}
1778
+ ${userIds.length > 0 ? `{ key: "id", operator: IN, value: ${gqlStringList(userIds)}},` : ''}
1738
1779
  ],
1739
- ${paginateFragment({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })}
1780
+ ${(0, queryUtils_1.paginateFragment)({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })}
1740
1781
  )
1741
1782
  {
1742
1783
  ${userFragment}
@@ -1800,6 +1841,62 @@ query getUsers {
1800
1841
  pageInfo: response.users.pageInfo,
1801
1842
  };
1802
1843
  }),
1844
+ // model - users / investor network accounts
1845
+ getUserNetworkAccounts: (request) => __awaiter(void 0, void 0, void 0, function* () {
1846
+ var _a, _b, _c;
1847
+ const { userId, organizationId, assetId, retry } = request;
1848
+ // Deliberately a standalone query: widening the shared userFragment with
1849
+ // `networkAccounts` would hard-fail getUsers against routers that predate
1850
+ // the field (OSS validates strictly — unknown field = query error).
1851
+ //
1852
+ // `account` is a GraphQL UNION (WalletAccount | Caip10Account |
1853
+ // CustodialAccount) — plain field selection is rejected by OSS, so the
1854
+ // variants are selected via inline fragments discriminated by __typename.
1855
+ //
1856
+ // The org/asset narrowing happens client-side rather than via the nested
1857
+ // networkAccounts(filter:) argument: the per-investor list is small and
1858
+ // filtering here avoids coupling to the read model's filter keys.
1859
+ const query = `
1860
+ query getUserNetworkAccounts {
1861
+ users (filter: [{ key: "id", operator: EQ, value: ${(0, filterUtils_1.formatFilterValue)(userId)} }]) {
1862
+ nodes {
1863
+ id
1864
+ networkAccounts {
1865
+ id
1866
+ organizationId
1867
+ assetId
1868
+ account {
1869
+ __typename
1870
+ ... on WalletAccount { type address }
1871
+ ... on Caip10Account { network address }
1872
+ ... on CustodialAccount { provider vaultAccountId assetId }
1873
+ }
1874
+ }
1875
+ }
1876
+ }
1877
+ }
1878
+ `;
1879
+ const readyConditions = {
1880
+ match: (res) => {
1881
+ var _a, _b, _c, _d;
1882
+ if (!retry)
1883
+ return true;
1884
+ return ((_d = (_c = (_b = (_a = res.users) === null || _a === void 0 ? void 0 : _a.nodes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.networkAccounts) === null || _d === void 0 ? void 0 : _d.length) > 0;
1885
+ },
1886
+ name: 'getUserNetworkAccounts',
1887
+ data: request,
1888
+ };
1889
+ const response = yield (0, utils_2.ossQuery)(client, logger, query, readyConditions);
1890
+ const user = (_b = (_a = response.users) === null || _a === void 0 ? void 0 : _a.nodes) === null || _b === void 0 ? void 0 : _b[0];
1891
+ if (!user) {
1892
+ throw {
1893
+ code: 404,
1894
+ name: 'NoMatchingOwner',
1895
+ message: `No owner found by id: ${userId}`,
1896
+ };
1897
+ }
1898
+ return ((_c = user.networkAccounts) !== null && _c !== void 0 ? _c : []).filter((account) => (!organizationId || account.organizationId === organizationId) && (!assetId || account.assetId === assetId));
1899
+ }),
1803
1900
  getUserIdByPublicKey: (request) => __awaiter(void 0, void 0, void 0, function* () {
1804
1901
  const { publicKey } = request;
1805
1902
  const query = `
@@ -1807,7 +1904,7 @@ query getUsers {
1807
1904
  organizations {
1808
1905
  nodes {
1809
1906
  id
1810
- users (filter: {key:"finIds", operator:CONTAINS, value:"${publicKey}"}) {
1907
+ users (filter: {key:"finIds", operator:CONTAINS, value:${gqlString(publicKey)}}) {
1811
1908
  nodes {
1812
1909
  id
1813
1910
  }
@@ -1837,7 +1934,7 @@ query getUsers {
1837
1934
  var _a, _b;
1838
1935
  const query = `
1839
1936
  query getUserHoldings {
1840
- users (filter:{key:"id",operator:EQ,value:"${request.userId}"}) {
1937
+ users (filter:{key:"id",operator:EQ,value:${gqlString(request.userId)}}) {
1841
1938
  nodes {
1842
1939
  holdings {
1843
1940
  nodes {
@@ -1883,7 +1980,7 @@ query getUserHoldings {
1883
1980
  const query = `
1884
1981
  query getAllUsersHoldings {
1885
1982
  users
1886
- (${paginateFragment({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })})
1983
+ (${(0, queryUtils_1.paginateFragment)({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })})
1887
1984
  {
1888
1985
  nodes {
1889
1986
  id
@@ -1920,7 +2017,7 @@ query getAllUsersHoldings {
1920
2017
  getInbox: (request) => __awaiter(void 0, void 0, void 0, function* () {
1921
2018
  const query = `
1922
2019
  query getUserInbox {
1923
- users (filter: {key: "id", operator: EQ, value: "${request.userId}"}) {
2020
+ users (filter: {key: "id", operator: EQ, value: ${gqlString(request.userId)}}) {
1924
2021
  nodes {
1925
2022
  id
1926
2023
  inbox {
@@ -1944,7 +2041,7 @@ query getUserInbox {
1944
2041
  var _a;
1945
2042
  const query = `
1946
2043
  query getReceipt {
1947
- receipts (filter: {key: "id", operator: EQ, value: "${request.receiptId}"}) {
2044
+ receipts (filter: {key: "id", operator: EQ, value: ${gqlString(request.receiptId)}}) {
1948
2045
  nodes {
1949
2046
  ${receiptFragment}
1950
2047
  }
@@ -1971,7 +2068,7 @@ query getReceipt {
1971
2068
  var _a;
1972
2069
  const query = `
1973
2070
  query getReceipt {
1974
- receipts (filter: {key: "operationId", operator: EQ, value: "${request.operationId}"}) {
2071
+ receipts (filter: {key: "operationId", operator: EQ, value: ${gqlString(request.operationId)}}) {
1975
2072
  nodes {
1976
2073
  ${receiptFragment}
1977
2074
  }
@@ -2013,7 +2110,7 @@ query getReceipt {
2013
2110
  const query = `
2014
2111
  query getReceiptsByAsset {
2015
2112
  receipts
2016
- (${paginateFragment({ after: cursor, limit: 10000, skip: 0 })})
2113
+ (${(0, queryUtils_1.paginateFragment)({ after: cursor, limit: 10000, skip: 0 })})
2017
2114
  {
2018
2115
  nodes {
2019
2116
  ${receiptFragment}
@@ -2061,8 +2158,8 @@ query getReceiptsByAsset {
2061
2158
  const destination = fetchDst
2062
2159
  ? `
2063
2160
  destination: receipts (
2064
- filter: {key: "destination", operator: EQ, value: "${request.userId}"},
2065
- ${paginateFragment({ after: dstCursor, limit: 10000, skip: 0 })}
2161
+ filter: {key: "destination", operator: EQ, value: ${gqlString(request.userId)}},
2162
+ ${(0, queryUtils_1.paginateFragment)({ after: dstCursor, limit: 10000, skip: 0 })}
2066
2163
  ) {
2067
2164
  nodes {
2068
2165
  ${receiptFragment}
@@ -2073,8 +2170,8 @@ query getReceiptsByAsset {
2073
2170
  const source = fetchSrc
2074
2171
  ? `
2075
2172
  source: receipts (
2076
- filter: {key: "source", operator: EQ, value: "${request.userId}"},
2077
- ${paginateFragment({ after: srcCursor, limit: 10000, skip: 0 })}
2173
+ filter: {key: "source", operator: EQ, value: ${gqlString(request.userId)}},
2174
+ ${(0, queryUtils_1.paginateFragment)({ after: srcCursor, limit: 10000, skip: 0 })}
2078
2175
  ) {
2079
2176
  nodes {
2080
2177
  ${receiptFragment}
@@ -2115,7 +2212,7 @@ query getReceiptsByUser {
2115
2212
  var _a;
2116
2213
  const query = `
2117
2214
  query getReceipt {
2118
- receipts (filter: {key: "operationId", operator: EQ, value: "${request.operationId}"}) {
2215
+ receipts (filter: {key: "operationId", operator: EQ, value: ${gqlString(request.operationId)}}) {
2119
2216
  nodes {
2120
2217
  ${receiptFragment}
2121
2218
  }
@@ -2143,7 +2240,7 @@ query getReceipt {
2143
2240
  var _a;
2144
2241
  const query = `
2145
2242
  query getReceiptsFromTimestamp {
2146
- receipts (filter: {key: "timestamp", operator: GT, value: "${request.timestamp}"}) {
2243
+ receipts (filter: {key: "timestamp", operator: GT, value: ${gqlString(request.timestamp)}}) {
2147
2244
  nodes {
2148
2245
  ${receiptFragment}
2149
2246
  }
@@ -2166,7 +2263,7 @@ query getReceiptsFromTimestamp {
2166
2263
  const query = `
2167
2264
  query getExecutionPlanStatus {
2168
2265
  plans
2169
- (filter: { key:"id", operator:EQ, value: "${request.planId}" })
2266
+ (filter: { key:"id", operator:EQ, value: ${gqlString(request.planId)} })
2170
2267
  {
2171
2268
  nodes {
2172
2269
  id
@@ -2191,31 +2288,49 @@ query getExecutionPlanStatus {
2191
2288
  }),
2192
2289
  getAllExecutionPlans: (request) => __awaiter(void 0, void 0, void 0, function* () {
2193
2290
  const { filter } = request;
2194
- const { id, status, creationDate, lastModified, sortOrder, sortField } = filter || {};
2291
+ const { id, status, creationDate, lastModified, sortOrder, sortField, investorId, assetId } = filter || {};
2195
2292
  let creationDateFilter = '';
2196
2293
  let lastModifiedFilter = '';
2197
2294
  if (creationDate) {
2198
2295
  if (typeof creationDate === 'object') {
2199
2296
  creationDateFilter = `
2200
- {key: "creationTimestamp", operator:GTE, value: "${creationDate.start}"},
2201
- {key: "creationTimestamp", operator:LTE, value: "${creationDate.end}"},
2297
+ {key: "creationTimestamp", operator:GTE, value: ${gqlString(creationDate.start)}},
2298
+ {key: "creationTimestamp", operator:LTE, value: ${gqlString(creationDate.end)}},
2202
2299
  `;
2203
2300
  }
2204
2301
  else {
2205
2302
  creationDateFilter = `
2206
- {key: "creationTimestamp", operator:GTE, value: "${creationDate}"},
2303
+ {key: "creationTimestamp", operator:GTE, value: ${gqlString(creationDate)}},
2207
2304
  `;
2208
2305
  }
2209
2306
  }
2210
2307
  if (lastModified) {
2211
- lastModifiedFilter = `{key: "lastModified", operator:GT, value: "${lastModified}"},`;
2212
- }
2308
+ lastModifiedFilter = `{key: "lastModified", operator:GT, value: ${gqlString(lastModified)}},`;
2309
+ }
2310
+ // ExecutionPlan.investorIds / assetIds are LIST fields (OSS >= v0.28.6, owneraio/oss#590)
2311
+ // holding every id from both the sending and the receiving side. Each filter takes a
2312
+ // single id and uses CONTAINS, which OSS evaluates on a list as exact, case-sensitive
2313
+ // membership of one element. IN / EQ / NEQ are rejected on list fields.
2314
+ // assetIds is the ASSET leg only; the settlement leg lives on settlementAssetIds and
2315
+ // would need a `where: { or: [...] }` expression, which we do not emit.
2316
+ // A blank value is treated as "no filter" and never emitted: a blank CONTAINS predicate
2317
+ // would match no plan, which is not what an empty filter means.
2318
+ const trimmedInvestorId = investorId === null || investorId === void 0 ? void 0 : investorId.trim();
2319
+ const trimmedAssetId = assetId === null || assetId === void 0 ? void 0 : assetId.trim();
2320
+ const investorIdFilter = trimmedInvestorId
2321
+ ? `{key: "investorIds", operator:CONTAINS, value: ${(0, filterUtils_1.formatFilterValue)(trimmedInvestorId)}},`
2322
+ : '';
2323
+ const assetIdFilter = trimmedAssetId
2324
+ ? `{key: "assetIds", operator:CONTAINS, value: ${(0, filterUtils_1.formatFilterValue)(trimmedAssetId)}},`
2325
+ : '';
2213
2326
  const filters = `
2214
2327
  filter: [
2215
- ${!!id ? `{key:"id",operator:EQ,value:"${id}"},` : ''}
2216
- ${!!status ? `{key:"status",operator:IN,value:"[${status.map((st) => `\\"${st}\\"`)}]"},` : ''}
2328
+ ${!!id ? `{key:"id",operator:EQ,value:${(0, filterUtils_1.formatFilterValue)(id)}},` : ''}
2329
+ ${!!status ? `{key:"status",operator:IN,value:${gqlStringList(status)}},` : ''}
2217
2330
  ${creationDateFilter}
2218
2331
  ${lastModifiedFilter}
2332
+ ${investorIdFilter}
2333
+ ${assetIdFilter}
2219
2334
  ]
2220
2335
  `;
2221
2336
  let orderBy = `orderBy:{field: CREATION_TIMESTAMP, direction: DESC}`;
@@ -2224,13 +2339,13 @@ query getExecutionPlanStatus {
2224
2339
  .split(/(?=[A-Z][a-z])/)
2225
2340
  .join('_')
2226
2341
  .toUpperCase();
2227
- orderBy = `orderBy:{field: ${field}, direction: ${(sortOrder === null || sortOrder === void 0 ? void 0 : sortOrder.toUpperCase()) || 'DESC'}}`;
2342
+ orderBy = `orderBy:{field: ${(0, filterUtils_1.formatEnumValue)(field)}, direction: ${(0, filterUtils_1.formatEnumValue)((sortOrder === null || sortOrder === void 0 ? void 0 : sortOrder.toUpperCase()) || 'DESC')}}`;
2228
2343
  }
2229
2344
  const query = `
2230
2345
  query getExecutionPlans {
2231
2346
  plans
2232
2347
  (${filters},
2233
- ${paginateFragment({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })}
2348
+ ${(0, queryUtils_1.paginateFragment)({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })}
2234
2349
  ${orderBy})
2235
2350
  {
2236
2351
  nodes {
@@ -2290,7 +2405,7 @@ query getExecutionPlans {
2290
2405
  };
2291
2406
  }
2292
2407
  const filters = `
2293
- (filter: [{key:"id",operator:EQ,value:"${id}"}, ])`;
2408
+ (filter: [{key:"id",operator:EQ,value:${gqlString(id)}}, ])`;
2294
2409
  const query = `
2295
2410
  query getExecutionPlans {
2296
2411
  plans
@@ -2481,7 +2596,7 @@ query getExecutionPlans {
2481
2596
  const { assetId, intentId } = request;
2482
2597
  const query = `
2483
2598
  query getIntentById {
2484
- assets (filter: {operator: EQ, key: "id", value: "${assetId}"}) {
2599
+ assets (filter: {operator: EQ, key: "id", value: ${gqlString(assetId)}}) {
2485
2600
  nodes {
2486
2601
  id
2487
2602
  name
@@ -2501,7 +2616,7 @@ query getExecutionPlans {
2501
2616
  ${certificateFragment}
2502
2617
  }
2503
2618
  }
2504
- intents (filter: {operator: EQ, key: "id", value: "${intentId}"}) {
2619
+ intents (filter: {operator: EQ, key: "id", value: ${gqlString(intentId)}}) {
2505
2620
  nodes {
2506
2621
  ${intentFragment}
2507
2622
  }
@@ -2726,36 +2841,34 @@ query getApproverConfigs {
2726
2841
  if (creationDate) {
2727
2842
  if (typeof creationDate === 'object') {
2728
2843
  creationDateFilter = `
2729
- {key: "creationTimestamp", operator:GTE, value: "${creationDate.start}"},
2730
- {key: "creationTimestamp", operator:LTE, value: "${creationDate.end}"},
2844
+ {key: "creationTimestamp", operator:GTE, value: ${gqlString(creationDate.start)}},
2845
+ {key: "creationTimestamp", operator:LTE, value: ${gqlString(creationDate.end)}},
2731
2846
  `;
2732
2847
  }
2733
2848
  else {
2734
- creationDateFilter = `{key: "creationTimestamp", operator:GTE, value: "${creationDate}"},`;
2849
+ creationDateFilter = `{key: "creationTimestamp", operator:GTE, value: ${gqlString(creationDate)}},`;
2735
2850
  }
2736
2851
  }
2737
2852
  const filters = `
2738
2853
  filter: [
2739
- ${id ? `{key:"id",operator:EQ,value:"${id}"},` : ''}
2740
- ${name ? `{key:"name",operator:EQ,value:"${name}"},` : ''}
2741
- ${referenceId ? `{key:"reference_id",operator:EQ,value:"${referenceId}"},` : ''}
2742
- ${status && status.length
2743
- ? `{key:"status",operator:IN,value:"[${status.map((s) => `\\"${s}\\"`).join(',')}]"},`
2744
- : ''}
2854
+ ${id ? `{key:"id",operator:EQ,value:${gqlString(id)}},` : ''}
2855
+ ${name ? `{key:"name",operator:EQ,value:${gqlString(name)}},` : ''}
2856
+ ${referenceId ? `{key:"reference_id",operator:EQ,value:${gqlString(referenceId)}},` : ''}
2857
+ ${status && status.length ? `{key:"status",operator:IN,value:${gqlStringList(status)}},` : ''}
2745
2858
  ${healthStatus && healthStatus.length
2746
- ? `{key:"health.status",operator:IN,value:"[${healthStatus.map((s) => `\\"${s}\\"`).join(',')}]"},`
2859
+ ? `{key:"health.status",operator:IN,value:${gqlStringList(healthStatus)}},`
2747
2860
  : ''}
2748
2861
  ${creationDateFilter}
2749
2862
  ]
2750
2863
  `;
2751
2864
  const orderBy = sortField
2752
- ? `orderBy:{field: ${sortField}, direction: ${sortOrder || 'DESC'}}`
2865
+ ? `orderBy:{field: ${(0, filterUtils_1.formatEnumValue)(sortField)}, direction: ${(0, filterUtils_1.formatEnumValue)(sortOrder || 'DESC')}}`
2753
2866
  : `orderBy:{field: CREATION_TIMESTAMP, direction: DESC}`;
2754
2867
  const query = `
2755
2868
  query getWorkflows {
2756
2869
  workflows
2757
2870
  (${filters},
2758
- ${paginateFragment({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })}
2871
+ ${(0, queryUtils_1.paginateFragment)({ after: filter === null || filter === void 0 ? void 0 : filter.after, limit: filter === null || filter === void 0 ? void 0 : filter.limit, skip: filter === null || filter === void 0 ? void 0 : filter.skip })}
2759
2872
  ${orderBy})
2760
2873
  {
2761
2874
  nodes {
@@ -2785,7 +2898,7 @@ query getWorkflows {
2785
2898
  const query = `
2786
2899
  query getWorkflowById {
2787
2900
  workflows
2788
- (filter: [{key:"id",operator:EQ,value:"${id}"}])
2901
+ (filter: [{key:"id",operator:EQ,value:${gqlString(id)}}])
2789
2902
  {
2790
2903
  nodes {
2791
2904
  ${routerWorkflowFragment}