Skip to content

Commit

Permalink
Fix OpenRequest context omission and FIndIntentsByContextResponse typo
Browse files Browse the repository at this point in the history
  • Loading branch information
kriswest committed Jul 23, 2024
1 parent d941719 commit 14952ae
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 17 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
"scripts": {
"clean": "rimraf dist",
"start": "rollup -c rollup.config.js --bundleConfigAsCjs -w",
"prebuild": "npm run clean && npm run typegen && npm run typegen-bridging && npm run lint",
"prebuild": "npm run clean && npm run typegen && npm run typegen-browser && npm run typegen-bridging && npm run lint",
"build": "rollup -c rollup.config.js --silent --bundleConfigAsCjs",
"test": "jest --verbose",
"lint": "eslint src/ test/ --ext .ts --fix",
"prepack": "npm run build",
"typegen": "node s2tQuicktypeUtil.js schemas/context src/context/ContextTypes.ts",
"typegen-browser": "node s2tQuicktypeUtil.js schemas/api/api.schema.json schemas/api/common.schema.json schemas/api/appRequest.schema.json schemas/api/agentResponse.schema.json schemas/api/agentEvent.schema.json schemas/api src/api/BrowserTypes.ts",
"typegen-bridging": "node s2tQuicktypeUtil.js schemas/api schemas/bridging schemas/context/context.schema.json src/bridging/BridgingTypes.ts"
"typegen-bridging": "node s2tQuicktypeUtil.js schemas/api/api.schema.json schemas/api/common.schema.json schemas/bridging schemas/context/context.schema.json src/bridging/BridgingTypes.ts"
},
"husky": {
"hooks": {
Expand Down
2 changes: 1 addition & 1 deletion schemas/api/findIntentsByContextResponse.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://fdc3.finos.org/schemas/next/api/findIntentsByContextResponse.schema.json",
"type": "object",
"title": "FindIntentsByContextsByContext Response",
"title": "FindIntentsByContexts Response",
"description": "A response to a findIntentsByContext request.",
"allOf": [
{
Expand Down
5 changes: 5 additions & 0 deletions schemas/api/openRequest.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
"properties": {
"app": {
"$ref": "api.schema.json#/definitions/AppIdentifier"
},
"context": {
"$ref": "../context/context.schema.json",
"title": "Context",
"description": "If a Context object is passed in, this object will be provided to the opened application via a contextListener. The Context argument is functionally equivalent to opening the target app with no context and broadcasting the context directly to it."
}
},
"required": [
Expand Down
46 changes: 32 additions & 14 deletions src/api/BrowserTypes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// To parse this data:
//
// import { Convert, AppRequestMessage, AgentResponseMessage, AgentEventMessage, AddContextListenerRequest, AddContextListenerResponse, AddIntentListenerRequest, AddIntentListenerResponse, BroadcastEvent, BroadcastRequest, BroadcastResponse, ChannelChangedEvent, ContextListenerUnsubscribeRequest, ContextListenerUnsubscribeResponse, CreatePrivateChannelRequest, CreatePrivateChannelResponse, FindInstancesRequest, FindInstancesResponse, FindIntentRequest, FindIntentResponse, FindIntentsByContextRequest, FindIntentsByContextsByContextResponse, GetAppMetadataRequest, GetAppMetadataResponse, GetCurrentChannelRequest, GetCurrentChannelResponse, GetCurrentContextRequest, GetCurrentContextResponse, GetInfoRequest, GetInfoResponse, GetOrCreateChannelRequest, GetOrCreateChannelResponse, GetUserChannelsRequest, GetUserChannelsResponse, IframeChannelDrag, IframeChannelResize, IframeChannels, IframeChannelSelected, IframeHandshake, IframeHello, IframeMessage, IframeResolve, IframeResolveAction, IntentEvent, IntentListenerUnsubscribeRequest, IntentListenerUnsubscribeResponse, JoinUserChannelRequest, JoinUserChannelResponse, LeaveCurrentChannelRequest, LeaveCurrentChannelResponse, OpenRequest, OpenResponse, PrivateChannelAddEventListenerRequest, PrivateChannelAddEventListenerResponse, PrivateChannelDisconnectRequest, PrivateChannelDisconnectResponse, PrivateChannelOnAddContextListenerEvent, PrivateChannelOnDisconnectEvent, PrivateChannelOnUnsubscribeEventEvent, PrivateChannelUnsubscribeEventListenerRequest, PrivateChannelUnsubscribeEventListenerResponse, RaiseIntentForContextRequest, RaiseIntentForContextResponse, RaiseIntentRequest, RaiseIntentResponse, RaiseIntentResultResponse, WebConnectionProtocol1Hello, WebConnectionProtocol2LoadURL, WebConnectionProtocol3Handshake, WebConnectionProtocol4ValidateAppIdentity, WebConnectionProtocol5ValidateAppIdentityFailedResponse, WebConnectionProtocol5ValidateAppIdentitySuccessResponse, WebConnectionProtocolMessage } from "./file";
// import { Convert, AppRequestMessage, AgentResponseMessage, AgentEventMessage, AddContextListenerRequest, AddContextListenerResponse, AddIntentListenerRequest, AddIntentListenerResponse, BroadcastEvent, BroadcastRequest, BroadcastResponse, ChannelChangedEvent, ContextListenerUnsubscribeRequest, ContextListenerUnsubscribeResponse, CreatePrivateChannelRequest, CreatePrivateChannelResponse, FindInstancesRequest, FindInstancesResponse, FindIntentRequest, FindIntentResponse, FindIntentsByContextRequest, FindIntentsByContextsResponse, GetAppMetadataRequest, GetAppMetadataResponse, GetCurrentChannelRequest, GetCurrentChannelResponse, GetCurrentContextRequest, GetCurrentContextResponse, GetInfoRequest, GetInfoResponse, GetOrCreateChannelRequest, GetOrCreateChannelResponse, GetUserChannelsRequest, GetUserChannelsResponse, IframeChannelDrag, IframeChannelResize, IframeChannels, IframeChannelSelected, IframeHandshake, IframeHello, IframeMessage, IframeResolve, IframeResolveAction, IntentEvent, IntentListenerUnsubscribeRequest, IntentListenerUnsubscribeResponse, JoinUserChannelRequest, JoinUserChannelResponse, LeaveCurrentChannelRequest, LeaveCurrentChannelResponse, OpenRequest, OpenResponse, PrivateChannelAddEventListenerRequest, PrivateChannelAddEventListenerResponse, PrivateChannelDisconnectRequest, PrivateChannelDisconnectResponse, PrivateChannelOnAddContextListenerEvent, PrivateChannelOnDisconnectEvent, PrivateChannelOnUnsubscribeEventEvent, PrivateChannelUnsubscribeEventListenerRequest, PrivateChannelUnsubscribeEventListenerResponse, RaiseIntentForContextRequest, RaiseIntentForContextResponse, RaiseIntentRequest, RaiseIntentResponse, RaiseIntentResultResponse, WebConnectionProtocol1Hello, WebConnectionProtocol2LoadURL, WebConnectionProtocol3Handshake, WebConnectionProtocol4ValidateAppIdentity, WebConnectionProtocol5ValidateAppIdentityFailedResponse, WebConnectionProtocol5ValidateAppIdentitySuccessResponse, WebConnectionProtocolMessage } from "./file";
//
// const fDC3DesktopAgentAPISchemas = Convert.toFDC3DesktopAgentAPISchemas(json);
// const commonDefinitions = Convert.toCommonDefinitions(json);
Expand All @@ -24,7 +24,7 @@
// const findIntentRequest = Convert.toFindIntentRequest(json);
// const findIntentResponse = Convert.toFindIntentResponse(json);
// const findIntentsByContextRequest = Convert.toFindIntentsByContextRequest(json);
// const findIntentsByContextsByContextResponse = Convert.toFindIntentsByContextsByContextResponse(json);
// const findIntentsByContextsResponse = Convert.toFindIntentsByContextsResponse(json);
// const getAppMetadataRequest = Convert.toGetAppMetadataRequest(json);
// const getAppMetadataResponse = Convert.toGetAppMetadataResponse(json);
// const getCurrentChannelRequest = Convert.toGetCurrentChannelRequest(json);
Expand Down Expand Up @@ -132,6 +132,8 @@ export interface AppRequestMessageMeta {
* Field that represents the source application that the request being responded to was
* received from, for debugging purposes.
*
* Details of the application instance that broadcast the context
*
* The App resolution option chosen
*
* Details of the application instance that raised the intent
Expand Down Expand Up @@ -509,6 +511,10 @@ export interface BroadcastEventPayload {
* The context object that was broadcast.
*/
context: Context;
/**
* Details of the application instance that broadcast the context
*/
originatingApp?: AppIdentifier;
}

/**
Expand All @@ -518,6 +524,10 @@ export interface BroadcastEventPayload {
*
* The context object passed with the raised intent.
*
* If a Context object is passed in, this object will be provided to the opened application
* via a contextListener. The Context argument is functionally equivalent to opening the
* target app with no context and broadcasting the context directly to it.
*
* The `fdc3.context` type defines the basic contract or "shape" for all data exchanged by
* FDC3 operations. As such, it is not really meant to be used on its own, but is imported
* by more specific type definitions (standardized or custom) to provide the structure and
Expand Down Expand Up @@ -1254,7 +1264,7 @@ export interface FindIntentsByContextRequestPayload {
* A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the
* payload contains an `error` property, the request was unsuccessful.
*/
export interface FindIntentsByContextsByContextResponse {
export interface FindIntentsByContextsResponse {
/**
* Metadata for messages sent by a Desktop Agent to an App in response to an API call
*/
Expand All @@ -1264,7 +1274,7 @@ export interface FindIntentsByContextsByContextResponse {
* property containing a standardized error message indicating that the request was
* unsuccessful.
*/
payload: FindIntentsByContextsByContextResponsePayload;
payload: FindIntentsByContextsResponsePayload;
/**
* Identifies the type of the message and it is typically set to the FDC3 function name that
* the message relates to, e.g. 'findIntent', with 'Response' appended.
Expand All @@ -1277,7 +1287,7 @@ export interface FindIntentsByContextsByContextResponse {
* property containing a standardized error message indicating that the request was
* unsuccessful.
*/
export interface FindIntentsByContextsByContextResponsePayload {
export interface FindIntentsByContextsResponsePayload {
error?: FindInstancesErrors;
appIntents?: AppIntent[];
}
Expand Down Expand Up @@ -2418,6 +2428,12 @@ export interface OpenRequest {
*/
export interface OpenRequestPayload {
app: AppIdentifier;
/**
* If a Context object is passed in, this object will be provided to the opened application
* via a contextListener. The Context argument is functionally equivalent to opening the
* target app with no context and broadcasting the context directly to it.
*/
context?: Context;
}

/**
Expand Down Expand Up @@ -3518,12 +3534,12 @@ export class Convert {
return JSON.stringify(uncast(value, r("FindIntentsByContextRequest")), null, 2);
}

public static toFindIntentsByContextsByContextResponse(json: string): FindIntentsByContextsByContextResponse {
return cast(JSON.parse(json), r("FindIntentsByContextsByContextResponse"));
public static toFindIntentsByContextsResponse(json: string): FindIntentsByContextsResponse {
return cast(JSON.parse(json), r("FindIntentsByContextsResponse"));
}

public static findIntentsByContextsByContextResponseToJson(value: FindIntentsByContextsByContextResponse): string {
return JSON.stringify(uncast(value, r("FindIntentsByContextsByContextResponse")), null, 2);
public static findIntentsByContextsResponseToJson(value: FindIntentsByContextsResponse): string {
return JSON.stringify(uncast(value, r("FindIntentsByContextsResponse")), null, 2);
}

public static toGetAppMetadataRequest(json: string): GetAppMetadataRequest {
Expand Down Expand Up @@ -4184,6 +4200,7 @@ const typeMap: any = {
"BroadcastEventPayload": o([
{ json: "channelId", js: "channelId", typ: "" },
{ json: "context", js: "context", typ: r("Context") },
{ json: "originatingApp", js: "originatingApp", typ: u(undefined, r("AppIdentifier")) },
], false),
"Context": o([
{ json: "id", js: "id", typ: u(undefined, m("any")) },
Expand Down Expand Up @@ -4332,12 +4349,12 @@ const typeMap: any = {
{ json: "context", js: "context", typ: r("Context") },
{ json: "resultType", js: "resultType", typ: u(undefined, "") },
], false),
"FindIntentsByContextsByContextResponse": o([
"FindIntentsByContextsResponse": o([
{ json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") },
{ json: "payload", js: "payload", typ: r("FindIntentsByContextsByContextResponsePayload") },
{ json: "type", js: "type", typ: r("FindIntentsByContextsByContextResponseType") },
{ json: "payload", js: "payload", typ: r("FindIntentsByContextsResponsePayload") },
{ json: "type", js: "type", typ: r("FindIntentsByContextsResponseType") },
], false),
"FindIntentsByContextsByContextResponsePayload": o([
"FindIntentsByContextsResponsePayload": o([
{ json: "error", js: "error", typ: u(undefined, r("FindInstancesErrors")) },
{ json: "appIntents", js: "appIntents", typ: u(undefined, a(r("AppIntent"))) },
], false),
Expand Down Expand Up @@ -4592,6 +4609,7 @@ const typeMap: any = {
], false),
"OpenRequestPayload": o([
{ json: "app", js: "app", typ: r("AppIdentifier") },
{ json: "context", js: "context", typ: u(undefined, r("Context")) },
], false),
"OpenResponse": o([
{ json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") },
Expand Down Expand Up @@ -4968,7 +4986,7 @@ const typeMap: any = {
"FindIntentsByContextRequestType": [
"findIntentsByContextRequest",
],
"FindIntentsByContextsByContextResponseType": [
"FindIntentsByContextsResponseType": [
"findIntentsByContextResponse",
],
"GetAppMetadataRequestType": [
Expand Down

0 comments on commit 14952ae

Please sign in to comment.