@ng-openapi/http-resource 0.0.31 → 0.0.32-pr-85-testing-1481b20.0
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/README.md +34 -34
- package/index.cjs +16 -12
- package/index.js +16 -12
- package/package.json +85 -85
package/README.md
CHANGED
|
@@ -40,14 +40,14 @@ npm install @ng-openapi/http-resource ng-openapi --save-dev
|
|
|
40
40
|
|
|
41
41
|
```typescript
|
|
42
42
|
// openapi.config.ts
|
|
43
|
-
import { GeneratorConfig } from
|
|
44
|
-
import { HttpResourcePlugin } from
|
|
43
|
+
import { GeneratorConfig } from "ng-openapi";
|
|
44
|
+
import { HttpResourcePlugin } from "@ng-openapi/http-resource";
|
|
45
45
|
|
|
46
46
|
export default {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
input: "./swagger.json",
|
|
48
|
+
output: "./src/api",
|
|
49
|
+
clientName: "NgOpenApi",
|
|
50
|
+
plugins: [HttpResourcePlugin],
|
|
51
51
|
} as GeneratorConfig;
|
|
52
52
|
```
|
|
53
53
|
|
|
@@ -61,45 +61,45 @@ ng-openapi -c openapi.config.ts
|
|
|
61
61
|
|
|
62
62
|
```typescript
|
|
63
63
|
// app.config.ts
|
|
64
|
-
import { ApplicationConfig } from
|
|
65
|
-
import { provideDefaultClient } from
|
|
64
|
+
import { ApplicationConfig } from "@angular/core";
|
|
65
|
+
import { provideDefaultClient } from "./api/providers";
|
|
66
66
|
|
|
67
67
|
export const appConfig: ApplicationConfig = {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
providers: [
|
|
69
|
+
provideNgOpenApiClient({
|
|
70
|
+
basePath: "https://api.example.com",
|
|
71
|
+
}),
|
|
72
|
+
],
|
|
73
73
|
};
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
### 4. Use Generated Resources
|
|
77
77
|
|
|
78
78
|
```typescript
|
|
79
|
-
import { Component, inject } from
|
|
80
|
-
import { UsersResource } from
|
|
79
|
+
import { Component, inject } from "@angular/core";
|
|
80
|
+
import { UsersResource } from "./api/resources";
|
|
81
81
|
|
|
82
82
|
@Component({
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
83
|
+
selector: "app-users",
|
|
84
|
+
template: `
|
|
85
|
+
<div>
|
|
86
|
+
@if (users.isLoading()) {
|
|
87
|
+
<p>Loading...</p>
|
|
88
|
+
}
|
|
89
|
+
@if (users.error()) {
|
|
90
|
+
<p>Error: {{ users.error() }}</p>
|
|
91
|
+
}
|
|
92
|
+
@for (user of users.value(); track user.id) {
|
|
93
|
+
<div>{{ user.name }}</div>
|
|
94
|
+
}
|
|
95
|
+
</div>
|
|
96
|
+
`,
|
|
97
97
|
})
|
|
98
98
|
export class UsersComponent {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
private readonly usersResource = inject(UsersResource);
|
|
100
|
+
|
|
101
|
+
// Automatic caching and reactive updates
|
|
102
|
+
readonly users = this.usersResource.getUsers();
|
|
103
103
|
}
|
|
104
104
|
```
|
|
105
105
|
|
|
@@ -120,4 +120,4 @@ src/api/
|
|
|
120
120
|
|
|
121
121
|
- 📖 [Full Documentation](https://ng-openapi.dev/plugins/http-resource)
|
|
122
122
|
- 🎯 [Angular httpResource Guide](https://angular.dev/guide/http/resource)
|
|
123
|
-
- 🚀 [Live Examples](https://stackblitz.com/@Mr-Jami/collections/ng-openapi-examples)
|
|
123
|
+
- 🚀 [Live Examples](https://stackblitz.com/@Mr-Jami/collections/ng-openapi-examples)
|
package/index.cjs
CHANGED
|
@@ -1279,6 +1279,19 @@ function charFromCodepoint(c) {
|
|
|
1279
1279
|
);
|
|
1280
1280
|
}
|
|
1281
1281
|
__name(charFromCodepoint, "charFromCodepoint");
|
|
1282
|
+
function setProperty(object, key, value) {
|
|
1283
|
+
if (key === "__proto__") {
|
|
1284
|
+
Object.defineProperty(object, key, {
|
|
1285
|
+
configurable: true,
|
|
1286
|
+
enumerable: true,
|
|
1287
|
+
writable: true,
|
|
1288
|
+
value
|
|
1289
|
+
});
|
|
1290
|
+
} else {
|
|
1291
|
+
object[key] = value;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
__name(setProperty, "setProperty");
|
|
1282
1295
|
var simpleEscapeCheck = new Array(256);
|
|
1283
1296
|
var simpleEscapeMap = new Array(256);
|
|
1284
1297
|
for (i = 0; i < 256; i++) {
|
|
@@ -1403,7 +1416,7 @@ function mergeMappings(state, destination, source, overridableKeys) {
|
|
|
1403
1416
|
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
1404
1417
|
key = sourceKeys[index];
|
|
1405
1418
|
if (!_hasOwnProperty$1.call(destination, key)) {
|
|
1406
|
-
destination
|
|
1419
|
+
setProperty(destination, key, source[key]);
|
|
1407
1420
|
overridableKeys[key] = true;
|
|
1408
1421
|
}
|
|
1409
1422
|
}
|
|
@@ -1444,16 +1457,7 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
|
|
|
1444
1457
|
state.position = startPos || state.position;
|
|
1445
1458
|
throwError(state, "duplicated mapping key");
|
|
1446
1459
|
}
|
|
1447
|
-
|
|
1448
|
-
Object.defineProperty(_result, keyNode, {
|
|
1449
|
-
configurable: true,
|
|
1450
|
-
enumerable: true,
|
|
1451
|
-
writable: true,
|
|
1452
|
-
value: valueNode
|
|
1453
|
-
});
|
|
1454
|
-
} else {
|
|
1455
|
-
_result[keyNode] = valueNode;
|
|
1456
|
-
}
|
|
1460
|
+
setProperty(_result, keyNode, valueNode);
|
|
1457
1461
|
delete overridableKeys[keyNode];
|
|
1458
1462
|
}
|
|
1459
1463
|
return _result;
|
|
@@ -3556,6 +3560,6 @@ return context.set(this.clientContextToken, '${this.config.clientName || "defaul
|
|
|
3556
3560
|
/*! Bundled license information:
|
|
3557
3561
|
|
|
3558
3562
|
js-yaml/dist/js-yaml.mjs:
|
|
3559
|
-
(*! js-yaml 4.1.
|
|
3563
|
+
(*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
|
|
3560
3564
|
*/
|
|
3561
3565
|
//# sourceMappingURL=index.cjs.map
|
package/index.js
CHANGED
|
@@ -1245,6 +1245,19 @@ function charFromCodepoint(c) {
|
|
|
1245
1245
|
);
|
|
1246
1246
|
}
|
|
1247
1247
|
__name(charFromCodepoint, "charFromCodepoint");
|
|
1248
|
+
function setProperty(object, key, value) {
|
|
1249
|
+
if (key === "__proto__") {
|
|
1250
|
+
Object.defineProperty(object, key, {
|
|
1251
|
+
configurable: true,
|
|
1252
|
+
enumerable: true,
|
|
1253
|
+
writable: true,
|
|
1254
|
+
value
|
|
1255
|
+
});
|
|
1256
|
+
} else {
|
|
1257
|
+
object[key] = value;
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
__name(setProperty, "setProperty");
|
|
1248
1261
|
var simpleEscapeCheck = new Array(256);
|
|
1249
1262
|
var simpleEscapeMap = new Array(256);
|
|
1250
1263
|
for (i = 0; i < 256; i++) {
|
|
@@ -1369,7 +1382,7 @@ function mergeMappings(state, destination, source, overridableKeys) {
|
|
|
1369
1382
|
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
1370
1383
|
key = sourceKeys[index];
|
|
1371
1384
|
if (!_hasOwnProperty$1.call(destination, key)) {
|
|
1372
|
-
destination
|
|
1385
|
+
setProperty(destination, key, source[key]);
|
|
1373
1386
|
overridableKeys[key] = true;
|
|
1374
1387
|
}
|
|
1375
1388
|
}
|
|
@@ -1410,16 +1423,7 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
|
|
|
1410
1423
|
state.position = startPos || state.position;
|
|
1411
1424
|
throwError(state, "duplicated mapping key");
|
|
1412
1425
|
}
|
|
1413
|
-
|
|
1414
|
-
Object.defineProperty(_result, keyNode, {
|
|
1415
|
-
configurable: true,
|
|
1416
|
-
enumerable: true,
|
|
1417
|
-
writable: true,
|
|
1418
|
-
value: valueNode
|
|
1419
|
-
});
|
|
1420
|
-
} else {
|
|
1421
|
-
_result[keyNode] = valueNode;
|
|
1422
|
-
}
|
|
1426
|
+
setProperty(_result, keyNode, valueNode);
|
|
1423
1427
|
delete overridableKeys[keyNode];
|
|
1424
1428
|
}
|
|
1425
1429
|
return _result;
|
|
@@ -3521,6 +3525,6 @@ export {
|
|
|
3521
3525
|
/*! Bundled license information:
|
|
3522
3526
|
|
|
3523
3527
|
js-yaml/dist/js-yaml.mjs:
|
|
3524
|
-
(*! js-yaml 4.1.
|
|
3528
|
+
(*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
|
|
3525
3529
|
*/
|
|
3526
3530
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
},
|
|
69
|
-
"peerDependenciesMeta": {
|
|
70
|
-
"@angular/core": {
|
|
71
|
-
"optional": false
|
|
2
|
+
"name": "@ng-openapi/http-resource",
|
|
3
|
+
"version": "0.0.32-pr-85-testing-1481b20.0",
|
|
4
|
+
"description": "HTTP Resource plugin for ng-openapi - Angular HTTP utilities with caching and state management",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"angular",
|
|
7
|
+
"ng-openapi",
|
|
8
|
+
"plugin",
|
|
9
|
+
"http",
|
|
10
|
+
"resource",
|
|
11
|
+
"cache",
|
|
12
|
+
"state-management",
|
|
13
|
+
"typescript",
|
|
14
|
+
"signal",
|
|
15
|
+
"ng",
|
|
16
|
+
"openapi"
|
|
17
|
+
],
|
|
18
|
+
"author": {
|
|
19
|
+
"name": "Tareq Jami",
|
|
20
|
+
"email": "info@jami-it.de",
|
|
21
|
+
"url": "http://tareqjami.de"
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"homepage": "https://ng-openapi.dev/guide/http-resource",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/ng-openapi/ng-openapi/issues"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/ng-openapi/ng-openapi.git",
|
|
31
|
+
"directory": "packages/plugins/http-resource"
|
|
32
|
+
},
|
|
33
|
+
"funding": {
|
|
34
|
+
"type": "github",
|
|
35
|
+
"url": "https://github.com/sponsors/ng-openapi"
|
|
36
|
+
},
|
|
37
|
+
"type": "module",
|
|
38
|
+
"main": "./index.js",
|
|
39
|
+
"module": "./index.js",
|
|
40
|
+
"types": "./index.d.ts",
|
|
41
|
+
"exports": {
|
|
42
|
+
".": {
|
|
43
|
+
"types": "./index.d.ts",
|
|
44
|
+
"import": "./index.js",
|
|
45
|
+
"require": "./index.cjs"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"index.js",
|
|
50
|
+
"index.cjs",
|
|
51
|
+
"index.d.ts",
|
|
52
|
+
"lib/**/*.js",
|
|
53
|
+
"lib/**/*.cjs",
|
|
54
|
+
"lib/**/*.d.ts",
|
|
55
|
+
"README.md",
|
|
56
|
+
"LICENSE",
|
|
57
|
+
"CHANGELOG.md"
|
|
58
|
+
],
|
|
59
|
+
"scripts": {
|
|
60
|
+
"prepublishOnly": "echo 'Build the package using: npm run build:http-resource from workspace root'",
|
|
61
|
+
"build": "tsup"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"@angular/core": ">=19.2",
|
|
65
|
+
"@angular/common": ">=19.2",
|
|
66
|
+
"ng-openapi": ">=0.1",
|
|
67
|
+
"ts-morph": "*"
|
|
72
68
|
},
|
|
73
|
-
"
|
|
74
|
-
|
|
69
|
+
"peerDependenciesMeta": {
|
|
70
|
+
"@angular/core": {
|
|
71
|
+
"optional": false
|
|
72
|
+
},
|
|
73
|
+
"@angular/common": {
|
|
74
|
+
"optional": false
|
|
75
|
+
},
|
|
76
|
+
"ng-openapi": {
|
|
77
|
+
"optional": false
|
|
78
|
+
},
|
|
79
|
+
"ts-morph": {
|
|
80
|
+
"optional": false
|
|
81
|
+
}
|
|
75
82
|
},
|
|
76
|
-
"
|
|
77
|
-
|
|
83
|
+
"engines": {
|
|
84
|
+
"node": ">=20.0.0",
|
|
85
|
+
"npm": ">=8.0.0"
|
|
78
86
|
},
|
|
79
|
-
"
|
|
80
|
-
|
|
87
|
+
"publishConfig": {
|
|
88
|
+
"access": "public",
|
|
89
|
+
"registry": "https://registry.npmjs.org/"
|
|
81
90
|
}
|
|
82
|
-
},
|
|
83
|
-
"engines": {
|
|
84
|
-
"node": ">=20.0.0",
|
|
85
|
-
"npm": ">=8.0.0"
|
|
86
|
-
},
|
|
87
|
-
"publishConfig": {
|
|
88
|
-
"access": "public",
|
|
89
|
-
"registry": "https://registry.npmjs.org/"
|
|
90
|
-
}
|
|
91
91
|
}
|