@useparagon/cli 0.0.1-canary.39 → 0.0.1-canary.4
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/dist/apis/api.types.d.ts +8 -71
- package/dist/apis/auth.api.js +7 -5
- package/dist/apis/auth.api.js.map +1 -1
- package/dist/apis/base.api.d.ts +0 -3
- package/dist/apis/base.api.js +52 -51
- package/dist/apis/base.api.js.map +1 -1
- package/dist/apis/event.api.d.ts +2 -0
- package/dist/apis/event.api.js +10 -0
- package/dist/apis/event.api.js.map +1 -0
- package/dist/apis/index.d.ts +2 -0
- package/dist/apis/index.js +2 -0
- package/dist/apis/index.js.map +1 -1
- package/dist/apis/integration.api.d.ts +3 -3
- package/dist/apis/integration.api.js +10 -18
- package/dist/apis/integration.api.js.map +1 -1
- package/dist/apis/project.api.d.ts +1 -1
- package/dist/apis/project.api.js +17 -40
- package/dist/apis/project.api.js.map +1 -1
- package/dist/apis/workflow.api.d.ts +2 -0
- package/dist/apis/workflow.api.js +10 -0
- package/dist/apis/workflow.api.js.map +1 -0
- package/dist/codegen/codegen.types.d.ts +4 -12
- package/dist/codegen/codegen.utils.d.ts +1 -2
- package/dist/codegen/codegen.utils.js +28 -63
- package/dist/codegen/codegen.utils.js.map +1 -1
- package/dist/codegen/codegens/condition.codegen.js +35 -38
- package/dist/codegen/codegens/condition.codegen.js.map +1 -1
- package/dist/codegen/codegens/event.codegen.js +3 -4
- package/dist/codegen/codegens/event.codegen.js.map +1 -1
- package/dist/codegen/codegens/integration.codegen.d.ts +3 -3
- package/dist/codegen/codegens/integration.codegen.js +32 -138
- package/dist/codegen/codegens/integration.codegen.js.map +1 -1
- package/dist/codegen/codegens/source.codegen.d.ts +1 -3
- package/dist/codegen/codegens/source.codegen.js +31 -120
- package/dist/codegen/codegens/source.codegen.js.map +1 -1
- package/dist/codegen/codegens/workflow.codegen.js +111 -253
- package/dist/codegen/codegens/workflow.codegen.js.map +1 -1
- package/dist/commands/auth/login/login.action.js +31 -28
- package/dist/commands/auth/login/login.action.js.map +1 -1
- package/dist/commands/auth/login/login.command.js +4 -5
- package/dist/commands/auth/login/login.command.js.map +1 -1
- package/dist/commands/auth/login/login.utils.js +19 -26
- package/dist/commands/auth/login/login.utils.js.map +1 -1
- package/dist/commands/auth/logout/logout.action.js +5 -3
- package/dist/commands/auth/logout/logout.action.js.map +1 -1
- package/dist/commands/auth/logout/logout.command.js +3 -3
- package/dist/commands/auth/logout/logout.command.js.map +1 -1
- package/dist/commands/auth/me/me.action.js +6 -10
- package/dist/commands/auth/me/me.action.js.map +1 -1
- package/dist/commands/auth/me/me.command.js +3 -3
- package/dist/commands/auth/me/me.command.js.map +1 -1
- package/dist/commands/build/build.action.js +27 -27
- package/dist/commands/build/build.action.js.map +1 -1
- package/dist/commands/build/build.command.js +5 -9
- package/dist/commands/build/build.command.js.map +1 -1
- package/dist/commands/build/build.types.d.ts +0 -1
- package/dist/commands/build/build.utils.d.ts +1 -1
- package/dist/commands/build/build.utils.js +9 -11
- package/dist/commands/build/build.utils.js.map +1 -1
- package/dist/commands/command.loader.js +8 -10
- package/dist/commands/command.loader.js.map +1 -1
- package/dist/commands/init/init.action.d.ts +1 -1
- package/dist/commands/init/init.action.js +68 -93
- package/dist/commands/init/init.action.js.map +1 -1
- package/dist/commands/init/init.command.js +8 -14
- package/dist/commands/init/init.command.js.map +1 -1
- package/dist/commands/init/init.constants.js +23 -0
- package/dist/commands/init/init.constants.js.map +1 -0
- package/dist/commands/init/init.types.d.ts +0 -1
- package/dist/commands/init/init.utils.d.ts +11 -0
- package/dist/commands/init/init.utils.js +50 -0
- package/dist/commands/init/init.utils.js.map +1 -0
- package/dist/commands/push/push.action.js +11 -9
- package/dist/commands/push/push.action.js.map +1 -1
- package/dist/commands/push/push.command.js +4 -4
- package/dist/commands/push/push.command.js.map +1 -1
- package/dist/compiler/compiler.types.d.ts +2 -3
- package/dist/compiler/compiler.utils.d.ts +1 -1
- package/dist/compiler/compiler.utils.js +4 -8
- package/dist/compiler/compiler.utils.js.map +1 -1
- package/dist/compiler/compilers/events.compiler.js +28 -24
- package/dist/compiler/compilers/events.compiler.js.map +1 -1
- package/dist/compiler/compilers/integrations.compiler.js +52 -148
- package/dist/compiler/compilers/integrations.compiler.js.map +1 -1
- package/dist/compiler/compilers/persona.compiler.js +11 -4
- package/dist/compiler/compilers/persona.compiler.js.map +1 -1
- package/dist/compiler/compilers/project.compiler.d.ts +0 -1
- package/dist/compiler/compilers/project.compiler.js +23 -49
- package/dist/compiler/compilers/project.compiler.js.map +1 -1
- package/dist/compiler/compilers/workflows.compiler.js +33 -46
- package/dist/compiler/compilers/workflows.compiler.js.map +1 -1
- package/dist/compiler/ts.compiler.d.ts +3 -1
- package/dist/compiler/ts.compiler.js +18 -18
- package/dist/compiler/ts.compiler.js.map +1 -1
- package/dist/config/config.constants.d.ts +0 -1
- package/dist/config/config.constants.js +1 -2
- package/dist/config/config.constants.js.map +1 -1
- package/dist/config/config.types.d.ts +0 -4
- package/dist/config/config.utils.d.ts +3 -4
- package/dist/config/config.utils.js +37 -65
- package/dist/config/config.utils.js.map +1 -1
- package/dist/helpers/constants.d.ts +0 -1
- package/dist/helpers/constants.js +1 -2
- package/dist/helpers/constants.js.map +1 -1
- package/dist/helpers/file.d.ts +1 -3
- package/dist/helpers/file.js +15 -44
- package/dist/helpers/file.js.map +1 -1
- package/dist/helpers/strings.d.ts +0 -1
- package/dist/helpers/strings.js +1 -34
- package/dist/helpers/strings.js.map +1 -1
- package/dist/index.js +0 -10
- package/dist/index.js.map +1 -1
- package/dist/logger/logger.js +1 -5
- package/dist/logger/logger.js.map +1 -1
- package/dist/templates/configurations/typescript/tsconfig.json +2 -3
- package/dist/templates/javascript/src/events/hello-world.js +13 -0
- package/dist/templates/javascript/src/integrations/slack/config.js +11 -0
- package/dist/templates/javascript/src/integrations/slack/workflows/example-workflow.js +30 -0
- package/dist/templates/typescript/src/events/hello-world.ts +21 -0
- package/dist/templates/typescript/src/integrations/slack/config.ts +18 -0
- package/dist/templates/typescript/src/integrations/slack/workflows/example-workflow.ts +30 -0
- package/dist/templates/typescript/tsconfig.json +31 -0
- package/package.json +16 -20
- package/dist/codegen/codegens/intent.codegen.d.ts +0 -5
- package/dist/codegen/codegens/intent.codegen.js +0 -179
- package/dist/codegen/codegens/intent.codegen.js.map +0 -1
- package/dist/commands/install/index.d.ts +0 -1
- package/dist/commands/install/index.js +0 -5
- package/dist/commands/install/index.js.map +0 -1
- package/dist/commands/install/install.action.d.ts +0 -5
- package/dist/commands/install/install.action.js +0 -15
- package/dist/commands/install/install.action.js.map +0 -1
- package/dist/commands/install/install.command.d.ts +0 -8
- package/dist/commands/install/install.command.js +0 -24
- package/dist/commands/install/install.command.js.map +0 -1
- package/dist/commands/install/install.constants.js +0 -68
- package/dist/commands/install/install.constants.js.map +0 -1
- package/dist/commands/install/install.types.d.ts +0 -7
- package/dist/commands/install/install.types.js +0 -3
- package/dist/commands/install/install.types.js.map +0 -1
- package/dist/commands/install/install.utils.d.ts +0 -8
- package/dist/commands/install/install.utils.js +0 -130
- package/dist/commands/install/install.utils.js.map +0 -1
- package/dist/commands/new/index.d.ts +0 -1
- package/dist/commands/new/index.js +0 -5
- package/dist/commands/new/index.js.map +0 -1
- package/dist/commands/new/integration/index.d.ts +0 -1
- package/dist/commands/new/integration/index.js +0 -5
- package/dist/commands/new/integration/index.js.map +0 -1
- package/dist/commands/new/integration/integration.action.d.ts +0 -5
- package/dist/commands/new/integration/integration.action.js +0 -52
- package/dist/commands/new/integration/integration.action.js.map +0 -1
- package/dist/commands/new/integration/integration.command.d.ts +0 -8
- package/dist/commands/new/integration/integration.command.js +0 -26
- package/dist/commands/new/integration/integration.command.js.map +0 -1
- package/dist/commands/new/integration/integration.types.d.ts +0 -1
- package/dist/commands/new/integration/integration.types.js +0 -3
- package/dist/commands/new/integration/integration.types.js.map +0 -1
- package/dist/commands/new/new.command.d.ts +0 -5
- package/dist/commands/new/new.command.js +0 -16
- package/dist/commands/new/new.command.js.map +0 -1
- package/dist/commands/new/new.utils.d.ts +0 -1
- package/dist/commands/new/new.utils.js +0 -18
- package/dist/commands/new/new.utils.js.map +0 -1
- package/dist/commands/new/workflow/index.d.ts +0 -1
- package/dist/commands/new/workflow/index.js +0 -5
- package/dist/commands/new/workflow/index.js.map +0 -1
- package/dist/commands/new/workflow/workflow.action.d.ts +0 -5
- package/dist/commands/new/workflow/workflow.action.js +0 -94
- package/dist/commands/new/workflow/workflow.action.js.map +0 -1
- package/dist/commands/new/workflow/workflow.command.d.ts +0 -8
- package/dist/commands/new/workflow/workflow.command.js +0 -25
- package/dist/commands/new/workflow/workflow.command.js.map +0 -1
- package/dist/commands/new/workflow/workflow.types.d.ts +0 -3
- package/dist/commands/new/workflow/workflow.types.js +0 -3
- package/dist/commands/new/workflow/workflow.types.js.map +0 -1
- package/dist/helpers/sets.d.ts +0 -1
- package/dist/helpers/sets.js +0 -10
- package/dist/helpers/sets.js.map +0 -1
- /package/dist/commands/{install/install.constants.d.ts → init/init.constants.d.ts} +0 -0
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { ProjectBuild } from '../apis/api.types';
|
|
2
|
-
import {
|
|
2
|
+
import { ParagraphProjectJSON, SystemFile, SystemFileToConfig } from './config.types';
|
|
3
3
|
export declare const initializeSystemFiles: (systemDirectoryPath?: string) => Promise<void>;
|
|
4
4
|
export declare const initializeSystemDirectory: (systemDirectoryPath: string) => Promise<void>;
|
|
5
5
|
export declare const upsertConfigFile: <T extends SystemFile>(file: T, config: SystemFileToConfig[T]) => Promise<void>;
|
|
6
6
|
export declare const removeProfile: (_profile: string) => Promise<void>;
|
|
7
7
|
export declare const getConfigForProfile: <T extends SystemFile>(file: T, profileName: string) => Promise<SystemFileToConfig[T]>;
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const getLocalProjectBuild: (rootProjectDir: string) => Promise<ProjectBuild>;
|
|
8
|
+
export declare const getParagraphProjectDetails: () => Promise<ParagraphProjectJSON>;
|
|
9
|
+
export declare const getLocalProjectBuild: () => Promise<ProjectBuild>;
|
|
@@ -1,124 +1,96 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getLocalProjectBuild = exports.getParagraphProjectDetails = exports.
|
|
3
|
+
exports.getLocalProjectBuild = exports.getParagraphProjectDetails = exports.getConfigForProfile = exports.removeProfile = exports.upsertConfigFile = exports.initializeSystemDirectory = exports.initializeSystemFiles = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
6
6
|
const path = tslib_1.__importStar(require("node:path"));
|
|
7
7
|
const logger_1 = tslib_1.__importDefault(require("../logger"));
|
|
8
8
|
const config_constants_1 = require("./config.constants");
|
|
9
9
|
const config_types_1 = require("./config.types");
|
|
10
|
-
const initializeSystemFiles =
|
|
10
|
+
const initializeSystemFiles = (systemDirectoryPath = config_constants_1.SYSTEM_CONFIG_DIR_PATH) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
11
|
logger_1.default.debug('Initializing system files...');
|
|
12
|
-
|
|
12
|
+
yield (0, exports.initializeSystemDirectory)(systemDirectoryPath);
|
|
13
13
|
const systemFiles = Object.values(config_types_1.SystemFile);
|
|
14
|
-
|
|
15
|
-
};
|
|
14
|
+
yield Promise.all(systemFiles.map((file) => initializeOrUpdateFile(file, systemDirectoryPath)));
|
|
15
|
+
});
|
|
16
16
|
exports.initializeSystemFiles = initializeSystemFiles;
|
|
17
|
-
const initializeSystemDirectory =
|
|
17
|
+
const initializeSystemDirectory = (systemDirectoryPath) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
18
18
|
logger_1.default.debug('Initializing system directory...', { systemDirectoryPath });
|
|
19
|
-
const isDir =
|
|
19
|
+
const isDir = yield fs.exists(systemDirectoryPath);
|
|
20
20
|
if (!isDir) {
|
|
21
21
|
logger_1.default.debug('Initialized system directory.');
|
|
22
|
-
|
|
22
|
+
yield fs.mkdir(systemDirectoryPath);
|
|
23
23
|
}
|
|
24
|
-
};
|
|
24
|
+
});
|
|
25
25
|
exports.initializeSystemDirectory = initializeSystemDirectory;
|
|
26
|
-
const initializeOrUpdateFile =
|
|
26
|
+
const initializeOrUpdateFile = (file, systemDirectoryPath, fileContents) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
27
27
|
logger_1.default.debug('Initializing or updating file...', {
|
|
28
28
|
file,
|
|
29
29
|
systemDirectoryPath,
|
|
30
30
|
});
|
|
31
31
|
const filePath = path.resolve(systemDirectoryPath, config_types_1.SystemFileToPathMap[file]);
|
|
32
|
-
const doesExist =
|
|
32
|
+
const doesExist = yield fs.exists(filePath);
|
|
33
33
|
if (!doesExist || fileContents) {
|
|
34
34
|
logger_1.default.debug('Initialized or updated file.');
|
|
35
|
-
|
|
35
|
+
yield fs.writeFile(filePath, fileContents || '{}', { encoding: 'utf-8' });
|
|
36
36
|
}
|
|
37
|
-
};
|
|
38
|
-
const readFile =
|
|
37
|
+
});
|
|
38
|
+
const readFile = (file, systemDirectoryPath = config_constants_1.SYSTEM_CONFIG_DIR_PATH) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
39
39
|
logger_1.default.debug('Reading file...', { file, systemDirectoryPath });
|
|
40
40
|
const filePath = path.resolve(systemDirectoryPath, config_types_1.SystemFileToPathMap[file]);
|
|
41
|
-
const fileContents =
|
|
41
|
+
const fileContents = yield fs.readFile(filePath, 'utf-8');
|
|
42
42
|
return JSON.parse(fileContents);
|
|
43
|
-
};
|
|
44
|
-
const upsertConfigFile =
|
|
43
|
+
});
|
|
44
|
+
const upsertConfigFile = (file, config) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
45
45
|
let previousFileContent = undefined;
|
|
46
46
|
try {
|
|
47
|
-
previousFileContent =
|
|
47
|
+
previousFileContent = yield readFile(file);
|
|
48
48
|
}
|
|
49
|
-
catch { }
|
|
49
|
+
catch (_a) { }
|
|
50
50
|
const profileName = file === config_types_1.SystemFile.PROFILES ? config['name'] : config['profile'];
|
|
51
51
|
let concatedConfig = {
|
|
52
52
|
[profileName]: config,
|
|
53
53
|
};
|
|
54
54
|
if (previousFileContent) {
|
|
55
|
-
concatedConfig = {
|
|
56
|
-
...previousFileContent,
|
|
57
|
-
...concatedConfig,
|
|
58
|
-
};
|
|
55
|
+
concatedConfig = Object.assign(Object.assign({}, previousFileContent), concatedConfig);
|
|
59
56
|
}
|
|
60
|
-
|
|
61
|
-
};
|
|
57
|
+
yield initializeOrUpdateFile(file, config_constants_1.SYSTEM_CONFIG_DIR_PATH, JSON.stringify(concatedConfig, null, 2));
|
|
58
|
+
});
|
|
62
59
|
exports.upsertConfigFile = upsertConfigFile;
|
|
63
|
-
const removeProfile =
|
|
64
|
-
|
|
60
|
+
const removeProfile = (_profile) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
+
yield Promise.all([
|
|
65
62
|
initializeOrUpdateFile(config_types_1.SystemFile.PROFILES, config_constants_1.SYSTEM_CONFIG_DIR_PATH, '{}'),
|
|
66
63
|
initializeOrUpdateFile(config_types_1.SystemFile.CREDENTIALS, config_constants_1.SYSTEM_CONFIG_DIR_PATH, '{}'),
|
|
67
64
|
]);
|
|
68
|
-
};
|
|
65
|
+
});
|
|
69
66
|
exports.removeProfile = removeProfile;
|
|
70
|
-
const getConfigForProfile =
|
|
71
|
-
const config =
|
|
67
|
+
const getConfigForProfile = (file, profileName) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
+
const config = yield readFile(file);
|
|
72
69
|
if (!config[profileName]) {
|
|
73
70
|
throw new Error(`Profiles not found for profile - ${profileName}`);
|
|
74
71
|
}
|
|
75
72
|
return config[profileName];
|
|
76
|
-
};
|
|
73
|
+
});
|
|
77
74
|
exports.getConfigForProfile = getConfigForProfile;
|
|
78
|
-
const
|
|
79
|
-
const projectConfigPath = path.join(projectPath, '.para');
|
|
80
|
-
await fs.promises.mkdir(projectConfigPath, { recursive: true });
|
|
81
|
-
await fs.writeFile(path.join(projectConfigPath, config_constants_1.PROJECT_CONFIG_FILE_NAME), JSON.stringify(data, null, 2));
|
|
82
|
-
};
|
|
83
|
-
exports.createParagrahpProjectConfig = createParagrahpProjectConfig;
|
|
84
|
-
const getProjectJSON = async (rootPath) => {
|
|
75
|
+
const getParagraphProjectDetails = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
85
76
|
try {
|
|
86
|
-
const projectJson = JSON.parse(
|
|
77
|
+
const projectJson = JSON.parse(yield fs.readFile(path.join(process.cwd(), 'paragon.json'), 'utf-8'));
|
|
87
78
|
return projectJson;
|
|
88
79
|
}
|
|
89
80
|
catch (err) {
|
|
90
|
-
return undefined;
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
const getParagraphProjectDetails = async () => {
|
|
94
|
-
const maxParentCheck = 5;
|
|
95
|
-
const rootDir = path.parse(process.cwd()).root;
|
|
96
|
-
let projectRootDir = process.cwd();
|
|
97
|
-
let currentDepth = 0;
|
|
98
|
-
let projectJson;
|
|
99
|
-
while (currentDepth < maxParentCheck && projectRootDir !== rootDir) {
|
|
100
|
-
projectJson = await getProjectJSON(projectRootDir);
|
|
101
|
-
if (projectJson) {
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
projectRootDir = path.dirname(projectRootDir);
|
|
105
|
-
currentDepth++;
|
|
106
|
-
}
|
|
107
|
-
if (!projectJson) {
|
|
108
81
|
logger_1.default.fatal('Not a paragraph project.');
|
|
109
82
|
}
|
|
110
|
-
|
|
111
|
-
};
|
|
83
|
+
});
|
|
112
84
|
exports.getParagraphProjectDetails = getParagraphProjectDetails;
|
|
113
|
-
const getLocalProjectBuild =
|
|
114
|
-
const buildPath = path.join(
|
|
85
|
+
const getLocalProjectBuild = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
+
const buildPath = path.join(process.cwd(), 'out', 'build.json');
|
|
115
87
|
try {
|
|
116
|
-
const fileString =
|
|
88
|
+
const fileString = yield fs.readFile(buildPath, 'utf-8');
|
|
117
89
|
return JSON.parse(fileString);
|
|
118
90
|
}
|
|
119
|
-
catch {
|
|
120
|
-
logger_1.default.fatal('Project build not found ,
|
|
91
|
+
catch (_b) {
|
|
92
|
+
logger_1.default.fatal('Project build not found , please run "para build" to create one.');
|
|
121
93
|
}
|
|
122
|
-
};
|
|
94
|
+
});
|
|
123
95
|
exports.getLocalProjectBuild = getLocalProjectBuild;
|
|
124
96
|
//# sourceMappingURL=config.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.utils.js","sourceRoot":"","sources":["../../src/config/config.utils.ts"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,wDAAkC;AAElC,+DAA+B;AAG/B,
|
|
1
|
+
{"version":3,"file":"config.utils.js","sourceRoot":"","sources":["../../src/config/config.utils.ts"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,wDAAkC;AAElC,+DAA+B;AAG/B,yDAA4D;AAC5D,iDAKwB;AAKjB,MAAM,qBAAqB,GAAG,CACnC,sBAA8B,yCAAsB,EACrC,EAAE;IACjB,gBAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAC7C,MAAM,IAAA,iCAAyB,EAAC,mBAAmB,CAAC,CAAC;IACrD,MAAM,WAAW,GAAiB,MAAM,CAAC,MAAM,CAAC,yBAAU,CAAC,CAAC;IAC5D,MAAM,OAAO,CAAC,GAAG,CACf,WAAW,CAAC,GAAG,CAAC,CAAC,IAAgB,EAAE,EAAE,CACnC,sBAAsB,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAClD,CACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAXW,QAAA,qBAAqB,yBAWhC;AAKK,MAAM,yBAAyB,GAAG,CACvC,mBAA2B,EACZ,EAAE;IACjB,gBAAM,CAAC,KAAK,CAAC,kCAAkC,EAAE,EAAE,mBAAmB,EAAE,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LANGUAGES_SUPPORTED = void 0;
|
|
4
4
|
exports.LANGUAGES_SUPPORTED = ['typescript', 'javascript'];
|
|
5
5
|
exports.KNOWN_PACKAGE_MANAGERS = ['npm', 'pnpm', 'yarn', 'bun'];
|
|
6
|
-
exports.DEFAULT_AUTH_HOST = 'dashboard.useparagon.com';
|
|
7
6
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/helpers/constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,mBAAmB,GAAU,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AAK1D,QAAA,sBAAsB,GAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/helpers/constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,mBAAmB,GAAU,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AAK1D,QAAA,sBAAsB,GAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC"}
|
package/dist/helpers/file.d.ts
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const withUniqueFileNames: (existingNames?: string[]) => (fileName: string) => string;
|
|
3
|
-
export declare const writeSourceToFile: (filePath: string, fileName: string, sourceCode: string, extenstion?: 'd.ts' | 'js' | 'ts') => Promise<void>;
|
|
1
|
+
export declare const writeSourceToFile: (filePath: string, fileName: string, sourceCode: string) => Promise<void>;
|
package/dist/helpers/file.js
CHANGED
|
@@ -1,54 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.writeSourceToFile =
|
|
3
|
+
exports.writeSourceToFile = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const prettier_plugin_sort_imports_1 = tslib_1.__importDefault(require("@trivago/prettier-plugin-sort-imports"));
|
|
6
6
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
7
7
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
8
|
const prettier_1 = tslib_1.__importDefault(require("prettier"));
|
|
9
9
|
const prettier_plugin_organize_imports_1 = tslib_1.__importDefault(require("prettier-plugin-organize-imports"));
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
while (uniqueNames.has(getCurrentFileName(sanitizedFileName, count))) {
|
|
25
|
-
count++;
|
|
26
|
-
}
|
|
27
|
-
const newFileName = getCurrentFileName(sanitizedFileName, count);
|
|
28
|
-
uniqueNames.add(newFileName);
|
|
29
|
-
return newFileName;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
exports.withUniqueFileNames = withUniqueFileNames;
|
|
33
|
-
const writeSourceToFile = async (filePath, fileName, sourceCode, extenstion = 'ts') => {
|
|
34
|
-
let formattedCode = sourceCode;
|
|
35
|
-
const fileNamePath = path_1.default.join(filePath, `${fileName}.${extenstion}`);
|
|
36
|
-
try {
|
|
37
|
-
formattedCode = await prettier_1.default.format(sourceCode, {
|
|
38
|
-
parser: 'typescript',
|
|
39
|
-
semi: true,
|
|
40
|
-
trailingComma: 'all',
|
|
41
|
-
singleQuote: true,
|
|
42
|
-
plugins: [prettier_plugin_sort_imports_1.default, prettier_plugin_organize_imports_1.default],
|
|
43
|
-
importOrder: ['^@useparagon/(.*)$', '^[./]'],
|
|
44
|
-
importOrderSeparation: true,
|
|
45
|
-
importOrderCaseInsensitive: true,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
logger_1.default.log(`Error while formatting file (${fileNamePath}), Please fix issue in this file manually.`);
|
|
50
|
-
}
|
|
51
|
-
await fs_extra_1.default.promises.writeFile(fileNamePath, formattedCode);
|
|
52
|
-
};
|
|
10
|
+
const writeSourceToFile = (filePath, fileName, sourceCode) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
const sanitizeFileName = fileName;
|
|
12
|
+
const formattedCode = yield prettier_1.default.format(sourceCode, {
|
|
13
|
+
parser: 'typescript',
|
|
14
|
+
semi: true,
|
|
15
|
+
trailingComma: 'all',
|
|
16
|
+
singleQuote: true,
|
|
17
|
+
plugins: [prettier_plugin_sort_imports_1.default, prettier_plugin_organize_imports_1.default],
|
|
18
|
+
importOrder: ['^@useparagon/(.*)$', '^[./]'],
|
|
19
|
+
importOrderSeparation: true,
|
|
20
|
+
importOrderCaseInsensitive: true,
|
|
21
|
+
});
|
|
22
|
+
yield fs_extra_1.default.promises.writeFile(path_1.default.join(filePath, `${sanitizeFileName}.ts`), formattedCode);
|
|
23
|
+
});
|
|
53
24
|
exports.writeSourceToFile = writeSourceToFile;
|
|
54
25
|
//# sourceMappingURL=file.js.map
|
package/dist/helpers/file.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/helpers/file.ts"],"names":[],"mappings":";;;;AAAA,iHAA0E;AAC1E,gEAA0B;AAC1B,wDAAwB;AACxB,gEAAgC;AAChC,gHAAoE;
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/helpers/file.ts"],"names":[],"mappings":";;;;AAAA,iHAA0E;AAC1E,gEAA0B;AAC1B,wDAAwB;AACxB,gEAAgC;AAChC,gHAAoE;AAQ7D,MAAM,iBAAiB,GAAG,CAC/B,QAAgB,EAChB,QAAgB,EAChB,UAAkB,EACH,EAAE;IACjB,MAAM,gBAAgB,GAAW,QAAQ,CAAC;IAE1C,MAAM,aAAa,GAAW,MAAM,kBAAQ,CAAC,MAAM,CAAC,UAAU,EAAE;QAC9D,MAAM,EAAE,YAAY;QACpB,IAAI,EAAE,IAAI;QACV,aAAa,EAAE,KAAK;QACpB,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,CAAC,sCAAqB,EAAE,0CAAoB,CAAC;QAEtD,WAAW,EAAE,CAAC,oBAAoB,EAAE,OAAO,CAAC;QAC5C,qBAAqB,EAAE,IAAI;QAC3B,0BAA0B,EAAE,IAAI;KACjC,CAAC,CAAC;IAEH,MAAM,kBAAE,CAAC,QAAQ,CAAC,SAAS,CACzB,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,gBAAgB,KAAK,CAAC,EAC7C,aAAa,CACd,CAAC;AACJ,CAAC,CAAA,CAAC;AAvBW,QAAA,iBAAiB,qBAuB5B"}
|
package/dist/helpers/strings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.wrapMultilineString = exports.capitalizeFirstLetter = void 0;
|
|
4
4
|
const capitalizeFirstLetter = (value) => {
|
|
5
5
|
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
6
6
|
};
|
|
@@ -9,37 +9,4 @@ const wrapMultilineString = (value) => {
|
|
|
9
9
|
return '`' + value + '`';
|
|
10
10
|
};
|
|
11
11
|
exports.wrapMultilineString = wrapMultilineString;
|
|
12
|
-
const sanitizeString = (value) => {
|
|
13
|
-
if (!value) {
|
|
14
|
-
return `''`;
|
|
15
|
-
}
|
|
16
|
-
const trimmedValue = value.trim();
|
|
17
|
-
const containDoubleQuotes = trimmedValue.includes('"');
|
|
18
|
-
const containSingleQuotes = trimmedValue.includes("'");
|
|
19
|
-
const containTemplateQuotes = trimmedValue.includes('`');
|
|
20
|
-
const isMultilineString = Boolean(trimmedValue.match(/\n/g));
|
|
21
|
-
if (isMultilineString && !containTemplateQuotes) {
|
|
22
|
-
return (0, exports.wrapMultilineString)(trimmedValue);
|
|
23
|
-
}
|
|
24
|
-
else if (isMultilineString) {
|
|
25
|
-
const multiLines = trimmedValue.split(/\n/);
|
|
26
|
-
return (0, exports.sanitizeString)(multiLines.map((line) => (0, exports.sanitizeString)(line)).join('+'));
|
|
27
|
-
}
|
|
28
|
-
else if (!containDoubleQuotes &&
|
|
29
|
-
!containSingleQuotes &&
|
|
30
|
-
!containTemplateQuotes) {
|
|
31
|
-
return `'${trimmedValue}'`;
|
|
32
|
-
}
|
|
33
|
-
else if (containDoubleQuotes && !containSingleQuotes) {
|
|
34
|
-
return `'${trimmedValue}'`;
|
|
35
|
-
}
|
|
36
|
-
else if (containSingleQuotes && !containDoubleQuotes) {
|
|
37
|
-
return `"${trimmedValue}"`;
|
|
38
|
-
}
|
|
39
|
-
else if (!containTemplateQuotes) {
|
|
40
|
-
return (0, exports.wrapMultilineString)(trimmedValue);
|
|
41
|
-
}
|
|
42
|
-
return `'${trimmedValue.replace(/\'/g, "\\'")}'`;
|
|
43
|
-
};
|
|
44
|
-
exports.sanitizeString = sanitizeString;
|
|
45
12
|
//# sourceMappingURL=strings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src/helpers/strings.ts"],"names":[],"mappings":";;;AAMO,MAAM,qBAAqB,GAAG,CAAC,KAAa,EAAE,EAAE;IACrD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC,CAAC;AAFW,QAAA,qBAAqB,yBAEhC;AAOK,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAU,EAAE;IAC3D,OAAO,GAAG,GAAG,KAAK,GAAG,GAAG,CAAC;AAC3B,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B
|
|
1
|
+
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src/helpers/strings.ts"],"names":[],"mappings":";;;AAMO,MAAM,qBAAqB,GAAG,CAAC,KAAa,EAAE,EAAE;IACrD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC,CAAC;AAFW,QAAA,qBAAqB,yBAEhC;AAOK,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAU,EAAE;IAC3D,OAAO,GAAG,GAAG,KAAK,GAAG,GAAG,CAAC;AAC3B,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B"}
|
package/dist/index.js
CHANGED
|
@@ -4,16 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const commander = tslib_1.__importStar(require("commander"));
|
|
6
6
|
const command_loader_1 = require("./commands/command.loader");
|
|
7
|
-
const logger_1 = tslib_1.__importDefault(require("./logger"));
|
|
8
|
-
process
|
|
9
|
-
.on('unhandledRejection', (reason) => {
|
|
10
|
-
logger_1.default.log(reason);
|
|
11
|
-
process.exit(1);
|
|
12
|
-
})
|
|
13
|
-
.on('uncaughtException', (err) => {
|
|
14
|
-
logger_1.default.log(err);
|
|
15
|
-
process.exit(1);
|
|
16
|
-
});
|
|
17
7
|
const program = commander.program
|
|
18
8
|
.version(require('../package.json').version, '-v, --version', 'Output the current version.')
|
|
19
9
|
.usage('<command> [options]')
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAEA,6DAAuC;AAEvC,8DAA0D;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAEA,6DAAuC;AAEvC,8DAA0D;AAE1D,MAAM,OAAO,GAAsB,SAAS,CAAC,OAAO;KACjD,OAAO,CACN,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,EAClC,eAAe,EACf,6BAA6B,CAC9B;KACA,KAAK,CAAC,qBAAqB,CAAC;KAC5B,UAAU,CAAC,YAAY,EAAE,2BAA2B,CAAC,CAAC;AAGzD,8BAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAK5B,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED,kBAAe,OAAO,CAAC"}
|
package/dist/logger/logger.js
CHANGED
|
@@ -15,11 +15,7 @@ var LOG_LEVEL;
|
|
|
15
15
|
const logWithColor = (logLevel, ...messages) => {
|
|
16
16
|
let completeMessage = '';
|
|
17
17
|
for (const message of messages) {
|
|
18
|
-
if (message
|
|
19
|
-
completeMessage += `${message.stack || message.message}`;
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
else if (typeof message === 'object') {
|
|
18
|
+
if (typeof message === 'object') {
|
|
23
19
|
completeMessage += ` ${JSON.stringify(message, null, 2)}`;
|
|
24
20
|
continue;
|
|
25
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":";;;AAAA,0DAA0B;AAuC1B,IAAK,SAUJ;AAVD,WAAK,SAAS;IACZ,2CAAK,CAAA;IAEL,2CAAK,CAAA;IACL,yCAAI,CAAA;IACJ,uCAAG,CAAA;IACH,+CAAO,CAAA;IACP,+CAAO,CAAA;IAEP,2CAAK,CAAA;AACP,CAAC,EAVI,SAAS,KAAT,SAAS,QAUb;AAOD,MAAM,YAAY,GAAG,CAAC,QAAmB,EAAE,GAAG,QAAe,EAAQ,EAAE;IACrE,IAAI,eAAe,GAAW,EAAE,CAAC;IAEjC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger/logger.ts"],"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incremental": true,
|
|
14
13
|
"isolatedModules": false,
|
|
15
14
|
"jsx": "react",
|
|
16
15
|
"module": "commonjs",
|
|
@@ -19,7 +18,7 @@
|
|
|
19
18
|
"noImplicitAny": false,
|
|
20
19
|
"noImplicitReturns": true,
|
|
21
20
|
"noImplicitThis": true,
|
|
22
|
-
"noUnusedLocals":
|
|
21
|
+
"noUnusedLocals": true,
|
|
23
22
|
"noUnusedParameters": false,
|
|
24
23
|
"removeComments": true,
|
|
25
24
|
"resolveJsonModule": true,
|
|
@@ -31,4 +30,4 @@
|
|
|
31
30
|
"baseUrl": "./",
|
|
32
31
|
"rootDir": "src"
|
|
33
32
|
}
|
|
34
|
-
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
description: 'Slack Integration',
|
|
3
|
+
overviewText: `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
4
|
+
|
|
5
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
6
|
+
|
|
7
|
+
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
8
|
+
|
|
9
|
+
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.`,
|
|
10
|
+
scopes: 'channel:read',
|
|
11
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { EventStep, FunctionStep, Workflow } from '@useparagon/core';
|
|
2
|
+
import { IContext } from '@useparagon/core/execution';
|
|
3
|
+
|
|
4
|
+
import event from '../../../events/hello';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* example workflow triggered by an app event
|
|
8
|
+
*/
|
|
9
|
+
export default class ExampleWorkflow extends Workflow {
|
|
10
|
+
/**
|
|
11
|
+
* defines the workflow
|
|
12
|
+
* @param integration
|
|
13
|
+
* @param context
|
|
14
|
+
* @param user
|
|
15
|
+
*/
|
|
16
|
+
define(integration, context) {
|
|
17
|
+
const trigger = new EventStep(event);
|
|
18
|
+
const fn = new FunctionStep({
|
|
19
|
+
code: (parameters) => {
|
|
20
|
+
return parameters.message;
|
|
21
|
+
},
|
|
22
|
+
parameters: {
|
|
23
|
+
message: context.getOutput(trigger)?.message,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
trigger.nextStep(fn);
|
|
28
|
+
return this.register({ trigger, fn });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IEventInit } from '@useparagon/core/event';
|
|
2
|
+
|
|
3
|
+
type EventSchema = {
|
|
4
|
+
message: string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const event: IEventInit<EventSchema> = {
|
|
8
|
+
/**
|
|
9
|
+
* name of event
|
|
10
|
+
*/
|
|
11
|
+
name: 'hello-world',
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* schema of event payload
|
|
15
|
+
*/
|
|
16
|
+
schema: {
|
|
17
|
+
message: 'Hello,world',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default event;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IIntegrationConfig } from '@useparagon/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* configuration for a dummy integration
|
|
5
|
+
*/
|
|
6
|
+
const config: IIntegrationConfig = {
|
|
7
|
+
description: 'A dummy BYO integration.',
|
|
8
|
+
overviewText: `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
9
|
+
|
|
10
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
11
|
+
|
|
12
|
+
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
13
|
+
|
|
14
|
+
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.`,
|
|
15
|
+
scopes: 'user:read',
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default config;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { EventStep, FunctionStep, Workflow } from '@useparagon/core';
|
|
2
|
+
import { IContext } from '@useparagon/core/execution';
|
|
3
|
+
|
|
4
|
+
import event from '../../../events/hello-world';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* example workflow triggered by an app event
|
|
8
|
+
*/
|
|
9
|
+
export default class MyWorkflow extends Workflow<any> {
|
|
10
|
+
/**
|
|
11
|
+
* defines the workflow
|
|
12
|
+
* @param integration
|
|
13
|
+
* @param context
|
|
14
|
+
* @param user
|
|
15
|
+
*/
|
|
16
|
+
define(_integration: any, context: IContext) {
|
|
17
|
+
const trigger = new EventStep(event);
|
|
18
|
+
const fn = new FunctionStep({
|
|
19
|
+
code: (parameters: Record<string, unknown>) => {
|
|
20
|
+
return parameters.message;
|
|
21
|
+
},
|
|
22
|
+
parameters: {
|
|
23
|
+
message: context.getOutput(trigger)?.message,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
trigger.nextStep(fn);
|
|
28
|
+
return this.register({ trigger, fn });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"allowUnreachableCode": false,
|
|
6
|
+
"alwaysStrict": true,
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"emitDecoratorMetadata": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"experimentalDecorators": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"importHelpers": true,
|
|
13
|
+
"isolatedModules": false,
|
|
14
|
+
"jsx": "react",
|
|
15
|
+
"module": "commonjs",
|
|
16
|
+
"moduleResolution": "node",
|
|
17
|
+
"noFallthroughCasesInSwitch": true,
|
|
18
|
+
"noImplicitAny": false,
|
|
19
|
+
"noImplicitReturns": true,
|
|
20
|
+
"noImplicitThis": true,
|
|
21
|
+
"noUnusedLocals": true,
|
|
22
|
+
"noUnusedParameters": true,
|
|
23
|
+
"removeComments": true,
|
|
24
|
+
"resolveJsonModule": true,
|
|
25
|
+
"sourceMap": true,
|
|
26
|
+
"strict": true,
|
|
27
|
+
"strictNullChecks": true,
|
|
28
|
+
"target": "es6",
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|