@openstax/ts-utils 1.46.0 → 1.48.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 (45) hide show
  1. package/dist/cjs/misc/hashValue.js +2 -2
  2. package/dist/cjs/misc/jwks.d.ts +5 -2
  3. package/dist/cjs/services/apiGateway/index.js +1 -2
  4. package/dist/cjs/services/assignmentsGateway/index.d.ts +26 -0
  5. package/dist/cjs/services/assignmentsGateway/index.js +31 -0
  6. package/dist/cjs/services/authProvider/index.js +3 -6
  7. package/dist/cjs/services/authProvider/utils/userSubrequest.js +2 -5
  8. package/dist/cjs/services/fileServer/localFileServer.js +2 -3
  9. package/dist/cjs/services/fileServer/s3FileServer.js +2 -2
  10. package/dist/cjs/services/httpMessage/verifier.d.ts +2 -2
  11. package/dist/cjs/services/keyStore/index.d.ts +3 -6
  12. package/dist/cjs/services/keyStore/index.js +20 -9
  13. package/dist/cjs/services/launchParams/verifier.d.ts +2 -2
  14. package/dist/cjs/services/lrsGateway/addStatementDefaultFields.js +1 -2
  15. package/dist/cjs/services/lrsGateway/file-system.js +2 -2
  16. package/dist/cjs/tsconfig.without-specs.cjs.tsbuildinfo +1 -1
  17. package/dist/esm/misc/hashValue.js +2 -2
  18. package/dist/esm/misc/jwks.d.ts +5 -2
  19. package/dist/esm/services/apiGateway/index.js +1 -2
  20. package/dist/esm/services/assignmentsGateway/index.d.ts +26 -0
  21. package/dist/esm/services/assignmentsGateway/index.js +27 -0
  22. package/dist/esm/services/authProvider/index.js +3 -3
  23. package/dist/esm/services/authProvider/utils/userSubrequest.js +2 -2
  24. package/dist/esm/services/fileServer/localFileServer.js +2 -3
  25. package/dist/esm/services/fileServer/s3FileServer.js +2 -2
  26. package/dist/esm/services/httpMessage/verifier.d.ts +2 -2
  27. package/dist/esm/services/keyStore/index.d.ts +3 -6
  28. package/dist/esm/services/keyStore/index.js +20 -9
  29. package/dist/esm/services/launchParams/verifier.d.ts +2 -2
  30. package/dist/esm/services/lrsGateway/addStatementDefaultFields.js +1 -2
  31. package/dist/esm/services/lrsGateway/file-system.js +2 -2
  32. package/dist/esm/tsconfig.without-specs.esm.tsbuildinfo +1 -1
  33. package/package.json +16 -15
  34. package/script/bin/delete-stack.bash +2 -2
  35. package/script/bin/deploy.bash +14 -3
  36. package/script/bin/destroy-deployment.bash +4 -4
  37. package/script/bin/get-deployed-environments.bash +1 -1
  38. package/script/bin/get-env-param.bash +4 -4
  39. package/script/bin/init-constants-script.bash +1 -1
  40. package/script/bin/init-params-script.bash +1 -1
  41. package/script/bin/update-utils.bash +3 -3
  42. package/script/bin/upload-pager-duty-endpoints.bash +3 -3
  43. package/script/bin/upload-params.bash +5 -5
  44. package/script/bin-entry.bash +1 -1
  45. package/script/build.bash +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openstax/ts-utils",
3
- "version": "1.46.0",
3
+ "version": "1.48.0",
4
4
  "bin": {
5
5
  "ts-utils": "./script/bin-entry.bash"
6
6
  },
@@ -13,38 +13,34 @@
13
13
  "@aws-sdk/s3-presigned-post": "^3.267.0",
14
14
  "@aws-sdk/s3-request-presigner": "^3.267.0",
15
15
  "@aws-sdk/util-dynamodb": "^3.171.0",
