initiative-plugin-sdk 4.2.0 → 6.0.0
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 +129 -14
- package/dist/client.d.ts +31 -3
- package/dist/client.js +34 -1
- package/dist/client.js.map +1 -1
- package/dist/contract.d.ts +274 -19
- package/dist/contract.js +33 -7
- package/dist/contract.js.map +1 -1
- package/dist/define.d.ts +36 -12
- package/dist/define.js +9 -6
- package/dist/define.js.map +1 -1
- package/dist/jsx-dev-runtime.d.ts +2 -0
- package/dist/jsx-dev-runtime.js +3 -0
- package/dist/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx-runtime.d.ts +28 -0
- package/dist/jsx-runtime.js +20 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/manifest.d.ts +1 -1
- package/dist/manifest.js.map +1 -1
- package/dist/parts.d.ts +43 -0
- package/dist/parts.js +63 -0
- package/dist/parts.js.map +1 -0
- package/dist/plugin-api.generated.d.ts +1 -3
- package/dist/plugin-api.generated.js +1 -1
- package/dist/plugin-api.generated.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.js +16 -8
- package/dist/server.js.map +1 -1
- package/dist/tokens.d.ts +14 -4
- package/dist/tokens.js +29 -8
- package/dist/tokens.js.map +1 -1
- package/dist/validate.d.ts +4 -2
- package/dist/validate.js +89 -9
- package/dist/validate.js.map +1 -1
- package/manifest.contract.json +454 -18
- package/package.json +15 -3
- package/schemas/plugin-api.json +3 -36
- package/schemas/plugin-manifest.json +442 -9
package/dist/contract.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* from, and the shape of every object it defines, so this package's types
|
|
9
9
|
* cannot describe a manifest the schema refuses, nor miss a term it allows.
|
|
10
10
|
*/
|
|
11
|
-
export type Feature = "
|
|
11
|
+
export type Feature = "actions" | "dashboards" | "endpoints" | "fields" | "pages" | "parts" | "widgets";
|
|
12
12
|
export declare const FEATURES: readonly Feature[];
|
|
13
13
|
export type Protocol = 1;
|
|
14
14
|
export declare const PROTOCOLS: readonly Protocol[];
|
|
@@ -46,8 +46,14 @@ export type Scope = "projects:read" | "projects:write" | "files:read" | "files:w
|
|
|
46
46
|
export declare const SCOPES: readonly Scope[];
|
|
47
47
|
export type SurfaceScope = "community" | "initiative";
|
|
48
48
|
export declare const SURFACE_SCOPES: readonly SurfaceScope[];
|
|
49
|
-
export type
|
|
50
|
-
export declare const
|
|
49
|
+
export type PageCapability = "camera" | "clipboard-read" | "clipboard-write" | "display-capture" | "fullscreen" | "geolocation" | "microphone";
|
|
50
|
+
export declare const PAGE_CAPABILITIES: readonly PageCapability[];
|
|
51
|
+
export type ItemKind = "task" | "calendar_event" | "queue_item" | "counter" | "gallery_image" | "post";
|
|
52
|
+
export declare const ITEM_KINDS: readonly ItemKind[];
|
|
53
|
+
export type FieldKind = "text" | "number" | "date" | "datetime" | "link" | "badge" | "progress" | "checkbox";
|
|
54
|
+
export declare const FIELD_KINDS: readonly FieldKind[];
|
|
55
|
+
export type Tone = "accent" | "positive" | "negative" | "warning" | "neutral" | "muted";
|
|
56
|
+
export declare const TONES: readonly Tone[];
|
|
51
57
|
export type ListingKind = "plugin" | "dashboard";
|
|
52
58
|
export declare const LISTING_KINDS: readonly ListingKind[];
|
|
53
59
|
export type HttpMethod = "DELETE" | "GET" | "PATCH" | "POST" | "PUT";
|
|
@@ -78,8 +84,21 @@ export declare const CAPS: {
|
|
|
78
84
|
readonly endpoints: 64;
|
|
79
85
|
readonly paramsPerEndpoint: 12;
|
|
80
86
|
readonly returnsPerEndpoint: 24;
|
|
81
|
-
readonly
|
|
82
|
-
readonly
|
|
87
|
+
readonly pages: 12;
|
|
88
|
+
readonly pageCapabilities: 8;
|
|
89
|
+
readonly fields: 32;
|
|
90
|
+
readonly parts: 16;
|
|
91
|
+
readonly actions: 16;
|
|
92
|
+
readonly partNodes: 50;
|
|
93
|
+
readonly partDepth: 4;
|
|
94
|
+
readonly metadataKeyLength: 64;
|
|
95
|
+
readonly metadataValueBytes: 8192;
|
|
96
|
+
readonly metadataLookupLength: 255;
|
|
97
|
+
readonly metadataKeysPerObject: 32;
|
|
98
|
+
readonly metadataBytesPerObject: 65536;
|
|
99
|
+
readonly installMetadataKeys: 256;
|
|
100
|
+
readonly installMetadataBytes: 1048576;
|
|
101
|
+
readonly partsPlacedPerItem: 3;
|
|
83
102
|
readonly bundledDashboards: 8;
|
|
84
103
|
readonly dashboardWidgets: 50;
|
|
85
104
|
readonly dashboardGridColumns: 12;
|
|
@@ -116,7 +135,7 @@ export declare const CAPS: {
|
|
|
116
135
|
readonly hosts: 8;
|
|
117
136
|
readonly hostLength: 253;
|
|
118
137
|
readonly steps: 3;
|
|
119
|
-
readonly
|
|
138
|
+
readonly maxPages: 10;
|
|
120
139
|
readonly perPage: 100;
|
|
121
140
|
readonly requestQuery: 24;
|
|
122
141
|
readonly requestHeaders: 12;
|
|
@@ -147,6 +166,7 @@ export declare const CHARSETS: {
|
|
|
147
166
|
readonly version: "0123456789.-+abcdefghijklmnopqrstuvwxyz";
|
|
148
167
|
readonly artwork: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/._-";
|
|
149
168
|
readonly queryName: "-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ[]_abcdefghijklmnopqrstuvwxyz~";
|
|
169
|
+
readonly metadataKey: "._0123456789abcdefghijklmnopqrstuvwxyz";
|
|
150
170
|
};
|
|
151
171
|
/**
|
|
152
172
|
* Every field the contract declares, by the object that owns it.
|
|
@@ -173,7 +193,16 @@ export declare const FIELDS: {
|
|
|
173
193
|
readonly schedule: readonly ["id", "every"];
|
|
174
194
|
readonly endpoint: readonly ["id", "label", "description", "returns", "group", "needs_subject", "direction", "params", "actors", "admin_only", "public", "requires", "cache_ttl_seconds", "identity", "unavailable", "request", "steps", "map", "errors"];
|
|
175
195
|
readonly widget: readonly ["id", "meta", "module_source", "endpoints", "sample_data", "requires"];
|
|
176
|
-
readonly
|
|
196
|
+
readonly page: readonly ["id", "path", "name", "scopes", "admin_only", "capabilities", "requires"];
|
|
197
|
+
readonly field: readonly ["key", "name", "kind", "on", "description", "tone", "requires"];
|
|
198
|
+
readonly sectionNode: readonly ["type", "props", "children"];
|
|
199
|
+
readonly stackNode: readonly ["type", "props", "children"];
|
|
200
|
+
readonly fieldNode: readonly ["type", "props"];
|
|
201
|
+
readonly valueNode: readonly ["type", "props"];
|
|
202
|
+
readonly textNode: readonly ["type", "props"];
|
|
203
|
+
readonly buttonNode: readonly ["type", "props"];
|
|
204
|
+
readonly part: readonly ["id", "name", "on", "tree", "description", "requires"];
|
|
205
|
+
readonly action: readonly ["id", "name", "endpoint", "on", "confirm", "menu", "requires"];
|
|
177
206
|
readonly bundledDashboard: readonly ["uid", "public_id", "name", "description", "layout", "widgets"];
|
|
178
207
|
readonly bundledDashboardWidget: readonly ["id", "type", "title", "grid", "binding"];
|
|
179
208
|
readonly endpointIdentity: readonly ["kind", "key"];
|
|
@@ -190,7 +219,7 @@ export declare const FIELDS: {
|
|
|
190
219
|
readonly healthState: readonly ["status", "when", "state"];
|
|
191
220
|
readonly webhookEvent: readonly ["when", "emit", "map"];
|
|
192
221
|
readonly webhookStatus: readonly ["when", "connection", "state"];
|
|
193
|
-
readonly manifest: readonly ["plugin_kind", "service", "features", "default_name", "minimum_age", "min_plugin_api", "hosts", "auth", "vendor", "connections", "webhooks", "schedules", "endpoints", "community_summary", "widgets", "
|
|
222
|
+
readonly manifest: readonly ["plugin_kind", "service", "features", "default_name", "minimum_age", "min_plugin_api", "hosts", "auth", "vendor", "connections", "webhooks", "schedules", "endpoints", "community_summary", "widgets", "pages", "dashboards", "fields", "parts", "actions"];
|
|
194
223
|
};
|
|
195
224
|
export type Identifier = string;
|
|
196
225
|
/**
|
|
@@ -791,26 +820,232 @@ export interface Widget {
|
|
|
791
820
|
sample_data?: Record<string, unknown>;
|
|
792
821
|
requires?: Requires;
|
|
793
822
|
}
|
|
794
|
-
export interface
|
|
823
|
+
export interface Page {
|
|
795
824
|
id: Identifier;
|
|
796
825
|
path: Path;
|
|
797
826
|
name: LocalizedText;
|
|
798
827
|
/**
|
|
799
|
-
* Where the
|
|
800
|
-
*
|
|
828
|
+
* Where the page renders. Declaring both gives it a community-wide entry and
|
|
829
|
+
* an entry inside each initiative.
|
|
801
830
|
*/
|
|
802
831
|
scopes?: SurfaceScope[];
|
|
803
832
|
/**
|
|
804
|
-
* Only the community's admins open this
|
|
805
|
-
* allows — a settings page, say. Who else may open a
|
|
833
|
+
* Only the community's admins open this page, whatever roles a placement
|
|
834
|
+
* allows — a settings page, say. Who else may open a page is chosen in the
|
|
806
835
|
* community, per initiative and per role, not declared here.
|
|
807
836
|
*/
|
|
808
837
|
admin_only?: boolean;
|
|
809
838
|
/**
|
|
810
|
-
* Browser features the frame is granted. A
|
|
811
|
-
*
|
|
839
|
+
* Browser features the frame is granted. A page that names nothing is framed
|
|
840
|
+
* with all of them denied.
|
|
812
841
|
*/
|
|
813
|
-
capabilities?:
|
|
842
|
+
capabilities?: PageCapability[];
|
|
843
|
+
requires?: Requires;
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* A key the plug-in keeps a value under, on an item or on its own install: a
|
|
847
|
+
* lowercase letter, then lowercase letters, digits, '_' and '.'.
|
|
848
|
+
*/
|
|
849
|
+
export type MetadataKey = string;
|
|
850
|
+
/**
|
|
851
|
+
* How one of the plug-in's metadata keys is shown on Initiative's items. The
|
|
852
|
+
* plug-in keeps the value in Initiative, through its installation token;
|
|
853
|
+
* Initiative draws it with its own component for `kind` and computes its plain
|
|
854
|
+
* text itself, so a field filters, sorts and exports with no call to the
|
|
855
|
+
* plug-in. Which views show it is chosen by the community's managers, never by
|
|
856
|
+
* the plug-in. Initiative holds what is kept, and these caps are enforced there
|
|
857
|
+
* rather than here: a value of at most 8192 bytes as JSON, with a string of at
|
|
858
|
+
* most 255 characters to be found by; at most 32 keys and 65536 bytes on one
|
|
859
|
+
* item, and 256 keys and 1048576 bytes on the install.
|
|
860
|
+
*/
|
|
861
|
+
export interface Field {
|
|
862
|
+
/**
|
|
863
|
+
* The metadata key whose value this shows. Unique among this manifest's
|
|
864
|
+
* fields.
|
|
865
|
+
*/
|
|
866
|
+
key: MetadataKey;
|
|
867
|
+
/**
|
|
868
|
+
* The field's label.
|
|
869
|
+
*/
|
|
870
|
+
name: LocalizedText;
|
|
871
|
+
/**
|
|
872
|
+
* What the value is, and so how it is drawn: 'text' a string; 'number' a
|
|
873
|
+
* number; 'date' a 'YYYY-MM-DD' string; 'datetime' an ISO 8601 string with
|
|
874
|
+
* its offset; 'link' {url, text?}; 'badge' {text, tone?}; 'progress' {value,
|
|
875
|
+
* max}; 'checkbox' a boolean.
|
|
876
|
+
*/
|
|
877
|
+
kind: FieldKind;
|
|
878
|
+
/**
|
|
879
|
+
* The item kinds it is offered on.
|
|
880
|
+
*/
|
|
881
|
+
on: ItemKind[];
|
|
882
|
+
/**
|
|
883
|
+
* The one line the view editor's Add picker shows beside the name.
|
|
884
|
+
*/
|
|
885
|
+
description?: LocalizedText;
|
|
886
|
+
/**
|
|
887
|
+
* A badge's tone when its value names none.
|
|
888
|
+
*/
|
|
889
|
+
tone?: Tone;
|
|
890
|
+
requires?: Requires;
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* One node of a part: one of Initiative's own components, told apart by 'type',
|
|
894
|
+
* with its props and, for a section or a stack, the nodes inside it.
|
|
895
|
+
*/
|
|
896
|
+
export type PartNode = SectionNode | StackNode | FieldNode | ValueNode | TextNode | ButtonNode;
|
|
897
|
+
/**
|
|
898
|
+
* A titled group, which the reader may fold.
|
|
899
|
+
*/
|
|
900
|
+
export interface SectionNode {
|
|
901
|
+
type: "section";
|
|
902
|
+
props?: {
|
|
903
|
+
title?: LocalizedText;
|
|
904
|
+
/**
|
|
905
|
+
* Drawn folded until the reader opens it.
|
|
906
|
+
*/
|
|
907
|
+
collapsed?: boolean;
|
|
908
|
+
};
|
|
909
|
+
/**
|
|
910
|
+
* Drawn in order, inside this one.
|
|
911
|
+
*/
|
|
912
|
+
children?: PartNode[];
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* Nodes side by side or one above another.
|
|
916
|
+
*/
|
|
917
|
+
export interface StackNode {
|
|
918
|
+
type: "stack";
|
|
919
|
+
props?: {
|
|
920
|
+
direction?: "row" | "column";
|
|
921
|
+
/**
|
|
922
|
+
* The space between the nodes. Absent: Initiative's own.
|
|
923
|
+
*/
|
|
924
|
+
gap?: "none" | "small" | "medium" | "large";
|
|
925
|
+
/**
|
|
926
|
+
* A row runs onto a second line rather than past its edge.
|
|
927
|
+
*/
|
|
928
|
+
wrap?: boolean;
|
|
929
|
+
};
|
|
930
|
+
/**
|
|
931
|
+
* Drawn in order, inside this one.
|
|
932
|
+
*/
|
|
933
|
+
children?: PartNode[];
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* A field's label and its value.
|
|
937
|
+
*/
|
|
938
|
+
export interface FieldNode {
|
|
939
|
+
type: "field";
|
|
940
|
+
props: {
|
|
941
|
+
/**
|
|
942
|
+
* One of this manifest's fields, by its key, offered on every item kind the
|
|
943
|
+
* part is.
|
|
944
|
+
*/
|
|
945
|
+
field: MetadataKey;
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* A field's value alone.
|
|
950
|
+
*/
|
|
951
|
+
export interface ValueNode {
|
|
952
|
+
type: "value";
|
|
953
|
+
props: {
|
|
954
|
+
/**
|
|
955
|
+
* One of this manifest's fields, by its key, offered on every item kind the
|
|
956
|
+
* part is.
|
|
957
|
+
*/
|
|
958
|
+
field: MetadataKey;
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Words the plug-in wrote.
|
|
963
|
+
*/
|
|
964
|
+
export interface TextNode {
|
|
965
|
+
type: "text";
|
|
966
|
+
props: {
|
|
967
|
+
text: LocalizedText;
|
|
968
|
+
tone?: Tone;
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* A button that runs one of this plug-in's actions on the item, labelled with
|
|
973
|
+
* the action's name.
|
|
974
|
+
*/
|
|
975
|
+
export interface ButtonNode {
|
|
976
|
+
type: "button";
|
|
977
|
+
props: {
|
|
978
|
+
/**
|
|
979
|
+
* One of this manifest's actions, by its id, offered on every item kind the
|
|
980
|
+
* part is.
|
|
981
|
+
*/
|
|
982
|
+
action: Identifier;
|
|
983
|
+
variant?: "primary" | "secondary" | "ghost";
|
|
984
|
+
};
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* A piece of an item's page or view, built from Initiative's own components and
|
|
988
|
+
* bound to this plug-in's fields and actions. Data only: Initiative draws each
|
|
989
|
+
* node, and no plug-in code runs in the reader's browser. Which views show it
|
|
990
|
+
* is chosen by the community's managers, never by the plug-in, and Initiative
|
|
991
|
+
* places at most 3 of a plug-in's parts on one item.
|
|
992
|
+
*/
|
|
993
|
+
export interface Part {
|
|
994
|
+
/**
|
|
995
|
+
* Unique among this manifest's parts.
|
|
996
|
+
*/
|
|
997
|
+
id: Identifier;
|
|
998
|
+
/**
|
|
999
|
+
* What the view editor calls it.
|
|
1000
|
+
*/
|
|
1001
|
+
name: LocalizedText;
|
|
1002
|
+
/**
|
|
1003
|
+
* The item kinds it is offered on.
|
|
1004
|
+
*/
|
|
1005
|
+
on: ItemKind[];
|
|
1006
|
+
/**
|
|
1007
|
+
* What is drawn: at most 50 nodes, at most 4 deep.
|
|
1008
|
+
*/
|
|
1009
|
+
tree: PartNode;
|
|
1010
|
+
/**
|
|
1011
|
+
* The one line the view editor's Add picker shows beside the name.
|
|
1012
|
+
*/
|
|
1013
|
+
description?: LocalizedText;
|
|
1014
|
+
requires?: Requires;
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Something a reader runs on one item, from a part's button or the item's own
|
|
1018
|
+
* menu. Initiative only connects: it calls the write endpoint as the
|
|
1019
|
+
* installation, with the reader as 'viewer' and the item as 'subject' in the
|
|
1020
|
+
* call's token, and the endpoint does the work, usually writing the plug-in's
|
|
1021
|
+
* metadata. Initiative then answers the reader with the item's metadata as it
|
|
1022
|
+
* stands.
|
|
1023
|
+
*/
|
|
1024
|
+
export interface Action {
|
|
1025
|
+
/**
|
|
1026
|
+
* Unique among this manifest's actions.
|
|
1027
|
+
*/
|
|
1028
|
+
id: Identifier;
|
|
1029
|
+
/**
|
|
1030
|
+
* The button's or the menu entry's label.
|
|
1031
|
+
*/
|
|
1032
|
+
name: LocalizedText;
|
|
1033
|
+
/**
|
|
1034
|
+
* A write endpoint this manifest declares.
|
|
1035
|
+
*/
|
|
1036
|
+
endpoint: NamespacedId;
|
|
1037
|
+
/**
|
|
1038
|
+
* The item kinds it is offered on.
|
|
1039
|
+
*/
|
|
1040
|
+
on: ItemKind[];
|
|
1041
|
+
/**
|
|
1042
|
+
* A question Initiative asks before running it. Absent: it runs at once.
|
|
1043
|
+
*/
|
|
1044
|
+
confirm?: LocalizedText;
|
|
1045
|
+
/**
|
|
1046
|
+
* Also offered in the item's own menu.
|
|
1047
|
+
*/
|
|
1048
|
+
menu?: boolean;
|
|
814
1049
|
requires?: Requires;
|
|
815
1050
|
}
|
|
816
1051
|
export interface BundledDashboard {
|
|
@@ -1183,8 +1418,10 @@ export interface WebhookStatus {
|
|
|
1183
1418
|
* in both directions, UTF-8 byte-size caps, the rules tying a connection's flow
|
|
1184
1419
|
* and token to its scope and fields, what a webhooks block names, what a vendor
|
|
1185
1420
|
* setup writes to, whether every expression parses, what a declarative request
|
|
1186
|
-
* and its steps name,
|
|
1187
|
-
*
|
|
1421
|
+
* and its steps name, the bounds and unique ids of schedules, the unique keys
|
|
1422
|
+
* and ids of fields, parts and actions, what a part's nodes and an action name,
|
|
1423
|
+
* and a part's size and depth are enforced by the platform on publish and are
|
|
1424
|
+
* not expressible here.
|
|
1188
1425
|
*/
|
|
1189
1426
|
export interface Manifest {
|
|
1190
1427
|
/**
|
|
@@ -1270,11 +1507,29 @@ export interface Manifest {
|
|
|
1270
1507
|
*/
|
|
1271
1508
|
community_summary?: NamespacedId;
|
|
1272
1509
|
widgets?: Widget[];
|
|
1273
|
-
|
|
1510
|
+
pages?: Page[];
|
|
1274
1511
|
/**
|
|
1275
1512
|
* Ready-made arrangements of this plug-in's own widgets. Publishing the
|
|
1276
1513
|
* plug-in publishes one ordinary dashboard listing per entry, offered to
|
|
1277
1514
|
* communities that install the plug-in.
|
|
1278
1515
|
*/
|
|
1279
1516
|
dashboards?: BundledDashboard[];
|
|
1517
|
+
/**
|
|
1518
|
+
* How the plug-in's metadata is shown on items. A container plug-in's only: a
|
|
1519
|
+
* declarative plug-in holds no installation token, so it keeps no metadata to
|
|
1520
|
+
* show.
|
|
1521
|
+
*/
|
|
1522
|
+
fields?: Field[];
|
|
1523
|
+
/**
|
|
1524
|
+
* Pieces of items' pages and views, built from Initiative's components and
|
|
1525
|
+
* bound to the plug-in's fields and actions. A container plug-in's only, as
|
|
1526
|
+
* fields are.
|
|
1527
|
+
*/
|
|
1528
|
+
parts?: Part[];
|
|
1529
|
+
/**
|
|
1530
|
+
* What a reader may run on an item, each one of the plug-in's write
|
|
1531
|
+
* endpoints. A container plug-in's only: a declarative plug-in has no handler
|
|
1532
|
+
* to do an action's work.
|
|
1533
|
+
*/
|
|
1534
|
+
actions?: Action[];
|
|
1280
1535
|
}
|
package/dist/contract.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* from, and the shape of every object it defines, so this package's types
|
|
9
9
|
* cannot describe a manifest the schema refuses, nor miss a term it allows.
|
|
10
10
|
*/
|
|
11
|
-
export const FEATURES = ["
|
|
11
|
+
export const FEATURES = ["actions", "dashboards", "endpoints", "fields", "pages", "parts", "widgets"];
|
|
12
12
|
export const PROTOCOLS = [1];
|
|
13
13
|
export const CONNECTION_SCOPES = ["interactive", "static"];
|
|
14
14
|
export const FLOW_TYPES = ["oauth2"];
|
|
@@ -27,7 +27,10 @@ export const DIRECTIONS = ["emit", "read", "write"];
|
|
|
27
27
|
export const ACTOR_KINDS = ["installation", "member"];
|
|
28
28
|
export const SCOPES = ["projects:read", "projects:write", "files:read", "files:write", "queues:read", "queues:write", "counter_groups:read", "counter_groups:write", "calendars:read", "calendars:write", "dashboards:read", "dashboards:write", "posts:read", "posts:write", "galleries:read", "galleries:write", "wikis:read", "wikis:write", "comments:read", "comments:write", "relationships:read", "relationships:write", "tags:read", "tags:write", "properties:read", "properties:write", "sharing:read", "sharing:write", "members:read", "initiatives:read", "initiatives:moderate", "community:admin"];
|
|
29
29
|
export const SURFACE_SCOPES = ["community", "initiative"];
|
|
30
|
-
export const
|
|
30
|
+
export const PAGE_CAPABILITIES = ["camera", "clipboard-read", "clipboard-write", "display-capture", "fullscreen", "geolocation", "microphone"];
|
|
31
|
+
export const ITEM_KINDS = ["task", "calendar_event", "queue_item", "counter", "gallery_image", "post"];
|
|
32
|
+
export const FIELD_KINDS = ["text", "number", "date", "datetime", "link", "badge", "progress", "checkbox"];
|
|
33
|
+
export const TONES = ["accent", "positive", "negative", "warning", "neutral", "muted"];
|
|
31
34
|
export const LISTING_KINDS = ["plugin", "dashboard"];
|
|
32
35
|
export const HTTP_METHODS = ["DELETE", "GET", "PATCH", "POST", "PUT"];
|
|
33
36
|
export const PAGE_LIMITS = ["refuse", "truncate"];
|
|
@@ -52,8 +55,21 @@ export const CAPS = {
|
|
|
52
55
|
endpoints: 64,
|
|
53
56
|
paramsPerEndpoint: 12,
|
|
54
57
|
returnsPerEndpoint: 24,
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
pages: 12,
|
|
59
|
+
pageCapabilities: 8,
|
|
60
|
+
fields: 32,
|
|
61
|
+
parts: 16,
|
|
62
|
+
actions: 16,
|
|
63
|
+
partNodes: 50,
|
|
64
|
+
partDepth: 4,
|
|
65
|
+
metadataKeyLength: 64,
|
|
66
|
+
metadataValueBytes: 8192,
|
|
67
|
+
metadataLookupLength: 255,
|
|
68
|
+
metadataKeysPerObject: 32,
|
|
69
|
+
metadataBytesPerObject: 65536,
|
|
70
|
+
installMetadataKeys: 256,
|
|
71
|
+
installMetadataBytes: 1048576,
|
|
72
|
+
partsPlacedPerItem: 3,
|
|
57
73
|
bundledDashboards: 8,
|
|
58
74
|
dashboardWidgets: 50,
|
|
59
75
|
dashboardGridColumns: 12,
|
|
@@ -90,7 +106,7 @@ export const CAPS = {
|
|
|
90
106
|
hosts: 8,
|
|
91
107
|
hostLength: 253,
|
|
92
108
|
steps: 3,
|
|
93
|
-
|
|
109
|
+
maxPages: 10,
|
|
94
110
|
perPage: 100,
|
|
95
111
|
requestQuery: 24,
|
|
96
112
|
requestHeaders: 12,
|
|
@@ -121,6 +137,7 @@ export const CHARSETS = {
|
|
|
121
137
|
version: "0123456789.-+abcdefghijklmnopqrstuvwxyz",
|
|
122
138
|
artwork: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/._-",
|
|
123
139
|
queryName: "-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ[]_abcdefghijklmnopqrstuvwxyz~",
|
|
140
|
+
metadataKey: "._0123456789abcdefghijklmnopqrstuvwxyz",
|
|
124
141
|
};
|
|
125
142
|
/**
|
|
126
143
|
* Every field the contract declares, by the object that owns it.
|
|
@@ -147,7 +164,16 @@ export const FIELDS = {
|
|
|
147
164
|
schedule: ["id", "every"],
|
|
148
165
|
endpoint: ["id", "label", "description", "returns", "group", "needs_subject", "direction", "params", "actors", "admin_only", "public", "requires", "cache_ttl_seconds", "identity", "unavailable", "request", "steps", "map", "errors"],
|
|
149
166
|
widget: ["id", "meta", "module_source", "endpoints", "sample_data", "requires"],
|
|
150
|
-
|
|
167
|
+
page: ["id", "path", "name", "scopes", "admin_only", "capabilities", "requires"],
|
|
168
|
+
field: ["key", "name", "kind", "on", "description", "tone", "requires"],
|
|
169
|
+
sectionNode: ["type", "props", "children"],
|
|
170
|
+
stackNode: ["type", "props", "children"],
|
|
171
|
+
fieldNode: ["type", "props"],
|
|
172
|
+
valueNode: ["type", "props"],
|
|
173
|
+
textNode: ["type", "props"],
|
|
174
|
+
buttonNode: ["type", "props"],
|
|
175
|
+
part: ["id", "name", "on", "tree", "description", "requires"],
|
|
176
|
+
action: ["id", "name", "endpoint", "on", "confirm", "menu", "requires"],
|
|
151
177
|
bundledDashboard: ["uid", "public_id", "name", "description", "layout", "widgets"],
|
|
152
178
|
bundledDashboardWidget: ["id", "type", "title", "grid", "binding"],
|
|
153
179
|
endpointIdentity: ["kind", "key"],
|
|
@@ -164,6 +190,6 @@ export const FIELDS = {
|
|
|
164
190
|
healthState: ["status", "when", "state"],
|
|
165
191
|
webhookEvent: ["when", "emit", "map"],
|
|
166
192
|
webhookStatus: ["when", "connection", "state"],
|
|
167
|
-
manifest: ["plugin_kind", "service", "features", "default_name", "minimum_age", "min_plugin_api", "hosts", "auth", "vendor", "connections", "webhooks", "schedules", "endpoints", "community_summary", "widgets", "
|
|
193
|
+
manifest: ["plugin_kind", "service", "features", "default_name", "minimum_age", "min_plugin_api", "hosts", "auth", "vendor", "connections", "webhooks", "schedules", "endpoints", "community_summary", "widgets", "pages", "dashboards", "fields", "parts", "actions"],
|
|
168
194
|
};
|
|
169
195
|
//# sourceMappingURL=contract.js.map
|
package/dist/contract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,MAAM,CAAC,MAAM,QAAQ,GAAuB,CAAC,YAAY,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,MAAM,CAAC,MAAM,QAAQ,GAAuB,CAAC,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;AAG1H,MAAM,CAA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MAAM,EAAE,SAAS,CAAC;IAChC,gBAAgB,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,CAAC;IACxG,gBAAgB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,CAAC;IAC5D,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,CAAC;IAC7F,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;IACrC,YAAY,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,CAAC;IAChE,gBAAgB,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC;IAChD,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC;IACxC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC;IACrC,aAAa,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC;IAC9C,QAAQ,EAAE,CAAC,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,mBAAmB,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;CAC9P,CAAC"}
|
package/dist/define.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* One typed definition of a plug-in.
|
|
3
3
|
*
|
|
4
4
|
* {@link definePlugin} takes everything a plug-in declares and does: its endpoints
|
|
5
|
-
* with their handlers, its hooks and schedules, its widgets and
|
|
5
|
+
* with their handlers, its hooks and schedules, its widgets and pages, and
|
|
6
6
|
* its listing. The same object routes Initiative's calls (`createPlugin`) and
|
|
7
7
|
* becomes the manifest (`initiative-plugin build`), so nothing is stated twice.
|
|
8
8
|
*
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
*
|
|
18
18
|
* Endpoints are named by their key. The manifest id is `plugin.<publicId>.<key>`,
|
|
19
19
|
* and everywhere a definition refers to an endpoint (a widget, a sample, a
|
|
20
|
-
* parameter's `options_from`, a bundled dashboard, `communitySummary
|
|
21
|
-
* key.
|
|
20
|
+
* parameter's `options_from`, a bundled dashboard, `communitySummary`, an
|
|
21
|
+
* action) it uses the key.
|
|
22
22
|
*/
|
|
23
|
-
import type { ActorKind, PluginScope, BundledDashboard, BundledDashboardWidget, Connection,
|
|
23
|
+
import type { Action, ActorKind, PluginScope, BundledDashboard, BundledDashboardWidget, Connection, Page, Endpoint, EndpointParam, EndpointReturn, ErrorRule, Expression, Field, ItemKind, Manifest, Part, RequestStep, ReturnValueType, Scope, Vendor, VendorAuth, VendorRequest, WebhookEvent, Webhooks, Widget } from "./contract.js";
|
|
24
24
|
import type { Client } from "./client.js";
|
|
25
25
|
/**
|
|
26
26
|
* What every handler is handed as `context`: the value given to `createPlugin`.
|
|
@@ -72,6 +72,11 @@ export type Actor = {
|
|
|
72
72
|
kind: "member";
|
|
73
73
|
member: string;
|
|
74
74
|
};
|
|
75
|
+
/** One of Initiative's items, by its kind and id. */
|
|
76
|
+
export interface ItemRef {
|
|
77
|
+
type: ItemKind;
|
|
78
|
+
id: number;
|
|
79
|
+
}
|
|
75
80
|
/** What every handler is handed. */
|
|
76
81
|
export interface Call {
|
|
77
82
|
/** The installation: the community, by the reference this plug-in's install knows it by. */
|
|
@@ -92,6 +97,10 @@ export interface EndpointCall<P> extends Call {
|
|
|
92
97
|
initiative: number | null;
|
|
93
98
|
/** Connection id → the handle Initiative gives a token for, where the call depends on one. */
|
|
94
99
|
connections: Record<string, string>;
|
|
100
|
+
/** On a call one of the plug-in's actions made: the reader who ran it, by this installation's reference for them. */
|
|
101
|
+
viewer: string | null;
|
|
102
|
+
/** On a call one of the plug-in's actions made: the item it was run on. */
|
|
103
|
+
subject: ItemRef | null;
|
|
95
104
|
}
|
|
96
105
|
/** What a handler answers with. `actor` says whose credential ran it; absent, the call's actor. */
|
|
97
106
|
export interface Outcome<R> {
|
|
@@ -184,17 +193,17 @@ export interface ScheduleDeclaration {
|
|
|
184
193
|
every: `${number}${"m" | "h"}`;
|
|
185
194
|
run: (call: ScheduleCall) => Promise<void>;
|
|
186
195
|
}
|
|
187
|
-
/** A member opening one of the plug-in's
|
|
196
|
+
/** A member opening one of the plug-in's pages, as the handoff token names them. */
|
|
188
197
|
export interface Handoff extends Call {
|
|
189
|
-
|
|
198
|
+
page: string;
|
|
190
199
|
/** The member, by this installation's reference for them. */
|
|
191
200
|
viewer: string;
|
|
192
201
|
/** Whether the viewer administers the community. For shaping screens; not a grant. */
|
|
193
202
|
admin: boolean;
|
|
194
|
-
/** The initiative the
|
|
203
|
+
/** The initiative the page was opened in, or null for the whole community. */
|
|
195
204
|
initiative: number | null;
|
|
196
205
|
}
|
|
197
|
-
export interface
|
|
206
|
+
export interface PageCall {
|
|
198
207
|
request: Request;
|
|
199
208
|
/** Null for a request that carries no handoff token, such as the page's own files. */
|
|
200
209
|
handoff: Handoff | null;
|
|
@@ -204,14 +213,19 @@ export interface SurfaceCall {
|
|
|
204
213
|
* request under its path that carries a handoff token reaches the handler with
|
|
205
214
|
* the handoff verified.
|
|
206
215
|
*/
|
|
207
|
-
export interface
|
|
208
|
-
handler?: (call:
|
|
216
|
+
export interface PageDeclaration extends Omit<Page, "id"> {
|
|
217
|
+
handler?: (call: PageCall) => Promise<Response>;
|
|
209
218
|
}
|
|
210
219
|
type ReadName<E> = {
|
|
211
220
|
[K in keyof E]: E[K] extends {
|
|
212
221
|
direction: "read";
|
|
213
222
|
} ? K : never;
|
|
214
223
|
}[keyof E] & string;
|
|
224
|
+
type WriteName<E> = {
|
|
225
|
+
[K in keyof E]: E[K] extends {
|
|
226
|
+
direction: "write";
|
|
227
|
+
} ? K : never;
|
|
228
|
+
}[keyof E] & string;
|
|
215
229
|
type EmitName<E> = {
|
|
216
230
|
[K in keyof E]: E[K] extends {
|
|
217
231
|
direction: "emit";
|
|
@@ -240,6 +254,10 @@ export interface WidgetDeclaration<E> extends Omit<Widget, "id" | "module_source
|
|
|
240
254
|
[K in ReadName<E>]?: Result<ReturnsOf<E[K]>>;
|
|
241
255
|
};
|
|
242
256
|
}
|
|
257
|
+
/** Something a reader runs on one item. `endpoint` names a write endpoint by its key. */
|
|
258
|
+
export interface ActionDeclaration<E> extends Omit<Action, "id" | "endpoint"> {
|
|
259
|
+
endpoint: WriteName<E>;
|
|
260
|
+
}
|
|
243
261
|
export interface DashboardDeclaration<E, W> extends Omit<BundledDashboard, "widgets"> {
|
|
244
262
|
widgets: Array<Omit<BundledDashboardWidget, "type" | "binding"> & {
|
|
245
263
|
type: keyof W & string;
|
|
@@ -320,9 +338,15 @@ export interface PluginDefinition<E, W> {
|
|
|
320
338
|
communitySummary?: ReadName<E>;
|
|
321
339
|
hooks?: Hooks;
|
|
322
340
|
widgets?: W;
|
|
323
|
-
/** Pages and panels, keyed by
|
|
324
|
-
|
|
341
|
+
/** Pages and panels, keyed by page id. */
|
|
342
|
+
pages?: Record<string, PageDeclaration>;
|
|
325
343
|
dashboards?: DashboardDeclaration<E, W>[];
|
|
344
|
+
/** How the plug-in's metadata is shown on items, keyed by metadata key. */
|
|
345
|
+
fields?: Record<string, Omit<Field, "key">>;
|
|
346
|
+
/** Pieces of items' pages and views, keyed by part id. A `tree` may be written as JSX (`initiative-plugin-sdk/parts`). */
|
|
347
|
+
parts?: Record<string, Omit<Part, "id">>;
|
|
348
|
+
/** What a reader may run on an item, keyed by action id. */
|
|
349
|
+
actions?: Record<string, ActionDeclaration<E>>;
|
|
326
350
|
listing?: ListingDeclaration;
|
|
327
351
|
}
|
|
328
352
|
/** Any plug-in's definition, as the server and the build read it. */
|
package/dist/define.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* One typed definition of a plug-in.
|
|
3
3
|
*
|
|
4
4
|
* {@link definePlugin} takes everything a plug-in declares and does: its endpoints
|
|
5
|
-
* with their handlers, its hooks and schedules, its widgets and
|
|
5
|
+
* with their handlers, its hooks and schedules, its widgets and pages, and
|
|
6
6
|
* its listing. The same object routes Initiative's calls (`createPlugin`) and
|
|
7
7
|
* becomes the manifest (`initiative-plugin build`), so nothing is stated twice.
|
|
8
8
|
*
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
*
|
|
18
18
|
* Endpoints are named by their key. The manifest id is `plugin.<publicId>.<key>`,
|
|
19
19
|
* and everywhere a definition refers to an endpoint (a widget, a sample, a
|
|
20
|
-
* parameter's `options_from`, a bundled dashboard, `communitySummary
|
|
21
|
-
* key.
|
|
20
|
+
* parameter's `options_from`, a bundled dashboard, `communitySummary`, an
|
|
21
|
+
* action) it uses the key.
|
|
22
22
|
*/
|
|
23
23
|
import { FEATURES } from "./contract.js";
|
|
24
24
|
export function defineEndpoint(endpoint) {
|
|
@@ -51,9 +51,9 @@ export function manifestOf(plugin, modules = {}) {
|
|
|
51
51
|
endpoints: listOf(plugin.endpoints, (key, endpoint) => endpointOf(id(key), endpoint, id)),
|
|
52
52
|
community_summary: plugin.communitySummary === undefined ? undefined : id(plugin.communitySummary),
|
|
53
53
|
widgets: listOf(plugin.widgets, (key, widget) => widgetOf(key, widget, modules[key] ?? "", id)),
|
|
54
|
-
|
|
55
|
-
const { handler: _handler, ...
|
|
56
|
-
return { id: key, ...
|
|
54
|
+
pages: listOf(plugin.pages, (key, page) => {
|
|
55
|
+
const { handler: _handler, ...declared } = page;
|
|
56
|
+
return { id: key, ...declared };
|
|
57
57
|
}),
|
|
58
58
|
dashboards: plugin.dashboards?.map((dashboard) => ({
|
|
59
59
|
...dashboard,
|
|
@@ -62,6 +62,9 @@ export function manifestOf(plugin, modules = {}) {
|
|
|
62
62
|
binding: { ...widget.binding, endpoint_id: id(widget.binding.endpoint_id) },
|
|
63
63
|
})),
|
|
64
64
|
})),
|
|
65
|
+
fields: listOf(plugin.fields, (key, field) => ({ key, ...field })),
|
|
66
|
+
parts: listOf(plugin.parts, (key, part) => ({ id: key, ...part })),
|
|
67
|
+
actions: listOf(plugin.actions, (key, action) => ({ id: key, ...action, endpoint: id(action.endpoint) })),
|
|
65
68
|
};
|
|
66
69
|
const present = Object.fromEntries(Object.entries(blocks).filter(([, value]) => value !== undefined));
|
|
67
70
|
return {
|