@spotto/contract 1.0.70-alpha.16 → 1.0.70-alpha.17
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.
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* A layout is a flat, ordered list of widgets, each pinned to a rect on a
|
|
8
8
|
* 4-column grid (`gridPos`). The widget `type` is a closed union (below): adding
|
|
9
9
|
* a new kind is a contract change + republish + client bump. Per-widget `config`
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* carries widget *behaviour* only (a saved-view id, an action id, a heading's
|
|
11
|
+
* text) — never geometry. Since 2026-07-30 the API validates each kind's KNOWN
|
|
12
|
+
* config keys on write (the per-kind `*WidgetConfig` shapes below) while
|
|
13
|
+
* tolerating unknown keys, so the client can still add config keys without an
|
|
14
|
+
* API deploy ordering — only changing a known key's meaning needs one.
|
|
13
15
|
*
|
|
14
16
|
* `version` discriminates stored layouts so the client can detect and
|
|
15
17
|
* reset/migrate an older one on read.
|
|
@@ -30,6 +32,38 @@
|
|
|
30
32
|
* expressed through `gridPos.w`, not enforced by the API.
|
|
31
33
|
*/
|
|
32
34
|
export declare type HomeWidgetType = 'tile-link' | 'summary-list' | 'recent-activity' | 'recent-assets' | 'recent-locations' | 'needs-attention' | 'kit-spotlight' | 'hero' | 'heading';
|
|
35
|
+
/**
|
|
36
|
+
* Per-kind `config` shapes — the authoritative form of each configurable
|
|
37
|
+
* kind's KNOWN keys, which the API enforces on write (unknown keys pass, so
|
|
38
|
+
* these can grow client-first). The feed kinds define no config keys. `config`
|
|
39
|
+
* itself stays loosely typed on `HomeWidget`; the client parses defensively at
|
|
40
|
+
* the render boundary regardless (stored data may predate validation).
|
|
41
|
+
*/
|
|
42
|
+
/** A `tile-link`'s target: a registered app action or a saved view — never a
|
|
43
|
+
* free URL (the client resolves targets to internal routes by design). */
|
|
44
|
+
export declare type TileLinkWidgetConfig = {
|
|
45
|
+
source: 'action';
|
|
46
|
+
actionId: string;
|
|
47
|
+
} | {
|
|
48
|
+
source: 'view';
|
|
49
|
+
viewId: string;
|
|
50
|
+
};
|
|
51
|
+
/** A `summary-list` renders the top matches of one saved view. */
|
|
52
|
+
export interface SummaryListWidgetConfig {
|
|
53
|
+
viewId: string;
|
|
54
|
+
}
|
|
55
|
+
/** A `heading`'s user-editable label — empty while freshly added. */
|
|
56
|
+
export interface HeadingWidgetConfig {
|
|
57
|
+
text: string;
|
|
58
|
+
}
|
|
59
|
+
/** The `hero`'s data source: the whole account's assets, or one saved view's
|
|
60
|
+
* matches. Always present on a stored hero (the kind shipped with it). */
|
|
61
|
+
export declare type HeroWidgetConfig = {
|
|
62
|
+
source: 'account';
|
|
63
|
+
} | {
|
|
64
|
+
source: 'view';
|
|
65
|
+
viewId: string;
|
|
66
|
+
};
|
|
33
67
|
/**
|
|
34
68
|
* A widget's cell on the Home grid: top-left position (`x`/`y`) and size
|
|
35
69
|
* (`w`/`h`), in grid units. The grid is 4 columns wide, so `x + w <= 4`, and
|
|
@@ -53,7 +87,7 @@ export interface HomeWidget {
|
|
|
53
87
|
type: HomeWidgetType;
|
|
54
88
|
/** Position + size on the 4-column grid. */
|
|
55
89
|
gridPos: HomeWidgetGridPos;
|
|
56
|
-
/** Widget-specific *behaviour* config (e.g. a saved-view id, a heading's text).
|
|
90
|
+
/** Widget-specific *behaviour* config (e.g. a saved-view id, a heading's text) — never geometry. Known keys are validated per kind (see the `*WidgetConfig` shapes); unknown keys pass through. */
|
|
57
91
|
config?: Record<string, unknown>;
|
|
58
92
|
}
|
|
59
93
|
export interface HomeLayout {
|
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
* A layout is a flat, ordered list of widgets, each pinned to a rect on a
|
|
9
9
|
* 4-column grid (`gridPos`). The widget `type` is a closed union (below): adding
|
|
10
10
|
* a new kind is a contract change + republish + client bump. Per-widget `config`
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* carries widget *behaviour* only (a saved-view id, an action id, a heading's
|
|
12
|
+
* text) — never geometry. Since 2026-07-30 the API validates each kind's KNOWN
|
|
13
|
+
* config keys on write (the per-kind `*WidgetConfig` shapes below) while
|
|
14
|
+
* tolerating unknown keys, so the client can still add config keys without an
|
|
15
|
+
* API deploy ordering — only changing a known key's meaning needs one.
|
|
14
16
|
*
|
|
15
17
|
* `version` discriminates stored layouts so the client can detect and
|
|
16
18
|
* reset/migrate an older one on read.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/users/home-layout/shared.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/users/home-layout/shared.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spotto/contract",
|
|
3
3
|
"license": "ISC",
|
|
4
|
-
"version": "1.0.70-alpha.
|
|
4
|
+
"version": "1.0.70-alpha.17",
|
|
5
5
|
"description": "Spotto's API Contract type definitions",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"files": [
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"@types/geojson": "^7946.0.11",
|
|
19
19
|
"shx": "^0.3.4"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "9b6226de3170566e74ebaaa51a55c0a8e646b5a8"
|
|
22
22
|
}
|