@webda/kubernetes 4.0.0-beta.2 → 4.0.0-beta.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/README.md +110 -0
- package/lib/cron.d.ts +2 -3
- package/lib/cron.d.ts.map +1 -1
- package/lib/cron.js +3 -3
- package/lib/cron.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/services/cronexporter.service.d.ts +26 -0
- package/lib/services/cronexporter.service.d.ts.map +1 -0
- package/lib/services/cronexporter.service.js +130 -0
- package/lib/services/cronexporter.service.js.map +1 -0
- package/lib/services/{kuberunner.d.ts → kuberunner.service.d.ts} +22 -10
- package/lib/services/kuberunner.service.d.ts.map +1 -0
- package/lib/services/{kuberunner.js → kuberunner.service.js} +21 -20
- package/lib/services/kuberunner.service.js.map +1 -0
- package/lib/utils/client.d.ts +9 -5
- package/lib/utils/client.d.ts.map +1 -1
- package/lib/utils/client.js +7 -6
- package/lib/utils/client.js.map +1 -1
- package/package.json +32 -43
- package/webda.module.json +194 -186
- package/lib/cron.spec.d.ts +0 -2
- package/lib/cron.spec.d.ts.map +0 -1
- package/lib/cron.spec.js +0 -38
- package/lib/cron.spec.js.map +0 -1
- package/lib/services/kuberunner.d.ts.map +0 -1
- package/lib/services/kuberunner.js.map +0 -1
- package/lib/services/kuberunner.spec.d.ts +0 -2
- package/lib/services/kuberunner.spec.d.ts.map +0 -1
- package/lib/services/kuberunner.spec.js +0 -116
- package/lib/services/kuberunner.spec.js.map +0 -1
- package/lib/shell.d.ts +0 -13
- package/lib/shell.d.ts.map +0 -1
- package/lib/shell.js +0 -53
- package/lib/shell.js.map +0 -1
- package/lib/utils/client.spec.d.ts +0 -2
- package/lib/utils/client.spec.d.ts.map +0 -1
- package/lib/utils/client.spec.js +0 -37
- package/lib/utils/client.spec.js.map +0 -1
- package/webda.shell.json +0 -10
package/package.json
CHANGED
|
@@ -1,56 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webda/kubernetes",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.4",
|
|
4
4
|
"description": "Kubernetes Helpers",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "tsc-esm",
|
|
8
|
-
"build:module": "webda build",
|
|
9
|
-
"build:watch": "webda build --watch",
|
|
10
|
-
"pretest": "npm run build",
|
|
11
|
-
"test": "c8 mocha",
|
|
12
|
-
"test:debug": "mocha --no-timeouts",
|
|
13
|
-
"run": "node core",
|
|
14
|
-
"format": "prettier --check src/**/*",
|
|
15
|
-
"lint": "eslint",
|
|
16
|
-
"lint:fix": "eslint --fix",
|
|
17
|
-
"format:fix": "prettier --write src/**/*"
|
|
18
|
-
},
|
|
19
6
|
"keywords": [
|
|
20
7
|
"webda-module"
|
|
21
8
|
],
|
|
22
9
|
"files": [
|
|
23
10
|
"lib",
|
|
24
11
|
"webda.module.json",
|
|
25
|
-
"webda.shell.json",
|
|
26
12
|
"package.json"
|
|
27
13
|
],
|
|
28
14
|
"dependencies": {
|
|
29
|
-
"@kubernetes/client-node": "^
|
|
30
|
-
"@webda/async": "
|
|
31
|
-
"@webda/
|
|
15
|
+
"@kubernetes/client-node": "^1.4.0",
|
|
16
|
+
"@webda/async": "4.0.0-beta.4",
|
|
17
|
+
"@webda/utils": "4.0.0-beta.4",
|
|
18
|
+
"@webda/core": "4.0.0-beta.4"
|
|
32
19
|
},
|
|
33
20
|
"devDependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
"c8": {
|
|
44
|
-
"report-dir": "./reports",
|
|
45
|
-
"reporter": [
|
|
46
|
-
"html",
|
|
47
|
-
"lcov",
|
|
48
|
-
"json",
|
|
49
|
-
"text"
|
|
50
|
-
],
|
|
51
|
-
"exclude": [
|
|
52
|
-
"**/*.spec.ts"
|
|
53
|
-
]
|
|
21
|
+
"@types/node": "25.5.0",
|
|
22
|
+
"@vitest/coverage-v8": "^4.1.2",
|
|
23
|
+
"jscodeshift": "^17.3.0",
|
|
24
|
+
"skott": "^0.35.8",
|
|
25
|
+
"typescript": "7.1.0-dev.20260929.1",
|
|
26
|
+
"vite": "^6.0.0",
|
|
27
|
+
"vitest": "^4.1.2",
|
|
28
|
+
"@webda/compiler": "^4.0.0-beta.4",
|
|
29
|
+
"@webda/test": "4.0.0-beta.3"
|
|
54
30
|
},
|
|
55
31
|
"bugs": {
|
|
56
32
|
"url": "https://github.com/loopingz/webda.io/issues"
|
|
@@ -64,19 +40,32 @@
|
|
|
64
40
|
"access": "public"
|
|
65
41
|
},
|
|
66
42
|
"webda": {
|
|
67
|
-
"namespace": "Webda"
|
|
43
|
+
"namespace": "Webda",
|
|
44
|
+
"capabilities": {
|
|
45
|
+
"kubernetes-cron-export": "Webda/KubernetesCronExporter"
|
|
46
|
+
}
|
|
68
47
|
},
|
|
69
48
|
"type": "module",
|
|
70
49
|
"engines": {
|
|
71
|
-
"node": ">=
|
|
50
|
+
"node": ">=22.0.0"
|
|
72
51
|
},
|
|
73
52
|
"nx": {
|
|
74
53
|
"implicitDependencies": [
|
|
75
54
|
"@webda/core",
|
|
76
|
-
"@webda/tsc-esm",
|
|
77
55
|
"@webda/async"
|
|
78
56
|
]
|
|
79
57
|
},
|
|
80
58
|
"license": "LGPL-3.0-only",
|
|
81
|
-
"
|
|
82
|
-
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "webdac build",
|
|
61
|
+
"build:watch": "webdac build --watch",
|
|
62
|
+
"pretest": "npm run build",
|
|
63
|
+
"test": "vitest run",
|
|
64
|
+
"format": "prettier --check src/**/*",
|
|
65
|
+
"lint": "eslint",
|
|
66
|
+
"lint:fix": "eslint --fix",
|
|
67
|
+
"format:fix": "prettier --write src/**/*",
|
|
68
|
+
"deps:graph": "skott --showCircularDependencies --no-trackTypeOnlyDependencies --displayMode=raw -e .ts",
|
|
69
|
+
"codemod": "jscodeshift --parser=ts --extensions=tsx,ts -t ../codemod/current.mjs src"
|
|
70
|
+
}
|
|
71
|
+
}
|
package/webda.module.json
CHANGED
|
@@ -1,46 +1,208 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$schema": "https://webda.io/schemas/webda.module.v4.json",
|
|
2
3
|
"beans": {},
|
|
3
4
|
"deployers": {},
|
|
4
5
|
"moddas": {
|
|
5
|
-
"Webda/KubeRunner":
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
"Webda/KubeRunner": {
|
|
7
|
+
"Import": "lib/services/kuberunner.service:default",
|
|
8
|
+
"Schema": {
|
|
9
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
10
|
+
"additionalProperties": false,
|
|
11
|
+
"definitions": {
|
|
12
|
+
"Cluster": {
|
|
13
|
+
"additionalProperties": false,
|
|
14
|
+
"properties": {
|
|
15
|
+
"caFile": {
|
|
16
|
+
"type": "string"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"type": "object"
|
|
20
|
+
},
|
|
21
|
+
"Context": {
|
|
22
|
+
"additionalProperties": false,
|
|
23
|
+
"type": "object"
|
|
24
|
+
},
|
|
25
|
+
"K8sConfiguration": {
|
|
26
|
+
"additionalProperties": false,
|
|
27
|
+
"description": "Kubernetes configuration as found in a kubeconfig file",
|
|
28
|
+
"properties": {
|
|
29
|
+
"clusters": {
|
|
30
|
+
"items": {
|
|
31
|
+
"$ref": "#/definitions/Cluster"
|
|
32
|
+
},
|
|
33
|
+
"type": "array"
|
|
34
|
+
},
|
|
35
|
+
"contexts": {
|
|
36
|
+
"items": {
|
|
37
|
+
"$ref": "#/definitions/Context"
|
|
38
|
+
},
|
|
39
|
+
"type": "array"
|
|
40
|
+
},
|
|
41
|
+
"currentContext": {
|
|
42
|
+
"type": "string"
|
|
43
|
+
},
|
|
44
|
+
"users": {
|
|
45
|
+
"items": {
|
|
46
|
+
"$ref": "#/definitions/User"
|
|
47
|
+
},
|
|
48
|
+
"type": "array"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"required": [
|
|
52
|
+
"clusters",
|
|
53
|
+
"contexts",
|
|
54
|
+
"currentContext",
|
|
55
|
+
"users"
|
|
56
|
+
],
|
|
57
|
+
"type": "object"
|
|
58
|
+
},
|
|
59
|
+
"User": {
|
|
60
|
+
"additionalProperties": false,
|
|
61
|
+
"properties": {
|
|
62
|
+
"certFile": {
|
|
63
|
+
"type": "string"
|
|
64
|
+
},
|
|
65
|
+
"keyFile": {
|
|
66
|
+
"type": "string"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"type": "object"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"description": "Parameters for the KubeRunner",
|
|
73
|
+
"properties": {
|
|
74
|
+
"actions": {
|
|
75
|
+
"default": [],
|
|
76
|
+
"description": "Actions managed by the runner",
|
|
77
|
+
"items": {
|
|
78
|
+
"type": "string"
|
|
79
|
+
},
|
|
80
|
+
"type": "array"
|
|
81
|
+
},
|
|
82
|
+
"config": {
|
|
83
|
+
"anyOf": [
|
|
84
|
+
{
|
|
85
|
+
"type": "string"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"$ref": "#/definitions/K8sConfiguration"
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"description": "Kubernetes configuration"
|
|
92
|
+
},
|
|
93
|
+
"context": {
|
|
94
|
+
"description": "Default context to use",
|
|
95
|
+
"type": "string"
|
|
96
|
+
},
|
|
97
|
+
"jobImage": {
|
|
98
|
+
"description": "If default template, use this image",
|
|
99
|
+
"type": "string"
|
|
100
|
+
},
|
|
101
|
+
"jobResources": {
|
|
102
|
+
"description": "Kubernetes resources to use"
|
|
103
|
+
},
|
|
104
|
+
"type": {
|
|
105
|
+
"description": "Type of the service",
|
|
106
|
+
"type": "string"
|
|
107
|
+
},
|
|
108
|
+
"openapi": {
|
|
109
|
+
"type": "object",
|
|
110
|
+
"additionalProperties": true
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"required": [
|
|
114
|
+
"type"
|
|
115
|
+
],
|
|
116
|
+
"type": "object",
|
|
117
|
+
"title": "KubeRunner"
|
|
118
|
+
},
|
|
119
|
+
"Configuration": "lib/services/kuberunner.service:KubeRunnerParameters"
|
|
120
|
+
},
|
|
121
|
+
"Webda/KubernetesCronExporter": {
|
|
122
|
+
"Import": "lib/services/cronexporter.service:default",
|
|
123
|
+
"Schema": {
|
|
124
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
125
|
+
"additionalProperties": false,
|
|
126
|
+
"description": "Interface to specify the Service parameters",
|
|
127
|
+
"properties": {
|
|
128
|
+
"type": {
|
|
129
|
+
"description": "Type of the service",
|
|
130
|
+
"type": "string"
|
|
131
|
+
},
|
|
132
|
+
"openapi": {
|
|
133
|
+
"type": "object",
|
|
134
|
+
"additionalProperties": true
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"required": [
|
|
138
|
+
"type"
|
|
139
|
+
],
|
|
140
|
+
"type": "object",
|
|
141
|
+
"title": "KubernetesCronExporter"
|
|
142
|
+
},
|
|
143
|
+
"Configuration": "node_modules/@webda/core/lib/services/serviceparameters:ServiceParameters",
|
|
144
|
+
"commands": {
|
|
145
|
+
"kubernetes cronExport": {
|
|
146
|
+
"description": "Export all application Cron as template",
|
|
147
|
+
"method": "cronExport",
|
|
148
|
+
"args": {
|
|
149
|
+
"template": {
|
|
150
|
+
"type": "string"
|
|
151
|
+
},
|
|
152
|
+
"target": {
|
|
153
|
+
"type": "string",
|
|
154
|
+
"default": "./crons"
|
|
155
|
+
},
|
|
156
|
+
"filenameTemplate": {
|
|
157
|
+
"type": "string",
|
|
158
|
+
"default": "${serviceName.toLowerCase()}.${method.toLowerCase()}-${cronId}.${ext}"
|
|
159
|
+
},
|
|
160
|
+
"image": {
|
|
161
|
+
"type": "string"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"requires": [
|
|
165
|
+
"kubernetes-cron-export"
|
|
166
|
+
],
|
|
167
|
+
"phase": "resolved"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
13
171
|
},
|
|
172
|
+
"models": {},
|
|
14
173
|
"schemas": {
|
|
15
174
|
"Webda/BinaryFile": {
|
|
16
|
-
"
|
|
175
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
176
|
+
"WebdaSchema": true,
|
|
177
|
+
"additionalProperties": false,
|
|
178
|
+
"description": "Represent a file to store",
|
|
17
179
|
"properties": {
|
|
18
|
-
"hash": {
|
|
19
|
-
"type": "string",
|
|
20
|
-
"description": "Will be computed by the service\n\nhash of the content"
|
|
21
|
-
},
|
|
22
180
|
"challenge": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
181
|
+
"description": "Will be computed by the service\n\nhash of the content prefixed by 'WEBDA'",
|
|
182
|
+
"type": "string"
|
|
25
183
|
},
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
184
|
+
"hash": {
|
|
185
|
+
"description": "Will be computed by the service\n\nhash of the content",
|
|
186
|
+
"type": "string"
|
|
29
187
|
},
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"description": "Current name"
|
|
188
|
+
"metadata": {
|
|
189
|
+
"description": "Metadatas stored along with the binary"
|
|
33
190
|
},
|
|
34
191
|
"mimetype": {
|
|
35
|
-
"
|
|
36
|
-
"
|
|
192
|
+
"description": "Mimetype of the binary",
|
|
193
|
+
"type": "string"
|
|
37
194
|
},
|
|
38
|
-
"
|
|
39
|
-
"description": "
|
|
195
|
+
"name": {
|
|
196
|
+
"description": "Current name",
|
|
197
|
+
"type": "string"
|
|
40
198
|
},
|
|
41
199
|
"originalname": {
|
|
42
|
-
"
|
|
43
|
-
"
|
|
200
|
+
"description": "Original name",
|
|
201
|
+
"type": "string"
|
|
202
|
+
},
|
|
203
|
+
"size": {
|
|
204
|
+
"description": "Size of the binary",
|
|
205
|
+
"type": "number"
|
|
44
206
|
}
|
|
45
207
|
},
|
|
46
208
|
"required": [
|
|
@@ -48,166 +210,12 @@
|
|
|
48
210
|
"name",
|
|
49
211
|
"size"
|
|
50
212
|
],
|
|
51
|
-
"description": "Represent a file to store",
|
|
52
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
53
|
-
"title": "BinaryFile"
|
|
54
|
-
},
|
|
55
|
-
"Webda/KubeRunner": {
|
|
56
213
|
"type": "object",
|
|
57
|
-
"
|
|
58
|
-
"config": {
|
|
59
|
-
"anyOf": [
|
|
60
|
-
{
|
|
61
|
-
"type": "string"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"type": "object",
|
|
65
|
-
"properties": {
|
|
66
|
-
"clusters": {
|
|
67
|
-
"type": "array",
|
|
68
|
-
"items": {
|
|
69
|
-
"type": "object",
|
|
70
|
-
"properties": {
|
|
71
|
-
"name": {
|
|
72
|
-
"type": "string"
|
|
73
|
-
},
|
|
74
|
-
"caData": {
|
|
75
|
-
"type": "string"
|
|
76
|
-
},
|
|
77
|
-
"caFile": {
|
|
78
|
-
"type": "string"
|
|
79
|
-
},
|
|
80
|
-
"server": {
|
|
81
|
-
"type": "string"
|
|
82
|
-
},
|
|
83
|
-
"skipTLSVerify": {
|
|
84
|
-
"type": "boolean"
|
|
85
|
-
},
|
|
86
|
-
"tlsServerName": {
|
|
87
|
-
"type": "string"
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
"required": [
|
|
91
|
-
"name",
|
|
92
|
-
"server"
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
"contexts": {
|
|
97
|
-
"type": "array",
|
|
98
|
-
"items": {
|
|
99
|
-
"type": "object",
|
|
100
|
-
"properties": {
|
|
101
|
-
"cluster": {
|
|
102
|
-
"type": "string"
|
|
103
|
-
},
|
|
104
|
-
"user": {
|
|
105
|
-
"type": "string"
|
|
106
|
-
},
|
|
107
|
-
"name": {
|
|
108
|
-
"type": "string"
|
|
109
|
-
},
|
|
110
|
-
"namespace": {
|
|
111
|
-
"type": "string"
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
"required": [
|
|
115
|
-
"cluster",
|
|
116
|
-
"user",
|
|
117
|
-
"name"
|
|
118
|
-
]
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
"currentContext": {
|
|
122
|
-
"type": "string"
|
|
123
|
-
},
|
|
124
|
-
"users": {
|
|
125
|
-
"type": "array",
|
|
126
|
-
"items": {
|
|
127
|
-
"type": "object",
|
|
128
|
-
"properties": {
|
|
129
|
-
"name": {
|
|
130
|
-
"type": "string"
|
|
131
|
-
},
|
|
132
|
-
"certData": {
|
|
133
|
-
"type": "string"
|
|
134
|
-
},
|
|
135
|
-
"certFile": {
|
|
136
|
-
"type": "string"
|
|
137
|
-
},
|
|
138
|
-
"exec": {},
|
|
139
|
-
"keyData": {
|
|
140
|
-
"type": "string"
|
|
141
|
-
},
|
|
142
|
-
"keyFile": {
|
|
143
|
-
"type": "string"
|
|
144
|
-
},
|
|
145
|
-
"authProvider": {},
|
|
146
|
-
"token": {
|
|
147
|
-
"type": "string"
|
|
148
|
-
},
|
|
149
|
-
"username": {
|
|
150
|
-
"type": "string"
|
|
151
|
-
},
|
|
152
|
-
"password": {
|
|
153
|
-
"type": "string"
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
"required": [
|
|
157
|
-
"name"
|
|
158
|
-
]
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
"required": [
|
|
163
|
-
"clusters",
|
|
164
|
-
"contexts",
|
|
165
|
-
"currentContext",
|
|
166
|
-
"users"
|
|
167
|
-
]
|
|
168
|
-
}
|
|
169
|
-
],
|
|
170
|
-
"description": "Kubernetes configuration"
|
|
171
|
-
},
|
|
172
|
-
"context": {
|
|
173
|
-
"type": "string",
|
|
174
|
-
"description": "Default context to use"
|
|
175
|
-
},
|
|
176
|
-
"type": {
|
|
177
|
-
"type": "string",
|
|
178
|
-
"description": "Type of the service"
|
|
179
|
-
},
|
|
180
|
-
"url": {
|
|
181
|
-
"type": "string",
|
|
182
|
-
"description": "URL on which to serve the content"
|
|
183
|
-
},
|
|
184
|
-
"actions": {
|
|
185
|
-
"type": "array",
|
|
186
|
-
"items": {
|
|
187
|
-
"type": "string"
|
|
188
|
-
},
|
|
189
|
-
"description": "Actions managed by the runner",
|
|
190
|
-
"default": []
|
|
191
|
-
},
|
|
192
|
-
"jobResources": {
|
|
193
|
-
"description": "Kubernetes resources to use"
|
|
194
|
-
},
|
|
195
|
-
"jobImage": {
|
|
196
|
-
"type": "string",
|
|
197
|
-
"description": "If default template, use this image"
|
|
198
|
-
},
|
|
199
|
-
"openapi": {
|
|
200
|
-
"type": "object",
|
|
201
|
-
"additionalProperties": true
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
"required": [
|
|
205
|
-
"config",
|
|
206
|
-
"type"
|
|
207
|
-
],
|
|
208
|
-
"description": "Parameters for the KubeRunner",
|
|
209
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
210
|
-
"title": "KubeRunner"
|
|
214
|
+
"title": "BinaryFile"
|
|
211
215
|
}
|
|
216
|
+
},
|
|
217
|
+
"behaviors": {},
|
|
218
|
+
"capabilities": {
|
|
219
|
+
"kubernetes-cron-export": "Webda/KubernetesCronExporter"
|
|
212
220
|
}
|
|
213
221
|
}
|
package/lib/cron.spec.d.ts
DELETED
package/lib/cron.spec.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cron.spec.d.ts","sourceRoot":"","sources":["../src/cron.spec.ts"],"names":[],"mappings":""}
|
package/lib/cron.spec.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { suite, test } from "@testdeck/mocha";
|
|
8
|
-
import { WebdaTest } from "@webda/core/lib/test.js";
|
|
9
|
-
import * as assert from "assert";
|
|
10
|
-
import { CronReplace } from "./cron.js";
|
|
11
|
-
let CronTest = class CronTest extends WebdaTest {
|
|
12
|
-
basic() {
|
|
13
|
-
const text = `{
|
|
14
|
-
"value": ["a", "\${cron.argsArray}"],
|
|
15
|
-
"value2": ["a", "\${...cron.args}"],
|
|
16
|
-
"cmdline": "echo 'a' '\${cron.argsLine}'"
|
|
17
|
-
}`;
|
|
18
|
-
let res = JSON.parse(CronReplace(text, { args: ["b", "c"], cron: "* * * * *", description: "Test", method: "method", serviceName: "service" }, this.webda.getApplication(), {}));
|
|
19
|
-
assert.deepStrictEqual(res.value, ["a", "b", "c"]);
|
|
20
|
-
assert.deepStrictEqual(res.value2, ["a", "b", "c"]);
|
|
21
|
-
assert.strictEqual(res.cmdline, "echo 'a' 'b' 'c'");
|
|
22
|
-
assert.strictEqual(CronReplace(`cmdline2:\n - echo "a" "\${cron.argsLine}"\n`, { args: ["b", "c"], cron: "* * * * *", description: "Test", method: "method", serviceName: "service" }, this.webda.getApplication()), `cmdline2:\n - echo "a" "b" "c"\n`);
|
|
23
|
-
res = CronReplace({
|
|
24
|
-
value: [
|
|
25
|
-
"a",
|
|
26
|
-
"${...cron.args}"
|
|
27
|
-
]
|
|
28
|
-
}, { args: ["b", "c"], cron: "* * * * *", description: "Test", method: "method", serviceName: "service" }, this.webda.getApplication());
|
|
29
|
-
assert.deepStrictEqual(res.value, ["a", "b", "c"]);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
__decorate([
|
|
33
|
-
test
|
|
34
|
-
], CronTest.prototype, "basic", null);
|
|
35
|
-
CronTest = __decorate([
|
|
36
|
-
suite
|
|
37
|
-
], CronTest);
|
|
38
|
-
//# sourceMappingURL=cron.spec.js.map
|
package/lib/cron.spec.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cron.spec.js","sourceRoot":"","sources":["../src/cron.spec.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGrC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,SAAS;IAE9B,KAAK;QACH,MAAM,IAAI,GAAG;;;;MAIX,CAAC;QACH,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAC9B,IAAI,EACJ,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,EACtG,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,EAC3B,EAAE,CACH,CAAC,CAAC;QACH,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;QACnD,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAA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