@panneau/protocol 5.0.0-alpha.39 → 5.0.0-alpha.41
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/dist/conformance/index.d.ts.map +1 -1
- package/dist/conformance/index.js +29 -7
- package/dist/conformance/index.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/lint.d.ts.map +1 -1
- package/dist/lint.js +176 -20
- package/dist/lint.js.map +1 -1
- package/dist/mock/index.js +2 -2
- package/dist/mock/index.js.map +1 -1
- package/dist/openapi.d.ts.map +1 -1
- package/dist/openapi.js +3 -1
- package/dist/openapi.js.map +1 -1
- package/dist/periods.d.ts +12 -0
- package/dist/periods.d.ts.map +1 -1
- package/dist/periods.js +38 -1
- package/dist/periods.js.map +1 -1
- package/dist/runtime/index.d.ts +2 -2
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +3 -3
- package/dist/schemas/definition.d.ts +930 -2
- package/dist/schemas/definition.d.ts.map +1 -1
- package/dist/schemas/index.d.ts +4158 -4
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +14 -3
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/resource.d.ts +464 -0
- package/dist/schemas/resource.d.ts.map +1 -1
- package/dist/schemas/theme.d.ts +2 -2
- package/dist/schemas/widget.d.ts +4210 -0
- package/dist/schemas/widget.d.ts.map +1 -1
- package/dist/schemas/widget.js +184 -17
- package/dist/schemas/widget.js.map +1 -1
- package/dist/widgets.d.ts +158 -7
- package/dist/widgets.d.ts.map +1 -1
- package/dist/widgets.js +469 -40
- package/dist/widgets.js.map +1 -1
- package/package.json +1 -1
- package/schema/boot.schema.json +459 -0
- package/schema/definition.schema.json +459 -0
- package/schema/openapi.json +976 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conformance/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","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G,MAAM,CAU9D"}
|
|
@@ -3,7 +3,7 @@ import { CONTEXT_HEADER, CONTEXT_PROBLEM_TYPE } from "../constants.js";
|
|
|
3
3
|
import { isEqual, isFilled } from "../values.js";
|
|
4
4
|
import { getLinkTypes } from "../links.js";
|
|
5
5
|
import { isCursorPage, toSearchParams } from "../query.js";
|
|
6
|
-
import { followsPeriod, getWidgetResource, isBuiltInWidgetType } from "../widgets.js";
|
|
6
|
+
import { followsPeriod, getWidgetAggregates, getWidgetResource, isBuiltInWidgetType, isCombinedWidget, readsResources } from "../widgets.js";
|
|
7
7
|
import { getAggregateWidgetType, nextPeriod, parseAggregateGroup, toAggregateParams } from "../aggregates.js";
|
|
8
8
|
import { getDefaultPeriod, getPeriodRange } from "../periods.js";
|
|
9
9
|
import { HOME_PAGE, getDashboardPages, getDashboardPeriod, getDashboardWidgets, getSummaryResources, getSummaryWidgets, toWidgetDataParams } from "../dashboards.js";
|
|
@@ -778,7 +778,7 @@ async function runConformance(options) {
|
|
|
778
778
|
const placeName = (place) => place.resource !== void 0 ? `the summary of "${place.resource}"` : place.page !== "home" ? `the page "${place.page}"` : "the home page";
|
|
779
779
|
const widgetName = (id, place) => place.resource !== void 0 || place.page !== "home" ? `"${id}" of ${placeName(place)}` : `"${id}"`;
|
|
780
780
|
await run("dashboard.widgets", "GET /dashboard/widgets/{widget} answers each widget in the shape of its type", async (check) => {
|
|
781
|
-
const own = widgets().filter(({ widget }) =>
|
|
781
|
+
const own = widgets().filter(({ widget }) => !readsResources(widget));
|
|
782
782
|
if (own.length === 0) {
|
|
783
783
|
check.skip("No dashboard or summary has a widget with data of its own.");
|
|
784
784
|
return;
|
|
@@ -798,13 +798,35 @@ async function runConformance(options) {
|
|
|
798
798
|
await run("dashboard.widgets.resource", "The lists and the aggregates of the widgets on a resource answer their query, with a total for a stat", async (check) => {
|
|
799
799
|
const onResource = widgets().flatMap(({ place, widget }) => {
|
|
800
800
|
const read = getWidgetResource(widget);
|
|
801
|
-
return read !== null ? [{
|
|
801
|
+
return read !== null && !isCombinedWidget(widget) ? [{
|
|
802
802
|
place,
|
|
803
803
|
widget,
|
|
804
804
|
read
|
|
805
805
|
}] : [];
|
|
806
806
|
});
|
|
807
|
-
|
|
807
|
+
const combined = widgets().flatMap(({ place, widget }) => getWidgetAggregates(widget).map((read) => ({
|
|
808
|
+
place,
|
|
809
|
+
widget,
|
|
810
|
+
read
|
|
811
|
+
})));
|
|
812
|
+
for (const { place, widget, read } of combined) {
|
|
813
|
+
const name = widgetName(widget.id, place);
|
|
814
|
+
const params = toAggregateParams({
|
|
815
|
+
...read.query.filter !== void 0 && { filter: read.query.filter },
|
|
816
|
+
...read.query.q !== void 0 && { q: read.query.q },
|
|
817
|
+
measure: read.measure,
|
|
818
|
+
group: read.group
|
|
819
|
+
});
|
|
820
|
+
const reply = await request(`/resources/${encodeURIComponent(read.resource)}/aggregate?${params.toString()}`);
|
|
821
|
+
if (reply.status === 403) {
|
|
822
|
+
check.expectProblem(reply, 403);
|
|
823
|
+
continue;
|
|
824
|
+
}
|
|
825
|
+
if (!check.expect(reply.status === 200, `Widget ${name}: expected status 200 from the aggregate of "${read.resource}" (${read.role}), got ${reply.status}.`)) continue;
|
|
826
|
+
const type = getAggregateWidgetType(read.group !== null ? parseAggregateGroup(read.group) : null);
|
|
827
|
+
check.expectSchema(widgetDataSchemas[type], reply.body, `The aggregate of the widget ${name} (${read.role} of "${read.resource}")`);
|
|
828
|
+
}
|
|
829
|
+
if (onResource.length === 0 && combined.length === 0) {
|
|
808
830
|
check.skip("No dashboard or summary has a widget on a resource.");
|
|
809
831
|
return;
|
|
810
832
|
}
|
|
@@ -840,7 +862,7 @@ async function runConformance(options) {
|
|
|
840
862
|
const following = widgets().flatMap(({ place, widget }) => {
|
|
841
863
|
const period = placePeriod(place);
|
|
842
864
|
const option = period !== void 0 ? getDefaultPeriod(period) : null;
|
|
843
|
-
return
|
|
865
|
+
return !readsResources(widget) && option !== null && followsPeriod(widget, place.resource) ? [{
|
|
844
866
|
place,
|
|
845
867
|
widget,
|
|
846
868
|
period: {
|
|
@@ -883,10 +905,10 @@ async function runConformance(options) {
|
|
|
883
905
|
const expectMissing = (path, what) => expectStatus(path, what, 404);
|
|
884
906
|
const places = [...pages.map((page) => ({ page })), ...summaries.map((resource) => ({ resource }))];
|
|
885
907
|
for (const place of places) await expectMissing(widgetPath(UNKNOWN, place), `An unknown widget of ${placeName(place)}`);
|
|
886
|
-
const all = widgets().sort((a, b) => Number(
|
|
908
|
+
const all = widgets().sort((a, b) => Number(readsResources(a.widget)) - Number(readsResources(b.widget)));
|
|
887
909
|
const first = all[0];
|
|
888
910
|
if (first === void 0) return;
|
|
889
|
-
const summarized = all.find(({ place, widget }) => place.resource !== void 0 &&
|
|
911
|
+
const summarized = all.find(({ place, widget }) => place.resource !== void 0 && !readsResources(widget));
|
|
890
912
|
if (summarized?.place.resource !== void 0) await expectStatus(`${widgetPath(summarized.widget.id, summarized.place)}&page=${HOME_PAGE}`, `Widget ${widgetName(summarized.widget.id, summarized.place)} with both a page and a resource`, 422);
|
|
891
913
|
if (places.length === 1 && first.place.page === "home") return;
|
|
892
914
|
await expectMissing(`/dashboard/widgets/${encodeURIComponent(first.widget.id)}?page=${UNKNOWN}`, `Widget ${widgetName(first.widget.id, first.place)} on an unknown page`);
|