Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions scripts/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ typescript () {

cat "${file}"
cp "LICENSE" "clients/${PROJECT}/typescript"

# The typescript-axios generator does not support `httpUserAgent`, and browsers
# forbid setting `User-Agent` from JS. Inject a custom `X-Ory-SDK` header into
# the default request headers so every request identifies the SDK for usage
# tracking. This mirrors the post-generation patching done elsewhere (jq/sed).
config_ts="${dir}/configuration.ts"
sed -i "s#\(\.\.\.param\.baseOptions?\.headers,\)#\1\n \"X-Ory-SDK\": \"${SDK_USER_AGENT_BASE}-typescript/${VERSION}\",#" "${config_ts}"
grep -q "X-Ory-SDK" "${config_ts}" # fail loudly if the injection point moved
}

typescript_fetch () {
Expand Down Expand Up @@ -99,14 +91,6 @@ typescript_fetch () {

cat "${file}"
cp "LICENSE" "clients/${PROJECT}/typescript-fetch"

# The typescript-fetch generator does not support `httpUserAgent`, and browsers
# forbid setting `User-Agent` from JS. Append a custom `X-Ory-SDK` header (last,
# so it always wins) to the per-request header merge in runtime.ts to identify
# the SDK for usage tracking. Mirrors the post-generation patching done elsewhere.
runtime_ts="${dir}/src/runtime.ts"
sed -i "s#Object.assign({}, this.configuration.headers, context.headers);#Object.assign({}, this.configuration.headers, context.headers, { \"X-Ory-SDK\": \"${SDK_USER_AGENT_BASE}-typescript-fetch/${VERSION}\" });#" "${runtime_ts}"
grep -q "X-Ory-SDK" "${runtime_ts}" # fail loudly if the injection point moved
}

java () {
Expand Down
2 changes: 1 addition & 1 deletion scripts/prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ and refer to the [self-hosted documentation](https://www.ory.sh/docs/ecosystem/p
"
fi

# Base for the SDK User-Agent / X-Ory-SDK header used to track SDK usage in our
# Base for the SDK User-Agent header used to track SDK usage in our
# monitoring stack. Defined after the client-specific overrides so it picks up
# the correct GIT_REPO (e.g. "client", "keto-client"). Each generator appends
# its language and the version, e.g. "ory-client-go/v1.22.53".
Expand Down
Loading