-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from nkolba/hello-2.0
initial commit for 2.0 support
- Loading branch information
Showing
30 changed files
with
1,655 additions
and
800 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { WebContents } from 'electron'; | ||
import { DirectoryApp } from './FDC3Data'; | ||
|
||
/** | ||
* represents an app instance when resolving intents | ||
* can either represent a directory item or a connected instance | ||
*/ | ||
export interface AppInstance { | ||
details: AppDetails; | ||
type: string; | ||
} | ||
|
||
/** | ||
* the connection and metadata details of a app | ||
*/ | ||
export interface AppDetails { | ||
directoryData: DirectoryApp; | ||
content: WebContents; | ||
} | ||
|
||
export enum InstanceTypeEnum { | ||
Window = 'window', | ||
Directory = 'directory', | ||
} | ||
|
||
/** | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Copyright 2020 FINOS FDC3 contributors - see NOTICE file | ||
*/ | ||
|
||
import { Context, ContextHandler, Listener } from '@finos/fdc3'; | ||
|
||
/** | ||
* An interface that relates an instance of an app to other apps | ||
*/ | ||
export interface fdc3AppInstance { | ||
readonly instanceId: string; | ||
readonly status: 'ready' | 'loading' | 'unregistered'; | ||
|
||
/** | ||
* Adds a listener for incoming contexts whenever a broadcast happens from this instance. | ||
*/ | ||
addContextListener(handler: ContextHandler): Listener; | ||
|
||
/** | ||
* Adds a listener for incoming contexts of the specified context type whenever a broadcast happens from this instance. | ||
*/ | ||
addContextListener(contextType: string, handler: ContextHandler): Listener; | ||
|
||
/** | ||
* Sends the given context to this app instance. | ||
* The context will be recieved on the applicable contextListener for the instance. | ||
*/ | ||
broadcast(context: Context): void; | ||
|
||
/** | ||
* | ||
*/ | ||
onStatusChanged(handler: (newVal: string, oldVal: string) => void): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Copyright 2019 FINOS FDC3 contributors - see NOTICE file | ||
*/ | ||
|
||
/** | ||
* App definition as provided by the application directory | ||
*/ | ||
export interface AppMetadata { | ||
/** The unique app name that can be used with the open and raiseIntent calls. */ | ||
readonly name: string; | ||
|
||
/** The unique application identifier located within a specific application directory instance. An example of an appId might be 'app@sub.root' */ | ||
readonly appId?: string; | ||
|
||
/** The Version of the application. */ | ||
readonly version?: string; | ||
|
||
/** A more user-friendly application title that can be used to render UI elements */ | ||
readonly title?: string; | ||
|
||
/** A tooltip for the application that can be used to render UI elements */ | ||
readonly tooltip?: string; | ||
|
||
/** A longer, multi-paragraph description for the application that could include markup */ | ||
readonly description?: string; | ||
|
||
/** A list of icon URLs for the application that can be used to render UI elements */ | ||
readonly icons?: Array<string>; | ||
|
||
/** A list of image URLs for the application that can be used to render UI elements */ | ||
readonly images?: Array<string>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { Context, DisplayMetadata, IntentMetadata } from 'fdc3-1.2'; | ||
|
||
/** | ||
* represenation of an FDC3 App - whether it is running (connected) or not (directory only) | ||
*/ | ||
export interface FDC3App { | ||
type: string; | ||
details: FDC3AppDetail; | ||
} | ||
|
||
/** | ||
* A collection of apps associated with an intent | ||
*/ | ||
export interface IntentInstance { | ||
intent: IntentMetadata; | ||
apps: Array<FDC3App>; | ||
} | ||
|
||
export interface FDC3AppDetail { | ||
instanceId?: string; | ||
title?: string; | ||
directoryData?: DirectoryApp; | ||
} | ||
|
||
export interface ResolverDetail { | ||
intent?: string; | ||
context?: Context; | ||
} | ||
|
||
/** | ||
* Data structure representing an App Directory item | ||
*/ | ||
export interface DirectoryApp { | ||
name: string; | ||
title: string; | ||
start_url: string; | ||
manifest: string; | ||
manifest_type: string; | ||
description: string; | ||
icons: Array<DirectoryIcon>; | ||
images: Array<DirectoryImage>; | ||
appId: string; | ||
intents: Array<DirectoryIntent>; | ||
} | ||
|
||
export interface DirectoryIcon { | ||
icon: string; | ||
} | ||
|
||
export interface DirectoryImage { | ||
url: string; | ||
} | ||
|
||
export interface DirectoryIntent { | ||
name: string; | ||
display_name: string; | ||
contexts: Array<string>; | ||
} | ||
|
||
/** | ||
* representation of channel data | ||
*/ | ||
export interface ChannelData { | ||
id: string; | ||
type: 'app' | 'system'; | ||
displayMetadata?: ChannelMetadata; | ||
} | ||
|
||
export class ChannelMetadata implements DisplayMetadata { | ||
/** | ||
* A user-readable name for this channel, e.g: `"Red"` | ||
*/ | ||
name?: string; | ||
|
||
/** | ||
* The color that should be associated within this channel when displaying this channel in a UI, e.g: `0xFF0000`. | ||
*/ | ||
color?: string; | ||
|
||
/** | ||
* A URL of an image that can be used to display this channel | ||
*/ | ||
glyph?: string; | ||
|
||
/** | ||
* alternate / secondary color to use in conjunction with 'color' when creating UIs | ||
*/ | ||
color2?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { Context, TargetApp } from 'fdc3-1.2'; | ||
|
||
/** | ||
* Custom DOM event used by the FDC3 API | ||
*/ | ||
|
||
export class FDC3Event extends Event { | ||
detail: FDC3EventDetail = {}; | ||
ts = 0; | ||
|
||
constructor(type: string, init?: CustomEventInit) { | ||
super(type, init); | ||
} | ||
} | ||
|
||
/** | ||
* Event Detail structure | ||
*/ | ||
export interface FDC3EventDetail { | ||
/** | ||
* | ||
*/ | ||
id?: string; //resolve with listenerId | ||
ts?: number; | ||
listenerId?: string; | ||
eventId?: string; //resolve with listenerId & eventId | ||
intent?: string; | ||
channel?: string; | ||
channelId?: string; //resolve w/channel | ||
instanceId?: string; //identifier for the app instance | ||
contextType?: string; | ||
data?: FDC3ResponseData | null; | ||
name?: string; | ||
context?: Context; | ||
target?: TargetApp; | ||
source?: string; | ||
/* identifier of the browserView the event originated from */ | ||
viewId?: string; | ||
error?: string; | ||
} | ||
|
||
export interface FDC3ResponseData { | ||
context?: Context; | ||
intent?: string; | ||
listenerId?: string; | ||
} | ||
|
||
/** | ||
* EventEnum | ||
* enum of all fdc3 event topics that can originate from the API layer | ||
*/ | ||
export enum FDC3EventEnum { | ||
Broadcast = 'broadcast', | ||
Open = 'open', | ||
RaiseIntent = 'raiseIntent', | ||
AddContextListener = 'addContextListener', | ||
AddIntentListener = 'addIntentListener', | ||
FindIntent = 'findIntent', | ||
FindIntentsByContext = 'findIntentsByContext', | ||
GetCurrentContext = 'getCurrentContext', | ||
GetSystemChannels = 'getSystemChannels', | ||
GetOrCreateChannel = 'getOrCreateChannel', | ||
GetCurrentChannel = 'getCurrentChannel', | ||
JoinChannel = 'joinChannel', | ||
DropContextListener = 'dropContextListener', | ||
DropIntentListener = 'dropIntentListener', | ||
IntentComplete = 'intentComplete', | ||
} | ||
|
||
/*export { | ||
FDC3Event, | ||
FDC3EventDetail, | ||
FDC3EventEnum | ||
};*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.