Skip to content

Commit

Permalink
change openTokenService sig
Browse files Browse the repository at this point in the history
  • Loading branch information
edsilv committed Aug 25, 2017
1 parent af20c7b commit 8d2f3aa
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion dist/client/manifesto.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2454,7 +2454,7 @@ var Manifesto;
case 0:
tokenService = authService.getService(Manifesto.ServiceProfile.AUTH1TOKEN.toString());
if (!tokenService) return [3 /*break*/, 3];
return [4 /*yield*/, openTokenService(tokenService)];
return [4 /*yield*/, openTokenService(resource, tokenService)];
case 1:
tokenMessage = _a.sent();
if (!(tokenMessage && tokenMessage.accessToken)) return [3 /*break*/, 3];
Expand Down
2 changes: 1 addition & 1 deletion dist/client/manifesto.js
Original file line number Diff line number Diff line change
Expand Up @@ -2381,7 +2381,7 @@ var Manifesto;
case 0:
tokenService = authService.getService(Manifesto.ServiceProfile.AUTH1TOKEN.toString());
if (!tokenService) return [3 /*break*/, 3];
return [4 /*yield*/, openTokenService(tokenService)];
return [4 /*yield*/, openTokenService(resource, tokenService)];
case 1:
tokenMessage = _a.sent();
if (!(tokenMessage && tokenMessage.accessToken)) return [3 /*break*/, 3];
Expand Down
8 changes: 4 additions & 4 deletions dist/manifesto.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,10 +535,10 @@ declare namespace Manifesto {
static isLevel1ImageProfile(profile: Manifesto.ServiceProfile): boolean;
static isLevel2ImageProfile(profile: Manifesto.ServiceProfile): boolean;
static loadResource(uri: string): Promise<string>;
static loadExternalResourcesAuth1(resources: IExternalResource[], openContentProviderInteraction: (service: Manifesto.IService) => any, openTokenService: (tokenService: Manifesto.IService) => Promise<any>, getStoredAccessToken: (resource: Manifesto.IExternalResource) => Promise<Manifesto.IAccessToken | null>, userInteractedWithContentProvider: (contentProviderInteraction: any) => Promise<any>, getContentProviderInteraction: (resource: IExternalResource, service: Manifesto.IService) => Promise<any>, handleMovedTemporarily: (resource: IExternalResource) => Promise<any>, showOutOfOptionsMessages: (service: Manifesto.IService) => void): Promise<IExternalResource[]>;
static loadExternalResourceAuth1(resource: IExternalResource, openContentProviderInteraction: (service: Manifesto.IService) => any, openTokenService: (tokenService: Manifesto.IService) => Promise<void>, getStoredAccessToken: (resource: Manifesto.IExternalResource) => Promise<Manifesto.IAccessToken | null>, userInteractedWithContentProvider: (contentProviderInteraction: any) => Promise<any>, getContentProviderInteraction: (resource: IExternalResource, service: Manifesto.IService) => Promise<any>, handleMovedTemporarily: (resource: IExternalResource) => Promise<any>, showOutOfOptionsMessages: (service: Manifesto.IService) => void): Promise<IExternalResource>;
static doAuthChain(resource: IExternalResource, openContentProviderInteraction: (service: Manifesto.IService) => any, openTokenService: (tokenService: Manifesto.IService) => Promise<any>, userInteractedWithContentProvider: (contentProviderInteraction: any) => Promise<any>, getContentProviderInteraction: (resource: IExternalResource, service: Manifesto.IService) => Promise<any>, handleMovedTemporarily: (resource: IExternalResource) => Promise<any>, showOutOfOptionsMessages: (service: Manifesto.IService) => void): Promise<Manifesto.IExternalResource | void>;
static attemptResourceWithToken(resource: Manifesto.IExternalResource, openTokenService: (tokenService: Manifesto.IService) => Promise<any>, authService: Manifesto.IService): Promise<Manifesto.IExternalResource | void>;
static loadExternalResourcesAuth1(resources: IExternalResource[], openContentProviderInteraction: (service: Manifesto.IService) => any, openTokenService: (resource: Manifesto.IExternalResource, tokenService: Manifesto.IService) => Promise<any>, getStoredAccessToken: (resource: Manifesto.IExternalResource) => Promise<Manifesto.IAccessToken | null>, userInteractedWithContentProvider: (contentProviderInteraction: any) => Promise<any>, getContentProviderInteraction: (resource: IExternalResource, service: Manifesto.IService) => Promise<any>, handleMovedTemporarily: (resource: IExternalResource) => Promise<any>, showOutOfOptionsMessages: (service: Manifesto.IService) => void): Promise<IExternalResource[]>;
static loadExternalResourceAuth1(resource: IExternalResource, openContentProviderInteraction: (service: Manifesto.IService) => any, openTokenService: (resource: Manifesto.IExternalResource, tokenService: Manifesto.IService) => Promise<void>, getStoredAccessToken: (resource: Manifesto.IExternalResource) => Promise<Manifesto.IAccessToken | null>, userInteractedWithContentProvider: (contentProviderInteraction: any) => Promise<any>, getContentProviderInteraction: (resource: IExternalResource, service: Manifesto.IService) => Promise<any>, handleMovedTemporarily: (resource: IExternalResource) => Promise<any>, showOutOfOptionsMessages: (service: Manifesto.IService) => void): Promise<IExternalResource>;
static doAuthChain(resource: IExternalResource, openContentProviderInteraction: (service: Manifesto.IService) => any, openTokenService: (resource: Manifesto.IExternalResource, tokenService: Manifesto.IService) => Promise<any>, userInteractedWithContentProvider: (contentProviderInteraction: any) => Promise<any>, getContentProviderInteraction: (resource: IExternalResource, service: Manifesto.IService) => Promise<any>, handleMovedTemporarily: (resource: IExternalResource) => Promise<any>, showOutOfOptionsMessages: (service: Manifesto.IService) => void): Promise<Manifesto.IExternalResource | void>;
static attemptResourceWithToken(resource: Manifesto.IExternalResource, openTokenService: (resource: Manifesto.IExternalResource, tokenService: Manifesto.IService) => Promise<any>, authService: Manifesto.IService): Promise<Manifesto.IExternalResource | void>;
static loadExternalResourcesAuth09(resources: IExternalResource[], tokenStorageStrategy: string, clickThrough: (resource: IExternalResource) => Promise<any>, restricted: (resource: IExternalResource) => Promise<any>, login: (resource: IExternalResource) => Promise<any>, getAccessToken: (resource: IExternalResource, rejectOnError: boolean) => Promise<IAccessToken>, storeAccessToken: (resource: IExternalResource, token: IAccessToken, tokenStorageStrategy: string) => Promise<any>, getStoredAccessToken: (resource: IExternalResource, tokenStorageStrategy: string) => Promise<IAccessToken>, handleResourceResponse: (resource: IExternalResource) => Promise<any>, options?: IManifestoOptions): Promise<IExternalResource[]>;
static loadExternalResourceAuth09(resource: IExternalResource, tokenStorageStrategy: string, clickThrough: (resource: IExternalResource) => Promise<any>, restricted: (resource: IExternalResource) => Promise<any>, login: (resource: IExternalResource) => Promise<any>, getAccessToken: (resource: IExternalResource, rejectOnError: boolean) => Promise<IAccessToken>, storeAccessToken: (resource: IExternalResource, token: IAccessToken, tokenStorageStrategy: string) => Promise<any>, getStoredAccessToken: (resource: IExternalResource, tokenStorageStrategy: string) => Promise<IAccessToken>, handleResourceResponse: (resource: IExternalResource) => Promise<any>, options?: IManifestoOptions): Promise<IExternalResource>;
static createError(name: string, message: string): Error;
Expand Down
2 changes: 1 addition & 1 deletion dist/server/manifesto.js
Original file line number Diff line number Diff line change
Expand Up @@ -2453,7 +2453,7 @@ var Manifesto;
case 0:
tokenService = authService.getService(Manifesto.ServiceProfile.AUTH1TOKEN.toString());
if (!tokenService) return [3 /*break*/, 3];
return [4 /*yield*/, openTokenService(tokenService)];
return [4 /*yield*/, openTokenService(resource, tokenService)];
case 1:
tokenMessage = _a.sent();
if (!(tokenMessage && tokenMessage.accessToken)) return [3 /*break*/, 3];
Expand Down
10 changes: 5 additions & 5 deletions src/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ namespace Manifesto {
static loadExternalResourcesAuth1(
resources: IExternalResource[],
openContentProviderInteraction: (service: Manifesto.IService) => any,
openTokenService: (tokenService: Manifesto.IService) => Promise<any>,
openTokenService: (resource: Manifesto.IExternalResource, tokenService: Manifesto.IService) => Promise<any>,
getStoredAccessToken: (resource: Manifesto.IExternalResource) => Promise<Manifesto.IAccessToken | null>,
userInteractedWithContentProvider: (contentProviderInteraction: any) => Promise<any>,
getContentProviderInteraction: (resource: IExternalResource, service: Manifesto.IService) => Promise<any>,
Expand Down Expand Up @@ -257,7 +257,7 @@ namespace Manifesto {
static async loadExternalResourceAuth1(
resource: IExternalResource,
openContentProviderInteraction: (service: Manifesto.IService) => any,
openTokenService: (tokenService: Manifesto.IService) => Promise<void>,
openTokenService: (resource: Manifesto.IExternalResource, tokenService: Manifesto.IService) => Promise<void>,
getStoredAccessToken: (resource: Manifesto.IExternalResource) => Promise<Manifesto.IAccessToken | null>,
userInteractedWithContentProvider: (contentProviderInteraction: any) => Promise<any>,
getContentProviderInteraction: (resource: IExternalResource, service: Manifesto.IService) => Promise<any>,
Expand Down Expand Up @@ -303,7 +303,7 @@ namespace Manifesto {
static async doAuthChain(
resource: IExternalResource,
openContentProviderInteraction: (service: Manifesto.IService) => any,
openTokenService: (tokenService: Manifesto.IService) => Promise<any>,
openTokenService: (resource: Manifesto.IExternalResource, tokenService: Manifesto.IService) => Promise<any>,
userInteractedWithContentProvider: (contentProviderInteraction: any) => Promise<any>,
getContentProviderInteraction: (resource: IExternalResource, service: Manifesto.IService) => Promise<any>,
handleMovedTemporarily: (resource: IExternalResource) => Promise<any>,
Expand Down Expand Up @@ -417,15 +417,15 @@ namespace Manifesto {

static async attemptResourceWithToken(
resource: Manifesto.IExternalResource,
openTokenService: (tokenService: Manifesto.IService) => Promise<any>,
openTokenService: (resource: Manifesto.IExternalResource, tokenService: Manifesto.IService) => Promise<any>,
authService: Manifesto.IService): Promise<Manifesto.IExternalResource | void> {

// attempting token interaction for " + authService["@id"]
const tokenService: Manifesto.IService | null = authService.getService(ServiceProfile.AUTH1TOKEN.toString());

if (tokenService) {
// found token service: " + tokenService["@id"]);
let tokenMessage: any = await openTokenService(tokenService);
let tokenMessage: any = await openTokenService(resource, tokenService);

if (tokenMessage && tokenMessage.accessToken) {
await resource.getData(tokenMessage);
Expand Down

0 comments on commit 8d2f3aa

Please sign in to comment.