Skip to content

Commit d9c9294

Browse files
committed
Merge remote-tracking branch 'origin/main' into dependabot/npm_and_yarn/main/typescript-6.0.2
* origin/main: chore(deps): bump actions/setup-node in /.github/actions/setup (#6754) chore(deps): bump bignumber.js from 11.1.4 to 11.1.5 (#6749) chore(deps): bump actions/checkout from 6.0.3 to 7.0.0 (#6708) chore(deps-dev): bump @cap-js/sqlite from 2.4.0 to 3.0.2 (#6739) chore(deps-dev): bump @sap/cds-dk from 9.9.2 to 10.0.3 (#6736) fix: destination fetch option XOR typing (#6701)
2 parents b1bfda1 + 7824f8b commit d9c9294

14 files changed

Lines changed: 394 additions & 350 deletions

File tree

.changeset/tricky-impalas-rush.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@sap-cloud-sdk/connectivity": patch
3+
---
4+
5+
[fix] Fix `DestinationOrFetchOptions` and `HttpDestinationOrFetchOptions` so the `service` key surfaces at the type level.

.github/actions/setup/action.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,23 @@ inputs:
3232
persist-credentials:
3333
description: 'Whether to configure the token or SSH key with the local git config'
3434
default: 'false'
35+
allow-unsafe-pr-checkout:
36+
description: 'Whether to allow checkout for pull_request_target and workflow_run'
37+
default: 'false'
38+
3539

3640
runs:
3741
using: 'composite'
3842
steps:
3943
- name: Checkout repository
40-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
44+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
4145
with:
4246
ref: ${{ inputs.ref }}
4347
token: ${{ inputs.token }}
4448
persist-credentials: ${{ inputs.persist-credentials }}
49+
allow-unsafe-pr-checkout: ${{ inputs.allow-unsafe-pr-checkout }}
4550
- name: Setup pnpm
46-
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
51+
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
4752
with:
4853
version: ${{ inputs.pnpm-version }}
4954
- name: Resolve registry URL
@@ -67,7 +72,7 @@ runs:
6772
echo "url=https://registry.npmjs.org" >> $GITHUB_OUTPUT
6873
fi
6974
- name: Setup Node.js
70-
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
75+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
7176
with:
7277
node-version: ${{ inputs.node-version }}
7378
registry-url: ${{ steps.resolve-registry-url.outputs.url }}

.github/dependabot.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,16 @@ updates:
3939
- dependency-name: 'yargs'
4040
update-types: ['version-update:semver-major']
4141
- package-ecosystem: 'github-actions'
42-
directory: '/'
42+
directories:
43+
- '/'
44+
- '/.github/actions/check-pr'
45+
- '/.github/actions/commit-and-tag'
46+
- '/.github/actions/changesets-fixed-version-bump'
47+
- '/.github/actions/merge-and-write-changelogs'
48+
- '/.github/actions/get-changelog'
49+
- '/.github/actions/setup'
50+
- '/.github/actions/check-public-api'
51+
- '/.github/actions/check-license'
4352
schedule:
4453
interval: 'weekly'
4554
time: '01:00'

.github/workflows/auto-dependabot-fix.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
token: ${{ steps.app-token.outputs.token }}
2727
persist-credentials: true
2828
registry-token: ${{ secrets.NPM_TOKEN_ARTIFACTORY }}
29+
allow-unsafe-pr-checkout: true
2930
- name: Commit Changes if needed
3031
env:
3132
BOT_EMAIL: ${{ vars.SAP_CLOUD_SDK_BOT_EMAIL }}

.github/workflows/check-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
with:
2222
files: |
2323
.changeset/**
24-
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
24+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2525
with:
2626
persist-credentials: false
2727
sparse-checkout: |

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
steps:
3737
- name: Checkout repository
38-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
38+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
3939
with:
4040
# We must fetch at least the immediate parents so that if this is
4141
# a pull request then we can checkout the head.

.github/workflows/fosstars-report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
permissions:
1414
contents: write
1515
steps:
16-
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
16+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
1717
with:
1818
persist-credentials: false
1919
- uses: SAP/fosstars-rating-core-action@daf10c3920b53405f6013ee987e7015525fdec30 # v1.14.0

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
run: |
4343
pnpm changeset publish
4444
- name: Checkout Docs
45-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
45+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
4646
with:
4747
repository: SAP/cloud-sdk
4848
token: ${{ steps.app-token.outputs.token }}

.github/workflows/zizmor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
actions: read
1919
steps:
2020
- name: Checkout repository
21-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
21+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2222
with:
2323
persist-credentials: false
2424

packages/connectivity/src/scp-cf/destination/destination.ts

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { isDestinationFetchOptions } from './destination-accessor-types';
2-
import type { Xor } from '@sap-cloud-sdk/util';
32
import type { DestinationFetchOptions } from './destination-accessor-types';
43
import type { DestinationFromServiceBindingOptions } from './destination-from-vcap';
54
import type {
@@ -9,6 +8,7 @@ import type {
98
DestinationCertificate,
109
HttpDestination
1110
} from './destination-service-types';
11+
import type { WithoutExclusive } from '@sap-cloud-sdk/util';
1212

1313
/**
1414
* Takes an existing or a parsed destination and returns an SDK compatible destination object.
@@ -469,17 +469,27 @@ export function noDestinationErrorMessage(
469469
}
470470

471471
/**
472-
* Type that is either a {@link HttpDestination} or (XOR) {@link DestinationFetchOptions & DestinationFromServiceBindingOptions}.
472+
* Fetch-options side of the XOR.
473+
*
474+
* `DestinationFetchOptions` requires `destinationName: string`, but when looking up by
475+
* `service` (via `DestinationFromServiceBindingOptions`) we don't have a name. Intersecting
476+
* the two naively makes `destinationName: string & never = never`, killing the service branch.
477+
* Stripping `destinationName` from `DestinationFetchOptions` and letting the inner discriminated
478+
* union of `DestinationFromServiceBindingOptions` own that key fixes it.
473479
*/
474-
export type DestinationOrFetchOptions = Xor<
475-
Destination,
476-
DestinationFetchOptions & DestinationFromServiceBindingOptions
477-
>;
480+
type FetchOptionsLeaf = Omit<DestinationFetchOptions, 'destinationName'> &
481+
DestinationFromServiceBindingOptions;
482+
483+
/**
484+
* Type that is either a {@link Destination} or (XOR) {@link DestinationFetchOptions} & {@link DestinationFromServiceBindingOptions}.
485+
*/
486+
export type DestinationOrFetchOptions =
487+
| (WithoutExclusive<Destination, FetchOptionsLeaf> & FetchOptionsLeaf)
488+
| (WithoutExclusive<FetchOptionsLeaf, Destination> & Destination);
478489

479490
/**
480-
* Type that is either a {@link HttpDestination} or (XOR) {@link DestinationFetchOptions & DestinationFromServiceBindingOptions}.
491+
* Type that is either an {@link HttpDestination} or (XOR) {@link DestinationFetchOptions} & {@link DestinationFromServiceBindingOptions}.
481492
*/
482-
export type HttpDestinationOrFetchOptions = Xor<
483-
HttpDestination,
484-
DestinationFetchOptions & DestinationFromServiceBindingOptions
485-
>;
493+
export type HttpDestinationOrFetchOptions =
494+
| (WithoutExclusive<HttpDestination, FetchOptionsLeaf> & FetchOptionsLeaf)
495+
| (WithoutExclusive<FetchOptionsLeaf, HttpDestination> & HttpDestination);

0 commit comments

Comments
 (0)