Skip to content

Commit

Permalink
Fixed urls for resolver, channel selector after kris' change
Browse files Browse the repository at this point in the history
  • Loading branch information
robmoffat committed Sep 12, 2024
1 parent 90efbf6 commit 7540c23
Show file tree
Hide file tree
Showing 19 changed files with 168 additions and 292 deletions.
274 changes: 107 additions & 167 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kite9/fdc3",
"version": "2.2.0-beta.6",
"version": "2.2.0-beta.8",
"author": "Fintech Open Source Foundation (FINOS)",
"homepage": "https://fdc3.finos.org",
"repository": {
Expand Down Expand Up @@ -35,7 +35,7 @@
"test": "npm run test --workspaces --if-present",
"lint": "npm run lint --workspaces --if-present",
"syncpack": "npm exec syncpack fix-mismatches --types 'local'",
"dev": "concurrently \"cd toolbox/fdc3-workbench && npm run dev\" \"cd packages/demo && npm run dev\""
"dev": "concurrently \"cd toolbox/fdc3-workbench && npm run dev\" \"cd toolbox/fdc3-for-web/demo && npm run dev\""
},
"prettier": {
"semi": true,
Expand Down
8 changes: 4 additions & 4 deletions packages/fdc3-agent-proxy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kite9/fdc3-agent-proxy",
"version": "2.2.0-beta.6",
"version": "2.2.0-beta.8",
"files": [
"dist"
],
Expand All @@ -12,7 +12,7 @@
"clean": "rimraf dist; rimraf cucumber-report.html; rimraf coverage; rimraf .nyc_output; rimraf node_modules"
},
"dependencies": {
"@kite9/fdc3-standard": "2.2.0-beta.6"
"@kite9/fdc3-standard": "2.2.0-beta.8"
},
"devDependencies": {
"@cucumber/cucumber": "10.3.1",
Expand All @@ -33,12 +33,12 @@
"is-ci": "2.0.0",
"jsonpath-plus": "^9.0.0",
"nyc": "15.1.0",
"@kite9/testing": "2.2.0-beta.6",
"@kite9/testing": "2.2.0-beta.8",
"prettier": "3.2.5",
"rimraf": "^6.0.1",
"ts-node": "^10.9.2",
"tsx": "^4.7.1",
"typescript": "^5.3.2",
"uuid": "^9.0.1"
}
}
}
4 changes: 2 additions & 2 deletions packages/fdc3-context/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kite9/fdc3-context",
"version": "2.2.0-beta.6",
"version": "2.2.0-beta.8",
"author": "Fintech Open Source Foundation (FINOS)",
"homepage": "https://fdc3.finos.org",
"repository": {
Expand Down Expand Up @@ -39,4 +39,4 @@
"tslib": "^2.0.1",
"typescript": "^5.3.2"
}
}
}
16 changes: 8 additions & 8 deletions packages/fdc3-get-agent/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kite9/fdc3-get-agent",
"version": "2.2.0-beta.6",
"version": "2.2.0-beta.8",
"files": [
"dist"
],
Expand All @@ -12,17 +12,17 @@
"clean": "rimraf dist; rimraf cucumber-report.html; rimraf coverage; rimraf .nyc_output; rimraf node_modules"
},
"dependencies": {
"@kite9/fdc3-standard": "2.2.0-beta.6",
"@kite9/fdc3-agent-proxy": "2.2.0-beta.6",
"@kite9/fdc3-schema": "2.2.0-beta.6",
"@kite9/fdc3-context": "2.2.0-beta.6",
"@kite9/fdc3-standard": "2.2.0-beta.8",
"@kite9/fdc3-agent-proxy": "2.2.0-beta.8",
"@kite9/fdc3-schema": "2.2.0-beta.8",
"@kite9/fdc3-context": "2.2.0-beta.8",
"@types/uuid": "^10.0.0",
"uuid": "^9.0.1"
},
"devDependencies": {
"@cucumber/cucumber": "10.3.1",
"@kite9/fdc3-web-impl": "2.2.0-beta.6",
"@kite9/testing": "2.2.0-beta.6",
"@kite9/fdc3-web-impl": "2.2.0-beta.8",
"@kite9/testing": "2.2.0-beta.8",
"@types/node": "^20.14.11",
"@types/wtfnode": "^0.7.3",
"expect": "^29.7.0",
Expand All @@ -33,4 +33,4 @@
"typescript": "^5.3.2",
"wtfnode": "^0.9.3"
}
}
}
4 changes: 2 additions & 2 deletions packages/fdc3-schema/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kite9/fdc3-schema",
"version": "2.2.0-beta.6",
"version": "2.2.0-beta.8",
"author": "Fintech Open Source Foundation (FINOS)",
"homepage": "https://fdc3.finos.org",
"repository": {
Expand Down Expand Up @@ -40,4 +40,4 @@
"tslib": "^2.0.1",
"typescript": "^5.3.2"
}
}
}
8 changes: 4 additions & 4 deletions packages/fdc3-standard/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kite9/fdc3-standard",
"version": "2.2.0-beta.6",
"version": "2.2.0-beta.8",
"author": "Fintech Open Source Foundation (FINOS)",
"homepage": "https://fdc3.finos.org",
"repository": {
Expand Down Expand Up @@ -31,8 +31,8 @@
"printWidth": 120
},
"dependencies": {
"@kite9/fdc3-schema": "2.2.0-beta.6",
"@kite9/fdc3-context": "2.2.0-beta.6"
"@kite9/fdc3-schema": "2.2.0-beta.8",
"@kite9/fdc3-context": "2.2.0-beta.8"
},
"devDependencies": {
"@types/jest": "29.5.12",
Expand All @@ -52,4 +52,4 @@
"tslib": "^2.0.1",
"typescript": "^5.3.2"
}
}
}
24 changes: 0 additions & 24 deletions packages/fdc3-standard/src/api/GetAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,30 +92,6 @@ export type GetAgentParams = {
failover?: (args: GetAgentParams) => Promise<WindowProxy | DesktopAgent>
};

