@ahoo-wang/wow-view-store 9.8.0 → 10.0.0-alpha.3

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.
Files changed (37) hide show
  1. package/README.md +115 -137
  2. package/README.zh-CN.md +89 -100
  3. package/dist/datasetWordings.d.ts +47 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.es.js +188 -257
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/paths.d.ts +2 -0
  8. package/dist/remembered.d.ts +9 -0
  9. package/dist/remembered.es.js +147 -0
  10. package/dist/remembered.es.js.map +1 -0
  11. package/dist/v10/datasetWordings.d.ts +46 -0
  12. package/dist/v10/errors.d.ts +83 -0
  13. package/dist/v10/generated/index.d.ts +1 -0
  14. package/dist/v10/generated/view-store/boundedContext.d.ts +36 -0
  15. package/dist/v10/generated/view-store/dataset_wording/aggregate.d.ts +17 -0
  16. package/dist/v10/generated/view-store/dataset_wording/commandClient.d.ts +32 -0
  17. package/dist/v10/generated/view-store/dataset_wording/index.d.ts +3 -0
  18. package/dist/v10/generated/view-store/dataset_wording/queryClient.d.ts +18 -0
  19. package/dist/v10/generated/view-store/index.d.ts +5 -0
  20. package/dist/v10/generated/view-store/types.d.ts +167 -0
  21. package/dist/v10/generated/view-store/view/aggregate.d.ts +17 -0
  22. package/dist/v10/generated/view-store/view/commandClient.d.ts +65 -0
  23. package/dist/v10/generated/view-store/view/index.d.ts +3 -0
  24. package/dist/v10/generated/view-store/view/queryClient.d.ts +18 -0
  25. package/dist/v10/generated/view-store/view_preferences/aggregate.d.ts +17 -0
  26. package/dist/v10/generated/view-store/view_preferences/commandClient.d.ts +22 -0
  27. package/dist/v10/generated/view-store/view_preferences/index.d.ts +3 -0
  28. package/dist/v10/generated/view-store/view_preferences/queryClient.d.ts +18 -0
  29. package/dist/v10/index.d.ts +6 -0
  30. package/dist/v10/source.d.ts +46 -0
  31. package/dist/v10/systemViews.d.ts +21 -0
  32. package/dist/v10/wire.d.ts +25 -0
  33. package/dist/v10/wowViewStore.d.ts +179 -0
  34. package/dist/v10.es.js +673 -0
  35. package/dist/v10.es.js.map +1 -0
  36. package/dist/wowViewStore.d.ts +13 -0
  37. package/package.json +12 -6
