@sap/cds-dk 6.4.0 → 6.5.0

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +28 -1
  2. package/bin/bind.js +30 -34
  3. package/bin/cds.js +14 -3
  4. package/bin/deploy/index.js +3 -1
  5. package/bin/deploy/to-sqlite.js +2 -1
  6. package/bin/env.js +4 -4
  7. package/bin/migrate.js +25 -4
  8. package/bin/push.js +4 -0
  9. package/bin/watch.js +3 -3
  10. package/lib/bind/KubernetesApiAccessor.js +79 -0
  11. package/lib/bind/{BindingManager.js → bindingManager.js} +16 -15
  12. package/lib/bind/bindingResolver.js +41 -68
  13. package/lib/bind/bindingUtil.js +93 -104
  14. package/lib/bind/cfKeyProvider.js +85 -74
  15. package/lib/bind/kubernetesCredentialsProvider.js +34 -132
  16. package/lib/bind/userCdsrcJsonStorageProvider.js +12 -18
  17. package/lib/client/params.js +2 -2
  18. package/lib/client/push.js +11 -6
  19. package/lib/client/settings_manager.js +2 -1
  20. package/lib/client/subscription.js +4 -1
  21. package/lib/import/odata/v2parser.js +32 -8
  22. package/lib/import/odata/v4parser.js +11 -3
  23. package/lib/init/constants.js +1 -1
  24. package/lib/init/index.js +3 -11
  25. package/lib/init/template/approuter/files/approuter-configmap.yaml +4 -1
  26. package/lib/init/template/approuter/files/approuter-mtxs-configmap.yaml +5 -1
  27. package/lib/init/template/approuter/files/package.json +1 -1
  28. package/lib/init/template/approuter/files/values.yaml.hbs +1 -1
  29. package/lib/init/template/approuter/files/xs-app.json.hbs +2 -2
  30. package/lib/init/template/approuter/index.js +4 -5
  31. package/lib/init/template/auditlog/index.js +1 -1
  32. package/lib/init/template/data/index.js +1 -1
  33. package/lib/init/template/destinations/index.js +1 -1
  34. package/lib/init/template/enterprise-messaging/index.js +1 -1
  35. package/lib/init/template/extensibility/index.js +6 -1
  36. package/lib/init/template/hana/files/chart.yaml +4 -0
  37. package/lib/init/template/hana/files/hana.yaml +1 -0
  38. package/lib/init/template/hana/files/java/db/package.json +1 -1
  39. package/lib/init/template/hana/files/values.yaml.hbs +6 -3
  40. package/lib/init/template/hana/index.js +73 -21
  41. package/lib/init/template/helm/chart/templates/_deployment_helpers.tpl +14 -6
  42. package/lib/init/template/helm/chart/values.root.schema.json +10 -0
  43. package/lib/init/template/helm/chart/values.schema.json +11 -110
  44. package/lib/init/template/helm/index.js +2 -2
  45. package/lib/init/template/helm/subcharts/content-deployment/Chart.yaml +5 -0
  46. package/lib/init/template/helm/subcharts/content-deployment/templates/_helpers.tpl +207 -0
  47. package/lib/init/template/helm/subcharts/content-deployment/templates/job.yaml +66 -0
  48. package/lib/init/template/helm/subcharts/content-deployment/templates/secret.yaml +10 -0
  49. package/lib/init/template/helm/subcharts/content-deployment/templates/service-account.yaml +4 -0
  50. package/lib/init/template/helm/subcharts/content-deployment/templates/service-binding.yaml +28 -0
  51. package/lib/init/template/helm/subcharts/content-deployment/values-lint.yaml +5 -0
  52. package/lib/init/template/helm/subcharts/content-deployment/values.md +1014 -0
  53. package/lib/init/template/helm/subcharts/content-deployment/values.schema.json +589 -0
  54. package/lib/init/template/helm/subcharts/content-deployment/values.yaml +54 -0
  55. package/lib/init/template/helm/{subchart → subcharts/web-application}/Chart.yaml +0 -0
  56. package/lib/init/template/helm/{subchart → subcharts/web-application}/templates/_helpers.tpl +56 -50
  57. package/lib/init/template/helm/{subchart → subcharts/web-application}/templates/api-rule.yaml +1 -1
  58. package/lib/init/template/helm/{subchart → subcharts/web-application}/templates/deployment.yaml +15 -9
  59. package/lib/init/template/helm/{subchart → subcharts/web-application}/templates/network-policy.yaml +0 -0
  60. package/lib/init/template/helm/{subchart → subcharts/web-application}/templates/pod-disruption-budget.yaml +2 -2
  61. package/lib/init/template/helm/{subchart → subcharts/web-application}/templates/secret.yaml +0 -0
  62. package/lib/init/template/helm/subcharts/web-application/templates/service-account.yaml +6 -0
  63. package/lib/init/template/helm/{subchart → subcharts/web-application}/templates/service-binding.yaml +4 -3
  64. package/lib/init/template/helm/{subchart → subcharts/web-application}/templates/service.yaml +0 -0
  65. package/lib/init/template/helm/subcharts/web-application/templating.md +44 -0
  66. package/lib/init/template/helm/{subchart → subcharts/web-application}/values-lint.yaml +0 -0
  67. package/lib/init/template/helm/{subchart → subcharts/web-application}/values.md +254 -200
  68. package/lib/init/template/helm/{subchart → subcharts/web-application}/values.schema.json +82 -28
  69. package/lib/init/template/helm/{subchart → subcharts/web-application}/values.yaml +15 -5
  70. package/lib/init/template/html5-repo/files/chart.yaml +4 -0
  71. package/lib/init/template/html5-repo/files/html5-apps-deployer-configmap.yaml +14 -0
  72. package/lib/init/template/html5-repo/index.js +39 -7
  73. package/lib/init/template/kibana-logging/index.js +1 -1
  74. package/lib/init/template/lint/index.js +1 -1
  75. package/lib/init/template/multitenancy/files/saas-registry.yaml +2 -2
  76. package/lib/init/template/multitenancy/files/service-manager.yaml +1 -0
  77. package/lib/init/template/multitenancy/files/values.yaml.hbs +10 -6
  78. package/lib/init/template/multitenancy/index.js +21 -3
  79. package/lib/init/util/commandUtil.js +5 -5
  80. package/lib/init/util/merge.js +27 -1
  81. package/lib/init/util/mvnArchetypeUtil.js +1 -1
  82. package/lib/init/util/projectReader.js +2 -2
  83. package/lib/util/exec.js +3 -3
  84. package/lib/util/term.js +7 -7
  85. package/lib/watch/livereload-connect.js +187 -0
  86. package/lib/watch/livereload-server.js +12 -12
  87. package/lib/watch/node-watch.js +1 -1
  88. package/npm-shrinkwrap.json +191 -404
  89. package/package.json +2 -5
  90. package/lib/init/template/hana/files/hana-deployer-job.yaml +0 -49
  91. package/lib/init/template/html5-repo/files/_html5_deployment_helpers.tpl +0 -16
  92. package/lib/init/template/html5-repo/files/html5-apps-deployer-job.yaml +0 -61
  93. package/lib/init/util/spinner.js +0 -80
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds-dk",
3
- "version": "6.4.0",
3
+ "version": "6.5.0",
4
4
  "description": "Command line client and development toolkit for the SAP Cloud Application Programming Model",
