@ahoo-wang/wow-view-store 10.0.0-alpha.5 → 10.0.0-alpha.7

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 CHANGED
@@ -29,9 +29,9 @@ later.
29
29
  `WowViewStore` takes a fetcher and, optionally, the permissions that drive the
30
30
  buttons. It takes no tenant, user or application: the service takes them from
31
31
  the principal, which the fetcher's interceptors carry as they do for every
32
- other Wow request of the host. `viewSourceOf` puts a definition on a query
33
- route, `datasetCatalogOf` the service's datasets, and `WowDatasetWordings`
34
- keeps the tenant's wording over them.
32
+ other Wow request of the host. A definition's source is the query route's
33
+ client itself, `datasetCatalogOf` lists the service's datasets, and
34
+ `WowDatasetWordings` keeps the tenant's wording over them.
35
35
 
36
36
  <!-- typecheck-context
37
37
  import type { ViewDefinition, ViewPermissions } from '@ahoo-wang/wow-view-engine';
@@ -47,7 +47,6 @@ import {
47
47
  WowDatasetWordings,
48
48
  WowViewStore,
49
49
  datasetCatalogOf,
50
- viewSourceOf,
51
50
  } from '@ahoo-wang/wow-view-store';
52
51
 
53
52
  // The fetcher's interceptors send the authorization and `CoSec-App-Id`; no
