@openstax/ts-utils 1.21.12 → 1.24.1-hotfix

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 (37) 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 +14 -5
  9. package/dist/cjs/services/fileServer/localFileServer.js +5 -4
  10. package/dist/cjs/services/fileServer/s3FileServer.js +1 -0
  11. package/dist/cjs/services/lrsGateway/index.js +1 -1
  12. package/dist/cjs/services/openSearch.d.ts +29 -0
  13. package/dist/cjs/services/openSearch.js +107 -0
  14. package/dist/cjs/services/searchProvider/index.d.ts +1 -0
  15. package/dist/cjs/services/searchProvider/memorySearchTheBadWay.js +11 -4
  16. package/dist/cjs/tsconfig.without-specs.cjs.tsbuildinfo +1 -1
  17. package/dist/esm/errors/index.d.ts +11 -0
  18. package/dist/esm/errors/index.js +13 -0
  19. package/dist/esm/middleware/apiErrorHandler.d.ts +4 -3
  20. package/dist/esm/middleware/apiErrorHandler.js +5 -4
  21. package/dist/esm/misc/helpers.js +1 -1
  22. package/dist/esm/services/accountsGateway/index.js +3 -4
  23. package/dist/esm/services/apiGateway/index.d.ts +6 -2
  24. package/dist/esm/services/apiGateway/index.js +14 -5
  25. package/dist/esm/services/fileServer/localFileServer.js +6 -5
  26. package/dist/esm/services/fileServer/s3FileServer.js +1 -0
  27. package/dist/esm/services/lrsGateway/index.js +1 -1
  28. package/dist/esm/services/openSearch.d.ts +29 -0
  29. package/dist/esm/services/openSearch.js +103 -0
  30. package/dist/esm/services/searchProvider/index.d.ts +1 -0
  31. package/dist/esm/services/searchProvider/memorySearchTheBadWay.js +11 -4
  32. package/dist/esm/tsconfig.without-specs.esm.tsbuildinfo +1 -1
  33. package/package.json +3 -1
  34. package/script/bin/deploy.bash +8 -0
  35. package/script/bin/get-env-param.bash +3 -3
  36. package/script/bin/init-params-script.bash +10 -1
  37. package/script/bin/upload-params.bash +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openstax/ts-utils",
3
- "version": "1.21.12",
3
+ "version": "1.24.1-hotfix",
4
4
  "bin": {
5
5
  "ts-utils": "./script/bin-entry.bash"
6
6
  },
@@ -23,6 +23,7 @@
23
23
  "uuid": "^9.0.0"
24
24
  },
25
25
  "devDependencies": {
26
+ "@opensearch-project/opensearch": "^1.2.0",
26
27
  "@types/cookie": "^0.5.0",
27
28
  "@types/cors": "^2.8.13",
28
29
  "@types/deep-equal": "^1.0.1",
@@ -200,6 +201,7 @@
200
201
  "license": "MIT",
201
202
  "main": "index.js",
202
203
  "peerDependencies": {
204
+ "@opensearch-project/opensearch": "^1.2.0",
203
205
  "cors": "^2.8.5",
204
206
  "express": "^4.17.3",
205
207
  "multer": "^1.4.5-lts.1",
@@ -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"