1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-12 11:54:35 +00:00

Compare commits

...

6 Commits

Author SHA1 Message Date
semantic-release-bot
799339de30 chore(release): 0.23.0 [skip ci]
# [0.23.0](https://github.com/sasjs/server/compare/v0.22.1...v0.23.0) (2022-10-03)

### Features

* Enable SAS_PACKAGES in SASjs Server ([424f0fc](424f0fc1fa))
2022-10-03 15:13:11 +00:00
Allan Bowe
042ed41189 Merge pull request #297 from sasjs/issue-292
feat: Enable SAS_PACKAGES in SASjs Server
2022-10-03 16:08:30 +01:00
424f0fc1fa feat: Enable SAS_PACKAGES in SASjs Server 2022-10-03 19:43:02 +05:00
semantic-release-bot
deafebde05 chore(release): 0.22.1 [skip ci]
## [0.22.1](https://github.com/sasjs/server/compare/v0.22.0...v0.22.1) (2022-10-03)

### Bug Fixes

* spelling issues ([3bb0597](3bb05974d2))
2022-10-03 13:17:14 +00:00
Allan Bowe
b66dc86b01 Merge pull request #296 from sasjs/spellingz
fix: spelling issues
2022-10-03 14:11:55 +01:00
Allan Bowe
3bb05974d2 fix: spelling issues 2022-10-03 13:10:30 +00:00
12 changed files with 237 additions and 24 deletions

View File

