@appweaver/client 1.0.22 → 1.0.23
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../clients/angular-client';
|
package/angular/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("../clients/angular-client"), exports);
|
|
@@ -2,8 +2,14 @@ import { FetchResponse, MaybeOptionalInit } from 'openapi-fetch';
|
|
|
2
2
|
import { HttpMethod, MediaType, PathsWithMethod } from 'openapi-typescript-helpers';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { BaseClient, ClientConfig, ClientResult, FetchHandler } from './base-client';
|
|
5
|
-
import { ExtendedPaths, InitParam
|
|
5
|
+
import { ExtendedPaths, InitParam } from './base-client-interface';
|
|
6
6
|
import { AccountClient, AccountInterface, AccountType, AuthClient, AuthInterface, AuthType, FilesClient, HealthClient, HealthInterface, HealthType, ResourceClient, ResourceInterface, ResourceType } from './modules';
|
|
7
|
+
/** Maps a `Promise`-returning type to a concrete RxJS `Observable`. */
|
|
8
|
+
export type PromiseToObservable<T> = T extends Promise<infer R> ? Observable<R> : T;
|
|
9
|
+
/** Maps every `Promise`-returning method of `T` to return a concrete RxJS `Observable`. */
|
|
10
|
+
export type ObservableMethods<T> = {
|
|
11
|
+
[K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => PromiseToObservable<R> : T[K];
|
|
12
|
+
};
|
|
7
13
|
export declare class AngularClient<Paths extends {} = {
|
|
8
14
|
[key: string]: any;
|
|
9
15
|
}> extends BaseClient<Paths, true> {
|
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import { FetchResponse, MaybeOptionalInit } from 'openapi-fetch';
|
|
2
2
|
import { HttpMethod, MediaType, PathsWithMethod, RequiredKeysOf } from 'openapi-typescript-helpers';
|
|
3
|
-
import { Observable } from 'rxjs';
|
|
4
3
|
export type ExtendedPaths<Paths> = Paths & Record<string, Record<HttpMethod, {}>>;
|
|
5
4
|
export type InitParam<Init> = RequiredKeysOf<Init> extends never ? [(Init & {
|
|
6
5
|
[key: string]: unknown;
|
|
7
6
|
})?] : [Init & {
|
|
8
7
|
[key: string]: unknown;
|
|
9
8
|
}];
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Minimal structural subset of an RxJS `Observable`.
|
|
11
|
+
*
|
|
12
|
+
* Keeps the base client free of any `rxjs` dependency (runtime and types) while
|
|
13
|
+
* remaining assignable from a real `Observable` — `AngularClient` narrows these
|
|
14
|
+
* return types to concrete RxJS Observables in the `@appweaver/client/angular` entry.
|
|
15
|
+
*/
|
|
16
|
+
export interface ObservableLike<T> {
|
|
17
|
+
subscribe(observer?: {
|
|
18
|
+
next?: (value: T) => void;
|
|
19
|
+
error?: (error: any) => void;
|
|
20
|
+
complete?: () => void;
|
|
21
|
+
}): {
|
|
22
|
+
unsubscribe(): void;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export type ObservableOrPromise<T, B extends boolean> = B extends true ? ObservableLike<T> : Promise<T>;
|
|
26
|
+
export type PromiseToObservable<T> = T extends Promise<infer R> ? ObservableLike<R> : T;
|
|
12
27
|
export type ObservableMethods<T> = {
|
|
13
28
|
[K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => PromiseToObservable<R> : T[K];
|
|
14
29
|
};
|
package/clients/index.d.ts
CHANGED
package/clients/index.js
CHANGED
|
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./modules"), exports);
|
|
18
|
-
__exportStar(require("./angular-client"), exports);
|
|
19
18
|
__exportStar(require("./base-client"), exports);
|
|
20
19
|
__exportStar(require("./base-client-interface"), exports);
|
|
21
20
|
__exportStar(require("./fetch-client"), exports);
|
|
@@ -173,7 +173,8 @@ export { ClientError };
|
|
|
173
173
|
`;
|
|
174
174
|
}
|
|
175
175
|
function generateAngularClient(pathsTypeImport, pathsTypeGeneric, className, clientMethodContent) {
|
|
176
|
-
return `import { ClientConfig, ClientError
|
|
176
|
+
return `import { ClientConfig, ClientError } from '@appweaver/client';
|
|
177
|
+
import { AngularClient } from '@appweaver/client/angular';
|
|
177
178
|
import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
|
|
178
179
|
import { firstValueFrom } from 'rxjs';
|
|
179
180
|
${pathsTypeImport}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appweaver/client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"description": "Appweaver - the backend framework for AI-first development (@client)",
|
|
5
5
|
"author": "Luka Matosevic",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,10 +37,18 @@
|
|
|
37
37
|
"openapi-typescript": "7.13.0",
|
|
38
38
|
"openapi-typescript-helpers": "0.1.0",
|
|
39
39
|
"prettier": "3.8.4",
|
|
40
|
-
"rxjs": "^7.8.0",
|
|
41
40
|
"typescript": "5.9.3"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
|
44
|
-
"@types/js-yaml": "4.0.9"
|
|
43
|
+
"@types/js-yaml": "4.0.9",
|
|
44
|
+
"rxjs": "^7.8.0"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"rxjs": "^7.8.0"
|
|
48
|
+
},
|
|
49
|
+
"peerDependenciesMeta": {
|
|
50
|
+
"rxjs": {
|
|
51
|
+
"optional": true
|
|
52
|
+
}
|
|
45
53
|
}
|
|
46
54
|
}
|