@kubun/protocol 0.9.0 → 0.10.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.
@@ -3638,6 +3638,22 @@ export declare const transactionResult: {
3638
3638
  readonly success: {
3639
3639
  readonly type: "boolean";
3640
3640
  };
3641
+ readonly error: {
3642
+ readonly type: "object";
3643
+ readonly properties: {
3644
+ readonly code: {
3645
+ readonly type: "string";
3646
+ };
3647
+ readonly message: {
3648
+ readonly type: "string";
3649
+ };
3650
+ readonly docID: {
3651
+ readonly type: "string";
3652
+ };
3653
+ };
3654
+ readonly required: readonly ["code", "message"];
3655
+ readonly additionalProperties: false;
3656
+ };
3641
3657
  };
3642
3658
  readonly required: readonly ["success"];
3643
3659
  readonly additionalProperties: false;
@@ -7414,6 +7430,22 @@ export declare const graphProtocol: {
7414
7430
  readonly success: {
7415
7431
  readonly type: "boolean";
7416
7432
  };
7433
+ readonly error: {
7434
+ readonly type: "object";
7435
+ readonly properties: {
7436
+ readonly code: {
7437
+ readonly type: "string";
7438
+ };
7439
+ readonly message: {
7440
+ readonly type: "string";
7441
+ };
7442
+ readonly docID: {
7443
+ readonly type: "string";
7444
+ };
7445
+ };
7446
+ readonly required: readonly ["code", "message"];
7447
+ readonly additionalProperties: false;
7448
+ };
7417
7449
  };
7418
7450
  readonly required: readonly ["success"];
7419
7451
  readonly additionalProperties: false;
@@ -7437,6 +7469,22 @@ export declare const graphProtocol: {
7437
7469
  readonly success: {
7438
7470
  readonly type: "boolean";
7439
7471
  };
7472
+ readonly error: {
7473
+ readonly type: "object";
7474
+ readonly properties: {
7475
+ readonly code: {
7476
+ readonly type: "string";
7477
+ };
7478
+ readonly message: {
7479
+ readonly type: "string";
7480
+ };
7481
+ readonly docID: {
7482
+ readonly type: "string";
7483
+ };
7484
+ };
7485
+ readonly required: readonly ["code", "message"];
7486
+ readonly additionalProperties: false;
7487
+ };
7440
7488
  };
7441
7489
  readonly required: readonly ["success"];
7442
7490
  readonly additionalProperties: false;
@@ -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"},plugins:{type:"object",additionalProperties:{type:"object",additionalProperties:!0}},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"}},extensionSDL:{type:"string"}},required:["record","aliases"],additionalProperties:!1};export const executeGraphParams={type:"object",properties:{id:{type:"string"},text:{type:"string"},variables:{type:"object"},catalogID:{type:"string"}},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}};
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"},plugins:{type:"object",additionalProperties:{type:"object",additionalProperties:!0}},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"}},extensionSDL:{type:"string"}},required:["record","aliases"],additionalProperties:!1};export const executeGraphParams={type:"object",properties:{id:{type:"string"},text:{type:"string"},variables:{type:"object"},catalogID:{type:"string"}},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"},error:{type:"object",properties:{code:{type:"string"},message:{type:"string"},docID:{type:"string"}},required:["code","message"],additionalProperties:!1}},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/lib/types.d.ts CHANGED
@@ -51,6 +51,76 @@ export type OrderByField = {
51
51
  [field: string]: OrderByDirection | OrderByField;
52
52
  };
53
53
  export type DocumentOrderBy = Array<OrderByField>;
54
+ export type AggregateOp = 'sum' | 'average' | 'min' | 'max';
55
+ export type AggregateSpec = {
56
+ op: AggregateOp;
57
+ keys: Array<string>;
58
+ numeric: boolean;
59
+ };
60
+ export type AccessLevel = 'only_owner' | 'anyone' | 'restricted';
61
+ export type ViewerReadAccess = {
62
+ viewerDID: string;
63
+ groupIDs: Array<string>;
64
+ circleIDs: Array<string>;
65
+ serverDefault: AccessLevel;
66
+ };
67
+ export type AggregateDocumentsParams = {
68
+ modelIDs: Array<string>;
69
+ filter?: DocumentFilter;
70
+ owner?: string;
71
+ catalogID?: string;
72
+ readAccess?: ViewerReadAccess;
73
+ count: boolean;
74
+ aggregates: Array<AggregateSpec>;
75
+ };
76
+ export type AggregateValues = {
77
+ count?: number;
78
+ sum?: Record<string, number | null>;
79
+ average?: Record<string, number | null>;
80
+ min?: Record<string, unknown>;
81
+ max?: Record<string, unknown>;
82
+ };
83
+ export type AggregateHavingComparison = {
84
+ isNull?: boolean;
85
+ equalTo?: number | string;
86
+ notEqualTo?: number | string;
87
+ in?: Array<unknown>;
88
+ notIn?: Array<unknown>;
89
+ greaterThan?: number | string;
90
+ greaterThanOrEqualTo?: number | string;
91
+ lessThan?: number | string;
92
+ lessThanOrEqualTo?: number | string;
93
+ };
94
+ export type AggregateHaving = {
95
+ count?: AggregateHavingComparison;
96
+ sum?: Record<string, AggregateHavingComparison>;
97
+ average?: Record<string, AggregateHavingComparison>;
98
+ min?: Record<string, AggregateHavingComparison>;
99
+ max?: Record<string, AggregateHavingComparison>;
100
+ };
101
+ export type GroupedAggregateDocumentsParams = {
102
+ modelIDs: Array<string>;
103
+ filter?: DocumentFilter;
104
+ owner?: string;
105
+ catalogID?: string;
106
+ readAccess?: ViewerReadAccess;
107
+ count: boolean;
108
+ aggregates: Array<AggregateSpec>;
109
+ groupBy: Array<{
110
+ keys: Array<string>;
111
+ }>;
112
+ having?: AggregateHaving;
113
+ orderBy?: Array<GroupedAggregateOrderTerm>;
114
+ limit?: number;
115
+ };
116
+ export type GroupedAggregateOrderTerm = {
117
+ path: Array<string>;
118
+ direction: OrderByDirection;
119
+ numeric: boolean;
120
+ };
121
+ export type GroupedAggregateValue = {
122
+ keys: Record<string, unknown>;
123
+ } & AggregateValues;
54
124
  export type DocumentData = Record<string, unknown>;
55
125
  export type DocumentNode = {
56
126
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubun/protocol",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
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.15.0",
19
- "@enkaku/protocol": "^0.15.0",
20
- "@enkaku/schema": "^0.15.0",
18
+ "@enkaku/codec": "^0.16.0",
19
+ "@enkaku/protocol": "^0.16.0",
20
+ "@enkaku/schema": "^0.16.0",
21
21
  "change-case": "^5.4.4",
22
- "@kubun/id": "^0.9.0",
23
- "@kubun/logger": "^0.9.0"
22
+ "@kubun/id": "^0.10.0",
23
+ "@kubun/logger": "^0.10.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "graphql": "^16.13.2",