The server side library to deploy remote proxies of uServices from Marklogic

Usage no npm install needed!

<script type="module">
  import markscriptUservicesServer from '';


MarkScript uServices server side Library


Deploy remote proxies of uServices from Marklogic.



npm install markscript-uservices

Basic Usage:

To use this as part of a MarkScript build, add this property to the root of your build options:

import {UServicesPlugin} from 'markscript-uservices'

let buildOptions = {
  plugins: {
    uservices: [UServicesPlugin, {}]
  // etc

For a uService on Marklogic:

import * as mu from 'markscript-uservices'
import {Observable} from 'uservices'
import {Message} from '../common/models/message'
import {ChatService} from '../common/services/chatService'

export class ChatService extends extends mu.AbstractMLService {
    method: 'put'
  sendMessage(message: Message): Promise<boolean> {
    xdmp.documentInsert('/chatMessages/' + message.timestamp, message)

    states: ['create', 'modify'],
    scope: '/chatMessages/'
  messageBroadcast(): Observable<Message> {
    return this.observableFactory().map(function(doc: Doc<Message>{
      return doc.value

Then to proxy that to another tier:

import {createRemoteProxy} from 'markscript-uservices'
import * as RxRouter from 'koa-rx-router'

let router = new RxRouter()
let chatService = createRemoteProxy(chatSpec, client, router)