Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
Fix problems around legacyAlfrescoApi (#1403)
Browse files Browse the repository at this point in the history
  • Loading branch information
popovicsandras authored Aug 5, 2022
1 parent 434c24e commit 73acb91
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 31 deletions.
1 change: 0 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
export * from './src/api-legacy/legacy';
export * from './src/api-legacy/content-rest-api/src/index';
export * from './src/api-legacy/activiti-rest-api/src/index';
export * from './src/api-legacy/legacy-alfresco-api';
export * from './src/api/content-rest-api/index';
export * from './src/api/content-custom-api/index';
export * from './src/api/discovery-rest-api/index';
Expand Down
5 changes: 2 additions & 3 deletions src/alfrescoApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import { ProcessClient } from './processClient';
import { Storage } from './storage';
import { AlfrescoApiConfig } from './alfrescoApiConfig';
import { Authentication } from './authentication/authentication';
import { LegacyAlfrescoApi } from './api-legacy/legacy-alfresco-api';
import { AlfrescoApiType } from './to-deprecate/alfresco-api-type';

export class AlfrescoApi extends LegacyAlfrescoApi implements Emitter, AlfrescoApiType {
export class AlfrescoApi implements Emitter, AlfrescoApiType {
__type = 'legacy-client';
storage: Storage;
config: AlfrescoApiConfig;
contentClient: ContentClient;
Expand All @@ -52,7 +52,6 @@ export class AlfrescoApi extends LegacyAlfrescoApi implements Emitter, AlfrescoA
username: string;

constructor(config?: AlfrescoApiConfig) {
super();
ee(this);

if (config) {
Expand Down
12 changes: 5 additions & 7 deletions src/api-clients/api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/

import { AlfrescoApiType } from "../to-deprecate/alfresco-api-type";
import { LegacyAlfrescoApi } from "../api-legacy/legacy-alfresco-api";
import { HttpClient, RequestOptions } from "./http-client.interface";

export abstract class ApiClient {
Expand All @@ -30,13 +29,12 @@ export abstract class ApiClient {

constructor(legacyApi?: AlfrescoApiType);
constructor(httpClient: HttpClient);
constructor(httpClient?: AlfrescoApiType | HttpClient) {
if (!(httpClient instanceof LegacyAlfrescoApi)) {
this.httpClient = httpClient as HttpClient;
} else {
constructor(httpClient?: AlfrescoApiType & HttpClient) {
if (httpClient?.__type === 'legacy-client') {
// TODO: remove legacyApi?: AlfrescoApi option and clean up this code. BREAKING CHANGE!
this.alfrescoApi = httpClient as AlfrescoApiType;

this.alfrescoApi = httpClient;
} else {
this.httpClient = httpClient;
}
}

Expand Down
20 changes: 0 additions & 20 deletions src/api-legacy/legacy-alfresco-api.ts

This file was deleted.

1 change: 1 addition & 0 deletions src/to-deprecate/alfresco-api-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface LegacyTicketApi {

// Extracted from existing AlfrescoApi:
export interface AlfrescoApiType {
__type: string;
config: AlfrescoApiConfig;
contentClient: HttpClient & LegacyTicketApi;
contentPrivateClient: HttpClient & LegacyTicketApi;
Expand Down

0 comments on commit 73acb91

Please sign in to comment.