16
- "aws-sdk": "^2.1145.0",
17
- "cookie": "^0.5.0",
16
+ "cookie": "^1.1.1",
18
17
  "date-fns": "^2.29.2",
19
18
  "deep-equal": "^2.1.0",
20
- "http-message-signatures": "^1.0.4",
19
+ "http-message-signatures": "1.0.4",
20
+ "js-sha1": "^0.7.0",
21
21
  "jsonwebtoken": "^9.0.0",
22
22
  "jwks-rsa": "^3.1.0",
23
23
  "ms": "^2.1.3",
24
- "node-jose": "^2.2.0",
25
24
  "path-to-regexp": "^6.2.0",
26
25
  "query-string": "^7.1.1",
27
26
  "structured-headers": "^1.0.1",
28
- "tiny-async-pool": "^2.1.0",
29
- "uuid": "^9.0.0"
27
+ "tiny-async-pool": "^2.1.0"
30
28
  },
31
29
  "devDependencies": {
32
30
  "@eslint/js": "^9.39.1",
33
31
  "@opensearch-project/opensearch": "^1.2.0",
34
32
  "@types/busboy": "^1.5.0",
35
- "@types/cookie": "^0.5.0",
36
33
  "@types/deep-equal": "^1.0.1",
37
34
  "@types/jest": "^29.5.14",
35
+ "@types/js-sha1": "^0.6.3",
38
36
  "@types/jsonwebtoken": "^9.0.1",
39
37
  "@types/lodash": "^4.14.200",
40
38
  "@types/ms": "^0.7.34",
41
39
  "@types/node": "^24.2.0",
42
40
  "@types/node-fetch": "^2.6.11",
43
- "@types/node-jose": "^1.1.12",
44
41
  "@types/tiny-async-pool": "^2.0.0",
45
- "@types/uuid": "^8.3.4",
46
42
  "busboy": "^1.6.0",
47
- "cspell": "^5.18.5",
43
+ "cspell": "^10.0.0",
48
44
  "eslint": "^9.39.1",
49
45
  "eslint-plugin-import-x": "^4.15.0",
50
46
  "eslint-plugin-jest": "^28.11.0",
@@ -142,6 +138,11 @@
142
138
  "import": "./dist/esm/services/accountsGateway/index.js",
143
139
  "require": "./dist/cjs/services/accountsGateway/index.js"
144
140
  },
141
+ "./services/assignmentsGateway": {
142
+ "browser": "./dist/esm/services/assignmentsGateway/index.js",
143
+ "import": "./dist/esm/services/assignmentsGateway/index.js",
144
+ "require": "./dist/cjs/services/assignmentsGateway/index.js"
145
+ },
145
146
  "./services/logger": {
146
147
  "browser": "./dist/esm/services/logger/index.js",
147
148
  "import": "./dist/esm/services/logger/index.js",
@@ -242,16 +243,16 @@
242
243
  },
243
244
  "scripts": {
244
245
  "build": "./script/build.bash",
245
- "build:clean": "yarn clean && yarn build",
246
+ "build:clean": "npm run clean && npm run build",
246
247
  "ci": "CI=true npm-run-all ci:*",
247
248
  "ci:lint": "eslint --max-warnings=0 .",
248
- "ci:spelling": "git ls-files | yarn cspell -c ../../cspell.json --file-list stdin",
249
- "ci:test": "yarn jest --coverage",
249
+ "ci:spelling": "cspell -c ../../cspell.json --gitignore --gitignore-root ../.. '**'",
250
+ "ci:test": "jest --coverage",
250
251
  "ci:typecheck": "tsc --noEmit",
251
252
  "clean": "rm -rf dist",
252
253
  "coverage-report": "open coverage/index.html",
253
254
  "start": "./script/build.bash --watch",
254
- "test": "yarn jest"
255
+ "test": "jest"
255
256
  },
256
257
  "sideEffects": false,
257
258
  "types": "index.d.ts",
@@ -8,11 +8,11 @@ name=$1
8
8
  region=$2
