@kubun/protocol 0.17.1 → 0.18.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/catalog-duration.d.ts +5 -0
- package/lib/catalog-duration.js +24 -0
- package/lib/document-date-field.d.ts +2 -0
- package/lib/document-date-field.js +17 -0
- package/lib/errors.d.ts +10 -0
- package/lib/errors.js +11 -1
- package/lib/executor.d.ts +5 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/models/cluster.d.ts +12 -0
- package/lib/models/document.d.ts +42 -0
- package/lib/models/document.js +3 -0
- package/lib/models/group.d.ts +0 -1
- package/lib/services/graph.d.ts +68 -15
- package/lib/services/graph.js +9 -3
- package/lib/types.d.ts +10 -3
- package/lib/types.js +2 -1
- package/package.json +8 -8
- package/lib/models/catalog.d.ts +0 -22
- package/lib/models/catalog.js +0 -6
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export class InvalidCatalogDurationError extends Error {
|
|
2
|
+
get code() {
|
|
3
|
+
return 'INVALID_CATALOG_DURATION';
|
|
4
|
+
}
|
|
5
|
+
constructor(value){
|
|
6
|
+
super(`Invalid catalog duration: ${value}`);
|
|
7
|
+
this.name = 'InvalidCatalogDurationError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const durationPattern = /^P(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/;
|
|
11
|
+
export function parseCatalogDuration(value) {
|
|
12
|
+
const match = durationPattern.exec(value);
|
|
13
|
+
if (match == null || match.slice(1).every((part)=>part == null) || value.includes('T') && match.slice(3).every((part)=>part == null)) {
|
|
14
|
+
throw new InvalidCatalogDurationError(value);
|
|
15
|
+
}
|
|
16
|
+
const weeks = Number(match[1] ?? 0);
|
|
17
|
+
const days = Number(match[2] ?? 0);
|
|
18
|
+
const hours = Number(match[3] ?? 0);
|
|
19
|
+
const minutes = Number(match[4] ?? 0);
|
|
20
|
+
const seconds = Number(match[5] ?? 0);
|
|
21
|
+
const result = (((weeks * 7 + days) * 24 + hours) * 60 + minutes) * 60_000 + seconds * 1000;
|
|
22
|
+
if (!Number.isSafeInteger(result)) throw new InvalidCatalogDurationError(value);
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function isDocumentDateField(model, field) {
|
|
2
|
+
const properties = model.schema.properties;
|
|
3
|
+
const definitions = model.schema.$defs;
|
|
4
|
+
let property = properties[field];
|
|
5
|
+
const seen = new Set();
|
|
6
|
+
while(property != null && typeof property === 'object'){
|
|
7
|
+
const definition = property;
|
|
8
|
+
if (definition.type === 'string') {
|
|
9
|
+
return definition.format === 'date' || definition.format === 'date-time';
|
|
10
|
+
}
|
|
11
|
+
const ref = definition.$ref;
|
|
12
|
+
if (typeof ref !== 'string' || !ref.startsWith('#/$defs/') || seen.has(ref)) return false;
|
|
13
|
+
seen.add(ref);
|
|
14
|
+
property = definitions[ref.slice('#/$defs/'.length)];
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
package/lib/errors.d.ts
CHANGED
|
@@ -28,6 +28,16 @@ export declare const KubunErrorCodes: {
|
|
|
28
28
|
readonly KB20: "Provider group CHANGE rejected";
|
|
29
29
|
readonly KB21: "Missing fetch token";
|
|
30
30
|
readonly KB22: "Merge-policy remove requires a tombstone";
|
|
31
|
+
readonly OWN_AGENTS_HEAD_UNRESOLVED: "Own agents controller head unresolved; retry";
|
|
32
|
+
readonly OWN_AGENTS_CONTROLLER_AMBIGUOUS: "Own agents grants name multiple controllers";
|
|
33
|
+
readonly OWN_AGENTS_NOT_MEMBER: "Device is not an effective own agent";
|
|
34
|
+
readonly MEMBERSHIP_CHECK_UNAVAILABLE: "Membership check unavailable; retry the write";
|
|
35
|
+
readonly CATALOG_RULE_LIMIT_EXCEEDED: "Catalog rule limit exceeded";
|
|
36
|
+
readonly APP_OUTBOX_FULL: "Group app outbox full; retry the dispatch";
|
|
37
|
+
readonly APP_ENTRY_TOO_LARGE: "Group app entry exceeds the plaintext limit";
|
|
38
|
+
readonly FRAME_TOO_LARGE: "Encrypted group frame exceeds the hub limit";
|
|
39
|
+
readonly SEND_NOT_ADMISSIBLE: "Group send admission refused";
|
|
40
|
+
readonly REVOCATION_DELIVERY_PENDING: "Undelivered capability revocations block leaving the group; retry the leave";
|
|
31
41
|
};
|
|
32
42
|
export type KubunErrorCode = keyof typeof KubunErrorCodes;
|
|
33
43
|
export declare function isKubunErrorCode(value: unknown): value is KubunErrorCode;
|
package/lib/errors.js
CHANGED
|
@@ -26,7 +26,17 @@
|
|
|
26
26
|
KB19: 'Tombstone requires a provider-merge-policy model',
|
|
27
27
|
KB20: 'Provider group CHANGE rejected',
|
|
28
28
|
KB21: 'Missing fetch token',
|
|
29
|
-
KB22: 'Merge-policy remove requires a tombstone'
|
|
29
|
+
KB22: 'Merge-policy remove requires a tombstone',
|
|
30
|
+
OWN_AGENTS_HEAD_UNRESOLVED: 'Own agents controller head unresolved; retry',
|
|
31
|
+
OWN_AGENTS_CONTROLLER_AMBIGUOUS: 'Own agents grants name multiple controllers',
|
|
32
|
+
OWN_AGENTS_NOT_MEMBER: 'Device is not an effective own agent',
|
|
33
|
+
MEMBERSHIP_CHECK_UNAVAILABLE: 'Membership check unavailable; retry the write',
|
|
34
|
+
CATALOG_RULE_LIMIT_EXCEEDED: 'Catalog rule limit exceeded',
|
|
35
|
+
APP_OUTBOX_FULL: 'Group app outbox full; retry the dispatch',
|
|
36
|
+
APP_ENTRY_TOO_LARGE: 'Group app entry exceeds the plaintext limit',
|
|
37
|
+
FRAME_TOO_LARGE: 'Encrypted group frame exceeds the hub limit',
|
|
38
|
+
SEND_NOT_ADMISSIBLE: 'Group send admission refused',
|
|
39
|
+
REVOCATION_DELIVERY_PENDING: 'Undelivered capability revocations block leaving the group; retry the leave'
|
|
30
40
|
};
|
|
31
41
|
export function isKubunErrorCode(value) {
|
|
32
42
|
return typeof value === 'string' && Object.hasOwn(KubunErrorCodes, value);
|
package/lib/executor.d.ts
CHANGED
|
@@ -24,6 +24,11 @@ export type GraphQLOperationParams = {
|
|
|
24
24
|
* retries of that intent, new for a new intent.
|
|
25
25
|
*/
|
|
26
26
|
deterministicEventID?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Capability chains presented to action gates such as `connector/execute`;
|
|
29
|
+
* each inner array is one chain. Delegated mode only.
|
|
30
|
+
*/
|
|
31
|
+
invocationCaps?: Array<Array<string>>;
|
|
27
32
|
};
|
|
28
33
|
/**
|
|
29
34
|
* A bound GraphQL execution target for a specific graph (and optionally a viewer).
|
package/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { AnyClientMessageOf, AnyServerMessageOf, ClientTransportOf, ServerTransportOf } from '@enkaku/protocol';
|
|
2
2
|
import type { GraphProtocol } from './services/graph.js';
|
|
3
|
+
export { InvalidCatalogDurationError, parseCatalogDuration } from './catalog-duration.js';
|
|
4
|
+
export { isDocumentDateField } from './document-date-field.js';
|
|
3
5
|
export { isKubunErrorCode, type KubunErrorCode, KubunErrorCodes } from './errors.js';
|
|
4
6
|
export type { GraphQLOperationParams, GraphQLSource, GraphQLSourceParams, GraphQLSourceProvider, GraphsProvider, } from './executor.js';
|
|
5
7
|
export { toHandlerError, wrapHandlers } from './handler-error.js';
|
|
6
|
-
export * from './models/catalog.js';
|
|
7
8
|
export * from './models/cluster.js';
|
|
8
9
|
export * from './models/document.js';
|
|
9
10
|
export * from './models/graph.js';
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export { InvalidCatalogDurationError, parseCatalogDuration } from './catalog-duration.js';
|
|
2
|
+
export { isDocumentDateField } from './document-date-field.js';
|
|
1
3
|
export { isKubunErrorCode, KubunErrorCodes } from './errors.js';
|
|
2
4
|
export { toHandlerError, wrapHandlers } from './handler-error.js';
|
|
3
|
-
export * from './models/catalog.js';
|
|
4
5
|
export * from './models/cluster.js';
|
|
5
6
|
export * from './models/document.js';
|
|
6
7
|
export * from './models/graph.js';
|
package/lib/models/cluster.d.ts
CHANGED
|
@@ -371,6 +371,9 @@ export declare const clusterModel: {
|
|
|
371
371
|
}];
|
|
372
372
|
};
|
|
373
373
|
};
|
|
374
|
+
readonly dateField: {
|
|
375
|
+
readonly type: "string";
|
|
376
|
+
};
|
|
374
377
|
readonly providerMergePolicy: {
|
|
375
378
|
readonly type: "object";
|
|
376
379
|
readonly properties: {
|
|
@@ -743,6 +746,9 @@ export declare const clusterModel: {
|
|
|
743
746
|
}];
|
|
744
747
|
};
|
|
745
748
|
};
|
|
749
|
+
readonly dateField: {
|
|
750
|
+
readonly type: "string";
|
|
751
|
+
};
|
|
746
752
|
readonly providerMergePolicy: {
|
|
747
753
|
readonly type: "object";
|
|
748
754
|
readonly properties: {
|
|
@@ -1121,6 +1127,9 @@ export declare const clusterModel: {
|
|
|
1121
1127
|
}];
|
|
1122
1128
|
};
|
|
1123
1129
|
};
|
|
1130
|
+
readonly dateField: {
|
|
1131
|
+
readonly type: "string";
|
|
1132
|
+
};
|
|
1124
1133
|
readonly providerMergePolicy: {
|
|
1125
1134
|
readonly type: "object";
|
|
1126
1135
|
readonly properties: {
|
|
@@ -1160,6 +1169,7 @@ export declare function clusterToRecord(cluster: ClusterModel): ClustersRecord;
|
|
|
1160
1169
|
export declare const validateClusterModel: import("@sozai/schema").Validator<{
|
|
1161
1170
|
digest: string;
|
|
1162
1171
|
models: ({
|
|
1172
|
+
dateField?: string | undefined;
|
|
1163
1173
|
providerMergePolicy?: {
|
|
1164
1174
|
group: string[];
|
|
1165
1175
|
} | undefined;
|
|
@@ -1254,6 +1264,7 @@ export declare const validateClusterModel: import("@sozai/schema").Validator<{
|
|
|
1254
1264
|
interfaces: string[];
|
|
1255
1265
|
behavior: "default";
|
|
1256
1266
|
} | {
|
|
1267
|
+
dateField?: string | undefined;
|
|
1257
1268
|
providerMergePolicy?: {
|
|
1258
1269
|
group: string[];
|
|
1259
1270
|
} | undefined;
|
|
@@ -1348,6 +1359,7 @@ export declare const validateClusterModel: import("@sozai/schema").Validator<{
|
|
|
1348
1359
|
interfaces: string[];
|
|
1349
1360
|
behavior: "interface";
|
|
1350
1361
|
} | {
|
|
1362
|
+
dateField?: string | undefined;
|
|
1351
1363
|
providerMergePolicy?: {
|
|
1352
1364
|
group: string[];
|
|
1353
1365
|
} | undefined;
|
package/lib/models/document.d.ts
CHANGED
|
@@ -796,6 +796,9 @@ export declare const documentModelBase: {
|
|
|
796
796
|
}];
|
|
797
797
|
};
|
|
798
798
|
};
|
|
799
|
+
readonly dateField: {
|
|
800
|
+
readonly type: "string";
|
|
801
|
+
};
|
|
799
802
|
readonly providerMergePolicy: {
|
|
800
803
|
readonly type: "object";
|
|
801
804
|
readonly properties: {
|
|
@@ -1169,6 +1172,9 @@ export declare const documentModelDefault: {
|
|
|
1169
1172
|
}];
|
|
1170
1173
|
};
|
|
1171
1174
|
};
|
|
1175
|
+
readonly dateField: {
|
|
1176
|
+
readonly type: "string";
|
|
1177
|
+
};
|
|
1172
1178
|
readonly providerMergePolicy: {
|
|
1173
1179
|
readonly type: "object";
|
|
1174
1180
|
readonly properties: {
|
|
@@ -1542,6 +1548,9 @@ export declare const documentModelInterface: {
|
|
|
1542
1548
|
}];
|
|
1543
1549
|
};
|
|
1544
1550
|
};
|
|
1551
|
+
readonly dateField: {
|
|
1552
|
+
readonly type: "string";
|
|
1553
|
+
};
|
|
1545
1554
|
readonly providerMergePolicy: {
|
|
1546
1555
|
readonly type: "object";
|
|
1547
1556
|
readonly properties: {
|
|
@@ -1921,6 +1930,9 @@ export declare const documentModelUnique: {
|
|
|
1921
1930
|
}];
|
|
1922
1931
|
};
|
|
1923
1932
|
};
|
|
1933
|
+
readonly dateField: {
|
|
1934
|
+
readonly type: "string";
|
|
1935
|
+
};
|
|
1924
1936
|
readonly providerMergePolicy: {
|
|
1925
1937
|
readonly type: "object";
|
|
1926
1938
|
readonly properties: {
|
|
@@ -2296,6 +2308,9 @@ export declare const documentModel: {
|
|
|
2296
2308
|
}];
|
|
2297
2309
|
};
|
|
2298
2310
|
};
|
|
2311
|
+
readonly dateField: {
|
|
2312
|
+
readonly type: "string";
|
|
2313
|
+
};
|
|
2299
2314
|
readonly providerMergePolicy: {
|
|
2300
2315
|
readonly type: "object";
|
|
2301
2316
|
readonly properties: {
|
|
@@ -2668,6 +2683,9 @@ export declare const documentModel: {
|
|
|
2668
2683
|
}];
|
|
2669
2684
|
};
|
|
2670
2685
|
};
|
|
2686
|
+
readonly dateField: {
|
|
2687
|
+
readonly type: "string";
|
|
2688
|
+
};
|
|
2671
2689
|
readonly providerMergePolicy: {
|
|
2672
2690
|
readonly type: "object";
|
|
2673
2691
|
readonly properties: {
|
|
@@ -3046,6 +3064,9 @@ export declare const documentModel: {
|
|
|
3046
3064
|
}];
|
|
3047
3065
|
};
|
|
3048
3066
|
};
|
|
3067
|
+
readonly dateField: {
|
|
3068
|
+
readonly type: "string";
|
|
3069
|
+
};
|
|
3049
3070
|
readonly providerMergePolicy: {
|
|
3050
3071
|
readonly type: "object";
|
|
3051
3072
|
readonly properties: {
|
|
@@ -3425,6 +3446,9 @@ export declare const documentModelsCluster: {
|
|
|
3425
3446
|
}];
|
|
3426
3447
|
};
|
|
3427
3448
|
};
|
|
3449
|
+
readonly dateField: {
|
|
3450
|
+
readonly type: "string";
|
|
3451
|
+
};
|
|
3428
3452
|
readonly providerMergePolicy: {
|
|
3429
3453
|
readonly type: "object";
|
|
3430
3454
|
readonly properties: {
|
|
@@ -3797,6 +3821,9 @@ export declare const documentModelsCluster: {
|
|
|
3797
3821
|
}];
|
|
3798
3822
|
};
|
|
3799
3823
|
};
|
|
3824
|
+
readonly dateField: {
|
|
3825
|
+
readonly type: "string";
|
|
3826
|
+
};
|
|
3800
3827
|
readonly providerMergePolicy: {
|
|
3801
3828
|
readonly type: "object";
|
|
3802
3829
|
readonly properties: {
|
|
@@ -4175,6 +4202,9 @@ export declare const documentModelsCluster: {
|
|
|
4175
4202
|
}];
|
|
4176
4203
|
};
|
|
4177
4204
|
};
|
|
4205
|
+
readonly dateField: {
|
|
4206
|
+
readonly type: "string";
|
|
4207
|
+
};
|
|
4178
4208
|
readonly providerMergePolicy: {
|
|
4179
4209
|
readonly type: "object";
|
|
4180
4210
|
readonly properties: {
|
|
@@ -4555,6 +4585,9 @@ export declare const documentModelsRecord: {
|
|
|
4555
4585
|
}];
|
|
4556
4586
|
};
|
|
4557
4587
|
};
|
|
4588
|
+
readonly dateField: {
|
|
4589
|
+
readonly type: "string";
|
|
4590
|
+
};
|
|
4558
4591
|
readonly providerMergePolicy: {
|
|
4559
4592
|
readonly type: "object";
|
|
4560
4593
|
readonly properties: {
|
|
@@ -4927,6 +4960,9 @@ export declare const documentModelsRecord: {
|
|
|
4927
4960
|
}];
|
|
4928
4961
|
};
|
|
4929
4962
|
};
|
|
4963
|
+
readonly dateField: {
|
|
4964
|
+
readonly type: "string";
|
|
4965
|
+
};
|
|
4930
4966
|
readonly providerMergePolicy: {
|
|
4931
4967
|
readonly type: "object";
|
|
4932
4968
|
readonly properties: {
|
|
@@ -5305,6 +5341,9 @@ export declare const documentModelsRecord: {
|
|
|
5305
5341
|
}];
|
|
5306
5342
|
};
|
|
5307
5343
|
};
|
|
5344
|
+
readonly dateField: {
|
|
5345
|
+
readonly type: "string";
|
|
5346
|
+
};
|
|
5308
5347
|
readonly providerMergePolicy: {
|
|
5309
5348
|
readonly type: "object";
|
|
5310
5349
|
readonly properties: {
|
|
@@ -5672,6 +5711,7 @@ export declare const documentMutation: {
|
|
|
5672
5711
|
};
|
|
5673
5712
|
export type DocumentMutation = FromSchema<typeof documentMutation>;
|
|
5674
5713
|
export declare const validateDocumentModel: import("@sozai/schema").Validator<{
|
|
5714
|
+
dateField?: string | undefined;
|
|
5675
5715
|
providerMergePolicy?: {
|
|
5676
5716
|
group: string[];
|
|
5677
5717
|
} | undefined;
|
|
@@ -5766,6 +5806,7 @@ export declare const validateDocumentModel: import("@sozai/schema").Validator<{
|
|
|
5766
5806
|
interfaces: string[];
|
|
5767
5807
|
behavior: "default";
|
|
5768
5808
|
} | {
|
|
5809
|
+
dateField?: string | undefined;
|
|
5769
5810
|
providerMergePolicy?: {
|
|
5770
5811
|
group: string[];
|
|
5771
5812
|
} | undefined;
|
|
@@ -5860,6 +5901,7 @@ export declare const validateDocumentModel: import("@sozai/schema").Validator<{
|
|
|
5860
5901
|
interfaces: string[];
|
|
5861
5902
|
behavior: "interface";
|
|
5862
5903
|
} | {
|
|
5904
|
+
dateField?: string | undefined;
|
|
5863
5905
|
providerMergePolicy?: {
|
|
5864
5906
|
group: string[];
|
|
5865
5907
|
} | undefined;
|
package/lib/models/document.js
CHANGED
package/lib/models/group.d.ts
CHANGED
package/lib/services/graph.d.ts
CHANGED
|
@@ -401,6 +401,9 @@ export declare const deployGraphParams: {
|
|
|
401
401
|
}];
|
|
402
402
|
};
|
|
403
403
|
};
|
|
404
|
+
readonly dateField: {
|
|
405
|
+
readonly type: "string";
|
|
406
|
+
};
|
|
404
407
|
readonly providerMergePolicy: {
|
|
405
408
|
readonly type: "object";
|
|
406
409
|
readonly properties: {
|
|
@@ -773,6 +776,9 @@ export declare const deployGraphParams: {
|
|
|
773
776
|
}];
|
|
774
777
|
};
|
|
775
778
|
};
|
|
779
|
+
readonly dateField: {
|
|
780
|
+
readonly type: "string";
|
|
781
|
+
};
|
|
776
782
|
readonly providerMergePolicy: {
|
|
777
783
|
readonly type: "object";
|
|
778
784
|
readonly properties: {
|
|
@@ -1151,6 +1157,9 @@ export declare const deployGraphParams: {
|
|
|
1151
1157
|
}];
|
|
1152
1158
|
};
|
|
1153
1159
|
};
|
|
1160
|
+
readonly dateField: {
|
|
1161
|
+
readonly type: "string";
|
|
1162
|
+
};
|
|
1154
1163
|
readonly providerMergePolicy: {
|
|
1155
1164
|
readonly type: "object";
|
|
1156
1165
|
readonly properties: {
|
|
@@ -1584,6 +1593,9 @@ export declare const deployGraphResult: {
|
|
|
1584
1593
|
}];
|
|
1585
1594
|
};
|
|
1586
1595
|
};
|
|
1596
|
+
readonly dateField: {
|
|
1597
|
+
readonly type: "string";
|
|
1598
|
+
};
|
|
1587
1599
|
readonly providerMergePolicy: {
|
|
1588
1600
|
readonly type: "object";
|
|
1589
1601
|
readonly properties: {
|
|
@@ -1956,6 +1968,9 @@ export declare const deployGraphResult: {
|
|
|
1956
1968
|
}];
|
|
1957
1969
|
};
|
|
1958
1970
|
};
|
|
1971
|
+
readonly dateField: {
|
|
1972
|
+
readonly type: "string";
|
|
1973
|
+
};
|
|
1959
1974
|
readonly providerMergePolicy: {
|
|
1960
1975
|
readonly type: "object";
|
|
1961
1976
|
readonly properties: {
|
|
@@ -2334,6 +2349,9 @@ export declare const deployGraphResult: {
|
|
|
2334
2349
|
}];
|
|
2335
2350
|
};
|
|
2336
2351
|
};
|
|
2352
|
+
readonly dateField: {
|
|
2353
|
+
readonly type: "string";
|
|
2354
|
+
};
|
|
2337
2355
|
readonly providerMergePolicy: {
|
|
2338
2356
|
readonly type: "object";
|
|
2339
2357
|
readonly properties: {
|
|
@@ -2777,6 +2795,9 @@ export declare const loadGraphResult: {
|
|
|
2777
2795
|
}];
|
|
2778
2796
|
};
|
|
2779
2797
|
};
|
|
2798
|
+
readonly dateField: {
|
|
2799
|
+
readonly type: "string";
|
|
2800
|
+
};
|
|
2780
2801
|
readonly providerMergePolicy: {
|
|
2781
2802
|
readonly type: "object";
|
|
2782
2803
|
readonly properties: {
|
|
@@ -3149,6 +3170,9 @@ export declare const loadGraphResult: {
|
|
|
3149
3170
|
}];
|
|
3150
3171
|
};
|
|
3151
3172
|
};
|
|
3173
|
+
readonly dateField: {
|
|
3174
|
+
readonly type: "string";
|
|
3175
|
+
};
|
|
3152
3176
|
readonly providerMergePolicy: {
|
|
3153
3177
|
readonly type: "object";
|
|
3154
3178
|
readonly properties: {
|
|
@@ -3527,6 +3551,9 @@ export declare const loadGraphResult: {
|
|
|
3527
3551
|
}];
|
|
3528
3552
|
};
|
|
3529
3553
|
};
|
|
3554
|
+
readonly dateField: {
|
|
3555
|
+
readonly type: "string";
|
|
3556
|
+
};
|
|
3530
3557
|
readonly providerMergePolicy: {
|
|
3531
3558
|
readonly type: "object";
|
|
3532
3559
|
readonly properties: {
|
|
@@ -3587,9 +3614,6 @@ export declare const executeGraphParams: {
|
|
|
3587
3614
|
readonly variables: {
|
|
3588
3615
|
readonly type: "object";
|
|
3589
3616
|
};
|
|
3590
|
-
readonly catalogID: {
|
|
3591
|
-
readonly type: "string";
|
|
3592
|
-
};
|
|
3593
3617
|
};
|
|
3594
3618
|
readonly required: readonly ["id", "text"];
|
|
3595
3619
|
readonly additionalProperties: false;
|
|
@@ -3744,9 +3768,6 @@ export declare const mutateGraphParams: {
|
|
|
3744
3768
|
readonly variables: {
|
|
3745
3769
|
readonly type: "object";
|
|
3746
3770
|
};
|
|
3747
|
-
readonly catalogID: {
|
|
3748
|
-
readonly type: "string";
|
|
3749
|
-
};
|
|
3750
3771
|
};
|
|
3751
3772
|
readonly required: readonly ["id", "text", "mutations"];
|
|
3752
3773
|
readonly additionalProperties: false;
|
|
@@ -3803,6 +3824,9 @@ export declare const transactionResult: {
|
|
|
3803
3824
|
readonly docID: {
|
|
3804
3825
|
readonly type: "string";
|
|
3805
3826
|
};
|
|
3827
|
+
readonly retryable: {
|
|
3828
|
+
readonly type: "boolean";
|
|
3829
|
+
};
|
|
3806
3830
|
};
|
|
3807
3831
|
readonly required: readonly ["code", "message"];
|
|
3808
3832
|
readonly additionalProperties: false;
|
|
@@ -4189,6 +4213,9 @@ export declare const graphProtocol: {
|
|
|
4189
4213
|
}];
|
|
4190
4214
|
};
|
|
4191
4215
|
};
|
|
4216
|
+
readonly dateField: {
|
|
4217
|
+
readonly type: "string";
|
|
4218
|
+
};
|
|
4192
4219
|
readonly providerMergePolicy: {
|
|
4193
4220
|
readonly type: "object";
|
|
4194
4221
|
readonly properties: {
|
|
@@ -4561,6 +4588,9 @@ export declare const graphProtocol: {
|
|
|
4561
4588
|
}];
|
|
4562
4589
|
};
|
|
4563
4590
|
};
|
|
4591
|
+
readonly dateField: {
|
|
4592
|
+
readonly type: "string";
|
|
4593
|
+
};
|
|
4564
4594
|
readonly providerMergePolicy: {
|
|
4565
4595
|
readonly type: "object";
|
|
4566
4596
|
readonly properties: {
|
|
@@ -4939,6 +4969,9 @@ export declare const graphProtocol: {
|
|
|
4939
4969
|
}];
|
|
4940
4970
|
};
|
|
4941
4971
|
};
|
|
4972
|
+
readonly dateField: {
|
|
4973
|
+
readonly type: "string";
|
|
4974
|
+
};
|
|
4942
4975
|
readonly providerMergePolicy: {
|
|
4943
4976
|
readonly type: "object";
|
|
4944
4977
|
readonly properties: {
|
|
@@ -5371,6 +5404,9 @@ export declare const graphProtocol: {
|
|
|
5371
5404
|
}];
|
|
5372
5405
|
};
|
|
5373
5406
|
};
|
|
5407
|
+
readonly dateField: {
|
|
5408
|
+
readonly type: "string";
|
|
5409
|
+
};
|
|
5374
5410
|
readonly providerMergePolicy: {
|
|
5375
5411
|
readonly type: "object";
|
|
5376
5412
|
readonly properties: {
|
|
@@ -5743,6 +5779,9 @@ export declare const graphProtocol: {
|
|
|
5743
5779
|
}];
|
|
5744
5780
|
};
|
|
5745
5781
|
};
|
|
5782
|
+
readonly dateField: {
|
|
5783
|
+
readonly type: "string";
|
|
5784
|
+
};
|
|
5746
5785
|
readonly providerMergePolicy: {
|
|
5747
5786
|
readonly type: "object";
|
|
5748
5787
|
readonly properties: {
|
|
@@ -6121,6 +6160,9 @@ export declare const graphProtocol: {
|
|
|
6121
6160
|
}];
|
|
6122
6161
|
};
|
|
6123
6162
|
};
|
|
6163
|
+
readonly dateField: {
|
|
6164
|
+
readonly type: "string";
|
|
6165
|
+
};
|
|
6124
6166
|
readonly providerMergePolicy: {
|
|
6125
6167
|
readonly type: "object";
|
|
6126
6168
|
readonly properties: {
|
|
@@ -6567,6 +6609,9 @@ export declare const graphProtocol: {
|
|
|
6567
6609
|
}];
|
|
6568
6610
|
};
|
|
6569
6611
|
};
|
|
6612
|
+
readonly dateField: {
|
|
6613
|
+
readonly type: "string";
|
|
6614
|
+
};
|
|
6570
6615
|
readonly providerMergePolicy: {
|
|
6571
6616
|
readonly type: "object";
|
|
6572
6617
|
readonly properties: {
|
|
@@ -6939,6 +6984,9 @@ export declare const graphProtocol: {
|
|
|
6939
6984
|
}];
|
|
6940
6985
|
};
|
|
6941
6986
|
};
|
|
6987
|
+
readonly dateField: {
|
|
6988
|
+
readonly type: "string";
|
|
6989
|
+
};
|
|
6942
6990
|
readonly providerMergePolicy: {
|
|
6943
6991
|
readonly type: "object";
|
|
6944
6992
|
readonly properties: {
|
|
@@ -7317,6 +7365,9 @@ export declare const graphProtocol: {
|
|
|
7317
7365
|
}];
|
|
7318
7366
|
};
|
|
7319
7367
|
};
|
|
7368
|
+
readonly dateField: {
|
|
7369
|
+
readonly type: "string";
|
|
7370
|
+
};
|
|
7320
7371
|
readonly providerMergePolicy: {
|
|
7321
7372
|
readonly type: "object";
|
|
7322
7373
|
readonly properties: {
|
|
@@ -7423,9 +7474,6 @@ export declare const graphProtocol: {
|
|
|
7423
7474
|
readonly variables: {
|
|
7424
7475
|
readonly type: "object";
|
|
7425
7476
|
};
|
|
7426
|
-
readonly catalogID: {
|
|
7427
|
-
readonly type: "string";
|
|
7428
|
-
};
|
|
7429
7477
|
};
|
|
7430
7478
|
readonly required: readonly ["id", "text", "mutations"];
|
|
7431
7479
|
readonly additionalProperties: false;
|
|
@@ -7499,9 +7547,6 @@ export declare const graphProtocol: {
|
|
|
7499
7547
|
readonly variables: {
|
|
7500
7548
|
readonly type: "object";
|
|
7501
7549
|
};
|
|
7502
|
-
readonly catalogID: {
|
|
7503
|
-
readonly type: "string";
|
|
7504
|
-
};
|
|
7505
7550
|
};
|
|
7506
7551
|
readonly required: readonly ["id", "text"];
|
|
7507
7552
|
readonly additionalProperties: false;
|
|
@@ -7575,9 +7620,6 @@ export declare const graphProtocol: {
|
|
|
7575
7620
|
readonly variables: {
|
|
7576
7621
|
readonly type: "object";
|
|
7577
7622
|
};
|
|
7578
|
-
readonly catalogID: {
|
|
7579
|
-
readonly type: "string";
|
|
7580
|
-
};
|
|
7581
7623
|
};
|
|
7582
7624
|
readonly required: readonly ["id", "text"];
|
|
7583
7625
|
readonly additionalProperties: false;
|
|
@@ -7748,6 +7790,9 @@ export declare const graphProtocol: {
|
|
|
7748
7790
|
readonly docID: {
|
|
7749
7791
|
readonly type: "string";
|
|
7750
7792
|
};
|
|
7793
|
+
readonly retryable: {
|
|
7794
|
+
readonly type: "boolean";
|
|
7795
|
+
};
|
|
7751
7796
|
};
|
|
7752
7797
|
readonly required: readonly ["code", "message"];
|
|
7753
7798
|
readonly additionalProperties: false;
|
|
@@ -7787,6 +7832,9 @@ export declare const graphProtocol: {
|
|
|
7787
7832
|
readonly docID: {
|
|
7788
7833
|
readonly type: "string";
|
|
7789
7834
|
};
|
|
7835
|
+
readonly retryable: {
|
|
7836
|
+
readonly type: "boolean";
|
|
7837
|
+
};
|
|
7790
7838
|
};
|
|
7791
7839
|
readonly required: readonly ["code", "message"];
|
|
7792
7840
|
readonly additionalProperties: false;
|
|
@@ -7798,3 +7846,8 @@ export declare const graphProtocol: {
|
|
|
7798
7846
|
};
|
|
7799
7847
|
};
|
|
7800
7848
|
export type GraphProtocol = typeof graphProtocol;
|
|
7849
|
+
/**
|
|
7850
|
+
* Graph procedures whose calls stay open for as long as the caller wants them: a
|
|
7851
|
+
* server must not expire them as stalled calls.
|
|
7852
|
+
*/
|
|
7853
|
+
export declare const GRAPH_LONG_LIVED_PROCEDURES: ReadonlyArray<keyof GraphProtocol & string>;
|
package/lib/services/graph.js
CHANGED
|
@@ -138,9 +138,6 @@ export const executeGraphParams = {
|
|
|
138
138
|
},
|
|
139
139
|
variables: {
|
|
140
140
|
type: 'object'
|
|
141
|
-
},
|
|
142
|
-
catalogID: {
|
|
143
|
-
type: 'string'
|
|
144
141
|
}
|
|
145
142
|
},
|
|
146
143
|
required: [
|
|
@@ -322,6 +319,9 @@ export const transactionResult = {
|
|
|
322
319
|
},
|
|
323
320
|
docID: {
|
|
324
321
|
type: 'string'
|
|
322
|
+
},
|
|
323
|
+
retryable: {
|
|
324
|
+
type: 'boolean'
|
|
325
325
|
}
|
|
326
326
|
},
|
|
327
327
|
required: [
|
|
@@ -390,3 +390,9 @@ export const graphProtocol = {
|
|
|
390
390
|
result: transactionResult
|
|
391
391
|
}
|
|
392
392
|
};
|
|
393
|
+
/**
|
|
394
|
+
* Graph procedures whose calls stay open for as long as the caller wants them: a
|
|
395
|
+
* server must not expire them as stalled calls.
|
|
396
|
+
*/ export const GRAPH_LONG_LIVED_PROCEDURES = [
|
|
397
|
+
'graph/subscribe'
|
|
398
|
+
];
|
package/lib/types.d.ts
CHANGED
|
@@ -79,7 +79,10 @@ export type AggregateDocumentsParams = {
|
|
|
79
79
|
modelIDs: Array<string>;
|
|
80
80
|
filter?: DocumentFilter;
|
|
81
81
|
owner?: string;
|
|
82
|
-
|
|
82
|
+
catalogRef?: {
|
|
83
|
+
owner: string;
|
|
84
|
+
id: string;
|
|
85
|
+
};
|
|
83
86
|
readAccess?: ViewerReadAccess;
|
|
84
87
|
count: boolean;
|
|
85
88
|
aggregates: Array<AggregateSpec>;
|
|
@@ -113,7 +116,10 @@ export type GroupedAggregateDocumentsParams = {
|
|
|
113
116
|
modelIDs: Array<string>;
|
|
114
117
|
filter?: DocumentFilter;
|
|
115
118
|
owner?: string;
|
|
116
|
-
|
|
119
|
+
catalogRef?: {
|
|
120
|
+
owner: string;
|
|
121
|
+
id: string;
|
|
122
|
+
};
|
|
117
123
|
readAccess?: ViewerReadAccess;
|
|
118
124
|
count: boolean;
|
|
119
125
|
aggregates: Array<AggregateSpec>;
|
|
@@ -140,7 +146,7 @@ export type DocumentData = Record<string, unknown>;
|
|
|
140
146
|
* validates only model-declared fields and preserves reserved fields through
|
|
141
147
|
* patches unchanged.
|
|
142
148
|
*/
|
|
143
|
-
export declare const RESERVED_DOCUMENT_FIELDS: readonly ["accessPermissions"];
|
|
149
|
+
export declare const RESERVED_DOCUMENT_FIELDS: readonly ["accessPermissions", "defaultAccessPermissions"];
|
|
144
150
|
export declare function isAccessLevel(value: unknown): value is AccessLevel;
|
|
145
151
|
export declare function isValidAccessRule(value: unknown): boolean;
|
|
146
152
|
/**
|
|
@@ -162,4 +168,5 @@ export type DocumentNode = {
|
|
|
162
168
|
data: DocumentData | null;
|
|
163
169
|
createdAt: Date;
|
|
164
170
|
updatedAt?: Date | null;
|
|
171
|
+
scopeDate?: number;
|
|
165
172
|
};
|
package/lib/types.js
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* validates only model-declared fields and preserves reserved fields through
|
|
6
6
|
* patches unchanged.
|
|
7
7
|
*/ export const RESERVED_DOCUMENT_FIELDS = [
|
|
8
|
-
'accessPermissions'
|
|
8
|
+
'accessPermissions',
|
|
9
|
+
'defaultAccessPermissions'
|
|
9
10
|
];
|
|
10
11
|
export function isAccessLevel(value) {
|
|
11
12
|
return value === 'only_owner' || value === 'anyone' || value === 'restricted';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubun/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"license": "see LICENSE.md",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -15,17 +15,17 @@
|
|
|
15
15
|
"LICENSE.md"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@enkaku/protocol": "^0.21.
|
|
19
|
-
"@enkaku/server": "^0.21.
|
|
20
|
-
"@kubun/id": "^0.
|
|
21
|
-
"@kubun/logger": "^0.
|
|
22
|
-
"@sozai/codec": "^0.4.
|
|
23
|
-
"@sozai/schema": "^0.1.
|
|
18
|
+
"@enkaku/protocol": "^0.21.5",
|
|
19
|
+
"@enkaku/server": "^0.21.5",
|
|
20
|
+
"@kubun/id": "^0.18.0",
|
|
21
|
+
"@kubun/logger": "^0.18.0",
|
|
22
|
+
"@sozai/codec": "^0.4.3",
|
|
23
|
+
"@sozai/schema": "^0.1.4",
|
|
24
24
|
"change-case": "^5.4.4"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"graphql": "^17.0.2",
|
|
28
|
-
"json-schema-typed": "^
|
|
28
|
+
"json-schema-typed": "^9.0.0"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
package/lib/models/catalog.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Declarative filter criteria for a catalog.
|
|
3
|
-
* All fields are optional — omitted fields mean "no constraint on this dimension."
|
|
4
|
-
* Multiple values in an array are OR'd (any match).
|
|
5
|
-
* Multiple fields are AND'd (all must match).
|
|
6
|
-
*/
|
|
7
|
-
export type CatalogFilterCriteria = {
|
|
8
|
-
/** Filter by model IDs — documents must be of one of these models */
|
|
9
|
-
models?: Array<string>;
|
|
10
|
-
/** Filter by owner DIDs — documents must be owned by one of these DIDs */
|
|
11
|
-
owners?: Array<string>;
|
|
12
|
-
/** Filter by circle IDs — documents must grant access to one of these circles */
|
|
13
|
-
circles?: Array<string>;
|
|
14
|
-
};
|
|
15
|
-
export type CatalogRecord = {
|
|
16
|
-
id: string;
|
|
17
|
-
ownerDID: string;
|
|
18
|
-
name: string;
|
|
19
|
-
description: string;
|
|
20
|
-
filterCriteria: CatalogFilterCriteria;
|
|
21
|
-
hlc: string;
|
|
22
|
-
};
|
package/lib/models/catalog.js
DELETED