@@ -0,0 +1,83 @@
1
+ import { WowProblemError } from '@ahoo-wang/wow-client/v10';
2
+ import { ViewStoreError, ViewStoreErrorCode } from '@ahoo-wang/wow-view-engine';
3
+ /**
4
+ * The V10 view store's own problem codes (`ViewStoreRejections` of
5
+ * `platform/view-store`), beside the framework's (`FrameworkErrorCodes` of
6
+ * `@ahoo-wang/wow-client/v10`): generated from the service's Manifest.
7
+ *
8
+ * Named apart from the engine's `ViewStoreErrorCode` (the port's codes):
9
+ * these are the `code` of the server's problems, which a `ViewStoreError`
10
+ * carries as `detail.code`.
11
+ */
12
+ export declare const WowViewStoreErrorCodes: {
13
+ readonly APP_REQUIRED: "view-store.app-required";
14
+ readonly INVALID: "view-store.invalid";
15
+ readonly NOT_FOUND: "view-store.not-found";
16
+ readonly OWNER_REQUIRED: "view-store.owner-required";
17
+ readonly REFERENCED_BY_SHARED_DASHBOARD: "view-store.referenced-by-shared-dashboard";
18
+ readonly SYSTEM_VIEW_READ_ONLY: "view-store.system-view-read-only";
19
+ };
20
+ /**
21
+ * A request that did not succeed, as the store reads it: the server's
22
+ * problem when it answered with one, else what the request threw.
23
+ */
24
+ export declare class Failure {
25
+ /** What the request threw. */
26
+ readonly cause: unknown;
27
+ /** The server's problem, when a response came back. */
28
+ readonly problem?: WowProblemError | undefined;
29
+ constructor(
30
+ /** What the request threw. */
31
+ cause: unknown,
32
+ /** The server's problem, when a response came back. */
33
+ problem?: WowProblemError | undefined);
34
+ /** The problem's code: a framework code (`wow.*`) or the view store's. */
35
+ get problemCode(): string | undefined;
36
+ /**
37
+ * The port's code, **by the problem's code first**: one HTTP status
38
+ * carries several decisions (a `400` is a bad title and a missing
39
+ * application alike). Only an answer without a code the store knows — a
40
+ * gateway's own page, a proxy, a code a later server adds — falls back to
41
+ * the status; a problem the service says a retry may get past is
42
+ * `UNAVAILABLE` whatever its status. A `404` without a code is a route the server does not serve:
43
+ * no view store there (or, on the memory backend, no snapshot query), so
44
+ * `UNSUPPORTED`. No answer at all is `UNAVAILABLE`: the outcome is
45
+ * unknown, and a retry under the same request id is safe, since the
46
+ * server deduplicates it.
47
+ */
48
+ get code(): ViewStoreErrorCode;
49
+ /** Whether the server (or something in front of it) answered at all. */
50
+ get reached(): boolean;
51
+ get message(): string;
52
+ /** The port's error, holding what it was read from. */
53
+ toStoreError(): ViewStoreError;
54
+ /**
55
+ * What {@link toStoreError} holds, for an error of another code: the
56
+ * request's own failure as `cause`, the problem's code as `detail` (a
57
+ * host tells `view-store.app-required` from `view-store.invalid` by it),
58
+ * and for `UNAVAILABLE` whether the server answered (`reachable`).
59
+ */
60
+ held(): {
61
+ cause: unknown;
62
+ detail?: {
63
+ code: string;
64
+ };
65
+ reachable?: true;
66
+ };
67
+ }
68
+ /** What a failed request threw, read as a {@link Failure}. */
69
+ export declare function failureOf(error: unknown): Promise<Failure>;
70
+ /**
71
+ * The titles of the shared dashboards a claim refusal names: the problem's
72
+ * `boards` extension member, a list of `{ id, title }` (decision D211). A
73
+ * board without a title is named by its id; anything else is skipped.
74
+ */
75
+ export declare function boardTitles(extensions: Readonly<Record<string, unknown>> | undefined): string[];
76
+ /**
77
+ * Runs one of the port's methods, so that everything it rejects with is a
78
+ * `ViewStoreError`: a failed request as its code says, anything else — a
79
+ * body that did not parse — as `UNAVAILABLE`, the outcome unknown.
80
+ */
81
+ export declare function guard<T>(run: () => Promise<T>): Promise<T>;
82
+ /** Runs one request, so that what it throws is a {@link Failure}. */
83
+ export declare function request<T>(run: () => Promise<T>): Promise<T>;
@@ -0,0 +1 @@
1
+ export * from './view-store/index.js';
@@ -0,0 +1,36 @@
1
+ import { Hop } from '@ahoo-wang/wow-client/v10';
2
+ /**
3
+ * The bounded context `view-store`.
4
+ * The view engine's saved views, view preferences and dataset wording
5
+ */
6
+ export declare const VIEW_STORE_BOUNDED_CONTEXT = "view-store";
7
+ /** The domain error codes of `view-store`, each a problem's `code` with the status the Manifest gives it. */
8
+ export declare const ViewStoreErrorCodes: {
9
+ /** 400: The request carries no CoSec-App-Id. */
10
+ readonly APP_REQUIRED: "view-store.app-required";
11
+ /** 400: The request is not a valid write: its config, title, preferences or wording. */
12
+ readonly INVALID: "view-store.invalid";
13
+ /** 404: The aggregate belongs to another application, which reads as none. */
14
+ readonly NOT_FOUND: "view-store.not-found";
15
+ /** 400: A view is saved by an owner: a user, (shared), or (system) under (platform). */
16
+ readonly OWNER_REQUIRED: "view-store.owner-required";
17
+ /** 409: A shared dashboard shows the view, which stays shared. */
18
+ readonly REFERENCED_BY_SHARED_DASHBOARD: "view-store.referenced-by-shared-dashboard";
19
+ /** 403: A system view never moves audience: it is neither shared nor claimed. */
20
+ readonly SYSTEM_VIEW_READ_ONLY: "view-store.system-view-read-only";
21
+ };
22
+ /** A {@link ViewStoreErrorCodes} value. */
23
+ export type ViewStoreErrorCode = (typeof ViewStoreErrorCodes)[keyof typeof ViewStoreErrorCodes];
24
+ /** The subscriptions of `view-store` a `handled` hop names. */
25
+ export type ViewStoreSubscription = 'ViewAudienceSaga.onAudienceChanged';
26
+ /** The hops of a wait chain (`Wow-Wait`) in `view-store`. */
27
+ export declare const viewStoreWait: {
28
+ /** Until a command of `view-store` passed admission. */
29
+ readonly accepted: () => Hop;
30
+ /** Until a command's events are appended to the log of `view-store`. */
31
+ readonly committed: () => Hop;
32
+ /** Until the snapshot of `view-store` holds the commit. */
33
+ readonly snapshot: () => Hop;
34
+ /** Until a subscription of `view-store` handled the commit. */
35
+ readonly handled: (subscription: ViewStoreSubscription) => Hop;
36
+ };
@@ -0,0 +1,17 @@
1
+ import { EventView, SystemEvent } from '@ahoo-wang/wow-client/v10';
2
+ import { DatasetWordingCleared, DatasetWordingSet } from '../types.js';
3
+ /**
4
+ * The aggregate `view-store.dataset_wording`.
5
+ * A tenant's wording over one dataset in one application
6
+ */
7
+ export declare const DatasetWordingAggregate: {
8
+ readonly context: "view-store";
9
+ readonly name: "dataset_wording";
10
+ readonly path: "/view-store/dataset_wording";
11
+ readonly ownership: "TENANT";
12
+ readonly snapshot: true;
13
+ };
14
+ /** The `state.*` paths of `dataset_wording`'s snapshots a query filters, sorts and projects on. */
15
+ export type DatasetWordingStateField = 'state.appId' | 'state.dataset' | 'state.fields' | 'state.recordNoun' | 'state.title';
16
+ /** The events of `dataset_wording`, named as the server sends them: `view-store.dataset_wording.<Event>`, and the system events every aggregate has. */
17
+ export type DatasetWordingEvent = EventView<'view-store.dataset_wording.DatasetWordingCleared', DatasetWordingCleared> | EventView<'view-store.dataset_wording.DatasetWordingSet', DatasetWordingSet> | SystemEvent;
@@ -0,0 +1,32 @@
1
+ import { CommandGateway, CommandResult, CommandResultStream, CreateCommandOptions, WowClientOptions } from '@ahoo-wang/wow-client/v10';
2
+ import { ClearDatasetWording, SetDatasetWording } from '../types.js';
3
+ /** The command routes of `view-store.dataset_wording`. */
4
+ export declare const DatasetWordingCommandPaths: {
5
+ readonly CLEAR_DATASET_WORDING: "/view-store/dataset_wording/{id}/clear-dataset-wording";
6
+ readonly CLEAR_DATASET_WORDING_WITHOUT_ID: "/view-store/dataset_wording/clear-dataset-wording";
7
+ readonly SET_DATASET_WORDING: "/view-store/dataset_wording/{id}/set-dataset-wording";
8
+ readonly SET_DATASET_WORDING_WITHOUT_ID: "/view-store/dataset_wording/set-dataset-wording";
9
+ };
10
+ /** Sends the commands of `view-store.dataset_wording`; a command that did not succeed rejects with a `WowProblemError` holding its result. */
11
+ export declare class DatasetWordingCommandClient {
12
+ readonly gateway: CommandGateway;
13
+ /** @param options - How the service is reached */
14
+ constructor(options?: WowClientOptions);
15
+ /**
16
+ * Clear the wording of a dataset
17
+ * `ClearDatasetWording`: `POST /view-store/dataset_wording/{id}/clear-dataset-wording`, `POST /view-store/dataset_wording/clear-dataset-wording`.
18
+ * Produces `DatasetWordingCleared`.
19
+ */
20
+ clearDatasetWording(body: ClearDatasetWording, options?: CreateCommandOptions): Promise<CommandResult>;
21
+ /** `ClearDatasetWording`, answered as one result per hop of its wait (`text/event-stream`). */
22
+ clearDatasetWordingStream(body: ClearDatasetWording, options?: CreateCommandOptions): Promise<CommandResultStream>;
23
+ /**
24
+ * Set the wording of a dataset
25
+ * `SetDatasetWording`: `POST /view-store/dataset_wording/{id}/set-dataset-wording`, `POST /view-store/dataset_wording/set-dataset-wording`.
26
+ * Creates the aggregate, or acts on the one that exists.
27
+ * Produces `DatasetWordingSet`.
28
+ */
29
+ setDatasetWording(body: SetDatasetWording, options?: CreateCommandOptions): Promise<CommandResult>;
30
+ /** `SetDatasetWording`, answered as one result per hop of its wait (`text/event-stream`). */
31
+ setDatasetWordingStream(body: SetDatasetWording, options?: CreateCommandOptions): Promise<CommandResultStream>;
32
+ }
@@ -0,0 +1,3 @@
1
+ export * from './aggregate.js';
2
+ export * from './commandClient.js';
3
+ export * from './queryClient.js';
@@ -0,0 +1,18 @@
1
+ import { EventQueryClient, SnapshotQueryClient, StateClient, WowClientOptions } from '@ahoo-wang/wow-client/v10';
2
+ import { DatasetWordingState } from '../types.js';
3
+ import { DatasetWordingEvent, DatasetWordingStateField } from './aggregate.js';
4
+ /** Queries the snapshots of `view-store.dataset_wording`: `POST /view-store/dataset_wording/snapshot/query`. */
5
+ export declare class DatasetWordingSnapshotQueryClient extends SnapshotQueryClient<DatasetWordingState, DatasetWordingStateField> {
6
+ /** @param options - How the service is reached */
7
+ constructor(options?: WowClientOptions);
8
+ }
9
+ /** Queries the event streams of `view-store.dataset_wording`, one aggregate at a time: `POST /view-store/dataset_wording/events/query`. */
10
+ export declare class DatasetWordingEventQueryClient extends EventQueryClient<DatasetWordingEvent> {
11
+ /** @param options - How the service is reached */
12
+ constructor(options?: WowClientOptions);
13
+ }
14
+ /** Reads the states of `view-store.dataset_wording`, at a version or a time, and their traces: `GET /view-store/dataset_wording/{id}/state`. */
15
+ export declare class DatasetWordingStateClient extends StateClient<DatasetWordingState, DatasetWordingEvent> {
16
+ /** @param options - How the service is reached */
17
+ constructor(options?: WowClientOptions);
18
+ }
@@ -0,0 +1,5 @@
1
+ export * from './boundedContext.js';
2
+ export * from './dataset_wording/index.js';
3
+ export * from './types.js';
4
+ export * from './view/index.js';
5
+ export * from './view_preferences/index.js';
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Gives the aggregate to the owner ownerId.
3
+ * - key: `me.ahoo.wow.api.lifecycle.TransferOwner`
4
+ */
5
+ export interface ApiLifecycleTransferOwner {
6
+ ownerId: string;
7
+ }
8
+ /**
9
+ * Make a shared view personal
10
+ * - key: `me.ahoo.wow.viewstore.api.view.ClaimView`
11
+ */
12
+ export type ClaimView = Record<string, unknown>;
13
+ /**
14
+ * Clear the wording of a dataset
15
+ * - key: `me.ahoo.wow.viewstore.api.wording.ClearDatasetWording`
16
+ */
17
+ export interface ClearDatasetWording {
18
+ dataset: string;
19
+ }
20
+ /**
21
+ * Create a view
22
+ * - key: `me.ahoo.wow.viewstore.api.view.CreateView`
23
+ */
24
+ export interface CreateView {
25
+ config: Record<string, unknown>;
26
+ definitionId: string;
27
+ title: string;
28
+ }
29
+ /**
30
+ * A dataset's wording was cleared
31
+ * - key: `me.ahoo.wow.viewstore.api.wording.DatasetWordingCleared`
32
+ */
33
+ export type DatasetWordingCleared = Record<string, unknown>;
34
+ /**
35
+ * A dataset's wording was set
36
+ * - key: `me.ahoo.wow.viewstore.api.wording.DatasetWordingSet`
37
+ */
38
+ export interface DatasetWordingSet {
39
+ appId: string;
40
+ dataset: string;
41
+ fields?: null | Record<string, unknown>;
42
+ recordNoun?: string | null;
43
+ title?: string | null;
44
+ }
45
+ /** - key: `me.ahoo.wow.viewstore.domain.wording.DatasetWordingState` */
46
+ export interface DatasetWordingState {
47
+ appId: string;
48
+ dataset: string;
49
+ fields?: null | Record<string, unknown>;
50
+ recordNoun?: string | null;
51
+ title?: string | null;
52
+ }
53
+ /**
54
+ * Rename a view
55
+ * - key: `me.ahoo.wow.viewstore.api.view.RenameView`
56
+ */
57
+ export interface RenameView {
58
+ title: string;
59
+ }
60
+ /**
61
+ * Save a view's config
62
+ * - key: `me.ahoo.wow.viewstore.api.view.SaveView`
63
+ */
64
+ export interface SaveView {
65
+ config: Record<string, unknown>;
66
+ }
67
+ /**
68
+ * Set the wording of a dataset
69
+ * - key: `me.ahoo.wow.viewstore.api.wording.SetDatasetWording`
70
+ */
71
+ export interface SetDatasetWording {
72
+ dataset: string;
73
+ fields?: null | Record<string, unknown>;
74
+ recordNoun?: string | null;
75
+ title?: string | null;
76
+ }
77
+ /**
78
+ * Set the view preferences of a definition
79
+ * - key: `me.ahoo.wow.viewstore.api.preferences.SetViewPreferences`
80
+ */
81
+ export interface SetViewPreferences {
82
+ autoRun?: boolean | null;
83
+ defaultInstanceId?: string | null;
84
+ definitionId: string;
85
+ lastTabs?: Record<string, string> | null;
86
+ order?: string[];
87
+ }
88
+ /**
89
+ * Make a view shared
90
+ * - key: `me.ahoo.wow.viewstore.api.view.ShareView`
91
+ */
92
+ export type ShareView = Record<string, unknown>;
93
+ /** - key: `me.ahoo.wow.viewstore.api.ViewAudience` */
94
+ export type ViewAudience = 'personal' | 'shared' | 'system';
95
+ /**
96
+ * A shared view was made personal to toOwnerId, who becomes its owner
97
+ * - key: `me.ahoo.wow.viewstore.api.view.ViewClaimed`
98
+ */
99
+ export interface ViewClaimed {
100
+ toOwnerId: string;
101
+ }
102
+ /**
103
+ * A view was saved
104
+ * - key: `me.ahoo.wow.viewstore.api.view.ViewCreated`
105
+ */
106
+ export interface ViewCreated {
107
+ appId: string;
108
+ audience: ViewAudience;
109
+ config: Record<string, unknown>;
110
+ definitionId: string;
111
+ kind: ViewKind;
112
+ title: string;
113
+ }
114
+ /** - key: `me.ahoo.wow.viewstore.api.ViewKind` */
115
+ export type ViewKind = 'record' | 'analysis' | 'dashboard';
116
+ /**
117
+ * A definition's view preferences were set
118
+ * - key: `me.ahoo.wow.viewstore.api.preferences.ViewPreferencesSet`
119
+ */
120
+ export interface ViewPreferencesSet {
121
+ appId: string;
122
+ autoRun?: boolean | null;
123
+ defaultInstanceId?: string | null;
124
+ definitionId: string;
125
+ lastTabs?: Record<string, string> | null;
126
+ order: string[];
127
+ }
128
+ /** - key: `me.ahoo.wow.viewstore.domain.preferences.ViewPreferencesState` */
129
+ export interface ViewPreferencesState {
130
+ appId: string;
131
+ autoRun?: boolean | null;
132
+ defaultInstanceId?: string | null;
133
+ definitionId: string;
134
+ lastTabs?: Record<string, string> | null;
135
+ order: string[];
136
+ }
137
+ /**
138
+ * A view was renamed
139
+ * - key: `me.ahoo.wow.viewstore.api.view.ViewRenamed`
140
+ */
141
+ export interface ViewRenamed {
142
+ title: string;
143
+ }
144
+ /**
145
+ * A view's config was overwritten
146
+ * - key: `me.ahoo.wow.viewstore.api.view.ViewSaved`
147
+ */
148
+ export interface ViewSaved {
149
+ config: Record<string, unknown>;
150
+ kind: ViewKind;
151
+ }
152
+ /**
153
+ * A view was made shared; its owner becomes (shared)
154
+ * - key: `me.ahoo.wow.viewstore.api.view.ViewShared`
155
+ */
156
+ export type ViewShared = Record<string, unknown>;
157
+ /** - key: `me.ahoo.wow.viewstore.domain.view.ViewState` */
158
+ export interface ViewState {
159
+ appId: string;
160
+ audience: ViewAudience;
161
+ config: Record<string, unknown>;
162
+ definitionId: string;
163
+ kind: ViewKind;
164
+ title: string;
165
+ }
166
+ /** - key: `wow.lifecycle.TransferOwner` */
167
+ export type WowLifecycleTransferOwner = ApiLifecycleTransferOwner;
@@ -0,0 +1,17 @@
1
+ import { EventView, SystemEvent } from '@ahoo-wang/wow-client/v10';
2
+ import { ViewClaimed, ViewCreated, ViewRenamed, ViewSaved, ViewShared } from '../types.js';
3
+ /**
4
+ * The aggregate `view-store.view`.
5
+ * A saved view of the view engine: a record view, an analysis view or a dashboard
6
+ */
7
+ export declare const ViewAggregate: {
8
+ readonly context: "view-store";
9
+ readonly name: "view";
10
+ readonly path: "/view-store/view";
11
+ readonly ownership: "OWNER";
12
+ readonly snapshot: true;
13
+ };
14
+ /** The `state.*` paths of `view`'s snapshots a query filters, sorts and projects on. */
15
+ export type ViewStateField = 'state.appId' | 'state.audience' | 'state.config' | 'state.definitionId' | 'state.kind' | 'state.title';
16
+ /** The events of `view`, named as the server sends them: `view-store.view.<Event>`, and the system events every aggregate has. */
17
+ export type ViewEvent = EventView<'view-store.view.ViewClaimed', ViewClaimed> | EventView<'view-store.view.ViewCreated', ViewCreated> | EventView<'view-store.view.ViewRenamed', ViewRenamed> | EventView<'view-store.view.ViewSaved', ViewSaved> | EventView<'view-store.view.ViewShared', ViewShared> | SystemEvent;
@@ -0,0 +1,65 @@
1
+ import { CommandGateway, CommandOptions, CommandResult, CommandResultStream, CreateCommandOptions, WowClientOptions } from '@ahoo-wang/wow-client/v10';
2
+ import { ClaimView, CreateView, RenameView, SaveView, ShareView, WowLifecycleTransferOwner } from '../types.js';
3
+ /** The command routes of `view-store.view`. */
4
+ export declare const ViewCommandPaths: {
5
+ readonly CLAIM_VIEW: "/view-store/view/{id}/claim-view";
6
+ readonly CREATE_VIEW: "/view-store/view/{id}/create-view";
7
+ readonly CREATE_VIEW_WITHOUT_ID: "/view-store/view/create-view";
8
+ readonly RENAME_VIEW: "/view-store/view/{id}/rename-view";
9
+ readonly SAVE_VIEW: "/view-store/view/{id}/save-view";
10
+ readonly SHARE_VIEW: "/view-store/view/{id}/share-view";
11
+ };
12
+ /** Sends the commands of `view-store.view`; a command that did not succeed rejects with a `WowProblemError` holding its result. */
13
+ export declare class ViewCommandClient {
14
+ readonly gateway: CommandGateway;
15
+ /** @param options - How the service is reached */
16
+ constructor(options?: WowClientOptions);
17
+ /**
18
+ * Make a shared view personal
19
+ * `ClaimView`: `POST /view-store/view/{id}/claim-view`.
20
+ * Produces `ViewClaimed`.
21
+ */
22
+ claimView(id: string, body?: ClaimView, options?: CommandOptions): Promise<CommandResult>;
23
+ /** `ClaimView`, answered as one result per hop of its wait (`text/event-stream`). */
24
+ claimViewStream(id: string, body?: ClaimView, options?: CommandOptions): Promise<CommandResultStream>;
25
+ /**
26
+ * Create a view
27
+ * `CreateView`: `POST /view-store/view/{id}/create-view`, `POST /view-store/view/create-view`.
28
+ * Creates the aggregate.
29
+ * Produces `ViewCreated`.
30
+ */
31
+ createView(body: CreateView, options?: CreateCommandOptions): Promise<CommandResult>;
32
+ /** `CreateView`, answered as one result per hop of its wait (`text/event-stream`). */
33
+ createViewStream(body: CreateView, options?: CreateCommandOptions): Promise<CommandResultStream>;
34
+ /**
35
+ * Rename a view
36
+ * `RenameView`: `POST /view-store/view/{id}/rename-view`.
37
+ * Produces `ViewRenamed`.
38
+ */
39
+ renameView(id: string, body: RenameView, options?: CommandOptions): Promise<CommandResult>;
40
+ /** `RenameView`, answered as one result per hop of its wait (`text/event-stream`). */
41
+ renameViewStream(id: string, body: RenameView, options?: CommandOptions): Promise<CommandResultStream>;
42
+ /**
43
+ * Save a view's config
44
+ * `SaveView`: `POST /view-store/view/{id}/save-view`.
45
+ * Produces `ViewSaved`.
46
+ */
47
+ saveView(id: string, body: SaveView, options?: CommandOptions): Promise<CommandResult>;
48
+ /** `SaveView`, answered as one result per hop of its wait (`text/event-stream`). */
49
+ saveViewStream(id: string, body: SaveView, options?: CommandOptions): Promise<CommandResultStream>;
50
+ /**
51
+ * Make a view shared
52
+ * `ShareView`: `POST /view-store/view/{id}/share-view`.
53
+ * Produces `ViewShared`.
54
+ */
55
+ shareView(id: string, body?: ShareView, options?: CommandOptions): Promise<CommandResult>;
56
+ /** `ShareView`, answered as one result per hop of its wait (`text/event-stream`). */
57
+ shareViewStream(id: string, body?: ShareView, options?: CommandOptions): Promise<CommandResultStream>;
58
+ /**
59
+ * Marks the aggregate deleted; its events stay in the log.
60
+ * The lifecycle command `wow.lifecycle.DeleteAggregate`.
61
+ */
62
+ deleteAggregate(id: string, options?: CommandOptions): Promise<CommandResult>;
63
+ /** The lifecycle command `wow.lifecycle.TransferOwner`. */
64
+ transferOwner(id: string, body: WowLifecycleTransferOwner, options?: CommandOptions): Promise<CommandResult>;
65
+ }
@@ -0,0 +1,3 @@
1
+ export * from './aggregate.js';
2
+ export * from './commandClient.js';
3
+ export * from './queryClient.js';
@@ -0,0 +1,18 @@
1
+ import { EventQueryClient, SnapshotQueryClient, StateClient, WowClientOptions } from '@ahoo-wang/wow-client/v10';
2
+ import { ViewState } from '../types.js';
3
+ import { ViewEvent, ViewStateField } from './aggregate.js';
4
+ /** Queries the snapshots of `view-store.view`: `POST /view-store/view/snapshot/query`. */
5
+ export declare class ViewSnapshotQueryClient extends SnapshotQueryClient<ViewState, ViewStateField> {
6
+ /** @param options - How the service is reached */
7
+ constructor(options?: WowClientOptions);
8
+ }
9
+ /** Queries the event streams of `view-store.view`, one aggregate at a time: `POST /view-store/view/events/query`. */
10
+ export declare class ViewEventQueryClient extends EventQueryClient<ViewEvent> {
11
+ /** @param options - How the service is reached */
12
+ constructor(options?: WowClientOptions);
13
+ }
14
+ /** Reads the states of `view-store.view`, at a version or a time, and their traces: `GET /view-store/view/{id}/state`. */
15
+ export declare class ViewStateClient extends StateClient<ViewState, ViewEvent> {
16
+ /** @param options - How the service is reached */
17
+ constructor(options?: WowClientOptions);
18
+ }
@@ -0,0 +1,17 @@
1
+ import { EventView, SystemEvent } from '@ahoo-wang/wow-client/v10';
2
+ import { ViewPreferencesSet } from '../types.js';
3
+ /**
4
+ * The aggregate `view-store.view_preferences`.
5
+ * One owner's view preferences for one definition in one application
6
+ */
7
+ export declare const ViewPreferencesAggregate: {
8
+ readonly context: "view-store";
9
+ readonly name: "view_preferences";
10
+ readonly path: "/view-store/view_preferences";
11
+ readonly ownership: "OWNER";
12
+ readonly snapshot: true;
13
+ };
14
+ /** The `state.*` paths of `view_preferences`'s snapshots a query filters, sorts and projects on. */
15
+ export type ViewPreferencesStateField = 'state.appId' | 'state.autoRun' | 'state.defaultInstanceId' | 'state.definitionId' | 'state.lastTabs' | 'state.order';
16
+ /** The events of `view_preferences`, named as the server sends them: `view-store.view_preferences.<Event>`, and the system events every aggregate has. */
17
+ export type ViewPreferencesEvent = EventView<'view-store.view_preferences.ViewPreferencesSet', ViewPreferencesSet> | SystemEvent;
@@ -0,0 +1,22 @@
1
+ import { CommandGateway, CommandResult, CommandResultStream, CreateCommandOptions, WowClientOptions } from '@ahoo-wang/wow-client/v10';
2
+ import { SetViewPreferences } from '../types.js';
3
+ /** The command routes of `view-store.view_preferences`. */
4
+ export declare const ViewPreferencesCommandPaths: {
5
+ readonly SET_VIEW_PREFERENCES: "/view-store/view_preferences/{id}/set-view-preferences";
6
+ readonly SET_VIEW_PREFERENCES_WITHOUT_ID: "/view-store/view_preferences/set-view-preferences";
7
+ };
8
+ /** Sends the commands of `view-store.view_preferences`; a command that did not succeed rejects with a `WowProblemError` holding its result. */
9
+ export declare class ViewPreferencesCommandClient {
10
+ readonly gateway: CommandGateway;
11
+ /** @param options - How the service is reached */
12
+ constructor(options?: WowClientOptions);
13
+ /**
14
+ * Set the view preferences of a definition
15
+ * `SetViewPreferences`: `POST /view-store/view_preferences/{id}/set-view-preferences`, `POST /view-store/view_preferences/set-view-preferences`.
16
+ * Creates the aggregate, or acts on the one that exists.
17
+ * Produces `ViewPreferencesSet`.
18
+ */
19
+ setViewPreferences(body: SetViewPreferences, options?: CreateCommandOptions): Promise<CommandResult>;
20
+ /** `SetViewPreferences`, answered as one result per hop of its wait (`text/event-stream`). */
21
+ setViewPreferencesStream(body: SetViewPreferences, options?: CreateCommandOptions): Promise<CommandResultStream>;
22
+ }
@@ -0,0 +1,3 @@
1
+ export * from './aggregate.js';
2
+ export * from './commandClient.js';
3
+ export * from './queryClient.js';
@@ -0,0 +1,18 @@
1
+ import { EventQueryClient, SnapshotQueryClient, StateClient, WowClientOptions } from '@ahoo-wang/wow-client/v10';
2
+ import { ViewPreferencesState } from '../types.js';
3
+ import { ViewPreferencesEvent, ViewPreferencesStateField } from './aggregate.js';
4
+ /** Queries the snapshots of `view-store.view_preferences`: `POST /view-store/view_preferences/snapshot/query`. */
5
+ export declare class ViewPreferencesSnapshotQueryClient extends SnapshotQueryClient<ViewPreferencesState, ViewPreferencesStateField> {
6
+ /** @param options - How the service is reached */
7
+ constructor(options?: WowClientOptions);
8
+ }
9
+ /** Queries the event streams of `view-store.view_preferences`, one aggregate at a time: `POST /view-store/view_preferences/events/query`. */
10
+ export declare class ViewPreferencesEventQueryClient extends EventQueryClient<ViewPreferencesEvent> {
11
+ /** @param options - How the service is reached */
12
+ constructor(options?: WowClientOptions);
13
+ }
14
+ /** Reads the states of `view-store.view_preferences`, at a version or a time, and their traces: `GET /view-store/view_preferences/{id}/state`. */
15
+ export declare class ViewPreferencesStateClient extends StateClient<ViewPreferencesState, ViewPreferencesEvent> {
16
+ /** @param options - How the service is reached */
17
+ constructor(options?: WowClientOptions);
18
+ }
@@ -0,0 +1,6 @@
1
+ export { WowViewStore, type WowViewStoreOptions } from './wowViewStore.js';
2
+ export { WowDatasetWordings, type WowDatasetWordingsOptions, } from './datasetWordings.js';
3
+ export { WowViewStoreErrorCodes } from './errors.js';
4
+ export { SHARED_SCOPE, SYSTEM_SCOPE } from './wire.js';
5
+ export { datasetCatalogOf, viewSourceOf } from './source.js';
6
+ export { SHARED_OWNER_ID, SYSTEM_OWNER_ID, SYSTEM_TENANT_ID, } from '../paths.js';
@@ -0,0 +1,46 @@
1
+ import { DatasetClient, QueryModelClient } from '@ahoo-wang/wow-client/v10';
2
+ import { DatasetCatalog, ViewSource } from '@ahoo-wang/wow-view-engine';
3
+ /**
4
+ * The view engine's `ViewSource` over one query route of a Wow **V10**
5
+ * service: a generated `…SnapshotQueryClient`, a `QueryModelClient`, or a
6
+ * dataset's (`DatasetClient.dataset(…)`). The engine's port was cut after
7
+ * the 9.x `QueryApi`, which a V10 client is not: its operations take
8
+ * request options rather than an `AbortController`, its page carries
9
+ * whether the total is exact, and its descriptor read answers the version
10
+ * apart. This is the whole adapter.
11
+ *
12
+ * A page counts its total as the service does by default, `BOUNDED`
13
+ * (D150): exact up to the budget's limit, and the limit itself past it. A
14
+ * V10 service refuses an exact total over HTTP, so the engine, which reads
15
+ * the total as the count of matches, shows a count past the limit as the
16
+ * limit (an engine follow-up: say "at least"). The engine's `attributes`
17
+ * have no counterpart on a V10 request and are not sent.
18
+ *
19
+ * ```ts
20
+ * const engine = new ViewEngine({
21
+ * store: new WowViewStore({ fetcher }),
22
+ * resources: [
23
+ * { definition: orders, source: viewSourceOf(new OrderSnapshotQueryClient({ fetcher })) },
24
+ * ],
25
+ * });
26
+ * ```
27
+ */
28
+ export declare function viewSourceOf<F extends string>(client: QueryModelClient<object, F>): ViewSource;
29
+ /**
30
+ * What a `DatasetCatalog` reads of a Wow **V10** service's datasets: the
31
+ * directory (`GET /wow/dataset`) and each dataset's query route as a
32
+ * `ViewSource` ({@link viewSourceOf}). A host spreads it into the catalog it
33
+ * hands `DatasetResources`, beside its own `overrides` and `wordings`:
34
+ *
35
+ * ```ts
36
+ * const datasets = new DatasetClient({ fetcher });
37
+ * new DatasetResources(engine, {
38
+ * ...datasetCatalogOf(datasets),
39
+ * wordings: new WowDatasetWordings({ fetcher }),
40
+ * });
41
+ * ```
42
+ *
43
+ * A V10 directory entry names no version: a dataset is told changed by its
44
+ * descriptor's version, which the engine checks on its own schedule.
45
+ */
46
+ export declare function datasetCatalogOf(client: DatasetClient): Pick<DatasetCatalog, 'list' | 'source'>;
@@ -0,0 +1,21 @@
1
+ import { Fetcher } from '@ahoo-wang/fetcher';
2
+ import { SystemViewBody } from '../wire.js';
3
+ /**
4
+ * The system views route, `GET /view-store/system-views[/{id}]`: the
5
+ * service's own route, ordered before Wow's and outside the Manifest, so no
6
+ * client is generated for it. It answers the configured system views of the
7
+ * caller's tenant and application and the stored ones, in the 9.x
8
+ * `SystemView` shape; the tenant is the principal's, the application the
9
+ * request's `CoSec-App-Id`.
10
+ */
11
+ export declare const SYSTEM_VIEWS_PATH = "/view-store/system-views";
12
+ /** The system views route, through the store's fetcher. */
13
+ export declare class SystemViewsClient {
14
+ private readonly fetcher;
15
+ constructor(fetcher: Fetcher);
16
+ /** The definition's system views: the configured ones first, in their order. */
17
+ list(definitionId: string, signal?: AbortSignal): Promise<SystemViewBody[]>;
18
+ /** One system view; `404 view-store.not-found` for none. */
19
+ one(id: string, signal?: AbortSignal): Promise<SystemViewBody>;
20
+ private get;
21
+ }