Skip to content

Commit

Permalink
Trying to publish
Browse files Browse the repository at this point in the history
  • Loading branch information
robmoffat committed May 10, 2024
1 parent cd34c57 commit 710d4aa
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 34 deletions.
14 changes: 14 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"git": {
"commitMessage": "chore: release v${version}"
},
"github": {
"release": false
},
"npm": {
"release": true
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
}
}
77 changes: 43 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# FDC3 For The Web
# FDC3 For The Web

This is a minimal proof-of-concept for FDC3 For the Web.

Expand All @@ -12,6 +12,7 @@ This is a minimal proof-of-concept for FDC3 For the Web.
```
1. From the Command Line:
```
yarn install
yarn workspaces foreach --all install
Expand All @@ -20,48 +21,49 @@ This is a minimal proof-of-concept for FDC3 For the Web.
yarn dev
```
2. Point browser at http://localhost:8080/da/
2. Point browser at http://localhost:8080/da/
3. This is your dummy desktop agent, which has various apps you can launch.
3. This is your dummy desktop agent, which has various apps you can launch.
4. Launch the apps, press the button, watch messages pass between them.
4. Launch the apps, press the button, watch messages pass between them.
## What This Project Contains
The project is divided into several different yarn workspaces:
- `da-proxy`:
- `src`: This is an implementation of a client-side, typescript desktop agent proxy that communicates to a server backend using the APIs/JSON Schema defined in [Agent Bridging](https://fdc3.finos.org/docs/next/agent-bridging/spec). It is expected that we would standardize this and add to the FDC3 NPM module.
- `test`: This is some cucumber/gherkin tests that exercise the functionality in `src`. These are written to be language-agnostic so that we can use the same Gherkin feature files to test .net, Java, Python APIs too. These can be run with `yarn build`
- `da-proxy`:
- `src`: This is an implementation of a client-side, typescript desktop agent proxy that communicates to a server backend using the APIs/JSON Schema defined in [Agent Bridging](https://fdc3.finos.org/docs/next/agent-bridging/spec). It is expected that we would standardize this and add to the FDC3 NPM module.
- `test`: This is some cucumber/gherkin tests that exercise the functionality in `src`. These are written to be language-agnostic so that we can use the same Gherkin feature files to test .net, Java, Python APIs too. These can be run with `yarn build`
- `client`: This exports the `getClientAPI()` function which can be used to retrieve a desktop agent API via the web.
- `da-server`:
- `client`: This exports the `getClientAPI()` function which can be used to retrieve a desktop agent API via the web.
- `src`: A minimal implementation of the desktop-agent bridging protocol for handling messages between multiple connected sources.
- `test`: This is some cucumber/gherkin tests that exercise the functionality in `src`. These can be run with `yarn build`
- `da-server`:
- `src`: A minimal implementation of the desktop-agent bridging protocol for handling messages between multiple connected sources.
- `test`: This is some cucumber/gherkin tests that exercise the functionality in `src`. These can be run with `yarn build`
- `common` : Common APIs and functionality used by both `client` and `server`
- `common` : Common APIs and functionality used by both `client` and `server`
- `demo` : A bare-bones desktop agent implementation with a few apps that use WebFDC3. See: https://static.swimlanes.io/6bb69f2c9acdc0656f5f3b098d40518e.png for how this works. Basically, the implementation here is that it uses iframes approach and a server-side websocket to relay messages.
- `demo` : A bare-bones desktop agent implementation with a few apps that use WebFDC3. See: https://static.swimlanes.io/6bb69f2c9acdc0656f5f3b098d40518e.png for how this works. Basically, the implementation here is that it uses iframes approach and a server-side websocket to relay messages.
- `fdc3-workbench`: The FDC3 Workbench app from https://github.com/FDC3/toolbox/workbench, ported to use WebFDC3. Start with `yarn dev` and invoke from `demo`
- `fdc3-workbench`: The FDC3 Workbench app from https://github.com/FDC3/toolbox/workbench, ported to use WebFDC3. Start with `yarn dev` and invoke from `demo`
## Configuring the client
`getClientAPI` (in `index.ts`): Called (with options) by an FDC3 App to retrieve the API. This retrieves `details` from the desktop agent and initialises a `DesktopAgent` API implementation, returning it in a promise. There are various options available:
`getClientAPI` (in `index.ts`): Called (with options) by an FDC3 App to retrieve the API. This retrieves `details` from the desktop agent and initialises a `DesktopAgent` API implementation, returning it in a promise. There are various options available:
- `strategies`: This allows plugable strategies for getting the DA. Two exist:
- `electron-event` which waits for `window.fdc3` to be set and
- `post-message` which fires a post message up to the opening window/iframe (or whatever is set in the `frame` option) asking for details of how to construct a `DesktopAgent` API implementation.
- `frame` : when _not_ using a loaded iframe, you can begin communicating with a port on a particular frame. By default, opener or window, but you can pick something else if you want.
- `strategies`: This allows plugable strategies for getting the DA. Two exist:
- `electron-event` which waits for `window.fdc3` to be set and
- `post-message` which fires a post message up to the opening window/iframe (or whatever is set in the `frame` option) asking for details of how to construct a `DesktopAgent` API implementation.
- `frame` : when _not_ using a loaded iframe, you can begin communicating with a port on a particular frame. By default, opener or window, but you can pick something else if you want.
## Configuring Server
- **For the desktop agent**: `supply` (in `server/supply.ts`): Called by the desktop agent on startup, allows it to supply FDC3 APIs to apps when they ask for one via the `post-message` strategy. This takes the following parameters:
- A `checker`, which checks the origin window for the API request. It should be a window that the Desktop Agent is aware of.
- A `detailsResolver`s, which returns a map of properties to send to the API requestor (the app) that should be used to instantiate the API.
- A `portResolver` which is responsible for providing a `MessagePort` for the server and client to communicate over.
- **For the desktop agent**: `supply` (in `server/supply.ts`): Called by the desktop agent on startup, allows it to supply FDC3 APIs to apps when they ask for one via the `post-message` strategy. This takes the following parameters:
- A `checker`, which checks the origin window for the API request. It should be a window that the Desktop Agent is aware of.
- A `detailsResolver`s, which returns a map of properties to send to the API requestor (the app) that should be used to instantiate the API.
- A `portResolver` which is responsible for providing a `MessagePort` for the server and client to communicate over.
## Notes
Expand All @@ -71,15 +73,15 @@ The project is divided into several different yarn workspaces:
## Cross-Origin
- This supports cross-origin when using post message without iframes. (at least on my machine!) you can configure hostnames in `dummy-desktop-agent.ts` to try this out.
- This supports cross-origin when using post message without iframes. (at least on my machine!) you can configure hostnames in `dummy-desktop-agent.ts` to try this out.
- However, using the iframe mode (you can see this in the demo) will fail as chrome has restricted the SharedWorker when used with iframes (even of the same origin).
## TO-DO
- Fallback strategy in case FDC3 API isn't available (currently promise never resolves)
- Sanitisation of response from the Desktop Agent
- Handing of fdc3Ready
- Handling on intents, open, finishing test cases for `da` / `testing`
- Fallback strategy in case FDC3 API isn't available (currently promise never resolves)
- Sanitisation of response from the Desktop Agent
- Handing of fdc3Ready
- Handling on intents, open, finishing test cases for `da` / `testing`
## Troubleshooting
Expand All @@ -89,10 +91,10 @@ The project is divided into several different yarn workspaces:
- Desktop Agent Briding needs extending with types from `fdc3-common/index.ts`
- Move exchange into client, instead of common.
- How does the da-server tell the da-proxy about the channel metadata? We need a message to get the list of user channels from the server.
- How does the da-server tell the da-proxy about the channel metadata? We need a message to get the list of user channels from the server.
- How does the da-server decide on a desktop agent name (maybe it just has one?)
- AppChecker / AppDetailsResolver / AppPortResolver - this is all too complex.
= fdc3Ready timeout
= fdc3Ready timeout
- get it to work without desktop agent window running
- use cookie for the da id.
- add server tests for intent resolution choice
Expand All @@ -102,5 +104,12 @@ The project is divided into several different yarn workspaces:
## Idea
Do we need to send a post-message to the server, if we have cookies? Couldn't we just hold the DA ID and the
address of the embed page in the cookie? Problem is, the cookie is scoped to the DA...
Do we need to send a post-message to the server, if we have cookies? Couldn't we just hold the DA ID and the
address of the embed page in the cookie? Problem is, the cookie is scoped to the DA...
## Releasing
```
yarn workspaces foreach --all run release

