@openstax/ts-utils 1.47.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.
- package/dist/cjs/misc/hashValue.js +2 -2
- package/dist/cjs/misc/jwks.d.ts +5 -2
- package/dist/cjs/services/apiGateway/index.js +1 -2
- package/dist/cjs/services/authProvider/index.js +3 -6
- package/dist/cjs/services/authProvider/utils/userSubrequest.js +2 -5
- package/dist/cjs/services/fileServer/localFileServer.js +2 -3
- package/dist/cjs/services/fileServer/s3FileServer.js +2 -2
- package/dist/cjs/services/httpMessage/verifier.d.ts +2 -2
- package/dist/cjs/services/keyStore/index.d.ts +3 -6
- package/dist/cjs/services/keyStore/index.js +20 -9
- package/dist/cjs/services/launchParams/verifier.d.ts +2 -2
- package/dist/cjs/services/lrsGateway/addStatementDefaultFields.js +1 -2
- package/dist/cjs/services/lrsGateway/file-system.js +2 -2
- package/dist/cjs/tsconfig.without-specs.cjs.tsbuildinfo +1 -1
- package/dist/esm/misc/hashValue.js +2 -2
- package/dist/esm/misc/jwks.d.ts +5 -2
- package/dist/esm/services/apiGateway/index.js +1 -2
- package/dist/esm/services/authProvider/index.js +3 -3
- package/dist/esm/services/authProvider/utils/userSubrequest.js +2 -2
- package/dist/esm/services/fileServer/localFileServer.js +2 -3
- package/dist/esm/services/fileServer/s3FileServer.js +2 -2
- package/dist/esm/services/httpMessage/verifier.d.ts +2 -2
- package/dist/esm/services/keyStore/index.d.ts +3 -6
- package/dist/esm/services/keyStore/index.js +20 -9
- package/dist/esm/services/launchParams/verifier.d.ts +2 -2
- package/dist/esm/services/lrsGateway/addStatementDefaultFields.js +1 -2
- package/dist/esm/services/lrsGateway/file-system.js +2 -2
- package/dist/esm/tsconfig.without-specs.esm.tsbuildinfo +1 -1
- package/package.json +11 -15
- package/script/bin/delete-stack.bash +2 -2
- package/script/bin/deploy.bash +14 -3
- package/script/bin/destroy-deployment.bash +4 -4
- package/script/bin/get-deployed-environments.bash +1 -1
- package/script/bin/get-env-param.bash +4 -4
- package/script/bin/init-constants-script.bash +1 -1
- package/script/bin/init-params-script.bash +1 -1
- package/script/bin/update-utils.bash +3 -3
- package/script/bin/upload-pager-duty-endpoints.bash +3 -3
- package/script/bin/upload-params.bash +5 -5
- package/script/bin-entry.bash +1 -1
- 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.
|
|
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
|
-
"
|
|
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": "
|
|
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": "^
|
|
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",
|
|
@@ -247,16 +243,16 @@
|
|
|
247
243
|
},
|
|
248
244
|
"scripts": {
|
|
249
245
|
"build": "./script/build.bash",
|
|
250
|
-
"build:clean": "
|
|
246
|
+
"build:clean": "npm run clean && npm run build",
|
|
251
247
|
"ci": "CI=true npm-run-all ci:*",
|
|
252
248
|
"ci:lint": "eslint --max-warnings=0 .",
|
|
253
|
-
"ci:spelling": "
|
|
254
|
-
"ci:test": "
|
|
249
|
+
"ci:spelling": "cspell -c ../../cspell.json --gitignore --gitignore-root ../.. '**'",
|
|
250
|
+
"ci:test": "jest --coverage",
|
|
255
251
|
"ci:typecheck": "tsc --noEmit",
|
|
256
252
|
"clean": "rm -rf dist",
|
|
257
253
|
"coverage-report": "open coverage/index.html",
|
|
258
254
|
"start": "./script/build.bash --watch",
|
|
259
|
-
"test": "
|
|
255
|
+
"test": "jest"
|
|
260
256
|
},
|
|
261
257
|
"sideEffects": false,
|
|
262
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"
|
|
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"
|
|
15
|
+
while AWS_DEFAULT_REGION="$region" ts-utils stack-exists "$name"; do
|
|
16
16
|
printf "."
|
|
17
17
|
sleep 5
|
|
18
18
|
done
|
package/script/bin/deploy.bash
CHANGED
|
@@ -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 $(
|
|
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:
|
|
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 $(
|
|
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 $(
|
|
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:
|
|
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=$(
|
|
31
|
+
ENVIRONMENT=$(ts-utils get-arg 0 "$@")
|
|
32
32
|
export ENVIRONMENT;
|
|
33
33
|
|
|
34
|
-
YES=$(
|
|
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 $(
|
|
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 $(
|
|
6
|
-
source $(
|
|
5
|
+
source "$(ts-utils which init-constants-script)"
|
|
6
|
+
source "$(ts-utils which init-params-script)"
|
|
7
7
|
|
|
8
|
-
ENVIRONMENT=$(
|
|
9
|
-
param=$(
|
|
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
|
-
#
|
|
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=$(
|
|
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=$(
|
|
5
|
+
newVersion=$(npm view @openstax/ts-utils version)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
npm install "@openstax/ts-utils@$newVersion"
|
|
8
8
|
|
|
9
|
-
|
|
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 $(
|
|
6
|
-
source $(
|
|
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=$(
|
|
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 $(
|
|
6
|
-
source $(
|
|
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=$(
|
|
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=$(
|
|
29
|
-
partial=$(
|
|
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=
|
package/script/bin-entry.bash
CHANGED
|
@@ -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
|
|
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
|
|
11
|
+
if ts-utils has-flag watch "$@"; then
|
|
12
12
|
tsc_args+=(--watch)
|
|
13
13
|
fi
|
|
14
|
-
if
|
|
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
|
-
|
|
21
|
-
|
|
20
|
+
tsc --project tsconfig.without-specs.esm.json "${tsc_args[@]}"
|
|
21
|
+
tsc --project tsconfig.without-specs.cjs.json "${tsc_args[@]}"
|