@appsemble/cli 0.29.10 → 0.30.1

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 (153) hide show
  1. package/README.md +10 -10
  2. package/commands/app/create.d.ts +1 -1
  3. package/commands/app/create.js +5 -5
  4. package/commands/{team → group}/create.d.ts +3 -3
  5. package/commands/{team → group}/create.js +5 -5
  6. package/commands/{team → group}/delete.d.ts +3 -3
  7. package/commands/{team → group}/delete.js +5 -5
  8. package/commands/{team → group}/index.d.ts +2 -2
  9. package/commands/{team → group}/index.js +4 -4
  10. package/commands/{team → group}/member/delete.d.ts +3 -3
  11. package/commands/{team → group}/member/delete.js +5 -5
  12. package/commands/{team → group}/member/index.d.ts +1 -1
  13. package/commands/{team → group}/member/index.js +1 -3
  14. package/commands/{team → group}/member/invite.d.ts +3 -3
  15. package/commands/{team → group}/member/invite.js +5 -5
  16. package/commands/{team → group}/update.d.ts +3 -3
  17. package/commands/{team → group}/update.js +7 -7
  18. package/commands/migrateAppDefinitions.d.ts +13 -0
  19. package/commands/migrateAppDefinitions.js +73 -0
  20. package/commands/serve.d.ts +1 -1
  21. package/commands/serve.js +16 -16
  22. package/index.js +4 -2
  23. package/lib/app.js +13 -3
  24. package/lib/app.test.js +10 -7
  25. package/lib/asset.js +4 -2
  26. package/lib/asset.test.js +3 -1
  27. package/lib/block.test.js +2 -1
  28. package/lib/createServers.js +3 -1
  29. package/lib/group.d.ts +61 -0
  30. package/lib/group.js +55 -0
  31. package/lib/{team.test.js → group.test.js} +121 -137
  32. package/lib/organization.test.js +5 -4
  33. package/lib/resource.js +3 -1
  34. package/lib/resource.test.js +2 -1
  35. package/lib/serverImport.d.ts +1 -1
  36. package/package.json +6 -6
  37. package/server/argv.d.ts +4 -4
  38. package/server/argv.js +1 -1
  39. package/server/controllers/apps/actions/index.d.ts +5 -0
  40. package/server/controllers/apps/actions/index.js +6 -0
  41. package/server/controllers/apps/actions/proxyDelete.d.ts +2 -0
  42. package/server/controllers/apps/actions/proxyDelete.js +4 -0
  43. package/server/controllers/apps/actions/proxyGet.d.ts +2 -0
  44. package/server/controllers/apps/actions/proxyGet.js +4 -0
  45. package/server/controllers/apps/actions/proxyPatch.d.ts +2 -0
  46. package/server/controllers/apps/actions/proxyPatch.js +4 -0
  47. package/server/controllers/apps/actions/proxyPost.d.ts +2 -0
  48. package/server/controllers/apps/actions/proxyPost.js +4 -0
  49. package/server/controllers/apps/actions/proxyPut.d.ts +2 -0
  50. package/server/controllers/apps/actions/proxyPut.js +4 -0
  51. package/server/controllers/apps/index.d.ts +2 -0
  52. package/server/controllers/apps/index.js +3 -0
  53. package/server/controllers/apps/members/current/getCurrentAppMember.d.ts +2 -0
  54. package/server/controllers/apps/members/current/getCurrentAppMember.js +4 -0
  55. package/server/controllers/apps/members/current/index.d.ts +1 -0
  56. package/server/controllers/apps/members/current/index.js +2 -0
  57. package/server/controllers/apps/members/index.d.ts +1 -0
  58. package/server/controllers/apps/members/index.js +2 -0
  59. package/server/controllers/common/apps/assets/getAppAssetById.d.ts +2 -0
  60. package/server/controllers/common/apps/assets/getAppAssetById.js +4 -0
  61. package/server/controllers/common/apps/assets/index.d.ts +1 -0
  62. package/server/controllers/common/apps/assets/index.js +2 -0
  63. package/server/controllers/common/apps/groups/getAppGroups.d.ts +2 -0
  64. package/server/controllers/common/apps/groups/getAppGroups.js +4 -0
  65. package/server/controllers/common/apps/groups/index.d.ts +1 -0
  66. package/server/controllers/common/apps/groups/index.js +2 -0
  67. package/server/controllers/common/apps/index.d.ts +5 -0
  68. package/server/controllers/common/apps/index.js +6 -0
  69. package/server/controllers/common/apps/messages/getAppMessages.d.ts +2 -0
  70. package/server/controllers/common/apps/messages/getAppMessages.js +4 -0
  71. package/server/controllers/common/apps/messages/index.d.ts +1 -0
  72. package/server/controllers/common/apps/messages/index.js +2 -0
  73. package/server/controllers/common/apps/resources/countAppResources.d.ts +2 -0
  74. package/server/controllers/common/apps/resources/countAppResources.js +4 -0
  75. package/server/controllers/common/apps/resources/createAppResource.d.ts +2 -0
  76. package/server/controllers/common/apps/resources/createAppResource.js +4 -0
  77. package/server/controllers/common/apps/resources/deleteAppResource.d.ts +2 -0
  78. package/server/controllers/common/apps/resources/deleteAppResource.js +4 -0
  79. package/server/controllers/common/apps/resources/getAppResourceById.d.ts +2 -0
  80. package/server/controllers/common/apps/resources/getAppResourceById.js +4 -0
  81. package/server/controllers/common/apps/resources/index.d.ts +6 -0
  82. package/server/controllers/common/apps/resources/index.js +7 -0
  83. package/server/controllers/common/apps/resources/queryAppResources.d.ts +2 -0
  84. package/server/controllers/common/apps/resources/queryAppResources.js +4 -0
  85. package/server/controllers/common/apps/resources/updateAppResource.d.ts +2 -0
  86. package/server/controllers/common/apps/resources/updateAppResource.js +4 -0
  87. package/server/controllers/common/apps/variables/getAppVariables.js +4 -0
  88. package/server/controllers/common/apps/variables/index.d.ts +1 -0
  89. package/server/controllers/common/apps/variables/index.js +2 -0
  90. package/server/controllers/common/index.d.ts +1 -0
  91. package/server/controllers/common/index.js +2 -0
  92. package/server/controllers/index.d.ts +3 -8
  93. package/server/controllers/index.js +3 -8
  94. package/server/controllers/main/apps/assets/createAppAsset.d.ts +2 -0
  95. package/server/controllers/main/apps/assets/createAppAsset.js +4 -0
  96. package/server/controllers/main/apps/assets/index.d.ts +1 -0
  97. package/server/controllers/main/apps/assets/index.js +2 -0
  98. package/server/controllers/main/apps/index.d.ts +1 -0
  99. package/server/controllers/main/apps/index.js +2 -0
  100. package/server/controllers/main/index.d.ts +1 -0
  101. package/server/controllers/main/index.js +2 -0
  102. package/server/options/checkAppMemberAppPermissions.d.ts +1 -0
  103. package/server/options/checkAppMemberAppPermissions.js +4 -0
  104. package/server/options/checkAppPermissions.d.ts +1 -0
  105. package/server/options/checkAppPermissions.js +4 -0
  106. package/server/options/checkAuthSubjectAppPermissions.d.ts +1 -0
  107. package/server/options/checkAuthSubjectAppPermissions.js +4 -0
  108. package/server/options/checkUserOrganizationPermissions.d.ts +1 -0
  109. package/server/options/checkUserOrganizationPermissions.js +4 -0
  110. package/server/options/getAppGroups.d.ts +2 -0
  111. package/server/options/getAppGroups.js +4 -0
  112. package/server/options/getCurrentAppMember.d.ts +3 -0
  113. package/server/options/getCurrentAppMember.js +4 -0
  114. package/server/options/index.d.ts +6 -5
  115. package/server/options/index.js +6 -5
  116. package/server/options/options.js +7 -6
  117. package/templates/apps/empty/app-definition.yaml +2 -2
  118. package/templates/blocks/mini-jsx/package.json +1 -1
  119. package/templates/blocks/preact/package.json +2 -2
  120. package/templates/blocks/vanilla/package.json +1 -1
  121. package/commands/team/member/update.d.ts +0 -16
  122. package/commands/team/member/update.js +0 -46
  123. package/lib/team.d.ts +0 -61
  124. package/lib/team.js +0 -83
  125. package/server/controllers/action.d.ts +0 -6
  126. package/server/controllers/action.js +0 -8
  127. package/server/controllers/appMembers.d.ts +0 -2
  128. package/server/controllers/appMembers.js +0 -4
  129. package/server/controllers/appMessages.d.ts +0 -2
  130. package/server/controllers/appMessages.js +0 -4
  131. package/server/controllers/appVariables.js +0 -4
  132. package/server/controllers/assets.d.ts +0 -4
  133. package/server/controllers/assets.js +0 -6
  134. package/server/controllers/oauth2Provider.d.ts +0 -2
  135. package/server/controllers/oauth2Provider.js +0 -4
  136. package/server/controllers/resources.d.ts +0 -7
  137. package/server/controllers/resources.js +0 -9
  138. package/server/controllers/teams.d.ts +0 -2
  139. package/server/controllers/teams.js +0 -4
  140. package/server/options/checkRole.d.ts +0 -1
  141. package/server/options/checkRole.js +0 -2
  142. package/server/options/checkRole.test.d.ts +0 -1
  143. package/server/options/checkRole.test.js +0 -13
  144. package/server/options/getAppMembers.d.ts +0 -3
  145. package/server/options/getAppMembers.js +0 -4
  146. package/server/options/getAppTeams.d.ts +0 -2
  147. package/server/options/getAppTeams.js +0 -4
  148. package/server/options/getAppUserInfo.d.ts +0 -3
  149. package/server/options/getAppUserInfo.js +0 -4
  150. package/server/options/verifyResourceActionPermission.d.ts +0 -1
  151. package/server/options/verifyResourceActionPermission.js +0 -2
  152. /package/lib/{team.test.d.ts → group.test.d.ts} +0 -0
  153. /package/server/controllers/{appVariables.d.ts → common/apps/variables/getAppVariables.d.ts} +0 -0
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.29.10/config/assets/logo.svg) Appsemble CLI
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.30.1/config/assets/logo.svg) Appsemble CLI
2
2
 
