@corva/create-app 0.62.0-2 → 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.
package/lib/commands/rerun.js
CHANGED
|
@@ -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 });
|
package/lib/flows/lib/api.js
CHANGED
|
@@ -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 {
|
|
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
|
|
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) {
|