@appsemble/cli 0.33.11 → 0.34.1-test.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.
- package/README.md +3 -3
- package/commands/app/publish.d.ts +5 -0
- package/commands/app/publish.js +16 -0
- package/commands/app/update.d.ts +5 -0
- package/commands/app/update.js +16 -0
- package/commands/migrate.js +0 -1
- package/index.js +2 -2
- package/lib/app.d.ts +40 -0
- package/lib/app.js +40 -0
- package/lib/group.d.ts +5 -5
- package/lib/group.js +10 -10
- package/package.json +7 -7
- 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 +7 -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.34.1-test.1)
|
|
7
7
|
[](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.
|
|
326
|
+
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.34.1-test.1/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.";
|
package/commands/app/publish.js
CHANGED
|
@@ -76,6 +76,22 @@ export function builder(yargs) {
|
|
|
76
76
|
.option('sentry-environment', {
|
|
77
77
|
describe: 'The environment for the custom Sentry DSN for the app.',
|
|
78
78
|
implies: ['sentry-dsn'],
|
|
79
|
+
})
|
|
80
|
+
.option('db-name', {
|
|
81
|
+
describe: 'The name of the external app database.',
|
|
82
|
+
})
|
|
83
|
+
.option('db-host', {
|
|
84
|
+
describe: 'The host of the external app database.',
|
|
85
|
+
})
|
|
86
|
+
.option('db-port', {
|
|
87
|
+
describe: 'The port of the external app database.',
|
|
88
|
+
type: 'number',
|
|
89
|
+
})
|
|
90
|
+
.option('db-user', {
|
|
91
|
+
describe: 'The user of the external app database.',
|
|
92
|
+
})
|
|
93
|
+
.option('db-password', {
|
|
94
|
+
describe: 'The password of the external app database.',
|
|
79
95
|
});
|
|
80
96
|
}
|
|
81
97
|
export async function handler({ paths, ...args }) {
|
package/commands/app/update.d.ts
CHANGED
|
@@ -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.";
|
package/commands/app/update.js
CHANGED
|
@@ -76,6 +76,22 @@ export function builder(yargs) {
|
|
|
76
76
|
.option('sentry-environment', {
|
|
77
77
|
describe: 'The environment for the custom Sentry DSN for the app.',
|
|
78
78
|
implies: ['sentry-dsn'],
|
|
79
|
+
})
|
|
80
|
+
.option('db-name', {
|
|
81
|
+
describe: 'The name of the external app database.',
|
|
82
|
+
})
|
|
83
|
+
.option('db-host', {
|
|
84
|
+
describe: 'The host of the external app database.',
|
|
85
|
+
})
|
|
86
|
+
.option('db-port', {
|
|
87
|
+
describe: 'The port of the external app database.',
|
|
88
|
+
type: 'number',
|
|
89
|
+
})
|
|
90
|
+
.option('db-user', {
|
|
91
|
+
describe: 'The user of the external app database.',
|
|
92
|
+
})
|
|
93
|
+
.option('db-password', {
|
|
94
|
+
describe: 'The password of the external app database.',
|
|
79
95
|
});
|
|
80
96
|
}
|
|
81
97
|
export async function handler({ clientCredentials, id, paths, remote, ...args }) {
|
package/commands/migrate.js
CHANGED
package/index.js
CHANGED
|
@@ -7,7 +7,7 @@ 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
9
|
import * as checkDownMigrations from './commands/checkDownMigrations.js';
|
|
10
|
-
import * as
|
|
10
|
+
import * as checkAppMigrations from './commands/checkMigrations.js';
|
|
11
11
|
import * as cleanupDemoAppMembers from './commands/cleanupDemoAppMembers.js';
|
|
12
12
|
import * as cleanupResourcesAndAssets from './commands/cleanupResourcesAndAssets.js';
|
|
13
13
|
import * as cleanupSoftDeletedRecords from './commands/cleanupSoftDeletedRecords.js';
|
|
@@ -58,7 +58,7 @@ let parser = yargs(process.argv.slice(2))
|
|
|
58
58
|
.command(cleanupResourcesAndAssets)
|
|
59
59
|
.command(cleanupDemoAppMembers)
|
|
60
60
|
.command(cleanupSoftDeletedRecords)
|
|
61
|
-
.command(
|
|
61
|
+
.command(checkAppMigrations)
|
|
62
62
|
.command(checkDownMigrations)
|
|
63
63
|
.command(fuzzMigrations)
|
|
64
64
|
.command(config)
|
package/lib/app.d.ts
CHANGED
|
@@ -140,6 +140,26 @@ interface PublishAppParams {
|
|
|
140
140
|
* The environment for the custom Sentry DSN for the app.
|
|
141
141
|
*/
|
|
142
142
|
sentryEnvironment?: string;
|
|
143
|
+
/**
|
|
144
|
+
* The name of the external app database.
|
|
145
|
+
*/
|
|
146
|
+
dbName?: string;
|
|
147
|
+
/**
|
|
148
|
+
* The host of the external app database.
|
|
149
|
+
*/
|
|
150
|
+
dbHost?: string;
|
|
151
|
+
/**
|
|
152
|
+
* The port of the external app database.
|
|
153
|
+
*/
|
|
154
|
+
dbPort?: number;
|
|
155
|
+
/**
|
|
156
|
+
* The user of the external app database.
|
|
157
|
+
*/
|
|
158
|
+
dbUser?: string;
|
|
159
|
+
/**
|
|
160
|
+
* The password of the external app database.
|
|
161
|
+
*/
|
|
162
|
+
dbPassword?: string;
|
|
143
163
|
}
|
|
144
164
|
/**
|
|
145
165
|
* Publish a new app.
|
|
@@ -224,6 +244,26 @@ interface UpdateAppParams {
|
|
|
224
244
|
* The environment for the custom Sentry DSN for the app.
|
|
225
245
|
*/
|
|
226
246
|
sentryEnvironment?: string;
|
|
247
|
+
/**
|
|
248
|
+
* The name of the external app database.
|
|
249
|
+
*/
|
|
250
|
+
dbName?: string;
|
|
251
|
+
/**
|
|
252
|
+
* The host of the external app database.
|
|
253
|
+
*/
|
|
254
|
+
dbHost?: string;
|
|
255
|
+
/**
|
|
256
|
+
* The port of the external app database.
|
|
257
|
+
*/
|
|
258
|
+
dbPort?: number;
|
|
259
|
+
/**
|
|
260
|
+
* The user of the external app database.
|
|
261
|
+
*/
|
|
262
|
+
dbUser?: string;
|
|
263
|
+
/**
|
|
264
|
+
* The password of the external app database.
|
|
265
|
+
*/
|
|
266
|
+
dbPassword?: string;
|
|
227
267
|
}
|
|
228
268
|
/**
|
|
229
269
|
* Update an existing app.
|
package/lib/app.js
CHANGED
|
@@ -783,6 +783,11 @@ export async function publishApp({ clientCredentials, context, dryRun, modifyCon
|
|
|
783
783
|
const assets = appsembleContext.assets ?? options.assets;
|
|
784
784
|
const resources = appsembleContext.resources ?? options.resources;
|
|
785
785
|
const appLock = appsembleContext.appLock || 'unlocked';
|
|
786
|
+
const dbName = appsembleContext.dbName ?? options.dbName;
|
|
787
|
+
const dbHost = appsembleContext.dbHost ?? options.dbHost;
|
|
788
|
+
const dbPort = appsembleContext.dbPort ?? options.dbPort;
|
|
789
|
+
const dbUser = appsembleContext.dbUser ?? options.dbUser;
|
|
790
|
+
const { dbPassword } = options;
|
|
786
791
|
logger.verbose(`App remote: ${remote}`);
|
|
787
792
|
logger.verbose(`App organization: ${organizationId}`);
|
|
788
793
|
logger.verbose(`App is template: ${inspect(template, { colors: true })}`);
|
|
@@ -797,6 +802,21 @@ export async function publishApp({ clientCredentials, context, dryRun, modifyCon
|
|
|
797
802
|
formData.append('visibility', visibility);
|
|
798
803
|
formData.append('iconBackground', iconBackground);
|
|
799
804
|
formData.append('locked', appLock);
|
|
805
|
+
if (dbName) {
|
|
806
|
+
formData.append('dbName', dbName);
|
|
807
|
+
}
|
|
808
|
+
if (dbHost) {
|
|
809
|
+
formData.append('dbHost', dbHost);
|
|
810
|
+
}
|
|
811
|
+
if (dbPort) {
|
|
812
|
+
formData.append('dbPort', dbPort);
|
|
813
|
+
}
|
|
814
|
+
if (dbUser) {
|
|
815
|
+
formData.append('dbUser', dbUser);
|
|
816
|
+
}
|
|
817
|
+
if (dbPassword) {
|
|
818
|
+
formData.append('dbPassword', dbPassword);
|
|
819
|
+
}
|
|
800
820
|
if (icon) {
|
|
801
821
|
const realIcon = typeof icon === 'string' ? createReadStream(icon) : icon;
|
|
802
822
|
logger.info(`Using icon from ${realIcon.path ?? 'stdin'}`);
|
|
@@ -957,6 +977,11 @@ export async function updateApp({ clientCredentials, context, force, path, ...op
|
|
|
957
977
|
const resources = appsembleContext.resources ?? options.resources;
|
|
958
978
|
const assets = appsembleContext.assets ?? options.assets;
|
|
959
979
|
const { appLock } = appsembleContext;
|
|
980
|
+
const dbName = appsembleContext.dbName ?? options.dbName;
|
|
981
|
+
const dbHost = appsembleContext.dbHost ?? options.dbHost;
|
|
982
|
+
const dbPort = appsembleContext.dbPort ?? options.dbPort;
|
|
983
|
+
const dbUser = appsembleContext.dbUser ?? options.dbUser;
|
|
984
|
+
const { dbPassword } = options;
|
|
960
985
|
logger.info(`App id: ${id}`);
|
|
961
986
|
logger.verbose(`App remote: ${remote}`);
|
|
962
987
|
logger.verbose(`App is template: ${inspect(template, { colors: true })}`);
|
|
@@ -971,6 +996,21 @@ export async function updateApp({ clientCredentials, context, force, path, ...op
|
|
|
971
996
|
formData.append('demoMode', String(demoMode));
|
|
972
997
|
formData.append('visibility', visibility);
|
|
973
998
|
formData.append('iconBackground', iconBackground);
|
|
999
|
+
if (dbName) {
|
|
1000
|
+
formData.append('dbName', dbName);
|
|
1001
|
+
}
|
|
1002
|
+
if (dbHost) {
|
|
1003
|
+
formData.append('dbHost', dbHost);
|
|
1004
|
+
}
|
|
1005
|
+
if (dbPort) {
|
|
1006
|
+
formData.append('dbPort', dbPort);
|
|
1007
|
+
}
|
|
1008
|
+
if (dbUser) {
|
|
1009
|
+
formData.append('dbUser', dbUser);
|
|
1010
|
+
}
|
|
1011
|
+
if (dbPassword) {
|
|
1012
|
+
formData.append('dbPassword', dbPassword);
|
|
1013
|
+
}
|
|
974
1014
|
if (icon) {
|
|
975
1015
|
const realIcon = typeof icon === 'string' ? createReadStream(icon) : icon;
|
|
976
1016
|
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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appsemble/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.1-test.1",
|
|
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.
|
|
48
|
-
"@appsemble/types": "0.
|
|
49
|
-
"@appsemble/lang-sdk": "0.
|
|
50
|
-
"@appsemble/utils": "0.
|
|
47
|
+
"@appsemble/node-utils": "0.34.1-test.1",
|
|
48
|
+
"@appsemble/types": "0.34.1-test.1",
|
|
49
|
+
"@appsemble/lang-sdk": "0.34.1-test.1",
|
|
50
|
+
"@appsemble/utils": "0.34.1-test.1",
|
|
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.
|
|
94
|
-
"@appsemble/server": "0.
|
|
93
|
+
"@appsemble/types": "0.34.1-test.1",
|
|
94
|
+
"@appsemble/server": "0.34.1-test.1",
|
|
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.
|
|
9
|
+
version: 0.34.1-test.1
|
|
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.
|
|
20
|
+
version: 0.34.1-test.1
|
|
21
21
|
parameters:
|
|
22
22
|
icon: arrow-left
|
|
23
23
|
actions:
|
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 {
|
|
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
|
-
|
|
34
|
+
getRootDB().query(`DROP DATABASE ${testDB.getDatabaseName()}`);
|
|
31
35
|
});
|
|
32
36
|
//# sourceMappingURL=vitest.setup.js.map
|