sample-piral 1.6.2-beta.7394 → 1.6.2-beta.7457

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
@@ -170,6 +170,8 @@ export interface PiralEventMap extends PiralCustomEventMap {
170
170
  [custom: string]: any;
171
171
  "store-data": PiralStoreDataEvent;
172
172
  "unhandled-error": PiralUnhandledErrorEvent;
173
+ "loading-pilets": PiralLoadingPiletsEvent;
174
+ "loaded-pilets": PiralLoadedPiletsEvent;
173
175
  }
174
176
 
175
177
  export interface PiletLocaleApi {
@@ -473,6 +475,30 @@ export interface PiralUnhandledErrorEvent {
473
475
  pilet: string;
474
476
  }
475
477
 
478
+ /**
479
+ * Gets fired when the loading of pilets is triggered.
480
+ */
481
+ export interface PiralLoadingPiletsEvent {
482
+ /**
483
+ * The options that have been supplied for loading the pilets.
484
+ */
485
+ options: LoadPiletsOptions;
486
+ }
487
+
488
+ /**
489
+ * Gets fired when all pilets have been loaded.
490
+ */
491
+ export interface PiralLoadedPiletsEvent {
492
+ /**
493
+ * The pilets that have been loaded.
494
+ */
495
+ pilets: Array<Pilet>;
496
+ /**
497
+ * The loading error, if any.
498
+ */
499
+ error?: Error;
500
+ }
501
+
476
502
  export type AnyLocalizationMessages = LocalizationMessages | NestedLocalizationMessages;
477
503
 
478
504
  export interface LocalizationMessages {
@@ -730,6 +756,56 @@ export interface PiralChangeUserEvent {
730
756
  current: UserInfo;
731
757
  }
732
758
 
759
+ /**
760
+ * The options for loading pilets.
761
+ */
762
+ export interface LoadPiletsOptions {
763
+ /**
764
+ * The callback function for creating an API object.
765
+ * The API object is passed on to a specific pilet.
766
+ */
767
+ createApi: PiletApiCreator;
768
+ /**
769
+ * The callback for fetching the dynamic pilets.
770
+ */
771
+ fetchPilets: PiletRequester;
772
+ /**
773
+ * Optionally, some already existing evaluated pilets, e.g.,
774
+ * helpful when debugging or in SSR scenarios.
775
+ */
776
+ pilets?: Array<Pilet>;
777
+ /**
778
+ * Optionally, configures the default loader.
779
+ */
780
+ config?: DefaultLoaderConfig;
781
+ /**
782
+ * Optionally, defines the default way how to load a pilet.
783
+ */
784
+ loadPilet?: PiletLoader;
785
+ /**
786
+ * Optionally, defines loaders for custom specifications.
787
+ */
788
+ loaders?: CustomSpecLoaders;
789
+ /**
790
+ * Optionally, defines a set of loading hooks to be used.
791
+ */
792
+ hooks?: PiletLifecycleHooks;
793
+ /**
794
+ * Gets the map of globally available dependencies with their names
795
+ * as keys and their evaluated pilet content as value.
796
+ */
797
+ dependencies?: AvailableDependencies;
798
+ /**
799
+ * Optionally, defines the loading strategy to use.
800
+ */
801
+ strategy?: PiletLoadingStrategy;
802
+ }
803
+
804
+ /**
805
+ * An evaluated pilet, i.e., a full pilet: functionality and metadata.
806
+ */
807
+ export type Pilet = SinglePilet | MultiPilet;
808
+
733
809
  export interface NestedLocalizationMessages {
734
810
  [lang: string]: NestedTranslations;
735
811
  }
@@ -932,6 +1008,94 @@ export interface ExtensionRegistration extends BaseRegistration {
932
1008
  defaults: any;
933
1009
  }
934
1010
 
1011
+ /**
1012
+ * The creator function for the pilet API.
1013
+ */
1014
+ export interface PiletApiCreator {
1015
+ /**
1016
+ * Creates an API for the given raw pilet.
1017
+ * @param target The raw (meta) content of the pilet.
1018
+ * @returns The API object to be used with the pilet.
1019
+ */
1020
+ (target: PiletMetadata): PiletApi;
1021
+ }
1022
+
1023
+ /**
1024
+ * The interface describing a function capable of fetching pilets.
1025
+ */
1026
+ export interface PiletRequester {
1027
+ /**
1028
+ * Gets the raw pilets (e.g., from a server) asynchronously.
1029
+ */
1030
+ (): Promise<PiletEntries>;
1031
+ }
1032
+
1033
+ /**
1034
+ * Additional configuration options for the default loader.
1035
+ */
1036
+ export interface DefaultLoaderConfig {
1037
+ /**
1038
+ * Sets the cross-origin attribute of potential script tags.
1039
+ * For pilets v1 this may be useful. Otherwise, only pilets that
1040
+ * have an integrity defined will be set to "anonymous".
1041
+ */
1042
+ crossOrigin?: string;
1043
+ }
1044
+
1045
+ /**
1046
+ * The callback to be used to load a single pilet.
1047
+ */
1048
+ export interface PiletLoader {
1049
+ (entry: PiletEntry): Promise<Pilet>;
1050
+ }
1051
+
1052
+ /**
1053
+ * Defines the spec identifiers for custom loading.
1054
+ */
1055
+ export type CustomSpecLoaders = Record<string, PiletLoader>;
1056
+
1057
+ /**
1058
+ * A set of pipeline hooks used by the Piral loading orchestrator.
1059
+ */
1060
+ export interface PiletLifecycleHooks {
1061
+ /**
1062
+ * Hook fired before a pilet is loaded.
1063
+ */
1064
+ loadPilet?(pilet: PiletMetadata): void;
1065
+ /**
1066
+ * Hook fired before a pilet is being set up.
1067
+ */
1068
+ setupPilet?(pilet: Pilet): void;
1069
+ /**
1070
+ * Hook fired before a pilet is being cleaned up.
1071
+ */
1072
+ cleanupPilet?(pilet: Pilet): void;
1073
+ }
1074
+
1075
+ /**
1076
+ * The record containing all available dependencies.
1077
+ */
1078
+ export interface AvailableDependencies {
1079
+ [name: string]: any;
1080
+ }
1081
+
1082
+ /**
1083
+ * The strategy for how pilets are loaded at runtime.
1084
+ */
1085
+ export interface PiletLoadingStrategy {
1086
+ (options: LoadPiletsOptions, pilets: PiletsLoaded): PromiseLike<void>;
1087
+ }
1088
+
1089
+ /**
1090
+ * An evaluated single pilet.
1091
+ */
1092
+ export type SinglePilet = SinglePiletApp & PiletMetadata;
1093
+
1094
+ /**
1095
+ * An evaluated multi pilet.
1096
+ */
1097
+ export type MultiPilet = MultiPiletApp & PiletMetadata;
1098
+
935
1099
  export interface NestedTranslations {
936
1100
  [tag: string]: string | NestedTranslations;
937
1101
  }
@@ -1019,6 +1183,60 @@ export interface BaseRegistration {
1019
1183
 
1020
1184
  export type WrappedComponent<TProps> = React.ComponentType<React.PropsWithChildren<Without<TProps, keyof BaseComponentProps>>>;
1021
1185
 
1186
+ /**
1187
+ * The entries representing pilets from a feed service response.
1188
+ */
1189
+ export type PiletEntries = Array<PiletEntry>;
1190
+
1191
+ /**
1192
+ * Pilet entry representing part of a response from the feed service.
1193
+ */
1194
+ export type PiletEntry = MultiPiletEntry | SinglePiletEntry;
1195
+
1196
+ /**
1197
+ * The callback to be used when pilets have been loaded.
1198
+ */
1199
+ export interface PiletsLoaded {
1200
+ (error: Error | undefined, pilets: Array<Pilet>): void;
1201
+ }
1202
+
1203
+ /**
1204
+ * The pilet app, i.e., the functional exports.
1205
+ */
1206
+ export interface SinglePiletApp {
1207
+ /**
1208
+ * Integrates the evaluated pilet into the application.
1209
+ * @param api The API to access the application.
1210
+ */
1211
+ setup(api: PiletApi): void | Promise<void>;
1212
+ /**
1213
+ * Optional function for cleanup.
1214
+ * @param api The API to access the application.
1215
+ */
1216
+ teardown?(api: PiletApi): void;
1217
+ /**
1218
+ * The referenced stylesheets to load / integrate.
1219
+ * This would only be used by v3 pilets.
1220
+ */
1221
+ styles?: Array<string>;
1222
+ /**
1223
+ * The referenced WebAssembly binaries to load / integrate.
1224
+ * This would only be used by v3 pilets.
1225
+ */
1226
+ assemblies?: Array<string>;
1227
+ }
1228
+
1229
+ /**
1230
+ * The pilet app, i.e., the functional exports.
1231
+ */
1232
+ export interface MultiPiletApp {
1233
+ /**
1234
+ * Integrates the evaluated pilet into the application.
1235
+ * @param api The API to access the application.
1236
+ */
1237
+ setup(apiFactory: PiletApiCreator): void | Promise<void>;
1238
+ }
1239
+
1022
1240
  export interface PiralCustomMenuTypes {}
1023
1241
 
1024
1242
  export interface PiralCustomNotificationTypes {}
@@ -1073,6 +1291,16 @@ export interface NavigationApi {
1073
1291
 
1074
1292
  export type Without<T, K> = Pick<T, Exclude<keyof T, K>>;
1075
1293
 
1294
+ /**
1295
+ * The metadata response for a multi pilet.
1296
+ */
1297
+ export type MultiPiletEntry = PiletBundleEntry;
1298
+
1299
+ /**
1300
+ * The metadata response for a single pilet.
1301
+ */
1302
+ export type SinglePiletEntry = PiletV0Entry | PiletV1Entry | PiletV2Entry | PiletV3Entry | PiletMfEntry | PiletVxEntry;
1303
+
1076
1304
  export interface NavigationBlocker {
1077
1305
  (tx: NavigationTransition): void;
1078
1306
  }
@@ -1081,6 +1309,238 @@ export interface NavigationListener {
1081
1309
  (update: NavigationUpdate): void;
1082
1310
  }
1083
1311
 
1312
+ /**
1313
+ * Metadata for pilets using the bundle schema.
1314
+ */
1315
+ export interface PiletBundleEntry {
1316
+ /**
1317
+ * The name of the bundle pilet, i.e., the package id.
1318
+ */
1319
+ name?: string;
1320
+ /**
1321
+ * Optionally provides the version of the specification for this pilet.
1322
+ */
1323
+ spec?: "v1";
1324
+ /**
1325
+ * The link for retrieving the bundle content of the pilet.
1326
+ */
1327
+ link: string;
1328
+ /**
1329
+ * The reference name for the global bundle-shared require.
1330
+ */
1331
+ bundle: string;
1332
+ /**
1333
+ * The computed integrity of the pilet. Will be used to set the
1334
+ * integrity value of the script.
1335
+ */
1336
+ integrity?: string;
1337
+ /**
1338
+ * Optionally provides some custom metadata for the pilet.
1339
+ */
1340
+ custom?: any;
1341
+ /**
1342
+ * Additional shared dependency script files.
1343
+ */
1344
+ dependencies?: Record<string, string>;
1345
+ }
1346
+
1347
+ /**
1348
+ * Metadata for pilets using the v0 schema.
1349
+ */
1350
+ export type PiletV0Entry = PiletV0ContentEntry | PiletV0LinkEntry;
1351
+
1352
+ /**
1353
+ * Metadata for pilets using the v1 schema.
1354
+ */
1355
+ export interface PiletV1Entry {
1356
+ /**
1357
+ * The name of the pilet, i.e., the package id.
1358
+ */
1359
+ name: string;
1360
+ /**
1361
+ * The version of the pilet. Should be semantically versioned.
1362
+ */
1363
+ version: string;
1364
+ /**
1365
+ * Optionally provides the version of the specification for this pilet.
1366
+ */
1367
+ spec?: "v1";
1368
+ /**
1369
+ * The link for retrieving the content of the pilet.
1370
+ */
1371
+ link: string;
1372
+ /**
1373
+ * The reference name for the global require.
1374
+ */
1375
+ requireRef: string;
1376
+ /**
1377
+ * The computed integrity of the pilet. Will be used to set the
1378
+ * integrity value of the script.
1379
+ */
1380
+ integrity?: string;
1381
+ /**
1382
+ * Optionally provides some custom metadata for the pilet.
1383
+ */
1384
+ custom?: any;
1385
+ /**
1386
+ * Optionally provides some configuration to be used in the pilet.
1387
+ */
1388
+ config?: Record<string, any>;
1389
+ /**
1390
+ * Additional shared dependency script files.
1391
+ */
1392
+ dependencies?: Record<string, string>;
1393
+ }
1394
+
1395
+ /**
1396
+ * Metadata for pilets using the v2 schema.
1397
+ */
1398
+ export interface PiletV2Entry {
1399
+ /**
1400
+ * The name of the pilet, i.e., the package id.
1401
+ */
1402
+ name: string;
1403
+ /**
1404
+ * The version of the pilet. Should be semantically versioned.
1405
+ */
1406
+ version: string;
1407
+ /**
1408
+ * Provides the version of the specification for this pilet.
1409
+ */
1410
+ spec: "v2";
1411
+ /**
1412
+ * The reference name for the global require.
1413
+ */
1414
+ requireRef: string;
1415
+ /**
1416
+ * The computed integrity of the pilet.
1417
+ */
1418
+ integrity?: string;
1419
+ /**
1420
+ * The link for retrieving the content of the pilet.
1421
+ */
1422
+ link: string;
1423
+ /**
1424
+ * Optionally provides some custom metadata for the pilet.
1425
+ */
1426
+ custom?: any;
1427
+ /**
1428
+ * Optionally provides some configuration to be used in the pilet.
1429
+ */
1430
+ config?: Record<string, any>;
1431
+ /**
1432
+ * Additional shared dependency script files.
1433
+ */
1434
+ dependencies?: Record<string, string>;
1435
+ }
1436
+
1437
+ /**
1438
+ * Metadata for pilets using the v3 schema.
1439
+ */
1440
+ export interface PiletV3Entry {
1441
+ /**
1442
+ * The name of the pilet, i.e., the package id.
1443
+ */
1444
+ name: string;
1445
+ /**
1446
+ * The version of the pilet. Should be semantically versioned.
1447
+ */
1448
+ version: string;
1449
+ /**
1450
+ * Provides the version of the specification for this pilet.
1451
+ */
1452
+ spec: "v3";
1453
+ /**
1454
+ * The reference name for the global require.
1455
+ */
1456
+ requireRef: string;
1457
+ /**
1458
+ * The computed integrity of the pilet.
1459
+ */
1460
+ integrity?: string;
1461
+ /**
1462
+ * The fallback link for retrieving the content of the pilet.
1463
+ */
1464
+ link: string;
1465
+ /**
1466
+ * The links for specific variations of the pilet, e.g., "client", "server", ...
1467
+ */
1468
+ variations?: Record<string, string>;
1469
+ /**
1470
+ * Optionally provides some custom metadata for the pilet.
1471
+ */
1472
+ custom?: any;
1473
+ /**
1474
+ * Optionally provides some configuration to be used in the pilet.
1475
+ */
1476
+ config?: Record<string, any>;
1477
+ /**
1478
+ * Additional shared dependency script files.
1479
+ */
1480
+ dependencies?: Record<string, string>;
1481
+ }
1482
+
1483
+ /**
1484
+ * Metadata for pilets using the v2 schema.
1485
+ */
1486
+ export interface PiletMfEntry {
1487
+ /**
1488
+ * The name of the pilet, i.e., the package id.
1489
+ */
1490
+ name: string;
1491
+ /**
1492
+ * The version of the pilet. Should be semantically versioned.
1493
+ */
1494
+ version: string;
1495
+ /**
1496
+ * Provides the version of the specification for this pilet.
1497
+ */
1498
+ spec: "mf";
1499
+ /**
1500
+ * The computed integrity of the pilet.
1501
+ */
1502
+ integrity?: string;
1503
+ /**
1504
+ * The fallback link for retrieving the content of the pilet.
1505
+ */
1506
+ link: string;
1507
+ /**
1508
+ * Optionally provides some custom metadata for the pilet.
1509
+ */
1510
+ custom?: any;
1511
+ /**
1512
+ * Optionally provides some configuration to be used in the pilet.
1513
+ */
1514
+ config?: Record<string, any>;
1515
+ }
1516
+
1517
+ export interface PiletVxEntry {
1518
+ /**
1519
+ * The name of the pilet, i.e., the package id.
1520
+ */
1521
+ name: string;
1522
+ /**
1523
+ * The version of the pilet. Should be semantically versioned.
1524
+ */
1525
+ version: string;
1526
+ /**
1527
+ * Provides an identifier for the custom specification.
1528
+ */
1529
+ spec: string;
1530
+ /**
1531
+ * Optionally provides some custom metadata for the pilet.
1532
+ */
1533
+ custom?: any;
1534
+ /**
1535
+ * Optionally provides some configuration to be used in the pilet.
1536
+ */
1537
+ config?: Record<string, any>;
1538
+ /**
1539
+ * Additional shared dependency script files.
1540
+ */
1541
+ dependencies?: Record<string, string>;
1542
+ }
1543
+
1084
1544
  export interface NavigationTransition extends NavigationUpdate {
1085
1545
  retry?(): void;
1086
1546
  }
@@ -1090,6 +1550,34 @@ export interface NavigationUpdate {
1090
1550
  location: NavigationLocation;
1091
1551
  }
1092
1552
 
1553
+ /**
1554
+ * Metadata for pilets using the v0 schema with a content.
1555
+ */
1556
+ export interface PiletV0ContentEntry extends PiletV0BaseEntry {
1557
+ /**
1558
+ * The content of the pilet. If the content is not available
1559
+ * the link will be used (unless caching has been activated).
1560
+ */
1561
+ content: string;
1562
+ /**
1563
+ * If available indicates that the pilet should not be cached.
1564
+ * In case of a string this is interpreted as the expiration time
1565
+ * of the cache. In case of an accurate hash this should not be
1566
+ * required or set.
1567
+ */
1568
+ noCache?: boolean | string;
1569
+ }
1570
+
1571
+ /**
1572
+ * Metadata for pilets using the v0 schema with a link.
1573
+ */
1574
+ export interface PiletV0LinkEntry extends PiletV0BaseEntry {
1575
+ /**
1576
+ * The link for retrieving the content of the pilet.
1577
+ */
1578
+ link: string;
1579
+ }
1580
+
1093
1581
  export type NavigationAction = "POP" | "PUSH" | "REPLACE";
1094
1582
 
1095
1583
  export interface NavigationLocation {
@@ -1127,4 +1615,39 @@ export interface NavigationLocation {
1127
1615
  * locations, this string will be a unique identifier.
1128
1616
  */
1129
1617
  key?: string;
1618
+ }
1619
+
1620
+ /**
1621
+ * Basic metadata for pilets using the v0 schema.
1622
+ */
1623
+ export interface PiletV0BaseEntry {
1624
+ /**
1625
+ * The name of the pilet, i.e., the package id.
1626
+ */
1627
+ name: string;
1628
+ /**
1629
+ * The version of the pilet. Should be semantically versioned.
1630
+ */
1631
+ version: string;
1632
+ /**
1633
+ * Optionally provides the version of the specification for this pilet.
1634
+ */
1635
+ spec?: "v0";
1636
+ /**
1637
+ * The computed hash value of the pilet's content. Should be
1638
+ * accurate to allow caching.
1639
+ */
1640
+ hash: string;
1641
+ /**
1642
+ * Optionally provides some custom metadata for the pilet.
1643
+ */
1644
+ custom?: any;
1645
+ /**
1646
+ * Optionally provides some configuration to be used in the pilet.
1647
+ */
1648
+ config?: Record<string, any>;
1649
+ /**
1650
+ * Additional shared dependency script files.
1651
+ */
1652
+ dependencies?: Record<string, string>;
1130
1653
  }
package/app/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <title>Piral Sample</title>
6
6
  <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
7
7
 
8
- <script defer src="/index.282bb1.js"></script></head>
8
+ <script defer src="/index.2f9975.js"></script></head>
9
9
  <body>
10
10
  <div id="app">
11
11
  <div class="pi-center">
package/files.tar CHANGED
Binary file
package/files_once.tar CHANGED
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sample-piral",
3
3
  "description": "Example project illustrating the use of the piral and piral-cli packages.",
4
- "version": "1.6.2-beta.7394",
4
+ "version": "1.6.2-beta.7457",
5
5
  "license": "MIT",
6
6
  "homepage": "https://piral.io",
7
7
  "keywords": [
@@ -31,7 +31,7 @@
31
31
  "files": []
32
32
  },
33
33
  "piralCLI": {
34
- "version": "1.6.2-beta.7394",
34
+ "version": "1.6.2-beta.7457",
35
35
  "generated": true
36
36
  },
37
37
  "main": "./app/index.js",
@@ -44,14 +44,14 @@
44
44
  "@types/react-dom": "^18.0.0",
45
45
  "@types/react-router": "^5.1.8",
46
46
  "@types/react-router-dom": "^5.1.6",
47
- "piral-cli": "^1.6.2-beta.7394",
48
- "piral-cli-webpack5": "^1.6.2-beta.7394",
47
+ "piral-cli": "^1.6.2-beta.7457",
48
+ "piral-cli-webpack5": "^1.6.2-beta.7457",
49
49
  "sass": "^1.17.0",
50
50
  "bootstrap": "^4.3.1",
51
- "piral": "^1.6.2-beta.7394",
52
- "piral-auth": "^1.6.2-beta.7394",
53
- "piral-hooks-utils": "^1.6.2-beta.7394",
54
- "piral-search": "^1.6.2-beta.7394",
51
+ "piral": "^1.6.2-beta.7457",
52
+ "piral-auth": "^1.6.2-beta.7457",
53
+ "piral-hooks-utils": "^1.6.2-beta.7457",
54
+ "piral-search": "^1.6.2-beta.7457",
55
55
  "reactstrap": "8.10.1",
56
56
  "tslib": "2.5.2",
57
57
  "react": "18.2.0",