Skip to content

Conversation

@sjvans
Copy link
Contributor

@sjvans sjvans commented Oct 30, 2025

and will be removed in cds^10

in general, i see a mismatch between the types for LinkedCSN and https://cap.cloud.sap/docs/node.js/cds-reflect#linked-csn. but that can also be ignorance on my part...

related docs pr: capire/docs#2267

@sjvans sjvans requested a review from daogrady December 10, 2025 22:38
Copy link
Contributor

@daogrady daogrady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So from what I understand, the namespace-filter has been removed from specific services, but is still available from the cds facade.
If that is the intention, then looks good to me. Thanks! 🙂

@sjvans
Copy link
Contributor Author

sjvans commented Dec 11, 2025

So from what I understand, the namespace-filter has been removed from specific services, but is still available from the cds facade. If that is the intention, then looks good to me. Thanks! 🙂

right. the namespace filter is only available for model.entities(). (cds.entities now points to (cds.model || cds.db.model).entities instead of cds.db.entities.)

what i was not able to reflect is that the namespace filter is still available until cds^10.

@daogrady
Copy link
Contributor

So it is still available as of cds9? Then we should not remove it, but add @deprecated will be removed in cds10 to it instead, no?

@sjvans
Copy link
Contributor Author

sjvans commented Dec 11, 2025

So it is still available as of cds9? Then we should not remove it, but add @deprecated will be removed in cds10 to it instead, no?

yes, but how? of

export type ModelPartFn<T extends any_> = IterableMap<T> & ((namespace: string) => IterableMap<T>)

only the ((namespace: string) => IterableMap<T>) part is deprecated.
i didn't manage to express that.

@daogrady
Copy link
Contributor

daogrady commented Dec 12, 2025

Ah, I see! That is indeed a bit tricky.
That can be expressed by changing the relevant part of the type from a lambda to a callable object:

// signature of a function that also has property `x` attached
type F_old = ((p: string) => number) & { x: boolean }

// type of an object that has property `x`, and can be called like a function. In that case, you can add annotations to the call signature.
type F_new = {
  /** @deprecated because of reasons */
  (p: string): number,
  x: boolean
} 

Demo

@sjvans
Copy link
Contributor Author

sjvans commented Dec 12, 2025

Ah, I see! That is indeed a bit tricky.

thanks!

[...srv.events].map(e => e.keys);
[...srv.events].map(e => e.elements)

// @ts-expect-deprecation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a valid annotation?
microsoft/TypeScript#50369

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it isn't, but it should be ;)
i added for documentation purposes, but we can remove as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree that it should be. As it does not cause any errors, let's just keep it in.
My approval stands! 🙂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

( = feel free to merge once you are happy with the PR's state)

@sjvans sjvans merged commit 034c5c4 into main Dec 12, 2025
11 checks passed
@sjvans sjvans deleted the srv.entities() branch December 12, 2025 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants