@appsemble/utils 0.36.10 → 0.37.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.
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.36.10/config/assets/logo.svg) Appsemble Utilities
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.37.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.36.10/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.36.10)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.37.0/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.37.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.36.10/LICENSE.md) ©
29
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.37.0/LICENSE.md) ©
30
30
  [Appsemble](https://appsemble.com)
@@ -1,7 +1,11 @@
1
1
  export const selectedGroupId = {
2
2
  name: 'selectedGroupId',
3
3
  in: 'query',
4
- description: 'The currently selected group of the app member.',
5
- schema: { type: 'number' },
4
+ description: 'The selected groups of the app member to scope the request to. Accepts a single value ' +
5
+ '(`selectedGroupId=1`) or several (`selectedGroupId=1&selectedGroupId=2`). Pass -1 for the ' +
6
+ 'app-wide scope.',
7
+ style: 'form',
8
+ explode: true,
9
+ schema: { type: 'array', items: { type: 'number' } },
6
10
  };
7
11
  //# sourceMappingURL=selectedGroupId.js.map
@@ -49,6 +49,26 @@ export const AppOAuth2Secret = {
49
49
  description: 'A remapper to apply on retrieved user information from the user info endpoint.',
50
50
  items: {},
51
51
  },
52
+ roleMappings: {
53
+ type: 'array',
54
+ description: 'Optional exact external-group to app-role mappings.',
55
+ items: {
56
+ type: 'object',
57
+ description: 'A mapping from one exact external group value to one app role.',
58
+ required: ['group', 'role'],
59
+ additionalProperties: false,
60
+ properties: {
61
+ group: {
62
+ type: 'string',
63
+ description: 'The exact external group value to match.',
64
+ },
65
+ role: {
66
+ type: 'string',
67
+ description: 'The app role to assign when the external group matches.',
68
+ },
69
+ },
70
+ },
71
+ },
52
72
  created: {
53
73
  type: 'string',
54
74
  format: 'date-time',
@@ -0,0 +1,2 @@
1
+ import { type OpenAPIV3 } from 'openapi-types';
2
+ export declare const AppSamlSecret: OpenAPIV3.NonArraySchemaObject;
@@ -0,0 +1,86 @@
1
+ export const AppSamlSecret = {
2
+ type: 'object',
3
+ description: 'Settings for login in apps using third party SAML providers',
4
+ required: ['entityId', 'icon', 'idpCertificate', 'name', 'ssoUrl'],
5
+ additionalProperties: false,
6
+ properties: {
7
+ id: {
8
+ type: 'number',
9
+ description: 'An autogenerated ID.',
10
+ readOnly: true,
11
+ },
12
+ entityId: {
13
+ type: 'string',
14
+ format: 'uri',
15
+ description: 'The URL where the identity provider metadata is hosted.',
16
+ },
17
+ ssoUrl: {
18
+ type: 'string',
19
+ format: 'uri',
20
+ description: 'The URL where the user is redirected to log in.',
21
+ },
22
+ idpCertificate: {
23
+ type: 'string',
24
+ description: 'The certificate of the identity provider.',
25
+ },
26
+ icon: {
27
+ type: 'string',
28
+ description: 'A Font Awesome icon which represents the SAML provider.',
29
+ },
30
+ name: {
31
+ type: 'string',
32
+ description: 'A display name which represents the SAML provider.',
33
+ },
34
+ emailAttribute: {
35
+ type: 'string',
36
+ description: 'The SAML attribute that contains the user email address.',
37
+ },
38
+ emailVerifiedAttribute: {
39
+ type: 'string',
40
+ description: 'The SAML attribute that contains whether the email address is verified.',
41
+ },
42
+ nameAttribute: {
43
+ type: 'string',
44
+ description: 'The SAML attribute that contains the user display name.',
45
+ },
46
+ groupAttribute: {
47
+ type: 'string',
48
+ description: 'The SAML attribute that contains the external groups for the user.',
49
+ },
50
+ objectIdAttribute: {
51
+ type: 'string',
52
+ description: 'The SAML attribute that contains the external user identifier.',
53
+ },
54
+ roleMappings: {
55
+ type: 'array',
56
+ description: 'Optional exact external-group to app-role mappings.',
57
+ items: {
58
+ type: 'object',
59
+ description: 'A mapping from one exact external group value to one app role.',
60
+ required: ['group', 'role'],
61
+ additionalProperties: false,
62
+ properties: {
63
+ group: {
64
+ type: 'string',
65
+ description: 'The exact external group value to match.',
66
+ },
67
+ role: {
68
+ type: 'string',
69
+ description: 'The app role to assign when the external group matches.',
70
+ },
71
+ },
72
+ },
73
+ },
74
+ spCertificate: {
75
+ type: 'string',
76
+ description: 'The generated SAML service provider certificate.',
77
+ readOnly: true,
78
+ },
79
+ updated: {
80
+ type: 'string',
81
+ format: 'date-time',
82
+ description: 'When the secret was last updated.',
83
+ },
84
+ },
85
+ };
86
+ //# sourceMappingURL=AppSamlSecret.js.map
@@ -5,6 +5,7 @@ export * from './AppMember.js';
5
5
  export * from './AppMemberInfo.js';
6
6
  export * from './AppMessages.js';
7
7
  export * from './AppOAuth2Secret.js';
8
+ export * from './AppSamlSecret.js';
8
9
  export * from './AppsembleMessages.js';
9
10
  export * from './AppServiceSecret.js';
10
11
  export * from './AppVariable.js';
@@ -5,6 +5,7 @@ export * from './AppMember.js';
5
5
  export * from './AppMemberInfo.js';
6
6
  export * from './AppMessages.js';
7
7
  export * from './AppOAuth2Secret.js';
8
+ export * from './AppSamlSecret.js';
8
9
  export * from './AppsembleMessages.js';
9
10
  export * from './AppServiceSecret.js';
10
11
  export * from './AppVariable.js';
@@ -1,3 +1,27 @@
1
+ const resourceContent = {
2
+ 'application/json': {
3
+ schema: { $ref: '#/components/schemas/Resource' },
4
+ },
5
+ 'text/csv': {
6
+ schema: { type: 'string' },
7
+ },
8
+ };
9
+ const etagResponseHeader = {
10
+ ETag: {
11
+ description: 'Strong validator for the current version of the resource.',
12
+ schema: { type: 'string' },
13
+ },
14
+ };
15
+ const ifMatchParameter = {
16
+ name: 'If-Match',
17
+ in: 'header',
18
+ required: false,
19
+ description: 'Strong ETag from a prior response. The request only proceeds if the resource still matches; otherwise the server responds with 412 Precondition Failed.',
20
+ schema: { type: 'string' },
21
+ };
22
+ const preconditionFailedResponse = {
23
+ description: 'The `If-Match` header did not match the current ETag of the resource. The caller should fetch the latest version and retry.',
24
+ };
1
25
  export const pathItems = {
2
26
  parameters: [
3
27
  { $ref: '#/components/parameters/appId' },
@@ -20,8 +44,9 @@ export const pathItems = {
20
44
  operationId: 'getAppResourceById',
21
45
  responses: {
22
46
  200: {
23
- description: 'The resource that matches the given id.',
24
- $ref: '#/components/responses/resource',
47
+ description: 'The resource that matches the given id. Omits the `ETag` header on view responses.',
48
+ content: resourceContent,
49
+ headers: etagResponseHeader,
25
50
  },
26
51
  },
27
52
  security: [{ studio: [] }, { app: ['resources:manage'] }, { cli: ['resources:read'] }, {}],
@@ -30,6 +55,7 @@ export const pathItems = {
30
55
  tags: ['common', 'app', 'resource'],
31
56
  description: 'Update an existing app resource.',
32
57
  operationId: 'updateAppResource',
58
+ parameters: [ifMatchParameter],
33
59
  requestBody: {
34
60
  required: true,
35
61
  $ref: '#/components/requestBodies/resource',
@@ -37,8 +63,10 @@ export const pathItems = {
37
63
  responses: {
38
64
  200: {
39
65
  description: 'The updated resource.',
40
- $ref: '#/components/responses/resource',
66
+ content: resourceContent,
67
+ headers: etagResponseHeader,
41
68
  },
69
+ 412: preconditionFailedResponse,
42
70
  },
43
71
  security: [{ studio: [] }, { app: ['resources:manage'] }, { cli: ['resources:write'] }, {}],
44
72
  },
@@ -46,6 +74,7 @@ export const pathItems = {
46
74
  tags: ['common', 'app', 'resource'],
47
75
  description: 'Patch an existing app resource.',
48
76
  operationId: 'patchAppResource',
77
+ parameters: [ifMatchParameter],
49
78
  requestBody: {
50
79
  required: true,
51
80
  $ref: '#/components/requestBodies/resource',
@@ -53,8 +82,10 @@ export const pathItems = {
53
82
  responses: {
54
83
  200: {
55
84
  description: 'The patched resource.',
56
- $ref: '#/components/responses/resource',
85
+ content: resourceContent,
86
+ headers: etagResponseHeader,
57
87
  },
88
+ 412: preconditionFailedResponse,
58
89
  },
59
90
  security: [{ studio: [] }, { app: ['resources:manage'] }, { cli: ['resources:write'] }, {}],
60
91
  },
@@ -62,11 +93,12 @@ export const pathItems = {
62
93
  tags: ['common', 'app', 'resource'],
63
94
  description: 'Delete an existing app resource.',
64
95
  operationId: 'deleteAppResource',
96
+ parameters: [ifMatchParameter],
65
97
  responses: {
66
98
  204: {
67
99
  description: 'The app resource has been deleted successfully.',
68
- $ref: '#/components/responses/resource',
69
100
  },
101
+ 412: preconditionFailedResponse,
70
102
  },
71
103
  security: [{ studio: [] }, { app: ['resources:manage'] }, { cli: ['resources:write'] }, {}],
72
104
  },
@@ -16,8 +16,24 @@ export const pathItems = {
16
16
  content: {
17
17
  'application/json': {
18
18
  schema: {
19
- type: 'array',
20
- items: { $ref: '#/components/schemas/AppOAuth2Secret' },
19
+ type: 'object',
20
+ description: 'The public facing values of an app OAuth2 secret.',
21
+ additionalProperties: false,
22
+ properties: {
23
+ authorizationUrl: {
24
+ type: 'string',
25
+ format: 'uri',
26
+ description: 'The OAuth2 redirect URL.',
27
+ },
28
+ clientId: {
29
+ type: 'string',
30
+ description: 'The public client id which identifies Appsemble to the authorization server.',
31
+ },
32
+ scope: {
33
+ type: 'string',
34
+ description: 'The login scope that will be requested from the authorization server.',
35
+ },
36
+ },
21
37
  },
22
38
  },
23
39
  },
@@ -9,7 +9,7 @@ export const pathItems = {
9
9
  requestBody: {
10
10
  content: {
11
11
  'application/json': {
12
- schema: {},
12
+ schema: { $ref: '#/components/schemas/AppSamlSecret' },
13
13
  },
14
14
  },
15
15
  },
@@ -19,7 +19,7 @@ export const pathItems = {
19
19
  description: 'The updated SAML secret.',
20
20
  content: {
21
21
  'application/json': {
22
- schema: {},
22
+ schema: { $ref: '#/components/schemas/AppSamlSecret' },
23
23
  },
24
24
  },
25
25
  },
@@ -6,7 +6,7 @@ export const pathItems = {
6
6
  requestBody: {
7
7
  content: {
8
8
  'application/json': {
9
- schema: {},
9
+ schema: { $ref: '#/components/schemas/AppSamlSecret' },
10
10
  },
11
11
  },
12
12
  },
@@ -16,7 +16,7 @@ export const pathItems = {
16
16
  description: 'A list of the SAML secrets for the app.',
17
17
  content: {
18
18
  'application/json': {
19
- schema: {},
19
+ schema: { $ref: '#/components/schemas/AppSamlSecret' },
20
20
  },
21
21
  },
22
22
  },
@@ -33,7 +33,7 @@ export const pathItems = {
33
33
  'application/json': {
34
34
  schema: {
35
35
  type: 'array',
36
- items: {},
36
+ items: { $ref: '#/components/schemas/AppSamlSecret' },
37
37
  },
38
38
  },
39
39
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/utils",
3
- "version": "0.36.10",
3
+ "version": "0.37.0",
4
4
  "description": "Utility functions used in Appsemble internally",
5
5
  "keywords": [
6
6
  "app",
@@ -39,8 +39,8 @@
39
39
  "test": "vitest"
40
40
  },
41
41
  "dependencies": {
42
- "@appsemble/lang-sdk": "0.36.10",
43
- "@appsemble/types": "0.36.10",
42
+ "@appsemble/lang-sdk": "0.37.0",
43
+ "@appsemble/types": "0.37.0",
44
44
  "@fortawesome/fontawesome-common-types": "^6.0.0",
45
45
  "axios": "^1.0.0",
46
46
  "langmap": "^0.0.16",