Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OData lambda style filter query #3155

Open
wants to merge 26 commits into
base: version-4
Choose a base branch
from

Conversation

Tanddant
Copy link

@Tanddant Tanddant commented Oct 21, 2024

Category

  • Bug fix?
  • New feature?
  • New sample?
  • Documentation update?

Related Issues

Based off the discussion over on #2781

What's in this Pull Request?

This PR is not completely done, but I needed a place to track the final changes (and docs) based off the input in #2781

  • We like "method 1", seems simpler
  • Drop "Field" from all the names so Lookup() vs LookupField().
  • switch to camel case so Lookup becomes lookup()
  • could simplify the names, equal instead of EqualsTo and notEqual vs NotEqualTo
    • I'm still open to the idea of having even shorter values, such as .eq(...) alongside the others, would like opinions
  • Swap and/or for All/Some, just seems clearer to someone showing up with no knowledge of the filter methods
  • pass in multiple objects you can use ...[] to gather them into an array within the method.
  • this should be able to support all the filter cases, another reason to drop the "Field" name from the builder functions. Like for a site if you give it ISiteInfo you could filter on Text("Title").EqualsTo("blah");
    • The following is tested to work
    sp.web.lists.filter<IListInfo>(f => f.text("Title").equal("Employees"))

I'll happily start updating the docs once we have a "somewhat sign-off" on the above been done to an acceptable state 😊

bcdmi and others added 25 commits August 19, 2023 08:09
This solved the issue where if you reused the same variable name in your long queries it broke
down to one warning which I can't resolve
# Conflicts:
#	package-lock.json
#	packages/sp/spqueryable.ts
@Tanddant Tanddant changed the title V4 o data filter query OData lambda style filter query Oct 21, 2024
await sp.web.webinfos.filter(w => w.text("Title").equal('MyWebTitle'))();
@Tanddant
Copy link
Author

Latest commit added "auto typing" for things like lists, webs, and so on, where we "know the type"

I.e

await sp.web.webinfos.filter(w => w.text("Title").equal('MyWebTitle'))();

Without having to specify that Title is a field on lists

I haven't tested this in every possible combination, but it looks to be working without breaking the list item stuff, should greatly improve the usability 😊

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.

2 participants