UNPKG

@jsonjoy.com/reactive-rpc

Version:

Reactive-RPC is a library for building reactive APIs over WebSocket, HTTP, and other RPCs.

106 lines 6.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BlockEventRef = exports.BlockEvent = exports.BlockUpdateEvent = exports.BlockDeleteEvent = exports.BlockCreateEvent = exports.BlockRef = exports.Block = exports.BlockNewRef = exports.BlockNew = exports.NewBlockSnapshotResponseRef = exports.NewBlockSnapshotResponse = exports.BlockSnapshotRef = exports.BlockSnapshot = exports.BlockSnapshotReturnRef = exports.BlockSnapshotReturn = exports.BlockBatchRef = exports.BlockBatch = exports.BlockBatchPartialReturnRef = exports.BlockBatchPartialReturn = exports.BlockBatchPartialRef = exports.BlockBatchPartial = exports.BlockPatchRef = exports.BlockPatch = exports.BlockPatchPartialReturnRef = exports.BlockPatchPartialReturn = exports.BlockPatchPartialRef = exports.BlockPatchPartial = exports.BlockBatchSeqRef = exports.BlockBatchSeq = exports.BlockCurRef = exports.BlockCur = exports.BlockIdRef = exports.BlockId = void 0; const system_1 = require("../system"); exports.BlockId = system_1.t.str.options({ title: 'Block ID', min: 6, max: 256, }); exports.BlockIdRef = system_1.t.Ref('BlockId'); exports.BlockCur = system_1.t.num.options({ title: 'Block Sequence Number', gte: -1, format: 'i32', }); exports.BlockCurRef = system_1.t.Ref('BlockCur'); exports.BlockBatchSeq = system_1.t.num.options({ title: 'Batch Sequence Number', gte: 0, format: 'u32', }); exports.BlockBatchSeqRef = system_1.t.Ref('BlockBatchSeq'); exports.BlockPatchPartial = system_1.t.Object(system_1.t.prop('blob', system_1.t.bin).options({ title: 'Patch Blob', description: 'The binary data of the patch. The format of the data is defined by the patch type.', })); exports.BlockPatchPartialRef = system_1.t.Ref('BlockPatchPartial'); exports.BlockPatchPartialReturn = system_1.t.Object(system_1.t.prop('ts', system_1.t.num.options({ format: 'u' })).options({ title: 'Patch Creation Time', description: 'The time when the patch was created, in milliseconds since the Unix epoch.' + '\n\n' + 'This time is set by the server when the patch received and stored on the server. If you ' + 'want to also store the time when the patch was created by the user, you can include this ' + 'information in the patch blob itself.', })); exports.BlockPatchPartialReturnRef = system_1.t.Ref('BlockPatchPartialReturn'); exports.BlockPatch = exports.BlockPatchPartial.extend(exports.BlockPatchPartialReturn); exports.BlockPatchRef = system_1.t.Ref('BlockPatch'); exports.BlockBatchPartial = system_1.t.Object(system_1.t.prop('patches', system_1.t.Array(exports.BlockPatchPartialRef)), system_1.t.propOpt('cts', system_1.t.num.options({ format: 'u', title: 'Batch Creation Time', description: 'The time when the batch was created, in milliseconds since the Unix epoch.', }))); exports.BlockBatchPartialRef = system_1.t.Ref('BlockBatchPartial'); exports.BlockBatchPartialReturn = system_1.t.Object(system_1.t.prop('seq', system_1.t.num.options({ format: 'u' })).options({ title: 'Batch Sequence Number', description: 'The sequence number of the batch, representing the position in the history.', }), system_1.t.prop('ts', system_1.t.num.options({ format: 'u' })).options({ title: 'Batch Creation Time', description: 'The time when the batch was created, in milliseconds since the Unix epoch.' + '\n\n' + 'This time is set by the server when the batch was received and stored on the server.', })); exports.BlockBatchPartialReturnRef = system_1.t.Ref('BlockBatchPartialReturn'); exports.BlockBatch = exports.BlockBatchPartial.extend(exports.BlockBatchPartialReturn); exports.BlockBatchRef = system_1.t.Ref('BlockBatch'); exports.BlockSnapshotReturn = system_1.t .Object(system_1.t.prop('id', exports.BlockIdRef).options({ title: 'Block ID', description: 'The ID of the block.', }), system_1.t.prop('seq', exports.BlockCurRef).options({ title: 'Snapshot Cursor', description: 'The cursor of the snapshot, representing the position in the history.', }), system_1.t.prop('ts', system_1.t.num.options({ format: 'u' })).options({ title: 'Snapshot Creation Time', description: 'The time when the snapshot was created, in milliseconds since the Unix epoch.', })) .options({ title: 'Block Snapshot Return', description: "Partial snapshot returned on creation, doesn't include the blob.", }); exports.BlockSnapshotReturnRef = system_1.t.Ref('BlockSnapshotReturn'); exports.BlockSnapshot = exports.BlockSnapshotReturn.extend(system_1.t.Object(system_1.t.prop('blob', system_1.t.bin).options({ title: 'Snapshot Blob', description: 'A serialized JSON CRDT model.', }))).options({ title: 'Block Snapshot', description: "A snapshot of the block's state at a certain point in time.", }); exports.BlockSnapshotRef = system_1.t.Ref('BlockSnapshot'); exports.NewBlockSnapshotResponse = exports.BlockSnapshot.omit('blob'); exports.NewBlockSnapshotResponseRef = system_1.t.Ref('NewBlockSnapshotResponse'); exports.BlockNew = system_1.t.Object(system_1.t.prop('id', system_1.t.Ref('BlockId')), system_1.t.prop('ts', system_1.t.num.options({ format: 'u' })), system_1.t.prop('uts', system_1.t.num.options({ format: 'u' }))); exports.BlockNewRef = system_1.t.Ref('BlockNew'); exports.Block = exports.BlockNew.extend(system_1.t.Object(system_1.t.prop('snapshot', exports.BlockSnapshotRef), system_1.t.prop('tip', system_1.t.Array(exports.BlockBatchRef)))); exports.BlockRef = system_1.t.Ref('Block'); exports.BlockCreateEvent = system_1.t .Tuple(system_1.t.Const('new').options({ title: 'Event Type' })) .options({ title: 'Creation Event' }); exports.BlockDeleteEvent = system_1.t .Tuple(system_1.t.Const('del').options({ title: 'Event Type' })) .options({ title: 'Delete Event' }); exports.BlockUpdateEvent = system_1.t .Tuple(system_1.t.Const('upd').options({ title: 'Event Type' }), system_1.t .Object(system_1.t.prop('batch', exports.BlockBatchRef).options({ title: 'Latest Patches', description: 'Patches that have been applied to the block.', })) .options({ title: 'Event Data' })) .options({ title: 'Update Event' }); exports.BlockEvent = system_1.t.Or(exports.BlockCreateEvent, exports.BlockUpdateEvent, exports.BlockDeleteEvent).options({ title: 'Block Event', description: 'A collection of possible events that can happen to a block.', }); exports.BlockEventRef = system_1.t.Ref('BlockEvent'); //# sourceMappingURL=schema.js.map