@appsemble/utils 0.20.43 → 0.20.45
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 +3 -3
- package/api/components/schemas/ActionDefinition.js +1 -0
- package/api/components/schemas/ObjectRemapperDefinition.js +1 -1
- package/api/components/schemas/TeamMembersActionDefinition.d.ts +1 -0
- package/api/components/schemas/TeamMembersActionDefinition.js +18 -0
- package/api/components/schemas/index.d.ts +1 -0
- package/api/components/schemas/index.js +1 -0
- package/api/index.d.ts +18 -1
- package/api/index.js +8 -1
- package/api/paths/apps.js +18 -1
- package/package.json +2 -2
- package/remap.js +1 -1
- package/remap.test.js +12 -7
- package/serverActions.js +5 -0
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#  Appsemble Utilities
|
|
2
2
|
|
|
3
3
|
> Internal utility functions used across multiple Appsemble projects.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@appsemble/utils)
|
|
6
|
-
[](https://gitlab.com/appsemble/appsemble/-/releases/0.20.45)
|
|
7
7
|
[](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.20.
|
|
29
|
+
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.20.45/LICENSE.md) ©
|
|
30
30
|
[Appsemble](https://appsemble.com)
|
|
@@ -69,6 +69,7 @@ export const ActionDefinition = {
|
|
|
69
69
|
{ $ref: '#/components/schemas/TeamInviteActionDefinition' },
|
|
70
70
|
{ $ref: '#/components/schemas/TeamJoinActionDefinition' },
|
|
71
71
|
{ $ref: '#/components/schemas/TeamListActionDefinition' },
|
|
72
|
+
{ $ref: '#/components/schemas/TeamMembersActionDefinition' },
|
|
72
73
|
{ $ref: '#/components/schemas/ThrowActionDefinition' },
|
|
73
74
|
{ $ref: '#/components/schemas/UserLoginActionDefinition' },
|
|
74
75
|
{ $ref: '#/components/schemas/UserRegisterActionDefinition' },
|
|
@@ -132,7 +132,7 @@ Returns \`true\` if all entries are equal, otherwise \`false\`.
|
|
|
132
132
|
|
|
133
133
|
Returns \`false\` if all entries are equal to the first entry, otherwise \`true\`.
|
|
134
134
|
|
|
135
|
-
If only
|
|
135
|
+
If only one remapper or none is passed, the remapper value gets computed and then inverted.
|
|
136
136
|
`,
|
|
137
137
|
},
|
|
138
138
|
step: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TeamMembersActionDefinition: import("openapi-types").OpenAPIV3.SchemaObject;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseActionDefinition } from './BaseActionDefinition.js';
|
|
2
|
+
import { extendJSONSchema } from './utils.js';
|
|
3
|
+
export const TeamMembersActionDefinition = extendJSONSchema(BaseActionDefinition, {
|
|
4
|
+
type: 'object',
|
|
5
|
+
additionalProperties: false,
|
|
6
|
+
required: ['type', 'id'],
|
|
7
|
+
properties: {
|
|
8
|
+
type: {
|
|
9
|
+
enum: ['team.members'],
|
|
10
|
+
description: "Get a list of a team's members",
|
|
11
|
+
},
|
|
12
|
+
id: {
|
|
13
|
+
description: 'The ID of a specific team to get the members from',
|
|
14
|
+
$ref: '#/components/schemas/RemapperDefinition',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=TeamMembersActionDefinition.js.map
|
|
@@ -103,6 +103,7 @@ export * from './TabsPageDefinition.js';
|
|
|
103
103
|
export * from './TeamInviteActionDefinition.js';
|
|
104
104
|
export * from './TeamJoinActionDefinition.js';
|
|
105
105
|
export * from './TeamListActionDefinition.js';
|
|
106
|
+
export * from './TeamMembersActionDefinition.js';
|
|
106
107
|
export * from './TeamsDefinition.js';
|
|
107
108
|
export * from './Theme.js';
|
|
108
109
|
export * from './ThrowActionDefinition.js';
|
|
@@ -103,6 +103,7 @@ export * from './TabsPageDefinition.js';
|
|
|
103
103
|
export * from './TeamInviteActionDefinition.js';
|
|
104
104
|
export * from './TeamJoinActionDefinition.js';
|
|
105
105
|
export * from './TeamListActionDefinition.js';
|
|
106
|
+
export * from './TeamMembersActionDefinition.js';
|
|
106
107
|
export * from './TeamsDefinition.js';
|
|
107
108
|
export * from './Theme.js';
|
|
108
109
|
export * from './ThrowActionDefinition.js';
|
package/api/index.d.ts
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { type OpenAPIV3 } from 'openapi-types';
|
|
2
2
|
export * as schemas from './components/schemas/index.js';
|
|
3
3
|
interface APIParams {
|
|
4
|
+
/**
|
|
5
|
+
* The port on which the server runs.
|
|
6
|
+
*/
|
|
4
7
|
port?: number;
|
|
8
|
+
/**
|
|
9
|
+
* The host on which the server is exposed.
|
|
10
|
+
*/
|
|
5
11
|
host?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether or not the API is served using SSL.
|
|
14
|
+
*/
|
|
15
|
+
ssl?: boolean;
|
|
6
16
|
}
|
|
7
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Get the OpenAPI document for the Appsemble REST API.
|
|
19
|
+
*
|
|
20
|
+
* @param version The Appsemble version
|
|
21
|
+
* @param argv The parsed command line arguments.
|
|
22
|
+
* @returns The OpenAPI document for Appsemble.
|
|
23
|
+
*/
|
|
24
|
+
export declare function api(version: string, { port, ssl, host }?: APIParams): OpenAPIV3.Document;
|
package/api/index.js
CHANGED
|
@@ -2,7 +2,14 @@ import { components } from './components/index.js';
|
|
|
2
2
|
import { paths } from './paths/index.js';
|
|
3
3
|
import { tags } from './tags/index.js';
|
|
4
4
|
export * as schemas from './components/schemas/index.js';
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Get the OpenAPI document for the Appsemble REST API.
|
|
7
|
+
*
|
|
8
|
+
* @param version The Appsemble version
|
|
9
|
+
* @param argv The parsed command line arguments.
|
|
10
|
+
* @returns The OpenAPI document for Appsemble.
|
|
11
|
+
*/
|
|
12
|
+
export function api(version, { port = 9999, ssl, host = `${ssl ? 'https' : 'http'}://localhost:${port}` } = {}) {
|
|
6
13
|
return {
|
|
7
14
|
openapi: '3.0.2',
|
|
8
15
|
components,
|
package/api/paths/apps.js
CHANGED
|
@@ -1167,7 +1167,7 @@ This will return a 404 if the user has not uploaded one.`,
|
|
|
1167
1167
|
},
|
|
1168
1168
|
},
|
|
1169
1169
|
},
|
|
1170
|
-
security: [{ studio: [] }],
|
|
1170
|
+
security: [{ studio: [] }, { app: ['teams:read'] }],
|
|
1171
1171
|
},
|
|
1172
1172
|
post: {
|
|
1173
1173
|
tags: ['app'],
|
|
@@ -1221,6 +1221,23 @@ This will return a 404 if the user has not uploaded one.`,
|
|
|
1221
1221
|
schema: { $ref: '#/components/schemas/User/properties/id' },
|
|
1222
1222
|
},
|
|
1223
1223
|
],
|
|
1224
|
+
get: {
|
|
1225
|
+
tags: ['app'],
|
|
1226
|
+
description: 'Get a certain team member from a team',
|
|
1227
|
+
operationId: 'getTeamMember',
|
|
1228
|
+
responses: {
|
|
1229
|
+
200: {
|
|
1230
|
+
description: 'The specified team member',
|
|
1231
|
+
content: {
|
|
1232
|
+
'application/json': {
|
|
1233
|
+
schema: {
|
|
1234
|
+
$ref: '#/components/schemas/Member',
|
|
1235
|
+
},
|
|
1236
|
+
},
|
|
1237
|
+
},
|
|
1238
|
+
},
|
|
1239
|
+
},
|
|
1240
|
+
},
|
|
1224
1241
|
put: {
|
|
1225
1242
|
tags: ['app'],
|
|
1226
1243
|
description: 'Update the role of a team member.',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appsemble/utils",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.45",
|
|
4
4
|
"description": "Utility functions used in Appsemble internally",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"test": "NODE_OPTIONS=--experimental-vm-modules jest"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@appsemble/types": "0.20.
|
|
34
|
+
"@appsemble/types": "0.20.45",
|
|
35
35
|
"axios": "^1.0.0",
|
|
36
36
|
"cron-parser": "^4.0.0",
|
|
37
37
|
"date-fns": "^2.0.0",
|
package/remap.js
CHANGED
|
@@ -93,7 +93,7 @@ const mapperImplementations = {
|
|
|
93
93
|
},
|
|
94
94
|
not(mappers, input, context) {
|
|
95
95
|
if (mappers.length <= 1) {
|
|
96
|
-
return
|
|
96
|
+
return !remap(mappers[0], input, context);
|
|
97
97
|
}
|
|
98
98
|
const [firstValue, ...otherValues] = mappers.map((mapper) => remap(mapper, input, context));
|
|
99
99
|
return !otherValues.some((value) => equal(firstValue, value));
|
package/remap.test.js
CHANGED
|
@@ -331,16 +331,21 @@ describe('not', () => {
|
|
|
331
331
|
mappers: { not: [{ prop: '0' }, { prop: '1' }] },
|
|
332
332
|
expected: true,
|
|
333
333
|
},
|
|
334
|
-
'return
|
|
335
|
-
input:
|
|
336
|
-
mappers: { not: [] },
|
|
337
|
-
expected:
|
|
334
|
+
'return true if (computed) input is false': {
|
|
335
|
+
input: false,
|
|
336
|
+
mappers: { not: [{ root: null }] },
|
|
337
|
+
expected: true,
|
|
338
338
|
},
|
|
339
|
-
'return false
|
|
340
|
-
input:
|
|
341
|
-
mappers: { not: [{
|
|
339
|
+
'return false if (computed) input is true': {
|
|
340
|
+
input: true,
|
|
341
|
+
mappers: { not: [{ root: null }] },
|
|
342
342
|
expected: false,
|
|
343
343
|
},
|
|
344
|
+
'return true when mappers is empty': {
|
|
345
|
+
input: true,
|
|
346
|
+
mappers: { not: [] },
|
|
347
|
+
expected: true,
|
|
348
|
+
},
|
|
344
349
|
});
|
|
345
350
|
});
|
|
346
351
|
describe('ics', () => {
|
package/serverActions.js
CHANGED
|
@@ -7,7 +7,12 @@ export const serverActions = new Set([
|
|
|
7
7
|
'log',
|
|
8
8
|
'notify',
|
|
9
9
|
'request',
|
|
10
|
+
'resource.get',
|
|
10
11
|
'resource.query',
|
|
12
|
+
'resource.create',
|
|
13
|
+
'resource.patch',
|
|
14
|
+
'resource.update',
|
|
15
|
+
'resource.delete',
|
|
11
16
|
'static',
|
|
12
17
|
]);
|
|
13
18
|
//# sourceMappingURL=serverActions.js.map
|