Skip to content

feat: Add support for Parse.Query.include in LiveQuery #9827

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

Open
wants to merge 5 commits into
base: alpha
Choose a base branch
from

Conversation

mtrezza
Copy link
Member

@mtrezza mtrezza commented Jul 17, 2025

Pull Request

Issue

Closes: #1686

Approach

Add Parse.Query.include to LiveQuery.

Tasks

Summary by CodeRabbit

  • New Features

    • Live queries now support the "include" directive, allowing related objects referenced by pointers to be automatically fetched and embedded in real-time subscription results.
  • Tests

    • Added a new test to verify that live queries correctly handle the "include" directive and return related pointer data as expected.

Copy link

parse-github-assistant bot commented Jul 17, 2025

🚀 Thanks for opening this pull request!

Copy link

coderabbitai bot commented Jul 17, 2025

📝 Walkthrough

Walkthrough

Support for the include directive in live query subscriptions was added to the live query server, enabling automatic fetching and embedding of related pointer objects in real-time events. A focused test case was introduced to verify that live queries correctly resolve and include related pointer data when the include directive is specified.

Changes

File(s) Change Summary
spec/ParseLiveQuery.spec.js Added a focused test to verify live query support for the include directive with pointer data.
src/LiveQuery/ParseLiveQueryServer.ts Implemented support for include in live queries: added methods for pointer resolution, object embedding, and updated event handling to process includes. Modified subscription handling to parse and store include fields.
src/LiveQuery/RequestSchema.js Extended subscribe and update query schemas to include an optional include array of strings.
types/LiveQuery/ParseLiveQueryServer.d.ts Added type declarations for new methods supporting include functionality in ParseLiveQueryServer.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant LiveQueryServer
    participant Database

    Client->>LiveQueryServer: Subscribe to class with include (e.g., Queue include user)
    LiveQueryServer->>Database: Register subscription

    Note over LiveQueryServer: On object creation or update
    Database-->>LiveQueryServer: New/updated object (with pointer)
    LiveQueryServer->>Database: Fetch related pointer objects (e.g., user)
    Database-->>LiveQueryServer: Return full related objects
    LiveQueryServer->>Client: Send event with included pointer objects
Loading

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE package: 'parse@6.1.1',
npm warn EBADENGINE required: { node: '18 || 19 || 20 || 22' },
npm warn EBADENGINE current: { node: 'v24.3.0', npm: '11.4.2' }
npm warn EBADENGINE }
npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-07-17T01_41_42_538Z-debug-0.log


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@parseplatformorg
Copy link
Contributor

parseplatformorg commented Jul 17, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/LiveQuery/ParseLiveQueryServer.ts (1)

1085-1200: Consider performance optimizations

The implementation is well-structured with proper batching and security considerations. However, there are some performance improvements to consider:

-        if (obj.className === '_User' && !auth.isMaster) {
-          delete obj.sessionToken;
-          delete obj.authData;
-        }
+        if (obj.className === '_User' && !auth.isMaster) {
+          obj.sessionToken = undefined;
+          obj.authData = undefined;
+        }

This avoids the performance impact of the delete operator as suggested by static analysis.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dfffc14 and b3b6d1e.

📒 Files selected for processing (2)
  • spec/ParseLiveQuery.spec.js (1 hunks)
  • src/LiveQuery/ParseLiveQueryServer.ts (7 hunks)
