@ahoo-wang/wow-view-store 10.0.0-alpha.6 → 10.0.0-beta.1
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 +11 -12
- package/README.zh-CN.md +10 -11
- package/dist/datasetWordings.d.ts +5 -5
- package/dist/errors.d.ts +10 -4
- package/dist/generated/view-store/client.d.ts +38 -0
- package/dist/generated/view-store/contract.d.ts +58 -0
- package/dist/generated/view-store/dataset_wording/aggregate.d.ts +4 -4
- package/dist/generated/view-store/dataset_wording/commandClient.d.ts +3 -10
- package/dist/generated/view-store/index.d.ts +4 -1
- package/dist/generated/view-store/manifest.d.ts +3 -0
- package/dist/generated/view-store/routes.d.ts +22 -0
- package/dist/generated/view-store/types.d.ts +30 -3
- package/dist/generated/view-store/view/aggregate.d.ts +3 -3
- package/dist/generated/view-store/view/commandClient.d.ts +3 -12
- package/dist/generated/view-store/view_preferences/aggregate.d.ts +3 -3
- package/dist/generated/view-store/view_preferences/commandClient.d.ts +3 -8
- package/dist/index.d.ts +2 -3
- package/dist/index.es.js +425 -286
- package/dist/index.es.js.map +1 -1
- package/dist/paths.d.ts +11 -19
- package/dist/source.d.ts +12 -36
- package/dist/views.d.ts +19 -34
- package/dist/wire.d.ts +8 -4
- package/dist/wowViewStore.d.ts +40 -33
- package/package.json +8 -8
- package/dist/generated/view-store/boundedContext.d.ts +0 -36
- package/dist/systemViews.d.ts +0 -21
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.
|
|
33
|
-
|
|
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`
|
|
63
|
-
source:
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
76
|
-
|
|
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
|
|
22
|
-
|
|
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
|
-
//
|
|
50
|
-
source:
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
63
|
-
|
|
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,
|
|
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
|
|
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?:
|
|
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:
|
|
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:
|
|
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
|
|
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 }
|
|
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 {
|
|
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: "
|
|
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
|
-
export type DatasetWordingStateField = 'state.appId' | 'state.dataset' | 'state.fields' | 'state.recordNoun' | 'state.title';
|
|
15
|
+
export type DatasetWordingStateField = 'state.appId' | 'state.dataset' | 'state.fields' | 'state.isEmpty' | '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 =
|
|
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 {
|
|
1
|
+
import { CommandClient, CommandResult, CommandResultStream, CreateCommandOptions, WowClientOptions } from '@ahoo-wang/wow-client';
|
|
2
2
|
import { ClearDatasetWording, SetDatasetWording } from '../types.js';
|
|
3
|
-
/**
|
|
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
|
|
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 './
|
|
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?:
|
|
41
|
+
fields?: Record<string, unknown> | null;
|
|
42
42
|
recordNoun?: string | null;
|
|
43
43
|
title?: string | null;
|
|
44
44
|
}
|
|
@@ -46,7 +46,8 @@ export interface DatasetWordingSet {
|
|
|
46
46
|
export interface DatasetWordingState {
|
|
47
47
|
appId: string;
|
|
48
48
|
dataset: string;
|
|
49
|
-
fields?:
|
|
49
|
+
fields?: Record<string, unknown> | null;
|
|
50
|
+
isEmpty: boolean;
|
|
50
51
|
recordNoun?: string | null;
|
|
51
52
|
title?: string | null;
|
|
52
53
|
}
|
|
@@ -70,7 +71,7 @@ export interface SaveView {
|
|
|
70
71
|
*/
|
|
71
72
|
export interface SetDatasetWording {
|
|
72
73
|
dataset: string;
|
|
73
|
-
fields?:
|
|
74
|
+
fields?: Record<string, unknown> | null;
|
|
74
75
|
recordNoun?: string | null;
|
|
75
76
|
title?: string | null;
|
|
76
77
|
}
|
|
@@ -90,6 +91,20 @@ export interface SetViewPreferences {
|
|
|
90
91
|
* - key: `me.ahoo.wow.viewstore.api.view.ShareView`
|
|
91
92
|
*/
|
|
92
93
|
export type ShareView = Record<string, unknown>;
|
|
94
|
+
/** - key: `me.ahoo.wow.viewstore.api.SystemView` */
|
|
95
|
+
export interface SystemView {
|
|
96
|
+
config: Record<string, unknown>;
|
|
97
|
+
definitionId: string;
|
|
98
|
+
id: string;
|
|
99
|
+
kind: ViewKind;
|
|
100
|
+
revision: string;
|
|
101
|
+
scope: ViewAudience;
|
|
102
|
+
source?: SystemViewSource;
|
|
103
|
+
title: string;
|
|
104
|
+
version?: number | null;
|
|
105
|
+
}
|
|
106
|
+
/** - key: `me.ahoo.wow.viewstore.api.SystemViewSource` */
|
|
107
|
+
export type SystemViewSource = 'configured' | 'stored';
|
|
93
108
|
/** - key: `me.ahoo.wow.viewstore.api.ViewAudience` */
|
|
94
109
|
export type ViewAudience = 'personal' | 'shared' | 'system';
|
|
95
110
|
/**
|
|
@@ -119,6 +134,18 @@ export interface ViewCreated {
|
|
|
119
134
|
kind: ViewKind;
|
|
120
135
|
title: string;
|
|
121
136
|
}
|
|
137
|
+
/** - key: `me.ahoo.wow.viewstore.api.ViewEntry` */
|
|
138
|
+
export interface ViewEntry {
|
|
139
|
+
config: Record<string, unknown>;
|
|
140
|
+
definitionId: string;
|
|
141
|
+
id: string;
|
|
142
|
+
kind: ViewKind;
|
|
143
|
+
revision: string;
|
|
144
|
+
scope: ViewAudience;
|
|
145
|
+
source?: null | SystemViewSource;
|
|
146
|
+
title: string;
|
|
147
|
+
version?: number | null;
|
|
148
|
+
}
|
|
122
149
|
/** - key: `me.ahoo.wow.viewstore.api.ViewKind` */
|
|
123
150
|
export type ViewKind = 'record' | 'analysis' | 'dashboard';
|
|
124
151
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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: "
|
|
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 =
|
|
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 {
|
|
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
|
-
/**
|
|
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
|
|
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 {
|
|
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: "
|
|
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 =
|
|
17
|
+
export type ViewPreferencesEvent = CommittedEvent<'view-store.view_preferences.ViewPreferencesSet', ViewPreferencesSet> | SystemEvent;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CommandClient, CommandResult, CommandResultStream, CreateCommandOptions, WowClientOptions } from '@ahoo-wang/wow-client';
|
|
2
2
|
import { SetViewPreferences } from '../types.js';
|
|
3
|
-
/**
|
|
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
|
|
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
|
|
6
|
-
export { SHARED_OWNER_ID, SYSTEM_OWNER_ID, SYSTEM_TENANT_ID } from './paths.js';
|
|
5
|
+
export { datasetCatalogOf } from './source.js';
|