@kubun/protocol 0.5.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import type { AnyClientMessageOf, AnyServerMessageOf, ClientTransportOf, ServerTransportOf } from '@enkaku/protocol';
2
- import type { DocumentProtocol } from './services/document.js';
3
2
  import type { GraphProtocol } from './services/graph.js';
4
3
  import type { SyncProtocol } from './services/sync.js';
5
4
  export * from './models/cluster.js';
@@ -7,11 +6,10 @@ export * from './models/document.js';
7
6
  export * from './models/graph.js';
8
7
  export * from './models/json-schema.js';
9
8
  export * from './models/value.js';
10
- export * from './services/document.js';
11
9
  export * from './services/graph.js';
12
10
  export * from './services/sync.js';
13
11
  export * from './types.js';
14
- export type Protocol = DocumentProtocol & GraphProtocol & SyncProtocol;
12
+ export type Protocol = GraphProtocol & SyncProtocol;
15
13
  export type ClientMessage = AnyClientMessageOf<Protocol>;
16
14
  export type ServerMessage = AnyServerMessageOf<Protocol>;
17
15
  export type ClientTransport = ClientTransportOf<Protocol>;
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- export*from"./models/cluster.js";export*from"./models/document.js";export*from"./models/graph.js";export*from"./models/json-schema.js";export*from"./models/value.js";export*from"./services/document.js";export*from"./services/graph.js";export*from"./services/sync.js";export*from"./types.js";
1
+ export*from"./models/cluster.js";export*from"./models/document.js";export*from"./models/graph.js";export*from"./models/json-schema.js";export*from"./models/value.js";export*from"./services/graph.js";export*from"./services/sync.js";export*from"./types.js";
@@ -5178,13 +5178,11 @@ export declare const setDocumentMutation: {
5178
5178
  readonly type: "string";
5179
5179
  };
5180
5180
  readonly data: {
5181
- readonly anyOf: readonly [{
5182
- readonly title: "KubunBinaryValue";
5183
- readonly type: "string";
5184
- readonly pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$";
5185
- }, {
5186
- readonly type: "null";
5187
- }];
5181
+ readonly type: "object";
5182
+ readonly additionalProperties: true;
5183
+ };
5184
+ readonly hlc: {
5185
+ readonly type: "string";
5188
5186
  };
5189
5187
  readonly unq: {
5190
5188
  readonly title: "KubunBinaryValue";
@@ -5202,10 +5200,27 @@ export declare const setDocumentMutation: {
5202
5200
  }];
5203
5201
  };
5204
5202
  };
5205
- readonly required: readonly ["iss", "sub", "typ", "data", "unq"];
5203
+ readonly required: readonly ["iss", "sub", "typ", "data", "hlc", "unq"];
5206
5204
  readonly additionalProperties: false;
5207
5205
  };
5208
5206
  export type SetDocumentMutation = FromSchema<typeof setDocumentMutation>;
