UNPKG

@sprucelabs/mercury-client

Version:

The simple way to interact with the Spruce Experience Platform

49 lines (48 loc) 1.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.connectionStatusContract = void 0; const mercury_types_1 = require("@sprucelabs/mercury-types"); const schema_1 = require("@sprucelabs/schema"); const statusChangePayloadSchema = (0, schema_1.buildSchema)({ id: 'connectionStatusChangeEmitPayload', fields: { status: { type: 'select', isRequired: true, options: { choices: [ { label: 'Connecting', value: 'connecting', }, { label: 'Connected', value: 'connected', }, { label: 'Disconnected', value: 'disconnected', }, ], }, }, }, }); const statusChangeTargetAndPayloadSchema = (0, schema_1.buildSchema)({ id: 'connectionStatusChangeEmitTargetAndPayload', fields: { payload: { type: 'schema', isRequired: true, options: { schema: statusChangePayloadSchema }, }, }, }); exports.connectionStatusContract = (0, mercury_types_1.buildEventContract)({ id: 'connectionStatus', eventSignatures: { 'connection-status-change': { emitPayloadSchema: statusChangeTargetAndPayloadSchema, }, }, });