@appsemble/cli 0.20.13 → 0.20.14
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 +4 -4
- package/__fixtures__/getBlockConfigFromTypeScript/comments/tsconfig.json +1 -1
- package/__fixtures__/getBlockConfigFromTypeScript/duplicateActions/tsconfig.json +1 -1
- package/__fixtures__/getBlockConfigFromTypeScript/duplicateEventEmitters/tsconfig.json +1 -1
- package/__fixtures__/getBlockConfigFromTypeScript/duplicateEventListeners/tsconfig.json +1 -1
- package/__fixtures__/getBlockConfigFromTypeScript/duplicateParameters/tsconfig.json +1 -1
- package/__fixtures__/getBlockConfigFromTypeScript/fontawesomeParameters/tsconfig.json +1 -1
- package/__fixtures__/getBlockConfigFromTypeScript/tsError/tsconfig.json +1 -1
- package/__fixtures__/getBlockConfigFromTypeScript/valid/tsconfig.json +1 -1
- package/commands/app/create.d.ts +1 -1
- package/commands/app/create.js +16 -24
- package/commands/app/create.js.map +1 -1
- package/commands/app/create.ts +3 -3
- package/commands/app/extract-messages.d.ts +1 -1
- package/commands/app/extract-messages.js +12 -20
- package/commands/app/extract-messages.js.map +1 -1
- package/commands/app/extract-messages.ts +2 -2
- package/commands/app/index.js +12 -36
- package/commands/app/index.js.map +1 -1
- package/commands/app/index.ts +9 -5
- package/commands/app/update.d.ts +1 -1
- package/commands/app/update.js +18 -26
- package/commands/app/update.js.map +1 -1
- package/commands/app/update.ts +4 -4
- package/commands/asset/create.d.ts +1 -1
- package/commands/asset/create.js +20 -28
- package/commands/asset/create.js.map +1 -1
- package/commands/asset/create.ts +4 -4
- package/commands/asset/index.js +5 -33
- package/commands/asset/index.js.map +1 -1
- package/commands/asset/index.ts +3 -3
- package/commands/block/build.d.ts +1 -1
- package/commands/block/build.js +14 -22
- package/commands/block/build.js.map +1 -1
- package/commands/block/build.ts +2 -2
- package/commands/block/extract-messages.d.ts +1 -1
- package/commands/block/extract-messages.js +15 -23
- package/commands/block/extract-messages.js.map +1 -1
- package/commands/block/extract-messages.ts +2 -2
- package/commands/block/index.js +12 -36
- package/commands/block/index.js.map +1 -1
- package/commands/block/index.ts +9 -5
- package/commands/block/publish.d.ts +1 -1
- package/commands/block/publish.js +17 -25
- package/commands/block/publish.js.map +1 -1
- package/commands/block/publish.ts +3 -3
- package/commands/cleanupResources.d.ts +1 -1
- package/commands/cleanupResources.js +6 -11
- package/commands/cleanupResources.js.map +1 -1
- package/commands/cleanupResources.ts +2 -2
- package/commands/config/get.d.ts +1 -1
- package/commands/config/get.js +10 -17
- package/commands/config/get.js.map +1 -1
- package/commands/config/get.ts +6 -5
- package/commands/config/index.js +10 -35
- package/commands/config/index.js.map +1 -1
- package/commands/config/index.ts +7 -4
- package/commands/config/set.d.ts +1 -1
- package/commands/config/set.js +15 -22
- package/commands/config/set.js.map +1 -1
- package/commands/config/set.ts +7 -6
- package/commands/login.d.ts +1 -1
- package/commands/login.js +3 -7
- package/commands/login.js.map +1 -1
- package/commands/login.ts +1 -1
- package/commands/logout.d.ts +1 -1
- package/commands/logout.js +3 -7
- package/commands/logout.js.map +1 -1
- package/commands/logout.ts +1 -1
- package/commands/migrate.d.ts +1 -1
- package/commands/migrate.js +8 -16
- package/commands/migrate.js.map +1 -1
- package/commands/migrate.ts +3 -3
- package/commands/organization/create.d.ts +1 -1
- package/commands/organization/create.js +10 -15
- package/commands/organization/create.js.map +1 -1
- package/commands/organization/create.ts +4 -4
- package/commands/organization/index.js +10 -35
- package/commands/organization/index.js.map +1 -1
- package/commands/organization/index.ts +7 -4
- package/commands/organization/update.d.ts +1 -1
- package/commands/organization/update.js +10 -15
- package/commands/organization/update.js.map +1 -1
- package/commands/organization/update.ts +4 -4
- package/commands/resource/create.d.ts +1 -1
- package/commands/resource/create.js +18 -26
- package/commands/resource/create.js.map +1 -1
- package/commands/resource/create.ts +4 -4
- package/commands/resource/index.js +10 -35
- package/commands/resource/index.js.map +1 -1
- package/commands/resource/index.ts +7 -4
- package/commands/resource/update.d.ts +1 -1
- package/commands/resource/update.js +18 -26
- package/commands/resource/update.js.map +1 -1
- package/commands/resource/update.ts +4 -4
- package/commands/runCronJobs.d.ts +1 -1
- package/commands/runCronJobs.js +6 -11
- package/commands/runCronJobs.js.map +1 -1
- package/commands/runCronJobs.ts +2 -2
- package/commands/start.d.ts +1 -1
- package/commands/start.js +10 -15
- package/commands/start.js.map +1 -1
- package/commands/start.ts +4 -4
- package/commands/team/create.d.ts +1 -1
- package/commands/team/create.js +10 -15
- package/commands/team/create.js.map +1 -1
- package/commands/team/create.ts +4 -4
- package/commands/team/delete.d.ts +1 -1
- package/commands/team/delete.js +10 -15
- package/commands/team/delete.js.map +1 -1
- package/commands/team/delete.ts +4 -4
- package/commands/team/index.js +14 -37
- package/commands/team/index.js.map +1 -1
- package/commands/team/index.ts +11 -6
- package/commands/team/member/delete.d.ts +1 -1
- package/commands/team/member/delete.js +10 -15
- package/commands/team/member/delete.js.map +1 -1
- package/commands/team/member/delete.ts +4 -4
- package/commands/team/member/index.js +12 -36
- package/commands/team/member/index.js.map +1 -1
- package/commands/team/member/index.ts +9 -5
- package/commands/team/member/invite.d.ts +1 -1
- package/commands/team/member/invite.js +10 -15
- package/commands/team/member/invite.js.map +1 -1
- package/commands/team/member/invite.ts +4 -4
- package/commands/team/member/update.d.ts +1 -1
- package/commands/team/member/update.js +12 -17
- package/commands/team/member/update.js.map +1 -1
- package/commands/team/member/update.ts +4 -4
- package/commands/team/update.d.ts +1 -1
- package/commands/team/update.js +10 -15
- package/commands/team/update.js.map +1 -1
- package/commands/team/update.ts +4 -4
- package/index.js +66 -94
- package/index.js.map +1 -1
- package/index.ts +65 -65
- package/jest.config.js +3 -1
- package/jest.setup.js +3 -5
- package/jest.setup.js.map +1 -1
- package/jest.setup.ts +1 -1
- package/lib/__snapshots__/getBlockConfigFromTypeScript.test.ts.snap +5 -6
- package/lib/app.d.ts +1 -1
- package/lib/app.js +151 -163
- package/lib/app.js.map +1 -1
- package/lib/app.ts +7 -7
- package/lib/asset.js +11 -18
- package/lib/asset.js.map +1 -1
- package/lib/authentication.d.ts +1 -1
- package/lib/authentication.js +34 -65
- package/lib/authentication.js.map +1 -1
- package/lib/authentication.ts +3 -2
- package/lib/block.js +99 -113
- package/lib/block.js.map +1 -1
- package/lib/block.test.js +9 -14
- package/lib/block.test.js.map +1 -1
- package/lib/block.test.ts +1 -1
- package/lib/block.ts +5 -5
- package/lib/coercers.js +5 -13
- package/lib/coercers.js.map +1 -1
- package/lib/coercers.test.js +2 -4
- package/lib/coercers.test.js.map +1 -1
- package/lib/coercers.test.ts +1 -1
- package/lib/getBlockConfigFromTypeScript.js +49 -56
- package/lib/getBlockConfigFromTypeScript.js.map +1 -1
- package/lib/getBlockConfigFromTypeScript.test.js +42 -46
- package/lib/getBlockConfigFromTypeScript.test.js.map +1 -1
- package/lib/getBlockConfigFromTypeScript.test.ts +7 -6
- package/lib/initAxios.d.ts +1 -1
- package/lib/initAxios.js +7 -14
- package/lib/initAxios.js.map +1 -1
- package/lib/initAxios.ts +2 -2
- package/lib/loadWebpackConfig.js +14 -45
- package/lib/loadWebpackConfig.js.map +1 -1
- package/lib/loadWebpackConfig.ts +10 -17
- package/lib/organization.js +23 -31
- package/lib/organization.js.map +1 -1
- package/lib/output.js +5 -9
- package/lib/output.js.map +1 -1
- package/lib/processCss.js +11 -18
- package/lib/processCss.js.map +1 -1
- package/lib/resource.js +17 -25
- package/lib/resource.js.map +1 -1
- package/lib/serverImport.js +6 -34
- package/lib/serverImport.js.map +1 -1
- package/lib/serverImport.ts +0 -1
- package/lib/team.js +28 -41
- package/lib/team.js.map +1 -1
- package/package.json +11 -10
- package/tsconfig.json +0 -1
- package/types.js +1 -2
package/lib/loadWebpackConfig.js
CHANGED
|
@@ -1,30 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.loadWebpackConfig = void 0;
|
|
27
|
-
const node_utils_1 = require("@appsemble/node-utils");
|
|
1
|
+
import { stat } from 'fs/promises';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { logger } from '@appsemble/node-utils';
|
|
28
4
|
/**
|
|
29
5
|
* Load a webpack configuration file.
|
|
30
6
|
*
|
|
@@ -37,29 +13,23 @@ const node_utils_1 = require("@appsemble/node-utils");
|
|
|
37
13
|
* @param outputPath The path where the build will be output on disk.
|
|
38
14
|
* @returns The webpack configuration as exposed by the webpack configuration file.
|
|
39
15
|
*/
|
|
40
|
-
async function loadWebpackConfig(block, mode, outputPath) {
|
|
16
|
+
export async function loadWebpackConfig(block, mode, outputPath) {
|
|
41
17
|
let configPath;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
configPath = require.resolve(block.webpack, requireOptions);
|
|
18
|
+
if (block.webpack) {
|
|
19
|
+
configPath = join(block.dir, block.webpack);
|
|
45
20
|
}
|
|
46
21
|
else {
|
|
22
|
+
configPath = join(block.dir, 'webpack.config.js');
|
|
47
23
|
try {
|
|
48
|
-
|
|
49
|
-
// eslint-disable-next-line node/no-unpublished-require
|
|
50
|
-
configPath = require.resolve('./webpack.config', requireOptions);
|
|
24
|
+
await stat(configPath);
|
|
51
25
|
}
|
|
52
|
-
catch
|
|
53
|
-
|
|
54
|
-
error.requireStack[0] === __filename)) {
|
|
55
|
-
throw error;
|
|
56
|
-
}
|
|
57
|
-
configPath = require.resolve('@appsemble/webpack-config', requireOptions);
|
|
26
|
+
catch {
|
|
27
|
+
configPath = '@appsemble/webpack-config';
|
|
58
28
|
}
|
|
59
29
|
}
|
|
60
|
-
|
|
30
|
+
logger.info(`Using webpack config from ${configPath}`);
|
|
61
31
|
const publicPath = `/api/blocks/${block.name}/versions/${block.version}/`;
|
|
62
|
-
let config = await
|
|
32
|
+
let config = await import(String(configPath));
|
|
63
33
|
config = await (config.default || config);
|
|
64
34
|
config = config instanceof Function ? await config(block, { mode, publicPath }) : config;
|
|
65
35
|
// Koa-webpack serves assets on the `output.path` path. Normally this field describes where to
|
|
@@ -67,10 +37,9 @@ async function loadWebpackConfig(block, mode, outputPath) {
|
|
|
67
37
|
// server.
|
|
68
38
|
config.output = config.output || {};
|
|
69
39
|
config.output.path = outputPath || publicPath;
|
|
70
|
-
|
|
40
|
+
logger.verbose(`Patched webpack config output.path to ${config.output.path}`);
|
|
71
41
|
config.output.publicPath = publicPath;
|
|
72
|
-
|
|
42
|
+
logger.verbose(`Patched webpack config output.publicPath to ${config.output.publicPath}`);
|
|
73
43
|
return config;
|
|
74
44
|
}
|
|
75
|
-
exports.loadWebpackConfig = loadWebpackConfig;
|
|
76
45
|
//# sourceMappingURL=loadWebpackConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadWebpackConfig.js","sourceRoot":"","sources":["loadWebpackConfig.ts"],"names":[],"mappings":"
|
|
1
|
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;IACpC,MAAM,CAAC,MAAM,CAAC,IAAI,GAAG,UAAU,IAAI,UAAU,CAAC;IAC9C,MAAM,CAAC,OAAO,CAAC,yCAAyC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9E,MAAM,CAAC,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC;IACtC,MAAM,CAAC,OAAO,CAAC,+CAA+C,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IAE1F,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/lib/loadWebpackConfig.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { stat } from 'fs/promises';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
|
|
1
4
|
import { logger } from '@appsemble/node-utils';
|
|
2
5
|
import { BlockConfig } from '@appsemble/types';
|
|
3
6
|
import { Configuration } from 'webpack';
|
|
@@ -20,29 +23,19 @@ export async function loadWebpackConfig(
|
|
|
20
23
|
outputPath?: string,
|
|
21
24
|
): Promise<Configuration> {
|
|
22
25
|
let configPath: string;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
configPath = require.resolve(block.webpack, requireOptions);
|
|
26
|
+
if (block.webpack) {
|
|
27
|
+
configPath = join(block.dir, block.webpack);
|
|
26
28
|
} else {
|
|
29
|
+
configPath = join(block.dir, 'webpack.config.js');
|
|
27
30
|
try {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
configPath =
|
|
31
|
-
} catch (error: unknown) {
|
|
32
|
-
if (
|
|
33
|
-
!(
|
|
34
|
-
(error as any).code === 'MODULE_NOT_FOUND' &&
|
|
35
|
-
(error as any).requireStack[0] === __filename
|
|
36
|
-
)
|
|
37
|
-
) {
|
|
38
|
-
throw error;
|
|
39
|
-
}
|
|
40
|
-
configPath = require.resolve('@appsemble/webpack-config', requireOptions);
|
|
31
|
+
await stat(configPath);
|
|
32
|
+
} catch {
|
|
33
|
+
configPath = '@appsemble/webpack-config';
|
|
41
34
|
}
|
|
42
35
|
}
|
|
43
36
|
logger.info(`Using webpack config from ${configPath}`);
|
|
44
37
|
const publicPath = `/api/blocks/${block.name}/versions/${block.version}/`;
|
|
45
|
-
let config = await import(configPath);
|
|
38
|
+
let config = await import(String(configPath));
|
|
46
39
|
config = await (config.default || config);
|
|
47
40
|
config = config instanceof Function ? await config(block, { mode, publicPath }) : config;
|
|
48
41
|
|
package/lib/organization.js
CHANGED
|
@@ -1,65 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
exports.updateOrganization = exports.createOrganization = void 0;
|
|
7
|
-
const node_utils_1 = require("@appsemble/node-utils");
|
|
8
|
-
const axios_1 = __importDefault(require("axios"));
|
|
9
|
-
const form_data_1 = __importDefault(require("form-data"));
|
|
10
|
-
async function createOrganization({ description, email, icon, id, name, website, }) {
|
|
11
|
-
const formData = new form_data_1.default();
|
|
1
|
+
import { logger } from '@appsemble/node-utils';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import FormData from 'form-data';
|
|
4
|
+
export async function createOrganization({ description, email, icon, id, name, website, }) {
|
|
5
|
+
const formData = new FormData();
|
|
12
6
|
formData.append('id', id);
|
|
13
7
|
if (description) {
|
|
14
|
-
|
|
8
|
+
logger.info(`Setting description to ${description}`);
|
|
15
9
|
formData.append('description', description);
|
|
16
10
|
}
|
|
17
11
|
if (email) {
|
|
18
|
-
|
|
12
|
+
logger.info(`Setting email to ${email}`);
|
|
19
13
|
formData.append('email', email);
|
|
20
14
|
}
|
|
21
15
|
if (icon) {
|
|
22
|
-
|
|
16
|
+
logger.info(`Including icon ${icon.path || 'from stdin'}`);
|
|
23
17
|
formData.append('icon', icon);
|
|
24
18
|
}
|
|
25
19
|
if (name) {
|
|
26
|
-
|
|
20
|
+
logger.info(`Setting name to ${name}`);
|
|
27
21
|
formData.append('name', name);
|
|
28
22
|
}
|
|
29
23
|
if (website) {
|
|
30
|
-
|
|
24
|
+
logger.info(`Setting website to ${website}`);
|
|
31
25
|
formData.append('website', website);
|
|
32
26
|
}
|
|
33
|
-
|
|
34
|
-
await
|
|
35
|
-
|
|
27
|
+
logger.info(`Creating organization ${id}${name ? ` (${name})` : ''}`);
|
|
28
|
+
await axios.post('/api/organizations', formData);
|
|
29
|
+
logger.info(`Successfully created organization ${id}${name ? ` (${name})` : ''}`);
|
|
36
30
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const formData = new form_data_1.default();
|
|
31
|
+
export async function updateOrganization({ description, email, icon, id, name, website, }) {
|
|
32
|
+
logger.info(`Updating organization ${id}${name ? ` (${name})` : ''}`);
|
|
33
|
+
const formData = new FormData();
|
|
41
34
|
if (description) {
|
|
42
|
-
|
|
35
|
+
logger.info(`Setting description to ${description}`);
|
|
43
36
|
formData.append('description', description);
|
|
44
37
|
}
|
|
45
38
|
if (email) {
|
|
46
|
-
|
|
39
|
+
logger.info(`Setting email to ${email}`);
|
|
47
40
|
formData.append('email', email);
|
|
48
41
|
}
|
|
49
42
|
if (icon) {
|
|
50
|
-
|
|
43
|
+
logger.info(`Including icon ${icon.path || 'from stdin'}`);
|
|
51
44
|
formData.append('icon', icon);
|
|
52
45
|
}
|
|
53
46
|
if (name) {
|
|
54
|
-
|
|
47
|
+
logger.info(`Setting name to ${name}`);
|
|
55
48
|
formData.append('name', name);
|
|
56
49
|
}
|
|
57
50
|
if (website) {
|
|
58
|
-
|
|
51
|
+
logger.info(`Setting website to ${website}`);
|
|
59
52
|
formData.append('website', website);
|
|
60
53
|
}
|
|
61
|
-
await
|
|
62
|
-
|
|
54
|
+
await axios.patch(`/api/organizations/${id}`, formData);
|
|
55
|
+
logger.info(`Successfully updated organization ${id}${name ? ` (${name})` : ''}`);
|
|
63
56
|
}
|
|
64
|
-
exports.updateOrganization = updateOrganization;
|
|
65
57
|
//# sourceMappingURL=organization.js.map
|
package/lib/organization.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.js","sourceRoot":"","sources":["organization.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"organization.js","sourceRoot":"","sources":["organization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,WAAW,CAAC;AAoBjC,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,EACvC,WAAW,EACX,KAAK,EACL,IAAI,EACJ,EAAE,EACF,IAAI,EACJ,OAAO,GACqB;IAC5B,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAE1B,IAAI,WAAW,EAAE;QACf,MAAM,CAAC,IAAI,CAAC,0BAA0B,WAAW,EAAE,CAAC,CAAC;QACrD,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;KAC7C;IAED,IAAI,KAAK,EAAE;QACT,MAAM,CAAC,IAAI,CAAC,oBAAoB,KAAK,EAAE,CAAC,CAAC;QACzC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KACjC;IAED,IAAI,IAAI,EAAE;QACR,MAAM,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,IAAI,IAAI,YAAY,EAAE,CAAC,CAAC;QAC3D,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;KAC/B;IAED,IAAI,IAAI,EAAE;QACR,MAAM,CAAC,IAAI,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;QACvC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;KAC/B;IAED,IAAI,OAAO,EAAE;QACX,MAAM,CAAC,IAAI,CAAC,sBAAsB,OAAO,EAAE,CAAC,CAAC;QAC7C,QAAQ,CAAC,M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,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;QACvC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;KAC/B;IAED,IAAI,OAAO,EAAE;QACX,MAAM,CAAC,IAAI,CAAC,sBAAsB,OAAO,EAAE,CAAC,CAAC;QAC7C,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;KACrC;IAED,MAAM,KAAK,CAAC,KAAK,CAAC,sBAAsB,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;IACxD,MAAM,CAAC,IAAI,CAAC,qCAAqC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACpF,CAAC"}
|
package/lib/output.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
function printAxiosError(filename, yaml, errors) {
|
|
6
|
-
const lineCounter = new yaml_1.LineCounter();
|
|
7
|
-
const doc = (0, yaml_1.parseDocument)(yaml, { lineCounter });
|
|
1
|
+
import { isNode, LineCounter, parseDocument } from 'yaml';
|
|
2
|
+
export function printAxiosError(filename, yaml, errors) {
|
|
3
|
+
const lineCounter = new LineCounter();
|
|
4
|
+
const doc = parseDocument(yaml, { lineCounter });
|
|
8
5
|
return errors
|
|
9
6
|
.map((error) => {
|
|
10
7
|
const node = doc.getIn(error.path, true);
|
|
11
8
|
let result = filename;
|
|
12
|
-
if (
|
|
9
|
+
if (isNode(node)) {
|
|
13
10
|
const { col, line } = lineCounter.linePos(node.range[0]);
|
|
14
11
|
result += `:${line}:${col}`;
|
|
15
12
|
}
|
|
@@ -17,5 +14,4 @@ function printAxiosError(filename, yaml, errors) {
|
|
|
17
14
|
})
|
|
18
15
|
.join('\n');
|
|
19
16
|
}
|
|
20
|
-
exports.printAxiosError = printAxiosError;
|
|
21
17
|
//# sourceMappingURL=output.js.map
|
package/lib/output.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["output.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["output.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAE1D,MAAM,UAAU,eAAe,CAAC,QAAgB,EAAE,IAAY,EAAE,MAAyB;IACvF,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;IACtC,MAAM,GAAG,GAAG,aAAa,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;IAEjD,OAAO,MAAM;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACb,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACzC,IAAI,MAAM,GAAG,QAAQ,CAAC;QACtB,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE;YAChB,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YACzD,MAAM,IAAI,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC;SAC7B;QACD,OAAO,GAAG,MAAM,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;IACtC,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
package/lib/processCss.js
CHANGED
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.processCss = void 0;
|
|
7
|
-
const promises_1 = require("fs/promises");
|
|
8
|
-
const postcss_1 = __importDefault(require("postcss"));
|
|
9
|
-
const postcss_import_1 = __importDefault(require("postcss-import"));
|
|
10
|
-
const postcss_load_config_1 = __importDefault(require("postcss-load-config"));
|
|
11
|
-
const postcss_url_1 = __importDefault(require("postcss-url"));
|
|
1
|
+
import { readFile } from 'fs/promises';
|
|
2
|
+
import postcss from 'postcss';
|
|
3
|
+
import postcssImport from 'postcss-import';
|
|
4
|
+
import postcssrc from 'postcss-load-config';
|
|
5
|
+
import postcssUrl from 'postcss-url';
|
|
12
6
|
/**
|
|
13
7
|
* Verifies and processes a CSS file using PostCSS.
|
|
14
8
|
*
|
|
15
9
|
* @param path Filepath of the CSS file
|
|
16
10
|
* @returns Processed CSS files concatenated into a single value.
|
|
17
11
|
*/
|
|
18
|
-
async function processCss(path) {
|
|
19
|
-
const data = await
|
|
20
|
-
const postcssConfig = await (
|
|
21
|
-
const postCss = (
|
|
22
|
-
postCss.use((
|
|
23
|
-
postCss.use((
|
|
12
|
+
export async function processCss(path) {
|
|
13
|
+
const data = await readFile(path, 'utf8');
|
|
14
|
+
const postcssConfig = await postcssrc();
|
|
15
|
+
const postCss = postcss(postcssConfig.plugins);
|
|
16
|
+
postCss.use(postcssUrl({ url: 'inline' }));
|
|
17
|
+
postCss.use(postcssImport({ plugins: postCss.plugins }));
|
|
24
18
|
const { css } = await postCss.process(data, { from: path, to: null });
|
|
25
19
|
return css;
|
|
26
20
|
}
|
|
27
|
-
exports.processCss = processCss;
|
|
28
21
|
//# sourceMappingURL=processCss.js.map
|
package/lib/processCss.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processCss.js","sourceRoot":"","sources":["processCss.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processCss.js","sourceRoot":"","sources":["processCss.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAC3C,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAC5C,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY;IAC3C,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAE1C,MAAM,aAAa,GAAG,MAAM,SAAS,EAAE,CAAC;IACxC,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/C,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;IAC3C,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAEzD,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IACtE,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/lib/resource.js
CHANGED
|
@@ -1,54 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.updateResource = exports.createResource = void 0;
|
|
7
|
-
const promises_1 = require("fs/promises");
|
|
8
|
-
const node_utils_1 = require("@appsemble/node-utils");
|
|
9
|
-
const axios_1 = __importDefault(require("axios"));
|
|
10
|
-
async function createResource({ appId, path, remote, resourceName, }) {
|
|
1
|
+
import { readFile } from 'fs/promises';
|
|
2
|
+
import { AppsembleError, logger, readData } from '@appsemble/node-utils';
|
|
3
|
+
import axios from 'axios';
|
|
4
|
+
export async function createResource({ appId, path, remote, resourceName, }) {
|
|
11
5
|
const csv = path.endsWith('.csv');
|
|
12
6
|
let resources;
|
|
13
7
|
if (csv) {
|
|
14
|
-
resources = await
|
|
8
|
+
resources = await readFile(path);
|
|
15
9
|
}
|
|
16
10
|
else {
|
|
17
|
-
const [file] = await
|
|
11
|
+
const [file] = await readData(path);
|
|
18
12
|
if (typeof file !== 'object') {
|
|
19
|
-
throw new
|
|
13
|
+
throw new AppsembleError(`File at ${path} does not contain an object or array of objects`);
|
|
20
14
|
}
|
|
21
15
|
resources = [].concat(file);
|
|
22
16
|
}
|
|
23
|
-
|
|
24
|
-
const { data } = await
|
|
17
|
+
logger.info(`Creating resource(s) from ${path}`);
|
|
18
|
+
const { data } = await axios.post(`/api/apps/${appId}/resources/${resourceName}`, resources, {
|
|
25
19
|
baseURL: remote,
|
|
26
20
|
headers: { 'content-type': csv ? 'text/csv' : 'application/json' },
|
|
27
21
|
});
|
|
28
22
|
const ids = [].concat(data).map((d) => d.id);
|
|
29
23
|
const url = new URL(`/apps/${appId}/resources/${resourceName}/`, remote);
|
|
30
|
-
|
|
24
|
+
logger.info(`Successfully created ${ids.length} resource${resources.length === 1 ? '' : 's'} at: \n${ids
|
|
31
25
|
.map((id) => `${url}${id}`)
|
|
32
26
|
.join('\n')}`);
|
|
33
27
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const [file] = await (0, node_utils_1.readData)(path);
|
|
28
|
+
export async function updateResource({ appId, path, remote, resourceName, }) {
|
|
29
|
+
const [file] = await readData(path);
|
|
37
30
|
if (typeof file !== 'object') {
|
|
38
|
-
throw new
|
|
31
|
+
throw new AppsembleError(`File at ${path} does not contain an object or array of objects`);
|
|
39
32
|
}
|
|
40
33
|
const resources = [].concat(file);
|
|
41
|
-
|
|
34
|
+
logger.info(`Updating ${resources.length} resource(s) from ${path}`);
|
|
42
35
|
for (const resource of resources) {
|
|
43
36
|
if (!resource.id) {
|
|
44
|
-
|
|
37
|
+
logger.info(`Skipping resource ${resources.indexOf(resource)} because it has no ID.`);
|
|
45
38
|
continue;
|
|
46
39
|
}
|
|
47
|
-
const { data: { id }, } = await
|
|
40
|
+
const { data: { id }, } = await axios.put(`/api/apps/${appId}/resources/${resourceName}/${resource.id}`, resource, {
|
|
48
41
|
baseURL: remote,
|
|
49
42
|
});
|
|
50
|
-
|
|
43
|
+
logger.info(`Successfully updated resource ${id} at ${new URL(`/apps/${appId}/resources/${resourceName}/${id}`, remote)}`);
|
|
51
44
|
}
|
|
52
45
|
}
|
|
53
|
-
exports.updateResource = updateResource;
|
|
54
46
|
//# sourceMappingURL=resource.js.map
|
package/lib/resource.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.js","sourceRoot":"","sources":["resource.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resource.js","sourceRoot":"","sources":["resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEzE,OAAO,KAAK,MAAM,OAAO,CAAC;AA8C1B,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EACnC,KAAK,EACL,IAAI,EACJ,MAAM,EACN,YAAY,GACS;IACrB,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAClC,IAAI,SAA8B,CAAC;IAEnC,IAAI,GAAG,EAAE;QACP,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;KAClC;SAAM;QACL,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,QAAQ,CAAW,IAAI,CAAC,CAAC;QAE9C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC5B,MAAM,IAAI,cAAc,CAAC,WAAW,IAAI,iDAAiD,CAAC,CAAC;SAC5F;QAED,SAAS,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KAC7B;IAED,MAAM,CAAC,IAAI,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC;IACjD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,KAA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AAQ,CAAC,EAAE,EAAE;YAChB,MAAM,CAAC,IAAI,CAAC,qBAAqB,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC;YACtF,SAAS;SACV;QAED,MAAM,EACJ,IAAI,EAAE,EAAE,EAAE,EAAE,GACb,GAAG,MAAM,KAAK,CAAC,GAAG,CACjB,aAAa,KAAK,cAAc,YAAY,IAAI,QAAQ,CAAC,EAAE,EAAE,EAC7D,QAAQ,EACR;YACE,OAAO,EAAE,MAAM;SAChB,CACF,CAAC;QAEF,MAAM,CAAC,IAAI,CACT,iCAAiC,EAAE,OAAO,IAAI,GAAG,CAC/C,SAAS,KAAK,cAAc,YAAY,IAAI,EAAE,EAAE,EAChD,MAAM,CACP,EAAE,CACJ,CAAC;KACH;AACH,CAAC"}
|
package/lib/serverImport.js
CHANGED
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.serverImport = void 0;
|
|
27
|
-
const node_utils_1 = require("@appsemble/node-utils");
|
|
28
|
-
const utils_1 = require("@appsemble/utils");
|
|
1
|
+
import { AppsembleError } from '@appsemble/node-utils';
|
|
2
|
+
import { has } from '@appsemble/utils';
|
|
29
3
|
const PROMPT = process.platform === 'win32' ? '>' : '$';
|
|
30
4
|
const COMMAND = /yarn/.test(process.env.npm_execpath)
|
|
31
5
|
? 'yarn add --dev --ignore-workspace-root-check'
|
|
@@ -40,16 +14,15 @@ ${PROMPT} ${COMMAND} @appsemble/server
|
|
|
40
14
|
* @param members The names of the exported member to import.
|
|
41
15
|
* @returns The exported member.
|
|
42
16
|
*/
|
|
43
|
-
async function serverImport(...members) {
|
|
17
|
+
export async function serverImport(...members) {
|
|
44
18
|
var _a;
|
|
45
19
|
try {
|
|
46
20
|
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
|
|
47
21
|
// @ts-ignore Because the the server isn’t built and published, an error is expected here at
|
|
48
22
|
// build time, but while type checking.
|
|
49
|
-
|
|
50
|
-
const mod = await Promise.resolve().then(() => __importStar(require('@appsemble/server')));
|
|
23
|
+
const mod = await import('@appsemble/server');
|
|
51
24
|
for (const member of members) {
|
|
52
|
-
if (!
|
|
25
|
+
if (!has(mod, member)) {
|
|
53
26
|
throw new Error(`@appsemble/server does not export ${member}`);
|
|
54
27
|
}
|
|
55
28
|
}
|
|
@@ -60,8 +33,7 @@ async function serverImport(...members) {
|
|
|
60
33
|
((_a = error.requireStack) === null || _a === void 0 ? void 0 : _a[0]) !== __filename) {
|
|
61
34
|
throw error;
|
|
62
35
|
}
|
|
63
|
-
throw new
|
|
36
|
+
throw new AppsembleError(INSTALL_MESSAGE);
|
|
64
37
|
}
|
|
65
38
|
}
|
|
66
|
-
exports.serverImport = serverImport;
|
|
67
39
|
//# sourceMappingURL=serverImport.js.map
|
package/lib/serverImport.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverImport.js","sourceRoot":"","sources":["serverImport.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serverImport.js","sourceRoot":"","sources":["serverImport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACxD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IACnD,CAAC,CAAC,8CAA8C;IAChD,CAAC,CAAC,wBAAwB,CAAC;AAC7B,MAAM,eAAe,GAAG;;EAEtB,MAAM,IAAI,OAAO;CAClB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAEhC,GAAG,OAAY;;IACf,IAAI;QACF,qEAAqE;QACrE,4FAA4F;QAC5F,uCAAuC;QACvC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;QAC9C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE;gBACrB,MAAM,IAAI,KAAK,CAAC,qCAAqC,MAAM,EAAE,CAAC,CAAC;aAChE;SACF;QACD,OAAO,GAAG,CAAC;KACZ;IAAC,OAAO,KAAc,EAAE;QACvB,IACG,KAAa,CAAC,IAAI,KAAK,kBAAkB;YAC1C,CAAA,MAAC,KAAa,CAAC,YAAY,0CAAG,CAAC,CAAC,MAAK,UAAU,EAC/C;YACA,MAAM,KAAK,CAAC;SACb;QACD,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,CAAC;KAC3C;AACH,CAAC"}
|
package/lib/serverImport.ts
CHANGED
|
@@ -23,7 +23,6 @@ export async function serverImport<
|
|
|
23
23
|
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
|
|
24
24
|
// @ts-ignore Because the the server isn’t built and published, an error is expected here at
|
|
25
25
|
// build time, but while type checking.
|
|
26
|
-
// eslint-disable-next-line import/no-extraneous-dependencies, node/no-extraneous-import
|
|
27
26
|
const mod = await import('@appsemble/server');
|
|
28
27
|
for (const member of members) {
|
|
29
28
|
if (!has(mod, member)) {
|
package/lib/team.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.deleteMember = exports.updateMember = exports.inviteMember = exports.updateTeam = exports.deleteTeam = exports.createTeam = exports.resolveAnnotations = void 0;
|
|
7
|
-
const node_utils_1 = require("@appsemble/node-utils");
|
|
8
|
-
const axios_1 = __importDefault(require("axios"));
|
|
9
|
-
function resolveAnnotations(annotations) {
|
|
1
|
+
import { AppsembleError, logger } from '@appsemble/node-utils';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
export function resolveAnnotations(annotations) {
|
|
10
4
|
const annotationRegex = /^\w+=.+$/;
|
|
11
5
|
if (annotations.some((a) => !annotationRegex.test(a))) {
|
|
12
|
-
throw new
|
|
6
|
+
throw new AppsembleError('One of the annotations did not follow the pattern of key=value');
|
|
13
7
|
}
|
|
14
8
|
return annotations.length
|
|
15
9
|
? Object.fromEntries(annotations.map((annotation) => {
|
|
@@ -18,47 +12,40 @@ function resolveAnnotations(annotations) {
|
|
|
18
12
|
}))
|
|
19
13
|
: undefined;
|
|
20
14
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const { data: { id }, } = await axios_1.default.post(`/api/apps/${appId}/teams`, {
|
|
15
|
+
export async function createTeam({ appId, name, remote, annotations = [], }) {
|
|
16
|
+
logger.info(`Creating team ${name}`);
|
|
17
|
+
const { data: { id }, } = await axios.post(`/api/apps/${appId}/teams`, {
|
|
25
18
|
name,
|
|
26
19
|
annotations: resolveAnnotations(annotations),
|
|
27
20
|
}, { baseURL: remote });
|
|
28
|
-
|
|
21
|
+
logger.info(`Successfully created team ${name} with ID ${id}`);
|
|
29
22
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
node_utils_1.logger.info(`Successfully deleted team ${id}`);
|
|
23
|
+
export async function deleteTeam({ appId, id, remote }) {
|
|
24
|
+
logger.info(`Deleting team ${id}`);
|
|
25
|
+
await axios.delete(`/api/apps/${appId}/teams/${id}`, { baseURL: remote });
|
|
26
|
+
logger.info(`Successfully deleted team ${id}`);
|
|
35
27
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
await axios_1.default.put(`/api/apps/${appId}/teams/${id}`, {
|
|
28
|
+
export async function updateTeam({ appId, id, name, remote, annotations = [], }) {
|
|
29
|
+
logger.info(`Updating team ${id}`);
|
|
30
|
+
await axios.put(`/api/apps/${appId}/teams/${id}`, {
|
|
40
31
|
name,
|
|
41
32
|
annotations: resolveAnnotations(annotations),
|
|
42
33
|
}, { baseURL: remote });
|
|
43
|
-
|
|
34
|
+
logger.info(`Successfully updated team ${id}`);
|
|
44
35
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
node_utils_1.logger.info(`Successfully invited ${user} to team ${id}`);
|
|
36
|
+
export async function inviteMember({ appId, id, remote, user, }) {
|
|
37
|
+
logger.info(`Inviting ${user} to team ${id}`);
|
|
38
|
+
await axios.post(`/api/apps/${appId}/teams/${id}/members`, { id: user }, { baseURL: remote });
|
|
39
|
+
logger.info(`Successfully invited ${user} to team ${id}`);
|
|
50
40
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
node_utils_1.logger.info(`Successfully updated ${user} in team ${id}`);
|
|
41
|
+
export async function updateMember({ appId, id, remote, role, user, }) {
|
|
42
|
+
logger.info(`Updating ${user}’s role in team ${id} to ${role}`);
|
|
43
|
+
await axios.put(`/api/apps/${appId}/teams/${id}/members/${user}`, { role }, { baseURL: remote });
|
|
44
|
+
logger.info(`Successfully updated ${user} in team ${id}`);
|
|
56
45
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
node_utils_1.logger.info(`Successfully deleted ${user} from team ${id}`);
|
|
46
|
+
export async function deleteMember({ appId, id, user }) {
|
|
47
|
+
logger.info(`Deleting ${user} to team ${id}`);
|
|
48
|
+
await axios.delete(`/api/apps/${appId}/teams/${id}/members/${user}`);
|
|
49
|
+
logger.info(`Successfully deleted ${user} from team ${id}`);
|
|
62
50
|
}
|
|
63
|
-
exports.deleteMember = deleteMember;
|
|
64
51
|
//# sourceMappingURL=team.js.map
|
package/lib/team.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"team.js","sourceRoot":"","sources":["team.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"team.js","sourceRoot":"","sources":["team.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG/D,OAAO,KAAK,MAAM,OAAO,CAAC;AA2D1B,MAAM,UAAU,kBAAkB,CAAC,WAAqB;IACtD,MAAM,eAAe,GAAG,UAAU,CAAC;IAEnC,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;QACrD,MAAM,IAAI,cAAc,CAAC,gEAAgE,CAAC,CAAC;KAC5F;IAED,OAAO,WAAW,CAAC,MAAM;QACvB,CAAC,CAAC,MAAM,CAAC,WAAW,CA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