🧰 Additional context used
🧠 Learnings (2)
spec/ParseLiveQuery.spec.js (4)
Learnt from: RahulLanjewar93
PR: parse-community/parse-server#9744
File: spec/ParseLiveQuery.spec.js:0-0
Timestamp: 2025-04-30T19:31:35.344Z
Learning: In the Parse Server codebase, the functions in QueryTools.js are typically tested through end-to-end behavior tests rather than direct unit tests, even though the functions are exported from the module.
Learnt from: mtrezza
PR: parse-community/parse-server#9445
File: spec/ParseLiveQuery.spec.js:1340-1375
Timestamp: 2025-05-09T09:59:06.289Z
Learning: New tests in the parse-server repository should use async/await with promise-based patterns rather than callback patterns with `done()`. The preferred pattern is to create a Promise that resolves when an expected event occurs, then await that Promise.
Learnt from: mtrezza
PR: parse-community/parse-server#9445
File: spec/ParseLiveQuery.spec.js:1312-1338
Timestamp: 2025-05-04T20:41:05.147Z
Learning: New tests in the parse-server repository should use async/await with promise-based patterns rather than callback patterns with `done()`.
Learnt from: mtrezza
PR: parse-community/parse-server#9445
File: spec/ParseLiveQuery.spec.js:1340-1375
Timestamp: 2025-05-09T09:59:06.289Z
Learning: Tests in the parse-server repository should use promise-based approaches rather than callback patterns with `done()`. Use a pattern where a Promise is created that resolves when the event occurs, then await that promise.
src/LiveQuery/ParseLiveQueryServer.ts (4)
Learnt from: RahulLanjewar93
PR: parse-community/parse-server#9744
File: spec/ParseLiveQuery.spec.js:0-0
Timestamp: 2025-04-30T19:31:35.344Z
Learning: In the Parse Server codebase, the functions in QueryTools.js are typically tested through end-to-end behavior tests rather than direct unit tests, even though the functions are exported from the module.
Learnt from: mtrezza
PR: parse-community/parse-server#9445
File: spec/ParseLiveQuery.spec.js:1312-1338
Timestamp: 2025-05-04T20:41:05.147Z
Learning: New tests in the parse-server repository should use async/await with promise-based patterns rather than callback patterns with `done()`.
Learnt from: mtrezza
PR: parse-community/parse-server#9445
File: spec/ParseLiveQuery.spec.js:1340-1375
Timestamp: 2025-05-09T09:59:06.289Z
Learning: New tests in the parse-server repository should use async/await with promise-based patterns rather than callback patterns with `done()`. The preferred pattern is to create a Promise that resolves when an expected event occurs, then await that Promise.
Learnt from: mtrezza
PR: parse-community/parse-server#9445
File: spec/ParseLiveQuery.spec.js:1340-1375
Timestamp: 2025-05-09T09:59:06.289Z
Learning: Tests in the parse-server repository should use promise-based approaches rather than callback patterns with `done()`. Use a pattern where a Promise is created that resolves when the event occurs, then await that promise.
🪛 Biome (1.9.4)
src/LiveQuery/ParseLiveQueryServer.ts

[error] 1185-1185: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 1186-1186: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 1203-1203: Use Array.isArray() instead of instanceof Array.

instanceof Array returns false for array-like objects and arrays from other execution contexts.
Unsafe fix: Use Array.isArray() instead.

(lint/suspicious/useIsArray)


[error] 1223-1223: Use Array.isArray() instead of instanceof Array.

instanceof Array returns false for array-like objects and arrays from other execution contexts.
Unsafe fix: Use Array.isArray() instead.

(lint/suspicious/useIsArray)

🔇 Additional comments (6)
src/LiveQuery/ParseLiveQueryServer.ts (6)

28-29: LGTM!

The imports are appropriate for the include functionality - RestQuery for querying related objects and masterAuth for elevated permissions when fetching included data.


246-247: LGTM!

Correctly applies includes to the deleted object after converting to JSON and before sending to the client.


399-404: LGTM!

Properly applies includes to both current and original objects in update events, ensuring clients receive complete data for comparison.


956-960: LGTM!

Correctly handles the include field from subscription requests, supporting both array and comma-separated string formats, consistent with how keys is handled.


1253-1269: LGTM!

Clean implementation that properly handles multiple include paths by wrapping the object for batch processing.


679-695: Security concern: confirm sensitive _User fields are filtered under masterAuth

The call to includeObject uses masterAuth, which bypasses ACLs. Please verify that the includeObject implementation still sanitizes sensitive _User fields (e.g., passwords, emailVerified, authData) even when using master privileges. If it doesn’t, add explicit filtering to prevent exposing private user data.

• File: src/LiveQuery/ParseLiveQueryServer.ts (lines 679–695)
• Method: _applyInclude

