@opra/common 1.0.0-alpha.6 → 1.0.0-alpha.7
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/browser.js +9 -0
- package/cjs/document/factory/http-api.factory.js +1 -0
- package/cjs/document/http/http-controller.js +3 -0
- package/cjs/document/http/http-operation.js +6 -0
- package/esm/document/factory/http-api.factory.js +1 -0
- package/esm/document/http/http-controller.js +3 -0
- package/esm/document/http/http-operation.js +5 -0
- package/package.json +1 -1
- package/types/document/http/http-controller.d.ts +1 -0
- package/types/document/http/http-operation.d.ts +1 -0
package/browser.js
CHANGED
|
@@ -2541,6 +2541,9 @@ var HttpControllerClass = class extends DocumentElement {
|
|
|
2541
2541
|
if (this.node.parent && this.node.parent.element instanceof HttpController2)
|
|
2542
2542
|
return this.node.parent.element.findParameter(paramName, location);
|
|
2543
2543
|
}
|
|
2544
|
+
getFullUrl() {
|
|
2545
|
+
return (this.owner instanceof HttpController2 ? this.owner.getFullUrl() : "/") + this.path;
|
|
2546
|
+
}
|
|
2544
2547
|
/**
|
|
2545
2548
|
*
|
|
2546
2549
|
*/
|
|
@@ -2734,6 +2737,7 @@ var HttpMultipartField = class extends HttpMediaType {
|
|
|
2734
2737
|
};
|
|
2735
2738
|
|
|
2736
2739
|
// ../../build/common/esm/document/http/http-operation.js
|
|
2740
|
+
import nodePath from "node:path";
|
|
2737
2741
|
import { asMutable as asMutable12 } from "ts-gems";
|
|
2738
2742
|
|
|
2739
2743
|
// ../../build/common/esm/document/decorators/http-operation.decorator.js
|
|
@@ -3162,6 +3166,10 @@ var HttpOperationClass = class extends DocumentElement {
|
|
|
3162
3166
|
return prm;
|
|
3163
3167
|
}
|
|
3164
3168
|
}
|
|
3169
|
+
getFullUrl() {
|
|
3170
|
+
const out = this.owner.getFullUrl();
|
|
3171
|
+
return out ? this.path ? nodePath.posix.join(out, this.path) : out : this.path || "/";
|
|
3172
|
+
}
|
|
3165
3173
|
toJSON() {
|
|
3166
3174
|
const out = omitUndefined({
|
|
3167
3175
|
kind: OpraSchema.HttpOperation.Kind,
|
|
@@ -3384,6 +3392,7 @@ var HttpApiFactory = class {
|
|
|
3384
3392
|
*/
|
|
3385
3393
|
static async createApi(context, document, init) {
|
|
3386
3394
|
const api = new HttpApi(document);
|
|
3395
|
+
api.name = init.name;
|
|
3387
3396
|
api.description = init.description;
|
|
3388
3397
|
api.url = init.url;
|
|
3389
3398
|
if (init.controllers) {
|
|
@@ -98,6 +98,9 @@ class HttpControllerClass extends document_element_js_1.DocumentElement {
|
|
|
98
98
|
if (this.node.parent && this.node.parent.element instanceof exports.HttpController)
|
|
99
99
|
return this.node.parent.element.findParameter(paramName, location);
|
|
100
100
|
}
|
|
101
|
+
getFullUrl() {
|
|
102
|
+
return (this.owner instanceof exports.HttpController ? this.owner.getFullUrl() : '/') + this.path;
|
|
103
|
+
}
|
|
101
104
|
/**
|
|
102
105
|
*
|
|
103
106
|
*/
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HttpOperation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
4
6
|
const ts_gems_1 = require("ts-gems");
|
|
5
7
|
const index_js_1 = require("../../helpers/index.js");
|
|
6
8
|
const index_js_2 = require("../../schema/index.js");
|
|
@@ -53,6 +55,10 @@ class HttpOperationClass extends document_element_js_1.DocumentElement {
|
|
|
53
55
|
return prm;
|
|
54
56
|
}
|
|
55
57
|
}
|
|
58
|
+
getFullUrl() {
|
|
59
|
+
const out = this.owner.getFullUrl();
|
|
60
|
+
return out ? (this.path ? node_path_1.default.posix.join(out, this.path) : out) : this.path || '/';
|
|
61
|
+
}
|
|
56
62
|
toJSON() {
|
|
57
63
|
const out = (0, index_js_1.omitUndefined)({
|
|
58
64
|
kind: index_js_2.OpraSchema.HttpOperation.Kind,
|
|
@@ -95,6 +95,9 @@ class HttpControllerClass extends DocumentElement {
|
|
|
95
95
|
if (this.node.parent && this.node.parent.element instanceof HttpController)
|
|
96
96
|
return this.node.parent.element.findParameter(paramName, location);
|
|
97
97
|
}
|
|
98
|
+
getFullUrl() {
|
|
99
|
+
return (this.owner instanceof HttpController ? this.owner.getFullUrl() : '/') + this.path;
|
|
100
|
+
}
|
|
98
101
|
/**
|
|
99
102
|
*
|
|
100
103
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import nodePath from 'node:path';
|
|
1
2
|
import { asMutable } from 'ts-gems';
|
|
2
3
|
import { cloneObject, omitUndefined } from '../../helpers/index.js';
|
|
3
4
|
import { OpraSchema } from '../../schema/index.js';
|
|
@@ -50,6 +51,10 @@ class HttpOperationClass extends DocumentElement {
|
|
|
50
51
|
return prm;
|
|
51
52
|
}
|
|
52
53
|
}
|
|
54
|
+
getFullUrl() {
|
|
55
|
+
const out = this.owner.getFullUrl();
|
|
56
|
+
return out ? (this.path ? nodePath.posix.join(out, this.path) : out) : this.path || '/';
|
|
57
|
+
}
|
|
53
58
|
toJSON() {
|
|
54
59
|
const out = omitUndefined({
|
|
55
60
|
kind: OpraSchema.HttpOperation.Kind,
|
package/package.json
CHANGED
|
@@ -76,6 +76,7 @@ declare class HttpControllerClass extends DocumentElement {
|
|
|
76
76
|
findController(controller: Type): HttpController | undefined;
|
|
77
77
|
findController(resourcePath: string): HttpController | undefined;
|
|
78
78
|
findParameter(paramName: string, location?: OpraSchema.HttpParameterLocation): HttpParameter | undefined;
|
|
79
|
+
getFullUrl(): string;
|
|
79
80
|
/**
|
|
80
81
|
*
|
|
81
82
|
*/
|
|
@@ -79,6 +79,7 @@ declare class HttpOperationClass extends DocumentElement {
|
|
|
79
79
|
composition?: string;
|
|
80
80
|
compositionOptions?: Record<string, any>;
|
|
81
81
|
findParameter(paramName: string, location?: OpraSchema.HttpParameterLocation): HttpParameter | undefined;
|
|
82
|
+
getFullUrl(): string;
|
|
82
83
|
toJSON(): OpraSchema.HttpOperation;
|
|
83
84
|
}
|
|
84
85
|
export {};
|