@openstax/ts-utils 1.21.12 → 1.23.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 (35) hide show
  1. package/dist/cjs/errors/index.d.ts +11 -0
  2. package/dist/cjs/errors/index.js +15 -1
  3. package/dist/cjs/middleware/apiErrorHandler.d.ts +4 -3
  4. package/dist/cjs/middleware/apiErrorHandler.js +4 -3
  5. package/dist/cjs/misc/helpers.js +1 -1
  6. package/dist/cjs/services/accountsGateway/index.js +3 -4
  7. package/dist/cjs/services/apiGateway/index.d.ts +6 -2
  8. package/dist/cjs/services/apiGateway/index.js +17 -5
  9. package/dist/cjs/services/fileServer/index.d.ts +0 -2
  10. package/dist/cjs/services/fileServer/localFileServer.d.ts +0 -4
  11. package/dist/cjs/services/fileServer/localFileServer.js +0 -57
  12. package/dist/cjs/services/fileServer/s3FileServer.js +0 -24
  13. package/dist/cjs/services/lrsGateway/index.js +1 -1
  14. package/dist/cjs/services/postgresConnection/index.js +1 -3
  15. package/dist/cjs/tsconfig.without-specs.cjs.tsbuildinfo +1 -1
  16. package/dist/esm/errors/index.d.ts +11 -0
  17. package/dist/esm/errors/index.js +13 -0
  18. package/dist/esm/middleware/apiErrorHandler.d.ts +4 -3
  19. package/dist/esm/middleware/apiErrorHandler.js +5 -4
  20. package/dist/esm/misc/helpers.js +1 -1
  21. package/dist/esm/services/accountsGateway/index.js +3 -4
  22. package/dist/esm/services/apiGateway/index.d.ts +6 -2
  23. package/dist/esm/services/apiGateway/index.js +18 -6
  24. package/dist/esm/services/fileServer/index.d.ts +0 -2
  25. package/dist/esm/services/fileServer/localFileServer.d.ts +0 -4
  26. package/dist/esm/services/fileServer/localFileServer.js +0 -57
  27. package/dist/esm/services/fileServer/s3FileServer.js +1 -25
  28. package/dist/esm/services/lrsGateway/index.js +1 -1
  29. package/dist/esm/services/postgresConnection/index.js +1 -3
  30. package/dist/esm/tsconfig.without-specs.esm.tsbuildinfo +1 -1
  31. package/package.json +16 -16
  32. package/script/bin/deploy.bash +8 -0
  33. package/script/bin/get-env-param.bash +3 -3
  34. package/script/bin/init-params-script.bash +10 -1
  35. package/script/bin/upload-params.bash +3 -3
