@kubun/protocol 0.4.0 → 0.5.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.
@@ -1,320 +1 @@
1
- export const booleanModel = {
2
- type: 'object',
3
- properties: {
4
- type: {
5
- type: 'string',
6
- const: 'boolean'
7
- },
8
- default: {
9
- type: 'boolean'
10
- }
11
- },
12
- required: [
13
- 'type'
14
- ],
15
- additionalProperties: false
16
- };
17
- export const integerModel = {
18
- type: 'object',
19
- properties: {
20
- type: {
21
- type: 'string',
22
- const: 'integer'
23
- },
24
- default: {
25
- type: 'integer'
26
- },
27
- minimum: {
28
- type: 'integer'
29
- },
30
- maximum: {
31
- type: 'integer'
32
- }
33
- },
34
- required: [
35
- 'type'
36
- ],
37
- additionalProperties: false
38
- };
39
- export const numberModel = {
40
- type: 'object',
41
- properties: {
42
- type: {
43
- type: 'string',
44
- const: 'number'
45
- },
46
- default: {
47
- type: 'number'
48
- },
49
- min: {
50
- type: 'number'
51
- },
52
- max: {
53
- type: 'number'
54
- }
55
- },
56
- required: [
57
- 'type'
58
- ],
59
- additionalProperties: false
60
- };
61
- export const stringConstModel = {
62
- type: 'object',
63
- properties: {
64
- type: {
65
- type: 'string',
66
- const: 'string'
67
- },
68
- title: {
69
- type: 'string'
70
- },
71
- const: {
72
- type: 'string'
73
- },
74
- default: {
75
- type: 'string'
76
- }
77
- },
78
- required: [
79
- 'type',
80
- 'const'
81
- ],
82
- additionalProperties: false
83
- };
84
- // Uppercase characters and "_" to match GraphQL enum
85
- const enumString = {
86
- type: 'string',
87
- pattern: '^[A-Z]+[A-Z_]+[A-Z]$'
88
- };
89
- export const stringEnumModel = {
90
- type: 'object',
91
- properties: {
92
- type: {
93
- type: 'string',
94
- const: 'string'
95
- },
96
- title: {
97
- type: 'string'
98
- },
99
- enum: {
100
- type: 'array',
101
- items: enumString
102
- },
103
- default: enumString
104
- },
105
- required: [
106
- 'type',
107
- 'title',
108
- 'enum'
109
- ],
110
- additionalProperties: false
111
- };
112
- export const supportedStringFormat = {
113
- type: 'string',
114
- enum: [
115
- 'date',
116
- 'date-time',
117
- 'duration',
118
- 'email',
119
- 'time',
120
- 'uri'
121
- ]
122
- };
123
- export const stringFormatModel = {
124
- type: 'object',
125
- properties: {
126
- type: {
127
- type: 'string',
128
- const: 'string'
129
- },
130
- format: supportedStringFormat,
131
- title: {
132
- type: 'string'
133
- },
134
- default: {
135
- type: 'string'
136
- },
137
- minLength: {
138
- type: 'integer'
139
- },
140
- maxLength: {
141
- type: 'integer'
142
- }
143
- },
144
- required: [
145
- 'type',
146
- 'format'
147
- ],
148
- additionalProperties: false
149
- };
150
- export const stringCustomModel = {
151
- type: 'object',
152
- properties: {
153
- type: {
154
- type: 'string',
155
- const: 'string'
156
- },
157
- title: {
158
- type: 'string'
159
- },
160
- pattern: {
161
- type: 'string'
162
- },
163
- default: {
164
- type: 'string'
165
- },
166
- minLength: {
167
- type: 'integer'
168
- },
169
- maxLength: {
170
- type: 'integer'
171
- }
172
- },
173
- required: [
174
- 'type'
175
- ],
176
- additionalProperties: false
177
- };
178
- export const stringModel = {
179
- anyOf: [
180
- stringConstModel,
181
- stringCustomModel,
182
- stringEnumModel,
183
- stringFormatModel
184
- ]
185
- };
186
- export const scalarModel = {
187
- anyOf: [
188
- booleanModel,
189
- integerModel,
190
- numberModel,
191
- stringModel
192
- ]
193
- };
194
- export const refModel = {
195
- type: 'object',
196
- properties: {
197
- $ref: {
198
- type: 'string'
199
- }
200
- },
201
- required: [
202
- '$ref'
203
- ],
204
- additionalProperties: false
205
- };
206
- // Valid GraphQL name
207
- export const nameString = {
208
- type: 'string',
209
- pattern: '^[A-Z]+[A-Za-z0-9]+$'
210
- };
211
- export const arrayModel = {
212
- type: 'object',
213
- properties: {
214
- type: {
215
- type: 'string',
216
- const: 'array'
217
- },
218
- title: nameString,
219
- items: refModel,
220
- uniqueItems: {
221
- type: 'boolean'
222
- },
223
- minItems: {
224
- type: 'integer'
225
- },
226
- maxItems: {
227
- type: 'integer'
228
- }
229
- },
230
- required: [
231
- 'type',
232
- 'title',
233
- 'items'
234
- ],
235
- additionalProperties: false
236
- };
237
- export const baseObjectModel = {
238
- type: 'object',
239
- properties: {
240
- type: {
241
- type: 'string',
242
- const: 'object'
243
- },
244
- properties: {
245
- type: 'object',
246
- patternProperties: {
247
- '^[a-z]+[A-Za-z0-9]+$': refModel
248
- },
249
- additionalProperties: false
250
- },
251
- required: {
252
- type: 'array',
253
- items: {
254
- type: 'string'
255
- }
256
- },
257
- additionalProperties: {
258
- type: 'boolean'
259
- }
260
- },
261
- required: [
262
- 'type',
263
- 'properties',
264
- 'required',
265
- 'additionalProperties'
266
- ],
267
- additionalProperties: false
268
- };
269
- export const objectModel = {
270
- type: 'object',
271
- properties: {
272
- ...baseObjectModel.properties,
273
- title: nameString
274
- },
275
- required: [
276
- ...baseObjectModel.required,
277
- 'title'
278
- ],
279
- additionalProperties: false
280
- };
281
- export const jsonObjectModel = {
282
- type: 'object',
283
- properties: {
284
- type: {
285
- type: 'string',
286
- const: 'object'
287
- },
288
- title: {
289
- type: 'string',
290
- const: 'JSONObject'
291
- },
292
- additionalProperties: {
293
- type: 'boolean',
294
- const: true
295
- }
296
- },
297
- required: [
298
- 'type',
299
- 'title',
300
- 'additionalProperties'
301
- ],
302
- additionalProperties: false
303
- };
304
- export const shapeModel = {
305
- anyOf: [
306
- arrayModel,
307
- objectModel,
308
- jsonObjectModel
309
- ]
310
- };
311
- export const typeModel = {
312
- anyOf: [
313
- scalarModel,
314
- shapeModel
315
- ]
316
- };
317
- export const referencesRecordModel = {
318
- type: 'object',
319
- additionalProperties: typeModel
320
- };
1
+ export const booleanModel={type:"object",properties:{type:{type:"string",const:"boolean"},default:{type:"boolean"}},required:["type"],additionalProperties:!1};export const integerModel={type:"object",properties:{type:{type:"string",const:"integer"},default:{type:"integer"},minimum:{type:"integer"},maximum:{type:"integer"}},required:["type"],additionalProperties:!1};export const numberModel={type:"object",properties:{type:{type:"string",const:"number"},default:{type:"number"},min:{type:"number"},max:{type:"number"}},required:["type"],additionalProperties:!1};export const stringConstModel={type:"object",properties:{type:{type:"string",const:"string"},title:{type:"string"},const:{type:"string"},default:{type:"string"}},required:["type","const"],additionalProperties:!1};let e={type:"string",pattern:"^[A-Z]+[A-Z_]+[A-Z]$"};export const stringEnumModel={type:"object",properties:{type:{type:"string",const:"string"},title:{type:"string"},enum:{type:"array",items:e},default:e},required:["type","title","enum"],additionalProperties:!1};export const supportedStringFormat={type:"string",enum:["date","date-time","duration","email","time","uri"]};export const stringFormatModel={type:"object",properties:{type:{type:"string",const:"string"},format:supportedStringFormat,title:{type:"string"},default:{type:"string"},minLength:{type:"integer"},maxLength:{type:"integer"}},required:["type","format"],additionalProperties:!1};export const stringCustomModel={type:"object",properties:{type:{type:"string",const:"string"},title:{type:"string"},pattern:{type:"string"},default:{type:"string"},minLength:{type:"integer"},maxLength:{type:"integer"}},required:["type"],additionalProperties:!1};export const stringModel={anyOf:[stringConstModel,stringCustomModel,stringEnumModel,stringFormatModel]};export const scalarModel={anyOf:[booleanModel,integerModel,numberModel,stringModel]};export const refModel={type:"object",properties:{$ref:{type:"string"}},required:["$ref"],additionalProperties:!1};export const nameString={type:"string",pattern:"^[A-Z]+[A-Za-z0-9]+$"};export const arrayModel={type:"object",properties:{type:{type:"string",const:"array"},title:nameString,items:refModel,uniqueItems:{type:"boolean"},minItems:{type:"integer"},maxItems:{type:"integer"}},required:["type","title","items"],additionalProperties:!1};export const baseObjectModel={type:"object",properties:{type:{type:"string",const:"object"},properties:{type:"object",patternProperties:{"^[a-z]+[A-Za-z0-9]+$":refModel},additionalProperties:!1},required:{type:"array",items:{type:"string"}},additionalProperties:{type:"boolean"}},required:["type","properties","required","additionalProperties"],additionalProperties:!1};export const objectModel={type:"object",properties:{...baseObjectModel.properties,title:nameString},required:[...baseObjectModel.required,"title"],additionalProperties:!1};export const jsonObjectModel={type:"object",properties:{type:{type:"string",const:"object"},title:{type:"string",const:"JSONObject"},additionalProperties:{type:"boolean",const:!0}},required:["type","title","additionalProperties"],additionalProperties:!1};export const shapeModel={anyOf:[arrayModel,objectModel,jsonObjectModel]};export const typeModel={anyOf:[scalarModel,shapeModel]};export const referencesRecordModel={type:"object",additionalProperties:typeModel};
@@ -13,4 +13,3 @@ export declare const signedJWTStringValue: {
13
13
  readonly type: "string";
14
14
  readonly pattern: "^[a-zA-Z0-9_-]+.[a-zA-Z0-9_-]+.[a-zA-Z0-9_-]+$";
15
15
  };
