@owneraio/finp2p-sdk-js 0.28.26 → 0.29.0
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/README.md +93 -2
- package/lib/OwneraAPI/__tests__/apiErrorShape.test.d.ts +1 -0
- package/lib/OwneraAPI/__tests__/apiErrorShape.test.js +264 -0
- package/lib/OwneraAPI/__tests__/apiErrorShape.test.js.map +1 -0
- package/lib/OwneraAPI/__tests__/utils.test.d.ts +1 -0
- package/lib/OwneraAPI/__tests__/utils.test.js +82 -0
- package/lib/OwneraAPI/__tests__/utils.test.js.map +1 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/agreements.test.d.ts +1 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/agreements.test.js +149 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/agreements.test.js.map +1 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/approvalsConfig.test.js +5 -12
- package/lib/OwneraAPI/finp2p-node-api/__tests__/approvalsConfig.test.js.map +1 -1
- package/lib/OwneraAPI/finp2p-node-api/__tests__/collateral.test.d.ts +1 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/collateral.test.js +502 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/collateral.test.js.map +1 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/createIntentMetadata.test.d.ts +1 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/createIntentMetadata.test.js +56 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/createIntentMetadata.test.js.map +1 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/dryRunExecute.test.d.ts +1 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/dryRunExecute.test.js +75 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/dryRunExecute.test.js.map +1 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/pathEncoding.test.d.ts +1 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/pathEncoding.test.js +348 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/pathEncoding.test.js.map +1 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/rejectIntent.test.d.ts +1 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/rejectIntent.test.js +97 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/rejectIntent.test.js.map +1 -0
- package/lib/OwneraAPI/finp2p-node-api/agreements.d.ts +8 -0
- package/lib/OwneraAPI/finp2p-node-api/agreements.js +31 -0
- package/lib/OwneraAPI/finp2p-node-api/agreements.js.map +1 -0
- package/lib/OwneraAPI/finp2p-node-api/certificates.js +15 -6
- package/lib/OwneraAPI/finp2p-node-api/certificates.js.map +1 -1
- package/lib/OwneraAPI/finp2p-node-api/collateral.d.ts +16 -0
- package/lib/OwneraAPI/finp2p-node-api/collateral.js +131 -0
- package/lib/OwneraAPI/finp2p-node-api/collateral.js.map +1 -0
- package/lib/OwneraAPI/finp2p-node-api/custodies.js +13 -2
- package/lib/OwneraAPI/finp2p-node-api/custodies.js.map +1 -1
- package/lib/OwneraAPI/finp2p-node-api/documents.js +22 -9
- package/lib/OwneraAPI/finp2p-node-api/documents.js.map +1 -1
- package/lib/OwneraAPI/finp2p-node-api/investorAccounts.d.ts +13 -0
- package/lib/OwneraAPI/finp2p-node-api/investorAccounts.js +71 -0
- package/lib/OwneraAPI/finp2p-node-api/investorAccounts.js.map +1 -0
- package/lib/OwneraAPI/finp2p-node-api/ledgers.js +13 -2
- package/lib/OwneraAPI/finp2p-node-api/ledgers.js.map +1 -1
- package/lib/OwneraAPI/finp2p-node-api/messages.js +12 -3
- package/lib/OwneraAPI/finp2p-node-api/messages.js.map +1 -1
- package/lib/OwneraAPI/finp2p-node-api/operations.js +37 -15
- package/lib/OwneraAPI/finp2p-node-api/operations.js.map +1 -1
- package/lib/OwneraAPI/finp2p-node-api/policies.js +14 -5
- package/lib/OwneraAPI/finp2p-node-api/policies.js.map +1 -1
- package/lib/OwneraAPI/finp2p-node-api/profiles.js +82 -45
- package/lib/OwneraAPI/finp2p-node-api/profiles.js.map +1 -1
- package/lib/OwneraAPI/finp2p-node-api/tokens.js +20 -0
- package/lib/OwneraAPI/finp2p-node-api/tokens.js.map +1 -1
- package/lib/OwneraAPI/index.js +6 -0
- package/lib/OwneraAPI/index.js.map +1 -1
- package/lib/OwneraAPI/oss-api/__tests__/buildGraphQLQuery.test.d.ts +1 -0
- package/lib/OwneraAPI/oss-api/__tests__/buildGraphQLQuery.test.js +253 -0
- package/lib/OwneraAPI/oss-api/__tests__/buildGraphQLQuery.test.js.map +1 -0
- package/lib/OwneraAPI/oss-api/__tests__/filterUtils.test.d.ts +1 -0
- package/lib/OwneraAPI/oss-api/__tests__/filterUtils.test.js +15 -0
- package/lib/OwneraAPI/oss-api/__tests__/filterUtils.test.js.map +1 -0
- package/lib/OwneraAPI/oss-api/__tests__/getAgreements.test.d.ts +1 -0
- package/lib/OwneraAPI/oss-api/__tests__/getAgreements.test.js +175 -0
- package/lib/OwneraAPI/oss-api/__tests__/getAgreements.test.js.map +1 -0
- package/lib/OwneraAPI/oss-api/__tests__/getAllExecutionPlans.test.js +52 -0
- package/lib/OwneraAPI/oss-api/__tests__/getAllExecutionPlans.test.js.map +1 -1
- package/lib/OwneraAPI/oss-api/__tests__/getCollateralAgreements.test.d.ts +1 -0
- package/lib/OwneraAPI/oss-api/__tests__/getCollateralAgreements.test.js +321 -0
- package/lib/OwneraAPI/oss-api/__tests__/getCollateralAgreements.test.js.map +1 -0
- package/lib/OwneraAPI/oss-api/__tests__/getCollateralReports.test.d.ts +1 -0
- package/lib/OwneraAPI/oss-api/__tests__/getCollateralReports.test.js +152 -0
- package/lib/OwneraAPI/oss-api/__tests__/getCollateralReports.test.js.map +1 -0
- package/lib/OwneraAPI/oss-api/__tests__/ossQueryEscaping.test.d.ts +1 -0
- package/lib/OwneraAPI/oss-api/__tests__/ossQueryEscaping.test.js +347 -0
- package/lib/OwneraAPI/oss-api/__tests__/ossQueryEscaping.test.js.map +1 -0
- package/lib/OwneraAPI/oss-api/filterUtils.d.ts +20 -0
- package/lib/OwneraAPI/oss-api/filterUtils.js +57 -5
- package/lib/OwneraAPI/oss-api/filterUtils.js.map +1 -1
- package/lib/OwneraAPI/oss-api/oss.js +730 -74
- package/lib/OwneraAPI/oss-api/oss.js.map +1 -1
- package/lib/OwneraAPI/oss-api/queryUtils.d.ts +1 -0
- package/lib/OwneraAPI/oss-api/queryUtils.js +6 -5
- package/lib/OwneraAPI/oss-api/queryUtils.js.map +1 -1
- package/lib/OwneraAPI/oss-api/queryValidation.d.ts +3 -1
- package/lib/OwneraAPI/oss-api/queryValidation.js +21 -2
- package/lib/OwneraAPI/oss-api/queryValidation.js.map +1 -1
- package/lib/OwneraAPI/payment-adapter-api/__tests__/updateBalance.test.d.ts +1 -0
- package/lib/OwneraAPI/payment-adapter-api/__tests__/updateBalance.test.js +42 -0
- package/lib/OwneraAPI/payment-adapter-api/__tests__/updateBalance.test.js.map +1 -0
- package/lib/OwneraAPI/payment-adapter-api/vanilla/__tests__/payouts.test.d.ts +1 -0
- package/lib/OwneraAPI/payment-adapter-api/vanilla/__tests__/payouts.test.js +73 -0
- package/lib/OwneraAPI/payment-adapter-api/vanilla/__tests__/payouts.test.js.map +1 -0
- package/lib/OwneraAPI/payment-adapter-api/vanilla/payouts.js +23 -11
- package/lib/OwneraAPI/payment-adapter-api/vanilla/payouts.js.map +1 -1
- package/lib/OwneraAPI/payment-adapter-api/vanilla/update-balance.d.ts +1 -1
- package/lib/OwneraAPI/payment-adapter-api/vanilla/update-balance.js +3 -1
- package/lib/OwneraAPI/payment-adapter-api/vanilla/update-balance.js.map +1 -1
- package/lib/OwneraAPI/utils.d.ts +39 -0
- package/lib/OwneraAPI/utils.js +176 -82
- package/lib/OwneraAPI/utils.js.map +1 -1
- package/lib/core/__tests__/consoleLogger.test.d.ts +1 -0
- package/lib/core/__tests__/consoleLogger.test.js +269 -0
- package/lib/core/__tests__/consoleLogger.test.js.map +1 -0
- package/lib/core/__tests__/createAssetNameUniqueness.test.d.ts +1 -0
- package/lib/core/__tests__/createAssetNameUniqueness.test.js +95 -0
- package/lib/core/__tests__/createAssetNameUniqueness.test.js.map +1 -0
- package/lib/core/__tests__/custodianPrecedence.test.d.ts +1 -0
- package/lib/core/__tests__/custodianPrecedence.test.js +683 -0
- package/lib/core/__tests__/custodianPrecedence.test.js.map +1 -0
- package/lib/core/__tests__/executeIntentSettlementAssets.test.d.ts +1 -0
- package/lib/core/__tests__/executeIntentSettlementAssets.test.js +128 -0
- package/lib/core/__tests__/executeIntentSettlementAssets.test.js.map +1 -0
- package/lib/core/__tests__/logException.test.d.ts +1 -0
- package/lib/core/__tests__/logException.test.js +49 -0
- package/lib/core/__tests__/logException.test.js.map +1 -0
- package/lib/core/__tests__/multiplyDecimalStrings.test.d.ts +1 -0
- package/lib/core/__tests__/multiplyDecimalStrings.test.js +37 -0
- package/lib/core/__tests__/multiplyDecimalStrings.test.js.map +1 -0
- package/lib/core/__tests__/settlementExecutionAmount.test.d.ts +1 -0
- package/lib/core/__tests__/settlementExecutionAmount.test.js +300 -0
- package/lib/core/__tests__/settlementExecutionAmount.test.js.map +1 -0
- package/lib/core/asset.js +21 -27
- package/lib/core/asset.js.map +1 -1
- package/lib/core/custodian.d.ts +30 -0
- package/lib/core/custodian.js +49 -0
- package/lib/core/custodian.js.map +1 -0
- package/lib/core/index.d.ts +1 -0
- package/lib/core/index.js +3 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/intents/__tests__/intentErrorCode.test.d.ts +1 -0
- package/lib/core/intents/__tests__/intentErrorCode.test.js +111 -0
- package/lib/core/intents/__tests__/intentErrorCode.test.js.map +1 -0
- package/lib/core/intents/__tests__/intentHandleReject.test.d.ts +1 -0
- package/lib/core/intents/__tests__/intentHandleReject.test.js +50 -0
- package/lib/core/intents/__tests__/intentHandleReject.test.js.map +1 -0
- package/lib/core/intents/__tests__/loanIntentAdditionalAccounts.test.d.ts +1 -0
- package/lib/core/intents/__tests__/loanIntentAdditionalAccounts.test.js +185 -0
- package/lib/core/intents/__tests__/loanIntentAdditionalAccounts.test.js.map +1 -0
- package/lib/core/intents/__tests__/loanIntentCustodianPrecedence.test.d.ts +1 -0
- package/lib/core/intents/__tests__/loanIntentCustodianPrecedence.test.js +85 -0
- package/lib/core/intents/__tests__/loanIntentCustodianPrecedence.test.js.map +1 -0
- package/lib/core/intents/__tests__/loanIntentMetadata.test.d.ts +1 -0
- package/lib/core/intents/__tests__/loanIntentMetadata.test.js +81 -0
- package/lib/core/intents/__tests__/loanIntentMetadata.test.js.map +1 -0
- package/lib/core/intents/__tests__/moveIntentSegregatedAccounts.test.d.ts +1 -0
- package/lib/core/intents/__tests__/moveIntentSegregatedAccounts.test.js +203 -0
- package/lib/core/intents/__tests__/moveIntentSegregatedAccounts.test.js.map +1 -0
- package/lib/core/intents/createIntent/createIntent.js +4 -3
- package/lib/core/intents/createIntent/createIntent.js.map +1 -1
- package/lib/core/intents/createIntent/createMoveIntentReq.d.ts +0 -1
- package/lib/core/intents/createIntent/createMoveIntentReq.js +15 -8
- package/lib/core/intents/createIntent/createMoveIntentReq.js.map +1 -1
- package/lib/core/intents/createIntent/helpers.d.ts +6 -2
- package/lib/core/intents/createIntent/helpers.js +27 -17
- package/lib/core/intents/createIntent/helpers.js.map +1 -1
- package/lib/core/intents/createLoanIntent.js +64 -19
- package/lib/core/intents/createLoanIntent.js.map +1 -1
- package/lib/core/intents/executeIntent.js +102 -41
- package/lib/core/intents/executeIntent.js.map +1 -1
- package/lib/core/intents/executeLoanIntent.js +48 -23
- package/lib/core/intents/executeLoanIntent.js.map +1 -1
- package/lib/core/intents/executeMoveIntent.js.map +1 -1
- package/lib/core/intents/executePrivateIntent.js +46 -13
- package/lib/core/intents/executePrivateIntent.js.map +1 -1
- package/lib/core/intents/executeRedemptionIntent.d.ts +1 -0
- package/lib/core/intents/executeRedemptionIntent.js +23 -9
- package/lib/core/intents/executeRedemptionIntent.js.map +1 -1
- package/lib/core/intents/executeTransferRequest.d.ts +5 -0
- package/lib/core/intents/executeTransferRequest.js +14 -3
- package/lib/core/intents/executeTransferRequest.js.map +1 -1
- package/lib/core/intents/getIntent.js +9 -0
- package/lib/core/intents/getIntent.js.map +1 -1
- package/lib/core/intents/transfer.js +7 -2
- package/lib/core/intents/transfer.js.map +1 -1
- package/lib/core/intents/updateMoveIntentReq.d.ts +4 -3
- package/lib/core/intents/updateMoveIntentReq.js +14 -12
- package/lib/core/intents/updateMoveIntentReq.js.map +1 -1
- package/lib/core/intents/utils.d.ts +15 -7
- package/lib/core/intents/utils.js +35 -26
- package/lib/core/intents/utils.js.map +1 -1
- package/lib/core/logger.js +128 -22
- package/lib/core/logger.js.map +1 -1
- package/lib/core/normalizers/__tests__/normalizeOperationResponse.test.d.ts +1 -0
- package/lib/core/normalizers/__tests__/normalizeOperationResponse.test.js +60 -0
- package/lib/core/normalizers/__tests__/normalizeOperationResponse.test.js.map +1 -0
- package/lib/core/normalizers/normalizeOperationResponse.d.ts +6 -0
- package/lib/core/normalizers/normalizeOperationResponse.js +4 -5
- package/lib/core/normalizers/normalizeOperationResponse.js.map +1 -1
- package/lib/core/sdk.d.ts +4 -0
- package/lib/core/sdk.js +2 -2
- package/lib/core/sdk.js.map +1 -1
- package/lib/core/user.d.ts +2 -2
- package/lib/core/user.js +6 -3
- package/lib/core/user.js.map +1 -1
- package/lib/core/utils.d.ts +17 -1
- package/lib/core/utils.js +75 -16
- package/lib/core/utils.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/types/Agreements/Agreements.d.ts +355 -0
- package/lib/types/Agreements/Agreements.js +3 -0
- package/lib/types/Agreements/Agreements.js.map +1 -0
- package/lib/types/Agreements/index.d.ts +1 -0
- package/lib/types/Agreements/index.js +18 -0
- package/lib/types/Agreements/index.js.map +1 -0
- package/lib/types/Collateral/Collateral.d.ts +564 -0
- package/lib/types/Collateral/Collateral.js +3 -0
- package/lib/types/Collateral/Collateral.js.map +1 -0
- package/lib/types/Collateral/index.d.ts +1 -0
- package/lib/types/Collateral/index.js +18 -0
- package/lib/types/Collateral/index.js.map +1 -0
- package/lib/types/Core/Intents.d.ts +115 -3
- package/lib/types/Core/Intents.js +9 -0
- package/lib/types/Core/Intents.js.map +1 -1
- package/lib/types/Core/OwneraAPI.d.ts +25 -1
- package/lib/types/Core/User.d.ts +28 -3
- package/lib/types/InvestorAccounts/InvestorAccounts.d.ts +171 -0
- package/lib/types/InvestorAccounts/InvestorAccounts.js +35 -0
- package/lib/types/InvestorAccounts/InvestorAccounts.js.map +1 -0
- package/lib/types/InvestorAccounts/index.d.ts +1 -0
- package/lib/types/InvestorAccounts/index.js +18 -0
- package/lib/types/InvestorAccounts/index.js.map +1 -0
- package/lib/types/Operations/Operations.d.ts +11 -0
- package/lib/types/Oss/Agreements.d.ts +671 -0
- package/lib/types/Oss/Agreements.js +3 -0
- package/lib/types/Oss/Agreements.js.map +1 -0
- package/lib/types/Oss/Oss.d.ts +81 -1
- package/lib/types/Oss/OssSchemas.d.ts +50 -0
- package/lib/types/Oss/OssSchemas.js.map +1 -1
- package/lib/types/Oss/index.d.ts +1 -0
- package/lib/types/Oss/index.js +1 -0
- package/lib/types/Oss/index.js.map +1 -1
- package/lib/types/Oss/utils.d.ts +39 -0
- package/lib/types/PaymentAdapter/PaymentAdapter.d.ts +7 -0
- package/lib/types/PaymentAdapter/index.d.ts +33 -1
- package/lib/types/Profiles/Intents.d.ts +24 -12
- package/lib/types/Profiles/Profiles.d.ts +46 -1
- package/lib/types/Tokens/Tokens.d.ts +109 -1
- package/lib/types/index.d.ts +3 -0
- package/lib/types/index.js +3 -0
- package/lib/types/index.js.map +1 -1
- package/lib/types/utils.d.ts +5 -0
- package/lib/types/utils.js.map +1 -1
- 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");
|
|
@@ -269,6 +270,11 @@ const intentFragment = `
|
|
|
269
270
|
intent {
|
|
270
271
|
${intentDetailsFragment}
|
|
271
272
|
}
|
|
273
|
+
customMetadata {
|
|
274
|
+
key
|
|
275
|
+
value
|
|
276
|
+
}
|
|
277
|
+
rejectReason
|
|
272
278
|
`;
|
|
273
279
|
// Data-layer fragments for the Financial Asset (assetHeader / pricing / referenceData feeds).
|
|
274
280
|
const assetDataItemFragment = `
|
|
@@ -508,6 +514,11 @@ const planInstructionDetailsFragment = `
|
|
|
508
514
|
amount
|
|
509
515
|
}
|
|
510
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)));
|
|
511
522
|
// pagination fragments
|
|
512
523
|
const pageInfoFragment = `
|
|
513
524
|
pageInfo {
|
|
@@ -516,10 +527,251 @@ pageInfo {
|
|
|
516
527
|
totalCount
|
|
517
528
|
totalLeft
|
|
518
529
|
}`;
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
530
|
+
const emptyPageInfo = { hasNextPage: false, totalCount: 0, totalLeft: 0 };
|
|
531
|
+
// agreement (resource type 107) fragments — selections validated against the
|
|
532
|
+
// oss feature/collateral-mobility schema on local6 (ownership.graphql).
|
|
533
|
+
const accountPolicyFragment = `
|
|
534
|
+
policyId
|
|
535
|
+
version
|
|
536
|
+
direction
|
|
537
|
+
eligibility { assetTypes assetNameRegexp assetCodes ledgerNames }
|
|
538
|
+
constraints { allowedCounterOrganizations allowedCounterAssetTypes allowedCounterFinIds allowedCounterRoles }
|
|
539
|
+
authorization { requiredRoles requiredSigners threshold }
|
|
540
|
+
conditions {
|
|
541
|
+
name
|
|
542
|
+
trigger { type asserterRole }
|
|
543
|
+
authorization { requiredRoles requiredSigners threshold }
|
|
544
|
+
constraints { allowedCounterOrganizations allowedCounterAssetTypes allowedCounterFinIds allowedCounterRoles }
|
|
545
|
+
}
|
|
546
|
+
allowedInitiatorRoles
|
|
547
|
+
agreementRef
|
|
548
|
+
beneficialOwnerRole
|
|
549
|
+
boundParty
|
|
550
|
+
signers { signerParty }
|
|
551
|
+
`;
|
|
552
|
+
const containerSpecFragment = `
|
|
553
|
+
key
|
|
554
|
+
servesRoles
|
|
555
|
+
boundParty
|
|
556
|
+
provisionerRole
|
|
557
|
+
provisionerParty
|
|
558
|
+
eligibleAssets { network standard tokenId }
|
|
559
|
+
policyTemplate { ${accountPolicyFragment} }
|
|
560
|
+
`;
|
|
561
|
+
// AgreementSchemaReference is a union: the url arm carries `url`, the document arm `key`.
|
|
562
|
+
const agreementSchemaFragment = `
|
|
563
|
+
name
|
|
564
|
+
version
|
|
565
|
+
reference {
|
|
566
|
+
... on AgreementSchemaUrlReference { url format hash { hash hashAlgorithm } }
|
|
567
|
+
... on AgreementSchemaDocumentReference { key path format hash { hash hashAlgorithm } }
|
|
568
|
+
}
|
|
569
|
+
`;
|
|
570
|
+
const agreementAccountFragment = `
|
|
571
|
+
agreementId
|
|
572
|
+
finId
|
|
573
|
+
orgId
|
|
574
|
+
custodianOrgId
|
|
575
|
+
policyId
|
|
576
|
+
policyVersion
|
|
577
|
+
servesRoles
|
|
578
|
+
provisionerRole
|
|
579
|
+
status
|
|
580
|
+
footprints { network standard tokenId networkAccount }
|
|
581
|
+
spec { ${containerSpecFragment} }
|
|
582
|
+
`;
|
|
583
|
+
const agreementFragment = `
|
|
584
|
+
id
|
|
585
|
+
organizationId
|
|
586
|
+
status
|
|
587
|
+
version
|
|
588
|
+
consentRoles
|
|
589
|
+
participants { organizationId roles }
|
|
590
|
+
roles { role parties }
|
|
591
|
+
eligibleAssets { network standard tokenId }
|
|
592
|
+
termsType
|
|
593
|
+
terms
|
|
594
|
+
validFrom
|
|
595
|
+
validUntil
|
|
596
|
+
signatures { role signerParty }
|
|
597
|
+
events {
|
|
598
|
+
id
|
|
599
|
+
eventType
|
|
600
|
+
emitterRole
|
|
601
|
+
sequence
|
|
602
|
+
occurredAt
|
|
603
|
+
payloadType
|
|
604
|
+
payload
|
|
605
|
+
referencedEventIds
|
|
606
|
+
after { changeStateTo }
|
|
607
|
+
}
|
|
608
|
+
accounts { ${agreementAccountFragment} }
|
|
609
|
+
setup {
|
|
610
|
+
... on AgreementProvisioningSpec {
|
|
611
|
+
provisionerRole
|
|
612
|
+
policyTemplate { ${accountPolicyFragment} }
|
|
613
|
+
containers { ${containerSpecFragment} }
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
definition {
|
|
617
|
+
name
|
|
618
|
+
version
|
|
619
|
+
emitterRoles
|
|
620
|
+
guard
|
|
621
|
+
states { onCreation onApproval allowedStates finalStates }
|
|
622
|
+
schema { ${agreementSchemaFragment} }
|
|
623
|
+
allowedEvents { type guard schema { ${agreementSchemaFragment} } }
|
|
624
|
+
transitions { event toState fromStates guard targetSelectableByEvent selectableStates }
|
|
625
|
+
}
|
|
522
626
|
`;
|
|
627
|
+
// collateral facade module fragments (collateral.graphql) — folded entities,
|
|
628
|
+
// decoded terms, no base64, no raw events.
|
|
629
|
+
const collateralAgreementFragment = `
|
|
630
|
+
agreementId
|
|
631
|
+
orgId
|
|
632
|
+
status
|
|
633
|
+
version
|
|
634
|
+
termsType
|
|
635
|
+
consentRoles
|
|
636
|
+
eligibleAssets { network standard tokenId }
|
|
637
|
+
definitionSchemaKey
|
|
638
|
+
terms {
|
|
639
|
+
baseCurrency
|
|
640
|
+
haircutApplyMethod
|
|
641
|
+
eligibleAssets { assetId haircut caip19 }
|
|
642
|
+
}
|
|
643
|
+
roles { role parties }
|
|
644
|
+
participants { orgId role }
|
|
645
|
+
containers { key finId orgId status boundParty }
|
|
646
|
+
validFrom
|
|
647
|
+
validUntil
|
|
648
|
+
createdAt
|
|
649
|
+
`;
|
|
650
|
+
// The asset an execution plan moved, with the attribution line's valuation overlaid.
|
|
651
|
+
const collateralReportActionAssetFragment = `
|
|
652
|
+
assetIdType
|
|
653
|
+
assetId
|
|
654
|
+
name
|
|
655
|
+
ticker
|
|
656
|
+
assetIdentifierType
|
|
657
|
+
assetIdentifierValue
|
|
658
|
+
metadata { appliedHaircut baseUnitPrice baseValue baseUnits finalUnitPrice finalValue finalUnits }
|
|
659
|
+
`;
|
|
660
|
+
const collateralReportFragment = `
|
|
661
|
+
reportId
|
|
662
|
+
agreementId
|
|
663
|
+
type
|
|
664
|
+
currency
|
|
665
|
+
senderOrgId
|
|
666
|
+
senderProfileId
|
|
667
|
+
receiverOrgId
|
|
668
|
+
receiverProfileId
|
|
669
|
+
reportCreatorId
|
|
670
|
+
nominalMarginAmount
|
|
671
|
+
deadline
|
|
672
|
+
eventId
|
|
673
|
+
containerKey
|
|
674
|
+
calledParty
|
|
675
|
+
overlayStatus
|
|
676
|
+
sequence
|
|
677
|
+
fulfillmentMode
|
|
678
|
+
createdAt
|
|
679
|
+
statusHistory { status sequence emitterRole emitterOrgId note timestamp }
|
|
680
|
+
resolutions { resolvedBy sequence timestamp note }
|
|
681
|
+
rejections { rejectedBy sequence timestamp note }
|
|
682
|
+
actions {
|
|
683
|
+
action
|
|
684
|
+
nominalAmount
|
|
685
|
+
recoveredAsset { assetId quantity }
|
|
686
|
+
}
|
|
687
|
+
settlement { assetId }
|
|
688
|
+
negotiations {
|
|
689
|
+
negotiationId
|
|
690
|
+
kind
|
|
691
|
+
status
|
|
692
|
+
openedBy
|
|
693
|
+
standingRound
|
|
694
|
+
standingBy
|
|
695
|
+
agreedLines { assetId quantity }
|
|
696
|
+
intentId
|
|
697
|
+
rounds { round action by lines { assetId quantity } intentId reason sequence timestamp }
|
|
698
|
+
}
|
|
699
|
+
exceptions {
|
|
700
|
+
exceptionId
|
|
701
|
+
status
|
|
702
|
+
blame
|
|
703
|
+
reason
|
|
704
|
+
raisedBy
|
|
705
|
+
details { executionPlanId assetId quantity }
|
|
706
|
+
eventId
|
|
707
|
+
sequence
|
|
708
|
+
timestamp
|
|
709
|
+
}
|
|
710
|
+
manualResolves {
|
|
711
|
+
manualResolveId
|
|
712
|
+
exceptionIds
|
|
713
|
+
requestedBy
|
|
714
|
+
reason
|
|
715
|
+
eventId
|
|
716
|
+
sequence
|
|
717
|
+
timestamp
|
|
718
|
+
decisions { status decidedBy reason sequence timestamp }
|
|
719
|
+
}
|
|
720
|
+
coverageRechecks { requestedBy reason eventId sequence timestamp }
|
|
721
|
+
executionPlans {
|
|
722
|
+
planId
|
|
723
|
+
status
|
|
724
|
+
asset { ${collateralReportActionAssetFragment} }
|
|
725
|
+
quantity
|
|
726
|
+
failureReason
|
|
727
|
+
instructions { sequence status errorCode errorMessage }
|
|
728
|
+
createdAt
|
|
729
|
+
lastModified
|
|
730
|
+
}
|
|
731
|
+
attributionProposals {
|
|
732
|
+
proposalId
|
|
733
|
+
round
|
|
734
|
+
status
|
|
735
|
+
lines {
|
|
736
|
+
assetId
|
|
737
|
+
quantity
|
|
738
|
+
metadata { appliedHaircut baseUnitPrice baseValue baseUnits finalUnitPrice finalValue finalUnits }
|
|
739
|
+
}
|
|
740
|
+
proposedBy
|
|
741
|
+
decidedBy
|
|
742
|
+
completed
|
|
743
|
+
eventId
|
|
744
|
+
decisionEventId
|
|
745
|
+
sequence
|
|
746
|
+
timestamp
|
|
747
|
+
}
|
|
748
|
+
`;
|
|
749
|
+
const collateralContainerBookFragment = `
|
|
750
|
+
agreementId
|
|
751
|
+
containerKey
|
|
752
|
+
finId
|
|
753
|
+
boundParty
|
|
754
|
+
booksAvailable
|
|
755
|
+
holdings { assetId quantity }
|
|
756
|
+
activity { assetId quantity direction reportId timestampMs transactionId operationType }
|
|
757
|
+
earmarks { reportId holdings { assetId quantity } }
|
|
758
|
+
unattributed { assetId quantity }
|
|
759
|
+
`;
|
|
760
|
+
// A connection page is complete when its root resolved and no node is null. `nodes: null` is a valid
|
|
761
|
+
// empty page; a field error that nulls anything is caught earlier, because these reads are `strict`.
|
|
762
|
+
const isCompletePage = (page) => { var _a; return !!page && ((_a = page.nodes) !== null && _a !== void 0 ? _a : []).every((node) => node !== null && node !== undefined); };
|
|
763
|
+
// OSS `CollateralAgreementOrderField` values: the only order literals `getCollateralAgreements` sends.
|
|
764
|
+
const COLLATERAL_AGREEMENT_ORDER_FIELDS = ['CREATED_AT', 'AGREEMENT_ID'];
|
|
765
|
+
// OSS `CollateralReportOrderField` values: the only order literals `getCollateralReports` sends.
|
|
766
|
+
const COLLATERAL_REPORT_ORDER_FIELDS = ['CREATED_AT'];
|
|
767
|
+
const COLLATERAL_REPORT_CHANGE_KINDS = [
|
|
768
|
+
'CREATED',
|
|
769
|
+
'STATUS_CHANGED',
|
|
770
|
+
'RESOLVED',
|
|
771
|
+
'NEGOTIATION',
|
|
772
|
+
'REJECTED',
|
|
773
|
+
'EXCEPTION',
|
|
774
|
+
];
|
|
523
775
|
// execution plan fragments
|
|
524
776
|
const termFragment = `
|
|
525
777
|
term {
|
|
@@ -962,9 +1214,6 @@ const mapAsset = (asset) => ({
|
|
|
962
1214
|
financialIdentifier: asset.financialIdentifier,
|
|
963
1215
|
decimalPlaces: asset.decimalPlaces,
|
|
964
1216
|
});
|
|
965
|
-
const stringifyArrayForQuery = (arr) => {
|
|
966
|
-
return `[` + arr.map((s) => `\\"${s}\\"`) + `]`;
|
|
967
|
-
};
|
|
968
1217
|
/**
|
|
969
1218
|
* Transforms raw GraphQL data nodes into API-formatted objects using schema path mappings
|
|
970
1219
|
* @param nodes - Raw GraphQL data nodes
|
|
@@ -1126,22 +1375,22 @@ query getAssets {
|
|
|
1126
1375
|
assets
|
|
1127
1376
|
(
|
|
1128
1377
|
filter: [
|
|
1129
|
-
${!!(filter === null || filter === void 0 ? void 0 : filter.assetIds) ? `{ key: "id", operator: IN, value:
|
|
1130
|
-
${!!(filter === null || filter === void 0 ? void 0 : filter.name) ? `{ key: "name", operator: EQ, value:
|
|
1378
|
+
${!!(filter === null || filter === void 0 ? void 0 : filter.assetIds) ? `{ key: "id", operator: IN, value: ${gqlStringList(filter.assetIds)}},` : ''}
|
|
1379
|
+
${!!(filter === null || filter === void 0 ? void 0 : filter.name) ? `{ key: "name", operator: EQ, value: ${gqlString(filter.name)} },` : ''}
|
|
1131
1380
|
${Array.isArray(filter === null || filter === void 0 ? void 0 : filter.symbol)
|
|
1132
|
-
? `{ key: "symbol", operator: IN, value:
|
|
1381
|
+
? `{ key: "symbol", operator: IN, value: ${gqlStringList(filter.symbol)} },`
|
|
1133
1382
|
: (filter === null || filter === void 0 ? void 0 : filter.symbol)
|
|
1134
|
-
? `{ key: "symbol", operator: EQ, value:
|
|
1383
|
+
? `{ key: "symbol", operator: EQ, value: ${gqlString(filter.symbol)} },`
|
|
1135
1384
|
: ''}
|
|
1136
|
-
${!!(filter === null || filter === void 0 ? void 0 : filter.excludeType) ? `{ key: "type", operator: NEQ, value:
|
|
1385
|
+
${!!(filter === null || filter === void 0 ? void 0 : filter.excludeType) ? `{ key: "type", operator: NEQ, value: ${gqlString(filter.excludeType)} },` : ''}
|
|
1137
1386
|
${Array.isArray(filter === null || filter === void 0 ? void 0 : filter.type)
|
|
1138
|
-
? `{ key: "type", operator: IN, value:
|
|
1387
|
+
? `{ key: "type", operator: IN, value: ${gqlStringList(filter.type)} },`
|
|
1139
1388
|
: (filter === null || filter === void 0 ? void 0 : filter.type)
|
|
1140
|
-
? `{ key: "type", operator: EQ, value:
|
|
1389
|
+
? `{ key: "type", operator: EQ, value: ${gqlString(filter.type)} },`
|
|
1141
1390
|
: ''}
|
|
1142
1391
|
],
|
|
1143
|
-
${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 })}
|
|
1144
|
-
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'}},
|
|
1392
|
+
${(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 })}
|
|
1393
|
+
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')}},
|
|
1145
1394
|
)
|
|
1146
1395
|
{
|
|
1147
1396
|
nodes {
|
|
@@ -1187,9 +1436,9 @@ query financialAssets {
|
|
|
1187
1436
|
financialAssets
|
|
1188
1437
|
(
|
|
1189
1438
|
filter: [
|
|
1190
|
-
${!!(filter === null || filter === void 0 ? void 0 : filter.identifierValues) ? `{ key: "identifierValue", operator: IN, value:
|
|
1439
|
+
${!!(filter === null || filter === void 0 ? void 0 : filter.identifierValues) ? `{ key: "identifierValue", operator: IN, value: ${gqlStringList(filter.identifierValues)} },` : ''}
|
|
1191
1440
|
],
|
|
1192
|
-
${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 })}
|
|
1441
|
+
${(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 })}
|
|
1193
1442
|
)
|
|
1194
1443
|
{
|
|
1195
1444
|
nodes {
|
|
@@ -1261,10 +1510,10 @@ query assetDatas {
|
|
|
1261
1510
|
assetDatas
|
|
1262
1511
|
(
|
|
1263
1512
|
filter: [
|
|
1264
|
-
${!!(filter === null || filter === void 0 ? void 0 : filter.identifierValue) ? `{ key: "identifierValue", operator: EQ, value:
|
|
1265
|
-
${!!(filter === null || filter === void 0 ? void 0 : filter.dataType) ? `{ key: "dataType", operator: EQ, value:
|
|
1513
|
+
${!!(filter === null || filter === void 0 ? void 0 : filter.identifierValue) ? `{ key: "identifierValue", operator: EQ, value: ${gqlString(filter.identifierValue)} },` : ''}
|
|
1514
|
+
${!!(filter === null || filter === void 0 ? void 0 : filter.dataType) ? `{ key: "dataType", operator: EQ, value: ${gqlString(filter.dataType)} },` : ''}
|
|
1266
1515
|
],
|
|
1267
|
-
${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 })}
|
|
1516
|
+
${(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 })}
|
|
1268
1517
|
)
|
|
1269
1518
|
{
|
|
1270
1519
|
nodes {
|
|
@@ -1308,12 +1557,14 @@ query assetDatas {
|
|
|
1308
1557
|
var _a, _b;
|
|
1309
1558
|
const { retry, filter } = request;
|
|
1310
1559
|
const intentFilterFragments = [
|
|
1311
|
-
`{ key: "type", operator: IN, value:
|
|
1312
|
-
filter.intentStatus ? `{ key: "status", operator: EQ, value:
|
|
1560
|
+
`{ key: "type", operator: IN, value: ${gqlStringList(filter.intentTypes)} }`,
|
|
1561
|
+
filter.intentStatus ? `{ key: "status", operator: EQ, value: ${gqlString(filter.intentStatus)} }` : '',
|
|
1313
1562
|
]
|
|
1314
1563
|
.filter(Boolean)
|
|
1315
1564
|
.join(',');
|
|
1316
|
-
const assetFilterFragments = [
|
|
1565
|
+
const assetFilterFragments = [
|
|
1566
|
+
(filter === null || filter === void 0 ? void 0 : filter.type) ? `{ key: "type", operator: EQ, value: ${gqlString(filter.type)} }` : '',
|
|
1567
|
+
]
|
|
1317
1568
|
.filter(Boolean)
|
|
1318
1569
|
.join(',');
|
|
1319
1570
|
const query = `
|
|
@@ -1321,8 +1572,8 @@ query assetDatas {
|
|
|
1321
1572
|
assets
|
|
1322
1573
|
(
|
|
1323
1574
|
filter: [${assetFilterFragments}],
|
|
1324
|
-
${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 })}
|
|
1325
|
-
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'}},
|
|
1575
|
+
${(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 })}
|
|
1576
|
+
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')}},
|
|
1326
1577
|
)
|
|
1327
1578
|
{
|
|
1328
1579
|
nodes {
|
|
@@ -1404,8 +1655,8 @@ query assetDatas {
|
|
|
1404
1655
|
}),
|
|
1405
1656
|
getAssetsWithSpecificIntents: (request) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1406
1657
|
const { assetIds, intentIds, fields, assetFields } = request;
|
|
1407
|
-
const assetFilterFragment = `{ key: "id", operator: IN, value:
|
|
1408
|
-
const intentFilterFragment = `{ key: "id", operator: IN, value:
|
|
1658
|
+
const assetFilterFragment = `{ key: "id", operator: IN, value: ${gqlStringList(assetIds)} }`;
|
|
1659
|
+
const intentFilterFragment = `{ key: "id", operator: IN, value: ${gqlStringList(intentIds)} }`;
|
|
1409
1660
|
const query = `
|
|
1410
1661
|
query getAssetsWithSpecificIntents {
|
|
1411
1662
|
assets(filter: [${assetFilterFragment}]) {
|
|
@@ -1447,11 +1698,11 @@ query assetDatas {
|
|
|
1447
1698
|
const { assetId, intentId } = request;
|
|
1448
1699
|
const query = `
|
|
1449
1700
|
query getLoanIntent {
|
|
1450
|
-
assets (filter: {operator: EQ, key: "id", value:
|
|
1701
|
+
assets (filter: {operator: EQ, key: "id", value: ${gqlString(assetId)}}) {
|
|
1451
1702
|
nodes {
|
|
1452
1703
|
id
|
|
1453
1704
|
name
|
|
1454
|
-
intents (filter: {operator: EQ, key: "id", value:
|
|
1705
|
+
intents (filter: {operator: EQ, key: "id", value: ${gqlString(intentId)}}) {
|
|
1455
1706
|
nodes {
|
|
1456
1707
|
${intentFragment}
|
|
1457
1708
|
}
|
|
@@ -1539,11 +1790,11 @@ query assetDatas {
|
|
|
1539
1790
|
const query = `
|
|
1540
1791
|
query getIssuerAssets {
|
|
1541
1792
|
issuers (
|
|
1542
|
-
filter:{key:"id", operator:EQ, value:
|
|
1793
|
+
filter:{key:"id", operator:EQ, value: ${gqlString(issuerId)}},
|
|
1543
1794
|
) {
|
|
1544
1795
|
nodes {
|
|
1545
1796
|
assets (
|
|
1546
|
-
${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 })}
|
|
1797
|
+
${(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 })}
|
|
1547
1798
|
) {
|
|
1548
1799
|
nodes {
|
|
1549
1800
|
${assetFragment}
|
|
@@ -1585,7 +1836,7 @@ query assetDatas {
|
|
|
1585
1836
|
getOutbox: (request) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1586
1837
|
const query = `
|
|
1587
1838
|
query getOutbox {
|
|
1588
|
-
issuers (filter: {key: "id", operator: EQ, value:
|
|
1839
|
+
issuers (filter: {key: "id", operator: EQ, value: ${gqlString(request.userId)}}){
|
|
1589
1840
|
nodes {
|
|
1590
1841
|
id
|
|
1591
1842
|
outbox {
|
|
@@ -1651,6 +1902,8 @@ query getAllOutbox {
|
|
|
1651
1902
|
// model - certificate
|
|
1652
1903
|
getProfileCertificates: (request) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1653
1904
|
const { profileId, profileType } = request;
|
|
1905
|
+
// profileType is written unquoted as the root field name
|
|
1906
|
+
(0, queryValidation_1.validateGraphQLTypeName)(profileType);
|
|
1654
1907
|
const query = `
|
|
1655
1908
|
query getProfileCertificates ($profileId: String!) {
|
|
1656
1909
|
${profileType} (filter: { key: "id", operator: EQ, value: $profileId }) {
|
|
@@ -1767,9 +2020,9 @@ query getUsers {
|
|
|
1767
2020
|
users
|
|
1768
2021
|
(
|
|
1769
2022
|
filter: [
|
|
1770
|
-
${userIds.length > 0 ? `{ key: "id", operator: IN, value:
|
|
2023
|
+
${userIds.length > 0 ? `{ key: "id", operator: IN, value: ${gqlStringList(userIds)}},` : ''}
|
|
1771
2024
|
],
|
|
1772
|
-
${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 })}
|
|
2025
|
+
${(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 })}
|
|
1773
2026
|
)
|
|
1774
2027
|
{
|
|
1775
2028
|
${userFragment}
|
|
@@ -1833,6 +2086,62 @@ query getUsers {
|
|
|
1833
2086
|
pageInfo: response.users.pageInfo,
|
|
1834
2087
|
};
|
|
1835
2088
|
}),
|
|
2089
|
+
// model - users / investor network accounts
|
|
2090
|
+
getUserNetworkAccounts: (request) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2091
|
+
var _a, _b, _c;
|
|
2092
|
+
const { userId, organizationId, assetId, retry } = request;
|
|
2093
|
+
// Deliberately a standalone query: widening the shared userFragment with
|
|
2094
|
+
// `networkAccounts` would hard-fail getUsers against routers that predate
|
|
2095
|
+
// the field (OSS validates strictly — unknown field = query error).
|
|
2096
|
+
//
|
|
2097
|
+
// `account` is a GraphQL UNION (WalletAccount | Caip10Account |
|
|
2098
|
+
// CustodialAccount) — plain field selection is rejected by OSS, so the
|
|
2099
|
+
// variants are selected via inline fragments discriminated by __typename.
|
|
2100
|
+
//
|
|
2101
|
+
// The org/asset narrowing happens client-side rather than via the nested
|
|
2102
|
+
// networkAccounts(filter:) argument: the per-investor list is small and
|
|
2103
|
+
// filtering here avoids coupling to the read model's filter keys.
|
|
2104
|
+
const query = `
|
|
2105
|
+
query getUserNetworkAccounts {
|
|
2106
|
+
users (filter: [{ key: "id", operator: EQ, value: ${(0, filterUtils_1.formatFilterValue)(userId)} }]) {
|
|
2107
|
+
nodes {
|
|
2108
|
+
id
|
|
2109
|
+
networkAccounts {
|
|
2110
|
+
id
|
|
2111
|
+
organizationId
|
|
2112
|
+
assetId
|
|
2113
|
+
account {
|
|
2114
|
+
__typename
|
|
2115
|
+
... on WalletAccount { type address }
|
|
2116
|
+
... on Caip10Account { network address }
|
|
2117
|
+
... on CustodialAccount { provider vaultAccountId assetId }
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
`;
|
|
2124
|
+
const readyConditions = {
|
|
2125
|
+
match: (res) => {
|
|
2126
|
+
var _a, _b, _c, _d;
|
|
2127
|
+
if (!retry)
|
|
2128
|
+
return true;
|
|
2129
|
+
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;
|
|
2130
|
+
},
|
|
2131
|
+
name: 'getUserNetworkAccounts',
|
|
2132
|
+
data: request,
|
|
2133
|
+
};
|
|
2134
|
+
const response = yield (0, utils_2.ossQuery)(client, logger, query, readyConditions);
|
|
2135
|
+
const user = (_b = (_a = response.users) === null || _a === void 0 ? void 0 : _a.nodes) === null || _b === void 0 ? void 0 : _b[0];
|
|
2136
|
+
if (!user) {
|
|
2137
|
+
throw {
|
|
2138
|
+
code: 404,
|
|
2139
|
+
name: 'NoMatchingOwner',
|
|
2140
|
+
message: `No owner found by id: ${userId}`,
|
|
2141
|
+
};
|
|
2142
|
+
}
|
|
2143
|
+
return ((_c = user.networkAccounts) !== null && _c !== void 0 ? _c : []).filter((account) => (!organizationId || account.organizationId === organizationId) && (!assetId || account.assetId === assetId));
|
|
2144
|
+
}),
|
|
1836
2145
|
getUserIdByPublicKey: (request) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1837
2146
|
const { publicKey } = request;
|
|
1838
2147
|
const query = `
|
|
@@ -1840,7 +2149,7 @@ query getUsers {
|
|
|
1840
2149
|
organizations {
|
|
1841
2150
|
nodes {
|
|
1842
2151
|
id
|
|
1843
|
-
users (filter: {key:"finIds", operator:CONTAINS, value
|
|
2152
|
+
users (filter: {key:"finIds", operator:CONTAINS, value:${gqlString(publicKey)}}) {
|
|
1844
2153
|
nodes {
|
|
1845
2154
|
id
|
|
1846
2155
|
}
|
|
@@ -1870,7 +2179,7 @@ query getUsers {
|
|
|
1870
2179
|
var _a, _b;
|
|
1871
2180
|
const query = `
|
|
1872
2181
|
query getUserHoldings {
|
|
1873
|
-
users (filter:{key:"id",operator:EQ,value
|
|
2182
|
+
users (filter:{key:"id",operator:EQ,value:${gqlString(request.userId)}}) {
|
|
1874
2183
|
nodes {
|
|
1875
2184
|
holdings {
|
|
1876
2185
|
nodes {
|
|
@@ -1916,7 +2225,7 @@ query getUserHoldings {
|
|
|
1916
2225
|
const query = `
|
|
1917
2226
|
query getAllUsersHoldings {
|
|
1918
2227
|
users
|
|
1919
|
-
(${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 })})
|
|
2228
|
+
(${(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 })})
|
|
1920
2229
|
{
|
|
1921
2230
|
nodes {
|
|
1922
2231
|
id
|
|
@@ -1953,7 +2262,7 @@ query getAllUsersHoldings {
|
|
|
1953
2262
|
getInbox: (request) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1954
2263
|
const query = `
|
|
1955
2264
|
query getUserInbox {
|
|
1956
|
-
users (filter: {key: "id", operator: EQ, value:
|
|
2265
|
+
users (filter: {key: "id", operator: EQ, value: ${gqlString(request.userId)}}) {
|
|
1957
2266
|
nodes {
|
|
1958
2267
|
id
|
|
1959
2268
|
inbox {
|
|
@@ -1977,7 +2286,7 @@ query getUserInbox {
|
|
|
1977
2286
|
var _a;
|
|
1978
2287
|
const query = `
|
|
1979
2288
|
query getReceipt {
|
|
1980
|
-
receipts (filter: {key: "id", operator: EQ, value:
|
|
2289
|
+
receipts (filter: {key: "id", operator: EQ, value: ${gqlString(request.receiptId)}}) {
|
|
1981
2290
|
nodes {
|
|
1982
2291
|
${receiptFragment}
|
|
1983
2292
|
}
|
|
@@ -2004,7 +2313,7 @@ query getReceipt {
|
|
|
2004
2313
|
var _a;
|
|
2005
2314
|
const query = `
|
|
2006
2315
|
query getReceipt {
|
|
2007
|
-
receipts (filter: {key: "operationId", operator: EQ, value:
|
|
2316
|
+
receipts (filter: {key: "operationId", operator: EQ, value: ${gqlString(request.operationId)}}) {
|
|
2008
2317
|
nodes {
|
|
2009
2318
|
${receiptFragment}
|
|
2010
2319
|
}
|
|
@@ -2046,7 +2355,7 @@ query getReceipt {
|
|
|
2046
2355
|
const query = `
|
|
2047
2356
|
query getReceiptsByAsset {
|
|
2048
2357
|
receipts
|
|
2049
|
-
(${paginateFragment({ after: cursor, limit: 10000, skip: 0 })})
|
|
2358
|
+
(${(0, queryUtils_1.paginateFragment)({ after: cursor, limit: 10000, skip: 0 })})
|
|
2050
2359
|
{
|
|
2051
2360
|
nodes {
|
|
2052
2361
|
${receiptFragment}
|
|
@@ -2094,8 +2403,8 @@ query getReceiptsByAsset {
|
|
|
2094
2403
|
const destination = fetchDst
|
|
2095
2404
|
? `
|
|
2096
2405
|
destination: receipts (
|
|
2097
|
-
filter: {key: "destination", operator: EQ, value:
|
|
2098
|
-
${paginateFragment({ after: dstCursor, limit: 10000, skip: 0 })}
|
|
2406
|
+
filter: {key: "destination", operator: EQ, value: ${gqlString(request.userId)}},
|
|
2407
|
+
${(0, queryUtils_1.paginateFragment)({ after: dstCursor, limit: 10000, skip: 0 })}
|
|
2099
2408
|
) {
|
|
2100
2409
|
nodes {
|
|
2101
2410
|
${receiptFragment}
|
|
@@ -2106,8 +2415,8 @@ query getReceiptsByAsset {
|
|
|
2106
2415
|
const source = fetchSrc
|
|
2107
2416
|
? `
|
|
2108
2417
|
source: receipts (
|
|
2109
|
-
filter: {key: "source", operator: EQ, value:
|
|
2110
|
-
${paginateFragment({ after: srcCursor, limit: 10000, skip: 0 })}
|
|
2418
|
+
filter: {key: "source", operator: EQ, value: ${gqlString(request.userId)}},
|
|
2419
|
+
${(0, queryUtils_1.paginateFragment)({ after: srcCursor, limit: 10000, skip: 0 })}
|
|
2111
2420
|
) {
|
|
2112
2421
|
nodes {
|
|
2113
2422
|
${receiptFragment}
|
|
@@ -2148,7 +2457,7 @@ query getReceiptsByUser {
|
|
|
2148
2457
|
var _a;
|
|
2149
2458
|
const query = `
|
|
2150
2459
|
query getReceipt {
|
|
2151
|
-
receipts (filter: {key: "operationId", operator: EQ, value:
|
|
2460
|
+
receipts (filter: {key: "operationId", operator: EQ, value: ${gqlString(request.operationId)}}) {
|
|
2152
2461
|
nodes {
|
|
2153
2462
|
${receiptFragment}
|
|
2154
2463
|
}
|
|
@@ -2176,7 +2485,7 @@ query getReceipt {
|
|
|
2176
2485
|
var _a;
|
|
2177
2486
|
const query = `
|
|
2178
2487
|
query getReceiptsFromTimestamp {
|
|
2179
|
-
receipts (filter: {key: "timestamp", operator: GT, value:
|
|
2488
|
+
receipts (filter: {key: "timestamp", operator: GT, value: ${gqlString(request.timestamp)}}) {
|
|
2180
2489
|
nodes {
|
|
2181
2490
|
${receiptFragment}
|
|
2182
2491
|
}
|
|
@@ -2199,7 +2508,7 @@ query getReceiptsFromTimestamp {
|
|
|
2199
2508
|
const query = `
|
|
2200
2509
|
query getExecutionPlanStatus {
|
|
2201
2510
|
plans
|
|
2202
|
-
(filter: { key:"id", operator:EQ, value:
|
|
2511
|
+
(filter: { key:"id", operator:EQ, value: ${gqlString(request.planId)} })
|
|
2203
2512
|
{
|
|
2204
2513
|
nodes {
|
|
2205
2514
|
id
|
|
@@ -2224,31 +2533,49 @@ query getExecutionPlanStatus {
|
|
|
2224
2533
|
}),
|
|
2225
2534
|
getAllExecutionPlans: (request) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2226
2535
|
const { filter } = request;
|
|
2227
|
-
const { id, status, creationDate, lastModified, sortOrder, sortField } = filter || {};
|
|
2536
|
+
const { id, status, creationDate, lastModified, sortOrder, sortField, investorId, assetId } = filter || {};
|
|
2228
2537
|
let creationDateFilter = '';
|
|
2229
2538
|
let lastModifiedFilter = '';
|
|
2230
2539
|
if (creationDate) {
|
|
2231
2540
|
if (typeof creationDate === 'object') {
|
|
2232
2541
|
creationDateFilter = `
|
|
2233
|
-
{key: "creationTimestamp", operator:GTE, value:
|
|
2234
|
-
{key: "creationTimestamp", operator:LTE, value:
|
|
2542
|
+
{key: "creationTimestamp", operator:GTE, value: ${gqlString(creationDate.start)}},
|
|
2543
|
+
{key: "creationTimestamp", operator:LTE, value: ${gqlString(creationDate.end)}},
|
|
2235
2544
|
`;
|
|
2236
2545
|
}
|
|
2237
2546
|
else {
|
|
2238
2547
|
creationDateFilter = `
|
|
2239
|
-
{key: "creationTimestamp", operator:GTE, value:
|
|
2548
|
+
{key: "creationTimestamp", operator:GTE, value: ${gqlString(creationDate)}},
|
|
2240
2549
|
`;
|
|
2241
2550
|
}
|
|
2242
2551
|
}
|
|
2243
2552
|
if (lastModified) {
|
|
2244
|
-
lastModifiedFilter = `{key: "lastModified", operator:GT, value:
|
|
2245
|
-
}
|
|
2553
|
+
lastModifiedFilter = `{key: "lastModified", operator:GT, value: ${gqlString(lastModified)}},`;
|
|
2554
|
+
}
|
|
2555
|
+
// ExecutionPlan.investorIds / assetIds are LIST fields (OSS >= v0.28.6, owneraio/oss#590)
|
|
2556
|
+
// holding every id from both the sending and the receiving side. Each filter takes a
|
|
2557
|
+
// single id and uses CONTAINS, which OSS evaluates on a list as exact, case-sensitive
|
|
2558
|
+
// membership of one element. IN / EQ / NEQ are rejected on list fields.
|
|
2559
|
+
// assetIds is the ASSET leg only; the settlement leg lives on settlementAssetIds and
|
|
2560
|
+
// would need a `where: { or: [...] }` expression, which we do not emit.
|
|
2561
|
+
// A blank value is treated as "no filter" and never emitted: a blank CONTAINS predicate
|
|
2562
|
+
// would match no plan, which is not what an empty filter means.
|
|
2563
|
+
const trimmedInvestorId = investorId === null || investorId === void 0 ? void 0 : investorId.trim();
|
|
2564
|
+
const trimmedAssetId = assetId === null || assetId === void 0 ? void 0 : assetId.trim();
|
|
2565
|
+
const investorIdFilter = trimmedInvestorId
|
|
2566
|
+
? `{key: "investorIds", operator:CONTAINS, value: ${(0, filterUtils_1.formatFilterValue)(trimmedInvestorId)}},`
|
|
2567
|
+
: '';
|
|
2568
|
+
const assetIdFilter = trimmedAssetId
|
|
2569
|
+
? `{key: "assetIds", operator:CONTAINS, value: ${(0, filterUtils_1.formatFilterValue)(trimmedAssetId)}},`
|
|
2570
|
+
: '';
|
|
2246
2571
|
const filters = `
|
|
2247
2572
|
filter: [
|
|
2248
|
-
${!!id ? `{key:"id",operator:EQ,value
|
|
2249
|
-
${!!status ? `{key:"status",operator:IN,value
|
|
2573
|
+
${!!id ? `{key:"id",operator:EQ,value:${(0, filterUtils_1.formatFilterValue)(id)}},` : ''}
|
|
2574
|
+
${!!status ? `{key:"status",operator:IN,value:${gqlStringList(status)}},` : ''}
|
|
2250
2575
|
${creationDateFilter}
|
|
2251
2576
|
${lastModifiedFilter}
|
|
2577
|
+
${investorIdFilter}
|
|
2578
|
+
${assetIdFilter}
|
|
2252
2579
|
]
|
|
2253
2580
|
`;
|
|
2254
2581
|
let orderBy = `orderBy:{field: CREATION_TIMESTAMP, direction: DESC}`;
|
|
@@ -2257,13 +2584,13 @@ query getExecutionPlanStatus {
|
|
|
2257
2584
|
.split(/(?=[A-Z][a-z])/)
|
|
2258
2585
|
.join('_')
|
|
2259
2586
|
.toUpperCase();
|
|
2260
|
-
orderBy = `orderBy:{field: ${field}, direction: ${(sortOrder === null || sortOrder === void 0 ? void 0 : sortOrder.toUpperCase()) || 'DESC'}}`;
|
|
2587
|
+
orderBy = `orderBy:{field: ${(0, filterUtils_1.formatEnumValue)(field)}, direction: ${(0, filterUtils_1.formatEnumValue)((sortOrder === null || sortOrder === void 0 ? void 0 : sortOrder.toUpperCase()) || 'DESC')}}`;
|
|
2261
2588
|
}
|
|
2262
2589
|
const query = `
|
|
2263
2590
|
query getExecutionPlans {
|
|
2264
2591
|
plans
|
|
2265
2592
|
(${filters},
|
|
2266
|
-
${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 })}
|
|
2593
|
+
${(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 })}
|
|
2267
2594
|
${orderBy})
|
|
2268
2595
|
{
|
|
2269
2596
|
nodes {
|
|
@@ -2323,7 +2650,7 @@ query getExecutionPlans {
|
|
|
2323
2650
|
};
|
|
2324
2651
|
}
|
|
2325
2652
|
const filters = `
|
|
2326
|
-
(filter: [{key:"id",operator:EQ,value
|
|
2653
|
+
(filter: [{key:"id",operator:EQ,value:${gqlString(id)}}, ])`;
|
|
2327
2654
|
const query = `
|
|
2328
2655
|
query getExecutionPlans {
|
|
2329
2656
|
plans
|
|
@@ -2392,6 +2719,112 @@ subscription getReceipts {
|
|
|
2392
2719
|
r.onNext(data);
|
|
2393
2720
|
} }));
|
|
2394
2721
|
},
|
|
2722
|
+
// -- agreements (resource type 107): raw read-model pushes (ownership.graphql)
|
|
2723
|
+
getAgreementAddedSubscription: (r) => {
|
|
2724
|
+
var _a;
|
|
2725
|
+
const args = ((_a = r.orgIds) === null || _a === void 0 ? void 0 : _a.length) ? `(orgIds: ${JSON.stringify(r.orgIds)})` : '';
|
|
2726
|
+
const query = `
|
|
2727
|
+
subscription agreementAddedSubscription {
|
|
2728
|
+
agreementAdded${args} {
|
|
2729
|
+
${agreementFragment}
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
`;
|
|
2733
|
+
return client.subscribe(Object.assign(Object.assign({}, r), { query }));
|
|
2734
|
+
},
|
|
2735
|
+
getAgreementChangedSubscription: (r) => {
|
|
2736
|
+
var _a, _b;
|
|
2737
|
+
const filters = [];
|
|
2738
|
+
if ((_a = r.agreementIds) === null || _a === void 0 ? void 0 : _a.length)
|
|
2739
|
+
filters.push(`agreementIds: ${JSON.stringify(r.agreementIds)}`);
|
|
2740
|
+
if ((_b = r.orgIds) === null || _b === void 0 ? void 0 : _b.length)
|
|
2741
|
+
filters.push(`orgIds: ${JSON.stringify(r.orgIds)}`);
|
|
2742
|
+
const args = filters.length ? `(${filters.join(', ')})` : '';
|
|
2743
|
+
const query = `
|
|
2744
|
+
subscription agreementChangedSubscription {
|
|
2745
|
+
agreementChanged${args} {
|
|
2746
|
+
${agreementFragment}
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
`;
|
|
2750
|
+
return client.subscribe(Object.assign(Object.assign({}, r), { query }));
|
|
2751
|
+
},
|
|
2752
|
+
// -- collateral facade subscriptions (collateral.graphql): the fully folded
|
|
2753
|
+
// entities; gated per org by the OSS `enabled_features` config (`collateral`).
|
|
2754
|
+
getCollateralAgreementAddedSubscription: (r) => {
|
|
2755
|
+
var _a;
|
|
2756
|
+
const args = ((_a = r.orgIds) === null || _a === void 0 ? void 0 : _a.length) ? `(orgIds: ${JSON.stringify(r.orgIds)})` : '';
|
|
2757
|
+
const query = `
|
|
2758
|
+
subscription collateralAgreementAddedSubscription {
|
|
2759
|
+
collateralAgreementAdded${args} {
|
|
2760
|
+
${collateralAgreementFragment}
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
`;
|
|
2764
|
+
return client.subscribe(Object.assign(Object.assign({}, r), { query }));
|
|
2765
|
+
},
|
|
2766
|
+
getCollateralAgreementChangedSubscription: (r) => {
|
|
2767
|
+
var _a, _b;
|
|
2768
|
+
const filters = [];
|
|
2769
|
+
if ((_a = r.agreementIds) === null || _a === void 0 ? void 0 : _a.length)
|
|
2770
|
+
filters.push(`agreementIds: ${JSON.stringify(r.agreementIds)}`);
|
|
2771
|
+
if ((_b = r.orgIds) === null || _b === void 0 ? void 0 : _b.length)
|
|
2772
|
+
filters.push(`orgIds: ${JSON.stringify(r.orgIds)}`);
|
|
2773
|
+
const args = filters.length ? `(${filters.join(', ')})` : '';
|
|
2774
|
+
const query = `
|
|
2775
|
+
subscription collateralAgreementChangedSubscription {
|
|
2776
|
+
collateralAgreementChanged${args} {
|
|
2777
|
+
${collateralAgreementFragment}
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
`;
|
|
2781
|
+
return client.subscribe(Object.assign(Object.assign({}, r), { query }));
|
|
2782
|
+
},
|
|
2783
|
+
getCollateralReportChangedSubscription: (r) => {
|
|
2784
|
+
var _a, _b, _c;
|
|
2785
|
+
const filters = [];
|
|
2786
|
+
if ((_a = r.agreementIds) === null || _a === void 0 ? void 0 : _a.length)
|
|
2787
|
+
filters.push(`agreementIds: ${JSON.stringify(r.agreementIds)}`);
|
|
2788
|
+
if ((_b = r.reportIds) === null || _b === void 0 ? void 0 : _b.length)
|
|
2789
|
+
filters.push(`reportIds: ${JSON.stringify(r.reportIds)}`);
|
|
2790
|
+
// Kinds are interpolated as raw enum literals, so only known ones may pass. An unknown kind is
|
|
2791
|
+
// refused rather than dropped: dropping the last one would silently widen the stream to every change.
|
|
2792
|
+
const changeKinds = (_c = r.changeKinds) !== null && _c !== void 0 ? _c : [];
|
|
2793
|
+
const unknownKinds = changeKinds.filter((kind) => !COLLATERAL_REPORT_CHANGE_KINDS.includes(kind));
|
|
2794
|
+
if (unknownKinds.length) {
|
|
2795
|
+
throw {
|
|
2796
|
+
code: 400,
|
|
2797
|
+
name: 'UnknownChangeKind',
|
|
2798
|
+
message: `Unknown collateral report change kind(s): ${unknownKinds.join(', ')}`,
|
|
2799
|
+
};
|
|
2800
|
+
}
|
|
2801
|
+
if (changeKinds.length)
|
|
2802
|
+
filters.push(`changeKinds: [${changeKinds.join(', ')}]`);
|
|
2803
|
+
const args = filters.length ? `(${filters.join(', ')})` : '';
|
|
2804
|
+
const query = `
|
|
2805
|
+
subscription collateralReportChangedSubscription {
|
|
2806
|
+
collateralReportChanged${args} {
|
|
2807
|
+
kind
|
|
2808
|
+
report {
|
|
2809
|
+
${collateralReportFragment}
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
`;
|
|
2814
|
+
return client.subscribe(Object.assign(Object.assign({}, r), { query }));
|
|
2815
|
+
},
|
|
2816
|
+
getCollateralContainerBookChangedSubscription: (r) => {
|
|
2817
|
+
var _a;
|
|
2818
|
+
const args = ((_a = r.agreementIds) === null || _a === void 0 ? void 0 : _a.length) ? `(agreementIds: ${JSON.stringify(r.agreementIds)})` : '';
|
|
2819
|
+
const query = `
|
|
2820
|
+
subscription collateralContainerBookChangedSubscription {
|
|
2821
|
+
collateralContainerBookChanged${args} {
|
|
2822
|
+
${collateralContainerBookFragment}
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
`;
|
|
2826
|
+
return client.subscribe(Object.assign(Object.assign({}, r), { query }));
|
|
2827
|
+
},
|
|
2395
2828
|
getUserHoldingChangedSubscription: (r) => {
|
|
2396
2829
|
const query = `
|
|
2397
2830
|
subscription userHoldingChangedSubscription {
|
|
@@ -2514,7 +2947,7 @@ query getExecutionPlans {
|
|
|
2514
2947
|
const { assetId, intentId } = request;
|
|
2515
2948
|
const query = `
|
|
2516
2949
|
query getIntentById {
|
|
2517
|
-
assets (filter: {operator: EQ, key: "id", value:
|
|
2950
|
+
assets (filter: {operator: EQ, key: "id", value: ${gqlString(assetId)}}) {
|
|
2518
2951
|
nodes {
|
|
2519
2952
|
id
|
|
2520
2953
|
name
|
|
@@ -2534,7 +2967,7 @@ query getExecutionPlans {
|
|
|
2534
2967
|
${certificateFragment}
|
|
2535
2968
|
}
|
|
2536
2969
|
}
|
|
2537
|
-
intents (filter: {operator: EQ, key: "id", value:
|
|
2970
|
+
intents (filter: {operator: EQ, key: "id", value: ${gqlString(intentId)}}) {
|
|
2538
2971
|
nodes {
|
|
2539
2972
|
${intentFragment}
|
|
2540
2973
|
}
|
|
@@ -2759,36 +3192,34 @@ query getApproverConfigs {
|
|
|
2759
3192
|
if (creationDate) {
|
|
2760
3193
|
if (typeof creationDate === 'object') {
|
|
2761
3194
|
creationDateFilter = `
|
|
2762
|
-
{key: "creationTimestamp", operator:GTE, value:
|
|
2763
|
-
{key: "creationTimestamp", operator:LTE, value:
|
|
3195
|
+
{key: "creationTimestamp", operator:GTE, value: ${gqlString(creationDate.start)}},
|
|
3196
|
+
{key: "creationTimestamp", operator:LTE, value: ${gqlString(creationDate.end)}},
|
|
2764
3197
|
`;
|
|
2765
3198
|
}
|
|
2766
3199
|
else {
|
|
2767
|
-
creationDateFilter = `{key: "creationTimestamp", operator:GTE, value:
|
|
3200
|
+
creationDateFilter = `{key: "creationTimestamp", operator:GTE, value: ${gqlString(creationDate)}},`;
|
|
2768
3201
|
}
|
|
2769
3202
|
}
|
|
2770
3203
|
const filters = `
|
|
2771
3204
|
filter: [
|
|
2772
|
-
${id ? `{key:"id",operator:EQ,value
|
|
2773
|
-
${name ? `{key:"name",operator:EQ,value
|
|
2774
|
-
${referenceId ? `{key:"reference_id",operator:EQ,value
|
|
2775
|
-
${status && status.length
|
|
2776
|
-
? `{key:"status",operator:IN,value:"[${status.map((s) => `\\"${s}\\"`).join(',')}]"},`
|
|
2777
|
-
: ''}
|
|
3205
|
+
${id ? `{key:"id",operator:EQ,value:${gqlString(id)}},` : ''}
|
|
3206
|
+
${name ? `{key:"name",operator:EQ,value:${gqlString(name)}},` : ''}
|
|
3207
|
+
${referenceId ? `{key:"reference_id",operator:EQ,value:${gqlString(referenceId)}},` : ''}
|
|
3208
|
+
${status && status.length ? `{key:"status",operator:IN,value:${gqlStringList(status)}},` : ''}
|
|
2778
3209
|
${healthStatus && healthStatus.length
|
|
2779
|
-
? `{key:"health.status",operator:IN,value
|
|
3210
|
+
? `{key:"health.status",operator:IN,value:${gqlStringList(healthStatus)}},`
|
|
2780
3211
|
: ''}
|
|
2781
3212
|
${creationDateFilter}
|
|
2782
3213
|
]
|
|
2783
3214
|
`;
|
|
2784
3215
|
const orderBy = sortField
|
|
2785
|
-
? `orderBy:{field: ${sortField}, direction: ${sortOrder || 'DESC'}}`
|
|
3216
|
+
? `orderBy:{field: ${(0, filterUtils_1.formatEnumValue)(sortField)}, direction: ${(0, filterUtils_1.formatEnumValue)(sortOrder || 'DESC')}}`
|
|
2786
3217
|
: `orderBy:{field: CREATION_TIMESTAMP, direction: DESC}`;
|
|
2787
3218
|
const query = `
|
|
2788
3219
|
query getWorkflows {
|
|
2789
3220
|
workflows
|
|
2790
3221
|
(${filters},
|
|
2791
|
-
${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 })}
|
|
3222
|
+
${(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 })}
|
|
2792
3223
|
${orderBy})
|
|
2793
3224
|
{
|
|
2794
3225
|
nodes {
|
|
@@ -2818,7 +3249,7 @@ query getWorkflows {
|
|
|
2818
3249
|
const query = `
|
|
2819
3250
|
query getWorkflowById {
|
|
2820
3251
|
workflows
|
|
2821
|
-
(filter: [{key:"id",operator:EQ,value
|
|
3252
|
+
(filter: [{key:"id",operator:EQ,value:${gqlString(id)}}])
|
|
2822
3253
|
{
|
|
2823
3254
|
nodes {
|
|
2824
3255
|
${routerWorkflowFragment}
|
|
@@ -2841,6 +3272,231 @@ query getWorkflowById {
|
|
|
2841
3272
|
}
|
|
2842
3273
|
return node;
|
|
2843
3274
|
}),
|
|
3275
|
+
// models - agreements (resource type 107)
|
|
3276
|
+
getAgreements: (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (request = {}) {
|
|
3277
|
+
var _a;
|
|
3278
|
+
const { filter } = request;
|
|
3279
|
+
const { id, idContains, organizationId, status } = filter || {};
|
|
3280
|
+
const filters = `
|
|
3281
|
+
filter: [
|
|
3282
|
+
${id ? `{key:"id",operator:EQ,value:${gqlString(id)}},` : ''}
|
|
3283
|
+
${idContains ? `{key:"id",operator:CONTAINS,value:${gqlString(idContains)}},` : ''}
|
|
3284
|
+
${organizationId ? `{key:"organizationId",operator:EQ,value:${gqlString(organizationId)}},` : ''}
|
|
3285
|
+
${(status === null || status === void 0 ? void 0 : status.length) ? `{key:"status",operator:IN,value:${gqlStringList(status)}},` : ''}
|
|
3286
|
+
]
|
|
3287
|
+
`;
|
|
3288
|
+
const query = `
|
|
3289
|
+
query getAgreements {
|
|
3290
|
+
agreements
|
|
3291
|
+
(${filters},
|
|
3292
|
+
${(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 })})
|
|
3293
|
+
{
|
|
3294
|
+
nodes {
|
|
3295
|
+
${agreementFragment}
|
|
3296
|
+
}
|
|
3297
|
+
${pageInfoFragment}
|
|
3298
|
+
}
|
|
3299
|
+
}
|
|
3300
|
+
`;
|
|
3301
|
+
const readyCondition = {
|
|
3302
|
+
match: (response) => isCompletePage(response === null || response === void 0 ? void 0 : response.agreements),
|
|
3303
|
+
name: 'getAgreements',
|
|
3304
|
+
strict: true,
|
|
3305
|
+
data: request,
|
|
3306
|
+
};
|
|
3307
|
+
const response = yield (0, utils_2.ossQuery)(client, logger, query, readyCondition);
|
|
3308
|
+
return { data: (_a = response.agreements.nodes) !== null && _a !== void 0 ? _a : [], pageInfo: response.agreements.pageInfo };
|
|
3309
|
+
}),
|
|
3310
|
+
getAgreementAccounts: (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (request = {}) {
|
|
3311
|
+
var _a;
|
|
3312
|
+
const { filter } = request;
|
|
3313
|
+
const { agreementId, finId, orgId, status } = filter || {};
|
|
3314
|
+
const filters = `
|
|
3315
|
+
filter: [
|
|
3316
|
+
${agreementId ? `{key:"agreementId",operator:EQ,value:${gqlString(agreementId)}},` : ''}
|
|
3317
|
+
${finId ? `{key:"finId",operator:EQ,value:${gqlString(finId)}},` : ''}
|
|
3318
|
+
${orgId ? `{key:"orgId",operator:EQ,value:${gqlString(orgId)}},` : ''}
|
|
3319
|
+
${(status === null || status === void 0 ? void 0 : status.length) ? `{key:"status",operator:IN,value:${gqlStringList(status)}},` : ''}
|
|
3320
|
+
]
|
|
3321
|
+
`;
|
|
3322
|
+
const query = `
|
|
3323
|
+
query getAgreementAccounts {
|
|
3324
|
+
agreementAccounts
|
|
3325
|
+
(${filters},
|
|
3326
|
+
${(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 })})
|
|
3327
|
+
{
|
|
3328
|
+
nodes {
|
|
3329
|
+
${agreementAccountFragment}
|
|
3330
|
+
}
|
|
3331
|
+
${pageInfoFragment}
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3334
|
+
`;
|
|
3335
|
+
const readyCondition = {
|
|
3336
|
+
match: (response) => isCompletePage(response === null || response === void 0 ? void 0 : response.agreementAccounts),
|
|
3337
|
+
name: 'getAgreementAccounts',
|
|
3338
|
+
strict: true,
|
|
3339
|
+
data: request,
|
|
3340
|
+
};
|
|
3341
|
+
const response = yield (0, utils_2.ossQuery)(client, logger, query, readyCondition);
|
|
3342
|
+
return { data: (_a = response.agreementAccounts.nodes) !== null && _a !== void 0 ? _a : [], pageInfo: response.agreementAccounts.pageInfo };
|
|
3343
|
+
}),
|
|
3344
|
+
// models - collateral facade (collateral.graphql, `collateral` namespace root;
|
|
3345
|
+
// gated by the OSS `enabled_features` config — unlicensed orgs get a GraphQL error)
|
|
3346
|
+
getCollateralAgreements: (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (request = {}) {
|
|
3347
|
+
var _a, _b;
|
|
3348
|
+
const { filter } = request;
|
|
3349
|
+
const { agreementId, agreementIdContains, orgId, status, createdAtFrom, createdAtTo, sortField, sortOrder } = filter || {};
|
|
3350
|
+
// 0 is a valid bound, so presence is checked rather than truthiness (as for reports).
|
|
3351
|
+
const hasFrom = createdAtFrom !== undefined && createdAtFrom !== null;
|
|
3352
|
+
const hasTo = createdAtTo !== undefined && createdAtTo !== null;
|
|
3353
|
+
// Interpolated raw into the document as enum literals, so only the schema's values get through.
|
|
3354
|
+
// A given but unknown value is refused, not replaced: a silent default would page in the wrong order.
|
|
3355
|
+
if (sortField !== undefined && !COLLATERAL_AGREEMENT_ORDER_FIELDS.includes(sortField)) {
|
|
3356
|
+
throw {
|
|
3357
|
+
code: 400,
|
|
3358
|
+
name: 'InvalidSortField',
|
|
3359
|
+
message: `Unknown collateral agreement sort field: ${sortField}`,
|
|
3360
|
+
};
|
|
3361
|
+
}
|
|
3362
|
+
if (sortOrder !== undefined && sortOrder !== 'ASC' && sortOrder !== 'DESC') {
|
|
3363
|
+
throw { code: 400, name: 'InvalidSortOrder', message: `Unknown sort order: ${sortOrder}` };
|
|
3364
|
+
}
|
|
3365
|
+
const orderField = sortField !== null && sortField !== void 0 ? sortField : 'CREATED_AT';
|
|
3366
|
+
const orderDirection = sortOrder !== null && sortOrder !== void 0 ? sortOrder : 'DESC';
|
|
3367
|
+
const filters = `
|
|
3368
|
+
filter: [
|
|
3369
|
+
${agreementId ? `{key:"agreementId",operator:EQ,value:${gqlString(agreementId)}},` : ''}
|
|
3370
|
+
${agreementIdContains ? `{key:"agreementId",operator:CONTAINS,value:${gqlString(agreementIdContains)}},` : ''}
|
|
3371
|
+
${orgId ? `{key:"orgId",operator:EQ,value:${gqlString(orgId)}},` : ''}
|
|
3372
|
+
${(status === null || status === void 0 ? void 0 : status.length) ? `{key:"status",operator:IN,value:${gqlStringList(status)}},` : ''}
|
|
3373
|
+
${hasFrom ? `{key:"createdAt",operator:GTE,value:${gqlString(createdAtFrom)}},` : ''}
|
|
3374
|
+
${hasTo ? `{key:"createdAt",operator:LTE,value:${gqlString(createdAtTo)}},` : ''}
|
|
3375
|
+
]
|
|
3376
|
+
`;
|
|
3377
|
+
const query = `
|
|
3378
|
+
query getCollateralAgreements {
|
|
3379
|
+
collateral {
|
|
3380
|
+
agreements
|
|
3381
|
+
(${filters},
|
|
3382
|
+
${(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 })}
|
|
3383
|
+
orderBy: {field: ${orderField}, direction: ${orderDirection}})
|
|
3384
|
+
{
|
|
3385
|
+
nodes {
|
|
3386
|
+
${collateralAgreementFragment}
|
|
3387
|
+
}
|
|
3388
|
+
${pageInfoFragment}
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
}
|
|
3392
|
+
`;
|
|
3393
|
+
const readyCondition = {
|
|
3394
|
+
match: (response) => {
|
|
3395
|
+
var _a;
|
|
3396
|
+
return isCompletePage((_a = response === null || response === void 0 ? void 0 : response.collateral) === null || _a === void 0 ? void 0 : _a.agreements);
|
|
3397
|
+
},
|
|
3398
|
+
name: 'getCollateralAgreements',
|
|
3399
|
+
strict: true,
|
|
3400
|
+
data: request,
|
|
3401
|
+
};
|
|
3402
|
+
const response = yield (0, utils_2.ossQuery)(client, logger, query, readyCondition);
|
|
3403
|
+
const page = response.collateral.agreements;
|
|
3404
|
+
return { data: (_a = page.nodes) !== null && _a !== void 0 ? _a : [], pageInfo: (_b = page.pageInfo) !== null && _b !== void 0 ? _b : emptyPageInfo };
|
|
3405
|
+
}),
|
|
3406
|
+
getCollateralReports: (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (request = {}) {
|
|
3407
|
+
var _a, _b;
|
|
3408
|
+
const { filter } = request;
|
|
3409
|
+
const { agreementId, reportId, reportIdContains, overlayStatus, type, createdAtFrom, createdAtTo, sortField, sortOrder, } = filter || {};
|
|
3410
|
+
// createdAt is epoch SECONDS on a report, and the bounds are inclusive: GTE/LTE, not GT/LT.
|
|
3411
|
+
// A bound of 0 is a real instant, so these test for undefined rather than truthiness.
|
|
3412
|
+
const hasFrom = createdAtFrom !== undefined && createdAtFrom !== null;
|
|
3413
|
+
const hasTo = createdAtTo !== undefined && createdAtTo !== null;
|
|
3414
|
+
// Interpolated raw into the document as enum literals, so only the schema's values get through.
|
|
3415
|
+
// A given but unknown value is refused, not replaced: a silent default would page in the wrong order.
|
|
3416
|
+
if (sortField !== undefined && !COLLATERAL_REPORT_ORDER_FIELDS.includes(sortField)) {
|
|
3417
|
+
throw {
|
|
3418
|
+
code: 400,
|
|
3419
|
+
name: 'InvalidSortField',
|
|
3420
|
+
message: `Unknown collateral report sort field: ${sortField}`,
|
|
3421
|
+
};
|
|
3422
|
+
}
|
|
3423
|
+
if (sortOrder !== undefined && sortOrder !== 'ASC' && sortOrder !== 'DESC') {
|
|
3424
|
+
throw { code: 400, name: 'InvalidSortOrder', message: `Unknown sort order: ${sortOrder}` };
|
|
3425
|
+
}
|
|
3426
|
+
const orderField = sortField !== null && sortField !== void 0 ? sortField : 'CREATED_AT';
|
|
3427
|
+
const orderDirection = sortOrder !== null && sortOrder !== void 0 ? sortOrder : 'DESC';
|
|
3428
|
+
const filters = `
|
|
3429
|
+
filter: [
|
|
3430
|
+
${agreementId ? `{key:"agreementId",operator:EQ,value:${gqlString(agreementId)}},` : ''}
|
|
3431
|
+
${reportId ? `{key:"reportId",operator:EQ,value:${gqlString(reportId)}},` : ''}
|
|
3432
|
+
${reportIdContains ? `{key:"reportId",operator:CONTAINS,value:${gqlString(reportIdContains)}},` : ''}
|
|
3433
|
+
${(overlayStatus === null || overlayStatus === void 0 ? void 0 : overlayStatus.length) ? `{key:"overlayStatus",operator:IN,value:${gqlStringList(overlayStatus)}},` : ''}
|
|
3434
|
+
${(type === null || type === void 0 ? void 0 : type.length) ? `{key:"type",operator:IN,value:${gqlStringList(type)}},` : ''}
|
|
3435
|
+
${hasFrom ? `{key:"createdAt",operator:GTE,value:${gqlString(createdAtFrom)}},` : ''}
|
|
3436
|
+
${hasTo ? `{key:"createdAt",operator:LTE,value:${gqlString(createdAtTo)}},` : ''}
|
|
3437
|
+
]
|
|
3438
|
+
`;
|
|
3439
|
+
const query = `
|
|
3440
|
+
query getCollateralReports {
|
|
3441
|
+
collateral {
|
|
3442
|
+
reports
|
|
3443
|
+
(${filters},
|
|
3444
|
+
${(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 })}
|
|
3445
|
+
orderBy: {field: ${orderField}, direction: ${orderDirection}})
|
|
3446
|
+
{
|
|
3447
|
+
nodes {
|
|
3448
|
+
${collateralReportFragment}
|
|
3449
|
+
}
|
|
3450
|
+
${pageInfoFragment}
|
|
3451
|
+
}
|
|
3452
|
+
}
|
|
3453
|
+
}
|
|
3454
|
+
`;
|
|
3455
|
+
const readyCondition = {
|
|
3456
|
+
match: (response) => { var _a; return isCompletePage((_a = response === null || response === void 0 ? void 0 : response.collateral) === null || _a === void 0 ? void 0 : _a.reports); },
|
|
3457
|
+
name: 'getCollateralReports',
|
|
3458
|
+
strict: true,
|
|
3459
|
+
data: request,
|
|
3460
|
+
};
|
|
3461
|
+
const response = yield (0, utils_2.ossQuery)(client, logger, query, readyCondition);
|
|
3462
|
+
const page = response.collateral.reports;
|
|
3463
|
+
return { data: (_a = page.nodes) !== null && _a !== void 0 ? _a : [], pageInfo: (_b = page.pageInfo) !== null && _b !== void 0 ? _b : emptyPageInfo };
|
|
3464
|
+
}),
|
|
3465
|
+
getCollateralContainerBooks: (request) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3466
|
+
var _a;
|
|
3467
|
+
const { agreementId } = request;
|
|
3468
|
+
if (!agreementId) {
|
|
3469
|
+
throw {
|
|
3470
|
+
code: 400,
|
|
3471
|
+
name: 'AgreementIdIsRequired',
|
|
3472
|
+
message: 'agreementId is required to get the container books!',
|
|
3473
|
+
};
|
|
3474
|
+
}
|
|
3475
|
+
const query = `
|
|
3476
|
+
query getCollateralContainerBooks {
|
|
3477
|
+
collateral {
|
|
3478
|
+
containerBooks(agreementId: ${gqlString(agreementId)}) {
|
|
3479
|
+
agreementId
|
|
3480
|
+
containers {
|
|
3481
|
+
${collateralContainerBookFragment}
|
|
3482
|
+
}
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
}
|
|
3486
|
+
`;
|
|
3487
|
+
const readyCondition = {
|
|
3488
|
+
match: (response) => {
|
|
3489
|
+
var _a;
|
|
3490
|
+
const books = (_a = response === null || response === void 0 ? void 0 : response.collateral) === null || _a === void 0 ? void 0 : _a.containerBooks;
|
|
3491
|
+
return isCompletePage(books && { nodes: books.containers });
|
|
3492
|
+
},
|
|
3493
|
+
name: 'getCollateralContainerBooks',
|
|
3494
|
+
strict: true,
|
|
3495
|
+
data: request,
|
|
3496
|
+
};
|
|
3497
|
+
const response = yield (0, utils_2.ossQuery)(client, logger, query, readyCondition);
|
|
3498
|
+
return (_a = response.collateral.containerBooks.containers) !== null && _a !== void 0 ? _a : [];
|
|
3499
|
+
}),
|
|
2844
3500
|
};
|
|
2845
3501
|
return ossInterface;
|
|
2846
3502
|
};
|