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

Extensions TSDoc edits #1982

Merged
merged 6 commits into from Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 21 additions & 8 deletions src/extensions/extensions-api.ts
Expand Up @@ -16,14 +16,27 @@
*/

/**
* SettableProcessingState represents all the Processing states that can be set on an ExtensionInstance's runtimeData.
* `SettableProcessingState` represents all the processing states that can be set
* on an Extension instance's runtime data.
*
* - NONE: No relevant lifecycle event work has been done. Set this to clear out old statuses.
* - PROCESSING_COMPLETE: Lifecycle event work completed with no errors.
* - PROCESSING_WARNING: Lifecycle event work succeeded partially,
* or something happened that the user should be warned about.
* - PROCESSING_FAILED: Lifecycle event work failed completely,
* but the instance will still work correctly going forward.
* - If the extension instance is in a broken state due to the errors, instead set FatalError.
* @remarks
* You can set the following states:
*
* - `NONE`: No relevant lifecycle event work has been done.
* Set this to clear out old statuses.
*
* - `PROCESSING_COMPLETE`: Lifecycle event work completed with no errors.
*
* - `PROCESSING_WARNING`: Lifecycle event work succeeded partially, or
* something happened that the user should be warned about.
*
* - `PROCESSING_FAILED`: Lifecycle event work failed completely, but the
* instance will still work correctly going forward.
*
* If the extension instance is in a broken state due to errors, instead call
* {@link Runtime.setFatalError}.
*
* There is no "processing in progress" state. To report the ongoing status of
* an extension's function, use `console.log` or the Cloud Functions logger SDK.
*/
export type SettableProcessingState = 'NONE' | 'PROCESSING_COMPLETE' | 'PROCESSING_WARNING' | 'PROCESSING_FAILED';
13 changes: 10 additions & 3 deletions src/extensions/extensions.ts
Expand Up @@ -37,6 +37,7 @@ export class Extensions {
/**
* The runtime() method returns a new Runtime, which provides methods to modify an extension instance's runtime data.
*
* @remarks
* This method will throw an error if called outside an Extensions environment.
*
* @returns A new {@link Runtime} object.
Expand Down Expand Up @@ -78,9 +79,14 @@ export class Runtime {
/**
* Sets the processing state of an extension instance.
*
* Use this method to report the results of a lifecycle event handler. If the
* lifecycle event failed & the extension instance will no longer work
* correctly, use `setFatalError` instead.
* @remarks
* Use this method to report the results of a lifecycle event handler.
*
* If the lifecycle event failed & the extension instance will no longer work
* correctly, use {@link Runtime.setFatalError} instead.
*
* To report the status of function calls other than lifecycle event handlers,
* use `console.log` or the Cloud Functions logger SDK.
*
* @param state - The state to set the instance to.
* @param detailMessage - A message explaining the results of the lifecycle function.
Expand All @@ -101,6 +107,7 @@ export class Runtime {
/**
* Reports a fatal error while running a lifecycle event handler.
*
* @remarks
* Call this method when a lifecycle event handler fails in a way that makes
* the Instance inoperable.
* If the lifecycle event failed but the instance will still work as expected,
Expand Down