-
Notifications
You must be signed in to change notification settings - Fork 129
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
Make window.fdc3 optional #1386
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 didn't make any changes to this file. I think it was an automated husky script that did this.
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.
Don't worry about this one, every PR is making the same changes, something got merged without generation being run. We'll make sure this is sorted out before the 2.2 release.
Co-authored-by: Kris West <kris.west@interop.io>
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.
LGTM, thanks @Roaders.
@@ -734,34 +734,31 @@ export interface ChatSearchCriteria { | |||
* | |||
* Empty search criteria can be supported to allow resetting of filters. | |||
*/ | |||
criteria: SearchCriteria[]; | |||
criteria: Array<OrganizationObject | string>; |
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.
What would the string entail in this case?
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.
@psmulovics Any search string. Easiest to understand from the example here: https://fdc3.finos.org/docs/next/context/ref/ChatSearchCriteria#example
This could be described in the comment of course.
Not actually relevant to this PR, a previous PR missed regenerating these types so these changes are showing up on them all.
@Roaders this change causes build errors in /src/Methods.ts, which needs to have guards installed to ensure that I can't find an elegant way to do that so in each function we need to make changes like: Current: export function open(app: AppIdentifier | string, context?: Context): Promise<AppIdentifier> {
if (isString(app)) {
return rejectIfNoGlobal(() => window.fdc3.open(app, context));
} else {
return rejectIfNoGlobal(() => window.fdc3.open(app, context));
}
} Updated: export function open(app: AppIdentifier | string, context?: Context): Promise<AppIdentifier> {
if (isString(app)) {
return window.fdc3 ? window.fdc3.open(app, context) : Promise.reject(UnavailableError);
} else {
return window.fdc3 ? window.fdc3.open(app, context) : Promise.reject(UnavailableError);
}
} I.e. inline the You can find a copy of the file with those updates at: https://github.com/finos/FDC3/blob/fdc3-for-web-impl-update/packages/fdc3-standard/src/api/Methods.ts However, don't apply the change to the import of Context on line 25. |
would return window.fdc3?.open() ?? Promise.reject(UnavailableError); work? It should do. If fdc3 is not defined then undefined would be returned rather than a promise so in that case the reject promise would be returned. |
Seems to work yes. |
@Roaders Scratch that, this appears to cause the tests to fail: export function findIntent(intent: Intent, context?: Context, resultType?: string): Promise<AppIntent> {
return window.fdc3?.findIntent(intent, context, resultType) ?? Promise.reject(UnavailableError);
} where this does not export function findIntent(intent: Intent, context?: Context, resultType?: string): Promise<AppIntent> {
return window.fdc3 ? window.fdc3.findIntent(intent, context, resultType) : Promise.reject(UnavailableError);
} (applies to all functions not just this one)
|
Co-authored-by: Brian Ingenito <28159742+bingenito@users.noreply.github.com>
Currently
window.fdc3
is incorrectly marked as always being set.getAgent
code will need to be able to determine if this has been set already and app code should also be able to determine if it is currently set. At the moment this is difficult due to the incorrect types.fixes #1385
THIS SOFTWARE IS CONTRIBUTED SUBJECT TO THE TERMS OF THE FINOS CORPORATE CONTRIBUTOR LICENSE AGREEMENT.
THIS SOFTWARE IS LICENSED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY WARRANTY OF NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THIS SOFTWARE MAY BE REDISTRIBUTED TO OTHERS ONLY BY EFFECTIVELY USING THIS OR ANOTHER EQUIVALENT DISCLAIMER IN ADDITION TO ANY OTHER REQUIRED LICENSE TERMS.