package/package.json CHANGED
@@ -1,15 +1,14 @@
1
1
  {
2
2
  "name": "@openstax/ts-utils",
3
- "version": "1.21.12",
3
+ "version": "1.23.0",
4
4
  "bin": {
5
5
  "ts-utils": "./script/bin-entry.bash"
6
6
  },
7
7
  "dependencies": {
8
8
  "@aws-sdk/client-dynamodb": "^3.171.0",
9
- "@aws-sdk/client-s3": "^3.744.0",
9
+ "@aws-sdk/client-s3": "^3.171.0",
10
10
  "@aws-sdk/client-ssm": "^3.171.0",
11
11
  "@aws-sdk/client-sts": "^3.171.0",
12
- "@aws-sdk/s3-request-presigner": "^3.744.0",
13
12
  "aws-sdk": "^2.1145.0",
14
13
  "cookie": "^0.5.0",
15
14
  "date-fns": "^2.29.2",
@@ -24,28 +23,22 @@
24
23
  },
25
24
  "devDependencies": {
26
25
  "@types/cookie": "^0.5.0",
27
- "@types/cors": "^2.8.13",
28
26
  "@types/deep-equal": "^1.0.1",
29
- "@types/express": "^4.17.13",
30
27
  "@types/jest": "^29.1.1",
31
28
  "@types/jsonwebtoken": "^9.0.1",
32
29
  "@types/lodash": "^4.14.200",
33
30
  "@types/ms": "^0.7.34",
34
- "@types/multer": "^1.4.7",
35
31
  "@types/node": "^17.0.35",
36
32
  "@types/node-fetch": "^2.6.11",
37
33
  "@types/node-jose": "^1.1.12",
38
34
  "@types/uuid": "^8.3.4",
39
35
  "@typescript-eslint/eslint-plugin": "^5.13.0",
40
36
  "@typescript-eslint/parser": "^5.13.0",
41
- "cors": "^2.8.5",
42
37
  "cspell": "^5.18.5",
43
38
  "eslint": "^8.10.0",
44
39
  "eslint-plugin-import": "^2.25.4",
45
40
  "eslint-plugin-jest": "^26.1.1",
46
- "express": "^4.17.3",
47
41
  "jest": "^29.1.1",
48
- "multer": "^1.4.5-lts.1",
49
42
  "node-fetch": "^2.7.0",
50
43
  "npm-run-all": "^4.1.5",
51
44
  "postgres": "^3.4.5",
@@ -182,10 +175,20 @@
182
175
  "import": "./dist/esm/services/apiGateway/index.js",
183
176
  "require": "./dist/cjs/services/apiGateway/index.js"
184
177
  },
185
- "./services/fileServer": {
186
- "browser": "./dist/cjs/services/fileServer/index.js",
187
- "import": "./dist/esm/services/fileServer/index.js",
188
- "require": "./dist/cjs/services/fileServer/index.js"
178
+ "./services/fileserver": {
179
+ "browser": "./dist/cjs/services/fileserver/index.js",
180
+ "import": "./dist/esm/services/fileserver/index.js",
181
+ "require": "./dist/cjs/services/fileserver/index.js"
182
+ },
183
+ "./services/fileserver/localFileServer": {
184
+ "browser": "./dist/cjs/services/fileserver/localFileServer/index.js",
185
+ "import": "./dist/esm/services/fileserver/localFileServer/index.js",
186
+ "require": "./dist/cjs/services/fileserver/localFileServer/index.js"
187
+ },
188
+ "./services/fileserver/s3FileServer": {
189
+ "browser": "./dist/cjs/services/fileserver/s3FileServer/index.js",
190
+ "import": "./dist/esm/services/fileserver/s3FileServer/index.js",
191
+ "require": "./dist/cjs/services/fileserver/s3FileServer/index.js"
189
192
  },
190
193
  "./services/postgresConnection": {
191
194
  "browser": "./dist/cjs/services/postgresConnection/index.js",
@@ -200,9 +203,6 @@
200
203
  "license": "MIT",
201
204
  "main": "index.js",
202
205
  "peerDependencies": {
203
- "cors": "^2.8.5",
204
- "express": "^4.17.3",
205
- "multer": "^1.4.5-lts.1",
206
206
  "postgres": "^3.4.5",
207
207
  "zod": "^3.23.8"
208
208
  },
@@ -38,4 +38,12 @@ if [ ! -f "./deploy/deploy.bash" ]; then
38
38
  exit 1
39
39
  fi;
40
40
 
41
+ source $(yarn -s ts-utils which init-params-script)
42
+
43
+ missing_params=$(get_missing_param_names)
44
+ if [ -n "$missing_params" ]; then
45
+ echo "please upload the following params before deploying: $missing_params"
46
+ exit 1
47
+ fi
48
+
41
49
  ./deploy/deploy.bash
@@ -5,12 +5,12 @@ set -euo pipefail; if [ -n "${DEBUG-}" ]; then set -x; fi
5
5
  source $(yarn -s ts-utils which init-constants-script)
6
6
  source $(yarn -s ts-utils which init-params-script)
7
7
 
8
- environment=$(yarn -s ts-utils get-arg 0 "$@")
8
+ ENVIRONMENT=$(yarn -s ts-utils get-arg 0 "$@")
9
9
  param=$(yarn -s ts-utils get-arg 1 "$@")
10
10
 
11
- if [ -z "$environment" ] || [ -z "$param" ]; then
11
+ if [ -z "$ENVIRONMENT" ] || [ -z "$param" ]; then
12
12
  cat <<HEREDOC
13
- Usage: $(basename ${BASH_SOURCE[0]}) <environment> <parameter name>
13
+ Usage: $(basename ${BASH_SOURCE[0]}) <environment> <parameter name>
14
14
 
15
15
  Shows secret value from AWS parameter store
16
16
  HEREDOC
@@ -37,7 +37,7 @@ if [ -z "${aws_version##aws-cli/1.*}" ]; then
37
37
  fi
38
38
 
39
39
  function get_param_name() {
40
- echo "/$APPLICATION/$environment/api/$param"
40
+ echo "/$APPLICATION/$ENVIRONMENT/api/$param"
41
41
  }
42
42
 
43
43
  function get_value() {
@@ -50,6 +50,15 @@ function get_parameter() {
50
50
  --query Parameter.Value --output text 2>&1
51
51
  }
52
52
 
53
+ function get_missing_param_names() {
54
+ names=()
55
+ for param in "${PARAMS[@]}"; do
56
+ name=$param
57
+ names+=($(get_param_name))
58
+ done
59
+ aws ssm get-parameters --region "$region" --names "${names[@]}" --query InvalidParameters --output text 2>&1
60
+ }
61
+
53
62
  function upload_parameter() {
54
63
  set +e
55
64
  previous_value=$(get_parameter)
@@ -7,9 +7,9 @@ source $(yarn -s ts-utils which init-params-script)
7
7
 
8
8
  if [ -z "${PARAMS:-}" ]; then echo "PARAMS must be set" > /dev/stderr; exit 1; fi
9
9
 
10
- environment=$(yarn -s ts-utils get-arg 0 "$@")
10
+ ENVIRONMENT=$(yarn -s ts-utils get-arg 0 "$@")
11
11
 
12
- if [ -z "$environment" ]; then
12
+ if [ -z "$ENVIRONMENT" ]; then
13
13
  cat <<HEREDOC
14
14
  Usage: $(basename "${BASH_SOURCE[0]}") <environment> [options]
15
15
 
@@ -56,4 +56,4 @@ for param in $params_with_value; do
56
56
  upload_parameter
57
57
  done
58
58
 
59
- printf "\nSuccessfully uploaded %sparameters for %s-%s\n\n" "${partial:+partial }" "$environment" "$APPLICATION"
59
+ printf "\nSuccessfully uploaded %sparameters for %s-%s\n\n" "${partial:+partial }" "$ENVIRONMENT" "$APPLICATION"