@@ -1,3 +1,17 @@
# [0.23.0](https://github.com/sasjs/server/compare/v0.22.1...v0.23.0) (2022-10-03)
### Features
* Enable SAS_PACKAGES in SASjs Server ([424f0fc](https://github.com/sasjs/server/commit/424f0fc1faec765eb7a14619584e649454105b70))
## [0.22.1](https://github.com/sasjs/server/compare/v0.22.0...v0.22.1) (2022-10-03)
### Bug Fixes
* spelling issues ([3bb0597](https://github.com/sasjs/server/commit/3bb05974d216d69368f4498eb9f309bce7d97fd8))
# [0.22.0](https://github.com/sasjs/server/compare/v0.21.7...v0.22.0) (2022-10-03) # [0.22.0](https://github.com/sasjs/server/compare/v0.21.7...v0.22.0) (2022-10-03)

View File

@@ -128,7 +128,7 @@ CA_ROOT=fullchain.pem (optional)
## ENV variables required for MODE: `server` ## ENV variables required for MODE: `server`
DB_CONNECT=mongodb+srv://<DB_USERNAME>:<DB_PASSWORD>@<CLUSTER>/<DB_NAME>?retryWrites=true&w=majority DB_CONNECT=mongodb+srv://<DB_USERNAME>:<DB_PASSWORD>@<CLUSTER>/<DB_NAME>?retryWrites=true&w=majority
# AUTH_PROVIDERS options: [ldap|internal] default: `internal` # AUTH_PROVIDERS options: [ldap] default: ``
AUTH_PROVIDERS= AUTH_PROVIDERS=
## ENV variables required for AUTH_MECHANISM: `ldap` ## ENV variables required for AUTH_MECHANISM: `ldap`

147
api/package-lock.json generated
View File

@@ -50,11 +50,13 @@
"@types/swagger-ui-express": "^4.1.3", "@types/swagger-ui-express": "^4.1.3",
"@types/unzipper": "^0.10.5", "@types/unzipper": "^0.10.5",
"adm-zip": "^0.5.9", "adm-zip": "^0.5.9",
"axios": "0.27.2",
"csrf": "^3.1.0", "csrf": "^3.1.0",
"dotenv": "^10.0.0", "dotenv": "^10.0.0",
"http-headers-validation": "^0.0.1", "http-headers-validation": "^0.0.1",
"jest": "^27.0.6", "jest": "^27.0.6",
"mongodb-memory-server": "^8.0.0", "mongodb-memory-server": "^8.0.0",
"nodejs-file-downloader": "4.10.2",
"nodemon": "^2.0.7", "nodemon": "^2.0.7",
"pkg": "5.6.0", "pkg": "5.6.0",
"prettier": "^2.3.1", "prettier": "^2.3.1",
@@ -2539,6 +2541,30 @@
"node": ">= 4.0.0" "node": ">= 4.0.0"
} }
}, },
"node_modules/axios": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
"integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
"dev": true,
"dependencies": {
"follow-redirects": "^1.14.9",
"form-data": "^4.0.0"
}
},
"node_modules/axios/node_modules/form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"dev": true,
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/babel-jest": { "node_modules/babel-jest": {
"version": "27.0.6", "version": "27.0.6",
"resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-27.0.6.tgz", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-27.0.6.tgz",
@@ -4185,6 +4211,26 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/follow-redirects": {
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
"dev": true,
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/form-data": { "node_modules/form-data": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
@@ -7519,6 +7565,18 @@
"integrity": "sha512-uW7fodD6pyW2FZNZnp/Z3hvWKeEW1Y8R1+1CnErE8cXFXzl5blBOoVB41CvMer6P6Q0S5FXDwcHgFd1Wj0U9zg==", "integrity": "sha512-uW7fodD6pyW2FZNZnp/Z3hvWKeEW1Y8R1+1CnErE8cXFXzl5blBOoVB41CvMer6P6Q0S5FXDwcHgFd1Wj0U9zg==",
"dev": true "dev": true
}, },
"node_modules/nodejs-file-downloader": {
"version": "4.10.2",
"resolved": "https://registry.npmjs.org/nodejs-file-downloader/-/nodejs-file-downloader-4.10.2.tgz",
"integrity": "sha512-pTVlytER/4wxcIpEhLXoqhuJ7WH1+xSFNLbI0wPmbwH3pWlJRRebb1Kbu91mz1CyOJmO4sj6YLH1wkF1B6efrQ==",
"dev": true,
"dependencies": {
"follow-redirects": "^1.15.1",
"https-proxy-agent": "^5.0.0",
"mime-types": "^2.1.27",
"sanitize-filename": "^1.6.3"
}
},
"node_modules/nodemon": { "node_modules/nodemon": {
"version": "2.0.19", "version": "2.0.19",
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.19.tgz", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.19.tgz",
@@ -8469,6 +8527,15 @@
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
}, },
"node_modules/sanitize-filename": {
"version": "1.6.3",
"resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.3.tgz",
"integrity": "sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==",
"dev": true,
"dependencies": {
"truncate-utf8-bytes": "^1.0.0"
}
},
"node_modules/saslprep": { "node_modules/saslprep": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz",
@@ -9323,6 +9390,15 @@
"resolved": "https://registry.npmjs.org/traverse-chain/-/traverse-chain-0.1.0.tgz", "resolved": "https://registry.npmjs.org/traverse-chain/-/traverse-chain-0.1.0.tgz",
"integrity": "sha1-YdvC1Ttp/2CRoSoWj9fUMxB+QPE=" "integrity": "sha1-YdvC1Ttp/2CRoSoWj9fUMxB+QPE="
}, },
"node_modules/truncate-utf8-bytes": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz",
"integrity": "sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ==",
"dev": true,
"dependencies": {
"utf8-byte-length": "^1.0.1"
}
},
"node_modules/ts-jest": { "node_modules/ts-jest": {
"version": "27.0.3", "version": "27.0.3",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.0.3.tgz", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.0.3.tgz",
@@ -9626,6 +9702,12 @@
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz",
"integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0="
}, },
"node_modules/utf8-byte-length": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz",
"integrity": "sha512-4+wkEYLBbWxqTahEsWrhxepcoVOJ+1z5PGIjPZxRkytcdSUaNjIjBM7Xn8E+pdSuV7SzvWovBFA54FO0JSoqhA==",
"dev": true
},
"node_modules/util-deprecate": { "node_modules/util-deprecate": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
@@ -12061,6 +12143,29 @@
"integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==",
"dev": true "dev": true
}, },
"axios": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
"integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
"dev": true,
"requires": {
"follow-redirects": "^1.14.9",
"form-data": "^4.0.0"
},
"dependencies": {
"form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"dev": true,
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
}
}
},
"babel-jest": { "babel-jest": {
"version": "27.0.6", "version": "27.0.6",
"resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-27.0.6.tgz", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-27.0.6.tgz",
@@ -13332,6 +13437,12 @@
"path-exists": "^4.0.0" "path-exists": "^4.0.0"
} }
}, },
"follow-redirects": {
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
"dev": true
},
"form-data": { "form-data": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
@@ -15842,6 +15953,18 @@
"integrity": "sha512-uW7fodD6pyW2FZNZnp/Z3hvWKeEW1Y8R1+1CnErE8cXFXzl5blBOoVB41CvMer6P6Q0S5FXDwcHgFd1Wj0U9zg==", "integrity": "sha512-uW7fodD6pyW2FZNZnp/Z3hvWKeEW1Y8R1+1CnErE8cXFXzl5blBOoVB41CvMer6P6Q0S5FXDwcHgFd1Wj0U9zg==",
"dev": true "dev": true
}, },
"nodejs-file-downloader": {
"version": "4.10.2",
"resolved": "https://registry.npmjs.org/nodejs-file-downloader/-/nodejs-file-downloader-4.10.2.tgz",
"integrity": "sha512-pTVlytER/4wxcIpEhLXoqhuJ7WH1+xSFNLbI0wPmbwH3pWlJRRebb1Kbu91mz1CyOJmO4sj6YLH1wkF1B6efrQ==",
"dev": true,
"requires": {
"follow-redirects": "^1.15.1",
"https-proxy-agent": "^5.0.0",
"mime-types": "^2.1.27",
"sanitize-filename": "^1.6.3"
}
},
"nodemon": { "nodemon": {
"version": "2.0.19", "version": "2.0.19",
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.19.tgz", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.19.tgz",
@@ -16520,6 +16643,15 @@
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
}, },
"sanitize-filename": {
"version": "1.6.3",
"resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.3.tgz",
"integrity": "sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==",
"dev": true,
"requires": {
"truncate-utf8-bytes": "^1.0.0"
}
},
"saslprep": { "saslprep": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz",
@@ -17183,6 +17315,15 @@
"resolved": "https://registry.npmjs.org/traverse-chain/-/traverse-chain-0.1.0.tgz", "resolved": "https://registry.npmjs.org/traverse-chain/-/traverse-chain-0.1.0.tgz",
"integrity": "sha1-YdvC1Ttp/2CRoSoWj9fUMxB+QPE=" "integrity": "sha1-YdvC1Ttp/2CRoSoWj9fUMxB+QPE="
}, },
"truncate-utf8-bytes": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz",
"integrity": "sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ==",
"dev": true,
"requires": {
"utf8-byte-length": "^1.0.1"
}
},
"ts-jest": { "ts-jest": {
"version": "27.0.3", "version": "27.0.3",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.0.3.tgz", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.0.3.tgz",
@@ -17405,6 +17546,12 @@
} }
} }
}, },
"utf8-byte-length": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz",
"integrity": "sha512-4+wkEYLBbWxqTahEsWrhxepcoVOJ+1z5PGIjPZxRkytcdSUaNjIjBM7Xn8E+pdSuV7SzvWovBFA54FO0JSoqhA==",
"dev": true
},
"util-deprecate": { "util-deprecate": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",

View File

@@ -4,7 +4,7 @@
"description": "Api of SASjs server", "description": "Api of SASjs server",
"main": "./src/server.ts", "main": "./src/server.ts",
"scripts": { "scripts": {
"initial": "npm run swagger && npm run compileSysInit && npm run copySASjsCore", "initial": "npm run swagger && npm run compileSysInit && npm run copySASjsCore && npm run downloadMacros",
"prestart": "npm run initial", "prestart": "npm run initial",
"prebuild": "npm run initial", "prebuild": "npm run initial",
"start": "NODE_ENV=development nodemon ./src/server.ts", "start": "NODE_ENV=development nodemon ./src/server.ts",
@@ -17,20 +17,21 @@
"lint:fix": "npx prettier --write \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"", "lint:fix": "npx prettier --write \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"",
"lint": "npx prettier --check \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"", "lint": "npx prettier --check \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"",
"exe": "npm run build && pkg .", "exe": "npm run build && pkg .",
"copy:files": "npm run public:copy && npm run sasjsbuild:copy && npm run sasjscore:copy && npm run web:copy", "copy:files": "npm run public:copy && npm run sasjsbuild:copy && npm run sas:copy && npm run web:copy",
"public:copy": "cp -r ./public/ ./build/public/", "public:copy": "cp -r ./public/ ./build/public/",
"sasjsbuild:copy": "cp -r ./sasjsbuild/ ./build/sasjsbuild/", "sasjsbuild:copy": "cp -r ./sasjsbuild/ ./build/sasjsbuild/",
"sasjscore:copy": "cp -r ./sasjscore/ ./build/sasjscore/", "sas:copy": "cp -r ./sas/ ./build/sas/",
"web:copy": "rimraf web && mkdir web && cp -r ../web/build/ ./web/build/", "web:copy": "rimraf web && mkdir web && cp -r ../web/build/ ./web/build/",
"compileSysInit": "ts-node ./scripts/compileSysInit.ts", "compileSysInit": "ts-node ./scripts/compileSysInit.ts",
"copySASjsCore": "ts-node ./scripts/copySASjsCore.ts" "copySASjsCore": "ts-node ./scripts/copySASjsCore.ts",
"downloadMacros": "ts-node ./scripts/downloadMacros.ts"
}, },
"bin": "./build/src/server.js", "bin": "./build/src/server.js",
"pkg": { "pkg": {
"assets": [ "assets": [
"./build/public/**/*", "./build/public/**/*",
"./build/sasjsbuild/**/*", "./build/sasjsbuild/**/*",
"./build/sasjscore/**/*", "./build/sas/**/*",
"./web/build/**/*" "./web/build/**/*"
], ],
"targets": [ "targets": [
@@ -86,11 +87,13 @@
"@types/swagger-ui-express": "^4.1.3", "@types/swagger-ui-express": "^4.1.3",
"@types/unzipper": "^0.10.5", "@types/unzipper": "^0.10.5",
"adm-zip": "^0.5.9", "adm-zip": "^0.5.9",
"axios": "0.27.2",
"csrf": "^3.1.0", "csrf": "^3.1.0",
"dotenv": "^10.0.0", "dotenv": "^10.0.0",
"http-headers-validation": "^0.0.1", "http-headers-validation": "^0.0.1",
"jest": "^27.0.6", "jest": "^27.0.6",
"mongodb-memory-server": "^8.0.0", "mongodb-memory-server": "^8.0.0",
"nodejs-file-downloader": "4.10.2",
"nodemon": "^2.0.7", "nodemon": "^2.0.7",
"pkg": "5.6.0", "pkg": "5.6.0",
"prettier": "^2.3.1", "prettier": "^2.3.1",

View File

@@ -641,9 +641,9 @@ paths:
- -
bearerAuth: [] bearerAuth: []
parameters: [] parameters: []
/SASjsApi/authConfig/synchronizeWithLDAP: /SASjsApi/authConfig/synchroniseWithLDAP:
post: post:
operationId: SynchronizeWithLDAP operationId: SynchroniseWithLDAP
responses: responses:
'200': '200':
description: Ok description: Ok
@@ -660,7 +660,7 @@ paths:
examples: examples:
'Example 1': 'Example 1':
value: {users: 5, groups: 3} value: {users: 5, groups: 3}
summary: 'Synchronizes LDAP users and groups with internal DB and returns the count of imported users and groups.' summary: 'Synchronises LDAP users and groups with internal DB and returns the count of imported users and groups.'
tags: tags:
- Auth_Config - Auth_Config
security: security:

View File

@@ -0,0 +1,39 @@
import axios from 'axios'
import Downloader from 'nodejs-file-downloader'
import { createFile, listFilesInFolder } from '@sasjs/utils'
import { sasJSCoreMacros, sasJSCoreMacrosInfo } from '../src/utils/file'
export const downloadMacros = async () => {
const url =
'https://api.github.com/repos/yabwon/SAS_PACKAGES/contents/SPF/Macros'
console.info(`Downloading macros from ${url}`)
await axios
.get(url)
.then(async (res) => {
await downloadFiles(res.data)
})
.catch((err) => {
throw new Error(err)
})
}
const downloadFiles = async function (fileList: any) {
for (const file of fileList) {
const downloader = new Downloader({
url: file.download_url,
directory: sasJSCoreMacros,
fileName: file.path.replace(/^SPF\/Macros/, ''),
cloneFiles: false
})
await downloader.download()
}
const fileNames = await listFilesInFolder(sasJSCoreMacros)
await createFile(sasJSCoreMacrosInfo, fileNames.join('\n'))
}
downloadMacros()

View File

@@ -30,20 +30,20 @@ export class AuthConfigController {
} }
/** /**
* @summary Synchronizes LDAP users and groups with internal DB and returns the count of imported users and groups. * @summary Synchronises LDAP users and groups with internal DB and returns the count of imported users and groups.
* *
*/ */
@Example({ @Example({
users: 5, users: 5,
groups: 3 groups: 3
}) })
@Post('/synchronizeWithLDAP') @Post('/synchroniseWithLDAP')
public async synchronizeWithLDAP() { public async synchroniseWithLDAP() {
return synchronizeWithLDAP() return synchroniseWithLDAP()
} }
} }
const synchronizeWithLDAP = async () => { const synchroniseWithLDAP = async () => {
process.logger.info('Syncing LDAP with internal DB') process.logger.info('Syncing LDAP with internal DB')
const permissions = await Permission.get({}) const permissions = await Permission.get({})

View File

@@ -3,6 +3,7 @@ import { Session } from '../../types'
import { promisify } from 'util' import { promisify } from 'util'
import { execFile } from 'child_process' import { execFile } from 'child_process'
import { import {
getPackagesFolder,
getSessionsFolder, getSessionsFolder,
generateUniqueFileName, generateUniqueFileName,
sysInitCompiledPath, sysInitCompiledPath,
@@ -104,7 +105,8 @@ export class SASSessionController extends SessionController {
// the autoexec file is executed on SAS startup // the autoexec file is executed on SAS startup
const autoExecPath = path.join(sessionFolder, 'autoexec.sas') const autoExecPath = path.join(sessionFolder, 'autoexec.sas')
const contentForAutoExec = `/* compiled systemInit */ const contentForAutoExec = `filename packages "${getPackagesFolder()}";
/* compiled systemInit */
${compiledSystemInitContent} ${compiledSystemInitContent}
/* autoexec */ /* autoexec */
${autoExecContent}` ${autoExecContent}`

View File

@@ -12,10 +12,10 @@ authConfigRouter.get('/', async (req, res) => {
} }
}) })
authConfigRouter.post('/synchronizeWithLDAP', async (req, res) => { authConfigRouter.post('/synchroniseWithLDAP', async (req, res) => {
const controller = new AuthConfigController() const controller = new AuthConfigController()
try { try {
const response = await controller.synchronizeWithLDAP() const response = await controller.synchroniseWithLDAP()
res.send(response) res.send(response)
} catch (err: any) { } catch (err: any) {
res.status(500).send(err.toString()) res.status(500).send(err.toString())

View File

@@ -10,7 +10,7 @@ export const sysInitCompiledPath = path.join(
'systemInitCompiled.sas' 'systemInitCompiled.sas'
) )
export const sasJSCoreMacros = path.join(apiRoot, 'sasjscore') export const sasJSCoreMacros = path.join(apiRoot, 'sas', 'sasautos')
export const sasJSCoreMacrosInfo = path.join(sasJSCoreMacros, '.macrolist') export const sasJSCoreMacrosInfo = path.join(sasJSCoreMacros, '.macrolist')
export const getWebBuildFolder = () => path.join(codebaseRoot, 'web', 'build') export const getWebBuildFolder = () => path.join(codebaseRoot, 'web', 'build')
@@ -28,7 +28,10 @@ export const getAppStreamConfigPath = () =>
path.join(getSasjsRootFolder(), 'appStreamConfig.json') path.join(getSasjsRootFolder(), 'appStreamConfig.json')
export const getMacrosFolder = () => export const getMacrosFolder = () =>
path.join(getSasjsRootFolder(), 'sasjscore') path.join(getSasjsRootFolder(), 'sas', 'sasautos')
export const getPackagesFolder = () =>
path.join(getSasjsRootFolder(), 'sas', 'sas_packages')
export const getUploadsFolder = () => path.join(getSasjsRootFolder(), 'uploads') export const getUploadsFolder = () => path.join(getSasjsRootFolder(), 'uploads')

View File

@@ -1,10 +1,15 @@
import { createFile, createFolder, fileExists } from '@sasjs/utils' import { createFile, createFolder, fileExists } from '@sasjs/utils'
import { getDesktopUserAutoExecPath, getFilesFolder } from './file' import {
getDesktopUserAutoExecPath,
getFilesFolder,
getPackagesFolder
} from './file'
import { ModeType } from './verifyEnvVariables' import { ModeType } from './verifyEnvVariables'
export const setupFolders = async () => { export const setupFolders = async () => {
const drivePath = getFilesFolder() const drivePath = getFilesFolder()
await createFolder(drivePath) await createFolder(drivePath)
await createFolder(getPackagesFolder())
if (process.env.MODE === ModeType.Desktop) { if (process.env.MODE === ModeType.Desktop) {
if (!(await fileExists(getDesktopUserAutoExecPath()))) { if (!(await fileExists(getDesktopUserAutoExecPath()))) {

View File

@@ -35,10 +35,10 @@ const AuthConfig = () => {
.finally(() => setIsLoading(false)) .finally(() => setIsLoading(false))
}, []) }, [])
const synchronizeWithLDAP = () => { const synchroniseWithLDAP = () => {
setIsLoading(true) setIsLoading(true)
axios axios
.post(`/SASjsApi/authConfig/synchronizeWithLDAP`) .post(`/SASjsApi/authConfig/synchroniseWithLDAP`)
.then((res: any) => { .then((res: any) => {
const { userCount, groupCount } = res.data const { userCount, groupCount } = res.data
toast.success( toast.success(
@@ -137,9 +137,9 @@ const AuthConfig = () => {
<Button <Button
type="submit" type="submit"
variant="contained" variant="contained"
onClick={synchronizeWithLDAP} onClick={synchroniseWithLDAP}
> >
Synchronize Synchronise
</Button> </Button>
</CardActions> </CardActions>
</Card> </Card>