@opra/cli 0.31.8 → 0.31.9
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.
|
@@ -71,6 +71,18 @@ export class ${className} {
|
|
|
71
71
|
constructorBody += ` this.${operation} = node.${operation}.bind(node);\n`;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
+
else if (resource instanceof common_1.Storage) {
|
|
75
|
+
tsFile.addImport('@opra/client', ['HttpStorageNode']);
|
|
76
|
+
constructorBody += ` const node = this[kClient].storage('${resource.getFullPath()}');\n`;
|
|
77
|
+
for (const [operation, endpoint] of resource.operations.entries()) {
|
|
78
|
+
tsFile.content += `
|
|
79
|
+
/**
|
|
80
|
+
* ${(0, string_utils_js_1.wrapJSDocString)(endpoint.description || '')}
|
|
81
|
+
*/
|
|
82
|
+
readonly ${operation}: HttpStorageNode['${operation}'];\n`;
|
|
83
|
+
constructorBody += ` this.${operation} = node.${operation}.bind(node);\n`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
74
86
|
if (resource.actions.size) {
|
|
75
87
|
tsFile.addImport('@opra/client', ['HttpRequestObservable']);
|
|
76
88
|
for (const [action, endpoint] of resource.actions.entries()) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import { Collection, Container, Singleton } from '@opra/common';
|
|
2
|
+
import { Collection, Container, Singleton, Storage } from '@opra/common';
|
|
3
3
|
import { wrapJSDocString } from '../utils/string-utils.js';
|
|
4
4
|
export async function processResource(resource, className, tsFile) {
|
|
5
5
|
tsFile.addImport('@opra/client', ['kClient', 'OpraHttpClient']);
|
|
@@ -67,6 +67,18 @@ export class ${className} {
|
|
|
67
67
|
constructorBody += ` this.${operation} = node.${operation}.bind(node);\n`;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
+
else if (resource instanceof Storage) {
|
|
71
|
+
tsFile.addImport('@opra/client', ['HttpStorageNode']);
|
|
72
|
+
constructorBody += ` const node = this[kClient].storage('${resource.getFullPath()}');\n`;
|
|
73
|
+
for (const [operation, endpoint] of resource.operations.entries()) {
|
|
74
|
+
tsFile.content += `
|
|
75
|
+
/**
|
|
76
|
+
* ${wrapJSDocString(endpoint.description || '')}
|
|
77
|
+
*/
|
|
78
|
+
readonly ${operation}: HttpStorageNode['${operation}'];\n`;
|
|
79
|
+
constructorBody += ` this.${operation} = node.${operation}.bind(node);\n`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
70
82
|
if (resource.actions.size) {
|
|
71
83
|
tsFile.addImport('@opra/client', ['HttpRequestObservable']);
|
|
72
84
|
for (const [action, endpoint] of resource.actions.entries()) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/cli",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.9",
|
|
4
4
|
"description": "Opra CLI tools",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"clean:cover": "rimraf ../../coverage/client"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@opra/client": "^0.31.
|
|
32
|
+
"@opra/client": "^0.31.9",
|
|
33
33
|
"chalk": "^5.3.0",
|
|
34
34
|
"commander": "^11.0.0",
|
|
35
35
|
"js-string-escape": "^1.0.1",
|