16
- //# sourceMappingURL=value.d.ts.map
@@ -1,16 +1 @@
1
- export const binaryStringValue = {
2
- title: 'KubunBinaryValue',
3
- type: 'string',
4
- // Base 64 encoding
5
- pattern: '^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$'
6
- };
7
- export const didStringValue = {
8
- title: 'KubunDIDValue',
9
- type: 'string',
10
- pattern: '^did:[a-z0-9]+:'
11
- };
12
- export const signedJWTStringValue = {
13
- title: 'KubunSignedJWTValue',
14
- type: 'string',
15
- pattern: '^[a-zA-Z0-9_-]+.[a-zA-Z0-9_-]+.[a-zA-Z0-9_-]+$'
16
- };
1
+ export const binaryStringValue={title:"KubunBinaryValue",type:"string",pattern:"^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"};export const didStringValue={title:"KubunDIDValue",type:"string",pattern:"^did:[a-z0-9]+:"};export const signedJWTStringValue={title:"KubunSignedJWTValue",type:"string",pattern:"^[a-zA-Z0-9_-]+.[a-zA-Z0-9_-]+.[a-zA-Z0-9_-]+$"};
@@ -83,4 +83,3 @@ export declare const documentProtocol: {
83
83
  };
84
84
  };
85
85
  export type DocumentProtocol = typeof documentProtocol;
86
- //# sourceMappingURL=document.d.ts.map
@@ -1,50 +1 @@
1
- import { binaryStringValue } from '../models/value.js';
2
- // TODO: use pattern properties with DocumentID keys
3
- export const documentSyncParams = {
4
- type: 'object',
5
- properties: {
6
- documents: {
7
- type: 'object',
8
- additionalProperties: {
9
- oneOf: [
10
- binaryStringValue,
11
- {
12
- type: 'null'
13
- }
14
- ]
15
- }
16
- }
17
- },
18
- required: [
19
- 'documents'
20
- ],
21
- additionalProperties: false
22
- };
23
- // TODO: use pattern properties with DocumentID keys
24
- export const documentSyncResult = {
25
- type: 'object',
26
- properties: {
27
- states: {
28
- type: 'object',
29
- additionalProperties: {
30
- oneOf: [
31
- binaryStringValue,
32
- {
33
- type: 'null'
34
- }
35
- ]
36
- }
37
- }
38
- },
39
- required: [
40
- 'states'
41
- ],
42
- additionalProperties: false
43
- };
44
- export const documentProtocol = {
45
- 'document/sync': {
46
- type: 'request',
47
- param: documentSyncParams,
48
- result: documentSyncResult
49
- }
50
- };
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}};