@kubun/mutation 0.12.0 → 0.13.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/apply.d.ts +9 -0
- package/lib/apply.js +8 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/package.json +8 -5
package/lib/apply.d.ts
CHANGED
|
@@ -56,6 +56,15 @@ export type MutationContext = {
|
|
|
56
56
|
postStateGate?: PostStateGate;
|
|
57
57
|
};
|
|
58
58
|
export declare function getDocumentValidator(ctx: MutationContext, id: string): Promise<DocumentValidator>;
|
|
59
|
+
/**
|
|
60
|
+
* How far into the future a stamp arriving from elsewhere may sit.
|
|
61
|
+
*
|
|
62
|
+
* One bound for the whole device: the graph lane and the credential lane check
|
|
63
|
+
* against the same number so a peer cannot get past one by going through the
|
|
64
|
+
* other. The past direction is deliberately unbounded — an offline-first write
|
|
65
|
+
* lands whenever it lands.
|
|
66
|
+
*/
|
|
67
|
+
export declare const DEFAULT_MAX_DRIFT_MS = 3600000;
|
|
59
68
|
export declare function getTopLevelField(path: string): string;
|
|
60
69
|
export declare function applyChangeMutation(ctx: MutationContext, mutation: ChangeDocumentMutation): Promise<DocumentNode | null>;
|
|
61
70
|
export declare function applySetMutation(ctx: MutationContext, mutation: SetDocumentMutation): Promise<DocumentNode | null>;
|
package/lib/apply.js
CHANGED
|
@@ -25,6 +25,14 @@ export function getDocumentValidator(ctx, id) {
|
|
|
25
25
|
}
|
|
26
26
|
return ctx.validators[id];
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* How far into the future a stamp arriving from elsewhere may sit.
|
|
30
|
+
*
|
|
31
|
+
* One bound for the whole device: the graph lane and the credential lane check
|
|
32
|
+
* against the same number so a peer cannot get past one by going through the
|
|
33
|
+
* other. The past direction is deliberately unbounded — an offline-first write
|
|
34
|
+
* lands whenever it lands.
|
|
35
|
+
*/ export const DEFAULT_MAX_DRIFT_MS = 3_600_000;
|
|
28
36
|
function validateHLCDrift(hlcString, maxDriftMS) {
|
|
29
37
|
const ts = HLC.parse(hlcString);
|
|
30
38
|
const now = Date.now();
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { HLC, type HLCTimestamp } from '@kubun/hlc';
|
|
2
2
|
export type { DocumentValidator, MutationContext, MutationDB, PostStateGate, ValidatorsRecord, } from './apply.js';
|
|
3
|
-
export { applyChangeMutation, applyMutation, applySetMutation, getTopLevelField } from './apply.js';
|
|
3
|
+
export { applyChangeMutation, applyMutation, applySetMutation, DEFAULT_MAX_DRIFT_MS, getTopLevelField, } from './apply.js';
|
|
4
4
|
export type { CreateChangeMutationParams, CreateRemoveMutationParams, CreateSetMutationParams, } from './create.js';
|
|
5
5
|
export { createChangeMutation, createRemoveMutation, createSetMutation } from './create.js';
|
|
6
6
|
export { DocumentIDMismatchError, HLCDriftError, InvalidAccessPermissionsError, isPermanentApplyError, MutationSchemaValidationError, OwnerChangeError, UnsupportedMutationTypeError, WriteAccessDeniedError, } from './errors.js';
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { HLC } from '@kubun/hlc';
|
|
2
|
-
export { applyChangeMutation, applyMutation, applySetMutation, getTopLevelField } from './apply.js';
|
|
2
|
+
export { applyChangeMutation, applyMutation, applySetMutation, DEFAULT_MAX_DRIFT_MS, getTopLevelField } from './apply.js';
|
|
3
3
|
export { createChangeMutation, createRemoveMutation, createSetMutation } from './create.js';
|
|
4
4
|
export { DocumentIDMismatchError, HLCDriftError, InvalidAccessPermissionsError, isPermanentApplyError, MutationSchemaValidationError, OwnerChangeError, UnsupportedMutationTypeError, WriteAccessDeniedError } from './errors.js';
|
|
5
5
|
export { convertPatchInput, createMutationOperations } from './operations.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubun/mutation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"license": "see LICENSE.md",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -19,12 +19,15 @@
|
|
|
19
19
|
"@sozai/patch": "^0.1.3",
|
|
20
20
|
"@sozai/runtime": "^0.1.0",
|
|
21
21
|
"@sozai/schema": "^0.1.1",
|
|
22
|
-
"@kubun/
|
|
23
|
-
"@kubun/
|
|
22
|
+
"@kubun/id": "^0.13.0",
|
|
23
|
+
"@kubun/hlc": "^0.13.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@kubun/graphql": "^0.
|
|
27
|
-
"@kubun/protocol": "^0.
|
|
26
|
+
"@kubun/graphql": "^0.13.0",
|
|
27
|
+
"@kubun/protocol": "^0.13.0"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
28
31
|
},
|
|
29
32
|
"scripts": {
|
|
30
33
|
"build": "pnpm run build:clean && pnpm run build:js && pnpm run build:types",
|