@corva/create-app 0.62.0-1 → 0.62.0-3

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.
@@ -20,6 +20,7 @@ export const rerunCommand = new Command('rerun')
20
20
  .addOption(new Option('--assets [assets...]', 'Assets IDs list', []).conflicts('companyId'))
21
21
  .addOption(new Option('--company-id [number]', 'Company ID', []))
22
22
  .addOption(new Option('--interval [number]', 'Interval for scheduler apps (exp. 1200)'))
23
+ .addOption(new Option('--force-stream-log-type [string]', 'Force stream log type').choices(['time', 'depth']))
23
24
  .addOption(originalCwdOption)
24
25
  .action(async (dirName, options) => {
25
26
  await runFlow(RERUN_FLOW, { dirName: getRealWorkingDir(dirName, options), options });
@@ -155,7 +155,7 @@ export class Api {
155
155
  .json();
156
156
 
157
157
  if (!wells || !wells.length) {
158
- throw new StepError(`Could not found wells by asset ID - ${assetId}`);
158
+ throw new StepError(`Could not find wells by asset ID - ${assetId}`);
159
159
  }
160
160
 
161
161
  return wells;
@@ -58,6 +58,8 @@ const ensureAppIsInTheStream = async (assetId, stream, appId, api, manifest, cor
58
58
 
59
59
  const newConnection = await api.connectAppToStream(appId, stream.id, manifest.manifest.settings.app);
60
60
 
61
+ stream.app_connections.push(newConnection);
62
+
61
63
  logger.write(
62
64
  `\n\n${chalk.black.underline.bold(
63
65
  `Added app to the stream: ${corvaUrl}/config/streams/${stream.id} App: ${corvaUrl}/config/streams/${stream.id}/apps/${newConnection.id}, Asset ID: ${assetId}`,
@@ -11,12 +11,17 @@ export const PREPARE_WELL_AND_STREAM_TASK_STEP = {
11
11
  */
12
12
  fn: async (context) => {
13
13
  let { assets } = context;
14
- const { api, manifest } = context;
14
+ const {
15
+ api,
16
+ manifest,
17
+ options: { forceStreamLogType },
18
+ } = context;
15
19
 
16
20
  const { mappedAssetsToWells, mappedAssetsToStreams, assetsToDelete } = await prepareWellAndStreamData(
17
21
  assets,
18
22
  api,
19
23
  manifest,
24
+ forceStreamLogType,
20
25
  );
21
26
 
22
27
  if (assetsToDelete.length) {
@@ -37,14 +42,17 @@ export const PREPARE_WELL_AND_STREAM_TASK_STEP = {
37
42
  * CLI prompt question - Please choose the stream
38
43
  *
39
44
  * @param {object[]} streams
45
+ * @param {('time'|'depth')} [forceStreamLogType]
40
46
  *
41
47
  * @returns {Promise<object>}
42
48
  */
43
- const getStreamWithPrompt = async (streams) => {
44
- const choices = streams.map((stream) => {
49
+ const getStreamWithPrompt = async (streams, forceStreamLogType) => {
50
+ const _streams = forceStreamLogType ? streams.filter((stream) => stream.log_type === forceStreamLogType) : streams;
51
+
52
+ const choices = _streams.map((stream) => {
45
53
  return {
46
54
  value: stream,
47
- name: stream.name,
55
+ name: `${stream.name} (${stream.log_type})`,
48
56
  };
49
57
  });
50
58
 
@@ -128,10 +136,11 @@ const getWellWithPrompt = async (wells, api) => {
128
136
  * @param {string[]} assets
129
137
  * @param {import('../lib/api').Api} api
130
138
  * @param {object} manifest
139
+ * @param {('time'|'depth')} [forceStreamLogType]
131
140
  *
132
141
  * @returns {Promise<object>}
133
142
  */
134
- const prepareWellAndStreamData = async (assets, api, manifest) => {
143
+ const prepareWellAndStreamData = async (assets, api, manifest, forceStreamLogType) => {
135
144
  const mappedAssetsToWells = new Map();
136
145
  const mappedAssetsToStreams = new Map();
137
146
  const assetsToDelete = [];
@@ -155,7 +164,7 @@ const prepareWellAndStreamData = async (assets, api, manifest) => {
155
164
  throw new Error(`Could not found streams in Complete status for the asset ID - ${assetId}`);
156
165
  }
157
166
 
158
- const stream = await getStreamWithPrompt(streams);
167
+ const stream = await getStreamWithPrompt(streams, forceStreamLogType);
159
168
 
160
169
  mappedAssetsToStreams.set(stream.asset_id, stream);
161
170
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/create-app",
3
- "version": "0.62.0-1",
3
+ "version": "0.62.0-3",
4
4
  "private": false,
5
5
  "description": "Create an app to use it in CORVA.AI",
6
6
  "keywords": [
@@ -40,22 +40,21 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "archiver": "^5.3.0",
43
- "chalk": "4.1.0",
43
+ "chalk": "^4.1.0",
44
44
  "commander": "^9.1.0",
45
45
  "cross-spawn": "^7.0.3",
46
46
  "debug": "^4.3.4",
47
47
  "dotenv": "^16.0.0",
48
- "eslint-plugin-react": "^7.32.0",
49
48
  "figlet": "^1.5.0",
50
49
  "form-data": "^4.0.0",
51
- "fs-extra": "9.0.1",
50
+ "fs-extra": "^9.0.1",
52
51
  "glob": "^8.0.1",
53
52
  "got": "^12.5.1",
54
53
  "inquirer": "^8.2.3",
55
54
  "is-glob": "^4.0.3",
56
55
  "lodash": "^4.17.21",
57
56
  "npm-api": "^1.0.0",
58
- "semver": "7.3.2",
57
+ "semver": "^7.3.2",
59
58
  "terminal-link": "^3.0.0"
60
59
  },
61
60
  "devDependencies": {
@@ -80,6 +79,7 @@
80
79
  "eslint-plugin-jest": "^27.1.5",
81
80
  "eslint-plugin-jsx-a11y": "^6.7.1",
82
81
  "eslint-plugin-prettier": "^4.2.1",
82
+ "eslint-plugin-react": "^7.32.0",
83
83
  "eslint-plugin-react-hooks": "^4.6.0",
84
84
  "eslint-plugin-require-sort": "^1.3.0",
85
85
  "husky": "^8.0.2",