@teambit/envs 0.0.881 → 0.0.882
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/components/env-console/env-console.js +1 -10
- package/dist/components/env-console/env-console.js.map +1 -1
- package/dist/components/env-console/index.js +0 -3
- package/dist/components/env-console/index.js.map +1 -1
- package/dist/components/env-overview/env-overview.js +0 -8
- package/dist/components/env-overview/env-overview.js.map +1 -1
- package/dist/components/env-overview/index.js +0 -3
- package/dist/components/env-overview/index.js.map +1 -1
- package/dist/components/index.js +0 -3
- package/dist/components/index.js.map +1 -1
- package/dist/context/context.js +1 -17
- package/dist/context/context.js.map +1 -1
- package/dist/context/index.js +0 -3
- package/dist/context/index.js.map +1 -1
- package/dist/env-definition.js +3 -11
- package/dist/env-definition.js.map +1 -1
- package/dist/env-service-list.js +0 -6
- package/dist/env-service-list.js.map +1 -1
- package/dist/env.composition.js +0 -6
- package/dist/env.composition.js.map +1 -1
- package/dist/env.fragment.js +0 -11
- package/dist/env.fragment.js.map +1 -1
- package/dist/environment.js +1 -1
- package/dist/environment.js.map +1 -1
- package/dist/environments.aspect.js +0 -5
- package/dist/environments.aspect.js.map +1 -1
- package/dist/environments.graphql.js +0 -5
- package/dist/environments.graphql.js.map +1 -1
- package/dist/environments.main.runtime.js +52 -194
- package/dist/environments.main.runtime.js.map +1 -1
- package/dist/envs.cmd.js +7 -46
- package/dist/envs.cmd.js.map +1 -1
- package/dist/exceptions/env-not-configured-for-component.js +0 -6
- package/dist/exceptions/env-not-configured-for-component.js.map +1 -1
- package/dist/exceptions/env-not-found-in-runtime.js +0 -6
- package/dist/exceptions/env-not-found-in-runtime.js.map +1 -1
- package/dist/exceptions/env-not-found.js +0 -7
- package/dist/exceptions/env-not-found.js.map +1 -1
- package/dist/exceptions/index.js +0 -9
- package/dist/exceptions/index.js.map +1 -1
- package/dist/index.js +0 -25
- package/dist/index.js.map +1 -1
- package/dist/runtime/env-runtime.js +0 -3
- package/dist/runtime/env-runtime.js.map +1 -1
- package/dist/runtime/envs-execution-result.js +2 -13
- package/dist/runtime/envs-execution-result.js.map +1 -1
- package/dist/runtime/index.js +0 -6
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/runtime.js +3 -29
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/services/index.js +0 -9
- package/dist/services/index.js.map +1 -1
- package/package-tar/teambit-envs-0.0.882.tgz +0 -0
- package/package.json +18 -18
- package/{preview-1666409808293.js → preview-1666496165706.js} +2 -2
- package/package-tar/teambit-envs-0.0.881.tgz +0 -0
package/dist/index.js
CHANGED
@@ -62,29 +62,21 @@ Object.defineProperty(exports, "ExecutionContext", {
|
|
62
62
|
}
|
63
63
|
});
|
64
64
|
exports.default = void 0;
|
65
|
-
|
66
65
|
function _environments() {
|
67
66
|
const data = require("./environments.aspect");
|
68
|
-
|
69
67
|
_environments = function () {
|
70
68
|
return data;
|
71
69
|
};
|
72
|
-
|
73
70
|
return data;
|
74
71
|
}
|
75
|
-
|
76
72
|
function _environmentsMain() {
|
77
73
|
const data = require("./environments.main.runtime");
|
78
|
-
|
79
74
|
_environmentsMain = function () {
|
80
75
|
return data;
|
81
76
|
};
|
82
|
-
|
83
77
|
return data;
|
84
78
|
}
|
85
|
-
|
86
79
|
var _environment = require("./environment");
|
87
|
-
|
88
80
|
Object.keys(_environment).forEach(function (key) {
|
89
81
|
if (key === "default" || key === "__esModule") return;
|
90
82
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
@@ -96,59 +88,42 @@ Object.keys(_environment).forEach(function (key) {
|
|
96
88
|
}
|
97
89
|
});
|
98
90
|
});
|
99
|
-
|
100
91
|
function _context() {
|
101
92
|
const data = require("./context");
|
102
|
-
|
103
93
|
_context = function () {
|
104
94
|
return data;
|
105
95
|
};
|
106
|
-
|
107
96
|
return data;
|
108
97
|
}
|
109
|
-
|
110
98
|
function _services() {
|
111
99
|
const data = require("./services");
|
112
|
-
|
113
100
|
_services = function () {
|
114
101
|
return data;
|
115
102
|
};
|
116
|
-
|
117
103
|
return data;
|
118
104
|
}
|
119
|
-
|
120
105
|
function _envRuntime() {
|
121
106
|
const data = require("./runtime/env-runtime");
|
122
|
-
|
123
107
|
_envRuntime = function () {
|
124
108
|
return data;
|
125
109
|
};
|
126
|
-
|
127
110
|
return data;
|
128
111
|
}
|
129
|
-
|
130
112
|
function _envsExecutionResult() {
|
131
113
|
const data = require("./runtime/envs-execution-result");
|
132
|
-
|
133
114
|
_envsExecutionResult = function () {
|
134
115
|
return data;
|
135
116
|
};
|
136
|
-
|
137
117
|
return data;
|
138
118
|
}
|
139
|
-
|
140
119
|
function _envDefinition() {
|
141
120
|
const data = require("./env-definition");
|
142
|
-
|
143
121
|
_envDefinition = function () {
|
144
122
|
return data;
|
145
123
|
};
|
146
|
-
|
147
124
|
return data;
|
148
125
|
}
|
149
|
-
|
150
126
|
var _default = _environments().EnvsAspect;
|
151
|
-
|
152
127
|
exports.default = _default;
|
153
128
|
|
154
129
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["EnvsAspect"],"sources":["index.ts"],"sourcesContent":["import { EnvsAspect } from './environments.aspect';\n\nexport { DEFAULT_ENV } from './environments.main.runtime';\nexport * from './environment';\nexport { ExecutionContext } from './context';\nexport { EnvService, ConcreteService } from './services';\nexport { EnvRuntime } from './runtime/env-runtime';\nexport type { EnvsMain, EnvTransformer, Descriptor } from './environments.main.runtime';\nexport { EnvsAspect };\nexport { EnvsExecutionResult } from './runtime/envs-execution-result';\nexport type { EnvServiceList } from './env-service-list';\nexport { EnvDefinition } from './env-definition';\nexport default EnvsAspect;\n"],"mappings":"
|
1
|
+
{"version":3,"names":["EnvsAspect"],"sources":["index.ts"],"sourcesContent":["import { EnvsAspect } from './environments.aspect';\n\nexport { DEFAULT_ENV } from './environments.main.runtime';\nexport * from './environment';\nexport { ExecutionContext } from './context';\nexport { EnvService, ConcreteService } from './services';\nexport { EnvRuntime } from './runtime/env-runtime';\nexport type { EnvsMain, EnvTransformer, Descriptor } from './environments.main.runtime';\nexport { EnvsAspect };\nexport { EnvsExecutionResult } from './runtime/envs-execution-result';\nexport type { EnvServiceList } from './env-service-list';\nexport { EnvDefinition } from './env-definition';\nexport default EnvsAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAiD,eAClCA,0BAAU;AAAA"}
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.EnvRuntime = void 0;
|
7
|
-
|
8
7
|
/**
|
9
8
|
* env runtime is an instance which represent the given env in a
|
10
9
|
*/
|
@@ -31,9 +30,7 @@ class EnvRuntime {
|
|
31
30
|
this.components = components;
|
32
31
|
this.envAspectDefinition = envAspectDefinition;
|
33
32
|
}
|
34
|
-
|
35
33
|
}
|
36
|
-
|
37
34
|
exports.EnvRuntime = EnvRuntime;
|
38
35
|
|
39
36
|
//# sourceMappingURL=env-runtime.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["EnvRuntime","constructor","id","env","components","envAspectDefinition"],"sources":["env-runtime.ts"],"sourcesContent":["import { AspectDefinition } from '@teambit/aspect-loader';\nimport { Component } from '@teambit/component';\n\nimport { Environment } from '../environment';\n\n/**\n * env runtime is an instance which represent the given env in a\n */\nexport class EnvRuntime {\n constructor(\n /**\n * ID of the wrapping extension.\n */\n readonly id: string,\n\n /**\n * environment\n */\n readonly env: Environment,\n\n /**\n * components to be loaded in the environment\n */\n readonly components: Component[],\n\n /**\n * Aspect definition of the env.\n */\n readonly envAspectDefinition: AspectDefinition\n ) {}\n}\n"],"mappings":"
|
1
|
+
{"version":3,"names":["EnvRuntime","constructor","id","env","components","envAspectDefinition"],"sources":["env-runtime.ts"],"sourcesContent":["import { AspectDefinition } from '@teambit/aspect-loader';\nimport { Component } from '@teambit/component';\n\nimport { Environment } from '../environment';\n\n/**\n * env runtime is an instance which represent the given env in a\n */\nexport class EnvRuntime {\n constructor(\n /**\n * ID of the wrapping extension.\n */\n readonly id: string,\n\n /**\n * environment\n */\n readonly env: Environment,\n\n /**\n * components to be loaded in the environment\n */\n readonly components: Component[],\n\n /**\n * Aspect definition of the env.\n */\n readonly envAspectDefinition: AspectDefinition\n ) {}\n}\n"],"mappings":";;;;;;AAKA;AACA;AACA;AACO,MAAMA,UAAU,CAAC;EACtBC,WAAW;EACT;AACJ;AACA;EACaC,EAAU;EAEnB;AACJ;AACA;EACaC,GAAgB;EAEzB;AACJ;AACA;EACaC,UAAuB;EAEhC;AACJ;AACA;EACaC,mBAAqC,EAC9C;IAAA,KAhBSH,EAAU,GAAVA,EAAU;IAAA,KAKVC,GAAgB,GAAhBA,GAAgB;IAAA,KAKhBC,UAAuB,GAAvBA,UAAuB;IAAA,KAKvBC,mBAAqC,GAArCA,mBAAqC;EAC7C;AACL;AAAC"}
|
@@ -4,46 +4,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.EnvsExecutionResult = void 0;
|
7
|
-
|
8
7
|
function _lodash() {
|
9
8
|
const data = require("lodash");
|
10
|
-
|
11
9
|
_lodash = function () {
|
12
10
|
return data;
|
13
11
|
};
|
14
|
-
|
15
12
|
return data;
|
16
13
|
}
|
17
|
-
|
18
14
|
class EnvsExecutionResult {
|
19
15
|
constructor(results) {
|
20
16
|
this.results = results;
|
21
17
|
}
|
22
|
-
|
23
18
|
hasErrors() {
|
24
19
|
return Boolean(this.errors.length);
|
25
20
|
}
|
21
|
+
|
26
22
|
/**
|
27
23
|
* execution errors.
|
28
24
|
*/
|
29
|
-
|
30
|
-
|
31
25
|
get errors() {
|
32
26
|
return (0, _lodash().flatten)(this.results.map(envResult => this.getErrorsOfEnv(envResult)));
|
33
27
|
}
|
34
|
-
|
35
28
|
getErrorsOfEnv(envResult) {
|
36
29
|
const execError = envResult.error;
|
37
30
|
const errors = envResult.data ? envResult.data.errors || [] : [];
|
38
31
|
if (execError) errors.push(execError);
|
39
32
|
return errors;
|
40
33
|
}
|
34
|
+
|
41
35
|
/**
|
42
36
|
* if only one error is found, throw it. otherwise, summarize the errors per env and throw the
|
43
37
|
* output
|
44
38
|
*/
|
45
|
-
|
46
|
-
|
47
39
|
throwErrorsIfExist() {
|
48
40
|
if (!this.errors || !this.errors.length) return;
|
49
41
|
if (this.errors.length === 1 && this.errors[0] instanceof Error) throw this.errors[0];
|
@@ -51,7 +43,6 @@ class EnvsExecutionResult {
|
|
51
43
|
const errorOutput = errorsPerEnvs.join('\n\n');
|
52
44
|
throw new Error(errorOutput);
|
53
45
|
}
|
54
|
-
|
55
46
|
getEnvErrorsAsString(envResult) {
|
56
47
|
const errors = this.getErrorsOfEnv(envResult);
|
57
48
|
if (!errors.length) return '';
|
@@ -59,9 +50,7 @@ class EnvsExecutionResult {
|
|
59
50
|
const errorsStr = errors.map(error => `${error.message}\n${error.stack}`).join('\n');
|
60
51
|
return `${title}\n${errorsStr}`;
|
61
52
|
}
|
62
|
-
|
63
53
|
}
|
64
|
-
|
65
54
|
exports.EnvsExecutionResult = EnvsExecutionResult;
|
66
55
|
|
67
56
|
//# sourceMappingURL=envs-execution-result.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["EnvsExecutionResult","constructor","results","hasErrors","Boolean","errors","length","flatten","map","envResult","getErrorsOfEnv","execError","error","data","push","throwErrorsIfExist","Error","errorsPerEnvs","getEnvErrorsAsString","errorOutput","join","title","env","id","errorsStr","message","stack"],"sources":["envs-execution-result.ts"],"sourcesContent":["import { flatten } from 'lodash';\n\nimport { ServiceExecutionResult } from '../services';\nimport { EnvResult } from './runtime';\n\nexport class EnvsExecutionResult<T extends ServiceExecutionResult> {\n constructor(readonly results: EnvResult<T>[]) {}\n\n hasErrors() {\n return Boolean(this.errors.length);\n }\n\n /**\n * execution errors.\n */\n get errors(): Error[] {\n return flatten(this.results.map((envResult) => this.getErrorsOfEnv(envResult)));\n }\n\n getErrorsOfEnv(envResult: EnvResult<T>): Error[] {\n const execError = envResult.error;\n const errors = envResult.data ? envResult.data.errors || [] : [];\n if (execError) errors.push(execError);\n return errors;\n }\n\n /**\n * if only one error is found, throw it. otherwise, summarize the errors per env and throw the\n * output\n */\n throwErrorsIfExist() {\n if (!this.errors || !this.errors.length) return;\n if (this.errors.length === 1 && this.errors[0] instanceof Error) throw this.errors[0];\n const errorsPerEnvs = this.results.map((envResult) => this.getEnvErrorsAsString(envResult));\n const errorOutput = errorsPerEnvs.join('\\n\\n');\n throw new Error(errorOutput);\n }\n\n getEnvErrorsAsString(envResult: EnvResult<T>): string {\n const errors = this.getErrorsOfEnv(envResult);\n if (!errors.length) return '';\n const title = `found ${errors.length} error(s) for ${envResult.env.id}`;\n const errorsStr = errors.map((error) => `${error.message}\\n${error.stack}`).join('\\n');\n return `${title}\\n${errorsStr}`;\n }\n}\n"],"mappings":"
|
1
|
+
{"version":3,"names":["EnvsExecutionResult","constructor","results","hasErrors","Boolean","errors","length","flatten","map","envResult","getErrorsOfEnv","execError","error","data","push","throwErrorsIfExist","Error","errorsPerEnvs","getEnvErrorsAsString","errorOutput","join","title","env","id","errorsStr","message","stack"],"sources":["envs-execution-result.ts"],"sourcesContent":["import { flatten } from 'lodash';\n\nimport { ServiceExecutionResult } from '../services';\nimport { EnvResult } from './runtime';\n\nexport class EnvsExecutionResult<T extends ServiceExecutionResult> {\n constructor(readonly results: EnvResult<T>[]) {}\n\n hasErrors() {\n return Boolean(this.errors.length);\n }\n\n /**\n * execution errors.\n */\n get errors(): Error[] {\n return flatten(this.results.map((envResult) => this.getErrorsOfEnv(envResult)));\n }\n\n getErrorsOfEnv(envResult: EnvResult<T>): Error[] {\n const execError = envResult.error;\n const errors = envResult.data ? envResult.data.errors || [] : [];\n if (execError) errors.push(execError);\n return errors;\n }\n\n /**\n * if only one error is found, throw it. otherwise, summarize the errors per env and throw the\n * output\n */\n throwErrorsIfExist() {\n if (!this.errors || !this.errors.length) return;\n if (this.errors.length === 1 && this.errors[0] instanceof Error) throw this.errors[0];\n const errorsPerEnvs = this.results.map((envResult) => this.getEnvErrorsAsString(envResult));\n const errorOutput = errorsPerEnvs.join('\\n\\n');\n throw new Error(errorOutput);\n }\n\n getEnvErrorsAsString(envResult: EnvResult<T>): string {\n const errors = this.getErrorsOfEnv(envResult);\n if (!errors.length) return '';\n const title = `found ${errors.length} error(s) for ${envResult.env.id}`;\n const errorsStr = errors.map((error) => `${error.message}\\n${error.stack}`).join('\\n');\n return `${title}\\n${errorsStr}`;\n }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKO,MAAMA,mBAAmB,CAAmC;EACjEC,WAAW,CAAUC,OAAuB,EAAE;IAAA,KAAzBA,OAAuB,GAAvBA,OAAuB;EAAG;EAE/CC,SAAS,GAAG;IACV,OAAOC,OAAO,CAAC,IAAI,CAACC,MAAM,CAACC,MAAM,CAAC;EACpC;;EAEA;AACF;AACA;EACE,IAAID,MAAM,GAAY;IACpB,OAAO,IAAAE,iBAAO,EAAC,IAAI,CAACL,OAAO,CAACM,GAAG,CAAEC,SAAS,IAAK,IAAI,CAACC,cAAc,CAACD,SAAS,CAAC,CAAC,CAAC;EACjF;EAEAC,cAAc,CAACD,SAAuB,EAAW;IAC/C,MAAME,SAAS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
CHANGED
@@ -15,24 +15,18 @@ Object.defineProperty(exports, "Runtime", {
|
|
15
15
|
return _runtime().Runtime;
|
16
16
|
}
|
17
17
|
});
|
18
|
-
|
19
18
|
function _runtime() {
|
20
19
|
const data = require("./runtime");
|
21
|
-
|
22
20
|
_runtime = function () {
|
23
21
|
return data;
|
24
22
|
};
|
25
|
-
|
26
23
|
return data;
|
27
24
|
}
|
28
|
-
|
29
25
|
function _envRuntime() {
|
30
26
|
const data = require("./env-runtime");
|
31
|
-
|
32
27
|
_envRuntime = function () {
|
33
28
|
return data;
|
34
29
|
};
|
35
|
-
|
36
30
|
return data;
|
37
31
|
}
|
38
32
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { Runtime } from './runtime';\nexport { EnvRuntime } from './env-runtime';\n"],"mappings":"
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { Runtime } from './runtime';\nexport { EnvRuntime } from './env-runtime';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
package/dist/runtime/runtime.js
CHANGED
@@ -1,64 +1,46 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
4
|
require("core-js/modules/es.promise.js");
|
6
|
-
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
8
6
|
value: true
|
9
7
|
});
|
10
8
|
exports.Runtime = void 0;
|
11
|
-
|
12
9
|
function _component() {
|
13
10
|
const data = require("@teambit/component");
|
14
|
-
|
15
11
|
_component = function () {
|
16
12
|
return data;
|
17
13
|
};
|
18
|
-
|
19
14
|
return data;
|
20
15
|
}
|
21
|
-
|
22
16
|
function _pMapSeries() {
|
23
17
|
const data = _interopRequireDefault(require("p-map-series"));
|
24
|
-
|
25
18
|
_pMapSeries = function () {
|
26
19
|
return data;
|
27
20
|
};
|
28
|
-
|
29
21
|
return data;
|
30
22
|
}
|
31
|
-
|
32
23
|
function _exceptions() {
|
33
24
|
const data = require("../exceptions");
|
34
|
-
|
35
25
|
_exceptions = function () {
|
36
26
|
return data;
|
37
27
|
};
|
38
|
-
|
39
28
|
return data;
|
40
29
|
}
|
41
|
-
|
42
30
|
function _context() {
|
43
31
|
const data = require("../context");
|
44
|
-
|
45
32
|
_context = function () {
|
46
33
|
return data;
|
47
34
|
};
|
48
|
-
|
49
35
|
return data;
|
50
36
|
}
|
51
|
-
|
52
37
|
function _envsExecutionResult() {
|
53
38
|
const data = require("./envs-execution-result");
|
54
|
-
|
55
39
|
_envsExecutionResult = function () {
|
56
40
|
return data;
|
57
41
|
};
|
58
|
-
|
59
42
|
return data;
|
60
43
|
}
|
61
|
-
|
62
44
|
class Runtime {
|
63
45
|
constructor(
|
64
46
|
/**
|
@@ -68,43 +50,37 @@ class Runtime {
|
|
68
50
|
this.runtimeEnvs = runtimeEnvs;
|
69
51
|
this.logger = logger;
|
70
52
|
}
|
53
|
+
|
71
54
|
/**
|
72
55
|
* execute a service on a specific env.
|
73
56
|
*/
|
74
|
-
|
75
|
-
|
76
57
|
runEnv(envRuntimeId, service, options) {
|
77
58
|
const envRuntime = this.runtimeEnvs.find(runtime => {
|
78
59
|
const id = _component().ComponentID.fromString(runtime.id);
|
79
|
-
|
80
60
|
const withoutVersion = id._legacy.toStringWithoutVersion();
|
81
|
-
|
82
61
|
return withoutVersion === envRuntimeId;
|
83
62
|
});
|
84
63
|
if (!envRuntime) throw new (_exceptions().EnvNotFoundInRuntime)(envRuntimeId);
|
85
64
|
return this.run(service, options, [envRuntime]);
|
86
65
|
}
|
66
|
+
|
87
67
|
/**
|
88
68
|
* execute a service once for all environments.
|
89
69
|
*/
|
90
|
-
|
91
|
-
|
92
70
|
async runOnce(service, options) {
|
93
71
|
if (!service.runOnce) throw new Error('a service must implement `runOnce()` in order to be executed');
|
94
72
|
const envsExecutionContext = this.getEnvExecutionContext();
|
95
73
|
const serviceResult = await service.runOnce(envsExecutionContext, options);
|
96
74
|
return serviceResult;
|
97
75
|
}
|
98
|
-
|
99
76
|
getEnvExecutionContext() {
|
100
77
|
const envsExecutionContext = this.runtimeEnvs.map(env => new (_context().ExecutionContext)(this, env));
|
101
78
|
return envsExecutionContext;
|
102
79
|
}
|
80
|
+
|
103
81
|
/**
|
104
82
|
* execute a service on each one of the environments.
|
105
83
|
*/
|
106
|
-
|
107
|
-
|
108
84
|
async run(
|
109
85
|
/**
|
110
86
|
* environment service to execute.
|
@@ -136,9 +112,7 @@ class Runtime {
|
|
136
112
|
});
|
137
113
|
return new (_envsExecutionResult().EnvsExecutionResult)(contexts);
|
138
114
|
}
|
139
|
-
|
140
115
|
}
|
141
|
-
|
142
116
|
exports.Runtime = Runtime;
|
143
117
|
|
144
118
|
//# sourceMappingURL=runtime.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["Runtime","constructor","runtimeEnvs","logger","runEnv","envRuntimeId","service","options","envRuntime","find","runtime","id","ComponentID","fromString","withoutVersion","_legacy","toStringWithoutVersion","EnvNotFoundInRuntime","run","runOnce","Error","envsExecutionContext","getEnvExecutionContext","serviceResult","map","env","ExecutionContext","runtimes","errors","contexts","mapSeries","data","err","error","message","consoleFailure","name","push","EnvsExecutionResult"],"sources":["runtime.ts"],"sourcesContent":["import { Logger } from '@teambit/logger';\nimport { ComponentID } from '@teambit/component';\nimport mapSeries from 'p-map-series';\nimport { EnvNotFoundInRuntime } from '../exceptions';\nimport { ExecutionContext } from '../context';\nimport { EnvService, ServiceExecutionResult } from '../services';\nimport { EnvRuntime } from './env-runtime';\nimport { EnvsExecutionResult } from './envs-execution-result';\n\nexport interface EnvResult<T extends ServiceExecutionResult> {\n env: EnvRuntime;\n data?: T;\n error?: Error;\n}\n\nexport class Runtime {\n constructor(\n /**\n * runtime instances of the environments.\n */\n readonly runtimeEnvs: EnvRuntime[],\n\n private logger: Logger\n ) {}\n\n /**\n * execute a service on a specific env.\n */\n runEnv<T>(\n envRuntimeId: string,\n service: EnvService<T>,\n options?: { [key: string]: any }\n ): Promise<EnvsExecutionResult<T>> {\n const envRuntime = this.runtimeEnvs.find((runtime) => {\n const id = ComponentID.fromString(runtime.id);\n const withoutVersion = id._legacy.toStringWithoutVersion();\n return withoutVersion === envRuntimeId;\n });\n if (!envRuntime) throw new EnvNotFoundInRuntime(envRuntimeId);\n return this.run(service, options, [envRuntime]);\n }\n\n /**\n * execute a service once for all environments.\n */\n async runOnce<T>(service: EnvService<T>, options?: { [key: string]: any }): Promise<any> {\n if (!service.runOnce) throw new Error('a service must implement `runOnce()` in order to be executed');\n const envsExecutionContext = this.getEnvExecutionContext();\n const serviceResult = await service.runOnce(envsExecutionContext, options);\n return serviceResult;\n }\n\n getEnvExecutionContext(): ExecutionContext[] {\n const envsExecutionContext = this.runtimeEnvs.map((env) => new ExecutionContext(this, env));\n return envsExecutionContext;\n }\n\n /**\n * execute a service on each one of the environments.\n */\n async run<T>(\n /**\n * environment service to execute.\n */\n service: EnvService<T>,\n\n /**\n * options to proxy to the service upon execution.\n */\n options?: { [key: string]: any },\n runtimes?: EnvRuntime[]\n ): Promise<EnvsExecutionResult<T>> {\n if (!service.run) throw new Error('a service must implement `run()` in order to be executed');\n const errors: Error[] = [];\n const contexts: EnvResult<T>[] = await mapSeries(runtimes || this.runtimeEnvs, async (env) => {\n try {\n // @ts-ignore\n const serviceResult = await service.run(new ExecutionContext(this, env), options);\n\n return {\n env,\n data: serviceResult,\n };\n } catch (err: any) {\n this.logger.error(err.message, err);\n this.logger.consoleFailure(`service \"${service.name}\" of env \"${env.id}\" has failed. error: ${err.message}`);\n errors.push(err);\n return {\n env,\n error: err,\n };\n }\n });\n\n return new EnvsExecutionResult(contexts);\n }\n}\n"],"mappings":"
|
1
|
+
{"version":3,"names":["Runtime","constructor","runtimeEnvs","logger","runEnv","envRuntimeId","service","options","envRuntime","find","runtime","id","ComponentID","fromString","withoutVersion","_legacy","toStringWithoutVersion","EnvNotFoundInRuntime","run","runOnce","Error","envsExecutionContext","getEnvExecutionContext","serviceResult","map","env","ExecutionContext","runtimes","errors","contexts","mapSeries","data","err","error","message","consoleFailure","name","push","EnvsExecutionResult"],"sources":["runtime.ts"],"sourcesContent":["import { Logger } from '@teambit/logger';\nimport { ComponentID } from '@teambit/component';\nimport mapSeries from 'p-map-series';\nimport { EnvNotFoundInRuntime } from '../exceptions';\nimport { ExecutionContext } from '../context';\nimport { EnvService, ServiceExecutionResult } from '../services';\nimport { EnvRuntime } from './env-runtime';\nimport { EnvsExecutionResult } from './envs-execution-result';\n\nexport interface EnvResult<T extends ServiceExecutionResult> {\n env: EnvRuntime;\n data?: T;\n error?: Error;\n}\n\nexport class Runtime {\n constructor(\n /**\n * runtime instances of the environments.\n */\n readonly runtimeEnvs: EnvRuntime[],\n\n private logger: Logger\n ) {}\n\n /**\n * execute a service on a specific env.\n */\n runEnv<T>(\n envRuntimeId: string,\n service: EnvService<T>,\n options?: { [key: string]: any }\n ): Promise<EnvsExecutionResult<T>> {\n const envRuntime = this.runtimeEnvs.find((runtime) => {\n const id = ComponentID.fromString(runtime.id);\n const withoutVersion = id._legacy.toStringWithoutVersion();\n return withoutVersion === envRuntimeId;\n });\n if (!envRuntime) throw new EnvNotFoundInRuntime(envRuntimeId);\n return this.run(service, options, [envRuntime]);\n }\n\n /**\n * execute a service once for all environments.\n */\n async runOnce<T>(service: EnvService<T>, options?: { [key: string]: any }): Promise<any> {\n if (!service.runOnce) throw new Error('a service must implement `runOnce()` in order to be executed');\n const envsExecutionContext = this.getEnvExecutionContext();\n const serviceResult = await service.runOnce(envsExecutionContext, options);\n return serviceResult;\n }\n\n getEnvExecutionContext(): ExecutionContext[] {\n const envsExecutionContext = this.runtimeEnvs.map((env) => new ExecutionContext(this, env));\n return envsExecutionContext;\n }\n\n /**\n * execute a service on each one of the environments.\n */\n async run<T>(\n /**\n * environment service to execute.\n */\n service: EnvService<T>,\n\n /**\n * options to proxy to the service upon execution.\n */\n options?: { [key: string]: any },\n runtimes?: EnvRuntime[]\n ): Promise<EnvsExecutionResult<T>> {\n if (!service.run) throw new Error('a service must implement `run()` in order to be executed');\n const errors: Error[] = [];\n const contexts: EnvResult<T>[] = await mapSeries(runtimes || this.runtimeEnvs, async (env) => {\n try {\n // @ts-ignore\n const serviceResult = await service.run(new ExecutionContext(this, env), options);\n\n return {\n env,\n data: serviceResult,\n };\n } catch (err: any) {\n this.logger.error(err.message, err);\n this.logger.consoleFailure(`service \"${service.name}\" of env \"${env.id}\" has failed. error: ${err.message}`);\n errors.push(err);\n return {\n env,\n error: err,\n };\n }\n });\n\n return new EnvsExecutionResult(contexts);\n }\n}\n"],"mappings":";;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQO,MAAMA,OAAO,CAAC;EACnBC,WAAW;EACT;AACJ;AACA;EACaC,WAAyB,EAE1BC,MAAc,EACtB;IAAA,KAHSD,WAAyB,GAAzBA,WAAyB;IAAA,KAE1BC,MAAc,GAAdA,MAAc;EACrB;;EAEH;AACF;AACA;EACEC,MAAM,CACJC,YAAoB,EACpBC,OAAsB,EACtBC,OAAgC,EACC;IACjC,MAAMC,UAAU,GAAG,IAAI,CAACN,WAAW,CAACO,IAAI,CAAEC,OAAO,IAAK;MACpD,MAAMC,EAAE,GAAGC,wBAAW,CAACC,UAAU,CAACH,OAAO,CAACC,EAAE,CAAC;MAC7C,MAAMG,cAAc,GAAGH,EAAE,CAACI,OAAO,CAACC,sBAAsB,EAAE;MAC1D,OAAOF,cAAc,KAAKT,YAAY;IACxC,CAAC,CAAC;IACF,IAAI,CAACG,UAAU,EAAE,MAAM,KAAIS,kCAAo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AC8B,KAAK,CAACD,GAAG,CAACE,OAAO,EAAEF,GAAG,CAAC;QACnC,IAAI,CAAC7B,MAAM,CAACgC,cAAc,CAAE,YAAW7B,OAAO,CAAC8B,IAAK,aAAYX,GAAG,CAACd,EAAG,wBAAuBqB,GAAG,CAACE,OAAQ,EAAC,CAAC;QAC5GN,MAAM,CAACS,IAAI,CAACL,GAAG,CAAC;QAChB,OAAO;UACLP,GAAG;UACHQ,KAAK,EAAED;QACT,CAAC;MACH;IACF,CAAC,CAAC;IAEF,OAAO,KAAIM,0CAAmB,EAACT,QAAQ,CAAC;EAC1C;AACF;AAAC"}
|
package/dist/services/index.js
CHANGED
@@ -27,34 +27,25 @@ Object.defineProperty(exports, "ServiceHandler", {
|
|
27
27
|
return _serviceHandler().ServiceHandler;
|
28
28
|
}
|
29
29
|
});
|
30
|
-
|
31
30
|
function _service() {
|
32
31
|
const data = require("./service");
|
33
|
-
|
34
32
|
_service = function () {
|
35
33
|
return data;
|
36
34
|
};
|
37
|
-
|
38
35
|
return data;
|
39
36
|
}
|
40
|
-
|
41
37
|
function _concreteService() {
|
42
38
|
const data = require("./concrete-service");
|
43
|
-
|
44
39
|
_concreteService = function () {
|
45
40
|
return data;
|
46
41
|
};
|
47
|
-
|
48
42
|
return data;
|
49
43
|
}
|
50
|
-
|
51
44
|
function _serviceHandler() {
|
52
45
|
const data = require("./service-handler");
|
53
|
-
|
54
46
|
_serviceHandler = function () {
|
55
47
|
return data;
|
56
48
|
};
|
57
|
-
|
58
49
|
return data;
|
59
50
|
}
|
60
51
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { Service as EnvService, ServiceExecutionResult } from './service';\nexport { ConcreteService } from './concrete-service';\nexport { ServiceHandler } from './service-handler';\n"],"mappings":"
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { Service as EnvService, ServiceExecutionResult } from './service';\nexport { ConcreteService } from './concrete-service';\nexport { ServiceHandler } from './service-handler';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
Binary file
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@teambit/envs",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.882",
|
4
4
|
"homepage": "https://bit.dev/teambit/envs/envs",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"componentId": {
|
7
7
|
"scope": "teambit.envs",
|
8
8
|
"name": "envs",
|
9
|
-
"version": "0.0.
|
9
|
+
"version": "0.0.882"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
12
|
"graphql-tag": "2.12.1",
|
@@ -17,22 +17,22 @@
|
|
17
17
|
"@babel/runtime": "7.12.18",
|
18
18
|
"core-js": "^3.0.0",
|
19
19
|
"@teambit/harmony": "0.3.3",
|
20
|
-
"@teambit/component": "0.0.
|
21
|
-
"@teambit/builder": "0.0.
|
22
|
-
"@teambit/bundler": "0.0.
|
23
|
-
"@teambit/compiler": "0.0.
|
24
|
-
"@teambit/dependency-resolver": "0.0.
|
25
|
-
"@teambit/elements": "0.0.
|
26
|
-
"@teambit/formatter": "0.0.
|
27
|
-
"@teambit/isolator": "0.0.
|
28
|
-
"@teambit/linter": "0.0.
|
29
|
-
"@teambit/pkg": "0.0.
|
30
|
-
"@teambit/preview": "0.0.
|
31
|
-
"@teambit/schema": "0.0.
|
32
|
-
"@teambit/tester": "0.0.
|
33
|
-
"@teambit/webpack": "0.0.
|
34
|
-
"@teambit/graphql": "0.0.
|
35
|
-
"@teambit/aspect-loader": "0.0.
|
20
|
+
"@teambit/component": "0.0.882",
|
21
|
+
"@teambit/builder": "0.0.882",
|
22
|
+
"@teambit/bundler": "0.0.882",
|
23
|
+
"@teambit/compiler": "0.0.882",
|
24
|
+
"@teambit/dependency-resolver": "0.0.882",
|
25
|
+
"@teambit/elements": "0.0.335",
|
26
|
+
"@teambit/formatter": "0.0.433",
|
27
|
+
"@teambit/isolator": "0.0.882",
|
28
|
+
"@teambit/linter": "0.0.882",
|
29
|
+
"@teambit/pkg": "0.0.882",
|
30
|
+
"@teambit/preview": "0.0.882",
|
31
|
+
"@teambit/schema": "0.0.882",
|
32
|
+
"@teambit/tester": "0.0.882",
|
33
|
+
"@teambit/webpack": "0.0.882",
|
34
|
+
"@teambit/graphql": "0.0.882",
|
35
|
+
"@teambit/aspect-loader": "0.0.882",
|
36
36
|
"@teambit/bit-error": "0.0.400",
|
37
37
|
"@teambit/cli": "0.0.591",
|
38
38
|
"@teambit/legacy-bit-id": "0.0.414",
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.envs_envs@0.0.
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.envs_envs@0.0.
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.envs_envs@0.0.882/dist/env.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.envs_envs@0.0.882/dist/envs.docs.mdx';
|
3
3
|
|
4
4
|
export const compositions = [compositions_0];
|
5
5
|
export const overview = [overview_0];
|
Binary file
|