UNPKG

@fairmint/canton-node-sdk

Version:
186 lines 8.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GetTransactionTreeByIdParamsSchema = exports.GetUpdateByIdParamsSchema = exports.GetTransactionByIdParamsSchema = exports.GetUpdateByOffsetParamsSchema = exports.GetTransactionByOffsetParamsSchema = exports.GetUpdateTreesParamsSchema = exports.GetUpdatesParamsSchema = exports.GetTransactionTreeByOffsetParamsSchema = exports.TransactionFormatSchema = exports.TransactionShapeSchema = exports.OperationEventFormatSchema = exports.FiltersForAnyPartySchema = exports.CumulativeFilterSchema = exports.IdentifierFilterSchema = void 0; const zod_1 = require("zod"); const base_1 = require("./base"); // Shared identifier filter schema exports.IdentifierFilterSchema = zod_1.z.union([ zod_1.z.object({ Empty: zod_1.z.object({}) }), zod_1.z.object({ InterfaceFilter: zod_1.z.object({ interfaceId: zod_1.z.string(), includeInterfaceView: zod_1.z.boolean().optional(), includeCreatedEventBlob: zod_1.z.boolean().optional(), }) }), zod_1.z.object({ TemplateFilter: zod_1.z.object({ templateId: zod_1.z.string(), includeCreatedEventBlob: zod_1.z.boolean().optional(), }) }), zod_1.z.object({ WildcardFilter: zod_1.z.object({ includeCreatedEventBlob: zod_1.z.boolean().optional(), }) }), ]); /** * Schema for cumulative filter configuration. * Defines filters that accumulate across multiple operations. */ exports.CumulativeFilterSchema = zod_1.z.object({ identifierFilter: exports.IdentifierFilterSchema, }); /** * Schema for filters that apply to any party. * Defines cumulative filters that can be applied regardless of specific party. */ exports.FiltersForAnyPartySchema = zod_1.z.object({ cumulative: zod_1.z.array(exports.CumulativeFilterSchema), }).optional(); /** * Schema for event format configuration in operations. * Defines how events are filtered and formatted in request parameters. */ exports.OperationEventFormatSchema = zod_1.z.object({ filtersByParty: zod_1.z.record(zod_1.z.string(), zod_1.z.object({ cumulative: zod_1.z.array(exports.CumulativeFilterSchema), })), filtersForAnyParty: exports.FiltersForAnyPartySchema, verbose: zod_1.z.boolean().optional(), }); /** * Schema for transaction shape configuration. * Defines the level of detail provided in transaction responses. */ exports.TransactionShapeSchema = zod_1.z.union([ /** * AcsDelta: The transaction shape that is sufficient to maintain an accurate ACS view. * This translates to create and archive events. The field witness_parties in events are * populated as stakeholders, transaction filter will apply accordingly. */ zod_1.z.literal('TRANSACTION_SHAPE_ACS_DELTA'), /** * LedgerEffects: The transaction shape that allows maintaining an ACS and also conveys * detailed information about all exercises. This translates to create, consuming exercise * and non-consuming exercise. The field witness_parties in events are populated as * cumulative informees, transaction filter will apply accordingly. */ zod_1.z.literal('TRANSACTION_SHAPE_LEDGER_EFFECTS') ]); /** * Schema for transaction format configuration. * Defines the event format and transaction shape for ledger operations. */ exports.TransactionFormatSchema = zod_1.z.object({ eventFormat: exports.OperationEventFormatSchema, transactionShape: exports.TransactionShapeSchema, }); exports.GetTransactionTreeByOffsetParamsSchema = zod_1.z.object({ /** Offset in the ledger to fetch the transaction tree from. */ offset: base_1.NonEmptyStringSchema, /** Parties to include in the query (optional). */ parties: zod_1.z.array(zod_1.z.string()).optional(), }); /** * Schema for get updates parameters. * Defines parameters for retrieving flat updates from the ledger. */ exports.GetUpdatesParamsSchema = zod_1.z.object({ /** Beginning of the requested ledger section (non-negative integer). */ beginExclusive: zod_1.z.number(), /** End of the requested ledger section (optional). */ endInclusive: zod_1.z.number().optional(), /** Maximum number of elements to return (optional). */ limit: zod_1.z.number().optional(), /** Timeout to complete and send result if no new elements are received (optional). */ streamIdleTimeoutMs: zod_1.z.number().optional(), /** Update format for the request. */ updateFormat: zod_1.z.object({ includeTransactions: zod_1.z.object({ eventFormat: exports.OperationEventFormatSchema, transactionShape: exports.TransactionShapeSchema, }).optional(), includeReassignments: zod_1.z.object({ filtersByParty: zod_1.z.record(zod_1.z.string(), zod_1.z.object({ cumulative: zod_1.z.array(exports.CumulativeFilterSchema), })), filtersForAnyParty: exports.FiltersForAnyPartySchema, verbose: zod_1.z.boolean().optional(), }).optional(), includeTopologyEvents: zod_1.z.object({ includeParticipantAuthorizationEvents: zod_1.z.object({ parties: zod_1.z.array(zod_1.z.string()).optional(), }).optional(), }).optional(), }), }); /** * Schema for get update trees parameters. * Defines parameters for retrieving update trees from the ledger. * Same as GetUpdatesParams but for tree structures. */ exports.GetUpdateTreesParamsSchema = exports.GetUpdatesParamsSchema; /** * Schema for get transaction by offset parameters. * Defines parameters for retrieving a specific transaction by its offset. */ exports.GetTransactionByOffsetParamsSchema = zod_1.z.object({ /** Offset of the transaction being looked up. */ offset: zod_1.z.number(), /** Transaction format for the request. */ transactionFormat: exports.TransactionFormatSchema, }); /** * Schema for get update by offset parameters. * Defines parameters for retrieving a specific update by its offset. */ exports.GetUpdateByOffsetParamsSchema = zod_1.z.object({ /** Offset of the update being looked up. */ offset: zod_1.z.number(), /** Update format for the request. */ updateFormat: zod_1.z.object({ includeTransactions: zod_1.z.object({ eventFormat: exports.OperationEventFormatSchema, transactionShape: exports.TransactionShapeSchema, }).optional(), includeReassignments: zod_1.z.object({ filtersByParty: zod_1.z.record(zod_1.z.string(), zod_1.z.object({ cumulative: zod_1.z.array(exports.CumulativeFilterSchema), })), filtersForAnyParty: exports.FiltersForAnyPartySchema, verbose: zod_1.z.boolean().optional(), }).optional(), includeTopologyEvents: zod_1.z.object({ includeParticipantAuthorizationEvents: zod_1.z.object({ parties: zod_1.z.array(zod_1.z.string()).optional(), }).optional(), }).optional(), }), }); /** * Schema for get transaction by id parameters. * Defines parameters for retrieving a specific transaction by its ID. */ exports.GetTransactionByIdParamsSchema = zod_1.z.object({ /** ID of the transaction to fetch. */ updateId: zod_1.z.string(), /** Transaction format for the request. */ transactionFormat: exports.TransactionFormatSchema, }); /** * Schema for get update by id parameters. * Defines parameters for retrieving a specific update by its ID. */ exports.GetUpdateByIdParamsSchema = zod_1.z.object({ /** ID of the update to fetch. */ updateId: zod_1.z.string(), /** Parties requesting the update (optional). */ requestingParties: zod_1.z.array(zod_1.z.string()).optional(), }); /** * Schema for get transaction tree by id parameters. * Defines parameters for retrieving a transaction tree by its ID. */ exports.GetTransactionTreeByIdParamsSchema = zod_1.z.object({ /** Update ID to fetch the transaction tree for. */ updateId: base_1.NonEmptyStringSchema, /** Parties to include in the query (optional). */ parties: zod_1.z.array(zod_1.z.string()).optional(), }); //# sourceMappingURL=updates.js.map