sample-piral 0.14.29 → 0.15.0-beta.4466

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/app/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import * as ReactRouter from 'react-router';
3
- import * as LibreAtom from '@libre/atom';
4
3
 
5
4
  declare module "sample-piral" {
6
5
  /**
@@ -40,7 +39,7 @@ declare module "sample-piral" {
40
39
  /**
41
40
  * Custom Pilet API parts defined outside of piral-core.
42
41
  */
43
- export interface PiletCustomApi extends PiletLocaleApi, PiletDashboardApi, PiletMenuApi, PiletNotificationsApi, PiletModalsApi, PiletFeedsApi, PiletSearchApi, PiralAuthApi {}
42
+ export interface PiletCustomApi extends PiletLocaleApi, PiletDashboardApi, PiletMenuApi, PiletNotificationsApi, PiletModalsApi, PiletFeedsApi, PiletSearchApi, PiletAuthApi {}
44
43
 
45
44
  /**
46
45
  * Defines the Pilet API from piral-core.
@@ -106,9 +105,47 @@ declare module "sample-piral" {
106
105
  }
107
106
 
108
107
  /**
109
- * Describes the metadata transported by a pilet.
108
+ * Describes the metadata of a pilet available in its API.
110
109
  */
111
- export type PiletMetadata = (SinglePiletMetadata | MultiPiletMetadata) & PiletRuntimeMetadata;
110
+ export interface PiletMetadata {
111
+ /**
112
+ * The name of the pilet, i.e., the package id.
113
+ */
114
+ name: string;
115
+ /**
116
+ * The version of the pilet. Should be semantically versioned.
117
+ */
118
+ version: string;
119
+ /**
120
+ * Provides the version of the specification for this pilet.
121
+ */
122
+ spec: string;
123
+ /**
124
+ * Provides some custom metadata for the pilet.
125
+ */
126
+ custom?: any;
127
+ /**
128
+ * Optionally indicates the global require reference, if any.
129
+ */
130
+ requireRef?: string;
131
+ /**
132
+ * Additional shared dependencies from the pilet.
133
+ */
134
+ dependencies: Record<string, string>;
135
+ /**
136
+ * Provides some configuration to be used in the pilet.
137
+ */
138
+ config: Record<string, any>;
139
+ /**
140
+ * The URL of the main script of the pilet.
141
+ */
142
+ link: string;
143
+ /**
144
+ * The base path to the pilet. Can be used to make resource requests
145
+ * and override the public path.
146
+ */
147
+ basePath: string;
148
+ }
112
149
 
113
150
  /**
114
151
  * Listener for Piral app shell events.
@@ -272,7 +309,7 @@ declare module "sample-piral" {
272
309
  unregisterSearchProvider(name: string): void;
273
310
  }
274
311
 
275
- export interface PiralAuthApi {
312
+ export interface PiletAuthApi {
276
313
  /**
277
314
  * Gets the currently authenticated user, if any.
278
315
  */
@@ -309,7 +346,7 @@ declare module "sample-piral" {
309
346
  /**
310
347
  * The meta data registered for a page.
311
348
  */
312
- export interface PiralPageMeta extends PiralCustomPageMeta {}
349
+ export interface PiralPageMeta extends PiralCustomPageMeta, PiralCustomPageMeta {}
313
350
 
314
351
  /**
315
352
  * The shape of an implicit unregister function.
@@ -340,23 +377,6 @@ declare module "sample-piral" {
340
377
  (): void;
341
378
  }
342
379
 
343
- /**
344
- * The metadata response for a single pilet.
345
- */
346
- export type SinglePiletMetadata = PiletMetadataV0 | PiletMetadataV1 | PiletMetadataV2 | PiletMetadataVx;
347
-
348
- /**
349
- * The metadata response for a multi pilet.
350
- */
351
- export type MultiPiletMetadata = PiletMetadataBundle;
352
-
353
- /**
354
- * Additional metadata that may be added to the runtime information.
355
- */
356
- export interface PiletRuntimeMetadata {
357
- basePath?: string;
358
- }
359
-
360
380
  /**
361
381
  * Custom events defined outside of piral-core.
362
382
  */
@@ -651,158 +671,6 @@ declare module "sample-piral" {
651
671
  name: TName;
652
672
  }
653
673
 
654
- /**
655
- * Metadata for pilets using the v0 schema.
656
- */
657
- export type PiletMetadataV0 = PiletMetadataV0Content | PiletMetadataV0Link;
658
-
659
- /**
660
- * Metadata for pilets using the v1 schema.
661
- */
662
- export interface PiletMetadataV1 {
663
- /**
664
- * The name of the pilet, i.e., the package id.
665
- */
666
- name: string;
667
- /**
668
- * The version of the pilet. Should be semantically versioned.
669
- */
670
- version: string;
671
- /**
672
- * Optionally provides the version of the specification for this pilet.
673
- */
674
- spec?: "v1";
675
- /**
676
- * The link for retrieving the content of the pilet.
677
- */
678
- link: string;
679
- /**
680
- * The reference name for the global require.
681
- */
682
- requireRef: string;
683
- /**
684
- * The computed integrity of the pilet. Will be used to set the
685
- * integrity value of the script.
686
- */
687
- integrity?: string;
688
- /**
689
- * Optionally provides some custom metadata for the pilet.
690
- */
691
- custom?: any;
692
- /**
693
- * Optionally provides some configuration to be used in the pilet.
694
- */
695
- config?: Record<string, any>;
696
- /**
697
- * Additional shared dependency script files.
698
- */
699
- dependencies?: Record<string, string>;
700
- }
701
-
702
- /**
703
- * Metadata for pilets using the v2 schema.
704
- */
705
- export interface PiletMetadataV2 {
706
- /**
707
- * The name of the pilet, i.e., the package id.
708
- */
709
- name: string;
710
- /**
711
- * The version of the pilet. Should be semantically versioned.
712
- */
713
- version: string;
714
- /**
715
- * Provides the version of the specification for this pilet.
716
- */
717
- spec: "v2";
718
- /**
719
- * The reference name for the global require.
720
- */
721
- requireRef: string;
722
- /**
723
- * The computed integrity of the pilet.
724
- */
725
- integrity?: string;
726
- /**
727
- * The link for retrieving the content of the pilet.
728
- */
729
- link: string;
730
- /**
731
- * Optionally provides some custom metadata for the pilet.
732
- */
733
- custom?: any;
734
- /**
735
- * Optionally provides some configuration to be used in the pilet.
736
- */
737
- config?: Record<string, any>;
738
- /**
739
- * Additional shared dependency script files.
740
- */
741
- dependencies?: Record<string, string>;
742
- }
743
-
744
- export interface PiletMetadataVx {
745
- /**
746
- * The name of the pilet, i.e., the package id.
747
- */
748
- name: string;
749
- /**
750
- * The version of the pilet. Should be semantically versioned.
751
- */
752
- version: string;
753
- /**
754
- * Provides an identifier for the custom specification.
755
- */
756
- spec: string;
757
- /**
758
- * Optionally provides some custom metadata for the pilet.
759
- */
760
- custom?: any;
761
- /**
762
- * Optionally provides some configuration to be used in the pilet.
763
- */
764
- config?: Record<string, any>;
765
- /**
766
- * Additional shared dependency script files.
767
- */
768
- dependencies?: Record<string, string>;
769
- }
770
-
771
- /**
772
- * Metadata for pilets using the bundle schema.
773
- */
774
- export interface PiletMetadataBundle {
775
- /**
776
- * The name of the bundle pilet, i.e., the package id.
777
- */
778
- name?: string;
779
- /**
780
- * Optionally provides the version of the specification for this pilet.
781
- */
782
- spec?: "v1";
783
- /**
784
- * The link for retrieving the bundle content of the pilet.
785
- */
786
- link: string;
787
- /**
788
- * The reference name for the global bundle-shared require.
789
- */
790
- bundle: string;
791
- /**
792
- * The computed integrity of the pilet. Will be used to set the
793
- * integrity value of the script.
794
- */
795
- integrity?: string;
796
- /**
797
- * Optionally provides some custom metadata for the pilet.
798
- */
799
- custom?: any;
800
- /**
801
- * Additional shared dependency script files.
802
- */
803
- dependencies?: Record<string, string>;
804
- }
805
-
806
674
  export interface PiralSelectLanguageEvent {
807
675
  /**
808
676
  * Gets the previously selected language.
@@ -988,34 +856,6 @@ declare module "sample-piral" {
988
856
  defaults: any;
989
857
  }
990
858
 
991
- /**
992
- * Metadata for pilets using the v0 schema with a content.
993
- */
994
- export interface PiletMetadataV0Content extends PiletMetadataV0Base {
995
- /**
996
- * The content of the pilet. If the content is not available
997
- * the link will be used (unless caching has been activated).
998
- */
999
- content: string;
1000
- /**
1001
- * If available indicates that the pilet should not be cached.
1002
- * In case of a string this is interpreted as the expiration time
1003
- * of the cache. In case of an accurate hash this should not be
1004
- * required or set.
1005
- */
1006
- noCache?: boolean | string;
1007
- }
1008
-
1009
- /**
1010
- * Metadata for pilets using the v0 schema with a link.
1011
- */
1012
- export interface PiletMetadataV0Link extends PiletMetadataV0Base {
1013
- /**
1014
- * The link for retrieving the content of the pilet.
1015
- */
1016
- link: string;
1017
- }
1018
-
1019
859
  export type StandardMenuType = "general" | "admin" | "user" | "header" | "footer";
1020
860
 
1021
861
  export interface PiralCustomMenuTypes {}
@@ -1030,9 +870,8 @@ declare module "sample-piral" {
1030
870
  * The context to be transported into the generic components.
1031
871
  */
1032
872
  export interface ComponentContext {
1033
- router: ReactRouter.RouteComponentProps;
1034
- state: LibreAtom.Atom<GlobalState>;
1035
- readState: PiralActions["readState"];
873
+ navigation: NavigationApi;
874
+ publicPath: string;
1036
875
  }
1037
876
 
1038
877
  /**
@@ -1045,1247 +884,94 @@ declare module "sample-piral" {
1045
884
  pilet: string;
1046
885
  }
1047
886
 
1048
- export type WrappedComponent<TProps> = React.ComponentType<Without<TProps, keyof BaseComponentProps>>;
887
+ export type WrappedComponent<TProps> = React.ComponentType<React.PropsWithChildren<Without<TProps, keyof BaseComponentProps>>>;
1049
888
 
1050
- /**
1051
- * Basic metadata for pilets using the v0 schema.
1052
- */
1053
- export interface PiletMetadataV0Base {
1054
- /**
1055
- * The name of the pilet, i.e., the package id.
1056
- */
1057
- name: string;
1058
- /**
1059
- * The version of the pilet. Should be semantically versioned.
1060
- */
1061
- version: string;
889
+ export interface NavigationApi {
1062
890
  /**
1063
- * Optionally provides the version of the specification for this pilet.
891
+ * Pushes a new location onto the history stack.
1064
892
  */
1065
- spec?: "v0";
893
+ push(target: string, state?: any): void;
1066
894
  /**
1067
- * The computed hash value of the pilet's content. Should be
1068
- * accurate to allow caching.
895
+ * Replaces the current location with another.
1069
896
  */
1070
- hash: string;
897
+ replace(target: string, state?: any): void;
1071
898
  /**
1072
- * Optionally provides some custom metadata for the pilet.
899
+ * Changes the current index in the history stack by a given delta.
1073
900
  */
1074
- custom?: any;
901
+ go(n: number): void;
1075
902
  /**
1076
- * Optionally provides some configuration to be used in the pilet.
903
+ * Prevents changes to the history stack from happening.
904
+ * This is useful when you want to prevent the user navigating
905
+ * away from the current page, for example when they have some
906
+ * unsaved data on the current page.
907
+ * @param blocker The function being called with a transition request.
908
+ * @returns The disposable for stopping the block.
1077
909
  */
1078
- config?: Record<string, any>;
910
+ block(blocker: NavigationBlocker): Disposable;
1079
911
  /**
1080
- * Additional shared dependency script files.
912
+ * Starts listening for location changes and calls the given
913
+ * callback with an Update when it does.
914
+ * @param listener The function being called when the route changes.
915
+ * @returns The disposable for stopping the block.
1081
916
  */
1082
- dependencies?: Record<string, string>;
917
+ listen(listener: NavigationListener): Disposable;
1083
918
  }
1084
919
 
1085
- /**
1086
- * The Piral global app state container.
1087
- */
1088
- export interface GlobalState extends PiralCustomState {
1089
- /**
1090
- * The relevant state for the app itself.
1091
- */
1092
- app: AppState;
1093
- /**
1094
- * The relevant state for rendering errors of the app.
1095
- */
1096
- errorComponents: ErrorComponentsState;
1097
- /**
1098
- * The relevant state for rendering parts of the app.
1099
- */
1100
- components: ComponentsState;
1101
- /**
1102
- * The relevant state for the registered components.
1103
- */
1104
- registry: RegistryState;
1105
- /**
1106
- * Gets the loaded modules.
1107
- */
1108
- modules: Array<PiletMetadata>;
1109
- /**
1110
- * The foreign component portals to render.
1111
- */
1112
- portals: Record<string, Array<React.ReactPortal>>;
1113
- /**
1114
- * The application's shared data.
1115
- */
1116
- data: Dict<SharedDataItem>;
1117
- /**
1118
- * The used (exact) application routes.
1119
- */
1120
- routes: Dict<React.ComponentType<ReactRouter.RouteComponentProps<any>>>;
1121
- /**
1122
- * The current provider.
1123
- */
1124
- provider?: React.ComponentType;
920
+ export type Without<T, K> = Pick<T, Exclude<keyof T, K>>;
921
+
922
+ export interface NavigationBlocker {
923
+ (tx: NavigationTransition): void;
1125
924
  }
1126
925
 
1127
- /**
1128
- * The globally defined actions.
1129
- */
1130
- export interface PiralActions extends PiralCustomActions {
1131
- /**
1132
- * Initializes the application shell.
1133
- * @param loading The current loading state.
1134
- * @param error The application error, if any.
1135
- * @param modules The loaded pilets.
1136
- */
1137
- initialize(loading: boolean, error: Error | undefined, modules: Array<Pilet>): void;
1138
- /**
1139
- * Injects a pilet at runtime - removes the pilet from registry first if available.
1140
- * @param pilet The pilet to be injected.
1141
- */
1142
- injectPilet(pilet: Pilet): void;
1143
- /**
1144
- * Defines a single action for Piral.
1145
- * @param actionName The name of the action to define.
1146
- * @param action The action to include.
1147
- */
1148
- defineAction<T extends keyof PiralActions>(actionName: T, action: PiralAction<PiralActions[T]>): void;
1149
- /**
1150
- * Defines a set of actions for Piral.
1151
- * @param actions The actions to define.
1152
- */
1153
- defineActions(actions: PiralDefineActions): void;
1154
- /**
1155
- * Reads the value of a shared data item.
1156
- * @param name The name of the shared item.
1157
- */
1158
- readDataValue(name: string): any;
1159
- /**
1160
- * Tries to write a shared data item. The write access is only
1161
- * possible if the name belongs to the provided owner or has not
1162
- * been taken yet.
1163
- * Setting the value to null will release it.
1164
- * @param name The name of the shared data item.
1165
- * @param value The value of the shared data item.
1166
- * @param owner The owner of the shared data item.
1167
- * @param target The target storage locatation.
1168
- * @param expiration The time for when to dispose the shared item.
1169
- */
1170
- tryWriteDataItem(name: string, value: any, owner: string, target: DataStoreTarget, expiration: number): boolean;
1171
- /**
1172
- * Performs a layout change.
1173
- * @param current The layout to take.
1174
- */
1175
- changeLayout(current: LayoutType): void;
1176
- /**
1177
- * Registers a new route to be resolved.
1178
- * @param route The route to register.
1179
- * @param value The page to be rendered on the route.
1180
- */
1181
- registerPage(route: string, value: PageRegistration): void;
1182
- /**
1183
- * Unregisters an existing route.
1184
- * @param route The route to be removed.
1185
- */
1186
- unregisterPage(route: string): void;
1187
- /**
1188
- * Registers a new extension.
1189
- * @param name The name of the extension category.
1190
- * @param value The extension registration.
1191
- */
1192
- registerExtension(name: string, value: ExtensionRegistration): void;
1193
- /**
1194
- * Unregisters an existing extension.
1195
- * @param name The name of the extension category.
1196
- * @param value The extension that will be removed.
1197
- */
1198
- unregisterExtension(name: string, reference: any): void;
1199
- /**
1200
- * Sets the common component to render.
1201
- * @param name The name of the component.
1202
- * @param component The component to use for rendering.
1203
- */
1204
- setComponent<TKey extends keyof ComponentsState>(name: TKey, component: ComponentsState[TKey]): void;
1205
- /**
1206
- * Sets the error component to render.
1207
- * @param type The type of the error.
1208
- * @param component The component to use for rendering.
1209
- */
1210
- setErrorComponent<TKey extends keyof ErrorComponentsState>(type: TKey, component: ErrorComponentsState[TKey]): void;
1211
- /**
1212
- * Sets the common routes to render.
1213
- * @param path The name of the component.
1214
- * @param component The component to use for rendering.
1215
- */
1216
- setRoute<T = {}>(path: string, component: React.ComponentType<ReactRouter.RouteComponentProps<T>>): void;
1217
- /**
1218
- * Includes a new provider as a sub-provider to the current provider.
1219
- * @param provider The provider to include.
1220
- */
1221
- includeProvider(provider: JSX.Element): void;
1222
- /**
1223
- * Destroys (i.e., resets) the given portal instance.
1224
- * @param id The id of the portal to destroy.
1225
- */
1226
- destroyPortal(id: string): void;
1227
- /**
1228
- * Includes the provided portal in the rendering pipeline.
1229
- * @param id The id of the portal to use.
1230
- * @param entry The child to render.
1231
- */
1232
- showPortal(id: string, entry: React.ReactPortal): void;
1233
- /**
1234
- * Hides the provided portal in the rendering pipeline.
1235
- * @param id The id of the portal to use.
1236
- * @param entry The child to remove.
1237
- */
1238
- hidePortal(id: string, entry: React.ReactPortal): void;
1239
- /**
1240
- * Updates the provided portal in the rendering pipeline.
1241
- * @param id The id of the portal to use.
1242
- * @param current The currently displayed child.
1243
- * @param next The updated child that should be displayed.
1244
- */
1245
- updatePortal(id: string, current: React.ReactPortal, next: React.ReactPortal): void;
1246
- /**
1247
- * Dispatches a state change.
1248
- * @param update The update function creating a new state.
1249
- */
1250
- dispatch(update: (state: GlobalState) => GlobalState): void;
1251
- /**
1252
- * Reads the selected part of the global state.
1253
- * @param select The selector for getting the desired part.
1254
- * @returns The desired part.
1255
- */
1256
- readState<S>(select: (state: GlobalState) => S): S;
926
+ export interface NavigationListener {
927
+ (update: NavigationUpdate): void;
1257
928
  }
1258
929
 
1259
- export type Without<T, K> = Pick<T, Exclude<keyof T, K>>;
930
+ export interface NavigationTransition extends NavigationUpdate {
931
+ retry(): void;
932
+ }
1260
933
 
1261
- /**
1262
- * Custom state extensions defined outside of piral-core.
1263
- */
1264
- export interface PiralCustomState {
1265
- /**
1266
- * Information for the language display.
1267
- */
1268
- language: {
1269
- /**
1270
- * Gets if languages are currently loading.
1271
- */
1272
- loading: boolean;
1273
- /**
1274
- * The selected, i.e., active, language.
1275
- */
1276
- selected: string;
1277
- /**
1278
- * The available languages.
1279
- */
1280
- available: Array<string>;
1281
- };
1282
- /**
1283
- * The currently open notifications.
1284
- */
1285
- notifications: Array<OpenNotification>;
1286
- /**
1287
- * The currently open modal dialogs.
1288
- */
1289
- modals: Array<OpenModalDialog>;
1290
- /**
1291
- * The relevant state for the registered feeds.
1292
- */
1293
- feeds: FeedsState;
934
+ export interface NavigationUpdate {
935
+ action: NavigationAction;
936
+ location: NavigationLocation;
937
+ }
938
+
939
+ export type NavigationAction = "POP" | "PUSH" | "REPLACE";
940
+
941
+ export interface NavigationLocation {
1294
942
  /**
1295
- * The relevant state for the in-site search.
943
+ * The fully qualified URL incl. the origin and base path.
1296
944
  */
1297
- search: SearchState;
945
+ href: string;
1298
946
  /**
1299
- * The currently authenticated user, if any.
947
+ * The location.pathname property is a string that contains an initial "/"
948
+ * followed by the remainder of the URL up to the ?.
1300
949
  */
1301
- user: UserInfo | undefined;
1302
- }
1303
-
1304
- /**
1305
- * The Piral global app sub-state container for app information.
1306
- */
1307
- export interface AppState {
950
+ pathname: string;
1308
951
  /**
1309
- * Information for the layout computation.
952
+ * The location.search property is a string that contains an initial "?"
953
+ * followed by the key=value pairs in the query string. If there are no
954
+ * parameters, this value may be the empty string (i.e. '').
1310
955
  */
1311
- layout: LayoutType;
956
+ search: string;
1312
957
  /**
1313
- * Gets if the application is currently performing a background loading
1314
- * activity, e.g., for loading modules asynchronously or fetching
1315
- * translations.
958
+ * The location.hash property is a string that contains an initial "#"
959
+ * followed by fragment identifier of the URL. If there is no fragment
960
+ * identifier, this value may be the empty string (i.e. '').
1316
961
  */
1317
- loading: boolean;
962
+ hash: string;
1318
963
  /**
1319
- * Gets an unrecoverable application error, if any.
964
+ * The location.state property is a user-supplied State object that is
965
+ * associated with this location. This can be a useful place to store
966
+ * any information you do not want to put in the URL, e.g. session-specific
967
+ * data.
1320
968
  */
1321
- error: Error | undefined;
969
+ state: unknown;
1322
970
  /**
1323
- * Gets the public path of the application.
971
+ * The location.key property is a unique string associated with this location.
972
+ * On the initial location, this will be the string default. On all subsequent
973
+ * locations, this string will be a unique identifier.
1324
974
  */
1325
- publicPath: string;
1326
- }
1327
-
1328
- export type ErrorComponentsState = {
1329
- [P in keyof Errors]?: React.ComponentType<Errors[P]>;
1330
- };
1331
-
1332
- /**
1333
- * The Piral global app sub-state container for shared components.
1334
- */
1335
- export interface ComponentsState extends PiralCustomComponentsState {
1336
- /**
1337
- * The loading indicator renderer.
1338
- */
1339
- LoadingIndicator: React.ComponentType<LoadingIndicatorProps>;
1340
- /**
1341
- * The error renderer.
1342
- */
1343
- ErrorInfo: React.ComponentType<ErrorInfoProps>;
1344
- /**
1345
- * The router context.
1346
- */
1347
- Router: React.ComponentType<RouterProps>;
1348
- /**
1349
- * The layout used for pages.
1350
- */
1351
- Layout: React.ComponentType<LayoutProps>;
1352
- /**
1353
- * The route switch used for determining the route registration.
1354
- */
1355
- RouteSwitch: React.ComponentType<RouteSwitchProps>;
1356
- /**
1357
- * A component that can be used for debugging purposes.
1358
- */
1359
- Debug?: React.ComponentType;
1360
- }
1361
-
1362
- /**
1363
- * The Piral global app sub-state container for component registrations.
1364
- */
1365
- export interface RegistryState extends PiralCustomRegistryState {
1366
- /**
1367
- * The registered page components for the router.
1368
- */
1369
- pages: Dict<PageRegistration>;
1370
- /**
1371
- * The registered extension components for extension slots.
1372
- */
1373
- extensions: Dict<Array<ExtensionRegistration>>;
1374
- /**
1375
- * The registered wrappers for any component.
1376
- */
1377
- wrappers: Dict<React.ComponentType<any>>;
1378
- }
1379
-
1380
- export type Dict<T> = Record<string, T>;
1381
-
1382
- /**
1383
- * Defines the shape of a shared data item.
1384
- */
1385
- export interface SharedDataItem<TValue = any> {
1386
- /**
1387
- * Gets the associated value.
1388
- */
1389
- value: TValue;
1390
- /**
1391
- * Gets the owner of the item.
1392
- */
1393
- owner: string;
1394
- /**
1395
- * Gets the storage location.
1396
- */
1397
- target: DataStoreTarget;
1398
- /**
1399
- * Gets the expiration of the item.
1400
- */
1401
- expires: number;
1402
- }
1403
-
1404
- /**
1405
- * Custom actions defined outside of piral-core.
1406
- */
1407
- export interface PiralCustomActions {
1408
- /**
1409
- * Changes the selected language.
1410
- * @param selected The selected language.
1411
- */
1412
- selectLanguage(selected: string): void;
1413
- /**
1414
- * Gets the translation for the given key at the current
1415
- * language.
1416
- */
1417
- translate(tag: string, variables?: Record<string, string>): string;
1418
- /**
1419
- * Sets the translations (both global and local) for
1420
- * the given language.
1421
- * @param language The language to set the translations for.
1422
- * @param data The global and local translations.
1423
- */
1424
- setTranslations(language: string, data: LanguageData): void;
1425
- /**
1426
- * Gets the translations (both global and local) for
1427
- * the given language.
1428
- * @param language The language to get the translations for.
1429
- * @result The global and local translations.
1430
- */
1431
- getTranslations(language: string): LanguageData;
1432
- /**
1433
- * Registers a new tile.
1434
- * @param name The name of the tile.
1435
- * @param value The tile registration.
1436
- */
1437
- registerTile(name: string, value: TileRegistration): void;
1438
- /**
1439
- * Unregisters an existing tile.
1440
- * @param name The name of the tile to be removed.
1441
- */
1442
- unregisterTile(name: string): void;
1443
- /**
1444
- * Registers a new menu item.
1445
- * @param name The name of the menu item.
1446
- * @param value The menu registration.
1447
- */
1448
- registerMenuItem(name: string, value: MenuItemRegistration): void;
1449
- /**
1450
- * Unregisters an existing menu item.
1451
- * @param name The name of the menu item to be removed.
1452
- */
1453
- unregisterMenuItem(name: string): void;
1454
- /**
1455
- * Opens the given notification.
1456
- * @param notification The notification to show.
1457
- */
1458
- openNotification(notification: OpenNotification): void;
1459
- /**
1460
- * Closes the given notification.
1461
- * @param notification The notification to hide.
1462
- */
1463
- closeNotification(notification: OpenNotification): void;
1464
- /**
1465
- * Opens the provided dialog.
1466
- * @param dialog The dialog to show.
1467
- */
1468
- openModal(dialog: OpenModalDialog): void;
1469
- /**
1470
- * Closes the provided dialog.
1471
- * @param dialog The dialog to hide.
1472
- */
1473
- closeModal(dialog: OpenModalDialog): void;
1474
- /**
1475
- * Registers a new modal dialog.
1476
- * @param name The name of the modal.
1477
- * @param value The modal registration.
1478
- */
1479
- registerModal(name: string, value: ModalRegistration): void;
1480
- /**
1481
- * Unregisters an existing modal dialog.
1482
- * @param name The name of the modal to be removed.
1483
- */
1484
- unregisterModal(name: string): void;
1485
- /**
1486
- * Creates a new (empty) feed.
1487
- * @param id The id of the feed.
1488
- */
1489
- createFeed(id: string): void;
1490
- /**
1491
- * Destroys an existing feed.
1492
- * @param id The id of the feed.
1493
- */
1494
- destroyFeed(id: string): void;
1495
- /**
1496
- * Loads the feed via the provided details.
1497
- * @param feed The feed details to use for loading.
1498
- */
1499
- loadFeed<TData, TItem>(feed: ConnectorDetails<TData, TItem>): void;
1500
- /**
1501
- * Updates an existing feed.
1502
- * @param id The id of the feed.
1503
- * @param item The item to pass on to the reducer.
1504
- * @param reducer The reducer to use.
1505
- */
1506
- updateFeed<TData, TItem>(id: string, item: TItem, reducer: FeedReducer<TData, TItem>): void;
1507
- /**
1508
- * Registers a new search provider.
1509
- * @param name The name of the search provider.
1510
- * @param value The value representing the provider.
1511
- */
1512
- registerSearchProvider(name: string, value: SearchProviderRegistration): void;
1513
- /**
1514
- * Unregisters an existing search provider.
1515
- * @param name The name of the search provider.
1516
- */
1517
- unregisterSearchProvider(name: string): void;
1518
- /**
1519
- * Sets the current search input.
1520
- * @param input The input to set.
1521
- */
1522
- setSearchInput(input: string): void;
1523
- /**
1524
- * Resets the search results.
1525
- * @param input The input to set.
1526
- * @param loading Determines if further results are currently loading.
1527
- */
1528
- resetSearchResults(input: string, loading: boolean): void;
1529
- /**
1530
- * Appends more results to the existing results.
1531
- * @param items The items to append.
1532
- * @param done Determines if more results are pending.
1533
- */
1534
- appendSearchResults(items: Array<React.ReactChild>, done: boolean): void;
1535
- /**
1536
- * Prepends more results to the existing results.
1537
- * @param items The items to prepend.
1538
- * @param done Determines if more results are pending.
1539
- */
1540
- prependSearchResults(items: Array<React.ReactChild>, done: boolean): void;
1541
- /**
1542
- * Triggers the search explicitly.
1543
- * @param input Optionally sets the query to look for. Otherwise the current input is taken.
1544
- * @param immediate Optionally, determins if the search was invoked immediately.
1545
- */
1546
- triggerSearch(input?: string, immediate?: boolean): Disposable;
1547
- /**
1548
- * Sets the currently logged in user.
1549
- * @param user The current user or undefined is anonymous.
1550
- * @param features The features for the current user, if any.
1551
- * @param permissions The permissions of the current user, if any.
1552
- */
1553
- setUser(user: UserInfo, features: UserFeatures, permissions: UserPermissions): void;
1554
- }
1555
-
1556
- /**
1557
- * An evaluated pilet, i.e., a full pilet: functionality and metadata.
1558
- */
1559
- export type Pilet = SinglePilet | MultiPilet;
1560
-
1561
- /**
1562
- * The shape of an app action in Piral.
1563
- */
1564
- export interface PiralAction<T extends (...args: any) => any> {
1565
- (ctx: GlobalStateContext, ...args: Parameters<T>): ReturnType<T>;
1566
- }
1567
-
1568
- /**
1569
- * A subset of the available app actions in Piral.
1570
- */
1571
- export type PiralDefineActions = Partial<{
1572
- [P in keyof PiralActions]: PiralAction<PiralActions[P]>;
1573
- }>;
1574
-
1575
- /**
1576
- * The different known layout types.
1577
- */
1578
- export type LayoutType = "mobile" | "tablet" | "desktop";
1579
-
1580
- /**
1581
- * The interface modeling the registration of a pilet page component.
1582
- */
1583
- export interface PageRegistration extends BaseRegistration {
1584
- /**
1585
- * The registered page component.
1586
- */
1587
- component: WrappedComponent<PageComponentProps>;
1588
- /**
1589
- * The page's associated metadata.
1590
- */
1591
- meta: PiralPageMeta;
1592
- }
1593
-
1594
- export interface OpenNotification {
1595
- id: string;
1596
- component: React.ComponentType<BareNotificationProps>;
1597
- options: NotificationOptions;
1598
- close(): void;
1599
- }
1600
-
1601
- export interface OpenModalDialog {
1602
- /**
1603
- * Gets the ID of the modal to open. For tracking its state.
1604
- */
1605
- id: string;
1606
- /**
1607
- * Specifies the fully qualified name of the dialog to show.
1608
- */
1609
- name: string;
1610
- /**
1611
- * Specifies the alternative (original) name of the dialog to show.
1612
- */
1613
- alternative?: string;
1614
- /**
1615
- * Defines the transported options.
1616
- */
1617
- options: BaseModalOptions;
1618
- /**
1619
- * Closes the modal dialog.
1620
- */
1621
- close(): void;
1622
- }
1623
-
1624
- export interface FeedsState {
1625
- [id: string]: FeedDataState;
1626
- }
1627
-
1628
- export interface SearchState {
1629
- /**
1630
- * Gets the current input value.
1631
- */
1632
- input: string;
1633
- /**
1634
- * Gets the current result state.
1635
- */
1636
- results: {
1637
- /**
1638
- * Gets weather the search is still loading.
1639
- */
1640
- loading: boolean;
1641
- /**
1642
- * The results to display for the current search.
1643
- */
1644
- items: Array<React.ReactChild>;
1645
- };
1646
- }
1647
-
1648
- /**
1649
- * Map of all error types to their respective props.
1650
- */
1651
- export interface Errors extends PiralCustomErrors {
1652
- /**
1653
- * The props type for an extension error.
1654
- */
1655
- extension: ExtensionErrorInfoProps;
1656
- /**
1657
- * The props type for a loading error.
1658
- */
1659
- loading: LoadingErrorInfoProps;
1660
- /**
1661
- * The props type for a page error.
1662
- */
1663
- page: PageErrorInfoProps;
1664
- /**
1665
- * The props type for a not found error.
1666
- */
1667
- not_found: NotFoundErrorInfoProps;
1668
- /**
1669
- * The props type for an unknown error.
1670
- */
1671
- unknown: UnknownErrorInfoProps;
1672
- }
1673
-
1674
- /**
1675
- * Custom parts of the global custom component state defined outside of piral-core.
1676
- */
1677
- export interface PiralCustomComponentsState {
1678
- /**
1679
- * Represents the component for rendering a language selection.
1680
- */
1681
- LanguagesPicker: React.ComponentType<LanguagesPickerProps>;
1682
- /**
1683
- * The dashboard container component.
1684
- */
1685
- DashboardContainer: React.ComponentType<DashboardContainerProps>;
1686
- /**
1687
- * The dashboard tile component.
1688
- */
1689
- DashboardTile: React.ComponentType<DashboardTileProps>;
1690
- /**
1691
- * The menu container component.
1692
- */
1693
- MenuContainer: React.ComponentType<MenuContainerProps>;
1694
- /**
1695
- * The menu item component.
1696
- */
1697
- MenuItem: React.ComponentType<MenuItemProps>;
1698
- /**
1699
- * The host component for notifications.
1700
- */
1701
- NotificationsHost: React.ComponentType<NotificationsHostProps>;
1702
- /**
1703
- * The notification toast component.
1704
- */
1705
- NotificationsToast: React.ComponentType<NotificationsToastProps>;
1706
- /**
1707
- * The host component for modal dialogs.
1708
- */
1709
- ModalsHost: React.ComponentType<ModalsHostProps>;
1710
- /**
1711
- * The modal dialog component.
1712
- */
1713
- ModalsDialog: React.ComponentType<ModalsDialogProps>;
1714
- /**
1715
- * The component for showing the results of the search.
1716
- */
1717
- SearchResult: React.ComponentType<SearchResultProps>;
1718
- /**
1719
- * The container for showing search.
1720
- */
1721
- SearchContainer: React.ComponentType<SearchContainerProps>;
1722
- /**
1723
- * The input component for search capability.
1724
- */
1725
- SearchInput: React.ComponentType<SearchInputProps>;
1726
- }
1727
-
1728
- /**
1729
- * The props of a Loading indicator component.
1730
- */
1731
- export interface LoadingIndicatorProps {}
1732
-
1733
- /**
1734
- * The props for the ErrorInfo component.
1735
- */
1736
- export type ErrorInfoProps = UnionOf<Errors>;
1737
-
1738
- /**
1739
- * The props of a Router component.
1740
- */
1741
- export interface RouterProps {}
1742
-
1743
- /**
1744
- * The props of a Layout component.
1745
- */
1746
- export interface LayoutProps {
1747
- /**
1748
- * The currently selected layout type.
1749
- */
1750
- currentLayout: LayoutType;
1751
- }
1752
-
1753
- /**
1754
- * The props of the RouteSwitch component.
1755
- */
1756
- export interface RouteSwitchProps extends ReactRouter.SwitchProps {
1757
- /**
1758
- * The component that should be used in case nothing was found.
1759
- */
1760
- NotFound: React.ComponentType<ReactRouter.RouteComponentProps>;
1761
- /**
1762
- * The component to register for the different paths.
1763
- */
1764
- paths: Array<{
1765
- /**
1766
- * The exact path to use.
1767
- */
1768
- path: string;
1769
- /**
1770
- * The component to register for this path.
1771
- */
1772
- Component: React.ComponentType<ReactRouter.RouteComponentProps>;
1773
- }>;
1774
- }
1775
-
1776
- /**
1777
- * Custom parts of the global registry state defined outside of piral-core.
1778
- */
1779
- export interface PiralCustomRegistryState {
1780
- /**
1781
- * The registered tile components for a dashboard.
1782
- */
1783
- tiles: Dict<TileRegistration>;
1784
- /**
1785
- * The registered menu items for global display.
1786
- */
1787
- menuItems: Dict<MenuItemRegistration>;
1788
- /**
1789
- * The registered modal dialog components.
1790
- */
1791
- modals: Dict<ModalRegistration>;
1792
- /**
1793
- * The registered search providers for context aware search.
1794
- */
1795
- searchProviders: Dict<SearchProviderRegistration>;
1796
- }
1797
-
1798
- export interface LanguageData {
1799
- global: Translations;
1800
- locals: Array<{
1801
- name: string;
1802
- value: Translations;
1803
- }>;
1804
- }
1805
-
1806
- export interface TileRegistration extends BaseRegistration {
1807
- component: WrappedComponent<TileComponentProps>;
1808
- preferences: TilePreferences;
1809
- }
1810
-
1811
- export interface MenuItemRegistration extends BaseRegistration {
1812
- component: WrappedComponent<MenuComponentProps>;
1813
- settings: MenuSettings;
1814
- }
1815
-
1816
- export interface ModalRegistration extends BaseRegistration {
1817
- name: string;
1818
- component: WrappedComponent<ModalComponentProps<any>>;
1819
- defaults: any;
1820
- layout: ModalLayoutOptions;
1821
- }
1822
-
1823
- export interface ConnectorDetails<TData, TItem, TReducers extends FeedConnectorReducers<TData> = {}> extends FeedConnectorOptions<TData, TItem, TReducers> {
1824
- /**
1825
- * The ID of the connector.
1826
- */
1827
- id: string;
1828
- /**
1829
- * The dispose function if active.
1830
- */
1831
- dispose?(): void;
1832
- }
1833
-
1834
- export interface SearchProviderRegistration extends BaseRegistration {
1835
- search: SearchHandler;
1836
- cancel(): void;
1837
- clear(): void;
1838
- onlyImmediate: boolean;
1839
- }
1840
-
1841
- /**
1842
- * An evaluated single pilet.
1843
- */
1844
- export type SinglePilet = SinglePiletApp & SinglePiletMetadata;
1845
-
1846
- /**
1847
- * An evaluated multi pilet.
1848
- */
1849
- export type MultiPilet = MultiPiletApp & MultiPiletMetadata;
1850
-
1851
- /**
1852
- * The Piral app instance context.
1853
- */
1854
- export interface GlobalStateContext extends PiralActions, EventEmitter {
1855
- /**
1856
- * The global state context atom.
1857
- * Changes to the state should always be dispatched via the `dispatch` action.
1858
- */
1859
- state: LibreAtom.Atom<GlobalState>;
1860
- /**
1861
- * The API objects created for the loaded pilets.
1862
- */
1863
- apis: PiletsBag;
1864
- /**
1865
- * The available component converters.
1866
- */
1867
- converters: ComponentConverters<any>;
1868
- /**
1869
- * The initial options.
1870
- */
1871
- options: LoadPiletsOptions;
1872
- }
1873
-
1874
- export interface FeedDataState {
1875
- /**
1876
- * Determines if the feed data is currently loading.
1877
- */
1878
- loading: boolean;
1879
- /**
1880
- * Indicates if the feed data was already loaded and is active.
1881
- */
1882
- loaded: boolean;
1883
- /**
1884
- * Stores the potential error when initializing or loading the feed.
1885
- */
1886
- error: any;
1887
- /**
1888
- * The currently stored feed data.
1889
- */
1890
- data: any;
1891
- }
1892
-
1893
- /**
1894
- * Custom errors defined outside of piral-core.
1895
- */
1896
- export interface PiralCustomErrors {
1897
- tile: TileErrorInfoProps;
1898
- menu: MenuItemErrorInfoProps;
1899
- modal: ModalErrorInfoProps;
1900
- feed: FeedErrorInfoProps;
1901
- }
1902
-
1903
- /**
1904
- * The error used when a registered extension component crashed.
1905
- */
1906
- export interface ExtensionErrorInfoProps {
1907
- /**
1908
- * The type of the error.
1909
- */
1910
- type: "extension";
1911
- /**
1912
- * The provided error details.
1913
- */
1914
- error: any;
1915
- /**
1916
- * The name of the pilet emitting the error.
1917
- */
1918
- pilet?: string;
1919
- }
1920
-
1921
- /**
1922
- * The error used when the app could not be loaded.
1923
- */
1924
- export interface LoadingErrorInfoProps {
1925
- /**
1926
- * The type of the error.
1927
- */
1928
- type: "loading";
1929
- /**
1930
- * The provided error details.
1931
- */
1932
- error: any;
1933
- }
1934
-
1935
- /**
1936
- * The error used when a registered page component crashes.
1937
- */
1938
- export interface PageErrorInfoProps extends ReactRouter.RouteComponentProps {
1939
- /**
1940
- * The type of the error.
1941
- */
1942
- type: "page";
1943
- /**
1944
- * The provided error details.
1945
- */
1946
- error: any;
1947
- /**
1948
- * The name of the pilet emitting the error.
1949
- */
1950
- pilet?: string;
1951
- }
1952
-
1953
- /**
1954
- * The error used when a route cannot be resolved.
1955
- */
1956
- export interface NotFoundErrorInfoProps extends ReactRouter.RouteComponentProps {
1957
- /**
1958
- * The type of the error.
1959
- */
1960
- type: "not_found";
1961
- }
1962
-
1963
- /**
1964
- * The error used when the exact type is unknown.
1965
- */
1966
- export interface UnknownErrorInfoProps {
1967
- /**
1968
- * The type of the error.
1969
- */
1970
- type: "unknown";
1971
- /**
1972
- * The provided error details.
1973
- */
1974
- error: any;
1975
- /**
1976
- * The name of the pilet emitting the error.
1977
- */
1978
- pilet?: string;
1979
- }
1980
-
1981
- export interface LanguagesPickerProps {
1982
- /**
1983
- * The currently selected language.
1984
- */
1985
- selected: string;
1986
- /**
1987
- * The languages available for selection.
1988
- */
1989
- available: Array<string>;
1990
- }
1991
-
1992
- export interface DashboardContainerProps extends ReactRouter.RouteComponentProps {}
1993
-
1994
- export interface DashboardTileProps {
1995
- /**
1996
- * The currently used number of columns.
1997
- */
1998
- columns: number;
1999
- /**
2000
- * The currently used number of rows.
2001
- */
2002
- rows: number;
2003
- /**
2004
- * The resizable status.
2005
- */
2006
- resizable: boolean;
2007
- /**
2008
- * The provided tile preferences.
2009
- */
2010
- meta: TilePreferences;
2011
- }
2012
-
2013
- export interface MenuContainerProps {
2014
- /**
2015
- * The type of the menu.
2016
- */
2017
- type: MenuType;
2018
- }
2019
-
2020
- export interface MenuItemProps {
2021
- /**
2022
- * The type of the menu.
2023
- */
2024
- type: MenuType;
2025
- /**
2026
- * The provided menu settings.
2027
- */
2028
- meta: MenuSettings;
2029
- }
2030
-
2031
- export interface NotificationsHostProps {}
2032
-
2033
- export interface NotificationsToastProps extends BareNotificationProps {}
2034
-
2035
- export interface ModalsHostProps {
2036
- /**
2037
- * Gets if the modal is currently open or closed.
2038
- */
2039
- open: boolean;
2040
- /**
2041
- * Callback to invoke closing the modal dialog.
2042
- */
2043
- close(): void;
2044
- }
2045
-
2046
- export interface ModalsDialogProps extends OpenModalDialog {
2047
- layout: ModalLayoutOptions;
2048
- defaults: any;
2049
- }
2050
-
2051
- export interface SearchResultProps {}
2052
-
2053
- export interface SearchContainerProps {
2054
- /**
2055
- * Gets if the results are still gathered.
2056
- */
2057
- loading: boolean;
2058
- }
2059
-
2060
- export interface SearchInputProps {
2061
- setValue(value: string): void;
2062
- value: string;
2063
- }
2064
-
2065
- export type UnionOf<T> = {
2066
- [K in keyof T]: T[K];
2067
- }[keyof T];
2068
-
2069
- export interface SearchHandler {
2070
- (options: SearchOptions): Promise<Array<React.ReactChild>>;
2071
- }
2072
-
2073
- /**
2074
- * The pilet app, i.e., the functional exports.
2075
- */
2076
- export interface SinglePiletApp {
2077
- /**
2078
- * Integrates the evaluated pilet into the application.
2079
- * @param api The API to access the application.
2080
- */
2081
- setup(api: PiletApi): void | Promise<void>;
2082
- /**
2083
- * Optional function for cleanup.
2084
- * @param api The API to access the application.
2085
- */
2086
- teardown?(api: PiletApi): void;
2087
- }
2088
-
2089
- /**
2090
- * The pilet app, i.e., the functional exports.
2091
- */
2092
- export interface MultiPiletApp {
2093
- /**
2094
- * Integrates the evaluated pilet into the application.
2095
- * @param api The API to access the application.
2096
- */
2097
- setup(apiFactory: PiletApiCreator): void | Promise<void>;
2098
- }
2099
-
2100
- /**
2101
- * Represents the dictionary of the loaded pilets and their APIs.
2102
- */
2103
- export interface PiletsBag {
2104
- [name: string]: PiletApi;
2105
- }
2106
-
2107
- /**
2108
- * The options for loading pilets.
2109
- */
2110
- export interface LoadPiletsOptions {
2111
- /**
2112
- * The callback function for creating an API object.
2113
- * The API object is passed on to a specific pilet.
2114
- */
2115
- createApi: PiletApiCreator;
2116
- /**
2117
- * The callback for fetching the dynamic pilets.
2118
- */
2119
- fetchPilets: PiletRequester;
2120
- /**
2121
- * Optionally, some already existing evaluated pilets, e.g.,
2122
- * helpful when debugging or in SSR scenarios.
2123
- */
2124
- pilets?: Array<Pilet>;
2125
- /**
2126
- * Optionally, configures the default loader.
2127
- */
2128
- config?: DefaultLoaderConfig;
2129
- /**
2130
- * Optionally, defines the default way how to load a pilet.
2131
- */
2132
- loadPilet?: PiletLoader;
2133
- /**
2134
- * Optionally, defines loaders for custom specifications.
2135
- */
2136
- loaders?: CustomSpecLoaders;
2137
- /**
2138
- * Gets the map of globally available dependencies with their names
2139
- * as keys and their evaluated pilet content as value.
2140
- */
2141
- dependencies?: AvailableDependencies;
2142
- /**
2143
- * Optionally, defines the loading strategy to use.
2144
- */
2145
- strategy?: PiletLoadingStrategy;
2146
- }
2147
-
2148
- export interface TileErrorInfoProps {
2149
- /**
2150
- * The type of the error.
2151
- */
2152
- type: "tile";
2153
- /**
2154
- * The provided error details.
2155
- */
2156
- error: any;
2157
- /**
2158
- * The currently used number of columns.
2159
- */
2160
- columns: number;
2161
- /**
2162
- * The currently used number of rows.
2163
- */
2164
- rows: number;
2165
- /**
2166
- * The name of the pilet emitting the error.
2167
- */
2168
- pilet?: string;
2169
- }
2170
-
2171
- /**
2172
- * The error used when a registered menu item component crashed.
2173
- */
2174
- export interface MenuItemErrorInfoProps {
2175
- /**
2176
- * The type of the error.
2177
- */
2178
- type: "menu";
2179
- /**
2180
- * The provided error details.
2181
- */
2182
- error: any;
2183
- /**
2184
- * The type of the used menu.
2185
- */
2186
- menu: MenuType;
2187
- /**
2188
- * The name of the pilet emitting the error.
2189
- */
2190
- pilet?: string;
2191
- }
2192
-
2193
- /**
2194
- * The error used when a registered modal dialog crashed.
2195
- */
2196
- export interface ModalErrorInfoProps {
2197
- /**
2198
- * The type of the error.
2199
- */
2200
- type: "modal";
2201
- /**
2202
- * The provided error details.
2203
- */
2204
- error: any;
2205
- /**
2206
- * Callback for closing the modal programmatically.
2207
- */
2208
- onClose(): void;
2209
- /**
2210
- * The name of the pilet emitting the error.
2211
- */
2212
- pilet?: string;
2213
- }
2214
-
2215
- /**
2216
- * The error used when loading a feed resulted in an error.
2217
- */
2218
- export interface FeedErrorInfoProps {
2219
- /**
2220
- * The type of the error.
2221
- */
2222
- type: "feed";
2223
- /**
2224
- * The provided error details.
2225
- */
2226
- error: any;
2227
- /**
2228
- * The name of the pilet emitting the error.
2229
- */
2230
- pilet?: string;
2231
- }
2232
-
2233
- /**
2234
- * The creator function for the pilet API.
2235
- */
2236
- export interface PiletApiCreator {
2237
- (target: PiletMetadata): PiletApi;
2238
- }
2239
-
2240
- /**
2241
- * The interface describing a function capable of fetching pilets.
2242
- */
2243
- export interface PiletRequester {
2244
- (): Promise<Array<PiletMetadata>>;
2245
- }
2246
-
2247
- /**
2248
- * Additional configuration options for the default loader.
2249
- */
2250
- export interface DefaultLoaderConfig {
2251
- /**
2252
- * Sets the cross-origin attribute of potential script tags.
2253
- * For pilets v1 this may be useful. Otherwise, only pilets that
2254
- * have an integrity defined will be set to "anonymous".
2255
- */
2256
- crossOrigin?: string;
2257
- }
2258
-
2259
- /**
2260
- * The callback to be used to load a single pilet.
2261
- */
2262
- export interface PiletLoader {
2263
- (meta: PiletMetadata): Promise<Pilet>;
2264
- }
2265
-
2266
- /**
2267
- * Defines the spec identifiers for custom loading.
2268
- */
2269
- export type CustomSpecLoaders = Record<string, PiletLoader>;
2270
-
2271
- /**
2272
- * The record containing all available dependencies.
2273
- */
2274
- export interface AvailableDependencies {
2275
- [name: string]: any;
2276
- }
2277
-
2278
- /**
2279
- * The strategy for how pilets are loaded at runtime.
2280
- */
2281
- export interface PiletLoadingStrategy {
2282
- (options: LoadPiletsOptions, pilets: PiletsLoaded): PromiseLike<void>;
2283
- }
2284
-
2285
- /**
2286
- * The callback to be used when pilets have been loaded.
2287
- */
2288
- export interface PiletsLoaded {
2289
- (error: Error | undefined, pilets: Array<Pilet>): void;
975
+ key: string;
2290
976
  }
2291
977
  }