@appsemble/utils 0.23.8 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +3 -3
  2. package/api/components/parameters/index.d.ts +2 -0
  3. package/api/components/parameters/index.js +2 -0
  4. package/api/components/parameters/memberEmail.d.ts +2 -0
  5. package/api/components/parameters/memberEmail.js +8 -0
  6. package/api/components/parameters/roles.d.ts +2 -0
  7. package/api/components/parameters/roles.js +13 -0
  8. package/api/components/schemas/ActionDefinition.js +2 -0
  9. package/api/components/schemas/LinkActionDefinition.js +4 -1
  10. package/api/components/schemas/OrganizationMember.d.ts +2 -0
  11. package/api/components/schemas/{Member.js → OrganizationMember.js} +2 -2
  12. package/api/components/schemas/Training.js +6 -3
  13. package/api/components/schemas/UserCreateActionDefinition.js +4 -4
  14. package/api/components/schemas/UserQueryActionDefinition.d.ts +1 -0
  15. package/api/components/schemas/UserQueryActionDefinition.js +20 -0
  16. package/api/components/schemas/UserRemoveActionDefinition.d.ts +1 -0
  17. package/api/components/schemas/UserRemoveActionDefinition.js +20 -0
  18. package/api/components/schemas/UserUpdateActionDefinition.js +11 -8
  19. package/api/components/schemas/index.d.ts +3 -1
  20. package/api/components/schemas/index.js +3 -1
  21. package/api/paths/apps.js +10 -10
  22. package/api/paths/organizations.js +2 -2
  23. package/api/paths/trainings.js +31 -5
  24. package/api/paths/user.js +82 -1
  25. package/constants/Permission.d.ts +17 -1
  26. package/constants/Permission.js +16 -0
  27. package/constants/roles.d.ts +1 -0
  28. package/constants/roles.js +8 -0
  29. package/package.json +2 -2
  30. package/validation.d.ts +2 -2
  31. package/validation.js +5 -0
  32. package/validation.test.js +1 -1
  33. package/api/components/schemas/Member.d.ts +0 -2
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.23.8/config/assets/logo.svg) Appsemble Utilities
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.24.0/config/assets/logo.svg) Appsemble Utilities
2
2
 
3
3
  > Internal utility functions used across multiple Appsemble projects.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@appsemble/utils)](https://www.npmjs.com/package/@appsemble/utils)
6
- [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.23.8/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.23.8)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.24.0/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.24.0)
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.23.8/LICENSE.md) ©
29
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.24.0/LICENSE.md) ©
30
30
  [Appsemble](https://appsemble.com)
@@ -19,3 +19,5 @@ export * from './appServiceId.js';
19
19
  export * from './view.js';
20
20
  export * from './trainingId.js';
21
21
  export * from './trainingBlockId.js';
22
+ export * from './memberEmail.js';
23
+ export * from './roles.js';
@@ -19,4 +19,6 @@ export * from './appServiceId.js';
19
19
  export * from './view.js';
20
20
  export * from './trainingId.js';
21
21
  export * from './trainingBlockId.js';
22
+ export * from './memberEmail.js';
23
+ export * from './roles.js';
22
24
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ import { type OpenAPIV3 } from 'openapi-types';
2
+ export declare const memberEmail: OpenAPIV3.ParameterObject;
@@ -0,0 +1,8 @@
1
+ export const memberEmail = {
2
+ name: 'memberEmail',
3
+ in: 'path',
4
+ description: 'The email of the member on which to perform an operation',
5
+ required: true,
6
+ schema: { $ref: '#/components/schemas/OrganizationMember/properties/primaryEmail' },
7
+ };
8
+ //# sourceMappingURL=memberEmail.js.map
@@ -0,0 +1,2 @@
1
+ import { type OpenAPIV3 } from 'openapi-types';
2
+ export declare const roles: OpenAPIV3.ParameterObject;
@@ -0,0 +1,13 @@
1
+ export const roles = {
2
+ name: 'roles',
3
+ in: 'query',
4
+ description: 'The roles of users on which to perform an operation',
5
+ required: true,
6
+ schema: {
7
+ type: 'array',
8
+ items: {
9
+ $ref: '#/components/schemas/AppAccount/properties/role',
10
+ },
11
+ },
12
+ };
13
+ //# sourceMappingURL=roles.js.map
@@ -77,6 +77,8 @@ export const ActionDefinition = {
77
77
  { $ref: '#/components/schemas/UserRegisterActionDefinition' },
78
78
  { $ref: '#/components/schemas/UserCreateActionDefinition' },
79
79
  { $ref: '#/components/schemas/UserUpdateActionDefinition' },
80
+ { $ref: '#/components/schemas/UserQueryActionDefinition' },
81
+ { $ref: '#/components/schemas/UserRemoveActionDefinition' },
80
82
  ],
81
83
  },
