@fairmint/canton-node-sdk
Version:
Canton Node SDK
94 lines • 3.55 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CompletionStreamResponseSchema = exports.CompletionStreamRequestSchema = exports.CompletionResponseSchema = exports.OffsetCheckpointSchema = exports.CompletionSchema = exports.SynchronizerTimeSchema = exports.JsStatusSchema = void 0;
const zod_1 = require("zod");
const event_details_1 = require("./event-details");
const commands_1 = require("./commands");
const common_1 = require("../common");
/**
* Status information for completions.
*/
exports.JsStatusSchema = zod_1.z.object({
/** Status code. */
code: zod_1.z.number(),
/** Status message. */
message: zod_1.z.string(),
/** Additional details (optional). */
details: zod_1.z.array(event_details_1.StatusDetailsSchema).optional(),
});
/**
* Synchronizer time information.
*/
exports.SynchronizerTimeSchema = zod_1.z.object({
/** Synchronizer ID. */
synchronizerId: zod_1.z.string(),
/** Record time. */
recordTime: zod_1.z.string(),
});
/**
* Completion details.
*/
exports.CompletionSchema = zod_1.z.object({
/** The completion details. */
value: zod_1.z.object({
/** Command ID of the succeeded or failed command. */
commandId: zod_1.z.string(),
/** Status information (optional). */
status: exports.JsStatusSchema.optional(),
/** Update ID of the transaction (optional). */
updateId: zod_1.z.string().optional(),
/** User ID that was used for the submission (optional). */
userId: zod_1.z.string().optional(),
/** Parties on whose behalf the commands were executed (optional). */
actAs: zod_1.z.array(zod_1.z.string()).optional(),
/** Submission ID (optional). */
submissionId: zod_1.z.string().optional(),
/** Deduplication period. */
deduplicationPeriod: commands_1.DeduplicationPeriodSchema,
/** Trace context (optional). */
traceContext: common_1.TraceContextSchema.optional(),
/** Offset for resuming the stream. */
offset: zod_1.z.number(),
/** Synchronizer time information. */
synchronizerTime: exports.SynchronizerTimeSchema,
}),
});
/**
* Offset checkpoint for stream resumption.
*/
exports.OffsetCheckpointSchema = zod_1.z.object({
/** The checkpoint details. */
value: zod_1.z.object({
/** Offset for resuming the stream. */
offset: zod_1.z.number(),
/** Synchronizer times. */
synchronizerTimes: zod_1.z.array(exports.SynchronizerTimeSchema),
}),
});
/**
* Completion response (oneOf completion, empty, or offset checkpoint).
*/
exports.CompletionResponseSchema = zod_1.z.union([
zod_1.z.object({ Completion: exports.CompletionSchema }),
zod_1.z.object({ Empty: zod_1.z.object({}) }),
zod_1.z.object({ OffsetCheckpoint: exports.OffsetCheckpointSchema }),
]);
/**
* Completion stream request.
*/
exports.CompletionStreamRequestSchema = zod_1.z.object({
/** User ID for the stream (optional if using authentication). */
userId: zod_1.z.string().optional(),
/** Parties whose data should be included. */
parties: zod_1.z.array(zod_1.z.string()),
/** Beginning offset (exclusive) for resuming the stream. */
beginExclusive: zod_1.z.number().optional(),
});
/**
* Completion stream response.
*/
exports.CompletionStreamResponseSchema = zod_1.z.object({
/** The completion response. */
completionResponse: exports.CompletionResponseSchema,
});
//# sourceMappingURL=completions.js.map