@appsemble/types 0.33.5 → 0.33.9

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/index.d.ts CHANGED
@@ -1,34 +1,26 @@
1
+ import { type ActionType, type AppDefinition, type AppMemberInfo, type AppRole, type BlockManifest, type EventType, type ProjectConfig, type ProjectImplementations, type ProjectManifest, type Remapper } from '@appsemble/lang-sdk';
1
2
  import { type IconName } from '@fortawesome/fontawesome-common-types';
2
- import { type Schema } from 'jsonschema';
3
- import { type OpenAPIV3 } from 'openapi-types';
4
- import { type JsonObject, type RequireExactlyOne } from 'type-fest';
5
- import { type Action, type LogAction } from './action.js';
6
3
  import { type AppVisibility } from './app.js';
7
- import { type BulmaColor } from './bulma.js';
8
- import { type HTTPMethods } from './http.js';
9
- import { type AppPermission } from './permissions.js';
10
- import { type AppRole, type PredefinedAppRole, type PredefinedOrganizationRole } from './roles.js';
11
- import { type Theme } from './theme.js';
12
- export * from './action.js';
4
+ import { type PredefinedOrganizationRole } from './roles.js';
13
5
  export * from './app.js';
14
6
  export * from './asset.js';
15
7
  export * from './authentication.js';
16
8
  export * from './author.js';
17
9
  export * from './bulma.js';
18
10
  export * from './appCollection.js';
19
- export * from './http.js';
20
11
  export * from './cli.js';
21
12
  export * from './snapshot.js';
22
13
  export * from './resource.js';
23
14
  export * from './saml.js';
24
15
  export * from './ssl.js';
25
16
  export * from './template.js';
26
- export * from './theme.js';
27
17
  export * from './oauth2.js';
28
18
  export * from './training.js';
29
19
  export * from './quota.js';
30
20
  export * from './permissions.js';
31
21
  export * from './roles.js';
22
+ export type { AppMemberInfo };
23
+ export type { ProjectImplementations, BlockManifest, ProjectManifest, ActionType, EventType };
32
24
  /**
33
25
  * A representation of a generated OAuth2 authorization code response.
34
26
  */
@@ -38,1878 +30,117 @@ export interface OAuth2AuthorizationCode {
38
30
  */
39
31
  code: string;
40
32
  }