82
84
  ],
@@ -10,7 +10,6 @@ export const LinkActionDefinition = extendJSONSchema(BaseActionDefinition, {
10
10
  description: 'The link action can be used to redirect the user to other pages or absolute URLs.',
11
11
  },
12
12
  to: {
13
- description: 'The name of the page to link to. Subpages can be referred to using arrays. If this matches with an absolute URL, link will open this instead of matching it with a page or subpage.',
14
13
  anyOf: [
15
14
  {
16
15
  type: 'string',
@@ -19,7 +18,11 @@ export const LinkActionDefinition = extendJSONSchema(BaseActionDefinition, {
19
18
  type: 'array',
20
19
  items: { type: 'string' },
21
20
  },
21
+ {
22
+ $ref: '#/components/schemas/RemapperDefinition',
23
+ },
22
24
  ],
25
+ description: 'The name of the page to link to. Subpages can be referred to using arrays. If this matches with an absolute URL, link will open this instead of matching it with a page or subpage.',
23
26
  },
24
27
  },
25
28
  });
@@ -0,0 +1,2 @@
1
+ import { type OpenAPIV3 } from 'openapi-types';
2
+ export declare const OrganizationMember: OpenAPIV3.NonArraySchemaObject;
@@ -1,5 +1,5 @@
1
1
  import { roles } from '../../../constants/index.js';
2
- export const Member = {
2
+ export const OrganizationMember = {
3
3
  type: 'object',
4
4
  description: 'A member of an organization.',
5
5
  required: ['id'],
@@ -26,4 +26,4 @@ export const Member = {
26
26
  },
27
27
  },
28
28
  };
29
- //# sourceMappingURL=Member.js.map
29
+ //# sourceMappingURL=OrganizationMember.js.map
@@ -17,9 +17,12 @@ export const Training = {
17
17
  type: 'string',
18
18
  description: 'A brief overview of the training.',
19
19
  },
