Skip to content

Commit

Permalink
Passing in raising app into narrow
Browse files Browse the repository at this point in the history
  • Loading branch information
robmoffat committed Sep 25, 2024
1 parent ec2306a commit 8c54dbf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/fdc3-get-agent/test/support/TestServerContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class TestServerContext implements ServerContext<ConnectionDetails> {
this.cw = cw
}

async narrowIntents(appIntents: AppIntent[], _context: Context): Promise<AppIntent[]> {
async narrowIntents(_raiser: AppIdentifier, appIntents: AppIntent[], _context: Context): Promise<AppIntent[]> {
return appIntents
}

Expand Down
4 changes: 2 additions & 2 deletions toolbox/fdc3-for-web/demo/src/client/da/DemoServerContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { AppRegistration, Directory, DirectoryApp, InstanceID, ServerContext, St
import { Socket } from 'socket.io-client';
import { v4 as uuid } from 'uuid'
import { FDC3_DA_EVENT } from '../../message-types';
import { AppIntent, Context, OpenError } from '@kite9/fdc3';
import { AppIdentifier, AppIntent, Context, OpenError } from '@kite9/fdc3';

enum Opener { Tab, Frame, Nested }

Expand All @@ -24,7 +24,7 @@ export class DemoServerContext implements ServerContext<DemoRegistration> {
this.directory = directory
}

async narrowIntents(appIntents: AppIntent[], _context: Context): Promise<AppIntent[]> {
async narrowIntents(_raiser: AppIdentifier, appIntents: AppIntent[], _context: Context): Promise<AppIntent[]> {
console.log("Narrow intents - not doing anything")
return appIntents
}
Expand Down
4 changes: 2 additions & 2 deletions toolbox/fdc3-for-web/fdc3-web-impl/src/ServerContext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AppIntent } from "@kite9/fdc3-standard";
import { AppIdentifier, AppIntent } from "@kite9/fdc3-standard";
import { Context } from "@kite9/fdc3-context";

export enum State {
Expand Down Expand Up @@ -106,5 +106,5 @@ export interface ServerContext<X extends AppRegistration> {
* an opportunity for the server to either present an intent resolver
* or otherwise mess with the availble intents, or do nothing.
*/
narrowIntents(appIntents: AppIntent[], context: Context): Promise<AppIntent[]>
narrowIntents(raiser: AppIdentifier, IappIntents: AppIntent[], context: Context): Promise<AppIntent[]>
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ export class IntentHandler implements MessageHandler {
shutdown(): void {
}

async narrowIntents(appIntents: AppIntent[], context: Context, sc: ServerContext<AppRegistration>): Promise<AppIntent[]> {
const out = await sc.narrowIntents(appIntents, context)
async narrowIntents(raiser: AppIdentifier, appIntents: AppIntent[], context: Context, sc: ServerContext<AppRegistration>): Promise<AppIntent[]> {
const out = await sc.narrowIntents(raiser, appIntents, context)
return out
}

Expand Down Expand Up @@ -274,7 +274,7 @@ export class IntentHandler implements MessageHandler {

const appIntents = this.createAppIntents(arg0, [...runningApps, { appId: target.appId }])

const narrowedAppIntents = await this.narrowIntents(appIntents, arg0[0].context, sc)
const narrowedAppIntents = await this.narrowIntents(arg0[0].from, appIntents, arg0[0].context, sc)

if (narrowedAppIntents.length == 1) {
if ((narrowedAppIntents[0].apps.length == 2) && (narrowedAppIntents[0].apps[0].instanceId)) {
Expand Down Expand Up @@ -337,7 +337,7 @@ export class IntentHandler implements MessageHandler {
}
})

const narrowedAppIntents = await this.narrowIntents(appIntents, arg0[0].context, sc)
const narrowedAppIntents = await this.narrowIntents(arg0[0].from, appIntents, arg0[0].context, sc)

if (narrowedAppIntents.length == 0) {
// nothing can resolve the intent, fail
Expand Down

0 comments on commit 8c54dbf

Please sign in to comment.