feat: Upgrade to @parse/push-adapter 6.4.0#9182
feat: Upgrade to @parse/push-adapter 6.4.0#9182mtrezza merged 4 commits intoparse-community:alphafrom
Conversation
Thanks for opening this pull request! |
|
@mtrezza The server tried to transcompile the ES module but is not supported. I add Babel and CommonJS support back to the push adapter. |
Can't we do this instead of reverting the push adapter repo to CommonJS? Maybe we support both modules and CommonJS with a try/catch where it let module;
let modulePath;
try {
module = require(modulePath);
} catch (err) {
if (err.code === 'ERR_REQUIRE_ESM') {
import(modulePath).then(mod => module = mod)
} else {
throw err;
}
}And we could write that as a method so we can re-use this in the future for other imports. Haven't tried this out though. |
|
The trick here is /lib/Controllers/index.js. The lib folder is autogenerated by babel. I'm not sure how that can be done. To be honest this is my first time using ESM. |
|
I've added some code above, not sure if you're seen it. |
|
Oh thanks, let me try it out |
|
It's an async import, as you have probably noticed. So this would need to go into an async function. If you paste it as-is it may be flaky, as the import sometimes may not have finished before the module is accessed. |
|
I noticed and the Server doesnt' support top level await. The controllers are loaded in the |
|
Here's a better version: async function loadModule(modulePath) {
let module;
try {
module = require(modulePath);
} catch (err) {
if (err.code === 'ERR_REQUIRE_ESM') {
module = await import(modulePath);
} else {
throw err;
}
}
return module;
} |
|
@mtrezza I keep running into |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## alpha #9182 +/- ##
==========================================
- Coverage 94.16% 94.15% -0.01%
==========================================
Files 186 186
Lines 14729 14738 +9
==========================================
+ Hits 13869 13877 +8
- Misses 860 861 +1 ☔ View full report in Codecov by Sentry. |
|
@mtrezza This is ready for review! I used |
# [7.1.0-alpha.15](7.1.0-alpha.14...7.1.0-alpha.15) (2024-07-08) ### Features * Upgrade to @parse/push-adapter 6.4.0 ([#9182](#9182)) ([ef1634b](ef1634b))
|
🎉 This change has been released in version 7.1.0-alpha.15 |
# [7.2.0-beta.1](7.1.0...7.2.0-beta.1) (2024-07-09) ### Bug Fixes * Invalid push notification tokens are not cleaned up from database for FCM API v2 ([#9173](#9173)) ([284da09](284da09)) ### Features * Add support for dot notation on array fields of Parse Object ([#9115](#9115)) ([cf4c880](cf4c880)) * Upgrade to @parse/push-adapter 6.4.0 ([#9182](#9182)) ([ef1634b](ef1634b)) * Upgrade to Parse JS SDK 5.3.0 ([#9180](#9180)) ([dca187f](dca187f))
|
🎉 This change has been released in version 7.2.0-beta.1 |
# [7.2.0](7.1.0...7.2.0) (2024-07-09) ### Bug Fixes * Invalid push notification tokens are not cleaned up from database for FCM API v2 ([#9173](#9173)) ([284da09](284da09)) ### Features * Add support for dot notation on array fields of Parse Object ([#9115](#9115)) ([cf4c880](cf4c880)) * Upgrade to @parse/push-adapter 6.4.0 ([#9182](#9182)) ([ef1634b](ef1634b)) * Upgrade to Parse JS SDK 5.3.0 ([#9180](#9180)) ([dca187f](dca187f))
|
🎉 This change has been released in version 7.2.0 |
|
Hi all. I just tried to update from parse-server 6.5.5 to 7.2.0 and got this error. was this not supposed to happen at 7.2.0? |
Pull Request
Issue
The push adapter now supports ES6 and Node 22
Closes: parse-community/parse-server-push-adapter#256