3
3
  > Manage apps and blocks from the command line.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@appsemble/cli)](https://www.npmjs.com/package/@appsemble/cli)
6
- [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.29.10/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.29.10)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.30.1/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.30.1)
7
7
  [![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)
8
8
 
9
9
  ## Table of Contents
@@ -15,7 +15,7 @@
15
15
  - [Organizations](#organizations)
16
16
  - [Apps](#apps)
17
17
  - [Blocks](#blocks)
18
- - [Teams](#teams)
18
+ - [Groups](#groups)
19
19
  - [Assets](#assets)
20
20
  - [Resources](#resources)
21
21
  - [Cronjobs](#cronjobs)
@@ -66,10 +66,10 @@ The following option allows you to view the app with a specified role:
66
66
  appsemble serve <path-to-app-directory> --user-role test
67
67
  ```
68
68
 
69
- The following option allows you to view the app as a Manager of a team:
69
+ The following option allows you to view the app as a Manager of a group:
70
70
 
71
71
  ```sh
72
- appsemble serve <path-to-app-directory> --team-role Manager
72
+ appsemble serve <path-to-app-directory> --group-role Manager
73
73
  ```
74
74
 
75
75
  App data is stored within a `db.json` file in your machine’s cache directory. Each app has their own
@@ -250,13 +250,13 @@ npm install webpack@webpack-4 @appsemble/webpack-config
250
250
  For a more in-depth explanation of how to build apps, use our
251
251
  [block development guide](https://appsemble.app/docs/02-development/developing-blocks).
252
252
 
253
- ### Teams
253
+ ### Groups
254
254
 
255
- The Appsemble CLI can be used to manage teams for apps. For example, the following command creates a
256
- new team named `My Team`:
255
+ The Appsemble CLI can be used to manage groups for apps. For example, the following command creates
256
+ a new group named `My Group`:
257
257
 
258
258
  ```sh
259
- appsemble team create 'My Team' --app-id 1 --context development
259
+ appsemble group create 'My Group' --app-id 1 --context development
260
260
  ```
261
261
 
262
262
  ### Assets
@@ -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.29.10/LICENSE.md) ©
326
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.30.1/LICENSE.md) ©
327
327
  [Appsemble](https://appsemble.com)
@@ -11,7 +11,7 @@ interface AppArgs {
11
11
  resource?: string;
12
12
  security?: boolean;
13
13
  cronJobs?: boolean;
14
- teams?: boolean;
14
+ groups?: boolean;
15
15
  }
16
16
  export declare function builder(yargs: Argv): Promise<Argv<any>>;
17
17
  export declare function handler(args: AppArgs): Promise<void>;
@@ -89,8 +89,8 @@ export async function handler(args) {
89
89
  default: false,
90
90
  },
91
91
  {
92
- name: 'teams',
93
- message: 'Will you be using teams in your app.',
92
+ name: 'groups',
93
+ message: 'Will you be using groups in your app.',
94
94
  type: 'confirm',
95
95
  default: false,
96
96
  when: (appOptions) => appOptions.security,
@@ -115,7 +115,7 @@ export async function handler(args) {
115
115
  const resource = answers.resource || args.resource;
116
116
  const security = answers.security || args.security;
117
117
  const cronJobs = answers['cron-jobs'] || args.cronJobs;
118
- const { teams } = answers;
118
+ const { groups } = answers;
119
119
  const outputDirectory = join(path, name);
120
120
  const inputDirectory = join(`${templatesDir}/`, template);
121
121
  const appsembleRcPath = join(inputDirectory, '.appsemblerc.yaml');
@@ -153,10 +153,10 @@ export async function handler(args) {
153
153
  description: 'A sample user to be included in the app definition',
154
154
  },
155
155
  },
156
- teams: teams
156
+ groups: groups
157
157
  ? {
158
158
  join: 'invite',
159
- invite: ['$team:member'],
159
+ invite: ['$group:member'],
160
160
  }
161
161
  : undefined,
162
162
  });
@@ -1,6 +1,6 @@
1
1
  import { type Argv } from 'yargs';
2
2
  import { type BaseArguments } from '../../types.js';
3
- interface CreateTeamArguments extends BaseArguments {
3
+ interface CreateGroupArguments extends BaseArguments {
4
4
  appId: number;
5
5
  name: string;
6
6
  context: string;
@@ -8,7 +8,7 @@ interface CreateTeamArguments extends BaseArguments {
8
8
  annotation: string[];
9
9
  }
10
10
  export declare const command = "create <name>";
11
- export declare const description = "Create a new team for an app.";
11
+ export declare const description = "Create a new group for an app.";
12
12
  export declare function builder(yargs: Argv): Argv<any>;
13
- export declare function handler({ annotation, app, appId, clientCredentials, context, name, remote, }: CreateTeamArguments): Promise<void>;
13
+ export declare function handler({ annotation, app, appId, clientCredentials, context, name, remote, }: CreateGroupArguments): Promise<void>;
14
14
  export {};
@@ -1,11 +1,11 @@
1
1
  import { resolveAppIdAndRemote } from '../../lib/app.js';
2
- import { createTeam } from '../../lib/team.js';
2
+ import { createGroup } from '../../lib/group.js';
3
3
  export const command = 'create <name>';
4
- export const description = 'Create a new team for an app.';
4
+ export const description = 'Create a new group for an app.';
5
5
  export function builder(yargs) {
6
6
  return yargs
7
7
  .positional('name', {
8
- describe: 'The name of the team.',
8
+ describe: 'The name of the group.',
9
9
  demandOption: true,
10
10
  })
11
11
  .option('annotation', {
@@ -13,7 +13,7 @@ export function builder(yargs) {
13
13
  describe: 'The new list of annotations. The format is key=value.',
14
14
  })
15
15
  .option('app-id', {
16
- describe: 'The ID of the app to create the team for.',
16
+ describe: 'The ID of the app to create the group for.',
17
17
  type: 'number',
18
18
  })
19
19
  .option('app', {
@@ -27,7 +27,7 @@ export function builder(yargs) {
27
27
  }
28
28
  export async function handler({ annotation, app, appId, clientCredentials, context, name, remote, }) {
29
29
  const [resolvedAppId, resolvedRemote] = await resolveAppIdAndRemote(app, context, remote, appId);
30
- await createTeam({
30
+ await createGroup({
31
31
  name,
32
32
  appId: resolvedAppId,
33
33
  annotations: annotation,
@@ -1,13 +1,13 @@
1
1
  import { type Argv } from 'yargs';
2
2
  import { type BaseArguments } from '../../types.js';
3
- interface DeleteTeamArguments extends BaseArguments {
3
+ interface DeleteGroupArguments extends BaseArguments {
4
4
  appId: number;
5
5
  id: number;
6
6
  context: string;
7
7
  app: string;
8
8
  }
9
9
  export declare const command = "delete";
10
- export declare const description = "Delete an existing team from an app.";
10
+ export declare const description = "Delete an existing group from an app.";
11
11
  export declare function builder(yargs: Argv): Argv<any>;
12
- export declare function handler({ app, appId, clientCredentials, context, id, remote, }: DeleteTeamArguments): Promise<void>;
12
+ export declare function handler({ app, appId, clientCredentials, context, id, remote, }: DeleteGroupArguments): Promise<void>;
13
13
  export {};
@@ -1,15 +1,15 @@
1
1
  import { resolveAppIdAndRemote } from '../../lib/app.js';
2
- import { deleteTeam } from '../../lib/team.js';
2
+ import { deleteGroup } from '../../lib/group.js';
3
3
  export const command = 'delete';
4
- export const description = 'Delete an existing team from an app.';
4
+ export const description = 'Delete an existing group from an app.';
5
5
  export function builder(yargs) {
6
6
  return yargs
7
7
  .option('id', {
8
- describe: 'The ID of the team to delete.',
8
+ describe: 'The ID of the group to delete.',
9
9
  demandOption: true,
10
10
  })
11
11
  .option('app-id', {
12
- describe: 'The ID of the app to delete the team from.',
12
+ describe: 'The ID of the app to delete the group from.',
13
13
  type: 'number',
14
14
  })
15
15
  .option('app', {
@@ -23,7 +23,7 @@ export function builder(yargs) {
23
23
  }
24
24
  export async function handler({ app, appId, clientCredentials, context, id, remote, }) {
25
25
  const [resolvedAppId, resolvedRemote] = await resolveAppIdAndRemote(app, context, remote, appId);
26
- await deleteTeam({
26
+ await deleteGroup({
27
27
  id,
28
28
  appId: resolvedAppId,
29
29
  remote: resolvedRemote,
@@ -1,5 +1,5 @@
1
1
  import { type Argv } from 'yargs';
2
2
  export { noop as handler } from '@appsemble/utils';
3
- export declare const command = "team";
4
- export declare const description = "Commands related to app teams.";
3
+ export declare const command = "group";
4
+ export declare const description = "Commands related to app groups.";
5
5
  export declare function builder(yargs: Argv): Argv;
@@ -1,14 +1,14 @@
1
1
  import * as create from './create.js';
2
- import * as deleteTeam from './delete.js';
2
+ import * as deleteGroup from './delete.js';
3
3
  import * as member from './member/index.js';
4
4
  import * as update from './update.js';
5
5
  export { noop as handler } from '@appsemble/utils';
6
- export const command = 'team';
7
- export const description = 'Commands related to app teams.';
6
+ export const command = 'group';
7
+ export const description = 'Commands related to app groups.';
8
8
  export function builder(yargs) {
9
9
  return yargs
10
10
  .command(create)
11
- .command(deleteTeam)
11
+ .command(deleteGroup)
12
12
  .command(member)
13
13
  .command(update)
14
14
  .demandCommand(1);
@@ -1,6 +1,6 @@
1
1
  import { type Argv } from 'yargs';
2
2
  import { type BaseArguments } from '../../../types.js';
3
- interface DeleteTeamArguments extends BaseArguments {
3
+ interface DeleteGroupArguments extends BaseArguments {
4
4
  appId: number;
5
5
  id: number;
6
6
  user: string;
@@ -8,7 +8,7 @@ interface DeleteTeamArguments extends BaseArguments {
8
8
  app: string;
9
9
  }
10
10
  export declare const command = "delete <user>";
11
- export declare const description = "Delete a new member to an existing team from an app.";
11
+ export declare const description = "Delete a new member to an existing group from an app.";
12
12
  export declare function builder(yargs: Argv): Argv<any>;
13
- export declare function handler({ app, appId, clientCredentials, context, id, remote, user, }: DeleteTeamArguments): Promise<void>;
13
+ export declare function handler({ app, appId, clientCredentials, context, id, remote, user, }: DeleteGroupArguments): Promise<void>;
14
14
  export {};
@@ -1,16 +1,16 @@
1
1
  import { authenticate } from '@appsemble/node-utils';
2
2
  import { resolveAppIdAndRemote } from '../../../lib/app.js';
3
- import { deleteMember } from '../../../lib/team.js';
3
+ import { deleteMember } from '../../../lib/group.js';
4
4
  export const command = 'delete <user>';
5
- export const description = 'Delete a new member to an existing team from an app.';
5
+ export const description = 'Delete a new member to an existing group from an app.';
6
6
  export function builder(yargs) {
7
7
  return yargs
8
8
  .option('id', {
9
- describe: 'The ID of the team.',
9
+ describe: 'The ID of the group.',
10
10
  demandOption: true,
11
11
  })
12
12
  .option('app-id', {
13
- describe: 'The ID of the app of the team',
13
+ describe: 'The ID of the app of the group',
14
14
  type: 'number',
15
15
  })
16
16
  .positional('user', {
@@ -28,7 +28,7 @@ export function builder(yargs) {
28
28
  }
29
29
  export async function handler({ app, appId, clientCredentials, context, id, remote, user, }) {
30
30
  const [resolvedAppId, resolvedRemote] = await resolveAppIdAndRemote(app, context, remote, appId);
31
- await authenticate(resolvedRemote, 'teams:write', clientCredentials);
31
+ await authenticate(resolvedRemote, 'groups:write', clientCredentials);
32
32
  await deleteMember({
33
33
  id,
34
34
  appId: resolvedAppId,
@@ -1,5 +1,5 @@
1
1
  import { type Argv } from 'yargs';
2
2
  export { noop as handler } from '@appsemble/utils';
3
3
  export declare const command = "member";
4
- export declare const description = "Commands related to app team members.";
4
+ export declare const description = "Commands related to app group members.";
5
5
  export declare function builder(yargs: Argv): Argv;
@@ -1,14 +1,12 @@
1
1
  import * as deleteMember from './delete.js';
2
2
  import * as invite from './invite.js';
3
- import * as update from './update.js';
4
3
  export { noop as handler } from '@appsemble/utils';
5
4
  export const command = 'member';
6
- export const description = 'Commands related to app team members.';
5
+ export const description = 'Commands related to app group members.';
7
6
  export function builder(yargs) {
8
7
  return yargs
9
8
  .command(deleteMember)
10
9
  .command(invite)
11
- .command(update)
12
10
  .demandCommand(1);
13
11
  }
14
12
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import { type Argv } from 'yargs';
2
2
  import { type BaseArguments } from '../../../types.js';
3
- interface InviteTeamArguments extends BaseArguments {
3
+ interface InviteGroupArguments extends BaseArguments {
4
4
  appId: number;
5
5
  id: number;
6
6
  user: string;
@@ -8,7 +8,7 @@ interface InviteTeamArguments extends BaseArguments {
8
8
  app: string;
9
9
  }
10
10
  export declare const command = "invite <user>";
11
- export declare const description = "Invite a new member to an existing team from an app.";
11
+ export declare const description = "Invite a new member to an existing group from an app.";
12
12
  export declare function builder(yargs: Argv): Argv<any>;
13
- export declare function handler({ app, appId, clientCredentials, context, id, remote, user, }: InviteTeamArguments): Promise<void>;
13
+ export declare function handler({ app, appId, clientCredentials, context, id, remote, user, }: InviteGroupArguments): Promise<void>;
14
14
  export {};
@@ -1,16 +1,16 @@
1
1
  import { authenticate } from '@appsemble/node-utils';
2
2
  import { resolveAppIdAndRemote } from '../../../lib/app.js';
3
- import { inviteMember } from '../../../lib/team.js';
3
+ import { inviteMember } from '../../../lib/group.js';
4
4
  export const command = 'invite <user>';
5
- export const description = 'Invite a new member to an existing team from an app.';
5
+ export const description = 'Invite a new member to an existing group from an app.';
6
6
  export function builder(yargs) {
7
7
  return yargs
8
8
  .option('id', {
9
- describe: 'The ID of the team.',
9
+ describe: 'The ID of the group.',
10
10
  demandOption: true,
11
11
  })
12
12
  .option('app-id', {
13
- describe: 'The ID of the app of the team',
13
+ describe: 'The ID of the app of the group',
14
14
  type: 'number',
15
15
  })
16
16
  .option('app', {
@@ -28,7 +28,7 @@ export function builder(yargs) {
28
28
  }
29
29
  export async function handler({ app, appId, clientCredentials, context, id, remote, user, }) {
30
30
  const [resolvedAppId, resolvedRemote] = await resolveAppIdAndRemote(app, context, remote, appId);
31
- await authenticate(resolvedRemote, 'teams:write', clientCredentials);
31
+ await authenticate(resolvedRemote, 'groups:write', clientCredentials);
32
32
  await inviteMember({
33
33
  id,
34
34
  appId: resolvedAppId,
@@ -1,6 +1,6 @@
1
1
  import { type Argv } from 'yargs';
2
2
  import { type BaseArguments } from '../../types.js';
3
- interface UpdateTeamArguments extends BaseArguments {
3
+ interface UpdateGroupArguments extends BaseArguments {
4
4
  appId: number;
5
5
  id: number;
6
6
  name: string;
@@ -9,7 +9,7 @@ interface UpdateTeamArguments extends BaseArguments {
9
9
  app: string;
10
10
  }
11
11
  export declare const command = "update";
12
- export declare const description = "Update an existing team for an app.";
12
+ export declare const description = "Update an existing group for an app.";
13
13
  export declare function builder(yargs: Argv): Argv<any>;
14
- export declare function handler({ annotation, app, appId, clientCredentials, context, id, name, remote, }: UpdateTeamArguments): Promise<void>;
14
+ export declare function handler({ annotation, app, appId, clientCredentials, context, id, name, remote, }: UpdateGroupArguments): Promise<void>;
15
15
  export {};
@@ -1,16 +1,16 @@
1
1
  import { authenticate } from '@appsemble/node-utils';
2
2
  import { resolveAppIdAndRemote } from '../../lib/app.js';
3
- import { updateTeam } from '../../lib/team.js';
3
+ import { updateGroup } from '../../lib/group.js';
4
4
  export const command = 'update';
5
- export const description = 'Update an existing team for an app.';
5
+ export const description = 'Update an existing group for an app.';
6
6
  export function builder(yargs) {
7
7
  return yargs
8
8
  .option('id', {
9
- describe: 'The ID of the team to update.',
9
+ describe: 'The ID of the group to update.',
10
10
  demandOption: true,
11
11
  })
12
12
  .option('name', {
13
- describe: 'The new name of the team.',
13
+ describe: 'The new name of the group.',
14
14
  })
15
15
  .option('annotation', {
16
16
  type: 'array',
@@ -25,15 +25,15 @@ export function builder(yargs) {
25
25
  implies: 'app',
26
26
  })
27
27
  .option('app-id', {
28
- describe: 'The ID of the app to delete the team from.',
28
+ describe: 'The ID of the app to delete the group from.',
29
29
  type: 'number',
30
30
  demandOption: true,
31
31
  });
32
32
  }
33
33
  export async function handler({ annotation, app, appId, clientCredentials, context, id, name, remote, }) {
34
34
  const [resolvedAppId, resolvedRemote] = await resolveAppIdAndRemote(app, context, remote, appId);
35
- await authenticate(resolvedRemote, 'teams:write', clientCredentials);
36
- await updateTeam({
35
+ await authenticate(resolvedRemote, 'groups:write', clientCredentials);
36
+ await updateGroup({
37
37
  id,
38
38
  appId: resolvedAppId,
39
39
  name,
@@ -0,0 +1,13 @@
1
+ import { type Argv } from 'yargs';
2
+ import { type BaseArguments } from '../types.js';
3
+ export declare const command = "migrate-app-definitions";
4
+ export declare const description = "Migrate all app definitions in the Appsemble database.";
5
+ interface AdditionalArguments {
6
+ validate?: boolean;
7
+ save?: boolean;
8
+ path?: string;
9
+ batch?: number;
10
+ }
11
+ export declare function builder(yargs: Argv): Argv<any>;
12
+ export declare function handler({ batch, path, save, validate, ...argv }: AdditionalArguments & BaseArguments): Promise<void>;
13
+ export {};
@@ -0,0 +1,73 @@
1
+ import { opendirSafe } from '@appsemble/node-utils';
2
+ import fg from 'fast-glob';
3
+ import normalizePath from 'normalize-path';
4
+ import { serverImport } from '../lib/serverImport.js';
5
+ export const command = 'migrate-app-definitions';
6
+ export const description = 'Migrate all app definitions in the Appsemble database.';
7
+ export function builder(yargs) {
8
+ return yargs
9
+ .option('database-host', {
10
+ desc: 'The host of the database to connect to. This defaults to the connected database container.',
11
+ })
12
+ .option('database-port', {
13
+ desc: 'The port of the database to connect to.',
14
+ type: 'number',
15
+ default: 5432,
16
+ })
17
+ .option('database-ssl', {
18
+ desc: 'Use SSL to connect to the database.',
19
+ type: 'boolean',
20
+ })
21
+ .option('database-name', {
22
+ desc: 'The name of the database to connect to.',
23
+ implies: ['database-user', 'database-password'],
24
+ })
25
+ .option('database-user', {
26
+ desc: 'The user to use to login to the database.',
27
+ implies: ['database-name', 'database-password'],
28
+ })
29
+ .option('database-password', {
30
+ desc: 'The password to use to login to the database.',
31
+ implies: ['database-name', 'database-user'],
32
+ })
33
+ .option('database-url', {
34
+ desc: 'A connection string for the database to connect to. This is an alternative to the separate database related variables.',
35
+ conflicts: ['database-host', 'database-name', 'database-user', 'database-password'],
36
+ })
37
+ .option('path', {
38
+ describe: 'The path to the local apps directory.',
39
+ })
40
+ .option('validate', {
41
+ desc: 'Whether to validate the definitions before saving.',
42
+ type: 'boolean',
43
+ default: true,
44
+ })
45
+ .option('save', {
46
+ desc: 'Whether to save the changes.',
47
+ type: 'boolean',
48
+ default: false,
49
+ })
50
+ .option('batch', {
51
+ desc: 'The batch size of apps to patch at once.',
52
+ type: 'number',
53
+ default: 100,
54
+ });
55
+ }
56
+ export async function handler({ batch, path, save, validate, ...argv }) {
57
+ const { migrateAppDefinitions, setArgv } = await serverImport('setArgv', 'migrateAppDefinitions');
58
+ setArgv(argv);
59
+ const paths = [];
60
+ if (path) {
61
+ const normalizedPath = normalizePath(path);
62
+ const directories = await fg(`${normalizedPath}/*`, { absolute: true, onlyDirectories: true });
63
+ for (const dir of directories) {
64
+ await opendirSafe(dir, (filepath, filestat) => {
65
+ if (filestat.isFile() && filestat.name.toLowerCase() === 'app-definition.yaml') {
66
+ paths.push(filepath);
67
+ }
68
+ });
69
+ }
70
+ }
71
+ return migrateAppDefinitions({ save, paths, validate, batch });
72
+ }
73
+ //# sourceMappingURL=migrateAppDefinitions.js.map
@@ -5,7 +5,7 @@ export interface ServeArguments {
5
5
  port: number;
6
6
  'api-port': number;
7
7
  'user-role': string;
8
- 'team-role': string;
8
+ 'group-role': string;
9
9
  'overwrite-block-cache': boolean;
10
10
  }
11
11
  export declare const command = "serve path";
package/commands/serve.js CHANGED
@@ -4,7 +4,7 @@ import http from 'node:http';
4
4
  import { basename, extname, join, parse } from 'node:path';
5
5
  import { Readable } from 'node:stream';
6
6
  import { AppsembleError, logger, opendirSafe, readData, writeData, } from '@appsemble/node-utils';
7
- import { asciiLogo, getAppBlocks, normalize, parseBlockName, } from '@appsemble/utils';
7
+ import { asciiLogo, getAppBlocks, getAppRoles, normalize, parseBlockName, } from '@appsemble/utils';
8
8
  import axios from 'axios';
9
9
  import csvToJson from 'csvtojson';
10
10
  import FormData from 'form-data';
@@ -38,8 +38,8 @@ export function builder(yargs) {
38
38
  desc: 'The role to set to the mocked authenticated user.',
39
39
  type: 'string',
40
40
  })
41
- .option('team-role', {
42
- desc: 'The role to set to the mocked authenticated user in the team.',
41
+ .option('group-role', {
42
+ desc: 'The role to set to the mocked authenticated user in the group.',
43
43
  type: 'string',
44
44
  default: 'member',
45
45
  })
@@ -57,7 +57,7 @@ export async function handler(argv) {
57
57
  setArgv(argv);
58
58
  const appPath = join(process.cwd(), argv.path);
59
59
  const [, , , appsembleApp] = await traverseAppDirectory(appPath, 'development', new FormData());
60
- const appRoles = appsembleApp.definition.roles;
60
+ const appRoles = getAppRoles(appsembleApp.definition.security);
61
61
  const passedUserRole = argv['user-role'];
62
62
  if (passedUserRole && !(appRoles === null || appRoles === void 0 ? void 0 : appRoles.includes(passedUserRole))) {
63
63
  throw appRoles
@@ -67,26 +67,26 @@ export async function handler(argv) {
67
67
  const appSecurity = appsembleApp.definition.security;
68
68
  const appMembers = [
69
69
  {
70
- userId: '1',
71
- memberId: '1',
70
+ sub: '1',
72
71
  name: 'dev',
73
- primaryEmail: 'dev@example.com',
72
+ email: 'dev@example.com',
73
+ email_verified: true,
74
74
  role: passedUserRole || (appSecurity === null || appSecurity === void 0 ? void 0 : appSecurity.default.role),
75
75
  demo: false,
76
+ zoneinfo: '',
76
77
  properties: {},
77
78
  },
78
79
  ];
79
- const allowedTeamRoles = ['manager', 'member'];
80
- const passedTeamRole = argv['team-role'];
81
- if (passedTeamRole && !allowedTeamRoles.includes(passedTeamRole)) {
82
- throw new AppsembleError(`The specified team role ${passedTeamRole} is not supported. Allowed roles are [member,manager]`);
80
+ const allowedGroupRoles = ['manager', 'member'];
81
+ const passedGroupRole = argv['group-role'];
82
+ if (passedGroupRole && !allowedGroupRoles.includes(passedGroupRole)) {
83
+ throw new AppsembleError(`The specified group role ${passedGroupRole} is not supported. Allowed roles are [member,manager]`);
83
84
  }
84
- const appTeams = [
85
+ const appGroups = [
85
86
  {
86
87
  id: 1,
87
- name: 'team',
88
+ name: 'group',
88
89
  size: 1,
89
- role: passedTeamRole,
90
90
  annotations: {},
91
91
  },
92
92
  ];
@@ -244,7 +244,7 @@ export async function handler(argv) {
244
244
  ? {
245
245
  appMembers,
246
246
  appUserInfo,
247
- appTeams,
247
+ appGroups,
248
248
  }
249
249
  : {}),
250
250
  appAssets,
@@ -270,7 +270,7 @@ export async function handler(argv) {
270
270
  ? {
271
271
  appMembers,
272
272
  appUserInfo,
273
- appTeams,
273
+ appGroups,
274
274
  }
275
275
  : {}),
276
276
  appAssets,
package/index.js CHANGED
@@ -12,16 +12,17 @@ import * as cleanupDemoUsers from './commands/cleanupDemoUsers.js';
12
12
  import * as cleanupResourcesAndAssets from './commands/cleanupResourcesAndAssets.js';
13
13
  import * as config from './commands/config/index.js';
14
14
  import * as fuzzMigrations from './commands/fuzzMigrations.js';
15
+ import * as group from './commands/group/index.js';
15
16
  import * as login from './commands/login.js';
16
17
  import * as logout from './commands/logout.js';
17
18
  import * as migrate from './commands/migrate.js';
19
+ import * as migrateAppDefinitions from './commands/migrateAppDefinitions.js';
18
20
  import * as organization from './commands/organization/index.js';
19
21
  import * as resource from './commands/resource/index.js';
20
22
  import * as runCronJobs from './commands/runCronJobs.js';
21
23
  import * as scaleContainers from './commands/scaleContainers.js';
22
24
  import * as serve from './commands/serve.js';
23
25
  import * as start from './commands/start.js';
24
- import * as team from './commands/team/index.js';
25
26
  import { coerceRemote } from './lib/coercers.js';
26
27
  import { initAxios } from './lib/initAxios.js';
27
28
  process.title = 'appsemble';
@@ -60,13 +61,14 @@ let parser = yargs(process.argv.slice(2))
60
61
  .command(login)
61
62
  .command(logout)
62
63
  .command(migrate)
64
+ .command(migrateAppDefinitions)
63
65
  .command(organization)
64
66
  .command(resource)
65
67
  .command(runCronJobs)
66
68
  .command(start)
67
69
  .command(serve)
68
70
  .command(scaleContainers)
69
- .command(team)
71
+ .command(group)
70
72
  .demandCommand(1)
71
73
  // .strict() isn’t used because of https://github.com/yargs/yargs/issues/2058
72
74
  .strictCommands()