@appsemble/cli 0.30.3 → 0.30.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/README.md +5 -5
- package/commands/group/member/invite.d.ts +2 -1
- package/commands/group/member/invite.js +6 -1
- package/commands/serve.js +14 -20
- package/lib/app.test.js +22 -19
- package/lib/asset.test.js +1 -0
- package/lib/group.d.ts +7 -1
- package/lib/group.js +2 -2
- package/lib/group.test.js +23 -17
- package/package.json +6 -6
- package/server/controllers/apps/members/current/groups/getCurrentAppMemberGroups.d.ts +2 -0
- package/server/controllers/apps/members/current/groups/getCurrentAppMemberGroups.js +4 -0
- package/server/controllers/apps/members/current/groups/index.d.ts +1 -0
- package/server/controllers/apps/members/current/groups/index.js +2 -0
- package/server/controllers/apps/members/current/index.d.ts +1 -0
- package/server/controllers/apps/members/current/index.js +1 -0
- package/server/options/getAppAsset.d.ts +2 -0
- package/server/options/getAppAsset.js +13 -0
- package/server/options/getCurrentAppMemberGroups.d.ts +3 -0
- package/server/options/getCurrentAppMemberGroups.js +2 -0
- package/server/options/index.d.ts +2 -0
- package/server/options/index.js +2 -0
- package/server/options/options.js +3 -1
- package/templates/apps/empty/app-definition.yaml +2 -2
- package/templates/blocks/mini-jsx/package.json +1 -1
- package/templates/blocks/preact/package.json +2 -2
- package/templates/blocks/vanilla/package.json +1 -1
- package/vitest.setup.js +3 -3
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#  Appsemble CLI
|
|
2
2
|
|
|
3
3
|
> Manage apps and blocks from the command line.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@appsemble/cli)
|
|
6
|
-
[](https://gitlab.com/appsemble/appsemble/-/releases/0.30.9)
|
|
7
7
|
[](https://prettier.io)
|
|
8
8
|
|
|
9
9
|
## Table of Contents
|
|
@@ -199,7 +199,7 @@ appsemble app import <path-of-zip-file> --organization <organizationId>
|
|
|
199
199
|
```
|
|
200
200
|
|
|
201
201
|
For a more in depth explanation of how to build apps, use our
|
|
202
|
-
[app building guide](https://appsemble.app/docs/
|
|
202
|
+
[app building guide](https://appsemble.app/docs/guides).
|
|
203
203
|
|
|
204
204
|
### Blocks
|
|
205
205
|
|
|
@@ -248,7 +248,7 @@ npm install webpack@webpack-4 @appsemble/webpack-config
|
|
|
248
248
|
```
|
|
249
249
|
|
|
250
250
|
For a more in-depth explanation of how to build apps, use our
|
|
251
|
-
[block development guide](https://appsemble.app/docs/
|
|
251
|
+
[block development guide](https://appsemble.app/docs/development/developing-blocks).
|
|
252
252
|
|
|
253
253
|
### Groups
|
|
254
254
|
|
|
@@ -323,5 +323,5 @@ appsemble run-cronjobs --interval 30
|
|
|
323
323
|
|
|
324
324
|
## License
|
|
325
325
|
|
|
326
|
-
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.30.
|
|
326
|
+
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.30.9/LICENSE.md) ©
|
|
327
327
|
[Appsemble](https://appsemble.com)
|
|
@@ -6,9 +6,10 @@ interface InviteGroupArguments extends BaseArguments {
|
|
|
6
6
|
user: string;
|
|
7
7
|
context: string;
|
|
8
8
|
app: string;
|
|
9
|
+
role: string;
|
|
9
10
|
}
|
|
10
11
|
export declare const command = "invite <user>";
|
|
11
12
|
export declare const description = "Invite a new member to an existing group from an app.";
|
|
12
13
|
export declare function builder(yargs: Argv): Argv<any>;
|
|
13
|
-
export declare function handler({ app, appId, clientCredentials, context, id, remote, user, }: InviteGroupArguments): Promise<void>;
|
|
14
|
+
export declare function handler({ app, appId, clientCredentials, context, id, remote, role, user, }: InviteGroupArguments): Promise<void>;
|
|
14
15
|
export {};
|
|
@@ -20,13 +20,17 @@ export function builder(yargs) {
|
|
|
20
20
|
.option('context', {
|
|
21
21
|
describe: 'If specified, use the specified context from .appsemblerc.yaml',
|
|
22
22
|
demandOption: 'app',
|
|
23
|
+
})
|
|
24
|
+
.option('role', {
|
|
25
|
+
describe: 'The user will be invited to the group with this role',
|
|
26
|
+
demandOption: true,
|
|
23
27
|
})
|
|
24
28
|
.positional('user', {
|
|
25
29
|
describe: 'The ID or email address of the user you want to invite.',
|
|
26
30
|
demandOption: true,
|
|
27
31
|
});
|
|
28
32
|
}
|
|
29
|
-
export async function handler({ app, appId, clientCredentials, context, id, remote, user, }) {
|
|
33
|
+
export async function handler({ app, appId, clientCredentials, context, id, remote, role, user, }) {
|
|
30
34
|
const [resolvedAppId, resolvedRemote] = await resolveAppIdAndRemote(app, context, remote, appId);
|
|
31
35
|
await authenticate(resolvedRemote, 'groups:write', clientCredentials);
|
|
32
36
|
await inviteMember({
|
|
@@ -34,6 +38,7 @@ export async function handler({ app, appId, clientCredentials, context, id, remo
|
|
|
34
38
|
appId: resolvedAppId,
|
|
35
39
|
user,
|
|
36
40
|
remote: resolvedRemote,
|
|
41
|
+
role,
|
|
37
42
|
});
|
|
38
43
|
}
|
|
39
44
|
//# sourceMappingURL=invite.js.map
|
package/commands/serve.js
CHANGED
|
@@ -54,6 +54,7 @@ export function builder(yargs) {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
export async function handler(argv) {
|
|
57
|
+
var _a;
|
|
57
58
|
setArgv(argv);
|
|
58
59
|
const appPath = join(process.cwd(), argv.path);
|
|
59
60
|
const [, , , appsembleApp] = await traverseAppDirectory(appPath, 'development', new FormData());
|
|
@@ -65,18 +66,17 @@ export async function handler(argv) {
|
|
|
65
66
|
: new AppsembleError('This app does not support roles');
|
|
66
67
|
}
|
|
67
68
|
const appSecurity = appsembleApp.definition.security;
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
];
|
|
69
|
+
const appMemberInfo = {
|
|
70
|
+
sub: '1',
|
|
71
|
+
name: 'dev',
|
|
72
|
+
email: 'dev@example.com',
|
|
73
|
+
email_verified: true,
|
|
74
|
+
role: passedUserRole || ((_a = appSecurity === null || appSecurity === void 0 ? void 0 : appSecurity.default) === null || _a === void 0 ? void 0 : _a.role),
|
|
75
|
+
demo: false,
|
|
76
|
+
zoneinfo: '',
|
|
77
|
+
properties: {},
|
|
78
|
+
};
|
|
79
|
+
const appMembers = [appMemberInfo];
|
|
80
80
|
const allowedGroupRoles = ['manager', 'member'];
|
|
81
81
|
const passedGroupRole = argv['group-role'];
|
|
82
82
|
if (passedGroupRole && !allowedGroupRoles.includes(passedGroupRole)) {
|
|
@@ -90,12 +90,6 @@ export async function handler(argv) {
|
|
|
90
90
|
annotations: {},
|
|
91
91
|
},
|
|
92
92
|
];
|
|
93
|
-
const appUserInfo = {
|
|
94
|
-
email: 'dev@example.com',
|
|
95
|
-
email_verified: true,
|
|
96
|
-
name: 'dev',
|
|
97
|
-
sub: '1',
|
|
98
|
-
};
|
|
99
93
|
const appName = normalize(appsembleApp.definition.name);
|
|
100
94
|
const appId = 1;
|
|
101
95
|
setAppName(appName);
|
|
@@ -243,7 +237,7 @@ export async function handler(argv) {
|
|
|
243
237
|
...(appSecurity
|
|
244
238
|
? {
|
|
245
239
|
appMembers,
|
|
246
|
-
|
|
240
|
+
appMemberInfo,
|
|
247
241
|
appGroups,
|
|
248
242
|
}
|
|
249
243
|
: {}),
|
|
@@ -269,7 +263,7 @@ export async function handler(argv) {
|
|
|
269
263
|
...(appSecurity
|
|
270
264
|
? {
|
|
271
265
|
appMembers,
|
|
272
|
-
|
|
266
|
+
appMemberInfo,
|
|
273
267
|
appGroups,
|
|
274
268
|
}
|
|
275
269
|
: {}),
|
package/lib/app.test.js
CHANGED
|
@@ -5,6 +5,7 @@ import { PredefinedOrganizationRole } from '@appsemble/types';
|
|
|
5
5
|
import { ISODateTimePattern } from '@appsemble/utils';
|
|
6
6
|
import { setTestApp } from 'axios-test-instance';
|
|
7
7
|
import FormData from 'form-data';
|
|
8
|
+
import sharp from 'sharp';
|
|
8
9
|
import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
9
10
|
import { deleteApp, patchApp, publishApp, resolveAppIdAndRemote, traverseAppDirectory, updateApp, writeAppMessages, } from './app.js';
|
|
10
11
|
import { initAxios } from './initAxios.js';
|
|
@@ -351,9 +352,11 @@ describe('app', () => {
|
|
|
351
352
|
},
|
|
352
353
|
]
|
|
353
354
|
`);
|
|
354
|
-
const assets = await Asset.findAll();
|
|
355
|
+
const assets = await Asset.findAll({ order: [['filename', 'ASC']] });
|
|
356
|
+
const tuxData = await readFixture('apps/test/assets/tux.png');
|
|
355
357
|
expect(assets.map((a) => a.data)).toStrictEqual([
|
|
356
|
-
await
|
|
358
|
+
await sharp(tuxData).toFormat('avif').toBuffer(),
|
|
359
|
+
tuxData,
|
|
357
360
|
]);
|
|
358
361
|
});
|
|
359
362
|
it('should publish app with runtime config', async () => {
|
|
@@ -516,11 +519,10 @@ describe('app', () => {
|
|
|
516
519
|
},
|
|
517
520
|
]
|
|
518
521
|
`);
|
|
519
|
-
const assets = await Asset.findAll();
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
]);
|
|
522
|
+
const assets = await Asset.findAll({ order: [['filename', 'ASC']] });
|
|
523
|
+
const tuxData = await readFixture('apps/test/assets/tux.png');
|
|
524
|
+
const tuxAvifData = await sharp(tuxData).toFormat('avif').toBuffer();
|
|
525
|
+
expect(assets.map((a) => a.data)).toStrictEqual([tuxAvifData, tuxAvifData, tuxData, tuxData]);
|
|
524
526
|
const appCollectionApp = await AppCollectionApp.findOne();
|
|
525
527
|
expect(appCollectionApp.AppId).toBe(1);
|
|
526
528
|
expect(appCollectionApp.AppCollectionId).toBe(1);
|
|
@@ -659,9 +661,11 @@ describe('app', () => {
|
|
|
659
661
|
},
|
|
660
662
|
]
|
|
661
663
|
`);
|
|
662
|
-
const assets = await Asset.findAll();
|
|
664
|
+
const assets = await Asset.findAll({ order: [['filename', 'ASC']] });
|
|
665
|
+
const tuxData = await readFixture('apps/test/variants/tux/assets/small-tux.png');
|
|
663
666
|
expect(assets.map((a) => a.data)).toStrictEqual([
|
|
664
|
-
await
|
|
667
|
+
await sharp(tuxData).toFormat('avif').toBuffer(),
|
|
668
|
+
tuxData,
|
|
665
669
|
]);
|
|
666
670
|
});
|
|
667
671
|
it('should publish app variables and secrets', async () => {
|
|
@@ -1128,9 +1132,11 @@ describe('app', () => {
|
|
|
1128
1132
|
},
|
|
1129
1133
|
]
|
|
1130
1134
|
`);
|
|
1131
|
-
const assets = await Asset.findAll();
|
|
1135
|
+
const assets = await Asset.findAll({ order: [['filename', 'ASC']] });
|
|
1136
|
+
const tuxData = await readFixture('apps/test/assets/tux.png');
|
|
1132
1137
|
expect(assets.map((a) => a.data)).toStrictEqual([
|
|
1133
|
-
await
|
|
1138
|
+
await sharp(tuxData).toFormat('avif').toBuffer(),
|
|
1139
|
+
tuxData,
|
|
1134
1140
|
]);
|
|
1135
1141
|
});
|
|
1136
1142
|
it('should update app with runtime config', async () => {
|
|
@@ -1294,11 +1300,10 @@ describe('app', () => {
|
|
|
1294
1300
|
},
|
|
1295
1301
|
]
|
|
1296
1302
|
`);
|
|
1297
|
-
const assets = await Asset.findAll();
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
]);
|
|
1303
|
+
const assets = await Asset.findAll({ order: [['filename', 'ASC']] });
|
|
1304
|
+
const tuxData = await readFixture('apps/test/assets/tux.png');
|
|
1305
|
+
const tuxAvifData = await sharp(tuxData).toFormat('avif').toBuffer();
|
|
1306
|
+
expect(assets.map((a) => a.data)).toStrictEqual([tuxAvifData, tuxAvifData, tuxData, tuxData]);
|
|
1302
1307
|
// TODO: not yet implemented
|
|
1303
1308
|
// const appCollectionApp = await AppCollectionApp.findOne();
|
|
1304
1309
|
// expect(appCollectionApp.AppId).toBe(1);
|
|
@@ -1440,9 +1445,7 @@ describe('app', () => {
|
|
|
1440
1445
|
]
|
|
1441
1446
|
`);
|
|
1442
1447
|
const assets = await Asset.findAll();
|
|
1443
|
-
expect(assets.map((a) => a.
|
|
1444
|
-
await readFixture('apps/test/variants/tux/assets/small-tux.png'),
|
|
1445
|
-
]);
|
|
1448
|
+
expect(assets.map((a) => a.filename)).toStrictEqual(['small-tux.png', 'small-tux.avif']);
|
|
1446
1449
|
});
|
|
1447
1450
|
it('should update app variables and secrets', async () => {
|
|
1448
1451
|
vi.useRealTimers();
|
package/lib/asset.test.js
CHANGED
package/lib/group.d.ts
CHANGED
|
@@ -25,6 +25,12 @@ interface SharedGroupMemberParams extends SharedExistingGroupParams {
|
|
|
25
25
|
*/
|
|
26
26
|
user: string;
|
|
27
27
|
}
|
|
28
|
+
interface InviteGroupMemberParams extends SharedGroupMemberParams {
|
|
29
|
+
/**
|
|
30
|
+
* The role to invite the group member with.
|
|
31
|
+
*/
|
|
32
|
+
role: AppRole;
|
|
33
|
+
}
|
|
28
34
|
interface UpdateGroupMemberParams extends SharedGroupMemberParams {
|
|
29
35
|
/**
|
|
30
36
|
* The new role of the group member.
|
|
@@ -55,7 +61,7 @@ export declare function resolveAnnotations(annotations: string[]): Record<string
|
|
|
55
61
|
export declare function createGroup({ annotations, appId, clientCredentials, name, remote, }: CreateGroupParams): Promise<void>;
|
|
56
62
|
export declare function deleteGroup({ clientCredentials, id, remote, }: SharedExistingGroupParams): Promise<void>;
|
|
57
63
|
export declare function updateGroup({ annotations, id, name, remote, }: UpdateGroupParams): Promise<void>;
|
|
58
|
-
export declare function inviteMember({ id, remote, user }:
|
|
64
|
+
export declare function inviteMember({ id, remote, role, user, }: InviteGroupMemberParams): Promise<void>;
|
|
59
65
|
export declare function updateMember({ id, remote, role, user, }: UpdateGroupMemberParams): Promise<void>;
|
|
60
66
|
export declare function deleteMember({ id, user }: SharedGroupMemberParams): Promise<void>;
|
|
61
67
|
export {};
|
package/lib/group.js
CHANGED
|
@@ -35,9 +35,9 @@ export async function updateGroup({ annotations = [], id, name, remote, }) {
|
|
|
35
35
|
}, { baseURL: remote });
|
|
36
36
|
logger.info(`Successfully updated group ${id}`);
|
|
37
37
|
}
|
|
38
|
-
export async function inviteMember({ id, remote, user }) {
|
|
38
|
+
export async function inviteMember({ id, remote, role, user, }) {
|
|
39
39
|
logger.info(`Inviting ${user} to group ${id}`);
|
|
40
|
-
await axios.post(`/api/groups/${id}/invites`, [{ email: user, role
|
|
40
|
+
await axios.post(`/api/groups/${id}/invites`, [{ email: user, role }], {
|
|
41
41
|
baseURL: remote,
|
|
42
42
|
});
|
|
43
43
|
logger.info(`Successfully invited ${user} to group ${id}`);
|
package/lib/group.test.js
CHANGED
|
@@ -312,10 +312,6 @@ describe('group', () => {
|
|
|
312
312
|
name: 'Test App',
|
|
313
313
|
defaultPage: 'Test Page',
|
|
314
314
|
security: {
|
|
315
|
-
groups: {
|
|
316
|
-
join: 'anyone',
|
|
317
|
-
invite: [],
|
|
318
|
-
},
|
|
319
315
|
default: {
|
|
320
316
|
role: 'Reader',
|
|
321
317
|
policy: 'everyone',
|
|
@@ -338,7 +334,7 @@ describe('group', () => {
|
|
|
338
334
|
email: user.primaryEmail,
|
|
339
335
|
AppId: app.id,
|
|
340
336
|
UserId: user.id,
|
|
341
|
-
role: '
|
|
337
|
+
role: 'Reader',
|
|
342
338
|
name: user.name,
|
|
343
339
|
});
|
|
344
340
|
await authorizeCLI('groups:write', testApp);
|
|
@@ -347,6 +343,7 @@ describe('group', () => {
|
|
|
347
343
|
id: group.id,
|
|
348
344
|
remote: testApp.defaults.baseURL,
|
|
349
345
|
user: user.primaryEmail,
|
|
346
|
+
role: 'Reader',
|
|
350
347
|
});
|
|
351
348
|
const invite = await GroupInvite.findOne();
|
|
352
349
|
expect(invite.dataValues).toMatchInlineSnapshot({
|
|
@@ -357,7 +354,7 @@ describe('group', () => {
|
|
|
357
354
|
"created": 1970-01-01T00:00:00.000Z,
|
|
358
355
|
"email": "test@example.com",
|
|
359
356
|
"key": Any<String>,
|
|
360
|
-
"role": "
|
|
357
|
+
"role": "Reader",
|
|
361
358
|
"updated": 1970-01-01T00:00:00.000Z,
|
|
362
359
|
}
|
|
363
360
|
`);
|
|
@@ -392,6 +389,7 @@ describe('group', () => {
|
|
|
392
389
|
id: 10,
|
|
393
390
|
remote: testApp.defaults.baseURL,
|
|
394
391
|
user: user.primaryEmail,
|
|
392
|
+
role: 'Reader',
|
|
395
393
|
})).rejects.toThrow('Request failed with status code 400');
|
|
396
394
|
});
|
|
397
395
|
});
|
|
@@ -402,16 +400,15 @@ describe('group', () => {
|
|
|
402
400
|
name: 'Test App',
|
|
403
401
|
defaultPage: 'Test Page',
|
|
404
402
|
security: {
|
|
405
|
-
groups: {
|
|
406
|
-
join: 'anyone',
|
|
407
|
-
invite: [],
|
|
408
|
-
},
|
|
409
403
|
default: {
|
|
410
404
|
role: 'Reader',
|
|
411
405
|
policy: 'everyone',
|
|
412
406
|
},
|
|
413
407
|
roles: {
|
|
414
408
|
Reader: {},
|
|
409
|
+
Updater: {
|
|
410
|
+
inherits: ['Manager'],
|
|
411
|
+
},
|
|
415
412
|
},
|
|
416
413
|
},
|
|
417
414
|
},
|
|
@@ -428,24 +425,25 @@ describe('group', () => {
|
|
|
428
425
|
email: user.primaryEmail,
|
|
429
426
|
AppId: app.id,
|
|
430
427
|
UserId: user.id,
|
|
431
|
-
role: '
|
|
428
|
+
role: 'Updater',
|
|
432
429
|
name: user.name,
|
|
433
430
|
});
|
|
434
431
|
const groupMember = await GroupMember.create({
|
|
435
432
|
GroupId: group.id,
|
|
436
433
|
AppMemberId: member.id,
|
|
434
|
+
role: 'Reader',
|
|
437
435
|
});
|
|
438
436
|
await authorizeCLI('groups:write', testApp);
|
|
439
437
|
await updateMember({
|
|
440
438
|
appId: app.id,
|
|
441
439
|
remote: testApp.defaults.baseURL,
|
|
442
440
|
user: groupMember.id,
|
|
443
|
-
role: '
|
|
441
|
+
role: 'Updater',
|
|
444
442
|
id: group.id,
|
|
445
443
|
});
|
|
446
|
-
expect(groupMember.role).toBe('
|
|
444
|
+
expect(groupMember.role).toBe('Reader');
|
|
447
445
|
await groupMember.reload();
|
|
448
|
-
expect(groupMember.role).toBe('
|
|
446
|
+
expect(groupMember.role).toBe('Updater');
|
|
449
447
|
});
|
|
450
448
|
it('should throw an error if the user is not a GroupMember', async () => {
|
|
451
449
|
const app = await App.create({
|
|
@@ -463,6 +461,9 @@ describe('group', () => {
|
|
|
463
461
|
},
|
|
464
462
|
roles: {
|
|
465
463
|
Reader: {},
|
|
464
|
+
Updater: {
|
|
465
|
+
inherits: ['Manager'],
|
|
466
|
+
},
|
|
466
467
|
},
|
|
467
468
|
},
|
|
468
469
|
},
|
|
@@ -479,7 +480,7 @@ describe('group', () => {
|
|
|
479
480
|
email: user.primaryEmail,
|
|
480
481
|
AppId: app.id,
|
|
481
482
|
UserId: user.id,
|
|
482
|
-
role: '
|
|
483
|
+
role: 'Updater',
|
|
483
484
|
name: user.name,
|
|
484
485
|
});
|
|
485
486
|
await authorizeCLI('groups:write', testApp);
|
|
@@ -487,7 +488,7 @@ describe('group', () => {
|
|
|
487
488
|
appId: app.id,
|
|
488
489
|
remote: testApp.defaults.baseURL,
|
|
489
490
|
user: user.id,
|
|
490
|
-
role: '
|
|
491
|
+
role: 'Updater',
|
|
491
492
|
id: group.id,
|
|
492
493
|
})).rejects.toThrow('Request failed with status code 404');
|
|
493
494
|
});
|
|
@@ -509,6 +510,9 @@ describe('group', () => {
|
|
|
509
510
|
},
|
|
510
511
|
roles: {
|
|
511
512
|
Reader: {},
|
|
513
|
+
Updater: {
|
|
514
|
+
inherits: ['Maintainer'],
|
|
515
|
+
},
|
|
512
516
|
},
|
|
513
517
|
},
|
|
514
518
|
},
|
|
@@ -525,7 +529,7 @@ describe('group', () => {
|
|
|
525
529
|
email: user.primaryEmail,
|
|
526
530
|
AppId: app.id,
|
|
527
531
|
UserId: user.id,
|
|
528
|
-
role: '
|
|
532
|
+
role: 'Updater',
|
|
529
533
|
name: user.name,
|
|
530
534
|
});
|
|
531
535
|
await authorizeCLI('groups:write', testApp);
|
|
@@ -534,10 +538,12 @@ describe('group', () => {
|
|
|
534
538
|
await GroupMember.create({
|
|
535
539
|
GroupId: group.id,
|
|
536
540
|
AppMemberId: member.id,
|
|
541
|
+
role: 'Updater',
|
|
537
542
|
});
|
|
538
543
|
const { id: groupMemberId } = await GroupMember.create({
|
|
539
544
|
GroupId: group.id,
|
|
540
545
|
AppMemberId: member2.id,
|
|
546
|
+
role: 'Reader',
|
|
541
547
|
});
|
|
542
548
|
await deleteMember({
|
|
543
549
|
id: group.id,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appsemble/cli",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.9",
|
|
4
4
|
"description": "The CLI for developing with Appsemble apps and blocks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"test": "vitest"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@appsemble/node-utils": "0.30.
|
|
46
|
-
"@appsemble/types": "0.30.
|
|
47
|
-
"@appsemble/utils": "0.30.
|
|
45
|
+
"@appsemble/node-utils": "0.30.9",
|
|
46
|
+
"@appsemble/types": "0.30.9",
|
|
47
|
+
"@appsemble/utils": "0.30.9",
|
|
48
48
|
"@fortawesome/fontawesome-common-types": "^6.0.0",
|
|
49
49
|
"@koa/cors": "^4.0.0",
|
|
50
50
|
"@odata/parser": "^0.2.0",
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
"yargs": "^17.0.0"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
|
-
"@appsemble/types": "0.30.
|
|
91
|
-
"@appsemble/server": "0.30.
|
|
90
|
+
"@appsemble/types": "0.30.9",
|
|
91
|
+
"@appsemble/server": "0.30.9",
|
|
92
92
|
"bcrypt": "^5.0.0",
|
|
93
93
|
"axios-test-instance": "^7.0.0",
|
|
94
94
|
"@types/concat-stream": "^2.0.0",
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createGetCurrentAppMemberGroupsController } from '@appsemble/node-utils';
|
|
2
|
+
import { options } from '../../../../../options/options.js';
|
|
3
|
+
export const getCurrentAppMemberGroups = createGetCurrentAppMemberGroupsController(options);
|
|
4
|
+
//# sourceMappingURL=getCurrentAppMemberGroups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getCurrentAppMemberGroups } from './getCurrentAppMemberGroups.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
export function getAppAsset({ context, id: filename }) {
|
|
3
|
+
const assetFound = context.appAssets.find((asset) => asset.filename === filename);
|
|
4
|
+
const assetPromise = async () => {
|
|
5
|
+
const data = await readFile(assetFound.filename);
|
|
6
|
+
return {
|
|
7
|
+
...assetFound,
|
|
8
|
+
data,
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
return Promise.resolve(assetPromise());
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=getAppAsset.js.map
|
|
@@ -20,6 +20,7 @@ export * from './createAppResourcesWithAssets.js';
|
|
|
20
20
|
export * from './updateAppResource.js';
|
|
21
21
|
export * from './deleteAppResource.js';
|
|
22
22
|
export * from './parseQuery.js';
|
|
23
|
+
export * from './getAppAsset.js';
|
|
23
24
|
export * from './getAppAssets.js';
|
|
24
25
|
export * from './createAppAsset.js';
|
|
25
26
|
export * from './getBlockMessages.js';
|
|
@@ -29,6 +30,7 @@ export * from './email.js';
|
|
|
29
30
|
export * from './sendNotifications.js';
|
|
30
31
|
export * from './applyAppServiceSecrets.js';
|
|
31
32
|
export * from './getCurrentAppMember.js';
|
|
33
|
+
export * from './getCurrentAppMemberGroups.js';
|
|
32
34
|
export * from './getAppGroups.js';
|
|
33
35
|
export * from './getAppReadmes.js';
|
|
34
36
|
export * from './getAppVariables.js';
|
package/server/options/index.js
CHANGED
|
@@ -20,6 +20,7 @@ export * from './createAppResourcesWithAssets.js';
|
|
|
20
20
|
export * from './updateAppResource.js';
|
|
21
21
|
export * from './deleteAppResource.js';
|
|
22
22
|
export * from './parseQuery.js';
|
|
23
|
+
export * from './getAppAsset.js';
|
|
23
24
|
export * from './getAppAssets.js';
|
|
24
25
|
export * from './createAppAsset.js';
|
|
25
26
|
export * from './getBlockMessages.js';
|
|
@@ -29,6 +30,7 @@ export * from './email.js';
|
|
|
29
30
|
export * from './sendNotifications.js';
|
|
30
31
|
export * from './applyAppServiceSecrets.js';
|
|
31
32
|
export * from './getCurrentAppMember.js';
|
|
33
|
+
export * from './getCurrentAppMemberGroups.js';
|
|
32
34
|
export * from './getAppGroups.js';
|
|
33
35
|
export * from './getAppReadmes.js';
|
|
34
36
|
export * from './getAppVariables.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { applyAppServiceSecrets, checkAppMemberAppPermissions, checkAppPermissions, checkAuthSubjectAppPermissions, checkUserOrganizationPermissions, createAppAsset, createAppResourcesWithAssets, createSettings, createTheme, deleteAppAsset, deleteAppResource, email, getApp, getAppAssets, getAppBlockStyles, getAppDetails, getAppGroups, getAppIcon, getAppMessages, getAppReadmes, getAppResource, getAppResources, getAppScreenshots, getAppStyles, getAppUrl, getAppVariables, getBlockAsset, getBlockMessages, getBlocksAssetsPaths, getCsp, getCurrentAppMember, getDbUpdated, getHost, getTheme, parseQuery, reloadUser, sendNotifications, updateAppResource, } from './index.js';
|
|
1
|
+
import { applyAppServiceSecrets, checkAppMemberAppPermissions, checkAppPermissions, checkAuthSubjectAppPermissions, checkUserOrganizationPermissions, createAppAsset, createAppResourcesWithAssets, createSettings, createTheme, deleteAppAsset, deleteAppResource, email, getApp, getAppAsset, getAppAssets, getAppBlockStyles, getAppDetails, getAppGroups, getAppIcon, getAppMessages, getAppReadmes, getAppResource, getAppResources, getAppScreenshots, getAppStyles, getAppUrl, getAppVariables, getBlockAsset, getBlockMessages, getBlocksAssetsPaths, getCsp, getCurrentAppMember, getCurrentAppMemberGroups, getDbUpdated, getHost, getTheme, parseQuery, reloadUser, sendNotifications, updateAppResource, } from './index.js';
|
|
2
2
|
export const options = {
|
|
3
3
|
applyAppServiceSecrets,
|
|
4
4
|
createAppAsset,
|
|
@@ -9,6 +9,7 @@ export const options = {
|
|
|
9
9
|
deleteAppResource,
|
|
10
10
|
email,
|
|
11
11
|
getApp,
|
|
12
|
+
getAppAsset,
|
|
12
13
|
getAppAssets,
|
|
13
14
|
getAppBlockStyles,
|
|
14
15
|
getAppDetails,
|
|
@@ -38,5 +39,6 @@ export const options = {
|
|
|
38
39
|
checkAppMemberAppPermissions,
|
|
39
40
|
checkAuthSubjectAppPermissions,
|
|
40
41
|
getCurrentAppMember,
|
|
42
|
+
getCurrentAppMemberGroups,
|
|
41
43
|
};
|
|
42
44
|
//# sourceMappingURL=options.js.map
|
|
@@ -6,7 +6,7 @@ pages:
|
|
|
6
6
|
- name: Example Page A
|
|
7
7
|
blocks:
|
|
8
8
|
- type: action-button
|
|
9
|
-
version: 0.30.
|
|
9
|
+
version: 0.30.9
|
|
10
10
|
parameters:
|
|
11
11
|
icon: arrow-right
|
|
12
12
|
actions:
|
|
@@ -17,7 +17,7 @@ pages:
|
|
|
17
17
|
- name: Example Page B
|
|
18
18
|
blocks:
|
|
19
19
|
- type: action-button
|
|
20
|
-
version: 0.30.
|
|
20
|
+
version: 0.30.9
|
|
21
21
|
parameters:
|
|
22
22
|
icon: arrow-left
|
|
23
23
|
actions:
|
package/vitest.setup.js
CHANGED
|
@@ -14,10 +14,10 @@ beforeAll(async () => {
|
|
|
14
14
|
beforeEach(async () => {
|
|
15
15
|
await testDB.truncate({ truncate: true, cascade: true, force: true, restartIdentity: true });
|
|
16
16
|
});
|
|
17
|
-
afterAll(
|
|
18
|
-
|
|
17
|
+
afterAll(() => {
|
|
18
|
+
testDB.close();
|
|
19
19
|
// We need to drop the test database from the root database
|
|
20
20
|
// testDB.drop() doesn't actually delete the database
|
|
21
|
-
|
|
21
|
+
rootDB.query(`DROP DATABASE ${testDB.getDatabaseName()}`);
|
|
22
22
|
});
|
|
23
23
|
//# sourceMappingURL=vitest.setup.js.map
|