@milaboratories/pl-model-common 1.16.5 → 1.17.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/dist/author_marker.d.ts +10 -0
- package/dist/author_marker.d.ts.map +1 -0
- package/dist/block_state.d.ts +2 -0
- package/dist/block_state.d.ts.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -43
- package/dist/index.mjs.map +1 -1
- package/dist/utag.d.ts +4 -0
- package/dist/utag.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/author_marker.ts +10 -0
- package/src/block_state.ts +3 -0
- package/src/errors.ts +2 -2
- package/src/index.ts +1 -0
- package/src/utag.ts +6 -0
package/dist/utag.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AuthorMarker } from './author_marker';
|
|
1
2
|
/** Value returned for changing states supporting reactive listening for changes */
|
|
2
3
|
export interface ValueWithUTag<V> {
|
|
3
4
|
/** Value snapshot. */
|
|
@@ -11,4 +12,7 @@ export interface ValueWithUTag<V> {
|
|
|
11
12
|
* */
|
|
12
13
|
readonly uTag: string;
|
|
13
14
|
}
|
|
15
|
+
export interface ValueWithUTagAndAuthor<V> extends ValueWithUTag<V> {
|
|
16
|
+
readonly author?: AuthorMarker;
|
|
17
|
+
}
|
|
14
18
|
//# sourceMappingURL=utag.d.ts.map
|
package/dist/utag.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utag.d.ts","sourceRoot":"","sources":["../src/utag.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,sBAAsB;IACtB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAElB;;;;;;SAMK;IACL,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB"}
|
|
1
|
+
{"version":3,"file":"utag.d.ts","sourceRoot":"","sources":["../src/utag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,mFAAmF;AACnF,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,sBAAsB;IACtB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAElB;;;;;;SAMK;IACL,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB,CAAC,CAAC,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;IACjE,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;CAChC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pl-model-common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "Platforma SDK Model",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"typescript": "~5.6.3",
|
|
27
27
|
"vite": "^6.3.5",
|
|
28
28
|
"vitest": "^2.1.9",
|
|
29
|
-
"@
|
|
30
|
-
"@
|
|
29
|
+
"@milaboratories/build-configs": "1.0.4",
|
|
30
|
+
"@platforma-sdk/eslint-config": "1.0.3"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"type-check": "tsc --noEmit --composite false",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Structure to help resolve conflicts if multiple participants writes to
|
|
2
|
+
* the same state */
|
|
3
|
+
export interface AuthorMarker {
|
|
4
|
+
/** Unique identifier of client or even a specific window that sets this
|
|
5
|
+
* particular state */
|
|
6
|
+
authorId: string;
|
|
7
|
+
|
|
8
|
+
/** Sequential version of the state local to the author */
|
|
9
|
+
localVersion: number;
|
|
10
|
+
}
|
package/src/block_state.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BlockOutputsBase } from './common_types';
|
|
2
2
|
import type { NavigationState } from './navigation';
|
|
3
|
+
import type { AuthorMarker } from './author_marker';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* @template Args sets type of block arguments passed to the workflow
|
|
@@ -27,4 +28,6 @@ export type BlockState<
|
|
|
27
28
|
|
|
28
29
|
/** Current navigation state */
|
|
29
30
|
navigationState: NavigationState<Href>;
|
|
31
|
+
|
|
32
|
+
readonly author: AuthorMarker | undefined;
|
|
30
33
|
};
|
package/src/errors.ts
CHANGED
|
@@ -107,9 +107,9 @@ export type ResultOrError<S, F = Error> = {
|
|
|
107
107
|
error: F;
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
-
export function unwrapResult<T>(result: ResultOrError<T>): T {
|
|
110
|
+
export function unwrapResult<T>(result: ResultOrError<T, Error | SerializedError>): T {
|
|
111
111
|
if (result.error) {
|
|
112
|
-
throw result.error;
|
|
112
|
+
throw result.error instanceof Error ? result.error : deserializeError(result.error);
|
|
113
113
|
}
|
|
114
114
|
return result.value;
|
|
115
115
|
}
|
package/src/index.ts
CHANGED
package/src/utag.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { AuthorMarker } from './author_marker';
|
|
2
|
+
|
|
1
3
|
/** Value returned for changing states supporting reactive listening for changes */
|
|
2
4
|
export interface ValueWithUTag<V> {
|
|
3
5
|
/** Value snapshot. */
|
|
@@ -12,3 +14,7 @@ export interface ValueWithUTag<V> {
|
|
|
12
14
|
* */
|
|
13
15
|
readonly uTag: string;
|
|
14
16
|
}
|
|
17
|
+
|
|
18
|
+
export interface ValueWithUTagAndAuthor<V> extends ValueWithUTag<V> {
|
|
19
|
+
readonly author?: AuthorMarker;
|
|
20
|
+
}
|