5207
+ export declare const patchOperationSchema: {
5208
+ readonly type: "object";
5209
+ readonly properties: {
5210
+ readonly op: {
5211
+ readonly type: "string";
5212
+ };
5213
+ readonly path: {
5214
+ readonly type: "string";
5215
+ };
5216
+ readonly value: {};
5217
+ readonly from: {
5218
+ readonly type: "string";
5219
+ };
5220
+ };
5221
+ readonly required: readonly ["op", "path"];
5222
+ readonly additionalProperties: false;
5223
+ };
5209
5224
  export declare const changeDocumentMutation: {
5210
5225
  readonly $id: "urn:kubun:protocol:mutation:change";
5211
5226
  readonly type: "object";
@@ -5222,17 +5237,28 @@ export declare const changeDocumentMutation: {
5222
5237
  readonly sub: {
5223
5238
  readonly type: "string";
5224
5239
  };
5225
- readonly data: {
5226
- readonly anyOf: readonly [{
5227
- readonly title: "KubunBinaryValue";
5228
- readonly type: "string";
5229
- readonly pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$";
5230
- }, {
5231
- readonly type: "null";
5232
- }];
5240
+ readonly patch: {
5241
+ readonly type: "array";
5242
+ readonly items: {
5243
+ readonly type: "object";
5244
+ readonly properties: {
5245
+ readonly op: {
5246
+ readonly type: "string";
5247
+ };
5248
+ readonly path: {
5249
+ readonly type: "string";
5250
+ };
5251
+ readonly value: {};
5252
+ readonly from: {
5253
+ readonly type: "string";
5254
+ };
5255
+ };
5256
+ readonly required: readonly ["op", "path"];
5257
+ readonly additionalProperties: false;
5258
+ };
5233
5259
  };
5234
- readonly inc: {
5235
- readonly type: "boolean";
5260
+ readonly hlc: {
5261
+ readonly type: "string";
5236
5262
  };
5237
5263
  readonly cap: {
5238
5264
  readonly anyOf: readonly [{
@@ -5245,7 +5271,7 @@ export declare const changeDocumentMutation: {
5245
5271
  }];
5246
5272
  };
5247
5273
  };
5248
- readonly required: readonly ["iss", "sub", "typ", "data", "inc"];
5274
+ readonly required: readonly ["iss", "sub", "typ", "patch", "hlc"];
5249
5275
  readonly additionalProperties: false;
5250
5276
  };
5251
5277
  export type ChangeDocumentMutation = FromSchema<typeof changeDocumentMutation>;
@@ -5273,13 +5299,11 @@ export declare const documentMutation: {
5273
5299
  readonly type: "string";
5274
5300
  };
5275
5301
  readonly data: {
5276
- readonly anyOf: readonly [{
5277
- readonly title: "KubunBinaryValue";
5278
- readonly type: "string";
5279
- readonly pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$";
5280
- }, {
5281
- readonly type: "null";
5282
- }];
5302
+ readonly type: "object";
5303
+ readonly additionalProperties: true;
5304
+ };
5305
+ readonly hlc: {
5306
+ readonly type: "string";
5283
5307
  };
5284
5308
  readonly unq: {
5285
5309
  readonly title: "KubunBinaryValue";
@@ -5297,7 +5321,7 @@ export declare const documentMutation: {
5297
5321
  }];
5298
5322
  };
5299
5323
  };
5300
- readonly required: readonly ["iss", "sub", "typ", "data", "unq"];
5324
+ readonly required: readonly ["iss", "sub", "typ", "data", "hlc", "unq"];
5301
5325
  readonly additionalProperties: false;
5302
5326
  }, {
5303
5327
  readonly $id: "urn:kubun:protocol:mutation:change";
@@ -5315,17 +5339,28 @@ export declare const documentMutation: {
5315
5339
  readonly sub: {
5316
5340
  readonly type: "string";
5317
5341
  };
5318
- readonly data: {
5319
- readonly anyOf: readonly [{
5320
- readonly title: "KubunBinaryValue";
5321
- readonly type: "string";
5322
- readonly pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$";
5323
- }, {
5324
- readonly type: "null";
5325
- }];
5342
+ readonly patch: {
5343
+ readonly type: "array";
5344
+ readonly items: {
5345
+ readonly type: "object";
5346
+ readonly properties: {
5347
+ readonly op: {
5348
+ readonly type: "string";
5349
+ };
5350
+ readonly path: {
5351
+ readonly type: "string";
5352
+ };
5353
+ readonly value: {};
5354
+ readonly from: {
5355
+ readonly type: "string";
5356
+ };
5357
+ };
5358
+ readonly required: readonly ["op", "path"];
5359
+ readonly additionalProperties: false;
5360
+ };
5326
5361
  };
5327
- readonly inc: {
5328
- readonly type: "boolean";
5362
+ readonly hlc: {
5363
+ readonly type: "string";
5329
5364
  };
5330
5365
  readonly cap: {
5331
5366
  readonly anyOf: readonly [{
@@ -5338,7 +5373,7 @@ export declare const documentMutation: {
5338
5373
  }];
5339
5374
  };
5340
5375
  };
5341
- readonly required: readonly ["iss", "sub", "typ", "data", "inc"];
5376
+ readonly required: readonly ["iss", "sub", "typ", "patch", "hlc"];
5342
5377
  readonly additionalProperties: false;
5343
5378
  }];
5344
5379
  };
@@ -1 +1 @@
1
- import{asType as e,createValidator as t}from"@enkaku/schema";import{DocumentModelID as r,ScalarModelID as o,ShapeModelID as i}from"@kubun/id";import{pascalCase as s}from"change-case";import{baseObjectModel as n,nameString as a,referencesRecordModel as d}from"./json-schema.js";import{binaryStringValue as c,didStringValue as l}from"./value.js";export const documentModelVersion={type:"string",const:"1.0"};export const documentFieldMetaAccount={type:"object",properties:{type:{type:"string",const:"account"},searchable:{type:"boolean"}},required:["type"],additionalProperties:!1};export const documentFieldMetaAttachment={type:"object",properties:{type:{type:"string",const:"attachment"},searchable:{type:"boolean"}},required:["type"],additionalProperties:!1};export const documentFieldMetaDocument={type:"object",properties:{type:{type:"string",const:"document"},model:{anyOf:[{type:"string"},{type:"null"}]},searchable:{type:"boolean"}},required:["type","model"],additionalProperties:!1};export const documentFieldMeta={anyOf:[documentFieldMetaAccount,documentFieldMetaAttachment,documentFieldMetaDocument]};export const documentFieldsMeta={type:"object",additionalProperties:documentFieldMeta};export const documentModelSchema={type:"object",properties:{...n.properties,$defs:d},required:[...n.required,"$defs"],additionalProperties:!1};export const documentModelBase={type:"object",properties:{name:a,version:documentModelVersion,interfaces:{type:"array",items:{type:"string"}},schema:documentModelSchema,fieldsMeta:documentFieldsMeta},required:["name","version","interfaces","schema","fieldsMeta"],additionalProperties:!1};export const documentModelDefault={type:"object",properties:{...documentModelBase.properties,behavior:{type:"string",const:"default"}},required:[...documentModelBase.required,"behavior"],additionalProperties:!1};export const documentModelInterface={type:"object",properties:{...documentModelBase.properties,behavior:{type:"string",const:"interface"}},required:[...documentModelBase.required,"behavior"],additionalProperties:!1};export const documentModelUnique={type:"object",properties:{...documentModelBase.properties,behavior:{type:"string",const:"unique"},uniqueFields:{type:"array",items:{type:"string"}}},required:[...documentModelBase.required,"behavior","uniqueFields"],additionalProperties:!1};export const documentModel={$id:"urn:kubun:protocol:model:document",anyOf:[documentModelDefault,documentModelInterface,documentModelUnique]};export const documentModelsCluster={type:"array",items:documentModel};export const documentModelsRecord={type:"object",additionalProperties:documentModel};export const setDocumentMutation={$id:"urn:kubun:protocol:mutation:set",type:"object",properties:{typ:{type:"string",const:"set"},iss:l,aud:l,sub:{type:"string"},data:{anyOf:[c,{type:"null"}]},unq:c,cap:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}},required:["iss","sub","typ","data","unq"],additionalProperties:!1};export const changeDocumentMutation={$id:"urn:kubun:protocol:mutation:change",type:"object",properties:{typ:{type:"string",const:"change"},iss:l,sub:{type:"string"},data:{anyOf:[c,{type:"null"}]},inc:{type:"boolean"},cap:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}},required:["iss","sub","typ","data","inc"],additionalProperties:!1};export const documentMutation={$id:"urn:kubun:protocol:mutation",anyOf:[setDocumentMutation,changeDocumentMutation]};export const validateDocumentModel=t(documentModel);export const REFERENCE_PREFIX="#/$defs/";let p={type:"object",title:"JSONObject",additionalProperties:!0},u=/^#([0-9]+)$/;export class DocumentModelNormalizer{#e;#t=new Set;#r;#o;#i;#s;#n={};#a={};#d=new Set;#c={};constructor(e){this.#e=e.inputModel,this.#r=e.logger;let t=e.inputModel.schema??{};this.#l(e.interfaceModels),this.#p(t,e.normalizedInterfaceIDs),this.#i=t.$defs??{},this.#s={...t,type:"object",properties:this.#n,required:Array.from(this.#d),additionalProperties:!1,$defs:{...t.$defs,...this.#a}},this.#o=this.#u(),this.#m()}#l(e){for(let t of e){for(let e of t.interfaces)this.#t.add(e);for(let e of t.schema.required)this.#d.add(e);Object.assign(this.#n,t.schema.properties),Object.assign(this.#a,t.schema.$defs),Object.assign(this.#c,t.fieldsMeta??{})}}#p(e,t){for(let e of t)this.#t.add(e);for(let t of e.required??[])this.#d.add(t);Object.assign(this.#n,e.properties??{}),Object.assign(this.#c,this.#e.fieldsMeta??{})}#u(){let e=this.#s,t=Object.entries(e.properties??{});if(0===t.length)throw Error("Document schema must contain at least one property");let r={};for(let[e,o]of t)r[e]={$ref:this.#h(e,o)};return{type:"object",properties:r,additionalProperties:!1,required:e.required??[],$defs:this.#i}}#h(e,t){if(null!=t.$ref){let r=this.#f(t.$ref);return this.#h(e,r)}let r=t.type;if(null==r)throw Error("Invalid schema: missing type");switch(r){case"array":{if(null==t.title)throw Error("Invalid array schema: missing title");if(null==t.items)throw Error("Invalid array schema: missing items");let{default:r,...o}=t;return this.#y({...o,title:s(t.title),items:{$ref:this.#h(e,t.items)}})}case"object":{if(t.additionalProperties)return this.#y(p);if(null==t.title)throw Error("Invalid object schema: missing title");let e=Object.entries(t.properties??{});if(0===e.length)throw Error("Invalid object schema: must contain at least one property");let r={};for(let[t,o]of e)r[t]={$ref:this.#h(t,o)};return this.#y({type:"object",title:s(t.title),properties:r,required:t.required??[],additionalProperties:!1})}default:return this.#M(e,t)}}#f(e){if(!e.startsWith("#"))throw Error(`Invalid reference format: ${e}`);if(e.startsWith(REFERENCE_PREFIX)){let t=e.slice(REFERENCE_PREFIX.length),r=this.#s.$defs?.[t];if(null==r)throw Error(`Reference not found: ${e}`);return r}let t=e.split("/").slice(1),r=this.#s;for(let o of t){if(null==r||"object"!=typeof r)throw Error(`Invalid reference path: ${e}`);if(null==(r=r[o]))throw Error(`Reference not found: ${e}`)}return r}#M(e,t){let r=o.create(t),i=t;if("boolean"===t.type){let{title:e,...r}=t;i=r}else if(null!=t.title){let r=t.title.toLowerCase();"attachmentid"===r?(this.#c[e]={type:"attachment"},i={...t,title:"attachmentid"}):"did"===r?(this.#c[e]={type:"account"},i={...t,title:"did"}):"docid"===r?(null==this.#c[e]&&(this.#r.warn("Missing fieldMeta entry for document reference {fieldKey} of model {inputModel}",{fieldKey:e,inputModel:this.#e}),this.#c[e]={type:"document",model:null}),i={...t,title:"docid"}):i={...t,title:s(t.title)}}return this.#i[r.toString()]=i,`${REFERENCE_PREFIX}${r}`}#y(e){let t=i.create(e);return this.#i[t.toString()]=e,`${REFERENCE_PREFIX}${t}`}#m(){for(let[e,t]of Object.entries(this.#c)){if("document"!==t.type||null===t.model)continue;let o=t.model.match(u);null!=o&&(this.#c[e]={...t,model:r.local(Number.parseInt(o[1],10)).toString()})}}toDocumentModel(){return e(validateDocumentModel,{version:"1.0",behavior:"default",...this.#e,interfaces:Array.from(this.#t),schema:this.#o,fieldsMeta:this.#c})}}
1
+ import{asType as e,createValidator as t}from"@enkaku/schema";import{DocumentModelID as r,ScalarModelID as o,ShapeModelID as i}from"@kubun/id";import{pascalCase as s}from"change-case";import{baseObjectModel as n,nameString as a,referencesRecordModel as d}from"./json-schema.js";import{binaryStringValue as c,didStringValue as l}from"./value.js";export const documentModelVersion={type:"string",const:"1.0"};export const documentFieldMetaAccount={type:"object",properties:{type:{type:"string",const:"account"},searchable:{type:"boolean"}},required:["type"],additionalProperties:!1};export const documentFieldMetaAttachment={type:"object",properties:{type:{type:"string",const:"attachment"},searchable:{type:"boolean"}},required:["type"],additionalProperties:!1};export const documentFieldMetaDocument={type:"object",properties:{type:{type:"string",const:"document"},model:{anyOf:[{type:"string"},{type:"null"}]},searchable:{type:"boolean"}},required:["type","model"],additionalProperties:!1};export const documentFieldMeta={anyOf:[documentFieldMetaAccount,documentFieldMetaAttachment,documentFieldMetaDocument]};export const documentFieldsMeta={type:"object",additionalProperties:documentFieldMeta};export const documentModelSchema={type:"object",properties:{...n.properties,$defs:d},required:[...n.required,"$defs"],additionalProperties:!1};export const documentModelBase={type:"object",properties:{name:a,version:documentModelVersion,interfaces:{type:"array",items:{type:"string"}},schema:documentModelSchema,fieldsMeta:documentFieldsMeta},required:["name","version","interfaces","schema","fieldsMeta"],additionalProperties:!1};export const documentModelDefault={type:"object",properties:{...documentModelBase.properties,behavior:{type:"string",const:"default"}},required:[...documentModelBase.required,"behavior"],additionalProperties:!1};export const documentModelInterface={type:"object",properties:{...documentModelBase.properties,behavior:{type:"string",const:"interface"}},required:[...documentModelBase.required,"behavior"],additionalProperties:!1};export const documentModelUnique={type:"object",properties:{...documentModelBase.properties,behavior:{type:"string",const:"unique"},uniqueFields:{type:"array",items:{type:"string"}}},required:[...documentModelBase.required,"behavior","uniqueFields"],additionalProperties:!1};export const documentModel={$id:"urn:kubun:protocol:model:document",anyOf:[documentModelDefault,documentModelInterface,documentModelUnique]};export const documentModelsCluster={type:"array",items:documentModel};export const documentModelsRecord={type:"object",additionalProperties:documentModel};export const setDocumentMutation={$id:"urn:kubun:protocol:mutation:set",type:"object",properties:{typ:{type:"string",const:"set"},iss:l,aud:l,sub:{type:"string"},data:{type:"object",additionalProperties:!0},hlc:{type:"string"},unq:c,cap:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}},required:["iss","sub","typ","data","hlc","unq"],additionalProperties:!1};export const patchOperationSchema={type:"object",properties:{op:{type:"string"},path:{type:"string"},value:{},from:{type:"string"}},required:["op","path"],additionalProperties:!1};export const changeDocumentMutation={$id:"urn:kubun:protocol:mutation:change",type:"object",properties:{typ:{type:"string",const:"change"},iss:l,sub:{type:"string"},patch:{type:"array",items:patchOperationSchema},hlc:{type:"string"},cap:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}},required:["iss","sub","typ","patch","hlc"],additionalProperties:!1};export const documentMutation={$id:"urn:kubun:protocol:mutation",anyOf:[setDocumentMutation,changeDocumentMutation]};export const validateDocumentModel=t(documentModel);export const REFERENCE_PREFIX="#/$defs/";let p={type:"object",title:"JSONObject",additionalProperties:!0},u=/^#([0-9]+)$/;export class DocumentModelNormalizer{#e;#t=new Set;#r;#o;#i;#s;#n={};#a={};#d=new Set;#c={};constructor(e){this.#e=e.inputModel,this.#r=e.logger;let t=e.inputModel.schema??{};this.#l(e.interfaceModels),this.#p(t,e.normalizedInterfaceIDs),this.#i=t.$defs??{},this.#s={...t,type:"object",properties:this.#n,required:Array.from(this.#d),additionalProperties:!1,$defs:{...t.$defs,...this.#a}},this.#o=this.#u(),this.#m()}#l(e){for(let t of e){for(let e of t.interfaces)this.#t.add(e);for(let e of t.schema.required)this.#d.add(e);Object.assign(this.#n,t.schema.properties),Object.assign(this.#a,t.schema.$defs),Object.assign(this.#c,t.fieldsMeta??{})}}#p(e,t){for(let e of t)this.#t.add(e);for(let t of e.required??[])this.#d.add(t);Object.assign(this.#n,e.properties??{}),Object.assign(this.#c,this.#e.fieldsMeta??{})}#u(){let e=this.#s,t=Object.entries(e.properties??{});if(0===t.length)throw Error("Document schema must contain at least one property");let r={};for(let[e,o]of t)r[e]={$ref:this.#h(e,o)};return{type:"object",properties:r,additionalProperties:!1,required:e.required??[],$defs:this.#i}}#h(e,t){if(null!=t.$ref){let r=this.#f(t.$ref);return this.#h(e,r)}let r=t.type;if(null==r)throw Error("Invalid schema: missing type");switch(r){case"array":{if(null==t.title)throw Error("Invalid array schema: missing title");if(null==t.items)throw Error("Invalid array schema: missing items");let{default:r,...o}=t;return this.#y({...o,title:s(t.title),items:{$ref:this.#h(e,t.items)}})}case"object":{if(t.additionalProperties)return this.#y(p);if(null==t.title)throw Error("Invalid object schema: missing title");let e=Object.entries(t.properties??{});if(0===e.length)throw Error("Invalid object schema: must contain at least one property");let r={};for(let[t,o]of e)r[t]={$ref:this.#h(t,o)};return this.#y({type:"object",title:s(t.title),properties:r,required:t.required??[],additionalProperties:!1})}default:return this.#M(e,t)}}#f(e){if(!e.startsWith("#"))throw Error(`Invalid reference format: ${e}`);if(e.startsWith(REFERENCE_PREFIX)){let t=e.slice(REFERENCE_PREFIX.length),r=this.#s.$defs?.[t];if(null==r)throw Error(`Reference not found: ${e}`);return r}let t=e.split("/").slice(1),r=this.#s;for(let o of t){if(null==r||"object"!=typeof r)throw Error(`Invalid reference path: ${e}`);if(null==(r=r[o]))throw Error(`Reference not found: ${e}`)}return r}#M(e,t){let r=o.create(t),i=t;if("boolean"===t.type){let{title:e,...r}=t;i=r}else if(null!=t.title){let r=t.title.toLowerCase();"attachmentid"===r?(this.#c[e]={type:"attachment"},i={...t,title:"attachmentid"}):"did"===r?(this.#c[e]={type:"account"},i={...t,title:"did"}):"docid"===r?(null==this.#c[e]&&(this.#r.warn("Missing fieldMeta entry for document reference {fieldKey} of model {inputModel}",{fieldKey:e,inputModel:this.#e}),this.#c[e]={type:"document",model:null}),i={...t,title:"docid"}):i={...t,title:s(t.title)}}return this.#i[r.toString()]=i,`${REFERENCE_PREFIX}${r}`}#y(e){let t=i.create(e);return this.#i[t.toString()]=e,`${REFERENCE_PREFIX}${t}`}#m(){for(let[e,t]of Object.entries(this.#c)){if("document"!==t.type||null===t.model)continue;let o=t.model.match(u);null!=o&&(this.#c[e]={...t,model:r.local(Number.parseInt(o[1],10)).toString()})}}toDocumentModel(){return e(validateDocumentModel,{version:"1.0",behavior:"default",...this.#e,interfaces:Array.from(this.#t),schema:this.#o,fieldsMeta:this.#c})}}
@@ -1 +1 @@
1
- import{verifyCluster as e}from"./cluster.js";export class GraphModel{static fromClusters(r){let s={};for(let t of r.clusters.map(e))Object.assign(s,t);return new GraphModel({aliases:r.aliases,record:s})}#e;#r;constructor(e){this.#e=e.aliases??Object.entries(e.record).reduce((e,[r,s])=>(null==e[s.name]?e[s.name]=r:console.warn(`Duplicate model name ${s.name} in GraphModel record, ignoring model ID ${r} in aliases`),e),{}),this.#r=e.record}get aliases(){return this.#e}get record(){return this.#r}getAlias(e){for(let[r,s]of Object.entries(this.#e))if(s===e)return r;return null}getModel(e){let r=this.#e[e]??e;return this.#r[r]??null}toJSON(){return{aliases:this.#e,record:this.#r}}}
1
+ import{verifyCluster as e}from"./cluster.js";export class GraphModel{static fromClusters(s){let r={};for(let a of s.clusters.map(e))Object.assign(r,a);return new GraphModel({aliases:s.aliases,record:r})}#e;#s;constructor(e){null!=e.aliases&&0!==Object.keys(e.aliases).length?this.#e=e.aliases:this.#e=Object.entries(e.record).reduce((e,[s,r])=>(null==e[r.name]?e[r.name]=s:console.warn(`Duplicate model name ${r.name} in GraphModel record, ignoring model ID ${s} in aliases`),e),{}),this.#s=e.record}get aliases(){return this.#e}get record(){return this.#s}getAlias(e){for(let[s,r]of Object.entries(this.#e))if(r===e)return s;return null}getModel(e){let s=this.#e[e]??e;return this.#s[s]??null}toJSON(){return{aliases:this.#e,record:this.#s}}}
@@ -3547,12 +3547,16 @@ export declare const mutateGraphParams: {
3547
3547
  readonly type: "object";
3548
3548
  readonly properties: {
3549
3549
  readonly mutations: {
3550
- readonly type: "object";
3551
- readonly additionalProperties: {
3552
- readonly title: "KubunSignedJWTValue";
3553
- readonly type: "string";
3554
- readonly pattern: "^[a-zA-Z0-9_-]+.[a-zA-Z0-9_-]+.[a-zA-Z0-9_-]+$";
3555
- };
3550
+ readonly anyOf: readonly [{
3551
+ readonly type: "object";
3552
+ readonly additionalProperties: {
3553
+ readonly title: "KubunSignedJWTValue";
3554
+ readonly type: "string";
3555
+ readonly pattern: "^[a-zA-Z0-9_-]+.[a-zA-Z0-9_-]+.[a-zA-Z0-9_-]+$";
3556
+ };
3557
+ }, {
3558
+ readonly type: "null";
3559
+ }];
3556
3560
  };
3557
3561
  readonly attachments: {
3558
3562
  readonly type: "object";
@@ -6993,12 +6997,16 @@ export declare const graphProtocol: {
6993
6997
  readonly type: "object";
6994
6998
  readonly properties: {
6995
6999
  readonly mutations: {
6996
- readonly type: "object";
6997
- readonly additionalProperties: {
6998
- readonly title: "KubunSignedJWTValue";
6999
- readonly type: "string";
7000
- readonly pattern: "^[a-zA-Z0-9_-]+.[a-zA-Z0-9_-]+.[a-zA-Z0-9_-]+$";
7001
- };
7000
+ readonly anyOf: readonly [{
7001
+ readonly type: "object";
7002
+ readonly additionalProperties: {
7003
+ readonly title: "KubunSignedJWTValue";
7004
+ readonly type: "string";
7005
+ readonly pattern: "^[a-zA-Z0-9_-]+.[a-zA-Z0-9_-]+.[a-zA-Z0-9_-]+$";
7006
+ };
7007
+ }, {
7008
+ readonly type: "null";
7009
+ }];
7002
7010
  };
7003
7011
  readonly attachments: {
7004
7012
  readonly type: "object";
@@ -1 +1 @@
1
- import{clusterModel as e}from"../models/cluster.js";import{documentModelsRecord as t}from"../models/document.js";import{binaryStringValue as r,signedJWTStringValue as a}from"../models/value.js";export const searchModelConfig={type:"object",properties:{fields:{type:"array",items:{type:"string"}}},additionalProperties:!1};export const searchConfig={type:"object",additionalProperties:searchModelConfig};export const deployGraphParams={type:"object",properties:{clusters:{type:"array",items:e},id:{type:"string"},name:{type:"string"},search:searchConfig},required:["clusters"],additionalProperties:!1};export const deployGraphResult={type:"object",properties:{id:{type:"string"},record:t,aliases:{type:"object",additionalProperties:{type:"string"}},search:searchConfig},required:["id","record","aliases"],additionalProperties:!1};export const listGraphResult={type:"object",properties:{graphs:{type:"array",items:{type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id","name"],additionalProperties:!1}}},required:["graphs"],additionalProperties:!1};export const loadGraphParams={type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1};export const loadGraphResult={type:"object",properties:{record:t,aliases:{type:"object",additionalProperties:{type:"string"}}},required:["record","aliases"],additionalProperties:!1};export const executeGraphParams={type:"object",properties:{id:{type:"string"},text:{type:"string"},variables:{type:"object"}},required:["id","text"],additionalProperties:!1};export const executeGraphError={type:"object",properties:{message:{type:"string"},locations:{type:"array",items:{type:"object",properties:{line:{type:"integer"},column:{type:"integer"}},required:["line","column"],additionalProperties:!1}},path:{type:"array",items:{type:"string"}},extensions:{type:"object"}},required:["message"],additionalProperties:!1};export const executeGraphResult={type:"object",properties:{data:{anyOf:[{type:"object"},{type:"null"}]},errors:{type:"array",items:executeGraphError},extensions:{type:"object"}},additionalProperties:!1};export const mutateGraphParams={type:"object",properties:{...executeGraphParams.properties,mutations:{type:"object",additionalProperties:a},attachments:{type:"object",additionalProperties:r}},required:[...executeGraphParams.required,"mutations"],additionalProperties:!1};export const graphProtocol={"graph/deploy":{type:"request",param:deployGraphParams,result:deployGraphResult},"graph/list":{type:"request",result:listGraphResult},"graph/load":{type:"request",param:loadGraphParams,result:loadGraphResult},"graph/mutate":{type:"request",param:mutateGraphParams,result:executeGraphResult},"graph/query":{type:"request",param:executeGraphParams,result:executeGraphResult},"graph/subscribe":{type:"stream",param:executeGraphParams,receive:executeGraphResult,result:{anyOf:[executeGraphResult,{type:"null"}]}}};
1
+ import{clusterModel as e}from"../models/cluster.js";import{documentModelsRecord as t}from"../models/document.js";import{binaryStringValue as r,signedJWTStringValue as a}from"../models/value.js";export const searchModelConfig={type:"object",properties:{fields:{type:"array",items:{type:"string"}}},additionalProperties:!1};export const searchConfig={type:"object",additionalProperties:searchModelConfig};export const deployGraphParams={type:"object",properties:{clusters:{type:"array",items:e},id:{type:"string"},name:{type:"string"},search:searchConfig},required:["clusters"],additionalProperties:!1};export const deployGraphResult={type:"object",properties:{id:{type:"string"},record:t,aliases:{type:"object",additionalProperties:{type:"string"}},search:searchConfig},required:["id","record","aliases"],additionalProperties:!1};export const listGraphResult={type:"object",properties:{graphs:{type:"array",items:{type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id","name"],additionalProperties:!1}}},required:["graphs"],additionalProperties:!1};export const loadGraphParams={type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1};export const loadGraphResult={type:"object",properties:{record:t,aliases:{type:"object",additionalProperties:{type:"string"}}},required:["record","aliases"],additionalProperties:!1};export const executeGraphParams={type:"object",properties:{id:{type:"string"},text:{type:"string"},variables:{type:"object"}},required:["id","text"],additionalProperties:!1};export const executeGraphError={type:"object",properties:{message:{type:"string"},locations:{type:"array",items:{type:"object",properties:{line:{type:"integer"},column:{type:"integer"}},required:["line","column"],additionalProperties:!1}},path:{type:"array",items:{type:"string"}},extensions:{type:"object"}},required:["message"],additionalProperties:!1};export const executeGraphResult={type:"object",properties:{data:{anyOf:[{type:"object"},{type:"null"}]},errors:{type:"array",items:executeGraphError},extensions:{type:"object"}},additionalProperties:!1};export const mutateGraphParams={type:"object",properties:{...executeGraphParams.properties,mutations:{anyOf:[{type:"object",additionalProperties:a},{type:"null"}]},attachments:{type:"object",additionalProperties:r}},required:[...executeGraphParams.required,"mutations"],additionalProperties:!1};export const graphProtocol={"graph/deploy":{type:"request",param:deployGraphParams,result:deployGraphResult},"graph/list":{type:"request",result:listGraphResult},"graph/load":{type:"request",param:loadGraphParams,result:loadGraphResult},"graph/mutate":{type:"request",param:mutateGraphParams,result:executeGraphResult},"graph/query":{type:"request",param:executeGraphParams,result:executeGraphResult},"graph/subscribe":{type:"stream",param:executeGraphParams,receive:executeGraphResult,result:{anyOf:[executeGraphResult,{type:"null"}]}}};
@@ -1,16 +1,26 @@
1
1
  import type { FromSchema } from '@enkaku/schema';
2
2
  export declare const syncProtocol: {
3
- readonly 'sync/discovery': {
3
+ readonly 'sync/negotiate': {
4
4
  readonly type: "request";
5
5
  readonly param: {
6
6
  readonly type: "object";
7
7
  readonly properties: {
8
- readonly userIDs: {
8
+ readonly scopes: {
9
9
  readonly type: "array";
10
10
  readonly items: {
11
- readonly type: "string";
11
+ readonly type: "object";
12
+ readonly properties: {
13
+ readonly modelID: {
14
+ readonly type: "string";
15
+ };
16
+ readonly ownerDID: {
17
+ readonly type: "string";
18
+ };
19
+ };
20
+ readonly required: readonly ["modelID", "ownerDID"];
21
+ readonly additionalProperties: false;
12
22
  };
13
- readonly description: "User accounts to sync";
23
+ readonly description: "Requested sync scopes as (model, owner) pairs";
14
24
  };
15
25
  readonly delegationTokens: {
16
26
  readonly type: "array";
@@ -20,67 +30,75 @@ export declare const syncProtocol: {
20
30
  readonly description: "JWT delegation tokens for authorization";
21
31
  };
22
32
  };
23
- readonly required: readonly ["userIDs", "delegationTokens"];
33
+ readonly required: readonly ["scopes", "delegationTokens"];
24
34
  readonly additionalProperties: false;
25
35
  };
26
36
  readonly result: {
27
37
  readonly type: "object";
28
38
  readonly properties: {
29
- readonly documents: {
39
+ readonly acceptedScopes: {
30
40
  readonly type: "array";
31
41
  readonly items: {
32
42
  readonly type: "object";
33
43
  readonly properties: {
34
- readonly documentID: {
35
- readonly type: "string";
36
- };
37
44
  readonly modelID: {
38
45
  readonly type: "string";
39
46
  };
40
- readonly lastMutationTimestamp: {
41
- readonly type: "number";
42
- };
43
- readonly checkpointHash: {
47
+ readonly ownerDID: {
44
48
  readonly type: "string";
45
49
  };
46
- readonly sequenceNumber: {
47
- readonly type: "string";
48
- };
49
- readonly priority: {
50
- readonly type: "number";
51
- readonly description: "Sync priority (higher = more recent activity)";
52
- };
53
50
  };
54
- readonly required: readonly ["documentID", "modelID", "lastMutationTimestamp", "checkpointHash", "sequenceNumber", "priority"];
51
+ readonly required: readonly ["modelID", "ownerDID"];
55
52
  readonly additionalProperties: false;
56
53
  };
57
54
  };
55
+ readonly excludedDocumentIDs: {
56
+ readonly type: "array";
57
+ readonly items: {
58
+ readonly type: "string";
59
+ };
60
+ };
58
61
  };
59
- readonly required: readonly ["documents"];
62
+ readonly required: readonly ["acceptedScopes", "excludedDocumentIDs"];
60
63
  readonly additionalProperties: false;
61
64
  };
62
65
  };
63
- readonly 'sync/stream': {
66
+ readonly 'sync/merkle-sync': {
64
67
  readonly type: "stream";
65
68
  readonly param: {
66
69
  readonly type: "object";
67
70
  readonly properties: {
68
- readonly documentIDs: {
71
+ readonly scopes: {
69
72
  readonly type: "array";
70
73
  readonly items: {
71
- readonly type: "string";
74
+ readonly type: "object";
75
+ readonly properties: {
76
+ readonly modelID: {
77
+ readonly type: "string";
78
+ };
79
+ readonly ownerDID: {
80
+ readonly type: "string";
81
+ };
82
+ };
83
+ readonly required: readonly ["modelID", "ownerDID"];
84
+ readonly additionalProperties: false;
72
85
  };
73
- readonly description: "List of document IDs to sync";
74
86
  };
75
- readonly delegationTokens: {
87
+ readonly excludedDocumentIDs: {
76
88
  readonly type: "array";
77
89
  readonly items: {
78
90
  readonly type: "string";
79
91
  };
80
- readonly description: "JWT delegation tokens for authorization";
92
+ };
93
+ readonly tree: {
94
+ readonly type: "object";
95
+ readonly description: "Merkle tree bucket hashes from requester";
96
+ readonly additionalProperties: {
97
+ readonly type: "string";
98
+ };
81
99
  };
82
100
  };
83
- readonly required: readonly ["documentIDs", "delegationTokens"];
101
+ readonly required: readonly ["scopes", "excludedDocumentIDs", "tree"];
84
102
  readonly additionalProperties: false;
85
103
  };
86
104
  readonly receive: {
@@ -88,31 +106,25 @@ export declare const syncProtocol: {
88
106
  readonly properties: {
89
107
  readonly type: {
90
108
  readonly type: "string";
91
- readonly enum: readonly ["document", "complete", "skipped"];
92
- };
93
- readonly documentID: {
94
- readonly type: "string";
95
- };
96
- readonly syncMode: {
97
- readonly type: "string";
98
- readonly enum: readonly ["incremental", "full"];
109
+ readonly enum: readonly ["mutations", "complete"];
99
110
  };
100
111
  readonly mutationJWTs: {
101
112
  readonly type: "array";
102
113
  readonly items: {
103
114
  readonly type: "string";
104
115
  };
105
- readonly description: "For incremental sync";
116
+ readonly description: "Signed mutation JWTs for divergent time buckets";
106
117
  };
107
- readonly fullState: {
108
- readonly type: "string";
109
- readonly description: "Base64 encoded Automerge document for full sync";
118
+ readonly divergentBuckets: {
119
+ readonly type: "number";
120
+ readonly description: "Number of divergent minute buckets found";
110
121
  };
111
- readonly reason: {
112
- readonly type: "string";
113
- readonly description: "Reason for skipping document (when type is skipped)";
122
+ readonly totalMutations: {
123
+ readonly type: "number";
124
+ readonly description: "Total mutations sent";
114
125
  };
115
126
  };
127
+ readonly required: readonly ["type"];
116
128
  readonly additionalProperties: false;
117
129
  };
118
130
  readonly result: {
@@ -121,62 +133,21 @@ export declare const syncProtocol: {
121
133
  readonly success: {
122
134
  readonly type: "boolean";
123
135
  };
124
- readonly syncedDocuments: {
136
+ readonly divergentBuckets: {
125
137
  readonly type: "number";
126
- readonly description: "Number of documents synced";
127
138
  };
128
- };
129
- readonly required: readonly ["success", "syncedDocuments"];
130
- readonly additionalProperties: false;
131
- };
132
- };
133
- readonly 'sync/checkpoint': {
134
- readonly type: "request";
135
- readonly param: {
136
- readonly type: "object";
137
- readonly properties: {
138
- readonly peerServerID: {
139
- readonly type: "string";
140
- };
141
- readonly checkpointData: {
142
- readonly type: "object";
143
- readonly properties: {
144
- readonly userID: {
145
- readonly type: "string";
146
- };
147
- readonly lastSyncTimestamp: {
148
- readonly type: "number";
149
- };
150
- readonly documentCheckpoints: {
151
- readonly type: "object";
152
- };
153
- readonly vectorClock: {
154
- readonly type: "object";
155
- };
156
- };
157
- readonly required: readonly ["userID", "lastSyncTimestamp", "documentCheckpoints", "vectorClock"];
158
- };
159
- };
160
- readonly required: readonly ["peerServerID", "checkpointData"];
161
- readonly additionalProperties: false;
162
- };
163
- readonly result: {
164
- readonly type: "object";
165
- readonly properties: {
166
- readonly success: {
167
- readonly type: "boolean";
139
+ readonly mutationsSent: {
140
+ readonly type: "number";
168
141
  };
169
142
  };
170
- readonly required: readonly ["success"];
143
+ readonly required: readonly ["success", "divergentBuckets", "mutationsSent"];
171
144
  readonly additionalProperties: false;
172
145
  };
173
146
  };
174
147
  };
175
148
  export type SyncProtocol = typeof syncProtocol;
176
- export type SyncDiscoveryParams = FromSchema<SyncProtocol['sync/discovery']['param']>;
177
- export type SyncDiscoveryResult = FromSchema<SyncProtocol['sync/discovery']['result']>;
178
- export type SyncStreamParams = FromSchema<SyncProtocol['sync/stream']['param']>;
179
- export type SyncStreamReceive = FromSchema<SyncProtocol['sync/stream']['receive']>;
180
- export type SyncStreamResult = FromSchema<SyncProtocol['sync/stream']['result']>;
181
- export type SyncCheckpointParams = FromSchema<SyncProtocol['sync/checkpoint']['param']>;
182
- export type SyncCheckpointResult = FromSchema<SyncProtocol['sync/checkpoint']['result']>;
149
+ export type SyncNegotiateParams = FromSchema<SyncProtocol['sync/negotiate']['param']>;
150
+ export type SyncNegotiateResult = FromSchema<SyncProtocol['sync/negotiate']['result']>;
151
+ export type SyncMerkleSyncParams = FromSchema<SyncProtocol['sync/merkle-sync']['param']>;
152
+ export type SyncMerkleSyncReceive = FromSchema<SyncProtocol['sync/merkle-sync']['receive']>;
153
+ export type SyncMerkleSyncResult = FromSchema<SyncProtocol['sync/merkle-sync']['result']>;
@@ -1 +1 @@
1
- export const syncProtocol={"sync/discovery":{type:"request",param:{type:"object",properties:{userIDs:{type:"array",items:{type:"string"},description:"User accounts to sync"},delegationTokens:{type:"array",items:{type:"string"},description:"JWT delegation tokens for authorization"}},required:["userIDs","delegationTokens"],additionalProperties:!1},result:{type:"object",properties:{documents:{type:"array",items:{type:"object",properties:{documentID:{type:"string"},modelID:{type:"string"},lastMutationTimestamp:{type:"number"},checkpointHash:{type:"string"},sequenceNumber:{type:"string"},priority:{type:"number",description:"Sync priority (higher = more recent activity)"}},required:["documentID","modelID","lastMutationTimestamp","checkpointHash","sequenceNumber","priority"],additionalProperties:!1}}},required:["documents"],additionalProperties:!1}},"sync/stream":{type:"stream",param:{type:"object",properties:{documentIDs:{type:"array",items:{type:"string"},description:"List of document IDs to sync"},delegationTokens:{type:"array",items:{type:"string"},description:"JWT delegation tokens for authorization"}},required:["documentIDs","delegationTokens"],additionalProperties:!1},receive:{type:"object",properties:{type:{type:"string",enum:["document","complete","skipped"]},documentID:{type:"string"},syncMode:{type:"string",enum:["incremental","full"]},mutationJWTs:{type:"array",items:{type:"string"},description:"For incremental sync"},fullState:{type:"string",description:"Base64 encoded Automerge document for full sync"},reason:{type:"string",description:"Reason for skipping document (when type is skipped)"}},additionalProperties:!1},result:{type:"object",properties:{success:{type:"boolean"},syncedDocuments:{type:"number",description:"Number of documents synced"}},required:["success","syncedDocuments"],additionalProperties:!1}},"sync/checkpoint":{type:"request",param:{type:"object",properties:{peerServerID:{type:"string"},checkpointData:{type:"object",properties:{userID:{type:"string"},lastSyncTimestamp:{type:"number"},documentCheckpoints:{type:"object"},vectorClock:{type:"object"}},required:["userID","lastSyncTimestamp","documentCheckpoints","vectorClock"]}},required:["peerServerID","checkpointData"],additionalProperties:!1},result:{type:"object",properties:{success:{type:"boolean"}},required:["success"],additionalProperties:!1}}};
1
+ export const syncProtocol={"sync/negotiate":{type:"request",param:{type:"object",properties:{scopes:{type:"array",items:{type:"object",properties:{modelID:{type:"string"},ownerDID:{type:"string"}},required:["modelID","ownerDID"],additionalProperties:!1},description:"Requested sync scopes as (model, owner) pairs"},delegationTokens:{type:"array",items:{type:"string"},description:"JWT delegation tokens for authorization"}},required:["scopes","delegationTokens"],additionalProperties:!1},result:{type:"object",properties:{acceptedScopes:{type:"array",items:{type:"object",properties:{modelID:{type:"string"},ownerDID:{type:"string"}},required:["modelID","ownerDID"],additionalProperties:!1}},excludedDocumentIDs:{type:"array",items:{type:"string"}}},required:["acceptedScopes","excludedDocumentIDs"],additionalProperties:!1}},"sync/merkle-sync":{type:"stream",param:{type:"object",properties:{scopes:{type:"array",items:{type:"object",properties:{modelID:{type:"string"},ownerDID:{type:"string"}},required:["modelID","ownerDID"],additionalProperties:!1}},excludedDocumentIDs:{type:"array",items:{type:"string"}},tree:{type:"object",description:"Merkle tree bucket hashes from requester",additionalProperties:{type:"string"}}},required:["scopes","excludedDocumentIDs","tree"],additionalProperties:!1},receive:{type:"object",properties:{type:{type:"string",enum:["mutations","complete"]},mutationJWTs:{type:"array",items:{type:"string"},description:"Signed mutation JWTs for divergent time buckets"},divergentBuckets:{type:"number",description:"Number of divergent minute buckets found"},totalMutations:{type:"number",description:"Total mutations sent"}},required:["type"],additionalProperties:!1},result:{type:"object",properties:{success:{type:"boolean"},divergentBuckets:{type:"number"},mutationsSent:{type:"number"}},required:["success","divergentBuckets","mutationsSent"],additionalProperties:!1}}};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubun/protocol",
3
- "version": "0.5.2",
3
+ "version": "0.6.0",
4
4
  "license": "see LICENSE.md",
5
5
  "keywords": [],
6
6
  "type": "module",
@@ -19,8 +19,8 @@
19
19
  "@enkaku/protocol": "^0.13.0",
20
20
  "@enkaku/schema": "^0.13.0",
21
21
  "change-case": "^5.4.4",
22
- "@kubun/logger": "^0.5.0",
23
- "@kubun/id": "^0.5.0"
22
+ "@kubun/id": "^0.6.0",
23
+ "@kubun/logger": "^0.6.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "json-schema-typed": "^8.0.2"
@@ -1,85 +0,0 @@
1
- import type { FromSchema } from '@enkaku/schema';
2
- export declare const documentSyncParams: {
3
- readonly type: "object";
4
- readonly properties: {
5
- readonly documents: {
6
- readonly type: "object";
7
- readonly additionalProperties: {
8
- readonly oneOf: readonly [{
9
- readonly title: "KubunBinaryValue";
10
- readonly type: "string";
11
- readonly pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$";
12
- }, {
13
- readonly type: "null";
14
- }];
15
- };
16
- };
17
- };
18
- readonly required: readonly ["documents"];
19
- readonly additionalProperties: false;
20
- };
21
- export type DocumentSyncParams = FromSchema<typeof documentSyncParams>;
22
- export declare const documentSyncResult: {
23
- readonly type: "object";
24
- readonly properties: {
25
- readonly states: {
26
- readonly type: "object";
27
- readonly additionalProperties: {
28
- readonly oneOf: readonly [{
29
- readonly title: "KubunBinaryValue";
30
- readonly type: "string";
31
- readonly pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$";
32
- }, {
33
- readonly type: "null";
34
- }];
35
- };
36
- };
37
- };
38
- readonly required: readonly ["states"];
39
- readonly additionalProperties: false;
40
- };
41
- export type DocumentSyncResult = FromSchema<typeof documentSyncResult>;
42
- export declare const documentProtocol: {
43
- readonly 'document/sync': {
44
- readonly type: "request";
45
- readonly param: {
46
- readonly type: "object";
47
- readonly properties: {
48
- readonly documents: {
49
- readonly type: "object";
50
- readonly additionalProperties: {
51
- readonly oneOf: readonly [{
52
- readonly title: "KubunBinaryValue";
53
- readonly type: "string";
54
- readonly pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$";
55
- }, {
56
- readonly type: "null";
57
- }];
58
- };
59
- };
60
- };
61
- readonly required: readonly ["documents"];
62
- readonly additionalProperties: false;
63
- };
64
- readonly result: {
65
- readonly type: "object";
66
- readonly properties: {
67
- readonly states: {
68
- readonly type: "object";
69
- readonly additionalProperties: {
70
- readonly oneOf: readonly [{
71
- readonly title: "KubunBinaryValue";
72
- readonly type: "string";
73
- readonly pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$";
74
- }, {
75
- readonly type: "null";
76
- }];
77
- };
78
- };
79
- };
80
- readonly required: readonly ["states"];
81
- readonly additionalProperties: false;
82
- };
83
- };
84
- };
85
- export type DocumentProtocol = typeof documentProtocol;
@@ -1 +0,0 @@
1
- import{binaryStringValue as e}from"../models/value.js";export const documentSyncParams={type:"object",properties:{documents:{type:"object",additionalProperties:{oneOf:[e,{type:"null"}]}}},required:["documents"],additionalProperties:!1};export const documentSyncResult={type:"object",properties:{states:{type:"object",additionalProperties:{oneOf:[e,{type:"null"}]}}},required:["states"],additionalProperties:!1};export const documentProtocol={"document/sync":{type:"request",param:documentSyncParams,result:documentSyncResult}};