@opra/core 0.26.3 → 0.26.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/http/http-adapter-host.js +1 -1
- package/cjs/index.js +1 -0
- package/cjs/services/api-service.js +16 -0
- package/esm/http/http-adapter-host.js +1 -1
- package/esm/index.js +1 -0
- package/esm/services/api-service.js +12 -0
- package/package.json +2 -2
- package/types/index.d.ts +1 -0
- package/types/services/api-service.d.ts +6 -0
|
@@ -120,7 +120,7 @@ class HttpAdapterHost extends platform_adapter_host_js_1.PlatformAdapterHost {
|
|
|
120
120
|
let resource = this.api.root;
|
|
121
121
|
let request;
|
|
122
122
|
// Walk through container
|
|
123
|
-
while (resource instanceof common_1.Container) {
|
|
123
|
+
while (resource instanceof common_1.Container && i < parsedUrl.path.length) {
|
|
124
124
|
p = parsedUrl.path[i];
|
|
125
125
|
const r = resource.resources.get(p.resource);
|
|
126
126
|
if (r) {
|
package/cjs/index.js
CHANGED
|
@@ -24,3 +24,4 @@ tslib_1.__exportStar(require("./interfaces/interceptor.interface.js"), exports);
|
|
|
24
24
|
tslib_1.__exportStar(require("./interfaces/logger.interface.js"), exports);
|
|
25
25
|
tslib_1.__exportStar(require("./interfaces/request-handler.interface.js"), exports);
|
|
26
26
|
tslib_1.__exportStar(require("./services/logger.js"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./services/api-service.js"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiService = void 0;
|
|
4
|
+
class ApiService {
|
|
5
|
+
get context() {
|
|
6
|
+
if (!this._context)
|
|
7
|
+
throw new Error(`No context assigned for ${Object.getPrototypeOf(this).name}`);
|
|
8
|
+
return this._context;
|
|
9
|
+
}
|
|
10
|
+
forContext(context) {
|
|
11
|
+
const instance = { context };
|
|
12
|
+
Object.setPrototypeOf(instance, this);
|
|
13
|
+
return instance;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ApiService = ApiService;
|
|
@@ -116,7 +116,7 @@ export class HttpAdapterHost extends PlatformAdapterHost {
|
|
|
116
116
|
let resource = this.api.root;
|
|
117
117
|
let request;
|
|
118
118
|
// Walk through container
|
|
119
|
-
while (resource instanceof Container) {
|
|
119
|
+
while (resource instanceof Container && i < parsedUrl.path.length) {
|
|
120
120
|
p = parsedUrl.path[i];
|
|
121
121
|
const r = resource.resources.get(p.resource);
|
|
122
122
|
if (r) {
|
package/esm/index.js
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export class ApiService {
|
|
2
|
+
get context() {
|
|
3
|
+
if (!this._context)
|
|
4
|
+
throw new Error(`No context assigned for ${Object.getPrototypeOf(this).name}`);
|
|
5
|
+
return this._context;
|
|
6
|
+
}
|
|
7
|
+
forContext(context) {
|
|
8
|
+
const instance = { context };
|
|
9
|
+
Object.setPrototypeOf(instance, this);
|
|
10
|
+
return instance;
|
|
11
|
+
}
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/core",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.4",
|
|
4
4
|
"description": "Opra schema package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"clean:cover": "rimraf ../../coverage/core"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@opra/common": "^0.26.
|
|
30
|
+
"@opra/common": "^0.26.4",
|
|
31
31
|
"accepts": "^1.3.8",
|
|
32
32
|
"content-disposition": "^0.5.4",
|
|
33
33
|
"content-type": "^1.0.5",
|
package/types/index.d.ts
CHANGED