@appsemble/cli 0.34.20 → 0.35.3-test.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.34.20/config/assets/logo.svg) Appsemble CLI
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.35.3-test.0/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.34.20/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.34.20)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.35.3-test.0/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.35.3-test.0)
7
7
  [![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)
8
8
 
9
9
  ## Table of Contents
@@ -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.34.20/LICENSE.md) ©
326
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.35.3-test.0/LICENSE.md) ©
327
327
  [Appsemble](https://appsemble.com)
@@ -21,6 +21,11 @@ interface PublishAppArguments extends BaseArguments {
21
21
  sentryDsn: string;
22
22
  sentryEnvironment: string;
23
23
  googleAnalyticsId: string;
24
+ dbName: string;
25
+ dbHost: string;
26
+ dbPort: number;
27
+ dbUser: string;
28
+ dbPassword: string;
24
29
  }
25
30
  export declare const command = "publish <paths...>";
26
31
  export declare const description = "Publish a new App to a remote based on a specified YAML file or directory.";
@@ -80,6 +80,22 @@ export function builder(yargs) {
80
80
  .option('sentry-environment', {
81
81
  describe: 'The environment for the custom Sentry DSN for the app.',
82
82
  implies: ['sentry-dsn'],
83
+ })
84
+ .option('db-name', {
85
+ describe: 'The name of the external app database.',
86
+ })
87
+ .option('db-host', {
88
+ describe: 'The host of the external app database.',
89
+ })
90
+ .option('db-port', {
91
+ describe: 'The port of the external app database.',
92
+ type: 'number',
93
+ })
94
+ .option('db-user', {
95
+ describe: 'The user of the external app database.',
96
+ })
97
+ .option('db-password', {
98
+ describe: 'The password of the external app database.',
83
99
  });
84
100
  }
85
101
  export async function handler({ paths, ...args }) {
@@ -19,6 +19,11 @@ interface UpdateAppArguments extends BaseArguments {
19
19
  sentryDsn: string;
20
20
  sentryEnvironment: string;
21
21
  googleAnalyticsId: string;
22
+ dbName: string;
23
+ dbHost: string;
24
+ dbPort: number;
25
+ dbUser: string;
26
+ dbPassword: string;
22
27
  }
23
28
  export declare const command = "update <paths...>";
24
29
  export declare const description = "Update an app based on a specified YAML file or directory.";
@@ -80,6 +80,22 @@ export function builder(yargs) {
80
80
  .option('sentry-environment', {
81
81
  describe: 'The environment for the custom Sentry DSN for the app.',
82
82
  implies: ['sentry-dsn'],
83
+ })
84
+ .option('db-name', {
85
+ describe: 'The name of the external app database.',
86
+ })
87
+ .option('db-host', {
88
+ describe: 'The host of the external app database.',
89
+ })
90
+ .option('db-port', {
91
+ describe: 'The port of the external app database.',
92
+ type: 'number',
93
+ })
94
+ .option('db-user', {
95
+ describe: 'The user of the external app database.',
96
+ })
97
+ .option('db-password', {
98
+ describe: 'The password of the external app database.',
83
99
  });
84
100
  }
85
101
  export async function handler({ clientCredentials, id, paths, remote, ...args }) {
@@ -0,0 +1,4 @@
1
+ import { type BaseArguments } from '../types.js';
2
+ export declare const command = "charge-organization-subscriptions";
3
+ export declare const description = "Charges organization subscriptions 2 weeks in advance, retries failed payments and send an email notification for upcoming charges.";
4
+ export declare function handler(argv: BaseArguments): Promise<void>;
@@ -0,0 +1,9 @@
1
+ import { serverImport } from '../lib/serverImport.js';
2
+ export const command = 'charge-organization-subscriptions';
3
+ export const description = 'Charges organization subscriptions 2 weeks in advance, retries failed payments and send an email notification for upcoming charges.';
4
+ export async function handler(argv) {
5
+ const { chargeOrganizationSubscriptions, setArgv } = await serverImport('setArgv', 'chargeOrganizationSubscriptions');
6
+ setArgv(argv);
7
+ return chargeOrganizationSubscriptions();
8
+ }
9
+ //# sourceMappingURL=chargeOrganizationSubscriptions.js.map
@@ -14,7 +14,6 @@ export function builder(yargs) {
14
14
  .option('database-port', {
15
15
  desc: 'The port of the database to connect to.',
16
16
  type: 'number',
17
- default: 5432,
18
17
  })
19
18
  .option('database-ssl', {
20
19
  desc: 'Use SSL to connect to the database.',
@@ -1,4 +1,5 @@
1
1
  import { type ReadStream } from 'node:fs';
2
+ import { type PaymentProvider } from '@appsemble/types';
2
3
  import { type Argv } from 'yargs';
3
4
  import { type BaseArguments } from '../../types.js';
4
5
  interface CreateOrganizationArguments extends BaseArguments {
@@ -8,9 +9,17 @@ interface CreateOrganizationArguments extends BaseArguments {
8
9
  name: string;
9
10
  website: string;
10
11
  icon: ReadStream;
12
+ preferredPaymentProvider: PaymentProvider;
13
+ vatIdNumber: string;
14
+ streetName: string;
15
+ houseNumber: string;
16
+ city: string;
17
+ zipCode: string;
18
+ countryCode: string;
19
+ invoiceReference: string;
11
20
  }
12
21
  export declare const command = "create <id>";
13
22
  export declare const description = "Register a new organization. You will be the owner of the new organization.";
14
23
  export declare function builder(yargs: Argv): Argv<any>;
15
- export declare function handler({ clientCredentials, description: desc, email, icon, id, name, remote, website, }: CreateOrganizationArguments): Promise<void>;
24
+ export declare function handler({ city, clientCredentials, countryCode, description: desc, email, houseNumber, icon, id, invoiceReference, name, preferredPaymentProvider, remote, streetName, vatIdNumber, website, zipCode, }: CreateOrganizationArguments): Promise<void>;
16
25
  export {};
@@ -23,17 +23,49 @@ export function builder(yargs) {
23
23
  .option('icon', {
24
24
  describe: 'The file location of the icon representing the organization.',
25
25
  coerce: coerceFile,
26
+ })
27
+ .option('preferredPaymentProvider', {
28
+ describe: 'The preferred payment provider of the organization.',
29
+ })
30
+ .option('vatIdNumber', {
31
+ describe: 'The VAT id number of the organization.',
32
+ })
33
+ .option('streetName', {
34
+ describe: 'Street name of the organization',
35
+ })
36
+ .option('houseNumber', {
37
+ describe: 'House number of the organization',
38
+ })
39
+ .option('city', {
40
+ describe: 'City of the organization',
41
+ })
42
+ .option('zipCode', {
43
+ describe: 'Zip code of the organization',
44
+ })
45
+ .option('countryCode', {
46
+ describe: 'Country code of the country where the organization is located',
47
+ })
48
+ .option('invoiceReference', {
49
+ describe: 'Optional reference the organization can set to appear on the invoice.',
26
50
  });
27
51
  }
28
- export async function handler({ clientCredentials, description: desc, email, icon, id, name, remote, website, }) {
52
+ export async function handler({ city, clientCredentials, countryCode, description: desc, email, houseNumber, icon, id, invoiceReference, name, preferredPaymentProvider, remote, streetName, vatIdNumber, website, zipCode, }) {
29
53
  await authenticate(remote, 'organizations:write', clientCredentials);
30
54
  await createOrganization({
31
55
  description: desc,
32
56
  email,
57
+ invoiceReference,
33
58
  icon,
34
59
  id,
35
60
  name,
61
+ preferredPaymentProvider,
36
62
  website,
63
+ streetName,
64
+ houseNumber,
65
+ city,
66
+ zipCode,
67
+ countryCode,
68
+ vatIdNumber,
37
69
  });
38
70
  }
39
71
  //# sourceMappingURL=create.js.map
@@ -1,4 +1,5 @@
1
1
  import { type ReadStream } from 'node:fs';
2
+ import { type PaymentProvider } from '@appsemble/types';
2
3
  import { type Argv } from 'yargs';
3
4
  import { type BaseArguments } from '../../types.js';
4
5
  interface UpdateOrganizationArguments extends BaseArguments {
@@ -8,9 +9,17 @@ interface UpdateOrganizationArguments extends BaseArguments {
8
9
  icon: ReadStream;
9
10
  name: string;
10
11
  website: string;
12
+ preferredPaymentProvider: PaymentProvider;
13
+ vatIdNumber: string;
14
+ streetName: string;
15
+ houseNumber: string;
16
+ city: string;
17
+ zipCode: string;
18
+ countryCode: string;
19
+ invoiceReference: string;
11
20
  }
12
21
  export declare const command = "update <id>";
13
22
  export declare const description = "Update an existing organization. You must be an owner of the organization.";
14
23
  export declare function builder(yargs: Argv): Argv<any>;
15
- export declare function handler({ clientCredentials, description: desc, email, icon, id, name, remote, website, }: UpdateOrganizationArguments): Promise<void>;
24
+ export declare function handler({ city, clientCredentials, countryCode, description: desc, email, houseNumber, icon, id, invoiceReference, name, preferredPaymentProvider, remote, streetName, vatIdNumber, website, zipCode, }: UpdateOrganizationArguments): Promise<void>;
16
25
  export {};
@@ -23,17 +23,49 @@ export function builder(yargs) {
23
23
  .option('icon', {
24
24
  describe: 'The file location of the icon representing the organization.',
25
25
  coerce: coerceFile,
26
+ })
27
+ .option('preferredPaymentProvider', {
28
+ describe: 'The preferred payment provider of the organization.',
29
+ })
30
+ .option('vatIdNumber', {
31
+ describe: 'The VAT id number of the organization.',
32
+ })
33
+ .option('streetName', {
34
+ describe: 'Street name of the organization',
35
+ })
36
+ .option('houseNumber', {
37
+ describe: 'House number of the organization',
38
+ })
39
+ .option('city', {
40
+ describe: 'City of the organization',
41
+ })
42
+ .option('zipCode', {
43
+ describe: 'Zip code of the organization',
44
+ })
45
+ .option('countryCode', {
46
+ describe: 'Country code of the country where the organization is located',
47
+ })
48
+ .option('invoiceReference', {
49
+ describe: 'Optional reference the organization can set to appear on the invoice.',
26
50
  });
27
51
  }
28
- export async function handler({ clientCredentials, description: desc, email, icon, id, name, remote, website, }) {
52
+ export async function handler({ city, clientCredentials, countryCode, description: desc, email, houseNumber, icon, id, invoiceReference, name, preferredPaymentProvider, remote, streetName, vatIdNumber, website, zipCode, }) {
29
53
  await authenticate(remote, 'organizations:write', clientCredentials);
30
54
  await updateOrganization({
31
55
  description: desc,
32
56
  email,
57
+ invoiceReference,
33
58
  icon,
34
59
  id,
35
60
  name,
61
+ preferredPaymentProvider,
36
62
  website,
63
+ streetName,
64
+ houseNumber,
65
+ city,
66
+ zipCode,
67
+ countryCode,
68
+ vatIdNumber,
37
69
  });
38
70
  }
39
71
  //# sourceMappingURL=update.js.map
@@ -1,4 +1,5 @@
1
1
  import { type ReadStream } from 'node:fs';
2
+ import { type PaymentProvider } from '@appsemble/types';
2
3
  import { type Argv } from 'yargs';
3
4
  import { type BaseArguments } from '../../types.js';
4
5
  interface UpsertOrganizationArguments extends BaseArguments {
@@ -8,9 +9,17 @@ interface UpsertOrganizationArguments extends BaseArguments {
8
9
  name: string;
9
10
  website: string;
10
11
  icon: ReadStream;
12
+ preferredPaymentProvider: PaymentProvider;
13
+ vatIdNumber: string;
14
+ streetName: string;
15
+ houseNumber: string;
16
+ city: string;
17
+ zipCode: string;
18
+ countryCode: string;
19
+ invoiceReference: string;
11
20
  }
12
21
  export declare const command = "upsert <id>";
13
22
  export declare const description = "Create a new organization for the given id or update if there exists one already.";
14
23
  export declare function builder(yargs: Argv): Argv<any>;
15
- export declare function handler({ clientCredentials, description: desc, email, icon, id, name, remote, website, }: UpsertOrganizationArguments): Promise<void>;
24
+ export declare function handler({ city, clientCredentials, countryCode, description: desc, email, houseNumber, icon, id, invoiceReference, name, preferredPaymentProvider, remote, streetName, vatIdNumber, website, zipCode, }: UpsertOrganizationArguments): Promise<void>;
16
25
  export {};
@@ -23,17 +23,49 @@ export function builder(yargs) {
23
23
  .option('icon', {
24
24
  describe: 'The file location of the icon representing the organization.',
25
25
  coerce: coerceFile,
26
+ })
27
+ .option('preferredPaymentProvider', {
28
+ describe: 'The preferred payment provider of the organization.',
29
+ })
30
+ .option('vatIdNumber', {
31
+ describe: 'The VAT id number of the organization.',
32
+ })
33
+ .option('streetName', {
34
+ describe: 'Street name of the organization',
35
+ })
36
+ .option('houseNumber', {
37
+ describe: 'House number of the organization',
38
+ })
39
+ .option('city', {
40
+ describe: 'City of the organization',
41
+ })
42
+ .option('zipCode', {
43
+ describe: 'Zip code of the organization',
44
+ })
45
+ .option('countryCode', {
46
+ describe: 'Country code of the country where the organization is located',
47
+ })
48
+ .option('invoiceReference', {
49
+ describe: 'Optional reference the organization can set to appear on the invoice.',
26
50
  });
27
51
  }
28
- export async function handler({ clientCredentials, description: desc, email, icon, id, name, remote, website, }) {
52
+ export async function handler({ city, clientCredentials, countryCode, description: desc, email, houseNumber, icon, id, invoiceReference, name, preferredPaymentProvider, remote, streetName, vatIdNumber, website, zipCode, }) {
29
53
  await authenticate(remote, 'organizations:write', clientCredentials);
30
54
  await upsertOrganization({
31
55
  description: desc,
32
56
  email,
57
+ invoiceReference,
33
58
  icon,
34
59
  id,
35
60
  name,
61
+ preferredPaymentProvider,
36
62
  website,
63
+ streetName,
64
+ houseNumber,
65
+ city,
66
+ zipCode,
67
+ countryCode,
68
+ vatIdNumber,
37
69
  });
38
70
  }
39
71
  //# sourceMappingURL=upsert.js.map
package/index.js CHANGED
@@ -6,8 +6,9 @@ import yargs from 'yargs';
6
6
  import * as app from './commands/app/index.js';
7
7
  import * as asset from './commands/asset/index.js';
8
8
  import * as block from './commands/block/index.js';
9
+ import * as chargeOrganizationSubscriptions from './commands/chargeOrganizationSubscriptions.js';
9
10
  import * as checkDownMigrations from './commands/checkDownMigrations.js';
10
- import * as checkMigrations from './commands/checkMigrations.js';
11
+ import * as checkAppMigrations from './commands/checkMigrations.js';
11
12
  import * as cleanupDemoAppMembers from './commands/cleanupDemoAppMembers.js';
12
13
  import * as cleanupResourcesAndAssets from './commands/cleanupResourcesAndAssets.js';
13
14
  import * as cleanupSoftDeletedRecords from './commands/cleanupSoftDeletedRecords.js';
@@ -58,7 +59,7 @@ let parser = yargs(process.argv.slice(2))
58
59
  .command(cleanupResourcesAndAssets)
59
60
  .command(cleanupDemoAppMembers)
60
61
  .command(cleanupSoftDeletedRecords)
61
- .command(checkMigrations)
62
+ .command(checkAppMigrations)
62
63
  .command(checkDownMigrations)
63
64
  .command(fuzzMigrations)
64
65
  .command(config)
@@ -73,6 +74,7 @@ let parser = yargs(process.argv.slice(2))
73
74
  .command(synchronizeTrainings)
74
75
  .command(serve)
75
76
  .command(scaleContainers)
77
+ .command(chargeOrganizationSubscriptions)
76
78
  .command(group)
77
79
  .demandCommand(1)
78
80
  // .strict() isn’t used because of https://github.com/yargs/yargs/issues/2058
package/lib/app.d.ts CHANGED
@@ -145,6 +145,26 @@ interface PublishAppParams {
145
145
  * The environment for the custom Sentry DSN for the app.
146
146
  */
147
147
  sentryEnvironment?: string;
148
+ /**
149
+ * The name of the external app database.
150
+ */
151
+ dbName?: string;
152
+ /**
153
+ * The host of the external app database.
154
+ */
155
+ dbHost?: string;
156
+ /**
157
+ * The port of the external app database.
158
+ */
159
+ dbPort?: number;
160
+ /**
161
+ * The user of the external app database.
162
+ */
163
+ dbUser?: string;
164
+ /**
165
+ * The password of the external app database.
166
+ */
167
+ dbPassword?: string;
148
168
  }
149
169
  /**
150
170
  * Publish a new app.
@@ -233,6 +253,26 @@ interface UpdateAppParams {
233
253
  * The environment for the custom Sentry DSN for the app.
234
254
  */
235
255
  sentryEnvironment?: string;
256
+ /**
257
+ * The name of the external app database.
258
+ */
259
+ dbName?: string;
260
+ /**
261
+ * The host of the external app database.
262
+ */
263
+ dbHost?: string;
264
+ /**
265
+ * The port of the external app database.
266
+ */
267
+ dbPort?: number;
268
+ /**
269
+ * The user of the external app database.
270
+ */
271
+ dbUser?: string;
272
+ /**
273
+ * The password of the external app database.
274
+ */
275
+ dbPassword?: string;
236
276
  }
237
277
  /**
238
278
  * Update an existing app.
package/lib/app.js CHANGED
@@ -808,6 +808,11 @@ export async function publishApp({ clientCredentials, context, dryRun, modifyCon
808
808
  const resources = appsembleContext.resources ?? options.resources;
809
809
  const members = appsembleContext.members ?? options.members;
810
810
  const appLock = appsembleContext.appLock || 'unlocked';
811
+ const dbName = appsembleContext.dbName ?? options.dbName;
812
+ const dbHost = appsembleContext.dbHost ?? options.dbHost;
813
+ const dbPort = appsembleContext.dbPort ?? options.dbPort;
814
+ const dbUser = appsembleContext.dbUser ?? options.dbUser;
815
+ const { dbPassword } = options;
811
816
  logger.verbose(`App remote: ${remote}`);
812
817
  logger.verbose(`App organization: ${organizationId}`);
813
818
  logger.verbose(`App is template: ${inspect(template, { colors: true })}`);
@@ -822,6 +827,21 @@ export async function publishApp({ clientCredentials, context, dryRun, modifyCon
822
827
  formData.append('visibility', visibility);
823
828
  formData.append('iconBackground', iconBackground);
824
829
  formData.append('locked', appLock);
830
+ if (dbName) {
831
+ formData.append('dbName', dbName);
832
+ }
833
+ if (dbHost) {
834
+ formData.append('dbHost', dbHost);
835
+ }
836
+ if (dbPort) {
837
+ formData.append('dbPort', dbPort);
838
+ }
839
+ if (dbUser) {
840
+ formData.append('dbUser', dbUser);
841
+ }
842
+ if (dbPassword) {
843
+ formData.append('dbPassword', dbPassword);
844
+ }
825
845
  if (icon) {
826
846
  const realIcon = typeof icon === 'string' ? createReadStream(icon) : icon;
827
847
  logger.info(`Using icon from ${realIcon.path ?? 'stdin'}`);
@@ -986,6 +1006,11 @@ export async function updateApp({ clientCredentials, context, force, path, ...op
986
1006
  const members = appsembleContext.members ?? options.members;
987
1007
  const assets = appsembleContext.assets ?? options.assets;
988
1008
  const { appLock } = appsembleContext;
1009
+ const dbName = appsembleContext.dbName ?? options.dbName;
1010
+ const dbHost = appsembleContext.dbHost ?? options.dbHost;
1011
+ const dbPort = appsembleContext.dbPort ?? options.dbPort;
1012
+ const dbUser = appsembleContext.dbUser ?? options.dbUser;
1013
+ const { dbPassword } = options;
989
1014
  logger.info(`App id: ${id}`);
990
1015
  logger.verbose(`App remote: ${remote}`);
991
1016
  logger.verbose(`App is template: ${inspect(template, { colors: true })}`);
@@ -1000,6 +1025,21 @@ export async function updateApp({ clientCredentials, context, force, path, ...op
1000
1025
  formData.append('demoMode', String(demoMode));
1001
1026
  formData.append('visibility', visibility);
1002
1027
  formData.append('iconBackground', iconBackground);
1028
+ if (dbName) {
1029
+ formData.append('dbName', dbName);
1030
+ }
1031
+ if (dbHost) {
1032
+ formData.append('dbHost', dbHost);
1033
+ }
1034
+ if (dbPort) {
1035
+ formData.append('dbPort', dbPort);
1036
+ }
1037
+ if (dbUser) {
1038
+ formData.append('dbUser', dbUser);
1039
+ }
1040
+ if (dbPassword) {
1041
+ formData.append('dbPassword', dbPassword);
1042
+ }
1003
1043
  if (icon) {
1004
1044
  const realIcon = typeof icon === 'string' ? createReadStream(icon) : icon;
1005
1045
  logger.info(`Using icon from ${realIcon.path ?? 'stdin'}`);
package/lib/group.d.ts CHANGED
@@ -59,9 +59,9 @@ interface CreateGroupParams extends SharedGroupParams {
59
59
  }
60
60
  export declare function resolveAnnotations(annotations: string[]): Record<string, string> | undefined;
61
61
  export declare function createGroup({ annotations, appId, clientCredentials, name, remote, }: CreateGroupParams): Promise<void>;
62
- export declare function deleteGroup({ clientCredentials, id, remote, }: SharedExistingGroupParams): Promise<void>;
63
- export declare function updateGroup({ annotations, id, name, remote, }: UpdateGroupParams): Promise<void>;
64
- export declare function inviteMember({ id, remote, role, user, }: InviteGroupMemberParams): Promise<void>;
65
- export declare function updateMember({ id, remote, role, user, }: UpdateGroupMemberParams): Promise<void>;
66
- export declare function deleteMember({ id, user }: SharedGroupMemberParams): Promise<void>;
62
+ export declare function deleteGroup({ appId, clientCredentials, id, remote, }: SharedExistingGroupParams): Promise<void>;
63
+ export declare function updateGroup({ annotations, appId, id, name, remote, }: UpdateGroupParams): Promise<void>;
64
+ export declare function inviteMember({ appId, id, remote, role, user, }: InviteGroupMemberParams): Promise<void>;
65
+ export declare function updateMember({ appId, id, remote, role, user, }: UpdateGroupMemberParams): Promise<void>;
66
+ export declare function deleteMember({ appId, id, user }: SharedGroupMemberParams): Promise<void>;
67
67
  export {};
package/lib/group.js CHANGED
@@ -22,35 +22,35 @@ export async function createGroup({ annotations = [], appId, clientCredentials,
22
22
  }, { baseURL: remote });
23
23
  logger.info(`Successfully created group ${name} with ID ${id}`);
24
24
  }
25
- export async function deleteGroup({ clientCredentials, id, remote, }) {
25
+ export async function deleteGroup({ appId, clientCredentials, id, remote, }) {
26
26
  await authenticate(remote, 'groups:write', clientCredentials);
27
27
  logger.info(`Deleting group ${id}`);
28
- await axios.delete(`/api/groups/${id}`, { baseURL: remote });
28
+ await axios.delete(`/api/apps/${appId}/groups/${id}`, { baseURL: remote });
29
29
  logger.info(`Successfully deleted group ${id}`);
30
30
  }
31
- export async function updateGroup({ annotations = [], id, name, remote, }) {
31
+ export async function updateGroup({ annotations = [], appId, id, name, remote, }) {
32
32
  logger.info(`Updating group ${id}`);
33
- await axios.patch(`/api/groups/${id}`, {
33
+ await axios.patch(`/api/apps/${appId}/groups/${id}`, {
34
34
  name,
35
35
  annotations: resolveAnnotations(annotations),
36
36
  }, { baseURL: remote });
37
37
  logger.info(`Successfully updated group ${id}`);
38
38
  }
39
- export async function inviteMember({ id, remote, role, user, }) {
39
+ export async function inviteMember({ appId, id, remote, role, user, }) {
40
40
  logger.info(`Inviting ${user} to group ${id}`);
41
- await axios.post(`/api/groups/${id}/invites`, [{ email: user, role }], {
41
+ await axios.post(`/api/apps/${appId}/groups/${id}/invites`, [{ email: user, role }], {
42
42
  baseURL: remote,
43
43
  });
44
44
  logger.info(`Successfully invited ${user} to group ${id}`);
45
45
  }
46
- export async function updateMember({ id, remote, role, user, }) {
46
+ export async function updateMember({ appId, id, remote, role, user, }) {
47
47
  logger.info(`Updating ${user}’s role in group ${id} to ${role}`);
48
- await axios.put(`/api/group-members/${user}/role`, { role }, { baseURL: remote });
48
+ await axios.put(`/api/apps/${appId}/group-members/${user}/role`, { role }, { baseURL: remote });
49
49
  logger.info(`Successfully updated ${user} in group ${id}`);
50
50
  }
51
- export async function deleteMember({ id, user }) {
51
+ export async function deleteMember({ appId, id, user }) {
52
52
  logger.info(`Deleting ${user} to group ${id}`);
53
- await axios.delete(`/api/group-members/${user}?selectedGroupId=${id}`);
53
+ await axios.delete(`/api/apps/${appId}/group-members/${user}?selectedGroupId=${id}`);
54
54
  logger.info(`Successfully deleted ${user} from group ${id}`);
55
55
  }
56
56
  //# sourceMappingURL=group.js.map
@@ -1,4 +1,5 @@
1
1
  import { type ReadStream } from 'node:fs';
2
+ import { type PaymentProvider } from '@appsemble/types';
2
3
  interface OrganizationArguments {
3
4
  description: string;
4
5
  email: string;
@@ -6,8 +7,16 @@ interface OrganizationArguments {
6
7
  icon: ReadStream;
7
8
  name: string;
8
9
  website: string;
10
+ preferredPaymentProvider: PaymentProvider;
11
+ vatIdNumber: string | null;
12
+ streetName: string | null;
13
+ houseNumber: string | null;
14
+ city: string | null;
15
+ zipCode: string | null;
16
+ countryCode: string | null;
17
+ invoiceReference: string | null;
9
18
  }
10
- export declare function createOrganization({ description, email, icon, id, name, website, }: OrganizationArguments): Promise<void>;
11
- export declare function updateOrganization({ description, email, icon, id, name, website, }: OrganizationArguments): Promise<void>;
12
- export declare function upsertOrganization({ description, email, icon, id, name, website, }: OrganizationArguments): Promise<void>;
19
+ export declare function createOrganization({ city, countryCode, description, email, houseNumber, icon, id, invoiceReference, name, preferredPaymentProvider, streetName, vatIdNumber, website, zipCode, }: OrganizationArguments): Promise<void>;
20
+ export declare function updateOrganization({ city, countryCode, description, email, houseNumber, icon, id, invoiceReference, name, preferredPaymentProvider, streetName, vatIdNumber, website, zipCode, }: OrganizationArguments): Promise<void>;
21
+ export declare function upsertOrganization({ city, countryCode, description, email, houseNumber, icon, id, invoiceReference, name, preferredPaymentProvider, streetName, vatIdNumber, website, zipCode, }: OrganizationArguments): Promise<void>;
13
22
  export {};
@@ -1,7 +1,7 @@
1
1
  import { logger } from '@appsemble/node-utils';
2
2
  import axios from 'axios';
3
3
  import FormData from 'form-data';
4
- export async function createOrganization({ description, email, icon, id, name, website, }) {
4
+ export async function createOrganization({ city, countryCode, description, email, houseNumber, icon, id, invoiceReference, name, preferredPaymentProvider, streetName, vatIdNumber, website, zipCode, }) {
5
5
  const formData = new FormData();
6
6
  formData.append('id', id);
7
7
  if (description) {
@@ -24,6 +24,38 @@ export async function createOrganization({ description, email, icon, id, name, w
24
24
  logger.info(`Setting website to ${website}`);
25
25
  formData.append('website', website);
26
26
  }
27
+ if (preferredPaymentProvider) {
28
+ logger.info(`Setting preferred payment provider to ${preferredPaymentProvider}`);
29
+ formData.append('preferredPaymentProvider', preferredPaymentProvider);
30
+ }
31
+ if (vatIdNumber) {
32
+ logger.info(`Setting vatIdNumber to ${vatIdNumber}`);
33
+ formData.append('vatIdNumber', vatIdNumber);
34
+ }
35
+ if (streetName) {
36
+ logger.info(`Setting street name to ${streetName}`);
37
+ formData.append('streetName', streetName);
38
+ }
39
+ if (houseNumber) {
40
+ logger.info(`Setting house number to ${houseNumber}`);
41
+ formData.append('houseNumber', houseNumber);
42
+ }
43
+ if (city) {
44
+ logger.info(`Setting city to ${city}`);
45
+ formData.append('city', city);
46
+ }
47
+ if (zipCode) {
48
+ logger.info(`Setting zip code to ${zipCode}`);
49
+ formData.append('zipCode', zipCode);
50
+ }
51
+ if (countryCode) {
52
+ logger.info(`Setting country code to ${countryCode}`);
53
+ formData.append('countryCode', countryCode);
54
+ }
55
+ if (invoiceReference) {
56
+ logger.info(`Setting invoice reference name to ${invoiceReference}`);
57
+ formData.append('invoiceReference', invoiceReference);
58
+ }
27
59
  logger.info(`Creating organization ${id}${name ? ` (${name})` : ''}`);
28
60
  try {
29
61
  await axios.post('/api/organizations', formData);
@@ -34,7 +66,7 @@ export async function createOrganization({ description, email, icon, id, name, w
34
66
  throw error;
35
67
  }
36
68
  }
37
- export async function updateOrganization({ description, email, icon, id, name, website, }) {
69
+ export async function updateOrganization({ city, countryCode, description, email, houseNumber, icon, id, invoiceReference, name, preferredPaymentProvider, streetName, vatIdNumber, website, zipCode, }) {
38
70
  logger.info(`Updating organization ${id}${name ? ` (${name})` : ''}`);
39
71
  const formData = new FormData();
40
72
  if (description) {
@@ -57,6 +89,38 @@ export async function updateOrganization({ description, email, icon, id, name, w
57
89
  logger.info(`Setting website to ${website}`);
58
90
  formData.append('website', website);
59
91
  }
92
+ if (preferredPaymentProvider) {
93
+ logger.info(`Setting preferred payment provider to ${preferredPaymentProvider}`);
94
+ formData.append('preferredPaymentProvider', preferredPaymentProvider);
95
+ }
96
+ if (vatIdNumber) {
97
+ logger.info(`Setting vat id number to ${vatIdNumber}`);
98
+ formData.append('vatIdNumber', vatIdNumber);
99
+ }
100
+ if (streetName) {
101
+ logger.info(`Setting street name to ${streetName}`);
102
+ formData.append('streetName', streetName);
103
+ }
104
+ if (houseNumber) {
105
+ logger.info(`Setting house number to ${houseNumber}`);
106
+ formData.append('houseNumber', houseNumber);
107
+ }
108
+ if (city) {
109
+ logger.info(`Setting city to ${city}`);
110
+ formData.append('city', city);
111
+ }
112
+ if (zipCode) {
113
+ logger.info(`Setting zip code to ${zipCode}`);
114
+ formData.append('zipCode', zipCode);
115
+ }
116
+ if (countryCode) {
117
+ logger.info(`Setting country code to ${countryCode}`);
118
+ formData.append('countryCode', countryCode);
119
+ }
120
+ if (invoiceReference) {
121
+ logger.info(`Setting invoice reference name to ${invoiceReference}`);
122
+ formData.append('invoiceReference', invoiceReference);
123
+ }
60
124
  try {
61
125
  await axios.patch(`/api/organizations/${id}`, formData);
62
126
  logger.info(`Successfully updated organization ${id}${name ? ` (${name})` : ''}`);
@@ -66,14 +130,44 @@ export async function updateOrganization({ description, email, icon, id, name, w
66
130
  throw error;
67
131
  }
68
132
  }
69
- export async function upsertOrganization({ description, email, icon, id, name, website, }) {
133
+ export async function upsertOrganization({ city, countryCode, description, email, houseNumber, icon, id, invoiceReference, name, preferredPaymentProvider, streetName, vatIdNumber, website, zipCode, }) {
70
134
  try {
71
135
  await axios.get(`/api/organizations/${id}`);
72
- await updateOrganization({ description, email, icon, id, name, website });
136
+ await updateOrganization({
137
+ description,
138
+ email,
139
+ icon,
140
+ id,
141
+ name,
142
+ website,
143
+ preferredPaymentProvider,
144
+ vatIdNumber,
145
+ streetName,
146
+ houseNumber,
147
+ city,
148
+ zipCode,
149
+ countryCode,
150
+ invoiceReference,
151
+ });
73
152
  }
74
153
  catch (error) {
75
154
  if (axios.isAxiosError(error) && error.response?.status === 404) {
76
- await createOrganization({ description, email, icon, id, name, website });
155
+ await createOrganization({
156
+ description,
157
+ email,
158
+ icon,
159
+ id,
160
+ name,
161
+ website,
162
+ preferredPaymentProvider,
163
+ vatIdNumber,
164
+ streetName,
165
+ houseNumber,
166
+ city,
167
+ zipCode,
168
+ countryCode,
169
+ invoiceReference,
170
+ });
77
171
  }
78
172
  else {
79
173
  logger.error(error);
@@ -4,4 +4,4 @@
4
4
  * @param members The names of the exported member to import.
5
5
  * @returns The exported member.
6
6
  */
7
- export declare function serverImport<T extends 'checkDownMigrations' | 'checkMigrations' | 'cleanupDemoAppMembers' | 'cleanupResourcesAndAssets' | 'cleanupSoftDeletedRecords' | 'fuzzMigrations' | 'migrate' | 'migrateAppDefinitions' | 'runCronJobs' | 'scaleContainers' | 'setArgv' | 'start' | 'synchronizeTrainings'>(...members: T[]): Promise<Record<T, any>>;
7
+ export declare function serverImport<T extends 'chargeOrganizationSubscriptions' | 'checkDownMigrations' | 'checkMigrations' | 'cleanupDemoAppMembers' | 'cleanupResourcesAndAssets' | 'cleanupSoftDeletedRecords' | 'fuzzMigrations' | 'migrate' | 'migrateAppDefinitions' | 'runCronJobs' | 'scaleContainers' | 'setArgv' | 'start' | 'synchronizeTrainings'>(...members: T[]): Promise<Record<T, any>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/cli",
3
- "version": "0.34.20",
3
+ "version": "0.35.3-test.0",
4
4
  "description": "The CLI for developing with Appsemble apps and blocks",
5
5
  "keywords": [
6
6
  "app",
@@ -44,10 +44,10 @@
44
44
  "test": "vitest"
45
45
  },
46
46
  "dependencies": {
47
- "@appsemble/node-utils": "0.34.20",
48
- "@appsemble/types": "0.34.20",
49
- "@appsemble/lang-sdk": "0.34.20",
50
- "@appsemble/utils": "0.34.20",
47
+ "@appsemble/node-utils": "0.35.3-test.0",
48
+ "@appsemble/types": "0.35.3-test.0",
49
+ "@appsemble/lang-sdk": "0.35.3-test.0",
50
+ "@appsemble/utils": "0.35.3-test.0",
51
51
  "@fortawesome/fontawesome-common-types": "^6.0.0",
52
52
  "@koa/cors": "^5.0.0",
53
53
  "@odata/parser": "^0.2.0",
@@ -90,8 +90,8 @@
90
90
  "yargs": "^17.0.0"
91
91
  },
92
92
  "devDependencies": {
93
- "@appsemble/types": "0.34.20",
94
- "@appsemble/server": "0.34.20",
93
+ "@appsemble/types": "0.35.3-test.0",
94
+ "@appsemble/server": "0.35.3-test.0",
95
95
  "bcrypt": "5.1.1",
96
96
  "axios-test-instance": "7.0.0",
97
97
  "@types/concat-stream": "2.0.3",
@@ -6,7 +6,7 @@ pages:
6
6
  - name: Example Page A
7
7
  blocks:
8
8
  - type: action-button
9
- version: 0.34.20
9
+ version: 0.35.3-test.0
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.34.20
20
+ version: 0.35.3-test.0
21
21
  parameters:
22
22
  icon: arrow-left
23
23
  actions:
@@ -5,7 +5,7 @@
5
5
  "*.css"
6
6
  ],
7
7
  "dependencies": {
8
- "@appsemble/sdk": "0.34.20",
8
+ "@appsemble/sdk": "0.35.3-test.0",
9
9
  "mini-jsx": "^4.0.0"
10
10
  }
11
11
  }
@@ -5,8 +5,8 @@
5
5
  "*.css"
6
6
  ],
7
7
  "dependencies": {
8
- "@appsemble/preact": "0.34.20",
9
- "@appsemble/sdk": "0.34.20",
8
+ "@appsemble/preact": "0.35.3-test.0",
9
+ "@appsemble/sdk": "0.35.3-test.0",
10
10
  "preact": "^10.0.0"
11
11
  }
12
12
  }
@@ -5,6 +5,6 @@
5
5
  "*.css"
6
6
  ],
7
7
  "dependencies": {
8
- "@appsemble/sdk": "0.34.20"
8
+ "@appsemble/sdk": "0.35.3-test.0"
9
9
  }
10
10
  }
package/vitest.setup.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { clearAllS3Buckets, CREDENTIALS_ENV_VAR, initS3Client, setFixtureBase, setLogLevel, } from '@appsemble/node-utils';
3
- import { rootDB, setupTestDatabase } from '@appsemble/server';
3
+ import { getRootDB, models, setupTestDatabase } from '@appsemble/server';
4
4
  // eslint-disable-next-line import/no-extraneous-dependencies
5
- import { afterAll, beforeAll, beforeEach, vi } from 'vitest';
5
+ import { afterAll, afterEach, beforeAll, beforeEach, vi } from 'vitest';
6
6
  setFixtureBase(import.meta);
7
7
  delete process.env[CREDENTIALS_ENV_VAR];
8
8
  setLogLevel(0);
@@ -19,14 +19,18 @@ beforeAll(async () => {
19
19
  });
20
20
  });
21
21
  beforeEach(async () => {
22
+ await models.dropAndCloseAllAppDBs();
22
23
  await testDB.truncate({ truncate: true, cascade: true, force: true, restartIdentity: true });
23
24
  vi.useRealTimers();
24
25
  await clearAllS3Buckets();
25
26
  });
27
+ afterEach(async () => {
28
+ await models.dropAndCloseAllAppDBs();
29
+ });
26
30
  afterAll(() => {
27
31
  testDB.close();
28
32
  // We need to drop the test database from the root database
29
33
  // testDB.drop() doesn't actually delete the database
30
- rootDB.query(`DROP DATABASE ${testDB.getDatabaseName()}`);
34
+ getRootDB().query(`DROP DATABASE ${testDB.getDatabaseName()}`);
31
35
  });
32
36
  //# sourceMappingURL=vitest.setup.js.map