-
Notifications
You must be signed in to change notification settings - Fork 1
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
Initial scheduler working prototype #1
base: main
Are you sure you want to change the base?
Conversation
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.
I did an initial pass and this looks pretty good besides the doc comments. Please verify them all with the source material.
I will set up CI for analysis so we can ensure code style.
@@ -22,4 +23,8 @@ abstract final class FirebaseFunctions { | |||
/// Access to the Firebase Functions Identity methods | |||
static FirebaseFunctionsIdentity get identity => | |||
require('firebase-functions/v2/identity') as FirebaseFunctionsIdentity; | |||
|
|||
/// Access to the Firebase Functions Schedule methods | |||
static FirebaseFunctionsSchedule get schedule => |
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.
static FirebaseFunctionsSchedule get schedule => | |
static FirebaseFunctionsScheduler get scheduler => |
@@ -22,4 +23,8 @@ abstract final class FirebaseFunctions { | |||
/// Access to the Firebase Functions Identity methods | |||
static FirebaseFunctionsIdentity get identity => | |||
require('firebase-functions/v2/identity') as FirebaseFunctionsIdentity; | |||
|
|||
/// Access to the Firebase Functions Schedule methods |
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.
/// Access to the Firebase Functions Schedule methods | |
/// Access to the Firebase Functions Scheduler methods |
/// Options that can be set on a schedule function. | ||
extension type ScheduleOptions._(JSObject _) implements JSObject { | ||
/// The schedule in Unix Crontab or AppEngine syntax. | ||
external JSAny? get schedule; |
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.
external JSAny? get schedule; | |
external String get schedule; |
} | ||
|
||
/// Event passed to a scheduled function handler. | ||
extension type ScheduledEvent._(JSObject _) implements JSObject { |
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.
This should be above ScheduleOptions
as it is in the source file
/// The Cloud Scheduler job name. | ||
external String? get jobName; | ||
|
||
/// The schedule time in RFC3339 UTC "Zulu" format. |
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.
This doc string does not match the source. All doc strings need checked for this since ChatGPT generated this.
}); | ||
} | ||
|
||
/// The Firebase Functions Schedule namespace |
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.
/// The Firebase Functions Schedule namespace | |
/// The Firebase Functions Scheduler namespace |
} | ||
|
||
/// The Cloud Function type for Schedule triggers. | ||
extension type ScheduleFunction._(JSObject _) implements JSObject { |
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.
This type declaration is unnecessary since Dart doesn't need to do anything with it
|
||
/// Constructor | ||
external ScheduleOptions({ | ||
JSAny? schedule, |
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.
JSAny? schedule, | |
String schedule, |
/// Constructor | ||
external ScheduledEvent({ | ||
String? jobName, | ||
String? scheduleTime, |
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.
String? scheduleTime, | |
String scheduleTime, |
/// @param handler - A function to execute when triggered | ||
/// @returns A function that you can export and deploy | ||
external JSFunction onSchedule( | ||
JSObject optionsOrSchedule, [ |
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.
JSObject optionsOrSchedule, [ | |
JSAny args, [ |
JSObject does not include primitives
You legend thank you! I'll work through these over the next couple weeks as I get time, thank you! 🙏 |
I added an analysis action, but for some reason I can't update this PR with main. Please merge with main so the action will run. |
@Attempt3035 are you planning on coming back to this? |
Yeah planning to sorry 😅 |
Love this project! It's exactly what my team needed! In our current project, we need scheduler, here's a basic chatGPT implementation (this has had literally 10 mins work so definitely not merge ready) which seems to be working. This PR is more an expression of interest and so other works can be coordinated, definitely will be spending some more time on this in the future and helping out making this project fully-fledged! Cheers!