9
9
 
10
10
  printf "\nchecking %s stack..." "$name"
11
- if AWS_DEFAULT_REGION="$region" yarn -s ts-utils stack-exists "$name"; then
11
+ if AWS_DEFAULT_REGION="$region" ts-utils stack-exists "$name"; then
12
12
  printf " deleting it"
13
13
  AWS_DEFAULT_REGION="$region" aws cloudformation delete-stack --region "$region" --stack-name "$name"
14
14
 
15
- while AWS_DEFAULT_REGION="$region" yarn -s ts-utils stack-exists "$name"; do
15
+ while AWS_DEFAULT_REGION="$region" ts-utils stack-exists "$name"; do
16
16
  printf "."
17
17
  sleep 5
18
18
  done
@@ -2,7 +2,7 @@
2
2
  # spell-checker: ignore pipefail
3
3
  set -euo pipefail; if [ -n "${DEBUG-}" ]; then set -x; fi
4
4
 
5
- source $(yarn -s ts-utils which init-constants-script)
5
+ source "$(ts-utils which init-constants-script)"
6
6
 
7
7
  if [ -z "${APPLICATION:-}" ]; then echo "APPLICATION must be set" > /dev/stderr; exit 1; fi
8
8
  if [ -z "${OWNER:-}" ]; then echo "OWNER must be set" > /dev/stderr; exit 1; fi
@@ -12,7 +12,7 @@ if [ -z "${AWS_DEFAULT_REGION:-}" ]; then echo "AWS_DEFAULT_REGION must be set"
12
12
  if [ "$#" -lt 1 ]; then
13
13
  cat <<HEREDOC
14
14
 
15
- Usage: yarn -s ts-utils deploy <environment>
15
+ Usage: npx ts-utils deploy <environment>
16
16
 
17
17
  Deploys the given $APPLICATION environment
18
18
 
@@ -33,12 +33,23 @@ if [ -z "$AWS_ACCOUNT" ]; then
33
33
  exit 1
34
34
  fi
35
35
 
36
+ # deploy.bash triggers the sbom emission workflow via `gh workflow run` after
37
+ # a successful deploy, so the cli has to be installed and authenticated.
38
+ if ! command -v gh > /dev/null 2>&1; then
39
+ echo "gh cli not found. install from https://cli.github.com/ before deploying" > /dev/stderr
40
+ exit 1
41
+ fi
42
+ if ! gh auth status > /dev/null 2>&1; then
43
+ echo "gh cli not authenticated. run 'gh auth login' before deploying" > /dev/stderr
44
+ exit 1
45
+ fi
46
+
36
47
  if [ ! -f "./deploy/deploy.bash" ]; then
37
48
  echo "could not find project deployment script at ./deploy/deploy.bash" > /dev/stderr;
38
49
  exit 1
39
50
  fi;
40
51
 
41
- source $(yarn -s ts-utils which init-params-script)
52
+ source "$(ts-utils which init-params-script)"
42
53
 
43
54
  missing_params=$(get_missing_param_names)
44
55
  if [ -n "$missing_params" ]; then
@@ -2,7 +2,7 @@
2
2
  # spell-checker: ignore pipefail kwarg
3
3
  set -euo pipefail; if [ -n "${DEBUG-}" ]; then set -x; fi
4
4
 
5
- source $(yarn -s ts-utils which init-constants-script)
5
+ source "$(ts-utils which init-constants-script)"
6
6
 
7
7
  if [ -z "${APPLICATION:-}" ]; then echo "APPLICATION must be set" > /dev/stderr; exit 1; fi
8
8
  if [ -z "${OWNER:-}" ]; then echo "OWNER must be set" > /dev/stderr; exit 1; fi
