@appsemble/types 0.30.14-test.5 → 0.32.1-test.14

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 CHANGED
@@ -1,9 +1,9 @@
1
- # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.30.14-test.5/config/assets/logo.svg) Appsemble Types
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.32.1-test.14/config/assets/logo.svg) Appsemble Types
2
2
 
3
3
  > Reusable TypeScript types
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@appsemble/types)](https://www.npmjs.com/package/@appsemble/types)
6
- [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.30.14-test.5/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.30.14-test.5)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.32.1-test.14/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.32.1-test.14)
7
7
  [![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)
8
8
 
9
9
  ## Table of Contents
@@ -26,5 +26,5 @@ not guaranteed.
26
26
 
27
27
  ## License
28
28
 
29
- [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.30.14-test.5/LICENSE.md) ©
29
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.32.1-test.14/LICENSE.md) ©
30
30
  [Appsemble](https://appsemble.com)
package/action.d.ts CHANGED
@@ -35,6 +35,9 @@ interface RequestLikeAction<T extends Action['type']> extends BaseAction<T> {
35
35
  export type RequestAction = RequestLikeAction<'request'>;
36
36
  export type ResourceCreateAction = RequestLikeAction<'resource.create'>;
37
37
  export type ResourceDeleteAction = RequestLikeAction<'resource.delete'>;
38
+ export type ResourceUpdatePositionsAction = RequestLikeAction<'resource.update.positions'>;
39
+ export type ResourceDeleteAllAction = RequestLikeAction<'resource.delete.all'>;
40
+ export type ResourceDeleteBulkAction = RequestLikeAction<'resource.delete.bulk'>;
38
41
  export type ResourceGetAction = RequestLikeAction<'resource.get'>;
39
42
  export type ResourceHistoryGetAction = RequestLikeAction<'resource.history.get'>;
40
43
  export type ResourceQueryAction = RequestLikeAction<'resource.query'>;
@@ -44,7 +47,7 @@ export type ResourcePatchAction = RequestLikeAction<'resource.patch'>;
44
47
  /**
45
48
  * An action that can be called from within a block.
46
49
  */
47
- export type Action = BaseAction<'analytics'> | BaseAction<'app.member.current.patch'> | BaseAction<'app.member.delete'> | BaseAction<'app.member.invite'> | BaseAction<'app.member.login'> | BaseAction<'app.member.logout'> | BaseAction<'app.member.properties.patch'> | BaseAction<'app.member.query'> | BaseAction<'app.member.register'> | BaseAction<'app.member.role.update'> | BaseAction<'condition'> | BaseAction<'controller'> | BaseAction<'dialog.error'> | BaseAction<'dialog.ok'> | BaseAction<'dialog'> | BaseAction<'download'> | BaseAction<'each'> | BaseAction<'email'> | BaseAction<'event'> | BaseAction<'flow.back'> | BaseAction<'flow.cancel'> | BaseAction<'flow.finish'> | BaseAction<'flow.next'> | BaseAction<'flow.to'> | BaseAction<'group.member.delete'> | BaseAction<'group.member.invite'> | BaseAction<'group.member.query'> | BaseAction<'group.member.role.update'> | BaseAction<'group.query'> | BaseAction<'link.back'> | BaseAction<'link.next'> | BaseAction<'match'> | BaseAction<'message'> | BaseAction<'noop'> | BaseAction<'notify'> | BaseAction<'resource.subscription.status'> | BaseAction<'resource.subscription.subscribe'> | BaseAction<'resource.subscription.toggle'> | BaseAction<'resource.subscription.unsubscribe'> | BaseAction<'share'> | BaseAction<'static'> | BaseAction<'storage.append'> | BaseAction<'storage.delete'> | BaseAction<'storage.read'> | BaseAction<'storage.subtract'> | BaseAction<'storage.update'> | BaseAction<'storage.write'> | BaseAction<'throw'> | LinkAction | LogAction | RequestAction | ResourceCountAction | ResourceCreateAction | ResourceDeleteAction | ResourceGetAction | ResourceHistoryGetAction | ResourcePatchAction | ResourceQueryAction | ResourceUpdateAction;
50
+ export type Action = BaseAction<'analytics'> | BaseAction<'app.member.current.patch'> | BaseAction<'app.member.delete'> | BaseAction<'app.member.invite'> | BaseAction<'app.member.login'> | BaseAction<'app.member.logout'> | BaseAction<'app.member.properties.patch'> | BaseAction<'app.member.query'> | BaseAction<'app.member.register'> | BaseAction<'app.member.role.update'> | BaseAction<'condition'> | BaseAction<'controller'> | BaseAction<'dialog.error'> | BaseAction<'dialog.ok'> | BaseAction<'dialog'> | BaseAction<'download'> | BaseAction<'each'> | BaseAction<'email'> | BaseAction<'event'> | BaseAction<'flow.back'> | BaseAction<'flow.cancel'> | BaseAction<'flow.finish'> | BaseAction<'flow.next'> | BaseAction<'flow.to'> | BaseAction<'group.member.delete'> | BaseAction<'group.member.invite'> | BaseAction<'group.member.query'> | BaseAction<'group.member.role.update'> | BaseAction<'group.query'> | BaseAction<'link.back'> | BaseAction<'link.next'> | BaseAction<'match'> | BaseAction<'message'> | BaseAction<'noop'> | BaseAction<'notify'> | BaseAction<'resource.subscription.status'> | BaseAction<'resource.subscription.subscribe'> | BaseAction<'resource.subscription.toggle'> | BaseAction<'resource.subscription.unsubscribe'> | BaseAction<'share'> | BaseAction<'static'> | BaseAction<'storage.append'> | BaseAction<'storage.delete'> | BaseAction<'storage.read'> | BaseAction<'storage.subtract'> | BaseAction<'storage.update'> | BaseAction<'storage.write'> | BaseAction<'throw'> | LinkAction | LogAction | RequestAction | ResourceCountAction | ResourceCreateAction | ResourceDeleteAction | ResourceDeleteAllAction | ResourceDeleteBulkAction | ResourceGetAction | ResourceHistoryGetAction | ResourcePatchAction | ResourceQueryAction | ResourceUpdateAction | ResourceUpdatePositionsAction;
48
51
  interface ActionErrorOptions<D extends ActionDefinition> {
49
52
  /**
50
53
  * What caused the error to be thrown.
package/index.d.ts CHANGED
@@ -25,6 +25,7 @@ export * from './ssl.js';
25
25
  export * from './template.js';
26
26
  export * from './theme.js';
27
27
  export * from './oauth2.js';
28
+ export * from './training.js';
28
29
  export * from './quota.js';
29
30
  export * from './permissions.js';
30
31
  export * from './roles.js';
@@ -155,6 +156,7 @@ export interface UserInfo extends BaseUserInfo {
155
156
  * If the user is subscribed to the newsletter
156
157
  */
157
158
  subscribed?: boolean;
159
+ hasPassword?: boolean;
158
160
  }
159
161
  export interface AppMemberInfo extends BaseUserInfo {
160
162
  /**
@@ -267,6 +269,22 @@ interface EndTimeICSRemapper extends BaseICSRemapper {
267
269
  */
268
270
  end: Remapper;
269
271
  }
272
+ export interface SubstringCaseType {
273
+ /**
274
+ * Whether to match the case of the substring.
275
+ */
276
+ strict?: boolean;
277
+ /**
278
+ * Substring to match.
279
+ */
280
+ substring: string;
281
+ }
282
+ type FilterParams = Record<string, {
283
+ type: 'Boolean' | 'Date' | 'Guid' | 'Number' | 'String';
284
+ value: Remapper;
285
+ comparator: 'eq' | 'ge' | 'gt' | 'le' | 'lt' | 'ne';
286
+ }>;
287
+ type OrderParams = Record<string, 'asc' | 'desc'>;
270
288
  export interface Remappers {
271
289
  /**
272
290
  * Get app metadata.
@@ -353,6 +371,22 @@ export interface Remappers {
353
371
  * If only one remapper or none is passed, the remapper value gets computed and then inverted.
354
372
  */
355
373
  not: Remapper[];
374
+ /**
375
+ * Compare all computed remapper values against each other.
376
+ *
377
+ * Returns `true` if all entries are true, otherwise `false`.
378
+ *
379
+ * If only one remapper is passed, the remapper is returned.
380
+ */
381
+ and: Remapper[];
382
+ /**
383
+ * Compare all computed remapper values against each other.
384
+ *
385
+ * Returns `false` if all entries are false, otherwise `true`.
386
+ *
387
+ * If only one remapper is passed, the remapper is returned.
388
+ */
389
+ or: Remapper[];
356
390
  /**
357
391
  * Get data stored at the current flow page step
358
392
  */
@@ -437,7 +471,7 @@ export interface Remappers {
437
471
  *
438
472
  * Returns nothing if array.map’s context isn’t set.
439
473
  */
440
- array: 'index' | 'item' | 'length';
474
+ array: 'index' | 'item' | 'length' | 'nextItem' | 'prevItem';
441
475
  /**
442
476
  *
443
477
  * Returns an array containing the items matching the specified conditions.
@@ -487,6 +521,85 @@ export interface Remappers {
487
521
  * ```
488
522
  */
489
523
  'object.omit': (string[] | string)[];
524
+ /**
525
+ * Compare two objects to each other and get an array of differences
526
+ *
527
+ * Nested object keys are returned as a path array.
528
+ *
529
+ * @example
530
+ * ```yaml
531
+ * object.compare:
532
+ * - object.from:
533
+ * name: Alice
534
+ * age: 25
535
+ * address:
536
+ * object.from:
537
+ * city: Paris
538
+ * zip: 7500
539
+ * - object.from:
540
+ * name: Alice
541
+ * age: 26
542
+ * address:
543
+ * object.from:
544
+ * city: Lyon
545
+ * country: France
546
+ * ```
547
+ *
548
+ * Returns:
549
+ * ```javascript
550
+ * [
551
+ * { path: ['age'], type: 'changed', from: 25, to: 26 },
552
+ * { path: ['address', 'city'], type: 'changed', from: 'Paris', to: 'Lyon' },
553
+ * { path: ['address', 'zip'], type: 'removed', value: 7500 },
554
+ * { path: ['address', 'country'], type: 'added', value: 'France' }
555
+ * ]
556
+ * ```
557
+ */
558
+ 'object.compare': [Remapper, Remapper];
559
+ /**
560
+ * Takes an object with an array property and transforms it into an array of objects.
561
+ *
562
+ * Each object in the resulting array contains all the entries of the original object
563
+ * plus all the entries of the corresponding array item from the array property.
564
+ *
565
+ * > **Note**
566
+ * > If one of the items in the array contains a key, which exists in the original object
567
+ * > it will overwrite the original key
568
+ *
569
+ * > **Note**
570
+ * > Nested arrays or objects are not exploded
571
+ *
572
+ * @example
573
+ * Input:
574
+ * ```javascript
575
+ * {
576
+ * ownerName: 'John',
577
+ * country: 'USA',
578
+ * pets: [
579
+ * { name: 'Milka' },
580
+ * { name: 'Sven', country: 'Sweden' },
581
+ * { name: 'Tom', likes: ['mice', 'fish'] },
582
+ * { name: 'Jerry', looks: { color: 'brown' } }
583
+ * ]
584
+ * }
585
+ * ```
586
+ *
587
+ * Remapper:
588
+ * ```yaml
589
+ * object.explode: pets
590
+ * ```
591
+ *
592
+ * Returns:
593
+ * ```javascript
594
+ * [
595
+ * { ownerName: 'John', name: 'Milka', country: 'USA' },
596
+ * { ownerName: 'John', name: 'Sven', country: 'Sweden' },
597
+ * { ownerName: 'John', name: 'Tom', country: 'USA', likes: ['mice', 'fish'] },
598
+ * { ownerName: 'John', name: 'Jerry', country: 'USA', looks: { color: 'brown' } }
599
+ * ]
600
+ * ```
601
+ */
602
+ 'object.explode': string;
490
603
  /**
491
604
  * Use a static value.
492
605
  */
@@ -530,6 +643,11 @@ export interface Remappers {
530
643
  choice: string;
531
644
  length: number;
532
645
  };
646
+ /**
647
+ * This remapper returns the length of the input array or a string, this remapper
648
+ * doesn't require array to be in the context unlike `{ array: length }` remapper.
649
+ */
650
+ len: null;
533
651
  /**
534
652
  * Get the input data as it was initially passed to the remap function.
535
653
  */
@@ -601,6 +719,18 @@ export interface Remappers {
601
719
  * Convert an input to lower or upper case.
602
720
  */
603
721
  'string.case': 'lower' | 'upper';
722
+ /**
723
+ * Check if the initial characters of the string matches with the input string.
724
+ */
725
+ 'string.startsWith': SubstringCaseType | string;
726
+ /**
727
+ * Check if the last characters of the string matches with the input string.
728
+ */
729
+ 'string.endsWith': SubstringCaseType | string;
730
+ /**
731
+ * Extract a section of the string or an array.
732
+ */
733
+ slice: number | [number, number];
604
734
  /**
605
735
  * Format a string using remapped input variables.
606
736
  */
@@ -629,10 +759,32 @@ export interface Remappers {
629
759
  */
630
760
  translate: string;
631
761
  container: string;
762
+ /**
763
+ * Construct an OData $filter
764
+ */
765
+ 'filter.from': FilterParams;
766
+ /**
767
+ * Construct an OData $orderby
768
+ */
769
+ 'order.from': OrderParams;
770
+ /**
771
+ * Parse an xml string to a JavaScript object
772
+ */
773
+ 'xml.parse': Remapper;
774
+ /**
775
+ * Check if the value is defined
776
+ *
777
+ * @example
778
+ * "" -> true
779
+ * 0 -> true
780
+ * null -> false
781
+ * undefined -> false
782
+ */
783
+ defined: Remapper;
632
784
  }
633
785
  export type ObjectRemapper = RequireExactlyOne<Remappers>;
634
786
  export type ArrayRemapper = (ArrayRemapper | ObjectRemapper)[];
635
- export type Remapper = ArrayRemapper | ObjectRemapper | boolean | number | string;
787
+ export type Remapper = ArrayRemapper | ObjectRemapper | boolean | number | string | null;
636
788
  export interface SubscriptionResponseResource {
637
789
  create: boolean;
638
790
  update: boolean;
@@ -648,7 +800,7 @@ export declare const resourceSubscribableAction: readonly ["create", "update", "
648
800
  export type ResourceSubscribableAction = (typeof resourceSubscribableAction)[number];
649
801
  export type ResourceViewAction = 'get' | 'query';
650
802
  export type OwnResourceAction = ResourceViewAction | 'delete' | 'patch' | 'update';
651
- export type ResourceAction = ResourceViewAction | 'create' | 'delete' | 'history.get' | 'patch' | 'update';
803
+ export type ResourceAction = ResourceViewAction | 'create' | 'delete' | 'history.get' | 'patch' | 'update.positions' | 'update';
652
804
  export type CustomAppResourcePermission = `$resource:${string}:${ResourceAction}`;
653
805
  export type CustomAppOwnResourcePermission = `$resource:${string}:own:${OwnResourceAction}`;
654
806
  export type CustomAppResourceViewPermission = `$resource:${string}:${ResourceViewAction}:${string}`;
@@ -658,6 +810,10 @@ export interface GuestDefinition {
658
810
  permissions?: CustomAppPermission[];
659
811
  inherits?: AppRole[];
660
812
  }
813
+ export interface CronSecurityDefinition {
814
+ permissions?: CustomAppPermission[];
815
+ inherits?: AppRole[];
816
+ }
661
817
  export interface RoleDefinition {
662
818
  description?: string;
663
819
  defaultPage?: string;
@@ -667,6 +823,7 @@ export interface RoleDefinition {
667
823
  export type SecurityPolicy = 'everyone' | 'invite' | 'organization';
668
824
  export interface MinimalSecurity {
669
825
  guest: GuestDefinition;
826
+ cron?: CronSecurityDefinition;
670
827
  default?: {
671
828
  role: AppRole;
672
829
  policy?: SecurityPolicy;
@@ -675,6 +832,7 @@ export interface MinimalSecurity {
675
832
  }
676
833
  export interface StrictSecurity {
677
834
  guest?: GuestDefinition;
835
+ cron?: CronSecurityDefinition;
678
836
  default: {
679
837
  role: AppRole;
680
838
  policy?: SecurityPolicy;
@@ -762,6 +920,11 @@ export interface ResourceDefinition {
762
920
  * A definition of how versioning should happen for instances of this resource.
763
921
  */
764
922
  history?: ResourceHistoryDefinition | boolean;
923
+ /**
924
+ * Whether to enable position column for the instances of this resource. This is used for keeping
925
+ * an ordered list to enable custom sorting of the data using drag and drop features.
926
+ */
927
+ positioning?: boolean;
765
928
  /**
766
929
  * The definition for the `resource.create` action.
767
930
  */
@@ -1121,6 +1284,10 @@ export interface StorageWriteActionDefinition extends BaseActionDefinition<'stor
1121
1284
  * @default 'indexedDB'
1122
1285
  */
1123
1286
  storage?: StorageType;
1287
+ /**
1288
+ * Expiry of the data stored, to be used with `localStorage`.
1289
+ */
1290
+ expiry?: '1d' | '3d' | '7d' | '12h';
1124
1291
  }
1125
1292
  export interface GroupMemberInviteActionDefinition extends BaseActionDefinition<'group.member.invite'> {
1126
1293
  /**
@@ -1317,18 +1484,27 @@ interface OwnResourceDefinition {
1317
1484
  */
1318
1485
  own?: boolean;
1319
1486
  }
1487
+ interface ResourceActionWithIdDefinition {
1488
+ /**
1489
+ * Id of the resource to fetch
1490
+ */
1491
+ id?: Remapper;
1492
+ }
1320
1493
  export interface ControllerActionDefinition extends BaseActionDefinition<'controller'> {
1321
1494
  handler: string;
1322
1495
  }
1323
1496
  export type RequestActionDefinition = RequestLikeActionDefinition<'request'>;
1324
1497
  export type ResourceCreateActionDefinition = ResourceActionDefinition<'resource.create'>;
1325
1498
  export type ResourceDeleteActionDefinition = ResourceActionDefinition<'resource.delete'>;
1499
+ export type ResourceDeleteAllActionDefinition = ResourceActionDefinition<'resource.delete.all'>;
1500
+ export type ResourceDeleteBulkActionDefinition = ResourceActionDefinition<'resource.delete.bulk'>;
1326
1501
  export type ResourceHistoryGetActionDefinition = ResourceActionDefinition<'resource.history.get'>;
1327
- export type ResourceGetActionDefinition = ResourceActionDefinition<'resource.get'> & ViewResourceDefinition;
1502
+ export type ResourceGetActionDefinition = ResourceActionDefinition<'resource.get'> & ResourceActionWithIdDefinition & ViewResourceDefinition;
1328
1503
  export type ResourceQueryActionDefinition = OwnResourceDefinition & ResourceActionDefinition<'resource.query'> & ViewResourceDefinition;
1329
1504
  export type ResourceCountActionDefinition = OwnResourceDefinition & ResourceActionDefinition<'resource.count'>;
1330
1505
  export type ResourceUpdateActionDefinition = ResourceActionDefinition<'resource.update'>;
1331
- export type ResourcePatchActionDefinition = ResourceActionDefinition<'resource.patch'>;
1506
+ export type ResourceUpdatePositionsActionDefinition = ResourceActionDefinition<'resource.update.positions'> & ResourceActionWithIdDefinition;
1507
+ export type ResourcePatchActionDefinition = ResourceActionDefinition<'resource.patch'> & ResourceActionWithIdDefinition;
1332
1508
  export type AppMemberLogoutAction = BaseActionDefinition<'app.member.logout'>;
1333
1509
  export interface BaseResourceSubscribeActionDefinition<T extends Action['type']> extends BaseActionDefinition<T> {
1334
1510
  /**
@@ -1394,7 +1570,7 @@ export type MessageActionDefinition = BaseActionDefinition<'message'> & BaseMess
1394
1570
  */
1395
1571
  body: Remapper;
1396
1572
  };
1397
- export type ActionDefinition = AnalyticsAction | AppMemberCurrentPatchAction | AppMemberDeleteAction | AppMemberInviteAction | AppMemberLoginAction | AppMemberLogoutAction | AppMemberPropertiesPatchAction | AppMemberQueryAction | AppMemberRegisterAction | AppMemberRoleUpdateAction | BaseActionDefinition<'dialog.error'> | BaseActionDefinition<'dialog.ok'> | BaseActionDefinition<'flow.back'> | BaseActionDefinition<'flow.cancel'> | BaseActionDefinition<'flow.finish'> | BaseActionDefinition<'flow.next'> | BaseActionDefinition<'group.query'> | BaseActionDefinition<'link.back'> | BaseActionDefinition<'link.next'> | BaseActionDefinition<'noop'> | BaseActionDefinition<'throw'> | ConditionActionDefinition | ControllerActionDefinition | DialogActionDefinition | DownloadActionDefinition | EachActionDefinition | EmailActionDefinition | EventActionDefinition | FlowToActionDefinition | GroupMemberDeleteActionDefinition | GroupMemberInviteActionDefinition | GroupMemberQueryActionDefinition | GroupMemberRoleUpdateActionDefinition | LinkActionDefinition | LogActionDefinition | MatchActionDefinition | MessageActionDefinition | NotifyActionDefinition | RequestActionDefinition | ResourceCountActionDefinition | ResourceCreateActionDefinition | ResourceDeleteActionDefinition | ResourceGetActionDefinition | ResourceHistoryGetActionDefinition | ResourcePatchActionDefinition | ResourceQueryActionDefinition | ResourceSubscriptionStatusActionDefinition | ResourceSubscriptionSubscribeActionDefinition | ResourceSubscriptionToggleActionDefinition | ResourceSubscriptionUnsubscribeActionDefinition | ResourceUpdateActionDefinition | ShareActionDefinition | StaticActionDefinition | StorageAppendActionDefinition | StorageDeleteActionDefinition | StorageReadActionDefinition | StorageSubtractActionDefinition | StorageUpdateActionDefinition | StorageWriteActionDefinition;
1573
+ export type ActionDefinition = AnalyticsAction | AppMemberCurrentPatchAction | AppMemberDeleteAction | AppMemberInviteAction | AppMemberLoginAction | AppMemberLogoutAction | AppMemberPropertiesPatchAction | AppMemberQueryAction | AppMemberRegisterAction | AppMemberRoleUpdateAction | BaseActionDefinition<'dialog.error'> | BaseActionDefinition<'dialog.ok'> | BaseActionDefinition<'flow.back'> | BaseActionDefinition<'flow.cancel'> | BaseActionDefinition<'flow.finish'> | BaseActionDefinition<'flow.next'> | BaseActionDefinition<'group.query'> | BaseActionDefinition<'link.back'> | BaseActionDefinition<'link.next'> | BaseActionDefinition<'noop'> | BaseActionDefinition<'throw'> | ConditionActionDefinition | ControllerActionDefinition | DialogActionDefinition | DownloadActionDefinition | EachActionDefinition | EmailActionDefinition | EventActionDefinition | FlowToActionDefinition | GroupMemberDeleteActionDefinition | GroupMemberInviteActionDefinition | GroupMemberQueryActionDefinition | GroupMemberRoleUpdateActionDefinition | LinkActionDefinition | LogActionDefinition | MatchActionDefinition | MessageActionDefinition | NotifyActionDefinition | RequestActionDefinition | ResourceCountActionDefinition | ResourceCreateActionDefinition | ResourceDeleteActionDefinition | ResourceDeleteAllActionDefinition | ResourceDeleteBulkActionDefinition | ResourceGetActionDefinition | ResourceHistoryGetActionDefinition | ResourcePatchActionDefinition | ResourceQueryActionDefinition | ResourceSubscriptionStatusActionDefinition | ResourceSubscriptionSubscribeActionDefinition | ResourceSubscriptionToggleActionDefinition | ResourceSubscriptionUnsubscribeActionDefinition | ResourceUpdateActionDefinition | ResourceUpdatePositionsActionDefinition | ShareActionDefinition | StaticActionDefinition | StorageAppendActionDefinition | StorageDeleteActionDefinition | StorageReadActionDefinition | StorageSubtractActionDefinition | StorageUpdateActionDefinition | StorageWriteActionDefinition;
1398
1574
  export interface ActionType {
1399
1575
  /**
1400
1576
  * Whether or not app creators are required to define this action.
@@ -1519,14 +1695,14 @@ export interface LoopPageDefinition extends BasePageDefinition {
1519
1695
  /**
1520
1696
  * Template step that the loop will pass data onto
1521
1697
  */
1522
- foreach?: SubPageDefinition;
1698
+ foreach: SubPageDefinition;
1523
1699
  /**
1524
1700
  * A mapping of actions that can be fired by the page to action handlers.
1525
1701
  */
1526
1702
  actions?: {
1527
1703
  onFlowCancel?: ActionDefinition;
1528
1704
  onFlowFinish?: ActionDefinition;
1529
- onLoad?: ActionDefinition;
1705
+ onLoad: ActionDefinition;
1530
1706
  };
1531
1707
  /**
1532
1708
  * The method used to display the progress of the flow page.
@@ -1568,7 +1744,7 @@ export interface AppDefinition {
1568
1744
  *
1569
1745
  * This determines the default path of the app.
1570
1746
  */
1571
- name?: string;
1747
+ name: string;
1572
1748
  /**
1573
1749
  * The description of the app.
1574
1750
  */
@@ -1615,6 +1791,14 @@ export interface AppDefinition {
1615
1791
  * @default 'navbar'
1616
1792
  */
1617
1793
  feedback?: LayoutPosition;
1794
+ /**
1795
+ * The location of the install button.
1796
+ *
1797
+ * If set to `navigation`, it will only be visible if `login` is also visible in `navigation`.
1798
+ *
1799
+ * @default 'navbar'
1800
+ */
1801
+ install?: LayoutPosition;
1618
1802
  /**
1619
1803
  * The navigation type to use.
1620
1804
  *
@@ -1656,6 +1840,10 @@ export interface AppDefinition {
1656
1840
  * Cron jobs associated with the app.
1657
1841
  */
1658
1842
  cron?: Record<string, CronDefinition>;
1843
+ /**
1844
+ * Webhooks associated with the app.
1845
+ */
1846
+ webhooks?: Record<string, WebhookDefinition>;
1659
1847
  /**
1660
1848
  * Companion containers of the app.
1661
1849
  */
@@ -1673,6 +1861,13 @@ export interface CronDefinition {
1673
1861
  schedule: string;
1674
1862
  action: ActionDefinition;
1675
1863
  }
1864
+ /**
1865
+ * The definition of a webhook for an app.
1866
+ */
1867
+ export interface WebhookDefinition {
1868
+ schema: OpenAPIV3.SchemaObject;
1869
+ action: ActionDefinition;
1870
+ }
1676
1871
  export interface App {
1677
1872
  /**
1678
1873
  * The unique identifier for the app.
@@ -1683,7 +1878,7 @@ export interface App {
1683
1878
  /**
1684
1879
  * A domain name on which this app should be served.
1685
1880
  */
1686
- domain?: string;
1881
+ domain?: string | null;
1687
1882
  /**
1688
1883
  * The name used for emails
1689
1884
  */
@@ -1691,7 +1886,7 @@ export interface App {
1691
1886
  /**
1692
1887
  * The id of the organization this app belongs to.
1693
1888
  */
1694
- OrganizationId?: string;
1889
+ OrganizationId: string;
1695
1890
  /**
1696
1891
  * The name of the organization this app belongs to.
1697
1892
  */
@@ -1728,6 +1923,14 @@ export interface App {
1728
1923
  * Whether the Appsemble password login method should be shown.
1729
1924
  */
1730
1925
  showAppsembleLogin: boolean;
1926
+ /**
1927
+ * Whether to display App member's name in the title bar.
1928
+ */
1929
+ displayAppMemberName: boolean;
1930
+ /**
1931
+ * Whether to display the installation prompt to the app members.
1932
+ */
1933
+ displayInstallationPrompt: boolean;
1731
1934
  /**
1732
1935
  * Whether the Appsemble OAuth2 login method should be shown.
1733
1936
  */
@@ -1739,11 +1942,11 @@ export interface App {
1739
1942
  /**
1740
1943
  * The Sentry DSN of the app.
1741
1944
  */
1742
- sentryDsn: string;
1945
+ sentryDsn?: string;
1743
1946
  /**
1744
1947
  * The Sentry environment associated with the Sentry DSN.
1745
1948
  */
1746
- sentryEnvironment: string;
1949
+ sentryEnvironment?: string;
1747
1950
  /**
1748
1951
  * The app definition.
1749
1952
  */
@@ -1751,7 +1954,7 @@ export interface App {
1751
1954
  /**
1752
1955
  * The app definition formatted as YAML.
1753
1956
  */
1754
- yaml: string;
1957
+ yaml?: string;
1755
1958
  /**
1756
1959
  * An app rating.
1757
1960
  */
@@ -2030,7 +2233,7 @@ export interface Messages {
2030
2233
  /**
2031
2234
  * A mapping of message id to message content.
2032
2235
  */
2033
- messages: AppsembleMessages;
2236
+ messages?: AppsembleMessages;
2034
2237
  }
2035
2238
  export interface AppMessages {
2036
2239
  /**
@@ -2128,6 +2331,13 @@ export interface AppServiceSecretDefinition {
2128
2331
  * The custom certificate authority used for client-certificate method.
2129
2332
  */
2130
2333
  ca?: string;
2334
+ /**
2335
+ * If a secret is marked public, it can be applied to the unauthenticated users, e.g. in the
2336
+ * requests originating in a custom sign up or login page.
2337
+ *
2338
+ * @default false
2339
+ */
2340
+ public: boolean;
2131
2341
  }
2132
2342
  export interface AppServiceSecret extends AppServiceSecretDefinition {
2133
2343
  /**
@@ -2135,6 +2345,22 @@ export interface AppServiceSecret extends AppServiceSecretDefinition {
2135
2345
  */
2136
2346
  id: number;
2137
2347
  }
2348
+ export interface AppWebhookSecretDefinition {
2349
+ /**
2350
+ * The name of the webhook this secret is tied to.
2351
+ */
2352
+ webhookName: string;
2353
+ /**
2354
+ * An optional name to give extra clarity what the secret is used for.
2355
+ */
2356
+ name?: string;
2357
+ }
2358
+ export interface AppWebhookSecret extends AppWebhookSecretDefinition {
2359
+ /**
2360
+ * An autogenerated ID.
2361
+ */
2362
+ id: string;
2363
+ }
2138
2364
  export interface AppOAuth2Secret extends OAuth2Provider {
2139
2365
  /**
2140
2366
  * An autogenerated ID.
@@ -2201,66 +2427,6 @@ export interface AppSamlSecret extends WritableAppSamlSecret {
2201
2427
  */
2202
2428
  spCertificate?: string;
2203
2429
  }
2204
- export interface Training {
2205
- /**
2206
- * Id of the training
2207
- */
2208
- id: number;
2209
- /**
2210
- * Title of the training.
2211
- */
2212
- title: string;
2213
- /**
2214
- * A brief overview of what the training is about.
2215
- */
2216
- description: string;
2217
- /**
2218
- * Tags related to competence of the training.
2219
- */
2220
- competences: string[];
2221
- /**
2222
- * Difficulty level of the training.
2223
- */
2224
- difficultyLevel: number;
2225
- /**
2226
- * The creation date of the training.
2227
- */
2228
- $created?: string;
2229
- /**
2230
- * The date when the training was last updated.
2231
- */
2232
- $updated?: string;
2233
- }
2234
- export interface TrainingBlock {
2235
- /**
2236
- * ID of the training block
2237
- */
2238
- id: string;
2239
- /**
2240
- * Title of the block.
2241
- */
2242
- title: string;
2243
- /**
2244
- * Id of the parent training.
2245
- */
2246
- trainingId: number;
2247
- /**
2248
- * A link pointing to the documentation of Appsemble.
2249
- */
2250
- documentationLink?: string;
2251
- /**
2252
- * A link pointing to a video regarding the topic.
2253
- */
2254
- videoLink?: string;
2255
- /**
2256
- * Link to an external resource.
2257
- */
2258
- externalResource?: string;
2259
- /**
2260
- * Example code for the user to try out.
2261
- */
2262
- exampleCode?: string;
2263
- }
2264
2430
  export type SAMLStatus = 'badsignature' | 'emailconflict' | 'invalidrelaystate' | 'invalidsecret' | 'invalidstatuscode' | 'invalidsubjectconfirmation' | 'missingnameid' | 'missingsubject';
2265
2431
  export interface ProjectConfig {
2266
2432
  /**
@@ -2327,7 +2493,7 @@ export interface BlockManifest extends ProjectManifest {
2327
2493
  /**
2328
2494
  * The URL that can be used to fetch this block’s icon.
2329
2495
  */
2330
- iconUrl?: string;
2496
+ iconUrl?: string | null;
2331
2497
  /**
2332
2498
  * The languages that are supported by the block by default.
2333
2499
  *
package/index.js CHANGED
@@ -14,6 +14,7 @@ export * from './ssl.js';
14
14
  export * from './template.js';
15
15
  export * from './theme.js';
16
16
  export * from './oauth2.js';
17
+ export * from './training.js';
17
18
  export * from './quota.js';
18
19
  export * from './permissions.js';
19
20
  export * from './roles.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/types",
3
- "version": "0.30.14-test.5",
3
+ "version": "0.32.1-test.14",
4
4
  "description": "TypeScript definitions reused within Appsemble internally",
5
5
  "keywords": [
6
6
  "app",
@@ -23,14 +23,16 @@
23
23
  "sideEffects": false,
24
24
  "type": "module",
25
25
  "exports": {
26
- ".": [
27
- "./index.js",
28
- "./index.ts"
29
- ]
26
+ ".": {
27
+ "ts-source": "./index.ts",
28
+ "default": "./index.js"
29
+ }
30
30
  },
31
31
  "files": [
32
32
  "**/*.d.ts",
33
33
  "**/*.js",
34
+ "!**/*.test.js",
35
+ "!**/*.test.d.ts",
34
36
  "!*.config.js"
35
37
  ],
36
38
  "scripts": {
@@ -39,8 +41,9 @@
39
41
  },
40
42
  "dependencies": {
41
43
  "@fortawesome/fontawesome-common-types": "^6.0.0",
42
- "jsonschema": "^1.0.0",
44
+ "jsonschema": "~1.4.1",
43
45
  "openapi-types": "^12.0.0",
46
+ "react": "^18.0.0",
44
47
  "type-fest": "^4.0.0"
45
48
  }
46
49
  }
package/permissions.d.ts CHANGED
@@ -370,31 +370,7 @@ export declare enum OrganizationPermission {
370
370
  /**
371
371
  * The permission to send manual push notifications for an app.
372
372
  */
373
- PushAppNotifications = 65,
374
- /**
375
- * The permission to create trainings.
376
- */
377
- CreateTrainings = 66,
378
- /**
379
- * The permission to update trainings.
380
- */
381
- UpdateTrainings = 67,
382
- /**
383
- * The permission to delete trainings.
384
- */
385
- DeleteTrainings = 68,
386
- /**
387
- * The permission to create training blocks.
388
- */
389
- CreateTrainingBlocks = 69,
390
- /**
391
- * The permission to update training blocks.
392
- */
393
- UpdateTrainingBlocks = 70,
394
- /**
395
- * The permission to delete training blocks.
396
- */
397
- DeleteTrainingBlocks = 71
373
+ PushAppNotifications = 65
398
374
  }
399
375
  export declare const appOrganizationPermissionMapping: {
400
376
  [key in AppPermission]: OrganizationPermission;
package/permissions.js CHANGED
@@ -373,30 +373,6 @@ export var OrganizationPermission;
373
373
  * The permission to send manual push notifications for an app.
374
374
  */
375
375
  OrganizationPermission[OrganizationPermission["PushAppNotifications"] = 65] = "PushAppNotifications";
376
- /**
377
- * The permission to create trainings.
378
- */
379
- OrganizationPermission[OrganizationPermission["CreateTrainings"] = 66] = "CreateTrainings";
380
- /**
381
- * The permission to update trainings.
382
- */
383
- OrganizationPermission[OrganizationPermission["UpdateTrainings"] = 67] = "UpdateTrainings";
384
- /**
385
- * The permission to delete trainings.
386
- */
387
- OrganizationPermission[OrganizationPermission["DeleteTrainings"] = 68] = "DeleteTrainings";
388
- /**
389
- * The permission to create training blocks.
390
- */
391
- OrganizationPermission[OrganizationPermission["CreateTrainingBlocks"] = 69] = "CreateTrainingBlocks";
392
- /**
393
- * The permission to update training blocks.
394
- */
395
- OrganizationPermission[OrganizationPermission["UpdateTrainingBlocks"] = 70] = "UpdateTrainingBlocks";
396
- /**
397
- * The permission to delete training blocks.
398
- */
399
- OrganizationPermission[OrganizationPermission["DeleteTrainingBlocks"] = 71] = "DeleteTrainingBlocks";
400
376
  })(OrganizationPermission || (OrganizationPermission = {}));
401
377
  export const appOrganizationPermissionMapping = {
402
378
  [AppPermission.CreateAppInvites]: OrganizationPermission.CreateAppInvites,
package/resource.d.ts CHANGED
@@ -51,7 +51,7 @@ export interface ResourceAuthor {
51
51
  /**
52
52
  * The display name of the user.
53
53
  */
54
- name: string;
54
+ name?: string;
55
55
  }
56
56
  export interface ResourceGroup {
57
57
  /**
@@ -66,5 +66,5 @@ export interface ResourceGroup {
66
66
  export interface ResourceVersion {
67
67
  created: string;
68
68
  data: Record<string, unknown>;
69
- author: ResourceAuthor;
69
+ author?: ResourceAuthor;
70
70
  }
package/roles.js CHANGED
@@ -85,20 +85,10 @@ const OrganizationBlockManagerPermissions = [
85
85
  OrganizationPermission.PublishBlocks,
86
86
  OrganizationPermission.DeleteBlocks,
87
87
  ];
88
- const OrganizationTrainingManagerPermissions = [
89
- ...OrganizationMemberPermissions,
90
- OrganizationPermission.CreateTrainings,
91
- OrganizationPermission.UpdateTrainings,
92
- OrganizationPermission.DeleteTrainings,
93
- OrganizationPermission.CreateTrainingBlocks,
94
- OrganizationPermission.UpdateTrainingBlocks,
95
- OrganizationPermission.DeleteTrainingBlocks,
96
- ];
97
88
  const OrganizationMaintainerPermissions = [
98
89
  ...OrganizationAppManagerPermissions,
99
90
  ...OrganizationAppCollectionManagerPermissions,
100
91
  ...OrganizationBlockManagerPermissions,
101
- ...OrganizationTrainingManagerPermissions,
102
92
  OrganizationPermission.CreateApps,
103
93
  OrganizationPermission.DeleteApps,
104
94
  OrganizationPermission.CreateOrganizationInvites,
package/training.d.ts ADDED
@@ -0,0 +1,60 @@
1
+ import { type ComponentType } from 'react';
2
+ export type TrainingStatus = 'available' | 'blocked' | 'completed' | 'in progress';
3
+ export interface TrainingChapter {
4
+ /**
5
+ * ID of the chapter.
6
+ */
7
+ id: string;
8
+ /**
9
+ * Title of the chapter
10
+ */
11
+ title: string;
12
+ /**
13
+ * List of trainings that make up this chapter.
14
+ */
15
+ trainings: Training[];
16
+ /**
17
+ * The ID of the chapter that has to be completed before this one can be accessed.
18
+ */
19
+ blockedBy?: string;
20
+ /**
21
+ * The status of the chapter
22
+ */
23
+ status: TrainingStatus;
24
+ }
25
+ export interface Training {
26
+ /**
27
+ * Id of the training.
28
+ */
29
+ id: string;
30
+ /**
31
+ * Title of the training
32
+ */
33
+ title: string;
34
+ /**
35
+ * The path of the training page to route to.
36
+ */
37
+ path: string;
38
+ /**
39
+ * The content of the training to render.
40
+ */
41
+ content?: ComponentType;
42
+ /**
43
+ * The status of the training
44
+ */
45
+ status: TrainingStatus;
46
+ }
47
+ export interface TrainingChapterProperties {
48
+ /**
49
+ * The ID of the chapter that has to be completed before this one can be accessed.
50
+ */
51
+ blockedBy: string;
52
+ /**
53
+ * Title of the chapter
54
+ */
55
+ title: string;
56
+ /**
57
+ * The order in which the trainings must be completed
58
+ */
59
+ trainingOrder: string[];
60
+ }
package/training.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=training.js.map