41
- /**
42
- * A project that is loaded in an app
43
- */
44
- export interface ControllerDefinition {
45
- /**
46
- * A mapping of actions that can be fired by the project to action handlers.
47
- *
48
- * The exact meaning of the parameters depends on the project.
49
- */
50
- actions?: Record<string, ActionDefinition>;
51
- /**
52
- * Mapping of the events the project can listen to and emit.
53
- *
54
- * The exact meaning of the parameters depends on the project.
55
- */
56
- events?: {
57
- listen?: Record<string, string>;
58
- emit?: Record<string, string>;
59
- };
60
- }
61
- /**
62
- * A block that is displayed on a page.
63
- */
64
- export interface BlockDefinition extends ControllerDefinition {
65
- /**
66
- * The type of the controller.
67
- *
68
- * A block type follow the format `@organization/project`.
69
- * If the organization is _appsemble_, it may be omitted.
70
- *
71
- * Pattern:
72
- * ^(@[a-z]([a-z\d-]{0,30}[a-z\d])?\/)?[a-z]([a-z\d-]{0,30}[a-z\d])$
73
- *
74
- * Examples:
75
- * - `empty`
76
- * - `@amsterdam/empty`
77
- */
78
- type: string;
79
- /**
80
- * A [semver](https://semver.org) representation of the project version.
81
- *
82
- * Pattern:
83
- * ^\d+\.\d+\.\d+$
84
- */
85
- version: string;
86
- /**
87
- * An optional header to render above the block.
88
- */
89
- header?: Remapper;
90
- /**
91
- * An override of the block’s default layout.
92
- */
93
- layout?: 'float' | 'grow' | 'static';
94
- /**
95
- * For floating blocks this property defines where the block should float.
96
- */
97
- position?: 'bottom left' | 'bottom right' | 'bottom' | 'left' | 'right' | 'top left' | 'top right' | 'top';
98
- /**
99
- * Whether to render the block or not.
100
- */
101
- hide?: Remapper;
102
- /**
103
- * The theme of the block.
104
- */
105
- theme?: Partial<Theme>;
106
- /**
107
- * A list of roles that are allowed to view this block.
108
- */
109
- roles?: ViewRole[];
110
- /**
111
- * A free form mapping of named parameters.
112
- *
113
- * The exact meaning of the parameters depends on the project type.
114
- */
115
- parameters?: JsonObject;
116
- }
117
33
  /**
118
34
  * OpenID Connect specifies a set of standard claims about the end-user, which cover common profile
119
35
  * information such as name, contact details, date of birth and locale.
120
36
  *
121
37
  * The Connect2id server can be set up to provide additional custom claims, such as roles and
122
- * permissions.
123
- */
124
- export interface BaseUserInfo {
125
- /**
126
- * The subject (end-user) identifier. This member is always present in a claims set.
127
- */
128
- sub: string;
129
- /**
130
- * The full name of the end-user, with optional language tag.
131
- */
132
- name: string;
133
- /**
134
- * The end-user's preferred email address.
135
- */
136
- email: string;
137
- /**
138
- * True if the end-user's email address has been verified, else false.
139
- */
140
- email_verified: boolean;
141
- /**
142
- * The URL of the profile picture for the end-user.
143
- */
144
- picture?: string;
145
- /**
146
- * The end-user’s locale, represented as a BCP47 language tag.
147
- */
148
- locale?: string;
149
- /**
150
- * The end-user’s time zone.
151
- */
152
- zoneinfo?: string;
153
- }
154
- export interface UserInfo extends BaseUserInfo {
155
- /**
156
- * If the user is subscribed to the newsletter
157
- */
158
- subscribed?: boolean;
159
- hasPassword?: boolean;
160
- }
161
- export interface AppMemberInfo extends BaseUserInfo {
162
- /**
163
- * The role of the app member.
164
- */
165
- role: AppRole;
166
- /**
167
- * The end-user's additional properties
168
- */
169
- properties?: Record<string, any>;
170
- /**
171
- * Whether this app member is used for demonstration purposes
172
- */
173
- demo: boolean;
174
- }
175
- export interface SSOConfiguration {
176
- type: 'oauth2' | 'saml';
177
- url: string;
178
- icon: IconName;
179
- name: string;
180
- }
181
- export interface AppAccount {
182
- app: App;
183
- appMemberInfo: AppMemberInfo;
184
- sso: SSOConfiguration[];
185
- }
186
- export interface EmailAuthorization {
187
- email: string;
188
- verified: boolean;
189
- }
190
- /**
191
- * The payload stored in our JSON web tokens
192
- */
193
- export interface JwtPayload {
194
- aud: string;
195
- exp: number;
196
- iat: string;
197
- iss: string;
198
- scope: string;
199
- sub: string;
200
- }
201
- /**
202
- * A response for a login token request
203
- */
204
- export interface TokenResponse {
205
- /**
206
- * The bearer access token to use for authenticating requests.
207
- */
208
- access_token: string;
209
- /**
210
- * How long until the access token expires in seconds from now.
211
- */
212
- expires_in?: number;
213
- /**
214
- * The OpenID ID token as a JWT.
215
- *
216
- * This field is only present on OpenID connect providers.
217
- */
218
- id_token?: string;
219
- /**
220
- * A refresh token for getting a new access token.
221
- */
222
- refresh_token?: string;
223
- token_type: 'bearer';
224
- }
225
- /**
226
- * A type to represent the app lock.
227
- */
228
- export type AppLock = 'fullLock' | 'studioLock' | 'unlocked';
229
- interface BaseICSRemapper {
230
- /**
231
- * The start of the icalendar event.
232
- */
233
- start: Remapper;
234
- /**
235
- * The title of the event.
236
- */
237
- title: Remapper;
238
- /**
239
- * An optional description of the event.
240
- */
241
- description?: Remapper;
242
- /**
243
- * An optional link to attach to the event.
244
- */
245
- url?: Remapper;
246
- /**
247
- * An optional location description to attach to the event.
248
- */
249
- location?: Remapper;
250
- /**
251
- * An optional geolocation description to attach to the event.
252
- *
253
- * This must be an object with the properties `lat` or `latitude`, and `lon`, `lng` or
254
- * `longitude`.
255
- */
256
- coordinates?: Remapper;
257
- }
258
- interface DurationICSRemapper extends BaseICSRemapper {
259
- /**
260
- * The duration of the event.
261
- *
262
- * @example '1w 3d 10h 30m'
263
- */
264
- duration: Remapper;
265
- }
266
- interface EndTimeICSRemapper extends BaseICSRemapper {
267
- /**
268
- * The end time of the event as a date or a date string.
269
- */
270
- end: Remapper;
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'>;
288
- export interface Remappers {
289
- /**
290
- * Get app metadata.
291
- *
292
- * Supported properties:
293
- *
294
- * - `id`: Get the app id.
295
- * - `locale`: Get the current locale of the app.
296
- * - `url`: Get the base URL of the app.
297
- */
298
- app: 'id' | 'locale' | 'url';
299
- /**
300
- * Get property of the AppMember object.
301
- *
302
- * Supported properties:
303
- *
304
- * - `sub`: Get the id of the app member.
305
- * - `name`: Get the name of the app member.
306
- * - `email`: Get the email of the app member.
307
- * - `email_verified`: Whether the email of the app member is verified.
308
- * - `picture`: Get the picture of the app member.
309
- * - `locale`: Get the locale of the app member.
310
- * - `zoneinfo`: Get the zoneinfo of the app member.
311
- * - `role`: Get the role of the app member.
312
- * - `properties`: Get the custom properties of the app member.
313
- */
314
- 'app.member': keyof AppMemberInfo;
315
- /**
316
- * Get a predefined app variable by name.
317
- */
318
- variable: string;
319
- /**
320
- * Get page metadata.
321
- *
322
- * Supported properties:
323
- *
324
- * - `data`: Get the current page data.
325
- * - `url`: Get the URL of the current page.
326
- */
327
- page: 'data' | 'url';
328
- /**
329
- * Get a property from the context.
330
- */
331
- context: string;
332
- /**
333
- * Get the title of current page.
334
- */
335
- 'tab.name': string;
336
- /**
337
- * Convert a string to a number.
338
- */
339
- 'number.parse': Remapper;
340
- /**
341
- * Convert a string to a date using a given format.
342
- */
343
- 'date.parse': string;
344
- /**
345
- * Returns the current date.
346
- */
347
- 'date.now': unknown;
348
- /**
349
- * Adds to a date.
350
- */
351
- 'date.add': string;
352
- /**
353
- * Formats a date to an iso8601 / rfc3339 compatible string.
354
- *
355
- * An argument can also be specified to use a different output format.
356
- *
357
- * Please refer to https://date-fns.org/docs/format for the supported patterns.
358
- */
359
- 'date.format'?: string;
360
- /**
361
- * Compare all computed remapper values against each other.
362
- *
363
- * Returns `true` if all entries are equal, otherwise `false`.
364
- */
365
- equals: Remapper[];
366
- /**
367
- * Compare all computed remapper values against the first.
368
- *
369
- * Returns `false` if all entries are equal to the first entry, otherwise `true`.
370
- *
371
- * If only one remapper or none is passed, the remapper value gets computed and then inverted.
372
- */
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[];
390
- /**
391
- * Get data stored at the current flow page step
392
- */
393
- step: string;
394
- /**
395
- * Compares the first computed remapper value with the second computed remapper value.
396
- *
397
- * Returns `true` of the first entry is greater than the second entry.
398
- */
399
- gt: [Remapper, Remapper];
400
- /**
401
- * Compares the first computed remapper value with the second computed remapper value.
402
- *
403
- * Returns `true` of the first entry is less than the second entry.
404
- */
405
- lt: [Remapper, Remapper];
406
- /**
407
- * Logs its input data (returns it) and its context.
408
- *
409
- * The value to set is the log level.
410
- */
411
- log: 'error' | 'info' | 'warn';
412
- /**
413
- * Get input object type.
414
- */
415
- type: null;
416
- /**
417
- * Builds an array based on the given data and remappers.
418
- *
419
- * The remappers gets applied to each item in the array.
420
- *
421
- * Always returns an array, can be empty if supplied data isn’t an array.
422
- */
423
- 'array.map': Remapper;
424
- /**
425
- * Filters out unique entries from an array.
426
- *
427
- * The value Remapper is applied to each entry in the array,
428
- * using its result to determine uniqueness.
429
- *
430
- * If the value Remapper result in `undefined` or `null`, the entire entry is used for uniqueness.
431
- *
432
- * If the input is not an array, the input is returned without any modifications.
433
- */
434
- 'array.unique': Remapper;
435
- /**
436
- * Flattens an array.
437
- *
438
- * The value of the remapper is used for the flattening depth.
439
- *
440
- * If the value Remapper result in `undefined` or `null`, the array will be flattened until
441
- * the last layer.
442
- *
443
- * If the input is not an array, the input is returned without any modifications.
444
- */
445
- 'array.flatten': Remapper;
446
- /**
447
- * Create an icalendar event.
448
- */
449
- ics: DurationICSRemapper | EndTimeICSRemapper;
450
- /**
451
- * Checks if condition results in a truthy value.
452
- *
453
- * Returns value of then if condition is truthy, otherwise it returns the value of else.
454
- */
455
- if: {
456
- condition: Remapper;
457
- then: Remapper;
458
- else: Remapper;
459
- };
460
- /**
461
- * Check if any case results in a truthy value.
462
- *
463
- * Returns the value of the first case where the condition equals true, otherwise returns null.
464
- */
465
- match: {
466
- case: Remapper;
467
- value: Remapper;
468
- }[];
469
- /**
470
- * Get the current array.map’s index or length.
471
- *
472
- * Returns nothing if array.map’s context isn’t set.
473
- */
474
- array: 'index' | 'item' | 'length' | 'nextItem' | 'prevItem';
475
- /**
476
- *
477
- * Returns an array containing the items matching the specified conditions.
478
- */
479
- 'array.filter': Remapper;
480
- /**
481
- * Returns an object based on the specified condition
482
- */
483
- 'array.find': Remapper;
484
- /**
485
- * Create a new array with an array of predefined remappers.
486
- */
487
- 'array.from': Remapper[];
488
- /**
489
- * Append new values to the end of an array.
490
- *
491
- * If the input is not an array an empty array is returned.
492
- */
493
- 'array.append': Remapper[];
494
- /**
495
- * Remove item(s) from an array given a predefined array of remappable indices.
496
- *
497
- * Only the remapped values that are turned into numbers are applied.
498
- *
499
- * If the input is not an array an empty array is returned.
500
- */
501
- 'array.omit': Remapper[];
502
- /**
503
- * Create a new object given some predefined mapper keys.
504
- */
505
- 'object.from': Record<string, Remapper>;
506
- /**
507
- * Assign properties to an existing object given some predefined mapper keys.
508
- */
509
- 'object.assign': Record<string, Remapper>;
510
- /**
511
- * Remove properties from an existing object based on the given the object keys.
512
- *
513
- * Nested properties can be removed using arrays of keys.
514
- *
515
- * @example
516
- * ```yaml
517
- * object.omit:
518
- * - foo # Removes the property foo
519
- * - - bar # Removes the property baz inside of bar
520
- * - baz
521
- * ```
522
- */
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;
603
- /**
604
- * Use a static value.
605
- */
606
- static: any;
607
- /**
608
- * Get a property from an object.
609
- *
610
- * If the prop is an array, nested properties will be retrieved in sequence.
611
- */
612
- prop: number[] | Remapper | string[];
613
- /**
614
- * Recursively strip all nullish values from an object or array.
615
- */
616
- 'null.strip': {
617
- depth: number;
618
- } | null;
619
- /**
620
- * Pick and return a random entry from an array.
621
- *
622
- * If the input is not an array, the input is returned as-is.
623
- */
624
- 'random.choice': null;
625
- /**
626
- * Pick and return a random entry from an array.
627
- *
628
- * If the input is not an array, the input is returned as-is.
629
- */
630
- 'random.integer': [number, number];
631
- /**
632
- * Pick and return a random entry from an array.
633
- *
634
- * If the input is not an array, the input is returned as-is.
635
- */
636
- 'random.float': [number, number];
637
- /**
638
- * Pick and return a random entry from an array.
639
- *
640
- * If the input is not an array, the input is returned as-is.
641
- */
642
- 'random.string': {
643
- choice: string;
644
- length: number;
645
- };
646
- /**
647
- * This remapper return true if the provided item is in the input array.
648
- *
649
- */
650
- 'array.contains': Remapper;
651
- /**
652
- * This remapper return true if the provided string is a substring of the input string.
653
- *
654
- */
655
- 'string.contains': string;
656
- /**
657
- * This remapper returns the length of the input array or a string, this remapper
658
- * doesn't require array to be in the context unlike `{ array: length }` remapper.
659
- */
660
- len: null;
661
- /**
662
- * Get the input data as it was initially passed to the remap function.
663
- */
664
- root: null;
665
- /**
666
- * Get the data at a certain index from the history stack prior to an action.
667
- *
668
- * 0 is the index of the first item in the history stack.
669
- */
670
- history: number;
671
- /**
672
- * Create a new object with properties from the history stack at a certain index.
673
- */
674
- 'from.history': {
675
- /**
676
- * The index of the history stack item to apply.
677
- *
678
- * 0 is the index of the first item in the history stack.
679
- */
680
- index: number;
681
- /**
682
- * Predefined mapper keys to choose what properties to apply.
683
- */
684
- props: Record<string, Remapper>;
685
- };
686
- /**
687
- * Assign properties from the history stack at a certain index to an existing object.
688
- */
689
- 'assign.history': {
690
- /**
691
- * The index of the history stack item to assign.
692
- *
693
- * 0 is the index of the first item in the history stack.
694
- */
695
- index: number;
696
- /**
697
- * Predefined mapper keys to choose what properties to assign.
698
- */
699
- props: Record<string, Remapper>;
700
- };
701
- /**
702
- * Assign properties from the history stack at a certain index and exclude the unwanted.
703
- */
704
- 'omit.history': {
705
- /**
706
- * The index of the history stack item to assign.
707
- *
708
- * 0 is the index of the first item in the history stack.
709
- */
710
- index: number;
711
- /**
712
- * Exclude properties from the history stack item, based on the given object keys.
713
- *
714
- * Nested properties can be excluded using arrays of keys.
715
- *
716
- * @example
717
- * ```yaml
718
- * omit.history:
719
- * index: 0
720
- * keys:
721
- * - foo # Excludes the property foo
722
- * - - bar # Excludes the property baz inside of bar
723
- * - baz
724
- * ```
725
- */
726
- keys: (string[] | string)[];
727
- };
728
- /**
729
- * Convert an input to lower or upper case.
730
- */
731
- 'string.case': 'lower' | 'upper';
732
- /**
733
- * Check if the initial characters of the string matches with the input string.
734
- */
735
- 'string.startsWith': SubstringCaseType | string;
736
- /**
737
- * Check if the last characters of the string matches with the input string.
738
- */
739
- 'string.endsWith': SubstringCaseType | string;
740
- /**
741
- * Extract a section of the string or an array.
742
- */
743
- slice: number | [number, number];
744
- /**
745
- * Format a string using remapped input variables.
746
- */
747
- 'string.format': {
748
- /**
749
- * The message id pointing to the template string to format.
750
- */
751
- messageId?: Remapper;
752
- /**
753
- * The template default string to format.
754
- */
755
- template?: string;
756
- /**
757
- * A set of remappers to convert the input to usable values.
758
- */
759
- values?: Record<string, Remapper>;
760
- };
761
- /**
762
- * Match the content with the regex in the key, and replace it with its value.
763
- */
764
- 'string.replace': Record<string, string>;
765
- /**
766
- * Translate using a messageID.
767
- *
768
- * This does not support parameters, for more nuanced translations use `string.format`.
769
- */
770
- translate: Remapper;
771
- container: string;
772
- /**
773
- * Construct an OData $filter
774
- */
775
- 'filter.from': FilterParams;
776
- /**
777
- * Construct an OData $orderby
778
- */
779
- 'order.from': OrderParams;
780
- /**
781
- * Parse an xml string to a JavaScript object
782
- */
783
- 'xml.parse': Remapper;
784
- /**
785
- * Check if the value is defined
786
- *
787
- * @example
788
- * "" -> true
789
- * 0 -> true
790
- * null -> false
791
- * undefined -> false
792
- */
793
- defined: Remapper;
794
- /**
795
- * Perform the specified mathematical operation on the two numbers.
796
- *
797
- * Where the position matters, `a` is the first input.
798
- *
799
- * If one of the inputs is not a number, or the operation is invalid, `-1` is returned.
800
- */
801
- maths: {
802
- a: Remapper;
803
- b: Remapper;
804
- operation: 'add' | 'divide' | 'mod' | 'multiply' | 'subtract';
805
- };
806
- }
807
- export type ObjectRemapper = RequireExactlyOne<Remappers>;
808
- export type ArrayRemapper = (ArrayRemapper | ObjectRemapper)[];
809
- export type Remapper = ArrayRemapper | ObjectRemapper | boolean | number | string | null;
810
- export interface SubscriptionResponseResource {
811
- create: boolean;
812
- update: boolean;
813
- delete: boolean;
814
- subscriptions?: Record<string, {
815
- create?: boolean;
816
- update: boolean;
817
- delete: boolean;
818
- }>;
819
- }
820
- export type SubscriptionResponse = Record<string, SubscriptionResponseResource>;
821
- export declare const resourceSubscribableAction: readonly ["create", "update", "delete"];
822
- export type ResourceSubscribableAction = (typeof resourceSubscribableAction)[number];
823
- export type ResourceViewAction = 'get' | 'query';
824
- export type OwnResourceAction = ResourceViewAction | 'delete' | 'patch' | 'update';
825
- export type ResourceAction = ResourceViewAction | 'create' | 'delete' | 'history.get' | 'patch' | 'update.positions' | 'update';
826
- export type CustomAppResourcePermission = `$resource:${string}:${ResourceAction}`;
827
- export type CustomAppOwnResourcePermission = `$resource:${string}:own:${OwnResourceAction}`;
828
- export type CustomAppResourceViewPermission = `$resource:${string}:${ResourceViewAction}:${string}`;
829
- export type CustomAppGuestPermission = AppPermission | CustomAppResourcePermission | CustomAppResourceViewPermission;
830
- export type CustomAppPermission = CustomAppGuestPermission | CustomAppOwnResourcePermission;
831
- export interface GuestDefinition {
832
- permissions?: CustomAppPermission[];
833
- inherits?: AppRole[];
834
- }
835
- export interface CronSecurityDefinition {
836
- permissions?: CustomAppPermission[];
837
- inherits?: AppRole[];
838
- }
839
- export interface RoleDefinition {
840
- description?: string;
841
- defaultPage?: string;
842
- inherits?: AppRole[];
843
- permissions?: CustomAppPermission[];
844
- }
845
- export type SecurityPolicy = 'everyone' | 'invite' | 'organization';
846
- export interface MinimalSecurity {
847
- guest: GuestDefinition;
848
- cron?: CronSecurityDefinition;
849
- default?: {
850
- role: AppRole;
851
- policy?: SecurityPolicy;
852
- };
853
- roles?: Record<Exclude<string, PredefinedAppRole>, RoleDefinition>;
854
- }
855
- export interface StrictSecurity {
856
- guest?: GuestDefinition;
857
- cron?: CronSecurityDefinition;
858
- default: {
859
- role: AppRole;
860
- policy?: SecurityPolicy;
861
- };
862
- roles: Record<string, RoleDefinition>;
863
- }
864
- export type Security = MinimalSecurity | StrictSecurity;
865
- export type Navigation = 'bottom' | 'hidden' | 'left-menu';
866
- export type LayoutPosition = 'hidden' | 'navbar' | 'navigation';
867
- export interface NotificationDefinition {
868
- to?: string[];
869
- subscribe?: 'all' | 'both' | 'single';
870
- data?: {
871
- title: string;
872
- content: string;
873
- link: string;
874
- };
875
- }
876
- /**
877
- * A collection of hooks that are triggered upon calling a resource actions.
878
- */
879
- export interface ResourceHooks {
880
- notification: NotificationDefinition;
881
- }
882
- export interface ResourceCall {
883
- /**
884
- * The HTTP method to use for making the HTTP request.
885
- */
886
- method?: HTTPMethods;
887
- /**
888
- * The URL to which to make the resource request.
889
- */
890
- url?: string;
891
- /**
892
- * The associated hooks with the resource action.
893
- */
894
- hooks?: ResourceHooks;
895
- /**
896
- * Query parameters to pass along with the request.
897
- */
898
- query?: Remapper;
899
- }
900
- export interface ResourceReferenceActionTrigger {
901
- type: 'create' | 'delete' | 'update';
902
- cascade?: 'delete' | 'update';
903
- }
904
- interface ResourceReferenceAction {
905
- triggers: ResourceReferenceActionTrigger[];
906
- }
907
- export interface ResourceReference {
908
- /**
909
- * The name of the referenced resource.
910
- */
911
- resource: string;
912
- create?: ResourceReferenceAction;
913
- update?: ResourceReferenceAction;
914
- delete?: ResourceReferenceAction;
915
- }
916
- export interface ResourceHistoryDefinition {
917
- /**
918
- * If set to `false`, edits are still tracked, but exactly what changed is lost.
919
- */
920
- data: boolean;
921
- }
922
- export interface ResourceView {
923
- /**
924
- * The remappers used to transform the output.
925
- */
926
- remap: Remapper;
927
- }
928
- export interface AppMemberPropertyDefinition {
929
- /**
930
- * The JSON schema to validate user properties against before sending it to the backend.
931
- */
932
- schema: OpenAPIV3.SchemaObject;
933
- /**
934
- * The resource that is referenced by this user property.
935
- */
936
- reference?: {
937
- resource: string;
938
- };
939
- }
940
- export interface ResourceDefinition {
941
- /**
942
- * A definition of how versioning should happen for instances of this resource.
943
- */
944
- history?: ResourceHistoryDefinition | boolean;
945
- /**
946
- * Whether to enable position column for the instances of this resource. This is used for keeping
947
- * an ordered list to enable custom sorting of the data using drag and drop features.
948
- */
949
- positioning?: boolean;
950
- /**
951
- * Enforce Custom Ordering By the fields.
952
- */
953
- enforceOrderingGroupByFields?: string[];
954
- /**
955
- * The definition for the `resource.create` action.
956
- */
957
- create?: ResourceCall;
958
- /**
959
- * The definition for the `resource.delete` action.
960
- */
961
- delete?: ResourceCall;
962
- /**
963
- * The definition for the `resource.get` action.
964
- */
965
- get?: ResourceCall;
966
- /**
967
- * The definition for the `resource.query` action.
968
- */
969
- query?: ResourceCall;
970
- /**
971
- * The definition for the `resource.count` action.
972
- */
973
- count?: ResourceCall;
974
- /**
975
- * The definition for the `resource.update` action.
976
- */
977
- update?: ResourceCall;
978
- /**
979
- * The definition for the `resource.patch` action.
980
- */
981
- patch?: ResourceCall;
982
- /**
983
- * The property to use as the id.
984
- *
985
- * @default `id`
986
- */
987
- id?: string;
988
- /**
989
- * The JSON schema to validate resources against before sending it to the backend.
990
- */
991
- schema: OpenAPIV3.SchemaObject;
992
- /**
993
- * The URL to post the resource to.
994
- *
995
- * @default autogenerated for use with the Appsemble resource API.
996
- */
997
- url?: string;
998
- /**
999
- * The alternate views of this resource.
1000
- */
1001
- views?: Record<string, ResourceView>;
1002
- /**
1003
- * The references this resources has to other resources.
1004
- */
1005
- references?: Record<string, ResourceReference>;
1006
- /**
1007
- * A time string representing when a resource should expire.
1008
- *
1009
- * @example '1d 8h 30m'
1010
- */
1011
- expires?: string;
1012
- /**
1013
- * Whether the resource should be able to be transferred when cloning the app it belongs to.
1014
- */
1015
- clonable?: boolean;
1016
- }
1017
- export interface BaseActionDefinition<T extends Action['type']> {
1018
- /**
1019
- * The type of the action.
1020
- */
1021
- type: T;
1022
- /**
1023
- * A remapper function. This may be used to remap data before it is passed into the action
1024
- * function.
1025
- *
1026
- * @deprecated Since 0.20.10, use {@link remapBefore} instead.
1027
- */
1028
- remap?: Remapper;
1029
- /**
1030
- * A remapper function. This may be used to remap data before it is passed into the action
1031
- * function.
1032
- */
1033
- remapBefore?: Remapper;
1034
- /**
1035
- * The remapper used to transform the output before passing it to the next action.
1036
- */
1037
- remapAfter?: Remapper;
1038
- /**
1039
- * Another action that is dispatched when the action has been dispatched successfully.
1040
- */
1041
- onSuccess?: ActionDefinition;
1042
- /**
1043
- * Another action that is dispatched when the action has failed to dispatch successfully.
1044
- */
1045
- onError?: ActionDefinition;
1046
- }
1047
- export interface AnalyticsAction extends BaseActionDefinition<'analytics'> {
1048
- /**
1049
- * The analytics event target name.
1050
- */
1051
- target: string;
1052
- /**
1053
- * Additional config to pass to analytics.
1054
- */
1055
- config?: Remapper;
1056
- }
1057
- export interface ConditionActionDefinition extends BaseActionDefinition<'condition'> {
1058
- /**
1059
- * The condition to check for.
1060
- */
1061
- if: Remapper;
1062
- /**
1063
- * The action to run if the condition is true.
1064
- */
1065
- then: ActionDefinition;
1066
- /**
1067
- * The action to run if the condition is false.
1068
- */
1069
- else: ActionDefinition;
1070
- }
1071
- export interface MatchActionDefinition extends BaseActionDefinition<'match'> {
1072
- /**
1073
- * Run another action if one of the cases is true.
1074
- *
1075
- * Only the first case that equals true is called.
1076
- */
1077
- match: {
1078
- /**
1079
- * The case to be matched.
1080
- */
1081
- case: Remapper;
1082
- /**
1083
- * Action to be called if the case equals true.
1084
- */
1085
- action: ActionDefinition;
1086
- }[];
1087
- }
1088
- export interface DialogActionDefinition extends BaseActionDefinition<'dialog'> {
1089
- /**
1090
- * If false, the dialog cannot be closed by clicking outside of the dialog or on the close button.
1091
- */
1092
- closable?: boolean;
1093
- /**
1094
- * If true, the dialog will be displayed full screen.
1095
- */
1096
- fullscreen?: boolean;
1097
- /**
1098
- * Blocks to render on the dialog.
1099
- */
1100
- blocks: BlockDefinition[];
1101
- /**
1102
- * The title to show in the dialog.
1103
- */
1104
- title?: Remapper;
1105
- }
1106
- export interface DownloadActionDefinition extends BaseActionDefinition<'download'> {
1107
- /**
1108
- * The filename to download the file as. It must include a file extension.
1109
- */
1110
- filename: string;
1111
- }
1112
- export interface EachActionDefinition extends BaseActionDefinition<'each'> {
1113
- /**
1114
- * Run the actions in series instead of parallel.
1115
- */
1116
- serial?: boolean;
1117
- /**
1118
- * Run an action for each entry in an array.
1119
- *
1120
- * The actions are run in parallel.
1121
- *
1122
- * If the input is not an array, the action will be applied to the input instead.
1123
- */
1124
- do: ActionDefinition;
1125
- }
1126
- export interface EmailActionDefinition extends BaseActionDefinition<'email'> {
1127
- /**
1128
- * The recipient of the email.
1129
- */
1130
- to?: Remapper;
1131
- /**
1132
- * The name of the sender.
1133
- *
1134
- * The default value depends on the email server.
1135
- */
1136
- from?: Remapper;
1137
- /**
1138
- * The recipients to CC the email to.
1139
- */
1140
- cc?: Remapper;
1141
- /**
1142
- * The recipients to BCC the email to.
1143
- */
1144
- bcc?: Remapper;
1145
- /**
1146
- * The subject of the email.
1147
- */
1148
- subject: Remapper;
1149
- /**
1150
- * The body of the email.
1151
- */
1152
- body: Remapper;
1153
- /**
1154
- * The attachments to include in the email.
1155
- *
1156
- * The remapper must resolve to an object containing the following properties:
1157
- *
1158
- * - \`target\`: The asset ID or link to download contents from to add as an attachment. This is
1159
- * mutually exclusive with \`content\`.
1160
- * - \`content\`: The raw content to include as the file content. This is mutually exclusive with
1161
- * \`target\`.
1162
- * - \`filename\`: The filename to include the attachment as.
1163
- * - \`accept\` If the target is a URL, this will be set as the HTTP \`Accept\` header when
1164
- * downloading the file.
1165
- *
1166
- * If the attachment is a string, it will be treated as the target.
1167
- */
1168
- attachments?: Remapper;
1169
- }
1170
- export interface FlowToActionDefinition extends BaseActionDefinition<'flow.to'> {
1171
- /**
1172
- * The flow step to go to.
1173
- */
1174
- step: Remapper;
1175
- }
1176
- export interface LinkActionDefinition extends BaseActionDefinition<'link'> {
1177
- /**
1178
- * Where to link to.
1179
- *
1180
- * This should be a page name.
1181
- */
1182
- to: Remapper | string[] | string;
1183
- }
1184
- export interface NotifyActionDefinition extends BaseActionDefinition<'notify'> {
1185
- /**
1186
- * The title of the notification.
1187
- */
1188
- title: Remapper;
1189
- /**
1190
- * The description of the notification.
1191
- */
1192
- body: Remapper;
1193
- /**
1194
- * To whom the notification should be sent.
1195
- *
1196
- * Use `all` to send the notification to all app subscribed users.
1197
- * Or notify specific users by passing either a single user id or an array of user ids.
1198
- *
1199
- * Nothing is sent if the value is **not** a valid user id.
1200
- */
1201
- to: Remapper;
1202
- }
1203
- export interface LogActionDefinition extends BaseActionDefinition<'log'> {
1204
- /**
1205
- * The logging level on which to log.
1206
- *
1207
- * @default `info`.
1208
- */
1209
- level?: LogAction['level'];
1210
- }
1211
- export interface ShareActionDefinition extends BaseActionDefinition<'share'> {
1212
- /**
1213
- * The URL that is being shared.
1214
- */
1215
- url?: Remapper;
1216
- /**
1217
- * The main body that is being shared.
1218
- */
1219
- text?: Remapper;
1220
- /**
1221
- * The title that is being shared, if supported.
1222
- */
1223
- title?: Remapper;
1224
- }
1225
- export type StorageType = 'appStorage' | 'indexedDB' | 'localStorage' | 'sessionStorage';
1226
- export interface StorageAppendActionDefinition extends BaseActionDefinition<'storage.append'> {
1227
- /**
1228
- * The key of the entry to write to the app’s storage.
1229
- */
1230
- key: Remapper;
1231
- /**
1232
- * The data to write to the app’s storage.
1233
- */
1234
- value: Remapper;
1235
- /**
1236
- * The mechanism used to read the data from.
1237
- *
1238
- * @default 'indexedDB'
1239
- */
1240
- storage?: StorageType;
1241
- }
1242
- export interface StorageDeleteActionDefinition extends BaseActionDefinition<'storage.delete'> {
1243
- /**
1244
- * The key of the entry to delete from the app’s storage.
1245
- */
1246
- key: Remapper;
1247
- /**
1248
- * The mechanism used to delete the data from.
1249
- *
1250
- * @default 'indexedDB'
1251
- */
1252
- storage?: StorageType;
1253
- }
1254
- export interface StorageSubtractActionDefinition extends BaseActionDefinition<'storage.subtract'> {
1255
- /**
1256
- * The key of the entry to subtract the last entry from
1257
- */
1258
- key: Remapper;
1259
- /**
1260
- * The mechanism used to read the data from.
1261
- *
1262
- * @default 'indexedDB'
1263
- */
1264
- storage?: StorageType;
1265
- }
1266
- export interface StorageUpdateActionDefinition extends BaseActionDefinition<'storage.update'> {
1267
- /**
1268
- * The key of the entry to write to the app’s storage.
1269
- */
1270
- key: Remapper;
1271
- /**
1272
- * The key of the item to update.
1273
- */
1274
- item: Remapper;
1275
- /**
1276
- * The data to update the specified item with.
1277
- */
1278
- value: Remapper;
1279
- /**
1280
- * The mechanism used to read the data from.
1281
- *
1282
- * @default 'indexedDB'
1283
- */
1284
- storage?: StorageType;
1285
- }
1286
- export interface StorageReadActionDefinition extends BaseActionDefinition<'storage.read'> {
1287
- /**
1288
- * The key of the entry to read from the app’s storage.
1289
- */
1290
- key: Remapper;
1291
- /**
1292
- * The mechanism used to read the data from.
1293
- *
1294
- * @default 'indexedDB'
1295
- */
1296
- storage?: StorageType;
1297
- }
1298
- export interface StorageWriteActionDefinition extends BaseActionDefinition<'storage.write'> {
1299
- /**
1300
- * The key of the entry to write to the app’s storage.
1301
- */
1302
- key: Remapper;
1303
- /**
1304
- * The data to write to the app’s storage.
1305
- */
1306
- value: Remapper;
1307
- /**
1308
- * The mechanism used to read the data from.
1309
- *
1310
- * @default 'indexedDB'
1311
- */
1312
- storage?: StorageType;
1313
- /**
1314
- * Expiry of the data stored, to be used with `localStorage`.
1315
- */
1316
- expiry?: '1d' | '3d' | '7d' | '12h';
1317
- }
1318
- export interface GroupMemberInviteActionDefinition extends BaseActionDefinition<'group.member.invite'> {
1319
- /**
1320
- * The ID of the group to invite the user to.
1321
- */
1322
- id: Remapper;
1323
- /**
1324
- * The email address of the user to invite.
1325
- */
1326
- email: Remapper;
1327
- /**
1328
- * The role of the invited group member.
1329
- */
1330
- role: Remapper;
1331
- }
1332
- export interface GroupMemberQueryActionDefinition extends BaseActionDefinition<'group.member.query'> {
1333
- /**
1334
- * The ID of the group to query the members of.
1335
- */
1336
- id: Remapper;
1337
- }
1338
- export interface GroupMemberDeleteActionDefinition extends BaseActionDefinition<'group.member.delete'> {
1339
- /**
1340
- * The ID of the group member to delete.
1341
- */
1342
- id: Remapper;
1343
- }
1344
- export interface GroupMemberRoleUpdateActionDefinition extends BaseActionDefinition<'group.member.role.update'> {
1345
- /**
1346
- * The ID of the group member to update the role of.
1347
- */
1348
- id: Remapper;
1349
- /**
1350
- * The role to invite the app member with.
1351
- */
1352
- role: Remapper;
1353
- }
1354
- export interface AppMemberLoginAction extends BaseActionDefinition<'app.member.login'> {
1355
- /**
1356
- * The email address to log in with.
1357
- */
1358
- email: Remapper;
1359
- /**
1360
- * The password to log in with.
1361
- */
1362
- password: Remapper;
1363
- }
1364
- export interface AppMemberRegisterAction extends BaseActionDefinition<'app.member.register'> {
1365
- /**
1366
- * The email address to register with.
1367
- */
1368
- email: Remapper;
1369
- /**
1370
- * The password to login with.
1371
- */
1372
- password: Remapper;
1373
- /**
1374
- * The full name of the app member.
1375
- */
1376
- name: Remapper;
1377
- /**
1378
- * The profile picture to use.
1379
- *
1380
- * This must be a file, otherwise it’s discarded.
1381
- */
1382
- picture?: Remapper;
1383
- /**
1384
- * Custom properties that can be assigned freely.
1385
- *
1386
- * Every value will be converted to a string.
1387
- */
1388
- properties?: Remapper;
1389
- /**
1390
- * Whether to login after registering.
1391
- *
1392
- * @default true
1393
- */
1394
- login?: boolean;
1395
- }
1396
- export interface AppMemberInviteAction extends BaseActionDefinition<'app.member.invite'> {
1397
- /**
1398
- * The email address to invite the app member with.
1399
- */
1400
- email: Remapper;
1401
- /**
1402
- * The role to invite the app member with.
1403
- */
1404
- role: Remapper;
1405
- }
1406
- export interface AppMemberQueryAction extends BaseActionDefinition<'app.member.query'> {
1407
- /**
1408
- * The roles of the users to fetch.
1409
- */
1410
- roles?: Remapper;
1411
- /**
1412
- * Additional filters to fetch members based on properties and other fields.
1413
- *
1414
- */
1415
- query?: Remapper;
1416
- }
1417
- export interface AppMemberRoleUpdateAction extends BaseActionDefinition<'app.member.role.update'> {
1418
- /**
1419
- * The id of the app member to update.
1420
- */
1421
- sub: Remapper;
1422
- /**
1423
- * The role of the updated app member
1424
- */
1425
- role: Remapper;
1426
- }
1427
- export interface AppMemberPropertiesPatchAction extends BaseActionDefinition<'app.member.properties.patch'> {
1428
- /**
1429
- * The id of the app member to update.
1430
- */
1431
- sub: Remapper;
1432
- /**
1433
- * Custom properties that can be assigned freely.
1434
- *
1435
- * Every value will be converted to a string.
1436
- */
1437
- properties: Remapper;
1438
- }
1439
- export interface AppMemberCurrentPatchAction extends BaseActionDefinition<'app.member.current.patch'> {
1440
- /**
1441
- * The display name to update.
1442
- */
1443
- name?: Remapper;
1444
- /**
1445
- * Custom properties that can be assigned freely.
1446
- *
1447
- * Every value will be converted to a string.
1448
- */
1449
- properties?: Remapper;
1450
- /**
1451
- * The profile picture to use.
1452
- *
1453
- * This must be a file, otherwise it’s discarded.
1454
- */
1455
- picture?: Remapper;
1456
- }
1457
- export interface AppMemberDeleteAction extends BaseActionDefinition<'app.member.delete'> {
1458
- /**
1459
- * The id of the app member to remove.
1460
- */
1461
- sub: Remapper;
1462
- }
1463
- interface RequestActionHeaders {
1464
- 'Content-Type': 'application/x-www-form-urlencoded' | 'application/xml' | 'multipart/form-data' | 'text/plain';
1465
- }
1466
- export interface RequestLikeActionDefinition<T extends Action['type'] = Action['type']> extends BaseActionDefinition<T> {
1467
- /**
1468
- * The HTTP method to use for making a request.
1469
- */
1470
- method?: HTTPMethods;
1471
- /**
1472
- * Whether or not to proxy the request through the Appsemble proxy endpoint.
1473
- *
1474
- * @default true
1475
- */
1476
- proxy?: boolean;
1477
- /**
1478
- * A JSON schema against which to validate data before uploading.
1479
- */
1480
- schema?: OpenAPIV3.SchemaObject;
1481
- /**
1482
- * Query parameters to pass along with the request.
1483
- */
1484
- query?: Remapper;
1485
- /**
1486
- * The URL to which to make the request.
1487
- */
1488
- url?: Remapper;
1489
- /**
1490
- * A remapper for the request body.
1491
- *
1492
- * If this isn’t specified, the raw input data is used.
1493
- */
1494
- body?: Remapper;
1495
- /**
1496
- * Headers for the outgoing request.
1497
- */
1498
- headers?: RequestActionHeaders;
1499
- }
1500
- export interface ResourceActionDefinition<T extends Action['type']> extends RequestLikeActionDefinition<T> {
1501
- /**
1502
- * The name of the resource.
1503
- */
1504
- resource: string;
1505
- }
1506
- interface ViewResourceDefinition {
1507
- /**
1508
- * The view to use for the request.
1509
- */
1510
- view?: string;
1511
- }
1512
- interface OwnResourceDefinition {
1513
- /**
1514
- * If only the resources created by the authenticated app member should be included
1515
- */
1516
- own?: boolean;
1517
- }
1518
- interface ResourceActionWithIdDefinition {
1519
- /**
1520
- * Id of the resource to fetch
1521
- */
1522
- id?: Remapper;
1523
- }
1524
- export interface ControllerActionDefinition extends BaseActionDefinition<'controller'> {
1525
- handler: string;
1526
- }
1527
- export type RequestActionDefinition = RequestLikeActionDefinition<'request'>;
1528
- export type ResourceCreateActionDefinition = ResourceActionDefinition<'resource.create'>;
1529
- export type ResourceDeleteActionDefinition = ResourceActionDefinition<'resource.delete'>;
1530
- export type ResourceDeleteAllActionDefinition = ResourceActionDefinition<'resource.delete.all'>;
1531
- export type ResourceDeleteBulkActionDefinition = ResourceActionDefinition<'resource.delete.bulk'>;
1532
- export type ResourceHistoryGetActionDefinition = ResourceActionDefinition<'resource.history.get'>;
1533
- export type ResourceGetActionDefinition = ResourceActionDefinition<'resource.get'> & ResourceActionWithIdDefinition & ViewResourceDefinition;
1534
- export type ResourceQueryActionDefinition = OwnResourceDefinition & ResourceActionDefinition<'resource.query'> & ViewResourceDefinition;
1535
- export type ResourceCountActionDefinition = OwnResourceDefinition & ResourceActionDefinition<'resource.count'>;
1536
- export type ResourceUpdateActionDefinition = ResourceActionDefinition<'resource.update'>;
1537
- export type ResourceUpdatePositionsActionDefinition = ResourceActionDefinition<'resource.update.positions'> & ResourceActionWithIdDefinition;
1538
- export type ResourcePatchActionDefinition = ResourceActionDefinition<'resource.patch'> & ResourceActionWithIdDefinition;
1539
- export type AppMemberLogoutAction = BaseActionDefinition<'app.member.logout'>;
1540
- export interface BaseResourceSubscribeActionDefinition<T extends Action['type']> extends BaseActionDefinition<T> {
1541
- /**
1542
- * The name of the resource.
1543
- */
1544
- resource: string;
1545
- /**
1546
- * The action to subscribe to. Defaults to `update` if not specified.
1547
- */
1548
- action?: 'create' | 'delete' | 'update';
1549
- }
1550
- export type ResourceSubscriptionSubscribeActionDefinition = BaseResourceSubscribeActionDefinition<'resource.subscription.subscribe'>;
1551
- export type ResourceSubscriptionUnsubscribeActionDefinition = BaseResourceSubscribeActionDefinition<'resource.subscription.unsubscribe'>;
1552
- export type ResourceSubscriptionToggleActionDefinition = BaseResourceSubscribeActionDefinition<'resource.subscription.toggle'>;
1553
- export type ResourceSubscriptionStatusActionDefinition = Omit<BaseResourceSubscribeActionDefinition<'resource.subscription.status'>, 'action'>;
1554
- export interface EventActionDefinition extends BaseActionDefinition<'event'> {
38
+ * permissions.
39
+ */
40
+ export interface BaseUserInfo {
1555
41
  /**
1556
- * The name of the event to emit to.
42
+ * The subject (end-user) identifier. This member is always present in a claims set.
1557
43
  */
1558
- event: string;
44
+ sub: string;
1559
45
  /**
1560
- * An event to wait for before resolving.
1561
- *
1562
- * If this is unspecified, the action will resolve with the input data.
46
+ * The full name of the end-user, with optional language tag.
1563
47
  */
1564
- waitFor?: string;
1565
- }
1566
- export interface StaticActionDefinition extends BaseActionDefinition<'static'> {
48
+ name: string;
1567
49
  /**
1568
- * The value to return.
50
+ * The end-user's preferred email address.
1569
51
  */
1570
- value: any;
1571
- }
1572
- export interface BaseMessage {
52
+ email: string;
1573
53
  /**
1574
- * The color to use for the message.
1575
- *
1576
- * @default 'info'
54
+ * True if the end-user's email address has been verified, else false.
1577
55
  */
1578
- color?: BulmaColor;
56
+ email_verified: boolean;
1579
57
  /**
1580
- * The timeout period for this message (in milliseconds).
1581
- *
1582
- * @default 5000
58
+ * The URL of the profile picture for the end-user.
1583
59
  */
1584
- timeout?: number;
60
+ picture?: string;
1585
61
  /**
1586
- * Whether or not to show the dismiss button.
1587
- *
1588
- * @default false
62
+ * The end-user’s locale, represented as a BCP47 language tag.
1589
63
  */
1590
- dismissable?: boolean;
64
+ locale?: string;
1591
65
  /**
1592
- * The position of the message on the screen.
1593
- *
1594
- * @default 'bottom'
66
+ * The end-user’s time zone.
1595
67
  */
1596
- layout?: 'bottom' | 'top';
68
+ zoneinfo?: string;
1597
69
  }
1598
- export type MessageActionDefinition = BaseActionDefinition<'message'> & BaseMessage & {
1599
- /**
1600
- * The content of the message to display.
1601
- */
1602
- body: Remapper;
1603
- };
1604
- export interface CsvParserActionDefinition extends BaseActionDefinition<'csv.parse'> {
1605
- /**
1606
- * The value to return.
1607
- */
1608
- file: Remapper;
70
+ export interface UserInfo extends BaseUserInfo {
1609
71
  /**
1610
- * Delimiter
72
+ * If the user is subscribed to the newsletter
1611
73
  */
1612
- delimiter?: Remapper;
74
+ subscribed?: boolean;
75
+ hasPassword?: boolean;
1613
76
  }
1614
- 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 | CsvParserActionDefinition | 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;
1615
- export interface ActionType {
1616
- /**
1617
- * Whether or not app creators are required to define this action.
1618
- */
1619
- required?: boolean;
1620
- /**
1621
- * The description of the action.
1622
- */
1623
- description?: string;
77
+ export interface SSOConfiguration {
78
+ type: 'oauth2' | 'saml';
79
+ url: string;
80
+ icon: IconName;
81
+ name: string;
1624
82
  }
1625
- export interface EventType {
1626
- /**
1627
- * The description of the action.
1628
- */
1629
- description?: string;
83
+ export interface AppAccount {
84
+ app: App;
85
+ appMemberInfo: AppMemberInfo;
86
+ sso: SSOConfiguration[];
87
+ }
88
+ export interface EmailAuthorization {
89
+ email: string;
90
+ verified: boolean;
1630
91
  }
1631
- export type ViewRole = AppRole | '$guest';
1632
92
  /**
1633
- * This describes what a page will look like in the app.
93
+ * The payload stored in our JSON web tokens
1634
94
  */
1635
- export interface BasePageDefinition {
1636
- /**
1637
- * The name of the page.
1638
- *
1639
- * This will be displayed at the *app bar* of each page and in the side menu,
1640
- * unless @see navTitle is set.
1641
- *
1642
- * The name of the page is used to determine the URL path of the page.
1643
- */
1644
- name: string;
1645
- /**
1646
- * Whether or not the page name should be displayed in the *app bar*.
1647
- */
1648
- hideName?: boolean;
1649
- /**
1650
- * The name of the page when displayed in the navigation menu.
1651
- *
1652
- * Context property `name` can be used to access the name of the page.
1653
- */
1654
- navTitle?: Remapper;
1655
- /**
1656
- * Whether or not the page should be displayed in navigational menus.
1657
- */
1658
- hideNavTitle?: boolean;
1659
- /**
1660
- * The navigation type to use for the page.
1661
- * Setting this will override the default navigation for the app.
1662
- */
1663
- navigation?: Navigation;
1664
- /**
1665
- * A list of roles that may view the page.
1666
- */
1667
- roles?: ViewRole[];
1668
- /**
1669
- * An optional icon from the fontawesome icon set
1670
- *
1671
- * This will be displayed in the navigation menu.
1672
- */
1673
- icon?: IconName;
1674
- /**
1675
- * Page parameters can be used for linking to a page that should display a single resource.
1676
- */
1677
- parameters?: string[];
1678
- /**
1679
- * The global theme for the page.
1680
- */
1681
- theme?: Partial<Theme>;
1682
- /**
1683
- * A Remapper that resolves to a number to be visible in the side-menu.
1684
- */
1685
- badgeCount?: Remapper;
1686
- /**
1687
- * A mapping of actions that can be fired by the page to action handlers.
1688
- */
1689
- actions?: {
1690
- onLoad?: ActionDefinition;
1691
- };
95
+ export interface JwtPayload {
96
+ aud: string;
97
+ exp: number;
98
+ iat: string;
99
+ iss: string;
100
+ scope: string;
101
+ sub: string;
1692
102
  }
1693
103
  /**
1694
- * A subset of page for use within flow pages and tab pages.
104
+ * A response for a login token request
1695
105
  */
1696
- export interface SubPageDefinition {
1697
- name: Remapper;
1698
- roles?: ViewRole[];
1699
- blocks: BlockDefinition[];
1700
- }
1701
- export interface BasicPageDefinition extends BasePageDefinition {
1702
- type?: 'page';
1703
- blocks: BlockDefinition[];
1704
- }
1705
- export interface ContainerPageDefinition extends BasePageDefinition {
1706
- type: 'container';
1707
- pages: PageDefinition[];
1708
- }
1709
- export interface FlowPageDefinition extends Omit<BasePageDefinition, 'actions'> {
1710
- type: 'flow';
1711
- steps: SubPageDefinition[];
1712
- /**
1713
- * A mapping of actions that can be fired by the page to action handlers.
1714
- */
1715
- actions?: {
1716
- onLoad?: ActionDefinition;
1717
- onFlowCancel?: ActionDefinition;
1718
- onFlowFinish?: ActionDefinition;
1719
- };
1720
- /**
1721
- * The method used to display the progress of the flow page.
1722
- *
1723
- * @default 'corner-dots'
1724
- */
1725
- progress?: 'corner-dots' | 'hidden';
1726
- /**
1727
- * Whether to retain the flow data when navigating away to another page outside the flow.
1728
- *
1729
- * By default the flow page retains it's data after navigating once. Set to false to clear it.
1730
- *
1731
- * @default true
1732
- */
1733
- retainFlowData?: boolean;
1734
- }
1735
- export interface LoopPageDefinition extends BasePageDefinition {
1736
- type: 'loop';
1737
- /**
1738
- * Template step that the loop will pass data onto
1739
- */
1740
- foreach: SubPageDefinition;
1741
- /**
1742
- * A mapping of actions that can be fired by the page to action handlers.
1743
- */
1744
- actions?: {
1745
- onFlowCancel?: ActionDefinition;
1746
- onFlowFinish?: ActionDefinition;
1747
- onLoad: ActionDefinition;
1748
- };
1749
- /**
1750
- * The method used to display the progress of the flow page.
1751
- *
1752
- * @default 'corner-dots'
1753
- */
1754
- progress?: 'corner-dots' | 'hidden';
1755
- /**
1756
- * Whether to retain the flow data when navigating away to another page outside the flow.
1757
- *
1758
- * By default the flow page retains it's data after navigating once. Set to false to clear it.
1759
- *
1760
- * @default true
1761
- */
1762
- retainFlowData?: boolean;
1763
- }
1764
- export interface AlternateTabsDefinition {
1765
- foreach: SubPageDefinition;
1766
- events: {
1767
- listen?: Record<string, string>;
1768
- emit?: Record<string, string>;
1769
- };
1770
- }
1771
- export interface TabsPageDefinition extends BasePageDefinition {
1772
- type: 'tabs';
1773
- tabs?: SubPageDefinition[];
1774
- definition?: AlternateTabsDefinition;
1775
- /**
1776
- * A mapping of actions that can be fired by the page to action handlers.
1777
- */
1778
- actions?: {
1779
- onLoad?: ActionDefinition;
1780
- };
1781
- }
1782
- export type PageDefinition = BasicPageDefinition | ContainerPageDefinition | FlowPageDefinition | LoopPageDefinition | TabsPageDefinition;
1783
- export interface AppDefinition {
1784
- /**
1785
- * The name of the app.
1786
- *
1787
- * This determines the default path of the app.
1788
- */
1789
- name: string;
1790
- /**
1791
- * The description of the app.
1792
- */
1793
- description?: string;
1794
- /**
1795
- * The default language of the app.
1796
- *
1797
- * @default 'en'
1798
- */
1799
- defaultLanguage?: string;
1800
- /**
1801
- * The security definition of the app.
1802
- *
1803
- * This determines user roles and login behavior.
1804
- */
1805
- security?: Security;
1806
- /**
1807
- * The default page of the app.
1808
- */
1809
- defaultPage: string;
1810
- /**
1811
- * The settings for the layout of the app.
1812
- */
1813
- layout?: {
1814
- /**
1815
- * The location of the login button.
1816
- *
1817
- * @default 'navbar'
1818
- */
1819
- login?: LayoutPosition;
1820
- /**
1821
- * The location of the settings button.
1822
- *
1823
- * If set to `navigation`, it will only be visible if `login` is also visible in `navigation`.
1824
- *
1825
- * @default 'navbar'
1826
- */
1827
- settings?: LayoutPosition;
1828
- /**
1829
- * The location of the feedback button
1830
- *
1831
- * If set to `navigation`, it will only be visible if `login` is also visible in `navigation`.
1832
- *
1833
- * @default 'navbar'
1834
- */
1835
- feedback?: LayoutPosition;
1836
- /**
1837
- * The location of the install button.
1838
- *
1839
- * If set to `navigation`, it will only be visible if `login` is also visible in `navigation`.
1840
- *
1841
- * @default 'navbar'
1842
- */
1843
- install?: LayoutPosition;
1844
- /**
1845
- * The navigation type to use.
1846
- *
1847
- * If this is omitted, a collapsible side navigation menu will be rendered on the left.
1848
- *
1849
- * @default 'left-menu'
1850
- */
1851
- navigation?: Navigation;
1852
- };
1853
- /**
1854
- * The strategy to use for apps to subscribe to push notifications.
1855
- *
1856
- * If this is omitted, push notifications can not be sent.
1857
- */
1858
- notifications?: 'login' | 'opt-in' | 'startup';
1859
- /**
1860
- * The pages of the app.
1861
- */
1862
- pages: PageDefinition[];
1863
- controller?: ControllerDefinition;
1864
- members?: {
1865
- properties: Record<string, AppMemberPropertyDefinition>;
1866
- };
106
+ export interface TokenResponse {
1867
107
  /**
1868
- * Resource definitions that may be used by the app.
108
+ * The bearer access token to use for authenticating requests.
1869
109
  */
1870
- resources?: Record<string, ResourceDefinition>;
110
+ access_token: string;
1871
111
  /**
1872
- * The global theme for the app.
112
+ * How long until the access token expires in seconds from now.
1873
113
  */
1874
- theme?: Partial<Theme>;
114
+ expires_in?: number;
1875
115
  /**
1876
- * Helper property that can be used to store YAML anchors.
116
+ * The OpenID ID token as a JWT.
1877
117
  *
1878
- * This is omitted any time the API serves the app definition.
1879
- */
1880
- anchors?: any[];
1881
- /**
1882
- * Cron jobs associated with the app.
1883
- */
1884
- cron?: Record<string, CronDefinition>;
1885
- /**
1886
- * Webhooks associated with the app.
1887
- */
1888
- webhooks?: Record<string, WebhookDefinition>;
1889
- /**
1890
- * Companion containers of the app.
118
+ * This field is only present on OpenID connect providers.
1891
119
  */
1892
- containers?: CompanionContainerDefinition[];
120
+ id_token?: string;
1893
121
  /**
1894
- * Default registry to use when creating app companion containers.
1895
- * Used to avoid writing the registry name in front of every image.
122
+ * A refresh token for getting a new access token.
1896
123
  */
1897
- registry?: string;
1898
- }
1899
- /**
1900
- * The definition of a cron job for an app.
1901
- */
1902
- export interface CronDefinition {
1903
- schedule: string;
1904
- action: ActionDefinition;
124
+ refresh_token?: string;
125
+ token_type: 'bearer';
1905
126
  }
1906
127
  /**
1907
- * The definition of a webhook for an app.
128
+ * A type to represent the app lock.
1908
129
  */
1909
- export interface WebhookDefinition {
1910
- schema: OpenAPIV3.SchemaObject;
1911
- action: ActionDefinition;
130
+ export type AppLock = 'fullLock' | 'studioLock' | 'unlocked';
131
+ export interface SubscriptionResponseResource {
132
+ create: boolean;
133
+ update: boolean;
134
+ delete: boolean;
135
+ subscriptions?: Record<string, {
136
+ create?: boolean;
137
+ update: boolean;
138
+ delete: boolean;
139
+ }>;
1912
140
  }
141
+ export type SubscriptionResponse = Record<string, SubscriptionResponseResource>;
142
+ export declare const resourceSubscribableAction: readonly ["create", "update", "delete"];
143
+ export type ResourceSubscribableAction = (typeof resourceSubscribableAction)[number];
1913
144
  export interface App {
1914
145
  /**
1915
146
  * The unique identifier for the app.
@@ -2476,30 +707,6 @@ export interface AppSamlSecret extends WritableAppSamlSecret {
2476
707
  spCertificate?: string;
2477
708
  }
2478
709
  export type SAMLStatus = 'badsignature' | 'emailconflict' | 'invalidrelaystate' | 'invalidsecret' | 'invalidstatuscode' | 'invalidsubjectconfirmation' | 'missingnameid' | 'missingsubject';
2479
- export interface ProjectConfig {
2480
- /**
2481
- * The name of the project.
2482
- */
2483
- name: string;
2484
- /**
2485
- * The description of the project.
2486
- */
2487
- description?: string;
2488
- /**
2489
- * The long description of the project.
2490
- *
2491
- * This is displayed when rendering documentation and supports Markdown.
2492
- */
2493
- longDescription?: string;
2494
- /**
2495
- * A [semver](https://semver.org) representation of the project version.
2496
- *
2497
- * Pattern:
2498
- * ^\d+\.\d+\.\d+$
2499
- */
2500
- version: string;
2501
- [key: string]: any;
2502
- }
2503
710
  export interface ProjectBuildConfig extends ProjectConfig {
2504
711
  /**
2505
712
  * The build output directory relative to the project directory.
@@ -2509,109 +716,7 @@ export interface ProjectBuildConfig extends ProjectConfig {
2509
716
  * The absolute directory of the project.
2510
717
  */
2511
718
  dir: string;
2512
- }
2513
- export interface ProjectImplementations {
2514
- /**
2515
- * The actions that are supported by a project.
2516
- */
2517
- actions?: Record<string, ActionType>;
2518
- /**
2519
- * The events that are supported by a project.
2520
- */
2521
- events?: {
2522
- listen?: Record<string, EventType>;
2523
- emit?: Record<string, EventType>;
2524
- };
2525
- /**
2526
- * The messages that are supported by a project.
2527
- */
2528
- messages?: Record<string, Record<string, any> | never>;
2529
- /**
2530
- * A JSON schema to validate project parameters.
2531
- */
2532
- parameters?: Schema;
2533
- }
2534
- export interface ProjectManifest extends ProjectConfig, ProjectImplementations {
2535
- /**
2536
- * Array of urls associated to the files of the project.
2537
- */
2538
- files: string[];
2539
- }
2540
- export interface BlockManifest extends ProjectManifest {
2541
- /**
2542
- * The URL that can be used to fetch this block’s icon.
2543
- */
2544
- iconUrl?: string | null;
2545
- /**
2546
- * The languages that are supported by the block by default.
2547
- *
2548
- * If the block has no messages, this property is `null`.
2549
- */
2550
- languages: string[] | null;
2551
- examples?: string[];
2552
- /**
2553
- * Whether the block should be listed publicly
2554
- * for users who aren’t part of the block’s organization.
2555
- *
2556
- * - **`public`**: The block is visible for everyone.
2557
- * - **`unlisted`**: The block will only be visible if the user is
2558
- * logged in and is part of the block’s organization.
2559
- */
2560
- visibility?: 'public' | 'unlisted';
2561
- /**
2562
- * Whether action validation for wildcard action is skipped.
2563
- */
2564
- wildcardActions?: boolean;
2565
- /**
2566
- * The type of layout to be used for the block.
2567
- */
2568
- layout?: 'float' | 'grow' | 'hidden' | 'static' | null;
2569
- }
2570
- export interface CompanionContainerDefinition {
2571
- /**
2572
- * Alias of the container in the app.
2573
- */
2574
- name: string;
2575
- /**
2576
- * Image to use for the container.
2577
- */
2578
- image: string;
2579
- /**
2580
- * Port exposed by the provided image.
2581
- *
2582
- * E.g., if the Dockerfile of the image contains `EXPOSE 3000`
2583
- * then `port` should be 3000 as well.
2584
- */
2585
- port: number;
2586
- /**
2587
- * Limits the resources used and required by companion containers
2588
- *
2589
- */
2590
- resources?: ContainerResources;
2591
- /**
2592
- * Environment within the container
2593
- */
2594
- env?: ContainerEnvVar[];
2595
- /**
2596
- * Additional properties e.g., labels, annotations
2597
- *
2598
- */
2599
- metadata?: Record<string, any>;
2600
- }
2601
- export interface ContainerResources {
2602
- /**
2603
- * Maximum amount of resources allowed
2604
- */
2605
- limits: ContainerResourceProps;
2606
- }
2607
- export interface ContainerResourceProps {
2608
- cpu: string;
2609
- memory: string;
2610
- }
2611
- export interface ContainerEnvVar {
2612
- name: string;
2613
- value: string;
2614
- useValueFromSecret?: boolean;
719
+ [key: string]: any;
2615
720
  }
2616
721
  export interface LogObject {
2617
722
  fromAppsemble: boolean;