@ahoo-wang/wow-view-store 10.0.0-alpha.3 → 10.0.0-alpha.4
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/README.md +54 -129
- package/README.zh-CN.md +42 -104
- package/dist/datasetWordings.d.ts +24 -25
- package/dist/errors.d.ts +54 -73
- package/dist/{v10/generated → generated}/view-store/boundedContext.d.ts +1 -1
- package/dist/{v10/generated → generated}/view-store/dataset_wording/aggregate.d.ts +2 -2
- package/dist/{v10/generated → generated}/view-store/dataset_wording/commandClient.d.ts +1 -1
- package/dist/{v10/generated → generated}/view-store/dataset_wording/queryClient.d.ts +2 -2
- package/dist/{v10/generated → generated}/view-store/types.d.ts +8 -0
- package/dist/generated/view-store/view/aggregate.d.ts +17 -0
- package/dist/{v10/generated → generated}/view-store/view/commandClient.d.ts +1 -1
- package/dist/{v10/generated → generated}/view-store/view/queryClient.d.ts +2 -2
- package/dist/{v10/generated → generated}/view-store/view_preferences/aggregate.d.ts +2 -2
- package/dist/{v10/generated → generated}/view-store/view_preferences/commandClient.d.ts +1 -1
- package/dist/{v10/generated → generated}/view-store/view_preferences/queryClient.d.ts +2 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.es.js +602 -391
- package/dist/index.es.js.map +1 -1
- package/dist/paths.d.ts +0 -32
- package/dist/{v10/source.d.ts → source.d.ts} +8 -7
- package/dist/{v10/systemViews.d.ts → systemViews.d.ts} +1 -1
- package/dist/views.d.ts +49 -0
- package/dist/wire.d.ts +20 -73
- package/dist/wowViewStore.d.ts +111 -159
- package/package.json +7 -13
- package/dist/remembered.es.js +0 -147
- package/dist/remembered.es.js.map +0 -1
- package/dist/v10/datasetWordings.d.ts +0 -46
- package/dist/v10/errors.d.ts +0 -83
- package/dist/v10/generated/view-store/view/aggregate.d.ts +0 -17
- package/dist/v10/index.d.ts +0 -6
- package/dist/v10/wire.d.ts +0 -25
- package/dist/v10/wowViewStore.d.ts +0 -179
- package/dist/v10.es.js +0 -673
- package/dist/v10.es.js.map +0 -1
- /package/dist/{v10/generated → generated}/index.d.ts +0 -0
- /package/dist/{v10/generated → generated}/view-store/dataset_wording/index.d.ts +0 -0
- /package/dist/{v10/generated → generated}/view-store/index.d.ts +0 -0
- /package/dist/{v10/generated → generated}/view-store/view/index.d.ts +0 -0
- /package/dist/{v10/generated → generated}/view-store/view_preferences/index.d.ts +0 -0
package/dist/wire.d.ts
CHANGED
|
@@ -1,78 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
1
|
+
import { TargetScope } from '@ahoo-wang/wow-client';
|
|
2
|
+
import { DatasetOverrides, ViewInstance, ViewInstanceSummary } from '@ahoo-wang/wow-view-engine';
|
|
3
|
+
import { Place } from './paths.js';
|
|
4
|
+
import { DatasetWordingState, ViewState } from './generated/view-store/types.js';
|
|
5
|
+
/** The `Wow-Scope` of the shared views: the reserved owner `(shared)`. */
|
|
6
|
+
export declare const SHARED_SCOPE: TargetScope;
|
|
7
|
+
/** The `Wow-Scope` of the stored system views: `(system)` of `(platform)`. */
|
|
8
|
+
export declare const SYSTEM_SCOPE: TargetScope;
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* them.
|
|
10
|
+
* The `Wow-Scope` a request at `place` carries: none for the caller's own
|
|
11
|
+
* views, whose owner the server takes from the principal.
|
|
14
12
|
*/
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
state: ViewStateBody;
|
|
19
|
-
}
|
|
20
|
-
/** A system view the server serves (`SystemView`); `scope` is always `system`. */
|
|
21
|
-
export interface SystemViewBody {
|
|
13
|
+
export declare function scopeAt(place: Place): TargetScope | undefined;
|
|
14
|
+
/** A view's snapshot or state as the store reads it: its id, version and state. */
|
|
15
|
+
export interface ViewRecord {
|
|
22
16
|
id: string;
|
|
23
|
-
definitionId: string;
|
|
24
|
-
title: string;
|
|
25
|
-
kind: ViewKind;
|
|
26
|
-
/** A hash of its content, whatever its source. */
|
|
27
|
-
revision: string;
|
|
28
|
-
config: ViewConfig;
|
|
29
|
-
/**
|
|
30
|
-
* `configured` (read-only) or `stored` (a view of `tenant/(platform)/owner/(system)`,
|
|
31
|
-
* written through the view routes); absent from a server before it,
|
|
32
|
-
* which served configured views only.
|
|
33
|
-
*/
|
|
34
|
-
source?: 'configured' | 'stored';
|
|
35
|
-
/** A stored view's aggregate version, which its writes expect. */
|
|
36
|
-
version?: number | null;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Whether the server stores `view` (else it configures it). A stored one
|
|
40
|
-
* carries the port's `stored: true` (D81), the views an `editSystem`
|
|
41
|
-
* permission may write; configured and code system views carry none.
|
|
42
|
-
*/
|
|
43
|
-
export declare function isStored(view: SystemViewBody): boolean;
|
|
44
|
-
/** One owner's preferences in one definition (`ViewPreferencesView`). */
|
|
45
|
-
export interface PreferencesBody {
|
|
46
|
-
definitionId: string;
|
|
47
|
-
order?: string[] | null;
|
|
48
|
-
defaultInstanceId?: string | null;
|
|
49
|
-
autoRun?: boolean | null;
|
|
50
|
-
lastTabs?: Record<string, string> | null;
|
|
51
|
-
/** `0` for preferences never written. */
|
|
52
17
|
version: number;
|
|
18
|
+
state: Pick<ViewState, 'definitionId' | 'title' | 'audience'> & Partial<Pick<ViewState, 'kind' | 'config'>>;
|
|
53
19
|
}
|
|
54
|
-
/** The
|
|
55
|
-
export
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
export declare const SUMMARY_FIELDS: string[];
|
|
61
|
-
/** A snapshot's revision: the aggregate's version, compared as a string. */
|
|
62
|
-
export declare function revisionOf(version: number): string;
|
|
63
|
-
export declare function toInstance(snapshot: ViewSnapshotBody): ViewInstance;
|
|
64
|
-
export declare function toSummary(snapshot: ViewSnapshotBody): ViewInstanceSummary;
|
|
65
|
-
export declare function systemInstance(view: SystemViewBody): ViewInstance;
|
|
66
|
-
export declare function systemSummary(view: SystemViewBody): ViewInstanceSummary;
|
|
67
|
-
/**
|
|
68
|
-
* The port's preferences. A member the server holds as `null` is one never
|
|
69
|
-
* set: `defaultInstanceId` reads as `null`, and `autoRun` and `lastTabs` are
|
|
70
|
-
* left out, as the port's own `emptyPreferences()` leaves them.
|
|
71
|
-
*/
|
|
72
|
-
export declare function toPreferences(body: PreferencesBody): ViewPreferences;
|
|
73
|
-
/** What a preferences write sends: everything but the revision. */
|
|
74
|
-
export declare function preferencesInput(preferences: Omit<ViewPreferences, 'revision'>): Omit<ViewPreferences, 'revision'>;
|
|
75
|
-
/** `preferences` as written at `version`, in the port's shape. */
|
|
76
|
-
export declare function preferencesAt(preferences: Omit<ViewPreferences, 'revision'>, version: number): ViewPreferences;
|
|
77
|
-
/** Whether two preferences say the same, whatever their revisions. */
|
|
78
|
-
export declare function samePreferences(a: Omit<ViewPreferences, 'revision'>, b: Omit<ViewPreferences, 'revision'>): boolean;
|
|
20
|
+
/** The fields a list reads, and of the config only its `kind`, kept apart. */
|
|
21
|
+
export declare const SUMMARY_FIELDS: readonly ["aggregateId", "version", "state.definitionId", "state.title", "state.audience", "state.kind"];
|
|
22
|
+
export declare function toInstance({ id, version, state }: ViewRecord): ViewInstance;
|
|
23
|
+
export declare function toSummary({ id, version, state, }: ViewRecord): ViewInstanceSummary;
|
|
24
|
+
/** The engine's overrides from a stored wording: what is stored, nothing more. */
|
|
25
|
+
export declare function wordingOf(state: Pick<DatasetWordingState, 'title' | 'recordNoun' | 'fields'>): DatasetOverrides;
|
package/dist/wowViewStore.d.ts
CHANGED
|
@@ -1,62 +1,59 @@
|
|
|
1
1
|
import { Fetcher } from '@ahoo-wang/fetcher';
|
|
2
2
|
import { ViewAudience, ViewConfig, ViewInstance, ViewInstanceSummary, ViewPermissions, ViewPreferences, ViewStore, WriteContext } from '@ahoo-wang/wow-view-engine';
|
|
3
|
-
/** How a {@link WowViewStore} reaches the view store. */
|
|
3
|
+
/** How a V10 {@link WowViewStore} reaches the view store service. */
|
|
4
4
|
export interface WowViewStoreOptions {
|
|
5
5
|
/**
|
|
6
6
|
* The fetcher every request goes through, on the base URL that serves
|
|
7
|
-
* `/view-store/…` (the
|
|
8
|
-
*
|
|
7
|
+
* `/view-store/…` (the V10 view store service, or a gateway in front of
|
|
8
|
+
* it).
|
|
9
9
|
*
|
|
10
|
-
* Its interceptors carry who is asking; the store never does.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
16
|
-
*
|
|
17
|
-
*
|
|
10
|
+
* Its interceptors carry who is asking; the store never does. The V10
|
|
11
|
+
* service takes the tenant and the owner from the principal, so no path
|
|
12
|
+
* names them: the interceptors send the authorization (CoSec's token, or
|
|
13
|
+
* the headers the service's own caller resolver reads) and `CoSec-App-Id`,
|
|
14
|
+
* the application every view, preference and wording is kept in. The
|
|
15
|
+
* store adds `Wow-Scope` itself where it acts as a reserved owner: the
|
|
16
|
+
* shared views' `(shared)`, and `(system)` of `(platform)` for stored
|
|
17
|
+
* system views.
|
|
18
18
|
*/
|
|
19
19
|
fetcher: Fetcher;
|
|
20
20
|
/**
|
|
21
|
-
* Which buttons are enabled for one definition's views. The
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* `
|
|
25
|
-
*
|
|
21
|
+
* Which buttons are enabled for one definition's views. The service
|
|
22
|
+
* authorizes each write; a host answers this by the roles it holds there —
|
|
23
|
+
* `changeAudience` and the shared views' writes by the role that writes
|
|
24
|
+
* the owner `(shared)` (`view-store.shared-writer` on the service as
|
|
25
|
+
* shipped), `editSystem` by the one that writes `(system)`. Left out,
|
|
26
|
+
* everything is allowed, as the port reads a store without `permissions`.
|
|
26
27
|
*/
|
|
27
28
|
permissions?: (definitionId: string) => ViewPermissions;
|
|
28
29
|
}
|
|
29
30
|
/**
|
|
30
|
-
* The view engine's `ViewStore` over the
|
|
31
|
-
* Wow repository): saved views and preferences
|
|
32
|
-
*
|
|
31
|
+
* The view engine's `ViewStore` over the **V10** view store service
|
|
32
|
+
* (`platform/view-store` in the Wow repository): saved views and preferences
|
|
33
|
+
* as two Wow V10 aggregates, reached through the clients generated from the
|
|
34
|
+
* service's Manifest (`@ahoo-wang/wow-client`), and the system views
|
|
35
|
+
* through the service's own route.
|
|
33
36
|
*
|
|
34
|
-
* **The owner
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* last saw each one
|
|
39
|
-
* the
|
|
40
|
-
*
|
|
41
|
-
*
|
|
37
|
+
* **The owner is the audience.** A personal view is the caller's own; a
|
|
38
|
+
* shared one belongs to the reserved owner `(shared)`, which the store acts
|
|
39
|
+
* as with `Wow-Scope: owner="(shared)"`; a stored system view to `(system)`
|
|
40
|
+
* of the tenant `(platform)`. The port names a view by id alone, so the
|
|
41
|
+
* store remembers where it last saw each one and looks an unknown id up as
|
|
42
|
+
* the caller, as `(shared)` and among the system views, in that order.
|
|
43
|
+
* Sharing and claiming move a view to the other owner in place, id kept:
|
|
44
|
+
* the store waits for the service's `ViewAudienceSaga` to move it.
|
|
42
45
|
*
|
|
43
|
-
* **Writes** carry the port's `requestId` as `
|
|
44
|
-
* `revision` as `
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* it is now, and a view that turns out to be gone is `NOT_FOUND`.
|
|
46
|
+
* **Writes** carry the port's `requestId` as `Wow-Request-Id` and its
|
|
47
|
+
* `revision` as `If-Match`, and wait for the snapshot. The service
|
|
48
|
+
* deduplicates a request id, creates included, so a retry is answered with
|
|
49
|
+
* the first attempt's outcome; the store answers the view read back at the
|
|
50
|
+
* version that write left (`GET …/{id}/state?version=`). A stale revision
|
|
51
|
+
* is `CONFLICT` carrying the view as it is now.
|
|
50
52
|
*
|
|
51
|
-
* **Errors** are read by
|
|
52
|
-
* HTTP status only for an answer without a code the store knows; a
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* **Creating is not idempotent on the server**, which generates the id. A
|
|
57
|
-
* store remembers the request ids of its own creates (bounded), and a retry
|
|
58
|
-
* of one first asks the replay route whether it landed; a retry sent by
|
|
59
|
-
* another store — another tab, a reload — makes a second view.
|
|
53
|
+
* **Errors** are read by the problem's code onto the port's codes, by the
|
|
54
|
+
* HTTP status only for an answer without a code the store knows; a `404`
|
|
55
|
+
* without a code is a route the service does not serve (`UNSUPPORTED`), and
|
|
56
|
+
* a request that got no answer is `UNAVAILABLE`.
|
|
60
57
|
*/
|
|
61
58
|
export declare class WowViewStore implements ViewStore {
|
|
62
59
|
/**
|
|
@@ -64,164 +61,119 @@ export declare class WowViewStore implements ViewStore {
|
|
|
64
61
|
* listed this full was cut there, which the workbench then says (R2-26).
|
|
65
62
|
*/
|
|
66
63
|
readonly listLimit = 1000;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
/** The host's {@link WowViewStoreOptions.permissions}, when it gave any. */
|
|
65
|
+
readonly permissions?: (definitionId: string) => ViewPermissions;
|
|
66
|
+
private readonly commands;
|
|
67
|
+
private readonly snapshots;
|
|
68
|
+
private readonly states;
|
|
69
|
+
private readonly preferenceCommands;
|
|
70
|
+
private readonly preferenceSnapshots;
|
|
71
|
+
private readonly systemViews;
|
|
72
|
+
/** Where each view was last seen, by id. */
|
|
73
73
|
private readonly places;
|
|
74
74
|
/**
|
|
75
|
-
* The
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
private readonly preferenceAttempts;
|
|
81
|
-
/** The request ids of the creates this store sent, for their retries. */
|
|
82
|
-
private readonly createAttempts;
|
|
83
|
-
/**
|
|
84
|
-
* The system views as last read, by id: a stored one's version at its
|
|
85
|
-
* revision (a hash of its content, while a write expects the version), or
|
|
86
|
-
* `null` for a configured one, which is read-only.
|
|
75
|
+
* The version of each stored system view at each revision the store has
|
|
76
|
+
* seen it at (a hash of its content, while a write expects the version),
|
|
77
|
+
* by `id` and revision; `null` for a configured one, which is read-only.
|
|
78
|
+
* Keeping the old revisions too lets a retry send the version its first
|
|
79
|
+
* attempt expected, which the service then answers as a duplicate.
|
|
87
80
|
*/
|
|
88
|
-
private readonly
|
|
89
|
-
/** The host's {@link WowViewStoreOptions.permissions}, when it gave any. */
|
|
90
|
-
readonly permissions?: (definitionId: string) => ViewPermissions;
|
|
81
|
+
private readonly systemVersions;
|
|
91
82
|
constructor(options: WowViewStoreOptions);
|
|
92
83
|
/**
|
|
93
|
-
* The caller's personal views, the shared views and the
|
|
84
|
+
* The caller's personal views, the shared views and the service's system
|
|
94
85
|
* views of the definition: three requests, sent together, answered in the
|
|
95
|
-
* port's order — system, shared, personal, each oldest first (the
|
|
86
|
+
* port's order — system, shared, personal, each oldest first (the service
|
|
96
87
|
* sorts each audience by the time its first event was written).
|
|
97
|
-
*
|
|
98
|
-
* A server with no view store at all (one released before it) answers
|
|
99
|
-
* every route `404`, where a list on one that has it never does: that is
|
|
100
|
-
* `UNSUPPORTED`, not a missing view.
|
|
101
88
|
*/
|
|
102
89
|
list(definitionId: string, signal?: AbortSignal): Promise<ViewInstanceSummary[]>;
|
|
103
|
-
/** View `id` wherever it is: the caller's, shared, or
|
|
90
|
+
/** View `id` wherever it is: the caller's, shared, or a system view. */
|
|
104
91
|
get(id: string, signal?: AbortSignal): Promise<ViewInstance>;
|
|
105
92
|
/**
|
|
106
|
-
*
|
|
107
|
-
* A retry
|
|
108
|
-
*
|
|
109
|
-
* server itself does not deduplicate, so a retry from another store makes
|
|
110
|
-
* a second view.
|
|
93
|
+
* Creates the view as the owner of its `scope`; the service generates the
|
|
94
|
+
* id. A retry under the same request id is answered with the first
|
|
95
|
+
* attempt's view, whichever store sends it: the service deduplicates it.
|
|
111
96
|
*/
|
|
112
97
|
create(input: Omit<ViewInstance, 'id' | 'revision'>, context: WriteContext): Promise<ViewInstance>;
|
|
113
98
|
/** Replaces the view's config, at the expected `revision`. */
|
|
114
99
|
save(id: string, config: ViewConfig, revision: string, context: WriteContext): Promise<ViewInstance>;
|
|
115
|
-
/** Renames the view (the
|
|
100
|
+
/** Renames the view (the service trims the title), at the expected `revision`. */
|
|
116
101
|
rename(id: string, title: string, revision: string, context: WriteContext): Promise<ViewInstance>;
|
|
117
102
|
/**
|
|
118
|
-
* 设为共享 sends `share`
|
|
119
|
-
*
|
|
120
|
-
* that
|
|
121
|
-
* the
|
|
103
|
+
* 设为共享 sends `share-view` as the caller, the view's owner; 设为个人
|
|
104
|
+
* sends `claim-view` as `(shared)`, which the service admits only with
|
|
105
|
+
* the role that writes the owner `(shared)`, and which makes the caller
|
|
106
|
+
* the owner. Either waits for the move (`ViewAudienceSaga`). Each is sent
|
|
107
|
+
* from the same owner whether or not the view has moved, so a retry is
|
|
108
|
+
* answered as its first attempt's duplicate even after the move.
|
|
122
109
|
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
110
|
+
* Asked for the audience the view already has, the service refuses the
|
|
111
|
+
* command as outside that owner's scope; the store then answers the view
|
|
112
|
+
* as it is, revision unmoved, once the revision matches.
|
|
113
|
+
*
|
|
114
|
+
* A shared view a shared dashboard shows stays shared: the service
|
|
115
|
+
* refuses the claim and names the boards, and the refusal carries them by
|
|
116
|
+
* **title** in `boards`, as they are stored.
|
|
127
117
|
*/
|
|
128
118
|
changeAudience(id: string, audience: ViewAudience, revision: string, context: WriteContext): Promise<ViewInstance>;
|
|
129
119
|
/** Deletes the view, at the expected `revision`; a board showing it keeps a broken panel. */
|
|
130
120
|
delete(id: string, revision: string, context: WriteContext): Promise<void>;
|
|
131
|
-
/**
|
|
121
|
+
/**
|
|
122
|
+
* The caller's preferences of the definition, in the request's
|
|
123
|
+
* application: the service derives their id from the owner, the
|
|
124
|
+
* application and the definition. None written yet reads as the port's
|
|
125
|
+
* empty preferences, at revision `'0'`.
|
|
126
|
+
*/
|
|
132
127
|
getPreferences(definitionId: string, signal?: AbortSignal): Promise<ViewPreferences>;
|
|
133
128
|
/**
|
|
134
129
|
* Writes the preferences at the expected `revision` (`'0'` for ones never
|
|
135
|
-
* written
|
|
136
|
-
*
|
|
137
|
-
* stored when that is what it wrote.
|
|
130
|
+
* written, which `If-Match: "0"` says). A retry under the same request id
|
|
131
|
+
* is answered as the first attempt's duplicate, at its version.
|
|
138
132
|
*/
|
|
139
133
|
setPreferences(definitionId: string, preferences: ViewPreferences, context: WriteContext): Promise<ViewPreferences>;
|
|
140
134
|
/**
|
|
141
135
|
* One instance write: to the place the view is at, then the answer read
|
|
142
136
|
* back. A view remembered at a place it has since left (another tab shared
|
|
143
|
-
* it) is looked up again and the write sent once more
|
|
137
|
+
* it) is looked up again and the write sent once more from where it is.
|
|
138
|
+
* A move refused because the view already has the audience it asks for
|
|
139
|
+
* changes nothing: the view is answered as it is, once its revision
|
|
140
|
+
* matches.
|
|
144
141
|
*/
|
|
145
142
|
private write;
|
|
146
|
-
/** A landed write's answer: the view read back at the version it left. */
|
|
147
|
-
private landed;
|
|
148
|
-
/**
|
|
149
|
-
* The answer of a write the server refused as a stale version, a repeated
|
|
150
|
-
* request id or a missing view, when the refusal is that of a retry: the
|
|
151
|
-
* replay route finds the first attempt by its request id.
|
|
152
|
-
*/
|
|
153
|
-
private replayed;
|
|
154
143
|
/**
|
|
155
|
-
*
|
|
156
|
-
*
|
|
144
|
+
* A landed write's answer: the view read back at the version it left
|
|
145
|
+
* (`GET …/{id}/state?version=`). A system view's revision is its content
|
|
146
|
+
* hash, so it is read from its route as it is now.
|
|
157
147
|
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* A probe that fails other than as "not found" is no answer on its path.
|
|
164
|
-
* With `strict` — a refused write, whose own path is asked first — that
|
|
165
|
-
* path's failure is passed on: whether the first attempt landed is
|
|
166
|
-
* unknown, and a retry under the same request id is safe. The other path
|
|
167
|
-
* (a caller without the shared role is refused there), and every probe of
|
|
168
|
-
* a write that landed, count it as not replayed, and the caller keeps what
|
|
169
|
-
* it knows: the refusal, or the view it read back.
|
|
170
|
-
*/
|
|
171
|
-
private replay;
|
|
172
|
-
/**
|
|
173
|
-
* The replay route at `place` for the context's request id; `undefined`
|
|
174
|
-
* when it knows none, or — not `strict` — when it could not be asked.
|
|
148
|
+
* A move is two commits: the view's own (its audience), then the saga's
|
|
149
|
+
* (its owner). Waited for, the result's version is the second; a
|
|
150
|
+
* duplicate answers the first, so the move is read one version later,
|
|
151
|
+
* where the owner it names must be the one it moved to. Anything else
|
|
152
|
+
* (another writer between the two) answers the view as it is now.
|
|
175
153
|
*/
|
|
176
|
-
private
|
|
154
|
+
private landed;
|
|
155
|
+
/** A move to where the view already is: the view as it is, at `revision`. */
|
|
156
|
+
private unchanged;
|
|
177
157
|
/** A stale write's refusal, carrying the view as it is now. */
|
|
178
158
|
private conflict;
|
|
179
|
-
/**
|
|
180
|
-
* The port's refusal of a write. A claim the server refuses because shared
|
|
181
|
-
* dashboards show the view carries those boards' titles (`boards`), which
|
|
182
|
-
* the server gives beside each board's id (a board it gives no title for
|
|
183
|
-
* is read for one); the engine says the refusal around them.
|
|
184
|
-
*/
|
|
185
|
-
private refusal;
|
|
186
|
-
private boardTitle;
|
|
187
159
|
/**
|
|
188
160
|
* View `id` and where it is: first where it was last seen (`first`, `null`
|
|
189
|
-
* to ignore that), then the
|
|
190
|
-
*
|
|
161
|
+
* to ignore that), then as the caller, as `(shared)` and among the system
|
|
162
|
+
* views.
|
|
191
163
|
*/
|
|
192
164
|
private find;
|
|
193
|
-
/**
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
* before it. Any other failure is no answer to that, and reads as served.
|
|
197
|
-
*/
|
|
198
|
-
private served;
|
|
199
|
-
/** A `404` from a server with no view store is `UNSUPPORTED`; else as it was. */
|
|
200
|
-
private unsupportedOr;
|
|
201
|
-
/** Keeps what a stored system view's writes expect; forgets a configured one. */
|
|
165
|
+
/** The view as it is now at `place`; a `NOT_FOUND` failure when it is not there. */
|
|
166
|
+
private readAt;
|
|
167
|
+
/** Keeps the version of a stored system view at its revision; a configured one as read-only. */
|
|
202
168
|
private rememberSystem;
|
|
203
169
|
/**
|
|
204
170
|
* The version a write of stored system view `id` at `revision` (its
|
|
205
|
-
* content hash) expects: as
|
|
206
|
-
* view is read-only (`FORBIDDEN`; a code one is never
|
|
207
|
-
* revision other than the view's is
|
|
208
|
-
*
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
private
|
|
213
|
-
private json;
|
|
214
|
-
/**
|
|
215
|
-
* The one place a request leaves the store, and so the one place what it
|
|
216
|
-
* threw becomes a {@link Failure}.
|
|
217
|
-
*/
|
|
218
|
-
private send;
|
|
171
|
+
* content hash) expects: as seen at that revision, else as read now. A
|
|
172
|
+
* configured system view is read-only (`FORBIDDEN`; a code one is never
|
|
173
|
+
* found here); a revision other than the view's is `CONFLICT`, carrying
|
|
174
|
+
* the view as it is.
|
|
175
|
+
*/
|
|
176
|
+
private systemVersion;
|
|
177
|
+
/** The options of a command sent from `place`: its scope, request id and signal. */
|
|
178
|
+
private commandOptions;
|
|
219
179
|
}
|
|
220
|
-
/** The headers of a write: its request id, its expected version, the wait. */
|
|
221
|
-
export declare function writeHeaders(context: WriteContext, revision?: string): Record<string, string>;
|
|
222
|
-
/**
|
|
223
|
-
* Runs one of the port's methods, so that everything it rejects with is a
|
|
224
|
-
* `ViewStoreError`: a failed request as its code says, anything else — a
|
|
225
|
-
* body that did not parse — as `UNAVAILABLE`, the outcome unknown.
|
|
226
|
-
*/
|
|
227
|
-
export declare function guard<T>(run: () => Promise<T>): Promise<T>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ahoo-wang/wow-view-store",
|
|
3
|
-
"version": "10.0.0-alpha.
|
|
3
|
+
"version": "10.0.0-alpha.4",
|
|
4
4
|
"description": "The Wow view store as the view engine's ViewStore: saved views and preferences of @ahoo-wang/wow-view-engine on a Wow server (https://github.com/Ahoo-Wang/Wow).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wow",
|
|
@@ -33,11 +33,6 @@
|
|
|
33
33
|
"import": "./dist/index.es.js",
|
|
34
34
|
"default": "./dist/index.es.js"
|
|
35
35
|
},
|
|
36
|
-
"./v10": {
|
|
37
|
-
"types": "./dist/v10/index.d.ts",
|
|
38
|
-
"import": "./dist/v10.es.js",
|
|
39
|
-
"default": "./dist/v10.es.js"
|
|
40
|
-
},
|
|
41
36
|
"./package.json": "./package.json"
|
|
42
37
|
},
|
|
43
38
|
"files": [
|
|
@@ -48,27 +43,26 @@
|
|
|
48
43
|
"sideEffects": false,
|
|
49
44
|
"peerDependencies": {
|
|
50
45
|
"@ahoo-wang/fetcher": "^5.1.5 || ^6.0.0",
|
|
51
|
-
"@ahoo-wang/wow-client": "~10.0.0-alpha.
|
|
52
|
-
"@ahoo-wang/wow-view-engine": "~10.0.0-alpha.
|
|
46
|
+
"@ahoo-wang/wow-client": "~10.0.0-alpha.4",
|
|
47
|
+
"@ahoo-wang/wow-view-engine": "~10.0.0-alpha.4"
|
|
53
48
|
},
|
|
54
49
|
"devDependencies": {
|
|
55
50
|
"@ahoo-wang/fetcher": "^6.0.1",
|
|
56
|
-
"@ahoo-wang/fetcher-decorator": "^6.0.1",
|
|
57
51
|
"@ahoo-wang/fetcher-eventstream": "^6.0.1",
|
|
58
52
|
"@eslint/js": "^10.0.1",
|
|
59
53
|
"@microsoft/api-extractor": "^7.59.4",
|
|
60
54
|
"@types/node": "^26.6.5",
|
|
61
55
|
"@vitest/coverage-v8": "4.1.11",
|
|
62
|
-
"eslint": "^10.
|
|
56
|
+
"eslint": "^10.13.0",
|
|
63
57
|
"globals": "^17.13.0",
|
|
64
58
|
"typescript": "~6.0.3",
|
|
65
59
|
"typescript-eslint": "^8.71.1",
|
|
66
60
|
"unplugin-dts": "1.1.2",
|
|
67
61
|
"vite": "8.3.4",
|
|
68
62
|
"vitest": "^4.1.11",
|
|
69
|
-
"@ahoo-wang/wow-client": "~10.0.0-alpha.
|
|
70
|
-
"@ahoo-wang/wow-
|
|
71
|
-
"@ahoo-wang/wow-
|
|
63
|
+
"@ahoo-wang/wow-client": "~10.0.0-alpha.4",
|
|
64
|
+
"@ahoo-wang/wow-generator": "~10.0.0-alpha.4",
|
|
65
|
+
"@ahoo-wang/wow-view-engine": "~10.0.0-alpha.4"
|
|
72
66
|
},
|
|
73
67
|
"scripts": {
|
|
74
68
|
"build": "vite build && pnpm test:package",
|