/**
* Contains constants representing the errors that can be encountered when
* trying to connect to a web-based Desktop Agent with the getAgent function.
*/
export enum AgentError {
/** Returned if no Desktop Agent was found by any means available or
* if the Agent previously connected to is not contactable on a
* subsequent connection attempt.*/
AgentNotFound = "AgentNotFound",

/** Returned if validation of the app identity by the Desktop Agent
* Failed or the app is not being allowed to connect to the Desktop Agent
* for another reason. */
AccessDenied = "AccessDenied",

/** Returned if an error or exception occurs while trying to set
* up communication with a Desktop Agent. */
ErrorOnConnect = "ErrorOnConnect",

/** Returned if either the failover function itself, or what it returned,
* was not the right type. */
InvalidFailover = "InvalidFailover"
}

/** Type representing data on the Desktop Agent that an app
* connected to that is persisted by the getAgent function
* to be used when re-connecting (after a navigation or
Expand Down
42 changes: 0 additions & 42 deletions packages/fdc3-standard/src/api/Methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,54 +24,12 @@ import { StandardContextsSet } from '../internal/contextConfiguration';
import { StandardIntentsSet } from '../internal/intentConfiguration';
import { Context } from '@kite9/fdc3-context'

const DEFAULT_TIMEOUT = 5000;

const UnavailableError = new Error('FDC3 DesktopAgent not available at `window.fdc3`.');
const TimeoutError = new Error('Timed out waiting for `fdc3Ready` event.');
const UnexpectedError = new Error('`fdc3Ready` event fired, but `window.fdc3` not set to DesktopAgent.');

function rejectIfNoGlobal(f: () => Promise<any>) {
return window.fdc3 ? f() : Promise.reject(UnavailableError);
}

/**
* Utility function that returns a promise that will resolve immediately
* if the desktop agent API is found at `window.fdc3`. If the API is found,
* the promise will resolve when the `fdc3Ready` event is received or if it
* is found at the end of the specified timeout. If the API is not found, it
* will reject with an error.
*
* ```javascript
* await fdc3Ready();
* const intentListener = await addIntentListener("ViewChart", intentHandlerFn);
* ```
*
* There is no need to use this function if you are using `await getAgent()` to
* retrieve a Desktop Agent as it already waits for the Desktop Agent to be ready.
*
* @param waitForMs The number of milliseconds to wait for the FDC3 API to be
* ready. Defaults to 5 seconds.
*/
export const fdc3Ready = async (waitForMs = DEFAULT_TIMEOUT): Promise<void> => {
return new Promise((resolve, reject) => {
// if the global is already available resolve immediately
if (window.fdc3) {
resolve();
} else {
// if its not available setup a timeout to return a rejected promise
const timeout = setTimeout(() => (window.fdc3 ? resolve() : reject(TimeoutError)), waitForMs);
// listen for the fdc3Ready event
window.addEventListener(
'fdc3Ready',
() => {
clearTimeout(timeout);
window.fdc3 ? resolve() : reject(UnexpectedError);
},
{ once: true }
);
}
});
};