@@ -12,7 +12,7 @@ if [ -z "${AWS_DEFAULT_REGION:-}" ]; then echo "AWS_DEFAULT_REGION must be set"
12
12
  function print_usage_and_exit() {
13
13
  cat <<HEREDOC
14
14
 
15
- Usage: yarn -s ts-utils destroy-deployment <environment> [options]
15
+ Usage: npx ts-utils destroy-deployment <environment> [options]
16
16
 
17
17
  Destroys the given $APPLICATION environment
18
18
 
@@ -28,10 +28,10 @@ if [ "$#" -lt 1 ]; then
28
28
  print_usage_and_exit
29
29
  fi
30
30
 
31
- ENVIRONMENT=$(yarn -s ts-utils get-arg 0 "$@")
31
+ ENVIRONMENT=$(ts-utils get-arg 0 "$@")
32
32
  export ENVIRONMENT;
33
33
 
34
- YES=$(yarn -s ts-utils get-kwarg y "$@")
34
+ YES=$(ts-utils get-kwarg y "$@")
35
35
  export YES
36
36
 
37
37
  if [ -z "$YES" ]; then
@@ -2,7 +2,7 @@
2
2
  # spell-checker: ignore pipefail
3
3
  set -euo pipefail; if [ -n "${DEBUG-}" ]; then set -x; fi
4
4
 
5
- source $(yarn -s ts-utils which init-constants-script)
5
+ source "$(ts-utils which init-constants-script)"
6
6
 
7
7
  if [ -z "${AWS_DEFAULT_REGION:-}" ]; then echo "AWS_DEFAULT_REGION must be set" > /dev/stderr; exit 1; fi
8
8
 
@@ -2,11 +2,11 @@
2
2
  # spell-checker: ignore pipefail
3
3
  set -euo pipefail; if [ -n "${DEBUG-}" ]; then set -x; fi
4
4
 
5
- source $(yarn -s ts-utils which init-constants-script)
6
- source $(yarn -s ts-utils which init-params-script)
5
+ source "$(ts-utils which init-constants-script)"
6
+ source "$(ts-utils which init-params-script)"
7
7
 
8
- ENVIRONMENT=$(yarn -s ts-utils get-arg 0 "$@")
9
- param=$(yarn -s ts-utils get-arg 1 "$@")
8
+ ENVIRONMENT=$(ts-utils get-arg 0 "$@")
9
+ param=$(ts-utils get-arg 1 "$@")
10
10
 
11
11
  if [ -z "$ENVIRONMENT" ] || [ -z "$param" ]; then
12
12
  cat <<HEREDOC
@@ -11,7 +11,7 @@ if [ "$sourced" == "false" ]; then
11
11
  exit 1
12
12
  fi;
13
13
 
14
- # yarn seems to naturally run things from the project root, so this is just a safety check
14
+ # npm runs scripts from the project root, so this is just a safety check
15
15
  if [ ! -f "./deploy/constants.env" ]; then
16
16
  echo "This command must be run from the project root directory" > /dev/stderr;
17
17
  exit 1
@@ -17,7 +17,7 @@ if [ -z "${APPLICATION:-}" ]; then echo "APPLICATION must be set" > /dev/stderr;
17
17
  if [ -z "${OWNER:-}" ]; then echo "OWNER must be set" > /dev/stderr; exit 1; fi
18
18
  if [ -z "${PROJECT:-}" ]; then echo "PROJECT must be set" > /dev/stderr; exit 1; fi
19
19
 
20
- region=$(yarn -s ts-utils get-kwarg r "$@")
20
+ region=$(ts-utils get-kwarg r "$@")
21
21
  region=${region:-us-east-1}
22
22
 
23
23
  # Prevent bad behavior when trying to upload URL params on aws cli v1
@@ -2,8 +2,8 @@
2
2
  # spell-checker: ignore pipefail SIGINT syncpack
3
3
  set -euo pipefail; if [ -n "${DEBUG-}" ]; then set -x; fi
4
4
 
5
- newVersion=$(yarn -s info @openstax/ts-utils version)
5
+ newVersion=$(npm view @openstax/ts-utils version)
6
6
 
7
- yarn add -W "@openstax/ts-utils@$newVersion"
7
+ npm install "@openstax/ts-utils@$newVersion"
8
8
 
9
- yarn syncpack fix-mismatches --filter '@openstax/ts-utils'
9
+ syncpack fix-mismatches --filter '@openstax/ts-utils'
@@ -2,8 +2,8 @@
2
2
  # spell-checker: ignore pipefail kwarg
3
3
  set -euo pipefail; if [ -n "${DEBUG-}" ]; then set -x; fi
4
4
 
5
- source $(yarn -s ts-utils which init-constants-script)
6
- source $(yarn -s ts-utils which init-params-script)
5
+ source "$(ts-utils which init-constants-script)"
6
+ source "$(ts-utils which init-params-script)"
7
7
 
8
8
  # List all configured PagerDuty endpoints here
9
9
  ENDPOINTS=(
@@ -11,7 +11,7 @@ ENDPOINTS=(
11
11
  workday
12
12
  )
13
13
 
14
- help=$(yarn -s ts-utils get-kwarg h "$@")
14
+ help=$(ts-utils get-kwarg h "$@")
15
15
 
16
16
  if [ -n "$help" ]; then
17
17
  cat <<HEREDOC
@@ -2,12 +2,12 @@
2
2
  # spell-checker: ignore pipefail kwarg sparameters
3
3
  set -euo pipefail; if [ -n "${DEBUG-}" ]; then set -x; fi
4
4
 
5
- source $(yarn -s ts-utils which init-constants-script)
6
- source $(yarn -s ts-utils which init-params-script)
5
+ source "$(ts-utils which init-constants-script)"
6
+ source "$(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=$(ts-utils get-arg 0 "$@")
11
11
 
12
12
  if [ -z "$ENVIRONMENT" ]; then
13
13
  cat <<HEREDOC
@@ -25,8 +25,8 @@ HEREDOC
25
25
  exit 1
26
26
  fi
27
27
 
28
- overwrite=$(yarn -s ts-utils get-kwarg o "$@")
29
- partial=$(yarn -s ts-utils get-kwarg p "$@")
28
+ overwrite=$(ts-utils get-kwarg o "$@")
29
+ partial=$(ts-utils get-kwarg p "$@")
30
30
 
31
31
  # Check if any params are missing
32
32
  params_with_value=
@@ -10,7 +10,7 @@ bin="$project_dir/script/bin/"
10
10
  file="$bin$script.bash"
11
11
 
12
12
  if [ -z "$script" ]; then
13
- printf "specify a command\n\neg:\n yarn -s ts-utils [command name] [parameters]\n\n"
13
+ printf "specify a command\n\neg:\n npx ts-utils [command name] [parameters]\n\n"
14
14
 
15
15
  find "$bin" -name "*.bash" -exec basename {} \; | sed "s/\.bash//" | sort
16
16
 
package/script/build.bash CHANGED
@@ -8,14 +8,14 @@ cd "$project_dir";
8
8
 
9
9
  tsc_args=(--noEmit false --declaration --preserveWatchOutput)
10
10
 
11
- if yarn -s ts-utils has-flag watch "$@"; then
11
+ if ts-utils has-flag watch "$@"; then
12
12
  tsc_args+=(--watch)
13
13
  fi
14
- if yarn -s ts-utils has-flag clean "$@"; then
14
+ if ts-utils has-flag clean "$@"; then
15
15
  rm -rf "$project_dir"/dist
16
16
  fi
17
17
 
18
18
  mkdir -p dist
19
19
 
20
- yarn -s tsc --project tsconfig.without-specs.esm.json "${tsc_args[@]}"
21
- yarn -s tsc --project tsconfig.without-specs.cjs.json "${tsc_args[@]}"
20
+ tsc --project tsconfig.without-specs.esm.json "${tsc_args[@]}"
21
+ tsc --project tsconfig.without-specs.cjs.json "${tsc_args[@]}"