@ahoo-wang/wow-view-store 10.0.0-alpha.3 → 10.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -129
- package/README.zh-CN.md +42 -104
- package/dist/datasetWordings.d.ts +24 -25
- package/dist/errors.d.ts +54 -73
- package/dist/{v10/generated → generated}/view-store/boundedContext.d.ts +1 -1
- package/dist/{v10/generated → generated}/view-store/dataset_wording/aggregate.d.ts +2 -2
- package/dist/{v10/generated → generated}/view-store/dataset_wording/commandClient.d.ts +1 -1
- package/dist/{v10/generated → generated}/view-store/dataset_wording/queryClient.d.ts +2 -2
- package/dist/{v10/generated → generated}/view-store/types.d.ts +8 -0
- package/dist/generated/view-store/view/aggregate.d.ts +17 -0
- package/dist/{v10/generated → generated}/view-store/view/commandClient.d.ts +1 -1
- package/dist/{v10/generated → generated}/view-store/view/queryClient.d.ts +2 -2
- package/dist/{v10/generated → generated}/view-store/view_preferences/aggregate.d.ts +2 -2
- package/dist/{v10/generated → generated}/view-store/view_preferences/commandClient.d.ts +1 -1
- package/dist/{v10/generated → generated}/view-store/view_preferences/queryClient.d.ts +2 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.es.js +602 -391
- package/dist/index.es.js.map +1 -1
- package/dist/paths.d.ts +0 -32
- package/dist/{v10/source.d.ts → source.d.ts} +8 -7
- package/dist/{v10/systemViews.d.ts → systemViews.d.ts} +1 -1
- package/dist/views.d.ts +49 -0
- package/dist/wire.d.ts +20 -73
- package/dist/wowViewStore.d.ts +111 -159
- package/package.json +7 -13
- package/dist/remembered.es.js +0 -147
- package/dist/remembered.es.js.map +0 -1
- package/dist/v10/datasetWordings.d.ts +0 -46
- package/dist/v10/errors.d.ts +0 -83
- package/dist/v10/generated/view-store/view/aggregate.d.ts +0 -17
- package/dist/v10/index.d.ts +0 -6
- package/dist/v10/wire.d.ts +0 -25
- package/dist/v10/wowViewStore.d.ts +0 -179
- package/dist/v10.es.js +0 -673
- package/dist/v10.es.js.map +0 -1
- /package/dist/{v10/generated → generated}/index.d.ts +0 -0
- /package/dist/{v10/generated → generated}/view-store/dataset_wording/index.d.ts +0 -0
- /package/dist/{v10/generated → generated}/view-store/index.d.ts +0 -0
- /package/dist/{v10/generated → generated}/view-store/view/index.d.ts +0 -0
- /package/dist/{v10/generated → generated}/view-store/view_preferences/index.d.ts +0 -0
package/dist/remembered.es.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var e = Object.defineProperty, __name = (t, n) => e(t, "name", {
|
|
3
|
-
value: n,
|
|
4
|
-
configurable: !0
|
|
5
|
-
}), t = "(shared)", n = "(system)", r = "(platform)", i = "/view-store/tenant/{tenantId}/owner/{ownerId}", a = {
|
|
6
|
-
views: `${i}/view`,
|
|
7
|
-
view: `${i}/view/{id}`,
|
|
8
|
-
save: `${i}/view/{id}/save`,
|
|
9
|
-
rename: `${i}/view/{id}/rename`,
|
|
10
|
-
share: `${i}/view/{id}/share`,
|
|
11
|
-
claim: `${i}/view/{id}/claim`,
|
|
12
|
-
single: `${i}/view/snapshot/single`,
|
|
13
|
-
list: `${i}/view/snapshot/list`,
|
|
14
|
-
replay: `${i}/view/requests/{requestId}`,
|
|
15
|
-
systemViews: `${i}/system-views`,
|
|
16
|
-
systemView: `${i}/system-views/{id}`,
|
|
17
|
-
preferences: `${i}/definitions/{definitionId}/preferences`
|
|
18
|
-
};
|
|
19
|
-
function pathAt(e, i = {}) {
|
|
20
|
-
switch (e) {
|
|
21
|
-
case "shared": return {
|
|
22
|
-
...i,
|
|
23
|
-
ownerId: t
|
|
24
|
-
};
|
|
25
|
-
case "system": return {
|
|
26
|
-
...i,
|
|
27
|
-
tenantId: r,
|
|
28
|
-
ownerId: n
|
|
29
|
-
};
|
|
30
|
-
default: return { ...i };
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region src/wire.ts
|
|
35
|
-
function isStored(e) {
|
|
36
|
-
return e.source === "stored" && typeof e.version == "number";
|
|
37
|
-
}
|
|
38
|
-
var o = [
|
|
39
|
-
"aggregateId",
|
|
40
|
-
"version",
|
|
41
|
-
"state.definitionId",
|
|
42
|
-
"state.title",
|
|
43
|
-
"state.audience",
|
|
44
|
-
"state.config.kind"
|
|
45
|
-
];
|
|
46
|
-
function revisionOf(e) {
|
|
47
|
-
return String(e);
|
|
48
|
-
}
|
|
49
|
-
function toInstance(e) {
|
|
50
|
-
let { aggregateId: t, version: n, state: r } = e;
|
|
51
|
-
return {
|
|
52
|
-
id: t,
|
|
53
|
-
definitionId: r.definitionId,
|
|
54
|
-
title: r.title,
|
|
55
|
-
scope: r.audience,
|
|
56
|
-
revision: revisionOf(n),
|
|
57
|
-
config: r.config
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
function toSummary(e) {
|
|
61
|
-
let { aggregateId: t, version: n, state: r } = e;
|
|
62
|
-
return {
|
|
63
|
-
id: t,
|
|
64
|
-
definitionId: r.definitionId,
|
|
65
|
-
title: r.title,
|
|
66
|
-
scope: r.audience,
|
|
67
|
-
kind: r.config.kind,
|
|
68
|
-
revision: revisionOf(n)
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
function systemInstance(e) {
|
|
72
|
-
return {
|
|
73
|
-
id: e.id,
|
|
74
|
-
definitionId: e.definitionId,
|
|
75
|
-
title: e.title,
|
|
76
|
-
scope: "system",
|
|
77
|
-
revision: e.revision,
|
|
78
|
-
config: e.config,
|
|
79
|
-
...isStored(e) ? { stored: !0 } : {}
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
function systemSummary(e) {
|
|
83
|
-
return {
|
|
84
|
-
id: e.id,
|
|
85
|
-
definitionId: e.definitionId,
|
|
86
|
-
title: e.title,
|
|
87
|
-
scope: "system",
|
|
88
|
-
kind: e.kind,
|
|
89
|
-
revision: e.revision,
|
|
90
|
-
...isStored(e) ? { stored: !0 } : {}
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
function toPreferences(e) {
|
|
94
|
-
return preferencesAt({
|
|
95
|
-
order: e.order ?? [],
|
|
96
|
-
defaultInstanceId: e.defaultInstanceId ?? null,
|
|
97
|
-
autoRun: e.autoRun ?? void 0,
|
|
98
|
-
lastTabs: e.lastTabs ?? void 0
|
|
99
|
-
}, e.version);
|
|
100
|
-
}
|
|
101
|
-
function preferencesInput(e) {
|
|
102
|
-
let { order: t, defaultInstanceId: n, autoRun: r, lastTabs: i } = e;
|
|
103
|
-
return {
|
|
104
|
-
order: [...t],
|
|
105
|
-
defaultInstanceId: n ?? null,
|
|
106
|
-
...r === void 0 ? {} : { autoRun: r },
|
|
107
|
-
...i === void 0 ? {} : { lastTabs: { ...i } }
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
function preferencesAt(e, t) {
|
|
111
|
-
return {
|
|
112
|
-
...preferencesInput(e),
|
|
113
|
-
revision: revisionOf(t)
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function samePreferences(e, t) {
|
|
117
|
-
return canonical(e) === canonical(t);
|
|
118
|
-
}
|
|
119
|
-
function canonical(e) {
|
|
120
|
-
let { order: t, defaultInstanceId: n, autoRun: r, lastTabs: i } = preferencesInput(e), a = i && Object.entries(i).sort(([e], [t]) => e < t ? -1 : +(e > t));
|
|
121
|
-
return JSON.stringify([
|
|
122
|
-
t,
|
|
123
|
-
n,
|
|
124
|
-
r ?? null,
|
|
125
|
-
a ?? null
|
|
126
|
-
]);
|
|
127
|
-
}
|
|
128
|
-
//#endregion
|
|
129
|
-
//#region src/remembered.ts
|
|
130
|
-
var s = 256, Remembered = class {
|
|
131
|
-
constructor(e = s) {
|
|
132
|
-
this.limit = e, this.entries = /* @__PURE__ */ new Map();
|
|
133
|
-
}
|
|
134
|
-
get(e) {
|
|
135
|
-
return this.entries.get(e);
|
|
136
|
-
}
|
|
137
|
-
has(e) {
|
|
138
|
-
return this.entries.has(e);
|
|
139
|
-
}
|
|
140
|
-
set(e, t) {
|
|
141
|
-
this.entries.delete(e), this.entries.set(e, t), this.entries.size > this.limit && this.entries.delete(this.entries.keys().next().value);
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
//#endregion
|
|
145
|
-
export { r as _, preferencesInput as a, systemInstance as c, toPreferences as d, toSummary as f, n as g, t as h, preferencesAt as i, systemSummary as l, i as m, o as n, revisionOf as o, a as p, isStored as r, samePreferences as s, Remembered as t, toInstance as u, pathAt as v, __name as y };
|
|
146
|
-
|
|
147
|
-
//# sourceMappingURL=remembered.es.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remembered.es.js","names":["__defProp","target","SHARED_OWNER_ID","SYSTEM_OWNER_ID","SYSTEM_TENANT_ID","SCOPE","PATHS","place","variables","view","SUMMARY_FIELDS","version","snapshot","aggregateId","state","body","preferences","order","defaultInstanceId","autoRun","lastTabs","a","b","tabs","x","y","REMEMBERED_WRITES","limit","key","value"],"sources":["../src/paths.ts","../src/wire.ts","../src/remembered.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The reserved owner of shared views and shared preferences\n * (`ViewStoreService.SHARED_OWNER_ID` on the server). The parentheses keep it\n * apart from every user id, so a path whose owner segment is `(shared)` is the\n * shared audience's.\n *\n * A host nobody signs in to fills `{ownerId}` with it by default (its own\n * request interceptor), and then has shared views and shared preferences\n * only.\n */\nexport const SHARED_OWNER_ID = '(shared)';\n\n/**\n * The reserved owner of stored system views\n * (`ViewStoreService.SYSTEM_OWNER_ID` on the server).\n */\nexport const SYSTEM_OWNER_ID = '(system)';\n\n/**\n * The one tenant stored system views live under\n * (`ViewStoreService.SYSTEM_TENANT_ID`): the value of CoSec's platform\n * tenant, not the default tenant `(0)`. System views are global, so the\n * store writes them on `tenant/(platform)/owner/(system)` whatever the\n * caller's own tenant, and the security gateway decides who may, by that\n * path.\n */\nexport const SYSTEM_TENANT_ID = '(platform)';\n\n/**\n * Where a view lives on the server: the owner segment of its path. `personal`\n * leaves `{ownerId}` to the fetcher's interceptors (fetcher-cosec's resource\n * attribution fills it from the token's `sub`); `shared` names\n * {@link SHARED_OWNER_ID}, which the interceptors never replace; `system`\n * names both the tenant and the owner of stored system views,\n * {@link SYSTEM_TENANT_ID} and {@link SYSTEM_OWNER_ID}.\n */\nexport type Place = 'personal' | 'shared' | 'system';\n\n/** Every route starts here; the tenant and owner are path variables. */\nexport const SCOPE = '/view-store/tenant/{tenantId}/owner/{ownerId}';\n\n/** The view store's routes, relative to the fetcher's base URL. */\nexport const PATHS = {\n /** `POST`: create (the server generates the id). */\n views: `${SCOPE}/view`,\n /** `DELETE`: Wow's delete of the aggregate. */\n view: `${SCOPE}/view/{id}`,\n save: `${SCOPE}/view/{id}/save`,\n rename: `${SCOPE}/view/{id}/rename`,\n /** Sent to the view's personal path; moves it to `(shared)`. */\n share: `${SCOPE}/view/{id}/share`,\n /** Sent to the caller's own path; moves a shared view to the caller. */\n claim: `${SCOPE}/view/{id}/claim`,\n single: `${SCOPE}/view/snapshot/single`,\n list: `${SCOPE}/view/snapshot/list`,\n /** The view as the write with this request id left it; `204` for a delete. */\n replay: `${SCOPE}/view/requests/{requestId}`,\n /**\n * Served under `(shared)` only: the configured system views of the\n * caller's tenant and the stored ones, global.\n */\n systemViews: `${SCOPE}/system-views`,\n systemView: `${SCOPE}/system-views/{id}`,\n preferences: `${SCOPE}/definitions/{definitionId}/preferences`,\n} as const;\n\n/**\n * The path variables of a request at `place`. The tenant is the\n * interceptors' but on the system path; the owner is theirs for a personal\n * path.\n */\nexport function pathAt(\n place: Place,\n variables: Record<string, string> = {},\n): Record<string, string> {\n switch (place) {\n case 'shared':\n return { ...variables, ownerId: SHARED_OWNER_ID };\n case 'system':\n return {\n ...variables,\n tenantId: SYSTEM_TENANT_ID,\n ownerId: SYSTEM_OWNER_ID,\n };\n default:\n return { ...variables };\n }\n}\n","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * The server's shapes, as far as the store reads them, and their reading as\n * the port's. The server stores the engine's `ViewConfig` whole and never\n * reads its meaning, so a config comes back exactly as it was saved.\n */\n\nimport type {\n ViewAudience,\n ViewConfig,\n ViewInstance,\n ViewInstanceSummary,\n ViewKind,\n ViewPreferences,\n} from '@ahoo-wang/wow-view-engine';\n\n/** The state of a `view` aggregate (`ViewState`); tenant and owner are Wow's. */\nexport interface ViewStateBody {\n definitionId: string;\n title: string;\n /** Follows the owner: `(shared)` is `shared`, any user is `personal`. */\n audience: ViewAudience;\n config: ViewConfig;\n}\n\n/**\n * A view's snapshot as a snapshot query or the replay route answers it. A\n * list projects it down to the summary's fields, `state.config.kind` among\n * them.\n */\nexport interface ViewSnapshotBody {\n aggregateId: string;\n version: number;\n state: ViewStateBody;\n}\n\n/** A system view the server serves (`SystemView`); `scope` is always `system`. */\nexport interface SystemViewBody {\n id: string;\n definitionId: string;\n title: string;\n kind: ViewKind;\n /** A hash of its content, whatever its source. */\n revision: string;\n config: ViewConfig;\n /**\n * `configured` (read-only) or `stored` (a view of `tenant/(platform)/owner/(system)`,\n * written through the view routes); absent from a server before it,\n * which served configured views only.\n */\n source?: 'configured' | 'stored';\n /** A stored view's aggregate version, which its writes expect. */\n version?: number | null;\n}\n\n/**\n * Whether the server stores `view` (else it configures it). A stored one\n * carries the port's `stored: true` (D81), the views an `editSystem`\n * permission may write; configured and code system views carry none.\n */\nexport function isStored(view: SystemViewBody): boolean {\n return view.source === 'stored' && typeof view.version === 'number';\n}\n\n/** One owner's preferences in one definition (`ViewPreferencesView`). */\nexport interface PreferencesBody {\n definitionId: string;\n order?: string[] | null;\n defaultInstanceId?: string | null;\n autoRun?: boolean | null;\n lastTabs?: Record<string, string> | null;\n /** `0` for preferences never written. */\n version: number;\n}\n\n/** The part of a command's answer (`CommandResult`) the store reads. */\nexport interface CommandResultBody {\n aggregateId: string;\n aggregateVersion?: number | null;\n}\n\n/** The fields a list reads, and nothing of the config but its `kind`. */\nexport const SUMMARY_FIELDS = [\n 'aggregateId',\n 'version',\n 'state.definitionId',\n 'state.title',\n 'state.audience',\n 'state.config.kind',\n];\n\n/** A snapshot's revision: the aggregate's version, compared as a string. */\nexport function revisionOf(version: number): string {\n return String(version);\n}\n\nexport function toInstance(snapshot: ViewSnapshotBody): ViewInstance {\n const { aggregateId, version, state } = snapshot;\n return {\n id: aggregateId,\n definitionId: state.definitionId,\n title: state.title,\n scope: state.audience,\n revision: revisionOf(version),\n config: state.config,\n };\n}\n\nexport function toSummary(snapshot: ViewSnapshotBody): ViewInstanceSummary {\n const { aggregateId, version, state } = snapshot;\n return {\n id: aggregateId,\n definitionId: state.definitionId,\n title: state.title,\n scope: state.audience,\n kind: state.config.kind,\n revision: revisionOf(version),\n };\n}\n\nexport function systemInstance(view: SystemViewBody): ViewInstance {\n return {\n id: view.id,\n definitionId: view.definitionId,\n title: view.title,\n scope: 'system',\n revision: view.revision,\n config: view.config,\n ...(isStored(view) ? { stored: true as const } : {}),\n };\n}\n\nexport function systemSummary(view: SystemViewBody): ViewInstanceSummary {\n return {\n id: view.id,\n definitionId: view.definitionId,\n title: view.title,\n scope: 'system',\n kind: view.kind,\n revision: view.revision,\n ...(isStored(view) ? { stored: true as const } : {}),\n };\n}\n\n/**\n * The port's preferences. A member the server holds as `null` is one never\n * set: `defaultInstanceId` reads as `null`, and `autoRun` and `lastTabs` are\n * left out, as the port's own `emptyPreferences()` leaves them.\n */\nexport function toPreferences(body: PreferencesBody): ViewPreferences {\n return preferencesAt(\n {\n order: body.order ?? [],\n defaultInstanceId: body.defaultInstanceId ?? null,\n autoRun: body.autoRun ?? undefined,\n lastTabs: body.lastTabs ?? undefined,\n },\n body.version,\n );\n}\n\n/** What a preferences write sends: everything but the revision. */\nexport function preferencesInput(\n preferences: Omit<ViewPreferences, 'revision'>,\n): Omit<ViewPreferences, 'revision'> {\n const { order, defaultInstanceId, autoRun, lastTabs } = preferences;\n return {\n order: [...order],\n defaultInstanceId: defaultInstanceId ?? null,\n ...(autoRun === undefined ? {} : { autoRun }),\n ...(lastTabs === undefined ? {} : { lastTabs: { ...lastTabs } }),\n };\n}\n\n/** `preferences` as written at `version`, in the port's shape. */\nexport function preferencesAt(\n preferences: Omit<ViewPreferences, 'revision'>,\n version: number,\n): ViewPreferences {\n return { ...preferencesInput(preferences), revision: revisionOf(version) };\n}\n\n/** Whether two preferences say the same, whatever their revisions. */\nexport function samePreferences(\n a: Omit<ViewPreferences, 'revision'>,\n b: Omit<ViewPreferences, 'revision'>,\n): boolean {\n return canonical(a) === canonical(b);\n}\n\n/** One spelling of what preferences say, the tabs in key order. */\nfunction canonical(preferences: Omit<ViewPreferences, 'revision'>): string {\n const { order, defaultInstanceId, autoRun, lastTabs } =\n preferencesInput(preferences);\n const tabs =\n lastTabs &&\n Object.entries(lastTabs).sort(([x], [y]) => (x < y ? -1 : x > y ? 1 : 0));\n return JSON.stringify([\n order,\n defaultInstanceId,\n autoRun ?? null,\n tabs ?? null,\n ]);\n}\n","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** How many writes a store remembers the outcome of, unless told otherwise. */\nconst REMEMBERED_WRITES = 256;\n\n/** A bounded memory by key: the oldest entry goes first. */\nexport class Remembered<T> {\n private readonly entries = new Map<string, T>();\n\n constructor(private readonly limit = REMEMBERED_WRITES) {}\n\n get(key: string): T | undefined {\n return this.entries.get(key);\n }\n\n has(key: string): boolean {\n return this.entries.has(key);\n }\n\n set(key: string, value: T): void {\n this.entries.delete(key);\n this.entries.set(key, value);\n if (this.entries.size > this.limit)\n this.entries.delete(this.entries.keys().next().value!);\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Fetcher } from '@ahoo-wang/fetcher';
|
|
2
|
-
import { DatasetOverrides, DatasetWordingStore, StoredDatasetWording, WriteContext } from '@ahoo-wang/wow-view-engine';
|
|
3
|
-
/** How a V10 {@link WowDatasetWordings} reaches the view store service: as a V10 `WowViewStore` does. */
|
|
4
|
-
export interface WowDatasetWordingsOptions {
|
|
5
|
-
/**
|
|
6
|
-
* The fetcher every request goes through, as the V10
|
|
7
|
-
* `WowViewStoreOptions.fetcher`: its interceptors carry the caller and
|
|
8
|
-
* `CoSec-App-Id`. The wording is the tenant's (an aggregate of the tenant,
|
|
9
|
-
* not of an owner), so no request names a scope.
|
|
10
|
-
*/
|
|
11
|
-
fetcher: Fetcher;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
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
|
|
16
|
-
* application, the id derived by the service from the two. Every reader of
|
|
17
|
-
* the tenant reads it; the service decides who writes it (the role that
|
|
18
|
-
* writes the owner `(shared)`, `view-store.shared-writer` as shipped).
|
|
19
|
-
*
|
|
20
|
-
* A host hands it to the datasets it registers as their store of wording
|
|
21
|
-
* (`DatasetCatalog.wordings`, D91). The key is the dataset's definition id,
|
|
22
|
-
* `{context}.{dataset}`. Every rejection is a `ViewStoreError`, read as a
|
|
23
|
-
* V10 `WowViewStore`'s are.
|
|
24
|
-
*/
|
|
25
|
-
export declare class WowDatasetWordings implements DatasetWordingStore {
|
|
26
|
-
private readonly commands;
|
|
27
|
-
private readonly snapshots;
|
|
28
|
-
constructor(options: WowDatasetWordingsOptions);
|
|
29
|
-
/**
|
|
30
|
-
* Every dataset's wording of the caller's tenant and application, by
|
|
31
|
-
* dataset. A cleared one is listed too, saying nothing: its revision is
|
|
32
|
-
* what the next write expects.
|
|
33
|
-
*/
|
|
34
|
-
list(signal?: AbortSignal): Promise<ReadonlyMap<string, StoredDatasetWording>>;
|
|
35
|
-
/**
|
|
36
|
-
* Writes a dataset's wording at the expected `revision` (`'0'` for one never
|
|
37
|
-
* written), whole: what it leaves out is no longer said. Answers the new
|
|
38
|
-
* revision.
|
|
39
|
-
*/
|
|
40
|
-
set(dataset: string, wording: DatasetOverrides, revision: string, context: WriteContext): Promise<string>;
|
|
41
|
-
/**
|
|
42
|
-
* Clears a dataset's wording at the expected `revision`: its derived words
|
|
43
|
-
* stand again. Answers the new revision.
|
|
44
|
-
*/
|
|
45
|
-
clear(dataset: string, revision: string, context: WriteContext): Promise<string>;
|
|
46
|
-
}
|
package/dist/v10/errors.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
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>;
|
|
@@ -1,17 +0,0 @@
|
|
|
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;
|
package/dist/v10/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
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';
|
package/dist/v10/wire.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { TargetScope } from '@ahoo-wang/wow-client/v10';
|
|
2
|
-
import { DatasetOverrides, ViewInstance, ViewInstanceSummary } from '@ahoo-wang/wow-view-engine';
|
|
3
|
-
import { Place } from '../paths.js';
|
|
4
|
-
import { DatasetWordingState, ViewState } from './generated/view-store/types.js';
|
|
5
|
-
/** The `Wow-Scope` of the shared views: the reserved owner `(shared)`. */
|
|
6
|
-
export declare const SHARED_SCOPE: TargetScope;
|
|
7
|
-
/** The `Wow-Scope` of the stored system views: `(system)` of `(platform)`. */
|
|
8
|
-
export declare const SYSTEM_SCOPE: TargetScope;
|
|
9
|
-
/**
|
|
10
|
-
* The `Wow-Scope` a request at `place` carries: none for the caller's own
|
|
11
|
-
* views, whose owner the server takes from the principal.
|
|
12
|
-
*/
|
|
13
|
-
export declare function scopeAt(place: Place): TargetScope | undefined;
|
|
14
|
-
/** A view's snapshot or state as the store reads it: its id, version and state. */
|
|
15
|
-
export interface ViewRecord {
|
|
16
|
-
id: string;
|
|
17
|
-
version: number;
|
|
18
|
-
state: Pick<ViewState, 'definitionId' | 'title' | 'audience'> & Partial<Pick<ViewState, 'kind' | 'config'>>;
|
|
19
|
-
}
|
|
20
|
-
/** The fields a list reads, and of the config only its `kind`, kept apart. */
|
|
21
|
-
export declare const SUMMARY_FIELDS: readonly ["aggregateId", "version", "state.definitionId", "state.title", "state.audience", "state.kind"];
|
|
22
|
-
export declare function toInstance({ id, version, state }: ViewRecord): ViewInstance;
|
|
23
|
-
export declare function toSummary({ id, version, state, }: ViewRecord): ViewInstanceSummary;
|
|
24
|
-
/** The engine's overrides from a stored wording: what is stored, nothing more. */
|
|
25
|
-
export declare function wordingOf(state: Pick<DatasetWordingState, 'title' | 'recordNoun' | 'fields'>): DatasetOverrides;
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { Fetcher } from '@ahoo-wang/fetcher';
|
|
2
|
-
import { ViewAudience, ViewConfig, ViewInstance, ViewInstanceSummary, ViewPermissions, ViewPreferences, ViewStore, WriteContext } from '@ahoo-wang/wow-view-engine';
|
|
3
|
-
/** How a V10 {@link WowViewStore} reaches the view store service. */
|
|
4
|
-
export interface WowViewStoreOptions {
|
|
5
|
-
/**
|
|
6
|
-
* The fetcher every request goes through, on the base URL that serves
|
|
7
|
-
* `/view-store/…` (the V10 view store service, or a gateway in front of
|
|
8
|
-
* it).
|
|
9
|
-
*
|
|
10
|
-
* Its interceptors carry who is asking; the store never does. The V10
|
|
11
|
-
* service takes the tenant and the owner from the principal, so no path
|
|
12
|
-
* names them: the interceptors send the authorization (CoSec's token, or
|
|
13
|
-
* the headers the service's own caller resolver reads) and `CoSec-App-Id`,
|
|
14
|
-
* the application every view, preference and wording is kept in. The
|
|
15
|
-
* store adds `Wow-Scope` itself where it acts as a reserved owner: the
|
|
16
|
-
* shared views' `(shared)`, and `(system)` of `(platform)` for stored
|
|
17
|
-
* system views.
|
|
18
|
-
*/
|
|
19
|
-
fetcher: Fetcher;
|
|
20
|
-
/**
|
|
21
|
-
* Which buttons are enabled for one definition's views. The service
|
|
22
|
-
* authorizes each write; a host answers this by the roles it holds there —
|
|
23
|
-
* `changeAudience` and the shared views' writes by the role that writes
|
|
24
|
-
* the owner `(shared)` (`view-store.shared-writer` on the service as
|
|
25
|
-
* shipped), `editSystem` by the one that writes `(system)`. Left out,
|
|
26
|
-
* everything is allowed, as the port reads a store without `permissions`.
|
|
27
|
-
*/
|
|
28
|
-
permissions?: (definitionId: string) => ViewPermissions;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* The view engine's `ViewStore` over the **V10** view store service
|
|
32
|
-
* (`platform/view-store` in the Wow repository): saved views and preferences
|
|
33
|
-
* as two Wow V10 aggregates, reached through the clients generated from the
|
|
34
|
-
* service's Manifest (`@ahoo-wang/wow-client/v10`), and the system views
|
|
35
|
-
* through the service's own route.
|
|
36
|
-
*
|
|
37
|
-
* **The owner is the audience.** A personal view is the caller's own; a
|
|
38
|
-
* shared one belongs to the reserved owner `(shared)`, which the store acts
|
|
39
|
-
* as with `Wow-Scope: owner="(shared)"`; a stored system view to `(system)`
|
|
40
|
-
* of the tenant `(platform)`. The port names a view by id alone, so the
|
|
41
|
-
* store remembers where it last saw each one and looks an unknown id up as
|
|
42
|
-
* the caller, as `(shared)` and among the system views, in that order.
|
|
43
|
-
* Sharing and claiming move a view to the other owner in place, id kept:
|
|
44
|
-
* the store waits for the service's `ViewAudienceSaga` to move it.
|
|
45
|
-
*
|
|
46
|
-
* **Writes** carry the port's `requestId` as `Wow-Request-Id` and its
|
|
47
|
-
* `revision` as `If-Match`, and wait for the snapshot. The service
|
|
48
|
-
* deduplicates a request id, creates included, so a retry is answered with
|
|
49
|
-
* the first attempt's outcome; the store answers the view read back at the
|
|
50
|
-
* version that write left (`GET …/{id}/state?version=`). A stale revision
|
|
51
|
-
* is `CONFLICT` carrying the view as it is now.
|
|
52
|
-
*
|
|
53
|
-
* **Errors** are read by the problem's code onto the port's codes, by the
|
|
54
|
-
* HTTP status only for an answer without a code the store knows; a `404`
|
|
55
|
-
* without a code is a route the service does not serve (`UNSUPPORTED`), and
|
|
56
|
-
* a request that got no answer is `UNAVAILABLE`.
|
|
57
|
-
*/
|
|
58
|
-
export declare class WowViewStore implements ViewStore {
|
|
59
|
-
/**
|
|
60
|
-
* The most of one audience a list answers (`LIST_LIMIT`): an audience
|
|
61
|
-
* listed this full was cut there, which the workbench then says (R2-26).
|
|
62
|
-
*/
|
|
63
|
-
readonly listLimit = 1000;
|
|
64
|
-
/** The host's {@link WowViewStoreOptions.permissions}, when it gave any. */
|
|
65
|
-
readonly permissions?: (definitionId: string) => ViewPermissions;
|
|
66
|
-
private readonly commands;
|
|
67
|
-
private readonly snapshots;
|
|
68
|
-
private readonly states;
|
|
69
|
-
private readonly preferenceCommands;
|
|
70
|
-
private readonly preferenceSnapshots;
|
|
71
|
-
private readonly systemViews;
|
|
72
|
-
/** Where each view was last seen, by id. */
|
|
73
|
-
private readonly places;
|
|
74
|
-
/**
|
|
75
|
-
* The version of each stored system view at each revision the store has
|
|
76
|
-
* seen it at (a hash of its content, while a write expects the version),
|
|
77
|
-
* by `id` and revision; `null` for a configured one, which is read-only.
|
|
78
|
-
* Keeping the old revisions too lets a retry send the version its first
|
|
79
|
-
* attempt expected, which the service then answers as a duplicate.
|
|
80
|
-
*/
|
|
81
|
-
private readonly systemVersions;
|
|
82
|
-
constructor(options: WowViewStoreOptions);
|
|
83
|
-
/**
|
|
84
|
-
* The caller's personal views, the shared views and the service's system
|
|
85
|
-
* views of the definition: three requests, sent together, answered in the
|
|
86
|
-
* port's order — system, shared, personal, each oldest first (the service
|
|
87
|
-
* sorts each audience by the time its first event was written).
|
|
88
|
-
*/
|
|
89
|
-
list(definitionId: string, signal?: AbortSignal): Promise<ViewInstanceSummary[]>;
|
|
90
|
-
/** View `id` wherever it is: the caller's, shared, or a system view. */
|
|
91
|
-
get(id: string, signal?: AbortSignal): Promise<ViewInstance>;
|
|
92
|
-
/**
|
|
93
|
-
* Creates the view as the owner of its `scope`; the service generates the
|
|
94
|
-
* id. A retry under the same request id is answered with the first
|
|
95
|
-
* attempt's view, whichever store sends it: the service deduplicates it.
|
|
96
|
-
*/
|
|
97
|
-
create(input: Omit<ViewInstance, 'id' | 'revision'>, context: WriteContext): Promise<ViewInstance>;
|
|
98
|
-
/** Replaces the view's config, at the expected `revision`. */
|
|
99
|
-
save(id: string, config: ViewConfig, revision: string, context: WriteContext): Promise<ViewInstance>;
|
|
100
|
-
/** Renames the view (the service trims the title), at the expected `revision`. */
|
|
101
|
-
rename(id: string, title: string, revision: string, context: WriteContext): Promise<ViewInstance>;
|
|
102
|
-
/**
|
|
103
|
-
* 设为共享 sends `share-view` as the caller, the view's owner; 设为个人
|
|
104
|
-
* sends `claim-view` as `(shared)`, which the service admits only with
|
|
105
|
-
* the role that writes the owner `(shared)`, and which makes the caller
|
|
106
|
-
* the owner. Either waits for the move (`ViewAudienceSaga`). Each is sent
|
|
107
|
-
* from the same owner whether or not the view has moved, so a retry is
|
|
108
|
-
* answered as its first attempt's duplicate even after the move.
|
|
109
|
-
*
|
|
110
|
-
* Asked for the audience the view already has, the service refuses the
|
|
111
|
-
* command as outside that owner's scope; the store then answers the view
|
|
112
|
-
* as it is, revision unmoved, once the revision matches.
|
|
113
|
-
*
|
|
114
|
-
* A shared view a shared dashboard shows stays shared: the service
|
|
115
|
-
* refuses the claim and names the boards, and the refusal carries them by
|
|
116
|
-
* **title** in `boards`, as they are stored.
|
|
117
|
-
*/
|
|
118
|
-
changeAudience(id: string, audience: ViewAudience, revision: string, context: WriteContext): Promise<ViewInstance>;
|
|
119
|
-
/** Deletes the view, at the expected `revision`; a board showing it keeps a broken panel. */
|
|
120
|
-
delete(id: string, revision: string, context: WriteContext): Promise<void>;
|
|
121
|
-
/**
|
|
122
|
-
* The caller's preferences of the definition, in the request's
|
|
123
|
-
* application: the service derives their id from the owner, the
|
|
124
|
-
* application and the definition. None written yet reads as the port's
|
|
125
|
-
* empty preferences, at revision `'0'`.
|
|
126
|
-
*/
|
|
127
|
-
getPreferences(definitionId: string, signal?: AbortSignal): Promise<ViewPreferences>;
|
|
128
|
-
/**
|
|
129
|
-
* Writes the preferences at the expected `revision` (`'0'` for ones never
|
|
130
|
-
* written, which `If-Match: "0"` says). A retry under the same request id
|
|
131
|
-
* is answered as the first attempt's duplicate, at its version.
|
|
132
|
-
*/
|
|
133
|
-
setPreferences(definitionId: string, preferences: ViewPreferences, context: WriteContext): Promise<ViewPreferences>;
|
|
134
|
-
/**
|
|
135
|
-
* One instance write: to the place the view is at, then the answer read
|
|
136
|
-
* back. A view remembered at a place it has since left (another tab shared
|
|
137
|
-
* it) is looked up again and the write sent once more from where it is.
|
|
138
|
-
* A move refused because the view already has the audience it asks for
|
|
139
|
-
* changes nothing: the view is answered as it is, once its revision
|
|
140
|
-
* matches.
|
|
141
|
-
*/
|
|
142
|
-
private write;
|
|
143
|
-
/**
|
|
144
|
-
* A landed write's answer: the view read back at the version it left
|
|
145
|
-
* (`GET …/{id}/state?version=`). A system view's revision is its content
|
|
146
|
-
* hash, so it is read from its route as it is now.
|
|
147
|
-
*
|
|
148
|
-
* A move is two commits: the view's own (its audience), then the saga's
|
|
149
|
-
* (its owner). Waited for, the result's version is the second; a
|
|
150
|
-
* duplicate answers the first, so the move is read one version later,
|
|
151
|
-
* where the owner it names must be the one it moved to. Anything else
|
|
152
|
-
* (another writer between the two) answers the view as it is now.
|
|
153
|
-
*/
|
|
154
|
-
private landed;
|
|
155
|
-
/** A move to where the view already is: the view as it is, at `revision`. */
|
|
156
|
-
private unchanged;
|
|
157
|
-
/** A stale write's refusal, carrying the view as it is now. */
|
|
158
|
-
private conflict;
|
|
159
|
-
/**
|
|
160
|
-
* View `id` and where it is: first where it was last seen (`first`, `null`
|
|
161
|
-
* to ignore that), then as the caller, as `(shared)` and among the system
|
|
162
|
-
* views.
|
|
163
|
-
*/
|
|
164
|
-
private find;
|
|
165
|
-
/** The view as it is now at `place`; a `NOT_FOUND` failure when it is not there. */
|
|
166
|
-
private readAt;
|
|
167
|
-
/** Keeps the version of a stored system view at its revision; a configured one as read-only. */
|
|
168
|
-
private rememberSystem;
|
|
169
|
-
/**
|
|
170
|
-
* The version a write of stored system view `id` at `revision` (its
|
|
171
|
-
* content hash) expects: as seen at that revision, else as read now. A
|
|
172
|
-
* configured system view is read-only (`FORBIDDEN`; a code one is never
|
|
173
|
-
* found here); a revision other than the view's is `CONFLICT`, carrying
|
|
174
|
-
* the view as it is.
|
|
175
|
-
*/
|
|
176
|
-
private systemVersion;
|
|
177
|
-
/** The options of a command sent from `place`: its scope, request id and signal. */
|
|
178
|
-
private commandOptions;
|
|
179
|
-
}
|