function isString(app: AppIdentifier | string | undefined): app is string {
return !!app && typeof app === 'string';
Expand Down
13 changes: 5 additions & 8 deletions packages/fdc3-standard/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,13 @@ export * from './api/PrivateChannel';
export * from './api/RecommendedChannels';
export * from './api/Types';
export * from './api/Events'

export * from './api/Events';
export * from './api/GetAgent';
export * from './context/ContextType';

export * from './intents/Intents';
export * from './api/Events';
export { AgentError, DesktopAgentDetails, GetAgentParams, GetAgentType, WebDesktopAgentType } from './api/GetAgent';

export { IntentResolver, IntentResolutionChoice } from './ui/IntentResolver';
export { ChannelSelector } from './ui/ChannelSelector';
export { Connectable } from './ui/Connectable'
export * from './ui/IntentResolver';
export * from './ui/ChannelSelector';
export * from './ui/Connectable'

declare global {
interface Window {
Expand Down
10 changes: 4 additions & 6 deletions packages/fdc3/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ export * from "@kite9/fdc3-context"
import { BrowserTypes, BridgingTypes } from "@kite9/fdc3-schema";
export { BridgingTypes, BrowserTypes };

import { getAgent } from "@kite9/fdc3-get-agent";
export { getAgent };

export * from '@kite9/fdc3-standard';

import { DesktopAgent, AppIdentifier } from "@kite9/fdc3-standard";

export * from '@kite9/fdc3-standard';
export { AppIdentifier };

import { getAgent, fdc3Ready } from "@kite9/fdc3-get-agent";
export { getAgent, fdc3Ready };

/** Might not be needed */
declare global {
interface Window {
Expand Down
6 changes: 3 additions & 3 deletions packages/testing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kite9/testing",
"version": "2.2.0-beta.6",
"version": "2.2.0-beta.8",
"private": true,
"files": [
"dist"
Expand All @@ -16,7 +16,7 @@
"@cucumber/cucumber": "10.3.1",
"@cucumber/html-formatter": "11.0.4",
"@cucumber/pretty-formatter": "1.0.1",
"@kite9/fdc3-standard": "2.2.0-beta.6",
"@kite9/fdc3-standard": "2.2.0-beta.8",
"@types/expect": "24.3.0",
"@types/lodash": "4.14.167",
"@types/node": "^20.14.11",
Expand All @@ -41,4 +41,4 @@
"typescript": "^5.3.2",
"uuid": "^9.0.1"
}
}
}
10 changes: 5 additions & 5 deletions toolbox/fdc3-for-web/demo/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@kite9/demo",
"private": true,
"version": "2.2.0-beta.6",
"version": "2.2.0-beta.8",
"scripts": {
"dev": "nodemon -w src/server src/server/main.ts"
},
Expand All @@ -13,9 +13,9 @@
"vite": "^5.2.0"
},
"dependencies": {
"@kite9/fdc3-get-agent": "2.2.0-beta.6",
"@kite9/fdc3-web-impl": "2.2.0-beta.6",
"@kite9/fdc3-standard": "2.2.0-beta.6",
"@kite9/fdc3-get-agent": "2.2.0-beta.8",
"@kite9/fdc3-web-impl": "2.2.0-beta.8",
"@kite9/fdc3-standard": "2.2.0-beta.8",
"@types/uuid": "^10.0.0",
"@types/ws": "^8.5.10",
"express": "^4.18.3",
Expand All @@ -26,4 +26,4 @@
"uuid": "^9.0.1",
"vite-express": "^0.15.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ window.addEventListener("load", () => {
},
payload: {
fdc3Version: "2.2",
resolver: window.location.origin + "/static/da/intent-resolver.html",
channelSelector: window.location.origin + "/static/da/channel-selector.html",
intentResolverUrl: window.location.origin + "/static/da/intent-resolver.html",
channelSelectorUrl: window.location.origin + "/static/da/channel-selector.html",
}
}, origin, [channel.port1])
}
Expand Down
4 changes: 2 additions & 2 deletions toolbox/fdc3-for-web/demo/src/client/da/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ window.addEventListener("load", () => {
},
payload: {
fdc3Version: "2.2",
resolver: window.location.origin + "/static/da/intent-resolver.html",
channelSelector: window.location.origin + "/static/da/channel-selector.html",
intentResolverUrl: window.location.origin + "/static/da/intent-resolver.html",
channelSelectorUrl: window.location.origin + "/static/da/channel-selector.html",
}
}, "*", [channel.port1])

Expand Down
8 changes: 4 additions & 4 deletions toolbox/fdc3-for-web/fdc3-web-impl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kite9/fdc3-web-impl",
"version": "2.2.0-beta.6",
"version": "2.2.0-beta.8",
"files": [
"dist"
],
Expand All @@ -13,7 +13,7 @@
"build": "npm run directory-openapi && tsc --module es2022"
},
"dependencies": {
"@kite9/fdc3-standard": "2.2.0-beta.6",
"@kite9/fdc3-standard": "2.2.0-beta.8",
"@types/uuid": "^10.0.0",
"uuid": "^9.0.1"
},
Expand All @@ -22,7 +22,7 @@
"@cucumber/html-formatter": "11.0.4",
"@cucumber/pretty-formatter": "1.0.1",
"@kite9/fdc3-common": "2.2.0-beta.6",
"@kite9/testing": "2.2.0-beta.6",
"@kite9/testing": "2.2.0-beta.8",
"@types/expect": "24.3.0",
"@types/lodash": "4.14.167",
"@types/node": "^20.14.11",
Expand All @@ -45,4 +45,4 @@
"typescript": "^5.3.2",
"uuid": "^9.0.1"
}
}
}
Loading

0 comments on commit 7540c23

Please sign in to comment.