@sap/cds-dk 6.2.2 → 6.3.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.
- package/CHANGELOG.md +38 -0
- package/bin/bind.js +4 -4
- package/bin/deploy/to-h2.js +4 -0
- package/bin/deploy/to-sqlite.js +6 -4
- package/bin/help.js +1 -1
- package/bin/login.js +1 -0
- package/bin/mock.js +2 -2
- package/bin/push.js +29 -7
- package/lib/bind/userCdsrcJsonStorageProvider.js +4 -4
- package/lib/cds.js +6 -3
- package/lib/client/activate.js +1 -1
- package/lib/client/base_command.js +10 -10
- package/lib/client/helper/dependency_helper.js +10 -1
- package/lib/client/helper/logging.js +6 -2
- package/lib/client/pull.js +6 -6
- package/lib/client/push.js +33 -14
- package/lib/client/settings_manager.js +52 -21
- package/lib/compile/openapi/csdl2openapi.js +1 -1
- package/lib/compile/to-xsuaa.js +1 -1
- package/lib/import/odata/v2parser.js +37 -1
- package/lib/import/odata/v4parser.js +101 -23
- package/lib/init/constants.js +1 -1
- package/lib/init/index.js +23 -45
- package/lib/init/template/approuter/index.js +44 -48
- package/lib/init/template/auditlog/index.js +14 -10
- package/lib/init/template/cf-manifest/index.js +9 -11
- package/lib/init/template/connectivity/index.js +10 -10
- package/lib/init/template/data/index.js +20 -19
- package/lib/init/template/destinations/index.js +14 -9
- package/lib/init/template/enterprise-messaging/index.js +14 -9
- package/lib/init/template/extensibility/index.js +14 -9
- package/lib/init/template/hana/index.js +51 -57
- package/lib/init/template/helm/index.js +27 -59
- package/lib/init/template/helm/subchart/templates/_helpers.tpl +38 -0
- package/lib/init/template/helm/subchart/templates/deployment.yaml +12 -12
- package/lib/init/template/helm/subchart/values.md +565 -194
- package/lib/init/template/helm/subchart/values.schema.json +163 -8
- package/lib/init/template/helm/subchart/values.yaml +17 -1
- package/lib/init/template/html5-repo/index.js +15 -11
- package/lib/init/template/java/index.js +15 -11
- package/lib/init/template/kibana-logging/index.js +30 -31
- package/lib/init/template/lint/index.js +17 -18
- package/lib/init/template/mta/index.js +18 -40
- package/lib/init/template/mtx/index.js +2 -3
- package/lib/init/template/multitenancy/index.js +27 -20
- package/lib/init/template/nodejs/index.js +18 -20
- package/lib/init/template/notebook/index.js +5 -434
- package/lib/init/template/pipeline/index.js +10 -10
- package/lib/init/template/samples/index.js +7 -16
- package/lib/init/template/templateBase.js +17 -18
- package/lib/init/template/toggles/files/cdsrc.json +5 -0
- package/lib/init/template/toggles/files/cdsrc.json.hbs +7 -0
- package/lib/init/template/toggles/index.js +12 -6
- package/lib/init/template/xsuaa/index.js +44 -41
- package/lib/init/types.d.ts +0 -59
- package/lib/init/util/commandUtil.js +6 -7
- package/lib/init/util/fsUtil.js +23 -109
- package/lib/init/util/merge.js +319 -0
- package/lib/init/util/mvnArchetypeUtil.js +6 -5
- package/lib/init/util/projectReader.js +125 -300
- package/lib/init/util/spinner.js +10 -8
- package/lib/init/util/templateUtil.js +25 -368
- package/lib/lint/Linter.js +2 -3
- package/lib/lint/checks.js +0 -1
- package/lib/lint/io.js +18 -34
- package/npm-shrinkwrap.json +115 -261
- package/package.json +3 -3
- package/lib/init/template/notebook/cap_magic.py +0 -118
- package/lib/init/template/notebook/files/{{{name}}}.ipynb.hbs +0 -90
- package/lib/init/template/notebook/files/{{{name}}}.json +0 -102
- package/lib/init/template/notebook/notebook.js +0 -394
- package/lib/init/util/logger.js +0 -42
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap/cds-dk",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.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": [
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"main": "lib/index.js",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@sap/cds": "^6.
|
|
19
|
+
"@sap/cds": "^6.3.0",
|
|
20
20
|
"@sap/cds-foss": "^4",
|
|
21
21
|
"@sap/eslint-plugin-cds": "^2.6.0",
|
|
22
22
|
"axios": ">=0.21",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"xml-js": "^1.6.11"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@sap/cds-mtxs": "^1.
|
|
37
|
+
"@sap/cds-mtxs": "^1.3.0",
|
|
38
38
|
"sqlite3": "^5.0.4"
|
|
39
39
|
},
|
|
40
40
|
"files": [
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import platform
|
|
3
|
-
import subprocess
|
|
4
|
-
from threading import Thread
|
|
5
|
-
from IPython import get_ipython
|
|
6
|
-
from IPython.core.magic import (Magics, magics_class, cell_magic, line_magic)
|
|
7
|
-
|
|
8
|
-
list_thread_cmds = [
|
|
9
|
-
'cds watch',
|
|
10
|
-
'cf login'
|
|
11
|
-
]
|
|
12
|
-
|
|
13
|
-
def start_thread_darwin(line):
|
|
14
|
-
list_thread_darwin = [
|
|
15
|
-
'printf \"#!/bin/bash',
|
|
16
|
-
'function finish {',
|
|
17
|
-
'rm notebook_thread.sh;'
|
|
18
|
-
'}',
|
|
19
|
-
'cd ' + os.getcwd(),
|
|
20
|
-
line,
|
|
21
|
-
'trap finish EXIT\" > notebook_thread.sh'
|
|
22
|
-
]
|
|
23
|
-
thread_darwin = '\\n'.join(list_thread_darwin)
|
|
24
|
-
thread_darwin += ' && chmod +x notebook_thread.sh'
|
|
25
|
-
thread_darwin += ' && open -a Terminal notebook_thread.sh'
|
|
26
|
-
return thread_darwin
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def get_system_info(platform, line):
|
|
30
|
-
system_info = { 'terminal': '', 'shell': '' }
|
|
31
|
-
if platform == 'Windows':
|
|
32
|
-
system_info['shell'] = 'cmd'
|
|
33
|
-
system_info['terminal'] = 'start cmd /c ' + line
|
|
34
|
-
elif platform == 'Linux':
|
|
35
|
-
system_info['shell'] = 'bash'
|
|
36
|
-
system_info['terminal'] = 'gnome-terminal -- ' + line
|
|
37
|
-
elif platform == 'Darwin':
|
|
38
|
-
system_info['shell'] = 'bash'
|
|
39
|
-
# Store in tmp folder
|
|
40
|
-
system_info['terminal'] = 'printf \"#!/bin/bash\\n' \
|
|
41
|
-
'function finish {\\n' \
|
|
42
|
-
'rm notebook_thread.sh;\\n' \
|
|
43
|
-
'}\\n' \
|
|
44
|
-
'cd ' + os.getcwd() + '\\n' + line + '\\n' \
|
|
45
|
-
'trap finish EXIT\" > notebook_thread.sh' \
|
|
46
|
-
' && chmod +x notebook_thread.sh && open -a Terminal notebook_thread.sh'
|
|
47
|
-
'printf \"{{{shell}}}\" > notebook_thread.sh' \
|
|
48
|
-
' && chmod +x notebook_thread.sh' \
|
|
49
|
-
' && open -a Terminal notebook_thread.sh'
|
|
50
|
-
return system_info
|
|
51
|
-
|
|
52
|
-
@magics_class
|
|
53
|
-
class CustomMagics(Magics):
|
|
54
|
-
|
|
55
|
-
# Modified %lsmagic to show up in vscode's notebook extension
|
|
56
|
-
@line_magic
|
|
57
|
-
def listmagic(self, line):
|
|
58
|
-
line = line.strip()
|
|
59
|
-
magics = str(get_ipython().run_line_magic('lsmagic', '', _stack_depth=2))
|
|
60
|
-
magics = magics.replace('\n', ' ')
|
|
61
|
-
return magics
|
|
62
|
-
|
|
63
|
-
# Helper function to also be able to replace variables when writing files
|
|
64
|
-
@cell_magic
|
|
65
|
-
def writetemplate(self, line, cell):
|
|
66
|
-
"Writes file while inserting environment variables given as {var}"
|
|
67
|
-
replaced = []
|
|
68
|
-
filepath = line.strip('"')
|
|
69
|
-
with open(filepath, 'w', encoding='utf8') as f:
|
|
70
|
-
for k, v in sorted(os.environ.items()):
|
|
71
|
-
template = '{' + k + '}'
|
|
72
|
-
if '{' not in v:
|
|
73
|
-
template_value = '"' + v + '"'
|
|
74
|
-
else:
|
|
75
|
-
template_value = v
|
|
76
|
-
if template in cell:
|
|
77
|
-
cell = cell.replace(template, template_value)
|
|
78
|
-
replaced.append('{' + k + '}=' + template_value)
|
|
79
|
-
f.write(cell)
|
|
80
|
-
return 'Replaced ' + ', '.join(replaced) + '. Writing ' + line + '.'
|
|
81
|
-
|
|
82
|
-
get_ipython().register_magics(CustomMagics)
|
|
83
|
-
|
|
84
|
-
def new_thread_window(line):
|
|
85
|
-
"Runs cds with native CLI, with function 'cds watch' being executed as a separate thread in new a terminal window."
|
|
86
|
-
line = line.strip()
|
|
87
|
-
system_info = get_system_info(platform.system(), line)
|
|
88
|
-
cell_magic = system_info['terminal']
|
|
89
|
-
# Starts a separate thread such that cmd does not block the notebook
|
|
90
|
-
if cell_magic:
|
|
91
|
-
def do_magic():
|
|
92
|
-
get_ipython().run_cell_magic(system_info['shell'], '', cell_magic)
|
|
93
|
-
Thread(target=do_magic).start()
|
|
94
|
-
return 'Running ' + line + '...'
|
|
95
|
-
else:
|
|
96
|
-
return 'Please open a new terminal outside of the notebook and run: ' + line + '...'
|
|
97
|
-
|
|
98
|
-
def filter(*args):
|
|
99
|
-
cmd = ' '.join(list(args))
|
|
100
|
-
if cmd.lower().startswith(tuple(list_thread_cmds)):
|
|
101
|
-
new_thread_window(cmd)
|
|
102
|
-
print(cmd + ' started in new terminal window')
|
|
103
|
-
else:
|
|
104
|
-
cmd = ' '.join(list(args))
|
|
105
|
-
try:
|
|
106
|
-
output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
|
107
|
-
for line in output.splitlines():
|
|
108
|
-
print(line.decode('utf-8'))
|
|
109
|
-
except subprocess.CalledProcessError as e:
|
|
110
|
-
for line in e.output.splitlines():
|
|
111
|
-
if line.startswith(b'[ERROR]'):
|
|
112
|
-
print('\n')
|
|
113
|
-
print(line.decode('utf-8'))
|
|
114
|
-
return
|
|
115
|
-
|
|
116
|
-
get_ipython().system = filter
|
|
117
|
-
|
|
118
|
-
print('CAP magic loaded successfully - Have fun with your notebook!')
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"metadata": {
|
|
3
|
-
"cap_nb_version": "1.0.0",
|
|
4
|
-
"cap_magic": "",
|
|
5
|
-
"language_info": {
|
|
6
|
-
"codemirror_mode": {
|
|
7
|
-
"name": "ipython",
|
|
8
|
-
"version": 3
|
|
9
|
-
},
|
|
10
|
-
"file_extension": ".py",
|
|
11
|
-
"mimetype": "text/x-python",
|
|
12
|
-
"name": "python",
|
|
13
|
-
"nbconvert_exporter": "python",
|
|
14
|
-
"pygments_lexer": "ipython3",
|
|
15
|
-
"version": 3
|
|
16
|
-
},
|
|
17
|
-
"orig_nbformat": 2,
|
|
18
|
-
"kernelspec": {
|
|
19
|
-
"name": ".cap-jupyter-nb",
|
|
20
|
-
"display_name": ".cap-jupyter-nb"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"nbformat": 4,
|
|
24
|
-
"nbformat_minor": 2,
|
|
25
|
-
"cells": [
|
|
26
|
-
{
|
|
27
|
-
"cell_type": "markdown",
|
|
28
|
-
"metadata": {},
|
|
29
|
-
"source": [
|
|
30
|
-
"<h1>Welcome to CAP Notebooks! <img style=\"vertical-align:middle\" src=\"{{{cap}}}/docs/assets/logos/sap.svg\" alt=\"drawing\" width=\"70\"/><img style=\"vertical-align:middle\" src=\"{{{cap}}}/docs/assets/logos/cap.svg\" alt=\"drawing\" width=\"60\"/></h1>\n",
|
|
31
|
-
"\n",
|
|
32
|
-
"## What is a CAP Notebook?\n",
|
|
33
|
-
"\n",
|
|
34
|
-
"A CAP notebook is a [Jupyter Notebook](https://jupyter.org/) that serves as a guide on how to create, navigate and monitor CAP projects.\n",
|
|
35
|
-
"\n",
|
|
36
|
-
"With this, we want to encourage the CAP community to work with CAP in the same *explorative* manner that data scientists work with their data by:\n",
|
|
37
|
-
"\n",
|
|
38
|
-
"- Visually interacting with their code\n",
|
|
39
|
-
"- Playing with REPL-type inputs (notebook input cells)\n",
|
|
40
|
-
"- Storing persistent code (notebook output cells)\n",
|
|
41
|
-
"\n",
|
|
42
|
-
"The cell inputs/outputs are especially useful at later points in time when the project's details have long been forgotten. In addition, notebooks are a good way to share, compare and also reproduce projects.\n",
|
|
43
|
-
"<br><br>\n",
|
|
44
|
-
"\n",
|
|
45
|
-
"## How do I run the CAP Notebook?\n",
|
|
46
|
-
"\n",
|
|
47
|
-
"The following symbols indicate the state of a cell:\n",
|
|
48
|
-
"\n",
|
|
49
|
-
"    `▶` : Executes the cell\n",
|
|
50
|
-
"\n",
|
|
51
|
-
"    `*` : Indicates that the cell is *running*\n",
|
|
52
|
-
" \n",
|
|
53
|
-
"    `■` : Stops cell execution\n",
|
|
54
|
-
"\n",
|
|
55
|
-
"When finished running, you will see the cell's output appear below the code cell. The blue bar on the left moves to keep track of where you are in the notebook. You can use `+` to add new cells anywhere in the notebook. See [Guide](https://code.visualstudio.com/docs/python/jupyter-support#_create-or-open-a-jupyter-notebook) for a more detailed description.\n",
|
|
56
|
-
"<br><br>\n",
|
|
57
|
-
"\n",
|
|
58
|
-
"## How do I interact with the CAP Notebook?\n",
|
|
59
|
-
"\n",
|
|
60
|
-
"In notebooks, predefined [Magic commands](https://ipython.readthedocs.io/en/stable/interactive/magics.html) have been designed to succinctly solve various common problems. They all start with `%` or `%%` for line or cell magic commands.\n",
|
|
61
|
-
"\n",
|
|
62
|
-
"    `%quickref` : Provides a full list of magic functions available\n",
|
|
63
|
-
"\n",
|
|
64
|
-
"You will find these being used throughout the notebook.\n",
|
|
65
|
-
"<br><br>\n",
|
|
66
|
-
"\n",
|
|
67
|
-
"## How do I get started?\n",
|
|
68
|
-
"\n",
|
|
69
|
-
"Start by executing the first cell, which registers some additional magic commands which make our notebook platform-independent (across Windows, Linux and Mac).\n",
|
|
70
|
-
"\n",
|
|
71
|
-
"After that, you're ready to start the CAP [Getting started in a Nutshell](https://cap.cloud.sap/docs/get-started/in-a-nutshell) tutorial. \n",
|
|
72
|
-
"\n",
|
|
73
|
-
"**```🡇 NOTE: This cell must be included and run at the start of any CAP Notebook! 🡇```**"
|
|
74
|
-
]
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"cell_type": "code",
|
|
78
|
-
"execution_count": null,
|
|
79
|
-
"metadata": {
|
|
80
|
-
"tags": []
|
|
81
|
-
},
|
|
82
|
-
"outputs": [],
|
|
83
|
-
"source": [
|
|
84
|
-
"import glob, json\n",
|
|
85
|
-
"with open(glob.glob('./*.ipynb')[0], encoding='utf8') as json_file:\n",
|
|
86
|
-
" exec(json.load(json_file)['metadata']['cap_magic'])"
|
|
87
|
-
]
|
|
88
|
-
}
|
|
89
|
-
]
|
|
90
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"metadata": {
|
|
3
|
-
"cap_nb_version": "1.0.0",
|
|
4
|
-
"cap_magic": "",
|
|
5
|
-
"language_info": {
|
|
6
|
-
"codemirror_mode": {
|
|
7
|
-
"name": "ipython",
|
|
8
|
-
"version": 3
|
|
9
|
-
},
|
|
10
|
-
"file_extension": ".py",
|
|
11
|
-
"mimetype": "text/x-python",
|
|
12
|
-
"name": "python",
|
|
13
|
-
"nbconvert_exporter": "python",
|
|
14
|
-
"pygments_lexer": "ipython3",
|
|
15
|
-
"version": 3
|
|
16
|
-
},
|
|
17
|
-
"orig_nbformat": 2,
|
|
18
|
-
"kernelspec": {
|
|
19
|
-
"name": "nbvenv",
|
|
20
|
-
"display_name": "nbvenv"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"nbformat": 4,
|
|
24
|
-
"nbformat_minor": 2,
|
|
25
|
-
"cells": [
|
|
26
|
-
{
|
|
27
|
-
"cell_type": "markdown",
|
|
28
|
-
"metadata": {},
|
|
29
|
-
"source": [
|
|
30
|
-
"<h1>Welcome to CAP Notebooks! <img style=\"vertical-align:middle\" src=\"{{{cap}}}/docs/assets/logos/sap.svg\"
|
|
31
|
-
alt=\"drawing\" width=\"70\" /><img style=\"vertical-align:middle\" src=\"{{{cap}}}/docs/assets/logos/cap.svg\"
|
|
32
|
-
alt=\"drawing\" width=\"60\" /></h1>\n",
|
|
33
|
-
"\n",
|
|
34
|
-
"## What is a CAP Notebook?\n",
|
|
35
|
-
"\n",
|
|
36
|
-
"A CAP notebook is a [Jupyter Notebook](https://jupyter.org/) that serves as a guide on how to create, navigate and
|
|
37
|
-
monitor CAP projects.\n",
|
|
38
|
-
"\n",
|
|
39
|
-
"With this, we want to encourage the CAP community to work with CAP in the same *explorative* manner that data
|
|
40
|
-
scientists work with their data by:\n",
|
|
41
|
-
"\n",
|
|
42
|
-
"- Visually interacting with their code\n",
|
|
43
|
-
"- Playing with REPL-type inputs (notebook input cells)\n",
|
|
44
|
-
"- Storing persistent code (notebook output cells)\n",
|
|
45
|
-
"\n",
|
|
46
|
-
"The cell inputs/outputs are especially useful at later points in time when the project's details have long been
|
|
47
|
-
forgotten. In addition, notebooks are a good way to share, compare and also reproduce projects.\n",
|
|
48
|
-
"<br><br>\n",
|
|
49
|
-
"\n",
|
|
50
|
-
"## How do I run the CAP Notebook?\n",
|
|
51
|
-
"\n",
|
|
52
|
-
"The following symbols indicate the state of a cell:\n",
|
|
53
|
-
"\n",
|
|
54
|
-
"    `▶` : Executes the cell\n",
|
|
55
|
-
"\n",
|
|
56
|
-
"    `*` : Indicates that the cell is *running*\n",
|
|
57
|
-
" \n",
|
|
58
|
-
"    `■` : Stops cell execution\n",
|
|
59
|
-
"\n",
|
|
60
|
-
"When finished running, you will see the cell's output appear below the code cell. The blue bar on the left moves to
|
|
61
|
-
keep track of where you are in the notebook. You can use `+` to add new cells anywhere in the notebook. See
|
|
62
|
-
[Guide](https://code.visualstudio.com/docs/python/jupyter-support#_create-or-open-a-jupyter-notebook) for a more
|
|
63
|
-
detailed description.\n",
|
|
64
|
-
"<br><br>\n",
|
|
65
|
-
"\n",
|
|
66
|
-
"## How do I interact with the CAP Notebook?\n",
|
|
67
|
-
"\n",
|
|
68
|
-
"In notebooks, predefined [Magic commands](https://ipython.readthedocs.io/en/stable/interactive/magics.html) have been
|
|
69
|
-
designed to succinctly solve various common problems. They all start with `%` or `%%` for line or cell magic
|
|
70
|
-
commands.\n",
|
|
71
|
-
"\n",
|
|
72
|
-
"    `%quickref` : Provides a full list of magic functions available\n",
|
|
73
|
-
"\n",
|
|
74
|
-
"You will find these being used throughout the notebook.\n",
|
|
75
|
-
"<br><br>\n",
|
|
76
|
-
"\n",
|
|
77
|
-
"## How do I get started?\n",
|
|
78
|
-
"\n",
|
|
79
|
-
"Start by executing the first cell, which registers some additional magic commands which make our notebook
|
|
80
|
-
platform-independent (across Windows, Linux and Mac).\n",
|
|
81
|
-
"\n",
|
|
82
|
-
"After that, you're ready to start the CAP [Getting started in a
|
|
83
|
-
Nutshell](https://cap.cloud.sap/docs/get-started/in-a-nutshell) tutorial. \n",
|
|
84
|
-
"\n",
|
|
85
|
-
"**```🡇 NOTE: This cell must be included and run at the start of any CAP Notebook! 🡇```**"
|
|
86
|
-
]
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
"cell_type": "code",
|
|
90
|
-
"execution_count": null,
|
|
91
|
-
"metadata": {
|
|
92
|
-
"tags": []
|
|
93
|
-
},
|
|
94
|
-
"outputs": [],
|
|
95
|
-
"source": [
|
|
96
|
-
"import glob, json\n",
|
|
97
|
-
"with open(glob.glob('./*.ipynb')[0], encoding='utf8') as json_file:\n",
|
|
98
|
-
" exec(json.load(json_file)['metadata']['cap_magic'])"
|
|
99
|
-
]
|
|
100
|
-
}
|
|
101
|
-
]
|
|
102
|
-
}
|