Skip to content

Commit 3e99e5f

Browse files
committed
BUG#36173373 Fix function/procedure "fetch()" declaration
In TypeScript, properties/fields in a class such as arrow functions become part of "this" which makes it impossible to call "super" when overriding those functions in a potential child class. The most recent versions of the TypeScript compiler actually yield an error when a method in a parent class is declared with an arrow function and then is called by a method in the base class. This patch updates the "fetch()" method declaration in the classes responsible for handling function and procedure calls (as well as the base class definition) to avoid bumping into this compiler error. Change-Id: Ib0f68e8f56dd206bc55ae26531a11914a317bc63
1 parent 6553be4 commit 3e99e5f

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

gui/extension/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
- BUG#36027690 Connection error when opening REST Object Request Path in Web Browser
88
- BUG#36032142 Unexpected error when deleting records with filter containing nullables
9+
- BUG#36173373 Parent class field not accessible in the child class in the TypeScript SDK
910

1011
## Changes in 1.14.2+8.1.1
1112

gui/frontend/src/modules/mrs/sdk/MrsBaseClasses.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, Oracle and/or its affiliates.
2+
* Copyright (c) 2023, 2024, Oracle and/or its affiliates.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License, version 2.0,
@@ -1194,7 +1194,7 @@ class MrsBaseObjectCall<I, P extends JsonObject> {
11941194
protected params: P) {
11951195
}
11961196

1197-
protected fetch = async (): Promise<I> => {
1197+
protected async fetch (): Promise<I> {
11981198
const input = `${this.schema.requestPath}${this.requestPath}`;
11991199

12001200
const res = await this.schema.service.session.doFetch({
@@ -1205,7 +1205,7 @@ class MrsBaseObjectCall<I, P extends JsonObject> {
12051205
});
12061206

12071207
return await res.json() as I;
1208-
};
1208+
}
12091209
}
12101210

12111211
export class MrsBaseObjectProcedureCall<I, P extends JsonObject>
@@ -1217,11 +1217,11 @@ export class MrsBaseObjectProcedureCall<I, P extends JsonObject>
12171217
super(schema, requestPath, params);
12181218
}
12191219

1220-
public fetch = async (): Promise<IMrsProcedureResultList<I>> => {
1220+
public async fetch (): Promise<IMrsProcedureResultList<I>> {
12211221
const res = await super.fetch();
12221222

12231223
return res;
1224-
};
1224+
}
12251225
}
12261226

12271227
export class MrsBaseObjectFunctionCall<I, P extends JsonObject> extends MrsBaseObjectCall<I, P> {
@@ -1232,9 +1232,9 @@ export class MrsBaseObjectFunctionCall<I, P extends JsonObject> extends MrsBaseO
12321232
super(schema, requestPath, params);
12331233
}
12341234

1235-
public fetch = async (): Promise<I> => {
1235+
public async fetch (): Promise<I> {
12361236
const res = await super.fetch() as IMrsFunctionResult<I>;
12371237

12381238
return res.result;
1239-
};
1239+
}
12401240
}

mrs_plugin/examples/mrs_notes/src/myService.mrs.sdk/MrsBaseClasses.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, Oracle and/or its affiliates.
2+
* Copyright (c) 2023, 2024, Oracle and/or its affiliates.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License, version 2.0,
@@ -1194,7 +1194,7 @@ class MrsBaseObjectCall<I, P extends JsonObject> {
11941194
protected params: P) {
11951195
}
11961196

1197-
protected fetch = async (): Promise<I> => {
1197+
protected async fetch (): Promise<I> {
11981198
const input = `${this.schema.requestPath}${this.requestPath}`;
11991199

12001200
const res = await this.schema.service.session.doFetch({
@@ -1205,7 +1205,7 @@ class MrsBaseObjectCall<I, P extends JsonObject> {
12051205
});
12061206

12071207
return await res.json() as I;
1208-
};
1208+
}
12091209
}
12101210

12111211
export class MrsBaseObjectProcedureCall<I, P extends JsonObject>
@@ -1217,11 +1217,11 @@ export class MrsBaseObjectProcedureCall<I, P extends JsonObject>
12171217
super(schema, requestPath, params);
12181218
}
12191219

1220-
public fetch = async (): Promise<IMrsProcedureResultList<I>> => {
1220+
public async fetch (): Promise<IMrsProcedureResultList<I>> {
12211221
const res = await super.fetch();
12221222

12231223
return res;
1224-
};
1224+
}
12251225
}
12261226

12271227
export class MrsBaseObjectFunctionCall<I, P extends JsonObject> extends MrsBaseObjectCall<I, P> {
@@ -1232,9 +1232,9 @@ export class MrsBaseObjectFunctionCall<I, P extends JsonObject> extends MrsBaseO
12321232
super(schema, requestPath, params);
12331233
}
12341234

1235-
public fetch = async (): Promise<I> => {
1235+
public async fetch (): Promise<I> {
12361236
const res = await super.fetch() as IMrsFunctionResult<I>;
12371237

12381238
return res.result;
1239-
};
1239+
}
12401240
}

mrs_plugin/sdk/MrsBaseClasses.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, Oracle and/or its affiliates.
2+
* Copyright (c) 2023, 2024, Oracle and/or its affiliates.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License, version 2.0,
@@ -1194,7 +1194,7 @@ class MrsBaseObjectCall<I, P extends JsonObject> {
11941194
protected params: P) {
11951195
}
11961196

1197-
protected fetch = async (): Promise<I> => {
1197+
protected async fetch (): Promise<I> {
11981198
const input = `${this.schema.requestPath}${this.requestPath}`;
11991199

12001200
const res = await this.schema.service.session.doFetch({
@@ -1205,7 +1205,7 @@ class MrsBaseObjectCall<I, P extends JsonObject> {
12051205
});
12061206

12071207
return await res.json() as I;
1208-
};
1208+
}
12091209
}
12101210

12111211
export class MrsBaseObjectProcedureCall<I, P extends JsonObject>
@@ -1217,11 +1217,11 @@ export class MrsBaseObjectProcedureCall<I, P extends JsonObject>
12171217
super(schema, requestPath, params);
12181218
}
12191219

1220-
public fetch = async (): Promise<IMrsProcedureResultList<I>> => {
1220+
public async fetch (): Promise<IMrsProcedureResultList<I>> {
12211221
const res = await super.fetch();
12221222

12231223
return res;
1224-
};
1224+
}
12251225
}
12261226

12271227
export class MrsBaseObjectFunctionCall<I, P extends JsonObject> extends MrsBaseObjectCall<I, P> {
@@ -1232,9 +1232,9 @@ export class MrsBaseObjectFunctionCall<I, P extends JsonObject> extends MrsBaseO
12321232
super(schema, requestPath, params);
12331233
}
12341234

1235-
public fetch = async (): Promise<I> => {
1235+
public async fetch (): Promise<I> {
12361236
const res = await super.fetch() as IMrsFunctionResult<I>;
12371237

12381238
return res.result;
1239-
};
1239+
}
12401240
}

0 commit comments

Comments
 (0)