```
1 change: 1 addition & 0 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"uuid": "^9.0.1"
},
"devDependencies": {
"release-it": "^17.2.1",
"typescript": "^5.3.2"
}
}
1 change: 1 addition & 0 deletions packages/da-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"jsonpath-plus": "^7.2.0",
"nyc": "15.1.0",
"prettier": "2.2.1",
"release-it": "^17.2.1",
"ts-node": "^10.9.2",
"tsx": "^4.7.1",
"typescript": "^5.3.2",
Expand Down
1 change: 1 addition & 0 deletions packages/da-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"nyc": "15.1.0",
"openapi-typescript": "^6.7.4",
"prettier": "2.2.1",
"release-it": "^17.2.1",
"ts-node": "^10.9.2",
"typescript": "^5.3.2",
"uuid": "^9.0.1"
Expand Down
1 change: 1 addition & 0 deletions packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@types/express": "^4.17.15",
"@types/node": "^20.9.3",
"nodemon": "^3.0.1",
"release-it": "^17.2.1",
"vite": "^5.0.2"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/fdc3-workbench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"pretty-quick": "^3.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"release-it": "^17.2.1",
"terser": "^5.16.1",
"typescript": "^4.1.2",
"uuid": "^9.0.0",
Expand Down
6 changes: 6 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,7 @@ __metadata:
"@kite9/da-proxy": "workspace:*"
"@kite9/fdc3-common": "workspace:*"
"@types/uuid": "npm:^9.0.7"
release-it: "npm:^17.2.1"
typescript: "npm:^5.3.2"
uuid: "npm:^9.0.1"
languageName: unknown
Expand Down Expand Up @@ -1251,6 +1252,7 @@ __metadata:
jsonpath-plus: "npm:^7.2.0"
nyc: "npm:15.1.0"
prettier: "npm:2.2.1"
release-it: "npm:^17.2.1"
ts-node: "npm:^10.9.2"
tsx: "npm:^4.7.1"
typescript: "npm:^5.3.2"
Expand Down Expand Up @@ -1284,6 +1286,7 @@ __metadata:
nyc: "npm:15.1.0"
openapi-typescript: "npm:^6.7.4"
prettier: "npm:2.2.1"
release-it: "npm:^17.2.1"
ts-node: "npm:^10.9.2"
typescript: "npm:^5.3.2"
uuid: "npm:^9.0.1"
Expand All @@ -1304,6 +1307,7 @@ __metadata:
"@types/ws": "npm:^8.5.10"
express: "npm:^4.18.3"
nodemon: "npm:^3.0.1"
release-it: "npm:^17.2.1"
socket.io: "npm:^4.7.5"
socket.io-client: "npm:^4.7.5"
tsx: "npm:^4.5.0"
Expand All @@ -1319,6 +1323,7 @@ __metadata:
resolution: "@kite9/fdc3-common@workspace:packages/fdc3-common"
dependencies:
"@finos/fdc3": "npm:^2.1.0-beta.6"
release-it: "npm:^17.2.1"
typescript: "npm:^5.3.2"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -5303,6 +5308,7 @@ __metadata:
pretty-quick: "npm:^3.1.0"
react: "npm:^17.0.2"
react-dom: "npm:^17.0.2"
release-it: "npm:^17.2.1"
terser: "npm:^5.16.1"
typescript: "npm:^4.1.2"
uuid: "npm:^9.0.0"
Expand Down

0 comments on commit 710d4aa

Please sign in to comment.