plugin-workflow-portainer 0.0.0-stage → 0.1.1
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/LICENSE +176 -0
- package/README.md +31 -3
- package/client-v2.js +1 -0
- package/client.js +1 -0
- package/dist/client/127.5012da93825a6e5c.js +10 -0
- package/dist/client/57.ace9538136438718.js +10 -0
- package/dist/client/65.ec4a55173511c06d.js +10 -0
- package/dist/client/660.546c702d1ddf7eff.js +10 -0
- package/dist/client/index.js +10 -0
- package/dist/client-v2/127.0ec4dce7b13750e9.js +10 -0
- package/dist/client-v2/57.e7cfc50fb651ac14.js +10 -0
- package/dist/client-v2/65.9c745ea32ac96e98.js +10 -0
- package/dist/client-v2/660.29ae3c3b4040039d.js +10 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/externalVersion.js +20 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +151 -0
- package/dist/locale/vi-VN.json +151 -0
- package/dist/locale/zh-CN.json +151 -0
- package/dist/node_modules/joi/dist/joi-browser.min.js +1 -0
- package/dist/node_modules/joi/lib/annotate.js +175 -0
- package/dist/node_modules/joi/lib/base.js +1069 -0
- package/dist/node_modules/joi/lib/cache.js +143 -0
- package/dist/node_modules/joi/lib/common.js +216 -0
- package/dist/node_modules/joi/lib/compile.js +283 -0
- package/dist/node_modules/joi/lib/errors.js +271 -0
- package/dist/node_modules/joi/lib/extend.js +312 -0
- package/dist/node_modules/joi/lib/index.d.ts +2365 -0
- package/dist/node_modules/joi/lib/index.js +1 -0
- package/dist/node_modules/joi/lib/manifest.js +476 -0
- package/dist/node_modules/joi/lib/messages.js +207 -0
- package/dist/node_modules/joi/lib/modify.js +267 -0
- package/dist/node_modules/joi/lib/ref.js +414 -0
- package/dist/node_modules/joi/lib/schemas.js +302 -0
- package/dist/node_modules/joi/lib/state.js +166 -0
- package/dist/node_modules/joi/lib/template.js +463 -0
- package/dist/node_modules/joi/lib/trace.js +346 -0
- package/dist/node_modules/joi/lib/types/alternatives.js +364 -0
- package/dist/node_modules/joi/lib/types/any.js +174 -0
- package/dist/node_modules/joi/lib/types/array.js +809 -0
- package/dist/node_modules/joi/lib/types/binary.js +100 -0
- package/dist/node_modules/joi/lib/types/boolean.js +150 -0
- package/dist/node_modules/joi/lib/types/date.js +233 -0
- package/dist/node_modules/joi/lib/types/function.js +93 -0
- package/dist/node_modules/joi/lib/types/keys.js +1084 -0
- package/dist/node_modules/joi/lib/types/link.js +184 -0
- package/dist/node_modules/joi/lib/types/number.js +363 -0
- package/dist/node_modules/joi/lib/types/object.js +22 -0
- package/dist/node_modules/joi/lib/types/string.js +850 -0
- package/dist/node_modules/joi/lib/types/symbol.js +102 -0
- package/dist/node_modules/joi/lib/validator.js +750 -0
- package/dist/node_modules/joi/lib/values.js +263 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.d.ts +60 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.js +225 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/package.json +30 -0
- package/dist/node_modules/joi/package.json +1 -0
- package/dist/server/actions/portainer.js +192 -0
- package/dist/server/collections/portainer-instances.js +54 -0
- package/dist/server/index.js +54 -0
- package/dist/server/instructions/PortainerStackControlInstruction.js +156 -0
- package/dist/server/instructions/PortainerStackRedeployInstruction.js +254 -0
- package/dist/server/instructions/helpers.js +211 -0
- package/dist/server/plugin.js +170 -0
- package/dist/server/services/PortainerClient.js +497 -0
- package/dist/shared/collection.js +57 -0
- package/dist/shared/constants.js +66 -0
- package/dist/shared/env.js +221 -0
- package/dist/shared/types.js +24 -0
- package/package.json +50 -4
- package/server.js +1 -0
- package/src/client/index.tsx +50 -0
- package/src/client/instructions.tsx +76 -0
- package/src/client-v2/__tests__/workflow-registration.test.tsx +132 -0
- package/src/client-v2/components/ControlFieldset.tsx +46 -0
- package/src/client-v2/components/PortainerEnvEditor.tsx +223 -0
- package/src/client-v2/components/PortainerSettingsPage.tsx +671 -0
- package/src/client-v2/components/PortainerTargetFields.tsx +317 -0
- package/src/client-v2/components/RedeployFieldset.tsx +123 -0
- package/src/client-v2/index.tsx +50 -0
- package/src/client-v2/instructions.tsx +162 -0
- package/src/client-v2/locale.ts +24 -0
- package/src/index.ts +11 -0
- package/src/locale/en-US.json +151 -0
- package/src/locale/vi-VN.json +151 -0
- package/src/locale/zh-CN.json +151 -0
- package/src/server/__tests__/portainer-workflow.test.ts +455 -0
- package/src/server/actions/portainer.ts +196 -0
- package/src/server/collections/portainer-instances.ts +34 -0
- package/src/server/index.ts +13 -0
- package/src/server/instructions/PortainerStackControlInstruction.ts +139 -0
- package/src/server/instructions/PortainerStackRedeployInstruction.ts +255 -0
- package/src/server/instructions/helpers.ts +237 -0
- package/src/server/plugin.ts +167 -0
- package/src/server/services/PortainerClient.ts +589 -0
- package/src/shared/collection.ts +32 -0
- package/src/shared/constants.ts +25 -0
- package/src/shared/env.ts +228 -0
- package/src/shared/types.ts +105 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const Assert = require('@hapi/hoek/lib/assert');
|
|
4
|
+
|
|
5
|
+
const Any = require('./any');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const internals = {};
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
internals.Map = class extends Map {
|
|
12
|
+
|
|
13
|
+
slice() {
|
|
14
|
+
|
|
15
|
+
return new internals.Map(this);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
module.exports = Any.extend({
|
|
21
|
+
|
|
22
|
+
type: 'symbol',
|
|
23
|
+
|
|
24
|
+
terms: {
|
|
25
|
+
|
|
26
|
+
map: { init: new internals.Map() }
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
coerce: {
|
|
30
|
+
method(value, { schema, error }) {
|
|
31
|
+
|
|
32
|
+
const lookup = schema.$_terms.map.get(value);
|
|
33
|
+
if (lookup) {
|
|
34
|
+
value = lookup;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!schema._flags.only ||
|
|
38
|
+
typeof value === 'symbol') {
|
|
39
|
+
|
|
40
|
+
return { value };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return { value, errors: error('symbol.map', { map: schema.$_terms.map }) };
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
validate(value, { error }) {
|
|
48
|
+
|
|
49
|
+
if (typeof value !== 'symbol') {
|
|
50
|
+
return { value, errors: error('symbol.base') };
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
rules: {
|
|
55
|
+
map: {
|
|
56
|
+
method(iterable) {
|
|
57
|
+
|
|
58
|
+
if (iterable &&
|
|
59
|
+
!iterable[Symbol.iterator] &&
|
|
60
|
+
typeof iterable === 'object') {
|
|
61
|
+
|
|
62
|
+
iterable = Object.entries(iterable);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
Assert(iterable && iterable[Symbol.iterator], 'Iterable must be an iterable or object');
|
|
66
|
+
|
|
67
|
+
const obj = this.clone();
|
|
68
|
+
|
|
69
|
+
const symbols = [];
|
|
70
|
+
for (const entry of iterable) {
|
|
71
|
+
Assert(entry && entry[Symbol.iterator], 'Entry must be an iterable');
|
|
72
|
+
const [key, value] = entry;
|
|
73
|
+
|
|
74
|
+
Assert(typeof key !== 'object' && typeof key !== 'function' && typeof key !== 'symbol', 'Key must not be of type object, function, or Symbol');
|
|
75
|
+
Assert(typeof value === 'symbol', 'Value must be a Symbol');
|
|
76
|
+
|
|
77
|
+
obj.$_terms.map.set(key, value);
|
|
78
|
+
symbols.push(value);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return obj.valid(...symbols);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
manifest: {
|
|
87
|
+
|
|
88
|
+
build(obj, desc) {
|
|
89
|
+
|
|
90
|
+
if (desc.map) {
|
|
91
|
+
obj = obj.map(desc.map);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return obj;
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
messages: {
|
|
99
|
+
'symbol.base': '{{#label}} must be a symbol',
|
|
100
|
+
'symbol.map': '{{#label}} must be one of {{#map}}'
|
|
101
|
+
}
|
|
102
|
+
});
|