@kubun/protocol 0.6.0 → 0.7.1
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/errors.d.ts +10 -0
- package/lib/errors.js +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -1
- package/lib/semantic.d.ts +23 -0
- package/lib/semantic.js +1 -0
- package/lib/services/graph.d.ts +119 -0
- package/lib/services/graph.js +1 -1
- package/package.json +6 -6
package/lib/errors.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const KubunErrorCodes: {
|
|
2
|
+
readonly KB01: "Validation error";
|
|
3
|
+
readonly KB02: "Not found";
|
|
4
|
+
readonly KB03: "Unauthorized";
|
|
5
|
+
readonly KB04: "Invalid operation";
|
|
6
|
+
readonly KB05: "Transaction error";
|
|
7
|
+
readonly KB06: "Internal error";
|
|
8
|
+
readonly KB07: "Access denied";
|
|
9
|
+
};
|
|
10
|
+
export type KubunErrorCode = keyof typeof KubunErrorCodes;
|
package/lib/errors.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const KubunErrorCodes={KB01:"Validation error",KB02:"Not found",KB03:"Unauthorized",KB04:"Invalid operation",KB05:"Transaction error",KB06:"Internal error",KB07:"Access denied"};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { AnyClientMessageOf, AnyServerMessageOf, ClientTransportOf, ServerTransportOf } from '@enkaku/protocol';
|
|
2
2
|
import type { GraphProtocol } from './services/graph.js';
|
|
3
3
|
import type { SyncProtocol } from './services/sync.js';
|
|
4
|
+
export { type KubunErrorCode, KubunErrorCodes } from './errors.js';
|
|
4
5
|
export * from './models/cluster.js';
|
|
5
6
|
export * from './models/document.js';
|
|
6
7
|
export * from './models/graph.js';
|
|
7
8
|
export * from './models/json-schema.js';
|
|
8
9
|
export * from './models/value.js';
|
|
10
|
+
export { KubunAttributeKeys, KubunSpanNames } from './semantic.js';
|
|
9
11
|
export * from './services/graph.js';
|
|
10
12
|
export * from './services/sync.js';
|
|
11
13
|
export * from './types.js';
|
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/graph.js";export*from"./services/sync.js";export*from"./types.js";
|
|
1
|
+
export{KubunErrorCodes}from"./errors.js";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{KubunAttributeKeys,KubunSpanNames}from"./semantic.js";export*from"./services/graph.js";export*from"./services/sync.js";export*from"./types.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const KubunSpanNames: {
|
|
2
|
+
readonly GRAPH_QUERY: "kubun.graph.query";
|
|
3
|
+
readonly GRAPH_MUTATE: "kubun.graph.mutate";
|
|
4
|
+
readonly GRAPH_SUBSCRIBE: "kubun.graph.subscribe";
|
|
5
|
+
readonly GRAPH_DEPLOY: "kubun.graph.deploy";
|
|
6
|
+
readonly GRAPHQL_EXECUTE: "kubun.graphql.execute";
|
|
7
|
+
readonly DATA_QUERY: "kubun.data.query";
|
|
8
|
+
readonly DATA_MUTATE: "kubun.data.mutate";
|
|
9
|
+
readonly DATA_TRANSACTION: "kubun.data.transaction";
|
|
10
|
+
};
|
|
11
|
+
export declare const KubunAttributeKeys: {
|
|
12
|
+
readonly GRAPH_ID: "kubun.graph.id";
|
|
13
|
+
readonly GRAPHQL_OPERATION_TYPE: "graphql.operation.type";
|
|
14
|
+
readonly GRAPHQL_DOCUMENT: "graphql.document";
|
|
15
|
+
readonly GRAPHQL_VARIABLES: "graphql.variables";
|
|
16
|
+
readonly MODEL_ID: "kubun.model.id";
|
|
17
|
+
readonly DOCUMENT_ID: "kubun.document.id";
|
|
18
|
+
readonly DOCUMENTS_COUNT: "kubun.documents.count";
|
|
19
|
+
readonly MUTATION_TYPE: "kubun.mutation.type";
|
|
20
|
+
readonly MUTATION_DATA: "kubun.mutation.data";
|
|
21
|
+
readonly QUERY_FILTER: "kubun.query.filter";
|
|
22
|
+
readonly ERROR_CODE: "kubun.error.code";
|
|
23
|
+
};
|
package/lib/semantic.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const KubunSpanNames={GRAPH_QUERY:"kubun.graph.query",GRAPH_MUTATE:"kubun.graph.mutate",GRAPH_SUBSCRIBE:"kubun.graph.subscribe",GRAPH_DEPLOY:"kubun.graph.deploy",GRAPHQL_EXECUTE:"kubun.graphql.execute",DATA_QUERY:"kubun.data.query",DATA_MUTATE:"kubun.data.mutate",DATA_TRANSACTION:"kubun.data.transaction"};export const KubunAttributeKeys={GRAPH_ID:"kubun.graph.id",GRAPHQL_OPERATION_TYPE:"graphql.operation.type",GRAPHQL_DOCUMENT:"graphql.document",GRAPHQL_VARIABLES:"graphql.variables",MODEL_ID:"kubun.model.id",DOCUMENT_ID:"kubun.document.id",DOCUMENTS_COUNT:"kubun.documents.count",MUTATION_TYPE:"kubun.mutation.type",MUTATION_DATA:"kubun.mutation.data",QUERY_FILTER:"kubun.query.filter",ERROR_CODE:"kubun.error.code"};
|
package/lib/services/graph.d.ts
CHANGED
|
@@ -3566,6 +3566,9 @@ export declare const mutateGraphParams: {
|
|
|
3566
3566
|
readonly pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$";
|
|
3567
3567
|
};
|
|
3568
3568
|
};
|
|
3569
|
+
readonly transactionID: {
|
|
3570
|
+
readonly type: "string";
|
|
3571
|
+
};
|
|
3569
3572
|
readonly id: {
|
|
3570
3573
|
readonly type: "string";
|
|
3571
3574
|
};
|
|
@@ -3580,6 +3583,50 @@ export declare const mutateGraphParams: {
|
|
|
3580
3583
|
readonly additionalProperties: false;
|
|
3581
3584
|
};
|
|
3582
3585
|
export type MutateGraphParams = FromSchema<typeof mutateGraphParams>;
|
|
3586
|
+
export declare const beginTransactionParams: {
|
|
3587
|
+
readonly type: "object";
|
|
3588
|
+
readonly properties: {
|
|
3589
|
+
readonly id: {
|
|
3590
|
+
readonly type: "string";
|
|
3591
|
+
};
|
|
3592
|
+
};
|
|
3593
|
+
readonly required: readonly ["id"];
|
|
3594
|
+
readonly additionalProperties: false;
|
|
3595
|
+
};
|
|
3596
|
+
export type BeginTransactionParams = FromSchema<typeof beginTransactionParams>;
|
|
3597
|
+
export declare const beginTransactionResult: {
|
|
3598
|
+
readonly type: "object";
|
|
3599
|
+
readonly properties: {
|
|
3600
|
+
readonly transactionID: {
|
|
3601
|
+
readonly type: "string";
|
|
3602
|
+
};
|
|
3603
|
+
};
|
|
3604
|
+
readonly required: readonly ["transactionID"];
|
|
3605
|
+
readonly additionalProperties: false;
|
|
3606
|
+
};
|
|
3607
|
+
export type BeginTransactionResult = FromSchema<typeof beginTransactionResult>;
|
|
3608
|
+
export declare const transactionParams: {
|
|
3609
|
+
readonly type: "object";
|
|
3610
|
+
readonly properties: {
|
|
3611
|
+
readonly transactionID: {
|
|
3612
|
+
readonly type: "string";
|
|
3613
|
+
};
|
|
3614
|
+
};
|
|
3615
|
+
readonly required: readonly ["transactionID"];
|
|
3616
|
+
readonly additionalProperties: false;
|
|
3617
|
+
};
|
|
3618
|
+
export type TransactionParams = FromSchema<typeof transactionParams>;
|
|
3619
|
+
export declare const transactionResult: {
|
|
3620
|
+
readonly type: "object";
|
|
3621
|
+
readonly properties: {
|
|
3622
|
+
readonly success: {
|
|
3623
|
+
readonly type: "boolean";
|
|
3624
|
+
};
|
|
3625
|
+
};
|
|
3626
|
+
readonly required: readonly ["success"];
|
|
3627
|
+
readonly additionalProperties: false;
|
|
3628
|
+
};
|
|
3629
|
+
export type TransactionResult = FromSchema<typeof transactionResult>;
|
|
3583
3630
|
export declare const graphProtocol: {
|
|
3584
3631
|
readonly 'graph/deploy': {
|
|
3585
3632
|
readonly type: "request";
|
|
@@ -7016,6 +7063,9 @@ export declare const graphProtocol: {
|
|
|
7016
7063
|
readonly pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$";
|
|
7017
7064
|
};
|
|
7018
7065
|
};
|
|
7066
|
+
readonly transactionID: {
|
|
7067
|
+
readonly type: "string";
|
|
7068
|
+
};
|
|
7019
7069
|
readonly id: {
|
|
7020
7070
|
readonly type: "string";
|
|
7021
7071
|
};
|
|
@@ -7288,5 +7338,74 @@ export declare const graphProtocol: {
|
|
|
7288
7338
|
}];
|
|
7289
7339
|
};
|
|
7290
7340
|
};
|
|
7341
|
+
readonly 'graph/beginTransaction': {
|
|
7342
|
+
readonly type: "request";
|
|
7343
|
+
readonly param: {
|
|
7344
|
+
readonly type: "object";
|
|
7345
|
+
readonly properties: {
|
|
7346
|
+
readonly id: {
|
|
7347
|
+
readonly type: "string";
|
|
7348
|
+
};
|
|
7349
|
+
};
|
|
7350
|
+
readonly required: readonly ["id"];
|
|
7351
|
+
readonly additionalProperties: false;
|
|
7352
|
+
};
|
|
7353
|
+
readonly result: {
|
|
7354
|
+
readonly type: "object";
|
|
7355
|
+
readonly properties: {
|
|
7356
|
+
readonly transactionID: {
|
|
7357
|
+
readonly type: "string";
|
|
7358
|
+
};
|
|
7359
|
+
};
|
|
7360
|
+
readonly required: readonly ["transactionID"];
|
|
7361
|
+
readonly additionalProperties: false;
|
|
7362
|
+
};
|
|
7363
|
+
};
|
|
7364
|
+
readonly 'graph/commitTransaction': {
|
|
7365
|
+
readonly type: "request";
|
|
7366
|
+
readonly param: {
|
|
7367
|
+
readonly type: "object";
|
|
7368
|
+
readonly properties: {
|
|
7369
|
+
readonly transactionID: {
|
|
7370
|
+
readonly type: "string";
|
|
7371
|
+
};
|
|
7372
|
+
};
|
|
7373
|
+
readonly required: readonly ["transactionID"];
|
|
7374
|
+
readonly additionalProperties: false;
|
|
7375
|
+
};
|
|
7376
|
+
readonly result: {
|
|
7377
|
+
readonly type: "object";
|
|
7378
|
+
readonly properties: {
|
|
7379
|
+
readonly success: {
|
|
7380
|
+
readonly type: "boolean";
|
|
7381
|
+
};
|
|
7382
|
+
};
|
|
7383
|
+
readonly required: readonly ["success"];
|
|
7384
|
+
readonly additionalProperties: false;
|
|
7385
|
+
};
|
|
7386
|
+
};
|
|
7387
|
+
readonly 'graph/rollbackTransaction': {
|
|
7388
|
+
readonly type: "request";
|
|
7389
|
+
readonly param: {
|
|
7390
|
+
readonly type: "object";
|
|
7391
|
+
readonly properties: {
|
|
7392
|
+
readonly transactionID: {
|
|
7393
|
+
readonly type: "string";
|
|
7394
|
+
};
|
|
7395
|
+
};
|
|
7396
|
+
readonly required: readonly ["transactionID"];
|
|
7397
|
+
readonly additionalProperties: false;
|
|
7398
|
+
};
|
|
7399
|
+
readonly result: {
|
|
7400
|
+
readonly type: "object";
|
|
7401
|
+
readonly properties: {
|
|
7402
|
+
readonly success: {
|
|
7403
|
+
readonly type: "boolean";
|
|
7404
|
+
};
|
|
7405
|
+
};
|
|
7406
|
+
readonly required: readonly ["success"];
|
|
7407
|
+
readonly additionalProperties: false;
|
|
7408
|
+
};
|
|
7409
|
+
};
|
|
7291
7410
|
};
|
|
7292
7411
|
export type GraphProtocol = typeof graphProtocol;
|
package/lib/services/graph.js
CHANGED
|
@@ -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:{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
|
+
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},transactionID:{type:"string"}},required:[...executeGraphParams.required,"mutations"],additionalProperties:!1};export const beginTransactionParams={type:"object",properties:{id:{type:"string"}},required:["id"],additionalProperties:!1};export const beginTransactionResult={type:"object",properties:{transactionID:{type:"string"}},required:["transactionID"],additionalProperties:!1};export const transactionParams={type:"object",properties:{transactionID:{type:"string"}},required:["transactionID"],additionalProperties:!1};export const transactionResult={type:"object",properties:{success:{type:"boolean"}},required:["success"],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"}]}},"graph/beginTransaction":{type:"request",param:beginTransactionParams,result:beginTransactionResult},"graph/commitTransaction":{type:"request",param:transactionParams,result:transactionResult},"graph/rollbackTransaction":{type:"request",param:transactionParams,result:transactionResult}};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubun/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"license": "see LICENSE.md",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"type": "module",
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
],
|
|
16
16
|
"sideEffects": false,
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@enkaku/codec": "^0.
|
|
19
|
-
"@enkaku/protocol": "^0.
|
|
20
|
-
"@enkaku/schema": "^0.
|
|
18
|
+
"@enkaku/codec": "^0.14.0",
|
|
19
|
+
"@enkaku/protocol": "^0.14.0",
|
|
20
|
+
"@enkaku/schema": "^0.14.0",
|
|
21
21
|
"change-case": "^5.4.4",
|
|
22
|
-
"@kubun/id": "^0.
|
|
23
|
-
"@kubun/logger": "^0.
|
|
22
|
+
"@kubun/id": "^0.7.0",
|
|
23
|
+
"@kubun/logger": "^0.7.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"json-schema-typed": "^8.0.2"
|