20
- competence: {
21
- type: 'string',
22
- description: 'Tag for the training',
20
+ competences: {
21
+ type: 'array',
22
+ description: 'Competence tags for the training',
23
+ items: {
24
+ type: 'string',
25
+ },
23
26
  },
24
27
  difficultyLevel: {
25
28
  type: 'number',
@@ -11,14 +11,14 @@ export const UserCreateActionDefinition = extendJSONSchema(BaseActionDefinition,
11
11
 
12
12
  Does nothing if the user is already logged in.`,
13
13
  },
14
- password: {
15
- description: 'The password to login with.',
14
+ name: {
15
+ description: 'The display name of the user.',
16
16
  },
17
17
  email: {
18
18
  description: 'The email to login with.',
19
19
  },
20
- displayName: {
21
- description: 'The display name of the user.',
20
+ password: {
21
+ description: 'The password to login with.',
22
22
  },
23
23
  properties: {
24
24
  description: `The custom properties for the user.
@@ -0,0 +1 @@
1
+ export declare const UserQueryActionDefinition: import("openapi-types").OpenAPIV3.SchemaObject;
@@ -0,0 +1,20 @@
1
+ import { BaseActionDefinition } from './BaseActionDefinition.js';
2
+ import { extendJSONSchema } from './utils.js';
3
+ export const UserQueryActionDefinition = extendJSONSchema(BaseActionDefinition, {
4
+ type: 'object',
5
+ additionalProperties: false,
6
+ required: [],
7
+ properties: {
8
+ type: {
9
+ enum: ['user.query'],
10
+ description: `Allows the user to fetch a list of accounts by their roles.
11
+
12
+ Does nothing if the user isn’t logged in.`,
13
+ },
14
+ roles: {
15
+ $ref: '#/components/schemas/RemapperDefinition',
16
+ description: 'The roles of the accounts that would be fetched.',
17
+ },
18
+ },
19
+ });
20
+ //# sourceMappingURL=UserQueryActionDefinition.js.map
@@ -0,0 +1 @@
1
+ export declare const UserRemoveActionDefinition: import("openapi-types").OpenAPIV3.SchemaObject;
@@ -0,0 +1,20 @@
1
+ import { BaseActionDefinition } from './BaseActionDefinition.js';
2
+ import { extendJSONSchema } from './utils.js';
3
+ export const UserRemoveActionDefinition = extendJSONSchema(BaseActionDefinition, {
4
+ type: 'object',
5
+ additionalProperties: false,
6
+ required: ['email'],
7
+ properties: {
8
+ type: {
9
+ enum: ['user.remove'],
10
+ description: `Allows the user to delete an existing account.
11
+
12
+ Does nothing if the user isn’t logged in.`,
13
+ },
14
+ email: {
15
+ $ref: '#/components/schemas/RemapperDefinition',
16
+ description: 'The email of the account to be deleted.',
17
+ },
18
+ },
19
+ });
20
+ //# sourceMappingURL=UserRemoveActionDefinition.js.map
@@ -11,23 +11,26 @@ export const UserUpdateActionDefinition = extendJSONSchema(BaseActionDefinition,
11
11
 
12
12
  Does nothing if the user isn’t logged in.`,
13
13
  },
14
- password: {
15
- description: 'The new password.',
14
+ name: {
15
+ description: 'The new display name of the user.',
16
16
  },
17
- email: {
18
- description: 'The new email address.',
17
+ currentEmail: {
18
+ description: 'The current email address of the user.',
19
19
  },
20
- displayName: {
21
- description: 'The new display name of the user.',
20
+ newEmail: {
21
+ description: 'The new email address.',
22
22
  },
23
- picture: {
24
- description: 'The new profile picture of the user.',
23
+ password: {
24
+ description: 'The new password.',
25
25
  },
26
26
  properties: {
27
27
  description: `The custom properties for the user.
28
28
 
29
29
  Every value will be converted to a string.`,
30
30
  },
31
+ role: {
32
+ description: "The role for the updated account. Defaults to the default role in the app's security definition.",
33
+ },
31
34
  },
32
35
  });
33
36
  //# sourceMappingURL=UserUpdateActionDefinition.js.map
@@ -57,7 +57,7 @@ export * from './LinkActionDefinition.js';
57
57
  export * from './LinkBackActionDefinition.js';
58
58
  export * from './LinkNextActionDefinition.js';
59
59
  export * from './LogActionDefinition.js';
60
- export * from './Member.js';
60
+ export * from './OrganizationMember.js';
61
61
  export * from './MatchActionDefinition.js';
62
62
  export * from './MessageActionDefinition.js';
63
63
  export * from './NoopActionDefinition.js';
@@ -123,5 +123,7 @@ export * from './UserLoginActionDefinition.js';
123
123
  export * from './UserRegisterActionDefinition.js';
124
124
  export * from './UserCreateActionDefinition.js';
125
125
  export * from './UserUpdateActionDefinition.js';
126
+ export * from './UserQueryActionDefinition.js';
127
+ export * from './UserRemoveActionDefinition.js';
126
128
  export * from './LoopPageDefinition.js';
127
129
  export * from './LoopPageActionsDefinition.js';
@@ -57,7 +57,7 @@ export * from './LinkActionDefinition.js';
57
57
  export * from './LinkBackActionDefinition.js';
58
58
  export * from './LinkNextActionDefinition.js';
59
59
  export * from './LogActionDefinition.js';
60
- export * from './Member.js';
60
+ export * from './OrganizationMember.js';
61
61
  export * from './MatchActionDefinition.js';
62
62
  export * from './MessageActionDefinition.js';
63
63
  export * from './NoopActionDefinition.js';
@@ -123,6 +123,8 @@ export * from './UserLoginActionDefinition.js';
123
123
  export * from './UserRegisterActionDefinition.js';
124
124
  export * from './UserCreateActionDefinition.js';
125
125
  export * from './UserUpdateActionDefinition.js';
126
+ export * from './UserQueryActionDefinition.js';
127
+ export * from './UserRemoveActionDefinition.js';
126
128
  export * from './LoopPageDefinition.js';
127
129
  export * from './LoopPageActionsDefinition.js';
128
130
  //# sourceMappingURL=index.js.map
package/api/paths/apps.js CHANGED
@@ -577,7 +577,7 @@ export const paths = {
577
577
  schema: {
578
578
  type: 'array',
579
579
  items: {
580
- $ref: '#/components/schemas/Member',
580
+ $ref: '#/components/schemas/OrganizationMember',
581
581
  },
582
582
  },
583
583
  },
@@ -608,7 +608,7 @@ export const paths = {
608
608
  content: {
609
609
  'application/json': {
610
610
  schema: {
611
- $ref: '#/components/schemas/Member',
611
+ $ref: '#/components/schemas/OrganizationMember',
612
612
  },
613
613
  },
614
614
  },
@@ -647,7 +647,7 @@ export const paths = {
647
647
  content: {
648
648
  'application/json': {
649
649
  schema: {
650
- $ref: '#/components/schemas/Member',
650
+ $ref: '#/components/schemas/OrganizationMember',
651
651
  },
652
652
  },
653
653
  },
@@ -1236,7 +1236,7 @@ This will return a 404 if the user has not uploaded one.`,
1236
1236
  schema: {
1237
1237
  type: 'array',
1238
1238
  items: {
1239
- $ref: '#/components/schemas/Member',
1239
+ $ref: '#/components/schemas/OrganizationMember',
1240
1240
  },
1241
1241
  },
1242
1242
  },
@@ -1270,7 +1270,7 @@ This will return a 404 if the user has not uploaded one.`,
1270
1270
  content: {
1271
1271
  'application/json': {
1272
1272
  schema: {
1273
- $ref: '#/components/schemas/Member',
1273
+ $ref: '#/components/schemas/OrganizationMember',
1274
1274
  },
1275
1275
  },
1276
1276
  },
@@ -1307,7 +1307,7 @@ This will return a 404 if the user has not uploaded one.`,
1307
1307
  content: {
1308
1308
  'application/json': {
1309
1309
  schema: {
1310
- $ref: '#/components/schemas/Member',
1310
+ $ref: '#/components/schemas/OrganizationMember',
1311
1311
  },
1312
1312
  },
1313
1313
  },
@@ -1342,7 +1342,7 @@ This will return a 404 if the user has not uploaded one.`,
1342
1342
  content: {
1343
1343
  'application/json': {
1344
1344
  schema: {
1345
- $ref: '#/components/schemas/Member',
1345
+ $ref: '#/components/schemas/OrganizationMember',
1346
1346
  },
1347
1347
  },
1348
1348
  },
@@ -1408,7 +1408,7 @@ This will return a 404 if the user has not uploaded one.`,
1408
1408
  content: {
1409
1409
  'application/json': {
1410
1410
  schema: {
1411
- $ref: '#/components/schemas/Member',
1411
+ $ref: '#/components/schemas/OrganizationMember',
1412
1412
  },
1413
1413
  },
1414
1414
  },
@@ -1438,7 +1438,7 @@ This will return a 404 if the user has not uploaded one.`,
1438
1438
  content: {
1439
1439
  'application/json': {
1440
1440
  schema: {
1441
- $ref: '#/components/schemas/Member',
1441
+ $ref: '#/components/schemas/OrganizationMember',
1442
1442
  },
1443
1443
  },
1444
1444
  },
@@ -1468,7 +1468,7 @@ This will return a 404 if the user has not uploaded one.`,
1468
1468
  content: {
1469
1469
  'application/json': {
1470
1470
  schema: {
1471
- $ref: '#/components/schemas/Member',
1471
+ $ref: '#/components/schemas/OrganizationMember',
1472
1472
  },
1473
1473
  },
1474
1474
  },
@@ -164,7 +164,7 @@ export const paths = {
164
164
  schema: {
165
165
  type: 'array',
166
166
  items: {
167
- $ref: '#/components/schemas/Member',
167
+ $ref: '#/components/schemas/OrganizationMember',
168
168
  },
169
169
  },
170
170
  },
@@ -409,7 +409,7 @@ export const paths = {
409
409
  content: {
410
410
  'application/json': {
411
411
  schema: {
412
- $ref: '#/components/schemas/Member',
412
+ $ref: '#/components/schemas/OrganizationMember',
413
413
  },
414
414
  },
415
415
  },
@@ -17,7 +17,7 @@ export const paths = {
17
17
  },
18
18
  },
19
19
  },
20
- security: [{ studio: [] }],
20
+ security: [{ studio: [] }, {}],
21
21
  },
22
22
  post: {
23
23
  tags: ['training', 'learning', 'docs'],
@@ -60,7 +60,7 @@ export const paths = {
60
60
  },
61
61
  },
62
62
  },