5
5
  "homepage": "https://cap.cloud.sap/",
6
6
  "keywords": [
@@ -18,13 +18,11 @@
18
18
  "dependencies": {
19
19
  "@sap/cds": "^6.4.0",
20
20
  "@sap/cds-foss": "^4",
21
+ "@sap/cds-mtxs": "^1.4.3",
21
22
  "@sap/eslint-plugin-cds": "^2.6.0",
22
23
  "axios": ">=0.21",
23
- "connect-livereload": "^0.6.1",
24
24
  "eslint": "^8",
25
25
  "express": "^4.17.1",
26
- "glob": "^8.0.3",
27
- "htmlparser2": "^8.0.0",
28
26
  "livereload-js": "^3.3.1",
29
27
  "md5": "^2.3.0",
30
28
  "mustache": "^4.0.1",
@@ -34,7 +32,6 @@
34
32
  "xml-js": "^1.6.11"
35
33
  },
36
34
  "optionalDependencies": {
37
- "@sap/cds-mtxs": "^1.4.0",
38
35
  "sqlite3": "^5.0.4"
39
36
  },
40
37
  "files": [
@@ -1,49 +0,0 @@
1
- #
2
- # HANA single-tenant DB deployment
3
- #
4
- {{- if .Values.hana_deployer }}
5
- {{- if or (not (hasKey .Values.hana_deployer "enabled")) .Values.hana_deployer.enabled }}
6
- {{- $ := merge (dict "root" . "name" "hana-deployer") .Values.hana_deployer . }}
7
- {{- template "cap.expect" (list . "hana_deployer.bindings.hana.fromSecret" "hana_deployer.image.repository") }}
8
- apiVersion: batch/v1
9
- kind: Job
10
- metadata:
11
- name: {{ .Release.Name }}-hana-deployer
12
- labels: {{- include "cap.labels" $ | nindent 4 }}
13
- annotations:
14
- "helm.sh/hook": "post-install,pre-upgrade"
15
- "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
16
- namespace: {{ .Release.Namespace }}
17
- spec:
18
- backoffLimit: 4
19
- template:
20
- metadata:
21
- labels:
22
- {{- include "cap.labels" $ | nindent 8 }}
23
- sidecar.istio.io/inject: "false"
24
- spec:
25
- restartPolicy: Never
26
- {{- include "cap.imagePullSecrets" $ | nindent 6 }}
27
- volumes:
28
- {{- include "cap.sapcp.bindingsVolumes" $ | nindent 10 }}
29
- containers:
30
- - name: hana-deployer
31
- image: {{ include "cap.image" $ }}
32
- imagePullPolicy: {{ include "cap.imagePullPolicy" $ }}
33
- env:
34
- {{- range $k, $v := .Values.hana_deployer.env }}
35
- - name: {{ $k }}
36
- value: {{ $v | quote }}
37
- {{- end }}
38
- - name: SERVICE_BINDING_ROOT
39
- value: /bindings
40
- - name: EXIT
41
- value: 'true'
42
- volumeMounts:
43
- {{- include "cap.sapcp.bindingsVolumeMounts" $ | nindent 10 }}
44
- resources:
45
- {{- toYaml .Values.hana_deployer.resources | nindent 10 }}
46
- ---
47
- {{ include "cap.sapcp.bindings" $ }}
48
- {{ end }}
49
- {{ end }}
@@ -1,16 +0,0 @@
1
- {{/*
2
- Backend Destinations
3
- */}}
4
- {{- define "cap.backendDestinations" -}}
5
- {{- $ := . -}}
6
- {{- $destinations := list -}}
7
- {{- range $destinationName, $destination := .backendDestinations -}}
8
- {{- $destination := merge (dict "name" $destinationName) $destination -}}
9
- {{- $deployment := (get $.root.Values $destination.service) -}}
10
- {{- $srv := merge (dict "name" $destination.service "destination" $destination "deployment" $deployment) $.root -}}
11
- {{- $destinationHost := include "cap.deploymentHost" $srv -}}
12
- {{- $currentDestination := dict "Name" $destination.name "Type" "HTTP" "ProxyType" "Internet" "URL" (print "https://" $destinationHost "." $.root.Values.global.domain ($destination.path | default "")) "Authentication" "NoAuthentication" "sap.cloud.service" $.cloudService "HTML5.forwardAuthToken" "true" -}}
13
- {{- $destinations = (append $destinations $currentDestination) -}}
14
- {{- end -}}
15
- {{- $destinations | toJson }}
16
- {{- end -}}
@@ -1,61 +0,0 @@
1
- {{- if .Values.html5_apps_deployer }}
2
- {{- if or (not (hasKey .Values.html5_apps_deployer "enabled")) .Values.html5_apps_deployer.enabled }}
3
-
4
- {{- $ := merge (dict "root" . "name" "html5-apps-deployer") .Values.html5_apps_deployer . }}
5
- {{- if $.backendDestinations }}
6
- {{- if not (.Values.destination.parameters.HTML5Runtime_enabled) }}
7
- {{- fail "destinations.parameters.HTML5Runtime_enabled must be set to true for use with Launchpad Service" }}
8
- {{- end }}
9
- {{- end }}
10
- {{- template "cap.expect" (list . "html5_apps_deployer.image.repository") }}
11
- apiVersion: batch/v1
12
- kind: Job
13
- metadata:
14
- name: {{ .Release.Name }}-html5-apps-deployer
15
- namespace: {{ .Release.Namespace }}
16
- labels: {{- include "cap.labels" $ | nindent 4 }}
17
- annotations:
18
- "helm.sh/hook": "post-install,post-upgrade"
19
- "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
20
- spec:
21
- backoffLimit: 4
22
- template:
23
- metadata:
24
- labels:
25
- {{- include "cap.labels" $ | nindent 8 }}
26
- sidecar.istio.io/inject: "false"
27
- spec:
28
- {{- include "cap.imagePullSecrets" $ | nindent 6 }}
29
- restartPolicy: Never
30
- volumes:
31
- {{- include "cap.sapcp.bindingsVolumes" $ | nindent 10 }}
32
- containers:
33
- - name: html5-deployer
34
- image: {{ include "cap.image" $ }}
35
- imagePullPolicy: {{ include "cap.imagePullPolicy" $ }}
36
- volumeMounts:
37
- {{- include "cap.sapcp.bindingsVolumeMounts" $ | nindent 10 }}
38
- resources:
39
- {{- toYaml .Values.html5_apps_deployer.resources | nindent 10 }}
40
- env:
41
- {{- range $k, $v := .Values.html5_apps_deployer.env }}
42
- - name: {{ $k }}
43
- value: {{ $v | quote }}
44
- {{- end }}
45
- - name: SERVICE_BINDING_ROOT
46
- value: /bindings
47
- - name: EXIT_PROCESS_AFTER_UPLOAD
48
- value: "true"
49
- - name: PORT
50
- value: "5000"
51
- # TODO: cloud service should be configurable in the HTML5 apps
52
- - name: SAP_CLOUD_SERVICE
53
- value: {{ $.cloudService }}
54
- # TODO: destination name should be configurable in the HTML5 apps
55
- - name: BACKEND_DESTINATIONS
56
- value: >
57
- {{ include "cap.backendDestinations" $ }}
58
- ---
59
- {{ include "cap.sapcp.bindings" $ }}
60
- {{- end }}
61
- {{- end }}
@@ -1,80 +0,0 @@
1
-
2
- const SPINNER_THEMES = {
3
- spin: ['—', '\\', '|', '/'],
4
- bounce: ['_', '—', '‾', '—', '/', '|', '/', '—'],
5
- balloon: ['o', 'O']
6
- }
7
-
8
- const RENDER_DELAY = 1000;
9
-
10
- const ESC_SEQ = '\u001B[';
11
- const HIDE_CURSOR = ESC_SEQ + '?25l';
12
- const SHOW_CURSOR = ESC_SEQ + '?25h';
13
- const MOVE_CURSOR_UP = ESC_SEQ + '1A';
14
- const ERASE_LINE = ESC_SEQ + 'K';
15
- // const MOVE_CURSOR_START = '\r';
16
- // const SAVE_CURSOR = ESC_SEQ + 's';
17
- // const RESTORE_CURSOR = ESC_SEQ + 'u';
18
-
19
- const LOG = console
20
- const DEBUG = /\bcli\b/.test(process.env.DEBUG) && LOG.debug
21
-
22
- class Spinner {
23
- constructor(theme = Spinner.THEME_SPIN, initialDelay = 1000) {
24
- this.theme = theme;
25
- this.initialDelay = initialDelay;
26
- }
27
-
28
- static get THEME_RANDOM() {
29
- const keys = Object.keys(SPINNER_THEMES);
30
- const idx = Math.round(Math.random() * (keys.length - 1));
31
- return keys[idx];
32
- }
33
-
34
- async run(msg, cb, postfix = '') {
35
- try {
36
- this._start(msg);
37
- // use return await to catch errors here
38
- return await cb();
39
- } finally {
40
- this._stop(msg, postfix);
41
- }
42
- }
43
-
44
- _start(msg) {
45
- if (!DEBUG && process.stdout.isTTY) {
46
- LOG.info(msg + HIDE_CURSOR + ERASE_LINE + MOVE_CURSOR_UP);
47
- this.timeoutId = setTimeout(() => {
48
- let idx = 0;
49
- this.intervalId = setInterval(() => {
50
- LOG.info(msg + ' ' + SPINNER_THEMES[this.theme][idx] + ERASE_LINE + MOVE_CURSOR_UP);
51
- idx = (idx + 1) % SPINNER_THEMES[this.theme].length;
52
- }, RENDER_DELAY);
53
- }, this.initialDelay);
54
- } else {
55
- LOG.info(msg);
56
- }
57
- }
58
-
59
- _stop(msg, postfix) {
60
- if (!DEBUG && process.stdout.isTTY) {
61
- if (this.timeoutId) {
62
- clearTimeout(this.timeoutId);
63
- this.timeoutId = null;
64
- }
65
-
66
- if (this.intervalId) {
67
- clearInterval(this.intervalId);
68
- this.intervalId = null;
69
- }
70
-
71
- LOG.info(SHOW_CURSOR + msg + ' ' + postfix + ERASE_LINE);
72
- }
73
- }
74
- }
75
-
76
- Spinner.THEME_SPIN = 'spin';
77
- Spinner.THEME_BOUNCE = 'bounce';
78
- Spinner.THEME_BALLOON = 'balloon';
79
-
80
- module.exports = Spinner;