-
-
Notifications
You must be signed in to change notification settings - Fork 600
fix: Missing Node.js type signature for Parse.initialize with masterKey, maintenanceKey
#2884
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
fix: Missing Node.js type signature for Parse.initialize with masterKey, maintenanceKey
#2884
Conversation
…nd maintenanceKey
|
🚀 Thanks for opening this pull request! |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
📝 WalkthroughWalkthroughAdd a typed public Parse interface and make the Parse constant conform to it; expand and refine the public API (initialize/_initialize, config accessors, controllers, storage/encode helpers, EventuallyQueue); update TypeScript declarations and Node initialization typings; add type tests and a small test message fix. Changes
Sequence Diagram(s)sequenceDiagram
participant App as Consumer
participant Parse as Parse
participant Core as CoreManager
participant Controllers as "Controllers\n(LiveQuery, Crypto,\nEventuallyQueue, Installation,\nLocalDatastore, Storage, WebSocket)"
App->>Parse: call Parse._initialize(config)
Parse->>Core: set applicationId / keys / serverURL / flags
Parse->>Core: set controller bindings (LiveQuery, Crypto, EventuallyQueue, Installation, LocalDatastore, Storage, WebSocket)
Core->>Controllers: instantiate/configure controllers
Controllers-->>Core: controllers ready
Core-->>Parse: core configured
Parse-->>App: initialization complete
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## alpha #2884 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 64 64
Lines 6222 6222
Branches 1477 1473 -4
=========================================
Hits 6222 6222 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mtrezza
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quite a lot of changes; are they all valid and related to the issue?
The changes look large but are actually minimal: Manual changes:
Auto-generated:
The large diff in Running now |
fd5f123
There was a problem hiding this 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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/Parse.ts (1)
557-561: Typo in log message: method name casing mismatch.The log message references
'enableLocalDataStore'but the actual method name isenableLocalDatastore(lowercase 's').Proposed fix
if (!this.applicationId) { - console.log("'enableLocalDataStore' must be called after 'initialize'"); + console.log("'enableLocalDatastore' must be called after 'initialize'"); return; }
🧹 Nitpick comments (3)
types/Parse.d.ts (1)
75-83: JSDoc indicates optional parameter but type signature requires it.The JSDoc on line 79 uses brackets
[javaScriptKey]indicating an optional parameter, but the type signature on line 83 declaresjavaScriptKey: stringas required. Consider aligning these:Option 1: Make javaScriptKey optional in the signature (if runtime allows)
- initialize(applicationId: string, javaScriptKey: string): void; + initialize(applicationId: string, javaScriptKey?: string): void;Option 2: Update JSDoc to reflect required parameter
- * `@param` {string} [javaScriptKey] Your Parse JavaScript Key (Not needed for parse-server) + * `@param` {string} javaScriptKey Your Parse JavaScript Key (Not needed for parse-server)src/Parse.ts (2)
90-98: JSDoc/signature mismatch (same as in types/Parse.d.ts).The JSDoc indicates
[javaScriptKey]is optional (line 94), but the signature requires it (line 98). This should be consistent with the declaration file fix.
588-595: Inconsistent reference:this.LocalDatastorevsParse.LocalDatastore.Line 589 uses
this.LocalDatastorewhile line 593 usesParse.LocalDatastore. Consider usingthisconsistently for clarity.Proposed fix
dumpLocalDatastore() { if (!this.LocalDatastore.isEnabled) { console.log('Parse.enableLocalDatastore() must be called first'); return Promise.resolve({}); } else { - return Parse.LocalDatastore._getAllContents(); + return this.LocalDatastore._getAllContents(); } },
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/Parse.ts`:
- Around line 90-98: The JSDoc for initialize is out of sync with the browser
signature: update the comment for the initialize(applicationId: string,
javaScriptKey: string) method to reflect that the browser API accepts two
required args (applicationId and javaScriptKey) and remove or mark masterKey as
Node-only/optional (or describe it separately) so generated docs aren't
misleading; locate the initialize declaration in Parse.ts and adjust the param
annotations and description accordingly.
Parse.initialize with masterKey, maintenanceKey
## [8.0.3-alpha.1](8.0.2...8.0.3-alpha.1) (2026-01-27) ### Bug Fixes * Missing Node.js type signature for `Parse.initialize` with `masterKey`, `maintenanceKey` ([#2884](#2884)) ([ce8c907](ce8c907))
|
🎉 This change has been released in version 8.0.3-alpha.1 |
## [8.0.3](8.0.2...8.0.3) (2026-01-27) ### Bug Fixes * Missing Node.js type signature for `Parse.initialize` with `masterKey`, `maintenanceKey` ([#2884](#2884)) ([ce8c907](ce8c907))
|
🎉 This change has been released in version 8.0.3 |
Pull Request
Issue
Related: parse-community/parse-server#10021
Approach
In Node.js builds,
Parse.initializeis reassigned toParse._initializeatruntime (line 409 of
src/Parse.ts), which accepts 4 parameters:applicationId,javaScriptKey,masterKey, andmaintenanceKey. However,the TypeScript type definition only exposed the 2-parameter browser signature.
This became apparent after the type resolution fix in 8.0.1, which correctly
resolved
parse/nodetypes. Before that fix, TypeScript wasn't properlychecking the types for
parse/nodeimports.Changes:
Parseinterface insrc/Parse.tsthat can be augmentedtypes/node.d.tsto overrideinitializewiththe 4-parameter signature for Node.js builds
params
This keeps browser types strict (2 params, no masterKey exposure) while giving
Node.js the correct 4-parameter signature matching runtime behavior.
Tasks
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.