63
- security: [{ studio: [] }],
63
+ security: [{ studio: [] }, {}],
64
64
  },
65
65
  patch: {
66
66
  tags: ['training', 'learning', 'docs'],
@@ -69,9 +69,35 @@ export const paths = {
69
69
  requestBody: {
70
70
  required: true,
71
71
  content: {
72
- 'application/json': {
72
+ 'multipart/form-data': {
73
73
  schema: {
74
- $ref: '#/components/schemas/Training',
74
+ description: 'Schema to be used for editing trainings.',
75
+ properties: {
76
+ id: {
77
+ type: 'number',
78
+ readOnly: true,
79
+ minimum: 0,
80
+ description: 'The id of the training, will be generated automatically by the system.',
81
+ },
82
+ title: {
83
+ type: 'string',
84
+ description: 'Title of the training.',
85
+ },
86
+ description: {
87
+ type: 'string',
88
+ description: 'A brief overview of the training.',
89
+ },
90
+ competence: {
91
+ type: 'string',
92
+ description: 'Competence tags for the training',
93
+ },
94
+ difficultyLevel: {
95
+ type: 'number',
96
+ description: 'Difficulty level between 1 and 5',
97
+ minimum: 1,
98
+ maximum: 5,
99
+ },
100
+ },
75
101
  },
76
102
  },
77
103
  },
@@ -119,7 +145,7 @@ export const paths = {
119
145
  },
120
146
  },
121
147
  },
122
- security: [{ studio: [] }],
148
+ security: [{ studio: [] }, {}],
123
149
  },
124
150
  post: {
125
151
  tags: ['training', 'trainingBlocks', 'learning', 'docs'],
package/api/paths/user.js CHANGED
@@ -123,7 +123,7 @@ export const paths = {
123
123
  properties: {
124
124
  id: { $ref: '#/components/schemas/Organization/properties/id' },
125
125
  name: { $ref: '#/components/schemas/Organization/properties/name' },
126
- role: { $ref: '#/components/schemas/Member/properties/role' },
126
+ role: { $ref: '#/components/schemas/OrganizationMember/properties/role' },
127
127
  },
128
128
  },
129
129
  },
@@ -354,6 +354,18 @@ export const paths = {
354
354
  },
355
355
  '/api/user/apps/{appId}/accounts': {
356
356
  parameters: [{ $ref: '#/components/parameters/appId' }],
357
+ get: {
358
+ tags: ['appMember'],
359
+ description: 'Fetch app accounts by roles.',
360
+ operationId: 'getAppMembersByRoles',
361
+ parameters: [{ $ref: '#/components/parameters/roles' }],
362
+ security: [{ app: [] }],
363
+ responses: {
364
+ 200: {
365
+ description: 'The accounts that were fetched.',
366
+ },
367
+ },
368
+ },
357
369
  post: {
358
370
  tags: ['appMember'],
359
371
  description: 'Create a new app account using an email address and a password.',
@@ -401,6 +413,75 @@ export const paths = {
401
413
  },
402
414
  },
403
415
  },
416
+ '/api/user/apps/{appId}/accounts/{memberEmail}': {
417
+ parameters: [
418
+ { $ref: '#/components/parameters/appId' },
419
+ { $ref: '#/components/parameters/memberEmail' },
420
+ ],
421
+ patch: {
422
+ tags: ['appMember'],
423
+ description: 'Patch an app account by email.',
424
+ operationId: 'updateAppMemberByEmail',
425
+ security: [{ app: [] }],
426
+ requestBody: {
427
+ description: 'The user account to update.',
428
+ required: true,
429
+ content: {
430
+ 'multipart/form-data': {
431
+ schema: {
432
+ type: 'object',
433
+ required: ['password'],
434
+ properties: {
435
+ name: {
436
+ type: 'string',
437
+ },
438
+ email: {
439
+ type: 'string',
440
+ format: 'email',
441
+ },
442
+ password: {
443
+ type: 'string',
444
+ minLength: 8,
445
+ },
446
+ properties: {
447
+ type: 'object',
448
+ additionalProperties: { type: 'string' },
449
+ description: 'The member’s custom properties.',
450
+ },
451
+ role: {
452
+ type: 'string',
453
+ description: "The role for the updated account. Defaults to the default role in the app's security definition.",
454
+ },
455
+ },
456
+ },
457
+ },
458
+ },
459
+ },
460
+ responses: {
461
+ 200: {
462
+ description: 'A linked app account',
463
+ content: {
464
+ 'application/json': {
465
+ schema: {
466
+ $ref: '#/components/schemas/AppAccount',
467
+ },
468
+ },
469
+ },
470
+ },
471
+ },
472
+ },
473
+ delete: {
474
+ tags: ['appMember'],
475
+ description: 'Delete a user account by email.',
476
+ operationId: 'deleteAppMemberByEmail',
477
+ security: [{ app: [] }],
478
+ responses: {
479
+ 204: {
480
+ description: 'The account was deleted successfully.',
481
+ },
482
+ },
483
+ },
484
+ },
404
485
  '/api/user/apps/{appId}/account/verify': {
405
486
  parameters: [{ $ref: '#/components/parameters/appId' }],
406
487
  post: {
@@ -94,5 +94,21 @@ export declare enum Permission {
94
94
  /**
95
95
  * The permission to edit collections.
96
96
  */
97
- EditCollections = 22
97
+ EditCollections = 22,
98
+ /**
99
+ * The permission to create app accounts.
100
+ */
101
+ CreateAppAccounts = 23,
102
+ /**
103
+ * The permission to read app accounts.
104
+ */
105
+ ReadAppAccounts = 24,
106
+ /**
107
+ * The permission to delete app accounts.
108
+ */
109
+ DeleteAppAccounts = 25,
110
+ /**
111
+ * The permission to edit app accounts.
112
+ */
113
+ EditAppAccounts = 26
98
114
  }
@@ -96,5 +96,21 @@ export var Permission;
96
96
  * The permission to edit collections.
97
97
  */
98
98
  Permission[Permission["EditCollections"] = 22] = "EditCollections";
99
+ /**
100
+ * The permission to create app accounts.
101
+ */
102
+ Permission[Permission["CreateAppAccounts"] = 23] = "CreateAppAccounts";
103
+ /**
104
+ * The permission to read app accounts.
105
+ */
106
+ Permission[Permission["ReadAppAccounts"] = 24] = "ReadAppAccounts";
107
+ /**
108
+ * The permission to delete app accounts.
109
+ */
110
+ Permission[Permission["DeleteAppAccounts"] = 25] = "DeleteAppAccounts";
111
+ /**
112
+ * The permission to edit app accounts.
113
+ */
114
+ Permission[Permission["EditAppAccounts"] = 26] = "EditAppAccounts";
99
115
  })(Permission || (Permission = {}));
100
116
  //# sourceMappingURL=Permission.js.map
@@ -7,6 +7,7 @@ export declare const roles: {
7
7
  readonly AppEditor: Permission[];
8
8
  readonly Maintainer: Permission[];
9
9
  readonly Owner: Permission[];
10
+ readonly AccountManager: Permission[];
10
11
  };
11
12
  export type Role = keyof typeof roles;
12
13
  export declare enum TeamRole {
@@ -3,6 +3,12 @@ const member = [Permission.ViewApps, Permission.ViewMembers];
3
3
  const Translator = [...member, Permission.EditAppMessages];
4
4
  const APIReader = [...member, Permission.ReadAssets, Permission.ReadResources];
5
5
  const APIUser = [...APIReader, Permission.ManageAssets, Permission.ManageResources];
6
+ const AccountManager = [
7
+ Permission.CreateAppAccounts,
8
+ Permission.ReadAppAccounts,
9
+ Permission.DeleteAppAccounts,
10
+ Permission.EditAppAccounts,
11
+ ];
6
12
  const AppEditor = [
7
13
  ...member,
8
14
  Permission.EditApps,
@@ -15,6 +21,7 @@ const AppEditor = [
15
21
  ];
16
22
  const Maintainer = [
17
23
  ...AppEditor,
24
+ ...AccountManager,
18
25
  Permission.CreateApps,
19
26
  Permission.DeleteApps,
20
27
  Permission.EditAppSettings,
@@ -41,6 +48,7 @@ export const roles = {
41
48
  AppEditor,
42
49
  Maintainer,
43
50
  Owner,
51
+ AccountManager,
44
52
  };
45
53
  export var TeamRole;
46
54
  (function (TeamRole) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/utils",
3
- "version": "0.23.8",
3
+ "version": "0.24.0",
4
4
  "description": "Utility functions used in Appsemble internally",
5
5
  "keywords": [
6
6
  "app",
@@ -37,7 +37,7 @@
37
37
  "test": "vitest"
38
38
  },
39
39
  "dependencies": {
40
- "@appsemble/types": "0.23.8",
40
+ "@appsemble/types": "0.24.0",
41
41
  "axios": "^1.0.0",
42
42
  "cron-parser": "^4.0.0",
43
43
  "date-fns": "^2.0.0",
package/validation.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type AppDefinition, type BlockManifest, type ProjectImplementations } from '@appsemble/types';
1
+ import { type AppDefinition, type BlockManifest, type ProjectImplementations, type Remapper } from '@appsemble/types';
2
2
  import { type ValidatorResult } from 'jsonschema';
3
3
  import { type Promisable } from 'type-fest';
4
4
  import { type IdentifiableBlock } from './blockUtils.js';
@@ -8,7 +8,7 @@ import { type IdentifiableBlock } from './blockUtils.js';
8
8
  * @param link The link to check
9
9
  * @returns Whether or not the given link represents a link related to the Appsemble core.
10
10
  */
11
- export declare function isAppLink(link: string[] | string): boolean;
11
+ export declare function isAppLink(link: Remapper | string[] | string): boolean;
12
12
  export type BlockVersionsGetter = (blockMap: IdentifiableBlock[]) => Promisable<BlockManifest[]>;
13
13
  /**
14
14
  * Validate an app definition.
package/validation.js CHANGED
@@ -538,6 +538,11 @@ function validateActions(definition, report) {
538
538
  }
539
539
  if (action.type === 'link') {
540
540
  const { to } = action;
541
+ if (typeof to === 'object' &&
542
+ (!Array.isArray(to) ||
543
+ (Array.isArray(to) && to.every((entry) => typeof entry === 'object')))) {
544
+ return;
545
+ }
541
546
  if (typeof to === 'string' && urlRegex.test(to)) {
542
547
  return;
543
548
  }
@@ -1483,7 +1483,7 @@ describe('validateAppDefinition', () => {
1483
1483
  actions: {
1484
1484
  onWhatever: {
1485
1485
  type: 'user.update',
1486
- email: 'example@example.com',
1486
+ currentEmail: 'example@example.com',
1487
1487
  password: 'password',
1488
1488
  },
1489
1489
  },
@@ -1,2 +0,0 @@
1
- import { type OpenAPIV3 } from 'openapi-types';
2
- export declare const Member: OpenAPIV3.NonArraySchemaObject;