Comment on lines +1222 to +1251
replacePointers(object: any, path: Array<string>, replace: any): any {
if (object instanceof Array) {
return object
.map(obj => this.replacePointers(obj, path, replace))
.filter(obj => typeof obj !== 'undefined');
}
if (typeof object !== 'object' || !object) {
return object;
}
if (path.length === 0) {
if (object && object.__type === 'Pointer') {
return replace[object.objectId];
}
return object;
}
const subObject = object[path[0]];
if (!subObject) {
return object;
}
const newSub = this.replacePointers(subObject, path.slice(1), replace);
const answer: any = {};
for (const key in object) {
if (key === path[0]) {
answer[key] = newSub;
} else {
answer[key] = object[key];
}
}
return answer;
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Use Array.isArray() for consistency

-    if (object instanceof Array) {
+    if (Array.isArray(object)) {
       return object
         .map(obj => this.replacePointers(obj, path, replace))
         .filter(obj => typeof obj !== 'undefined');
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
replacePointers(object: any, path: Array<string>, replace: any): any {
if (object instanceof Array) {
return object
.map(obj => this.replacePointers(obj, path, replace))
.filter(obj => typeof obj !== 'undefined');
}
if (typeof object !== 'object' || !object) {
return object;
}
if (path.length === 0) {
if (object && object.__type === 'Pointer') {
return replace[object.objectId];
}
return object;
}
const subObject = object[path[0]];
if (!subObject) {
return object;
}
const newSub = this.replacePointers(subObject, path.slice(1), replace);
const answer: any = {};
for (const key in object) {
if (key === path[0]) {
answer[key] = newSub;
} else {
answer[key] = object[key];
}
}
return answer;
}
replacePointers(object: any, path: Array<string>, replace: any): any {
if (Array.isArray(object)) {
return object
.map(obj => this.replacePointers(obj, path, replace))
.filter(obj => typeof obj !== 'undefined');
}
if (typeof object !== 'object' || !object) {
return object;
}
if (path.length === 0) {
if (object && object.__type === 'Pointer') {
return replace[object.objectId];
}
return object;
}
const subObject = object[path[0]];
if (!subObject) {
return object;
}
const newSub = this.replacePointers(subObject, path.slice(1), replace);
const answer: any = {};
for (const key in object) {
if (key === path[0]) {
answer[key] = newSub;
} else {
answer[key] = object[key];
}
}
return answer;
}
🧰 Tools
🪛 Biome (1.9.4)

[error] 1223-1223: Use Array.isArray() instead of instanceof Array.

instanceof Array returns false for array-like objects and arrays from other execution contexts.
Unsafe fix: Use Array.isArray() instead.

(lint/suspicious/useIsArray)

🤖 Prompt for AI Agents
In src/LiveQuery/ParseLiveQueryServer.ts between lines 1222 and 1251, replace
the use of 'object instanceof Array' with 'Array.isArray(object)' to check if
the variable is an array. This change improves consistency and reliability in
array type checking. Update the condition accordingly without altering the rest
of the logic.

Comment on lines +1202 to +1220
findPointers(object: any, path: Array<string>): any[] {
if (object instanceof Array) {
return object.map(x => this.findPointers(x, path)).flat();
}
if (typeof object !== 'object' || !object) {
return [];
}
if (path.length === 0) {
if (object === null || object.__type === 'Pointer') {
return [object];
}
return [];
}
const subObject = object[path[0]];
if (!subObject) {
return [];
}
return this.findPointers(subObject, path.slice(1));
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Use Array.isArray() for more robust array detection

The recursive implementation is correct, but should use Array.isArray() for better compatibility:

-    if (object instanceof Array) {
+    if (Array.isArray(object)) {
       return object.map(x => this.findPointers(x, path)).flat();
     }

This handles arrays from different execution contexts correctly, as noted by static analysis.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
findPointers(object: any, path: Array<string>): any[] {
if (object instanceof Array) {
return object.map(x => this.findPointers(x, path)).flat();
}
if (typeof object !== 'object' || !object) {
return [];
}
if (path.length === 0) {
if (object === null || object.__type === 'Pointer') {
return [object];
}
return [];
}
const subObject = object[path[0]];
if (!subObject) {
return [];
}
return this.findPointers(subObject, path.slice(1));
}
findPointers(object: any, path: Array<string>): any[] {
if (Array.isArray(object)) {
return object.map(x => this.findPointers(x, path)).flat();
}
if (typeof object !== 'object' || !object) {
return [];
}
if (path.length === 0) {
if (object === null || object.__type === 'Pointer') {
return [object];
}
return [];
}
const subObject = object[path[0]];
if (!subObject) {
return [];
}
return this.findPointers(subObject, path.slice(1));
}
🧰 Tools
🪛 Biome (1.9.4)

[error] 1203-1203: Use Array.isArray() instead of instanceof Array.

instanceof Array returns false for array-like objects and arrays from other execution contexts.
Unsafe fix: Use Array.isArray() instead.

(lint/suspicious/useIsArray)

🤖 Prompt for AI Agents
In src/LiveQuery/ParseLiveQueryServer.ts around lines 1202 to 1220, replace the
use of 'object instanceof Array' with 'Array.isArray(object)' to detect arrays
more reliably across different execution contexts. This change ensures the
function correctly identifies arrays regardless of their origin, improving
compatibility and correctness of the recursive pointer finding logic.

Comment on lines 1312 to 1338
it_id('a1b7fa01-877e-46e2-9601-d312ebb9b33a')(fit)('handles query include', async done => {
await reconfigureServer({
liveQuery: {
classNames: ['Queue'],
},
startLiveQueryServer: true,
verbose: false,
silent: true,
});

const user = new Parse.User();
user.setUsername('testuser');
user.setPassword('password');
await user.signUp();

const query = new Parse.Query('Queue');
query.include('user');
const subscription = await query.subscribe();
subscription.on('create', obj => {
expect(obj.get('user').get('username')).toBe('testuser');
done();
});

const queue = new Parse.Object('Queue');
queue.set('user', user);
await queue.save();
});
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Change fit() to it() before committing

The test correctly validates the include functionality using the recommended async/await pattern. However, fit() focuses only this test and skips all others.

-  it_id('a1b7fa01-877e-46e2-9601-d312ebb9b33a')(fit)('handles query include', async done => {
+  it_id('a1b7fa01-877e-46e2-9601-d312ebb9b33a')(it)('handles query include', async done => {

Consider adding more test cases to cover:

  • Multiple includes
  • Nested includes
  • Include with keys/exclude keys
  • Error scenarios
🤖 Prompt for AI Agents
In spec/ParseLiveQuery.spec.js around lines 1312 to 1338, change the test
function from fit() to it() to ensure all tests run instead of focusing only on
this one. Additionally, expand test coverage by adding new test cases that cover
multiple includes, nested includes, include with keys/exclude keys, and error
scenarios to thoroughly validate the include functionality.

@mtrezza mtrezza linked an issue Jul 17, 2025 that may be closed by this pull request
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (2)
src/LiveQuery/ParseLiveQueryServer.ts (2)

1205-1223: Use Array.isArray() for more robust array detection.

The recursive implementation is correct, but should use Array.isArray() for better compatibility:

-    if (object instanceof Array) {
+    if (Array.isArray(object)) {
       return object.map(x => this.findPointers(x, path)).flat();
     }

This handles arrays from different execution contexts correctly, as noted by static analysis.


1225-1254: Use Array.isArray() for consistency.

-    if (object instanceof Array) {
+    if (Array.isArray(object)) {
       return object
         .map(obj => this.replacePointers(obj, path, replace))
         .filter(obj => typeof obj !== 'undefined');
     }
🧹 Nitpick comments (1)
src/LiveQuery/ParseLiveQueryServer.ts (1)

1088-1203: LGTM! Comprehensive include path implementation.

The includePath method is well-structured with proper batching, filtering, and security considerations for User objects.

Consider the static analysis suggestion to use undefined assignment instead of delete for better performance:

         if (obj.className === '_User' && !auth.isMaster) {
-          delete obj.sessionToken;
-          delete obj.authData;
+          obj.sessionToken = undefined;
+          obj.authData = undefined;
         }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b3b6d1e and e91134b.

📒 Files selected for processing (4)
  • spec/ParseLiveQuery.spec.js (1 hunks)
  • src/LiveQuery/ParseLiveQueryServer.ts (7 hunks)
  • src/LiveQuery/RequestSchema.js (2 hunks)
  • types/LiveQuery/ParseLiveQueryServer.d.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • spec/ParseLiveQuery.spec.js
🧰 Additional context used
🧠 Learnings (2)
types/LiveQuery/ParseLiveQueryServer.d.ts (4)
Learnt from: RahulLanjewar93
PR: parse-community/parse-server#9744
File: spec/ParseLiveQuery.spec.js:0-0
Timestamp: 2025-04-30T19:31:35.344Z
Learning: In the Parse Server codebase, the functions in QueryTools.js are typically tested through end-to-end behavior tests rather than direct unit tests, even though the functions are exported from the module.
Learnt from: mtrezza
PR: parse-community/parse-server#9445
File: spec/ParseLiveQuery.spec.js:1340-1375
Timestamp: 2025-05-09T09:59:06.289Z
Learning: New tests in the parse-server repository should use async/await with promise-based patterns rather than callback patterns with `done()`. The preferred pattern is to create a Promise that resolves when an expected event occurs, then await that Promise.
Learnt from: mtrezza
PR: parse-community/parse-server#9445
File: spec/ParseLiveQuery.spec.js:1312-1338
Timestamp: 2025-05-04T20:41:05.147Z
Learning: New tests in the parse-server repository should use async/await with promise-based patterns rather than callback patterns with `done()`.
Learnt from: mtrezza
PR: parse-community/parse-server#9445
File: spec/ParseLiveQuery.spec.js:1340-1375
Timestamp: 2025-05-09T09:59:06.289Z
Learning: Tests in the parse-server repository should use promise-based approaches rather than callback patterns with `done()`. Use a pattern where a Promise is created that resolves when the event occurs, then await that promise.
src/LiveQuery/ParseLiveQueryServer.ts (4)
Learnt from: RahulLanjewar93
PR: parse-community/parse-server#9744
File: spec/ParseLiveQuery.spec.js:0-0
Timestamp: 2025-04-30T19:31:35.344Z
Learning: In the Parse Server codebase, the functions in QueryTools.js are typically tested through end-to-end behavior tests rather than direct unit tests, even though the functions are exported from the module.
Learnt from: mtrezza
PR: parse-community/parse-server#9445
File: spec/ParseLiveQuery.spec.js:1312-1338
Timestamp: 2025-05-04T20:41:05.147Z
Learning: New tests in the parse-server repository should use async/await with promise-based patterns rather than callback patterns with `done()`.
Learnt from: mtrezza
PR: parse-community/parse-server#9445
File: spec/ParseLiveQuery.spec.js:1340-1375
Timestamp: 2025-05-09T09:59:06.289Z
Learning: New tests in the parse-server repository should use async/await with promise-based patterns rather than callback patterns with `done()`. The preferred pattern is to create a Promise that resolves when an expected event occurs, then await that Promise.
Learnt from: mtrezza
PR: parse-community/parse-server#9445
File: spec/ParseLiveQuery.spec.js:1340-1375
Timestamp: 2025-05-09T09:59:06.289Z
Learning: Tests in the parse-server repository should use promise-based approaches rather than callback patterns with `done()`. Use a pattern where a Promise is created that resolves when the event occurs, then await that promise.
🪛 Biome (1.9.4)
src/LiveQuery/ParseLiveQueryServer.ts

[error] 1188-1188: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 1189-1189: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 1206-1206: Use Array.isArray() instead of instanceof Array.

instanceof Array returns false for array-like objects and arrays from other execution contexts.
Unsafe fix: Use Array.isArray() instead.

(lint/suspicious/useIsArray)


[error] 1226-1226: Use Array.isArray() instead of instanceof Array.

instanceof Array returns false for array-like objects and arrays from other execution contexts.
Unsafe fix: Use Array.isArray() instead.

(lint/suspicious/useIsArray)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Docker Build
🔇 Additional comments (10)
src/LiveQuery/RequestSchema.js (2)

81-88: LGTM! Schema definition follows established patterns.

The include property definition is consistent with existing array properties (keys and watch) and includes appropriate validation constraints.


135-142: LGTM! Consistent schema definition across operations.

The include property is correctly duplicated in the update operation schema, maintaining consistency with the subscribe operation.

types/LiveQuery/ParseLiveQueryServer.d.ts (1)

28-28: LGTM! Type declarations properly define include functionality.

The new method signatures are well-defined with appropriate parameter types and return types, following the existing conventions in the file.

Also applies to: 40-43

src/LiveQuery/ParseLiveQueryServer.ts (7)

2-28: LGTM! Import reorganization supports new functionality.

The reorganized imports and new additions are necessary for the include feature implementation.


682-698: LGTM! Well-implemented include application method.

The _applyInclude method properly handles null checks, extracts include paths from subscription info, and uses master auth for include operations.


245-245: LGTM! Proper integration of include functionality in delete events.

The _applyInclude call is correctly placed after object conversion and uses proper await syntax.


396-407: LGTM! Comprehensive include handling for save events.

The implementation correctly applies includes to both current and original objects, with proper null checks and async handling.


959-963: LGTM! Consistent include parsing in subscription handling.

The include parsing follows the established pattern used for keys, properly handling both array and comma-separated string formats.


1256-1272: LGTM! Clean orchestration method.

The includeObject method provides a clean interface for processing multiple include paths sequentially.


561-561: LGTM! Minor formatting improvement.

The return type annotation formatting is improved for better readability.

@mtrezza mtrezza changed the title feat: Add LiveQuery include feat: Add support for Parse.Query.include in LiveQuery Jul 17, 2025
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.

Live query with include won't work
2 participants