@@ -59,12 +58,10 @@ const engine = new ViewEngine({
59
58
  resources: [
60
59
  {
61
60
  definition: orders,
62
- // Any query route: a generated `…SnapshotQueryClient` fits too.
63
- source: viewSourceOf(
64
- new SnapshotQueryClient(
65
- { context: 'sales', name: 'order' },
66
- { fetcher },
67
- ),
61
+ // Any query route's client is a source: a generated `…SnapshotQueryClient` too.
62
+ source: new SnapshotQueryClient(
63
+ { context: 'sales', name: 'order' },
64
+ { fetcher },
68
65
  ),
69
66
  },
70
67
  ],
@@ -72,8 +69,10 @@ const engine = new ViewEngine({
72
69
 
73
70
  // The service's datasets (`GET /wow/dataset`), worded by the tenant.
74
71
  const datasets = new DatasetResources(engine, {
75
- ...datasetCatalogOf(new DatasetClient({ fetcher })),
76
- wordings: new WowDatasetWordings({ fetcher }),
72
+ catalogs: {
73
+ ...datasetCatalogOf(new DatasetClient({ fetcher })),
74
+ wordings: new WowDatasetWordings({ fetcher }),
75
+ },
77
76
  });
78
77
  await datasets.refresh();
79
78
  ```
package/README.zh-CN.md CHANGED
@@ -18,8 +18,8 @@ peer,由宿主一并安装:`@ahoo-wang/fetcher-eventstream`(wow-client 的
18
18
  `react`、`react-dom`、`react-router` 与 `mingo`。Node `>=22.12.0` 或当前的浏览器;TypeScript 6 或更高。
19
19
 
20
20
  `WowViewStore` 接收一个 fetcher,以及可选的、决定按钮的权限。它不接收租户、用户或应用:服务从主体
21
- (principal)取得它们,fetcher 的拦截器像宿主的其他 Wow 请求一样带上它们。`viewSourceOf` 把一个定义放到
22
- 查询路由上,`datasetCatalogOf` 放上服务的数据集,`WowDatasetWordings` 保存租户对它们的措辞。
21
+ (principal)取得它们,fetcher 的拦截器像宿主的其他 Wow 请求一样带上它们。定义的数据源就是查询路由的
22
+ 客户端本身,`datasetCatalogOf` 列出服务的数据集,`WowDatasetWordings` 保存租户对它们的措辞。
23
23
 
24
24
  <!-- typecheck-context
25
25
  import type { ViewDefinition, ViewPermissions } from '@ahoo-wang/wow-view-engine';
@@ -35,7 +35,6 @@ import {
35
35
  WowDatasetWordings,
36
36
  WowViewStore,
37
37
  datasetCatalogOf,
38
- viewSourceOf,
39
38
  } from '@ahoo-wang/wow-view-store';
40
39
 
41
40
  // fetcher 的拦截器带上授权与 `CoSec-App-Id`;路径里不出现租户与 owner。
@@ -46,12 +45,10 @@ const engine = new ViewEngine({
46
45
  resources: [
47
46
  {
48
47
  definition: orders,
49
- // 任何查询路由都可以:生成的 `…SnapshotQueryClient` 同样适用。
50
- source: viewSourceOf(
51
- new SnapshotQueryClient(
52
- { context: 'sales', name: 'order' },
53
- { fetcher },
54
- ),
48
+ // 任何查询路由的客户端都是数据源:生成的 `…SnapshotQueryClient` 同样如此。
49
+ source: new SnapshotQueryClient(
50
+ { context: 'sales', name: 'order' },
51
+ { fetcher },
55
52
  ),
56
53
  },
57
54
  ],
@@ -59,8 +56,10 @@ const engine = new ViewEngine({
59
56
 
60
57
  // 服务的数据集(`GET /wow/dataset`),按租户的措辞注册。
61
58
  const datasets = new DatasetResources(engine, {
62
- ...datasetCatalogOf(new DatasetClient({ fetcher })),
63
- wordings: new WowDatasetWordings({ fetcher }),
59
+ catalogs: {
60
+ ...datasetCatalogOf(new DatasetClient({ fetcher })),
61
+ wordings: new WowDatasetWordings({ fetcher }),
62
+ },
64
63
  });
65
64
  await datasets.refresh();
66
65
  ```
@@ -1,5 +1,5 @@
1
1
  import { Fetcher } from '@ahoo-wang/fetcher';
2
- import { DatasetOverrides, DatasetWordingStore, StoredDatasetWording, WriteContext } from '@ahoo-wang/wow-view-engine';
2
+ import { DatasetOverrides, DatasetWordingStore, StoredDatasetWording, ReadOptions, WriteOptions } from '@ahoo-wang/wow-view-engine';
3
3
  /** How a V10 {@link WowDatasetWordings} reaches the view store service: as a V10 `WowViewStore` does. */
4
4
  export interface WowDatasetWordingsOptions {
5
5
  /**
@@ -12,7 +12,7 @@ export interface WowDatasetWordingsOptions {
12
12
  }
13
13
  /**
14
14
  * The wording a tenant's administrators keep over its datasets in the V10
15
- * view store (view engine D86): one per dataset of the caller's tenant and
15
+ * view store: one per dataset of the caller's tenant and
16
16
  * application, the id derived by the service from the two. Every reader of
17
17
  * the tenant reads it; the service decides who writes it (the role that
18
18
  * writes the owner `(shared)`, `view-store.shared-writer` as shipped).
@@ -31,16 +31,16 @@ export declare class WowDatasetWordings implements DatasetWordingStore {
31
31
  * dataset. A cleared one is listed too, saying nothing: its revision is
32
32
  * what the next write expects.
33
33
  */
34
- list(signal?: AbortSignal): Promise<ReadonlyMap<string, StoredDatasetWording>>;
34
+ list({ signal }?: ReadOptions): Promise<ReadonlyMap<string, StoredDatasetWording>>;
35
35
  /**
36
36
  * Writes a dataset's wording at the expected `revision` (`'0'` for one never
37
37
  * written), whole: what it leaves out is no longer said. Answers the new
38
38
  * revision.
39
39
  */
40
- set(dataset: string, wording: DatasetOverrides, revision: string, context: WriteContext): Promise<string>;
40
+ set(dataset: string, wording: DatasetOverrides, revision: string, context: WriteOptions): Promise<string>;
41
41
  /**
42
42
  * Clears a dataset's wording at the expected `revision`: its derived words
43
43
  * stand again. Answers the new revision.
44
44
  */
45
- clear(dataset: string, revision: string, context: WriteContext): Promise<string>;
45
+ clear(dataset: string, revision: string, context: WriteOptions): Promise<string>;
46
46
  }
package/dist/errors.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { WowProblemError } from '@ahoo-wang/wow-client';
1
+ import { CommandRejectedError, WowProblemError } from '@ahoo-wang/wow-client';
2
2
  import { ViewStoreError, ViewStoreErrorCode } from '@ahoo-wang/wow-view-engine';
3
3
  /**
4
4
  * The V10 view store's own problem codes (`ViewStoreRejections` of
@@ -17,6 +17,8 @@ export declare const WowViewStoreErrorCodes: {
17
17
  readonly REFERENCED_BY_SHARED_DASHBOARD: "view-store.referenced-by-shared-dashboard";
18
18
  readonly SYSTEM_VIEW_READ_ONLY: "view-store.system-view-read-only";
19
19
  };
20
+ /** One of {@link WowViewStoreErrorCodes}: a problem code the server answers. */
21
+ export type WowViewStoreErrorCode = (typeof WowViewStoreErrorCodes)[keyof typeof WowViewStoreErrorCodes];
20
22
  /**
21
23
  * A request that did not succeed, as the store reads it: the server's
22
24
  * problem when it answered with one, else what the request threw.
@@ -26,12 +28,16 @@ export declare class Failure {
26
28
  readonly cause: unknown;
27
29
  /** The server's problem, when a response came back. */
28
30
  readonly problem?: WowProblemError | undefined;
31
+ /** The command's rejection, when its result came back rejected without a problem. */
32
+ readonly rejection?: CommandRejectedError | undefined;
29
33
  constructor(
30
34
  /** What the request threw. */
31
35
  cause: unknown,
32
36
  /** 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. */
37
+ problem?: WowProblemError | undefined,
38
+ /** The command's rejection, when its result came back rejected without a problem. */
39
+ rejection?: CommandRejectedError | undefined);
40
+ /** The problem's code, or the rejection's: a framework code (`wow.*`) or the view store's. */
35
41
  get problemCode(): string | undefined;
36
42
  /**
37
43
  * The port's code, **by the problem's code first**: one HTTP status
@@ -69,7 +75,7 @@ export declare class Failure {
69
75
  export declare function failureOf(error: unknown): Promise<Failure>;
70
76
  /**
71
77
  * 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
78
+ * `boards` extension member, a list of `{ id, title }`. A
73
79
  * board without a title is named by its id; anything else is skipped.
74
80
  */
75
81
  export declare function boardTitles(extensions: Readonly<Record<string, unknown>> | undefined): string[];
@@ -0,0 +1,38 @@
1
+ import { CommandClient, WowClientOptions } from '@ahoo-wang/wow-client';
2
+ import { DatasetWordingCommandClient } from './dataset_wording/commandClient.js';
3
+ import { DatasetWordingEventQueryClient, DatasetWordingSnapshotQueryClient, DatasetWordingStateClient } from './dataset_wording/queryClient.js';
4
+ import { ViewStoreRoutes } from './routes.js';
5
+ import { ViewCommandClient } from './view/commandClient.js';
6
+ import { ViewEventQueryClient, ViewSnapshotQueryClient, ViewStateClient } from './view/queryClient.js';
7
+ import { ViewPreferencesCommandClient } from './view_preferences/commandClient.js';
8
+ import { ViewPreferencesEventQueryClient, ViewPreferencesSnapshotQueryClient, ViewPreferencesStateClient } from './view_preferences/queryClient.js';
9
+ /** The clients of `view-store`: its command client, per aggregate its command, query and state clients, and its service routes. */
10
+ export declare class ViewStoreClient {
11
+ /** Sends any command of the service, by its Manifest's routes: `send`, `wait` and `stream`. */
12
+ readonly commands: CommandClient;
13
+ /** The clients of `view-store.dataset_wording`. */
14
+ readonly datasetWording: {
15
+ readonly commands: DatasetWordingCommandClient;
16
+ readonly snapshots: DatasetWordingSnapshotQueryClient;
17
+ readonly events: DatasetWordingEventQueryClient;
18
+ readonly state: DatasetWordingStateClient;
19
+ };
20
+ /** The clients of `view-store.view`. */
21
+ readonly view: {
22
+ readonly commands: ViewCommandClient;
23
+ readonly snapshots: ViewSnapshotQueryClient;
24
+ readonly events: ViewEventQueryClient;
25
+ readonly state: ViewStateClient;
26
+ };
27
+ /** The clients of `view-store.view_preferences`. */
28
+ readonly viewPreferences: {
29
+ readonly commands: ViewPreferencesCommandClient;
30
+ readonly snapshots: ViewPreferencesSnapshotQueryClient;
31
+ readonly events: ViewPreferencesEventQueryClient;
32
+ readonly state: ViewPreferencesStateClient;
33
+ };
34
+ /** The service routes of `view-store`. */
35
+ readonly routes: ViewStoreRoutes;
36
+ /** @param options - How the service is reached */
37
+ constructor(options?: WowClientOptions);
38
+ }
@@ -0,0 +1,58 @@
1
+ import { Hop } from '@ahoo-wang/wow-client';
2
+ /**
3
+ * The bounded context `view-store`: its name, its error codes and its aggregates, as the Kotlin `ViewStoreContract` names them. A problem's `code` is one of its `Errors`, or of an aggregate's.
4
+ * The view engine's saved views, view preferences and dataset wording
5
+ */
6
+ export declare const ViewStoreContract: {
7
+ readonly NAME: "view-store";
8
+ readonly Errors: {
9
+ /** 400: The request's CoSec scope has no application (behind the CoSec gateway, the one it forwarded). */
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
+ readonly DatasetWording: {
23
+ readonly context: "view-store";
24
+ readonly name: "dataset_wording";
25
+ readonly path: "/view-store/dataset_wording";
26
+ readonly ownership: "tenant";
27
+ readonly snapshot: true;
28
+ };
29
+ readonly View: {
30
+ readonly context: "view-store";
31
+ readonly name: "view";
32
+ readonly path: "/view-store/view";
33
+ readonly ownership: "owner";
34
+ readonly snapshot: true;
35
+ };
36
+ readonly ViewPreferences: {
37
+ readonly context: "view-store";
38
+ readonly name: "view_preferences";
39
+ readonly path: "/view-store/view_preferences";
40
+ readonly ownership: "owner";
41
+ readonly snapshot: true;
42
+ };
43
+ };
44
+ /** An error code of `view-store`, of the context or of one of its aggregates. */
45
+ export type ViewStoreErrorCode = 'view-store.app-required' | 'view-store.invalid' | 'view-store.not-found' | 'view-store.owner-required' | 'view-store.referenced-by-shared-dashboard' | 'view-store.system-view-read-only';
46
+ /** The subscriptions of `view-store` a `handled` hop names. */
47
+ export type ViewStoreSubscription = 'ViewAudienceSaga.onAudienceChanged';
48
+ /** The hops of a wait chain (`Wow-Wait`) in `view-store`. */
49
+ export declare const viewStoreWait: {
50
+ /** Until a command of `view-store` passed admission. */
51
+ readonly accepted: () => Hop;
52
+ /** Until a command's events are appended to the log of `view-store`. */
53
+ readonly committed: () => Hop;
54
+ /** Until the snapshot of `view-store` holds the commit. */
55
+ readonly snapshot: () => Hop;
56
+ /** Until a subscription of `view-store` handled the commit. */
57
+ readonly handled: (subscription: ViewStoreSubscription) => Hop;
58
+ };
@@ -1,4 +1,4 @@
1
- import { EventView, SystemEvent } from '@ahoo-wang/wow-client';
1
+ import { CommittedEvent, SystemEvent } from '@ahoo-wang/wow-client';
2
2
  import { DatasetWordingCleared, DatasetWordingSet } from '../types.js';
3
3
  /**
4
4
  * The aggregate `view-store.dataset_wording`.
@@ -8,10 +8,10 @@ export declare const DatasetWordingAggregate: {
8
8
  readonly context: "view-store";
9
9
  readonly name: "dataset_wording";
10
10
  readonly path: "/view-store/dataset_wording";
11
- readonly ownership: "TENANT";
11
+ readonly ownership: "tenant";
12
12
  readonly snapshot: true;
13
13
  };
14
14
  /** The `state.*` paths of `dataset_wording`'s snapshots a query filters, sorts and projects on. */
15
15
  export type DatasetWordingStateField = 'state.appId' | 'state.dataset' | 'state.fields' | 'state.recordNoun' | 'state.title';
16
16
  /** The events of `dataset_wording`, named as the server sends them, `view-store.dataset_wording.<Event>` at its current revision (the `events` query upgrades older records), 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;
17
+ export type DatasetWordingEvent = CommittedEvent<'view-store.dataset_wording.DatasetWordingCleared', DatasetWordingCleared> | CommittedEvent<'view-store.dataset_wording.DatasetWordingSet', DatasetWordingSet> | SystemEvent;
@@ -1,15 +1,8 @@
1
- import { CommandGateway, CommandResult, CommandResultStream, CreateCommandOptions, WowClientOptions } from '@ahoo-wang/wow-client';
1
+ import { CommandClient, CommandResult, CommandResultStream, CreateCommandOptions, WowClientOptions } from '@ahoo-wang/wow-client';
2
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. */
3
+ /** Sends the commands of `view-store.dataset_wording` by its service's routes (`ViewStoreManifest`). Each method answers the result its wait plan ends with, as `CommandClient.wait` does: the server's default plan unless the options give one, `{ wait: WaitPlan.ACCEPTED }` to answer once it is accepted. A rejected command rejects with a `CommandRejectedError`; anything else that did not succeed with a `WowProblemError`. */
11
4
  export declare class DatasetWordingCommandClient {
12
- readonly gateway: CommandGateway;
5
+ readonly client: CommandClient;
13
6
  /** @param options - How the service is reached */
14
7
  constructor(options?: WowClientOptions);
15
8
  /**
@@ -1,5 +1,8 @@
1
- export * from './boundedContext.js';
1
+ export * from './client.js';
2
+ export * from './contract.js';
2
3
  export * from './dataset_wording/index.js';
4
+ export * from './manifest.js';
5
+ export * from './routes.js';
3
6
  export * from './types.js';
4
7
  export * from './view/index.js';
5
8
  export * from './view_preferences/index.js';
@@ -0,0 +1,3 @@
1
+ import { RoutingManifest } from '@ahoo-wang/wow-client';
2
+ /** The routes of `view-store`'s commands and service routes, as its Manifest lists them: what its clients send by, with no Manifest fetched and no schema. */
3
+ export declare const ViewStoreManifest: RoutingManifest;
@@ -0,0 +1,22 @@
1
+ import { RequestOptions, WowClientOptions } from '@ahoo-wang/wow-client';
2
+ import { ServiceRoutes } from '@ahoo-wang/wow-client/routes';
3
+ import { SystemView, ViewEntry } from './types.js';
4
+ /** The service routes of `view-store`: routes whose handler is the service's own code, each called by its Manifest's name. */
5
+ export declare class ViewStoreRoutes {
6
+ /** Calls any route of the service by its name. */
7
+ readonly routes: ServiceRoutes;
8
+ /** @param options - How the service is reached */
9
+ constructor(options?: WowClientOptions);
10
+ /**
11
+ * The system views of the caller's tenant and application, of definitionId when it is given and not blank.
12
+ * `GET /view-store/system-views`
13
+ */
14
+ systemViews(query?: {
15
+ readonly definitionId?: string;
16
+ }, options?: RequestOptions): Promise<SystemView[]>;
17
+ /**
18
+ * The view id as the caller reads it: its own personal view, else a shared view of its tenant, else a system view of its tenant and application; `view-store.not-found` when none is.
19
+ * `GET /view-store/views/{id}`
20
+ */
21
+ view(id: string, options?: RequestOptions): Promise<ViewEntry>;
22
+ }
@@ -38,7 +38,7 @@ export type DatasetWordingCleared = Record<string, unknown>;
38
38
  export interface DatasetWordingSet {
39
39
  appId: string;
40
40
  dataset: string;
41
- fields?: null | Record<string, unknown>;
41
+ fields?: Record<string, unknown> | null;
42
42
  recordNoun?: string | null;
43
43
  title?: string | null;
44
44
  }
@@ -46,7 +46,7 @@ export interface DatasetWordingSet {
46
46
  export interface DatasetWordingState {
47
47
  appId: string;
48
48
  dataset: string;
49
- fields?: null | Record<string, unknown>;
49
+ fields?: Record<string, unknown> | null;
50
50
  recordNoun?: string | null;
51
51
  title?: string | null;
52
52
  }
@@ -70,7 +70,7 @@ export interface SaveView {
70
70
  */
71
71
  export interface SetDatasetWording {
72
72
  dataset: string;
73
- fields?: null | Record<string, unknown>;
73
+ fields?: Record<string, unknown> | null;
74
74
  recordNoun?: string | null;
75
75
  title?: string | null;
76
76
  }
@@ -90,6 +90,20 @@ export interface SetViewPreferences {
90
90
  * - key: `me.ahoo.wow.viewstore.api.view.ShareView`
91
91
  */
92
92
  export type ShareView = Record<string, unknown>;
93
+ /** - key: `me.ahoo.wow.viewstore.api.SystemView` */
94
+ export interface SystemView {
95
+ config: Record<string, unknown>;
96
+ definitionId: string;
97
+ id: string;
98
+ kind: ViewKind;
99
+ revision: string;
100
+ scope: ViewAudience;
101
+ source?: SystemViewSource;
102
+ title: string;
103
+ version?: number | null;
104
+ }
105
+ /** - key: `me.ahoo.wow.viewstore.api.SystemViewSource` */
106
+ export type SystemViewSource = 'configured' | 'stored';
93
107
  /** - key: `me.ahoo.wow.viewstore.api.ViewAudience` */
94
108
  export type ViewAudience = 'personal' | 'shared' | 'system';
95
109
  /**
@@ -119,6 +133,18 @@ export interface ViewCreated {
119
133
  kind: ViewKind;
120
134
  title: string;
121
135
  }
136
+ /** - key: `me.ahoo.wow.viewstore.api.ViewEntry` */
137
+ export interface ViewEntry {
138
+ config: Record<string, unknown>;
139
+ definitionId: string;
140
+ id: string;
141
+ kind: ViewKind;
142
+ revision: string;
143
+ scope: ViewAudience;
144
+ source?: null | SystemViewSource;
145
+ title: string;
146
+ version?: number | null;
147
+ }
122
148
  /** - key: `me.ahoo.wow.viewstore.api.ViewKind` */
123
149
  export type ViewKind = 'record' | 'analysis' | 'dashboard';
124
150
  /**
@@ -1,4 +1,4 @@
1
- import { EventView, SystemEvent } from '@ahoo-wang/wow-client';
1
+ import { CommittedEvent, SystemEvent } from '@ahoo-wang/wow-client';
2
2
  import { ViewAudienceChanged, ViewClaimed, ViewCreated, ViewRenamed, ViewSaved, ViewShared } from '../types.js';
3
3
  /**
4
4
  * The aggregate `view-store.view`.
@@ -8,10 +8,10 @@ export declare const ViewAggregate: {
8
8
  readonly context: "view-store";
9
9
  readonly name: "view";
10
10
  readonly path: "/view-store/view";
11
- readonly ownership: "OWNER";
11
+ readonly ownership: "owner";
12
12
  readonly snapshot: true;
13
13
  };
14
14
  /** The `state.*` paths of `view`'s snapshots a query filters, sorts and projects on. */
15
15
  export type ViewStateField = 'state.appId' | 'state.audience' | 'state.config' | 'state.definitionId' | 'state.kind' | 'state.title';
16
16
  /** The events of `view`, named as the server sends them, `view-store.view.<Event>` at its current revision (the `events` query upgrades older records), and the system events every aggregate has. */
17
- export type ViewEvent = EventView<'view-store.view.ViewAudienceChanged', ViewAudienceChanged> | 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;
17
+ export type ViewEvent = CommittedEvent<'view-store.view.ViewAudienceChanged', ViewAudienceChanged> | CommittedEvent<'view-store.view.ViewClaimed', ViewClaimed> | CommittedEvent<'view-store.view.ViewCreated', ViewCreated> | CommittedEvent<'view-store.view.ViewRenamed', ViewRenamed> | CommittedEvent<'view-store.view.ViewSaved', ViewSaved> | CommittedEvent<'view-store.view.ViewShared', ViewShared> | SystemEvent;
@@ -1,17 +1,8 @@
1
- import { CommandGateway, CommandOptions, CommandResult, CommandResultStream, CreateCommandOptions, WowClientOptions } from '@ahoo-wang/wow-client';
1
+ import { CommandClient, CommandOptions, CommandResult, CommandResultStream, CreateCommandOptions, WowClientOptions } from '@ahoo-wang/wow-client';
2
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. */
3
+ /** Sends the commands of `view-store.view` by its service's routes (`ViewStoreManifest`). Each method answers the result its wait plan ends with, as `CommandClient.wait` does: the server's default plan unless the options give one, `{ wait: WaitPlan.ACCEPTED }` to answer once it is accepted. A rejected command rejects with a `CommandRejectedError`; anything else that did not succeed with a `WowProblemError`. */
13
4
  export declare class ViewCommandClient {
14
- readonly gateway: CommandGateway;
5
+ readonly client: CommandClient;
15
6
  /** @param options - How the service is reached */
16
7
  constructor(options?: WowClientOptions);
17
8
  /**
@@ -1,4 +1,4 @@
1
- import { EventView, SystemEvent } from '@ahoo-wang/wow-client';
1
+ import { CommittedEvent, SystemEvent } from '@ahoo-wang/wow-client';
2
2
  import { ViewPreferencesSet } from '../types.js';
3
3
  /**
4
4
  * The aggregate `view-store.view_preferences`.
@@ -8,10 +8,10 @@ export declare const ViewPreferencesAggregate: {
8
8
  readonly context: "view-store";
9
9
  readonly name: "view_preferences";
10
10
  readonly path: "/view-store/view_preferences";
11
- readonly ownership: "OWNER";
11
+ readonly ownership: "owner";
12
12
  readonly snapshot: true;
13
13
  };
14
14
  /** The `state.*` paths of `view_preferences`'s snapshots a query filters, sorts and projects on. */
15
15
  export type ViewPreferencesStateField = 'state.appId' | 'state.autoRun' | 'state.defaultInstanceId' | 'state.definitionId' | 'state.lastTabs' | 'state.order';
16
16
  /** The events of `view_preferences`, named as the server sends them, `view-store.view_preferences.<Event>` at its current revision (the `events` query upgrades older records), and the system events every aggregate has. */
17
- export type ViewPreferencesEvent = EventView<'view-store.view_preferences.ViewPreferencesSet', ViewPreferencesSet> | SystemEvent;
17
+ export type ViewPreferencesEvent = CommittedEvent<'view-store.view_preferences.ViewPreferencesSet', ViewPreferencesSet> | SystemEvent;
@@ -1,13 +1,8 @@
1
- import { CommandGateway, CommandResult, CommandResultStream, CreateCommandOptions, WowClientOptions } from '@ahoo-wang/wow-client';
1
+ import { CommandClient, CommandResult, CommandResultStream, CreateCommandOptions, WowClientOptions } from '@ahoo-wang/wow-client';
2
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. */
3
+ /** Sends the commands of `view-store.view_preferences` by its service's routes (`ViewStoreManifest`). Each method answers the result its wait plan ends with, as `CommandClient.wait` does: the server's default plan unless the options give one, `{ wait: WaitPlan.ACCEPTED }` to answer once it is accepted. A rejected command rejects with a `CommandRejectedError`; anything else that did not succeed with a `WowProblemError`. */
9
4
  export declare class ViewPreferencesCommandClient {
10
- readonly gateway: CommandGateway;
5
+ readonly client: CommandClient;
11
6
  /** @param options - How the service is reached */
12
7
  constructor(options?: WowClientOptions);
13
8
  /**
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export { WowViewStore, type WowViewStoreOptions } from './wowViewStore.js';
2
2
  export { WowDatasetWordings, type WowDatasetWordingsOptions, } from './datasetWordings.js';
3
- export { WowViewStoreErrorCodes } from './errors.js';
3
+ export { WowViewStoreErrorCodes, type WowViewStoreErrorCode, } from './errors.js';
4
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';
5
+ export { datasetCatalogOf } from './source.js';