@kanda-libs/kai-frontend-services 0.0.1
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/dist/index.esm.js +5412 -0
- package/dist/index.esm.js.map +7 -0
- package/package.json +49 -0
- package/src/codegen/generated/components/schemas/Address.d.ts +18 -0
- package/src/codegen/generated/components/schemas/Error.d.ts +9 -0
- package/src/codegen/generated/components/schemas/GenerateType.d.ts +3 -0
- package/src/codegen/generated/components/schemas/JobQuote.d.ts +49 -0
- package/src/codegen/generated/components/schemas/LineItem.d.ts +17 -0
- package/src/codegen/generated/components/schemas/Money.d.ts +11 -0
- package/src/codegen/generated/components/schemas/PostPDFInput.d.ts +13 -0
- package/src/codegen/generated/components/schemas/PostPDFOutput.d.ts +44 -0
- package/src/codegen/generated/components/schemas/PublicLiabilityInsurance.d.ts +10 -0
- package/src/codegen/generated/components/schemas/Recipient.d.ts +22 -0
- package/src/codegen/generated/components/schemas/User.d.ts +33 -0
- package/src/codegen/generated/components/schemas/index.d.ts +11 -0
- package/src/codegen/generated/operations/getMe.d.ts +43 -0
- package/src/codegen/generated/operations/index.d.ts +19 -0
- package/src/codegen/generated/operations/postPDF.d.ts +69 -0
- package/src/codegen/generated/servers.d.ts +1 -0
- package/src/codegen/service/index.d.ts +30 -0
- package/src/codegen/service/types.d.ts +19 -0
- package/src/codegen/service/utils/fetch.d.ts +26 -0
- package/src/codegen/service/utils/index.d.ts +13 -0
- package/src/codegen/store/adapters/aiPdfPostPDF.d.ts +8 -0
- package/src/codegen/store/adapters/aiUsersGetMe.d.ts +8 -0
- package/src/codegen/store/adapters/index.d.ts +12 -0
- package/src/codegen/store/constants.d.ts +2 -0
- package/src/codegen/store/helpers.d.ts +24 -0
- package/src/codegen/store/index.d.ts +7 -0
- package/src/codegen/store/selectors/index.d.ts +6 -0
- package/src/codegen/store/slices/actions.d.ts +1 -0
- package/src/codegen/store/slices/generated/actions.d.ts +2 -0
- package/src/codegen/store/slices/generated/aiPdfPostPDF.d.ts +17 -0
- package/src/codegen/store/slices/generated/aiUsersGetMe.d.ts +15 -0
- package/src/codegen/store/slices/generated/index.d.ts +11 -0
- package/src/codegen/store/slices/index.d.ts +8 -0
- package/src/codegen/store/types.d.ts +48 -0
- package/src/config/index.d.ts +2 -0
- package/src/index.d.ts +7 -0
- package/src/types.d.ts +21 -0
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kanda-libs/kai-frontend-services",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.esm.js",
|
|
6
|
+
"types": "src/index.d.ts",
|
|
7
|
+
"module": "dist/index.esm.js",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"src/**/*.d.ts"
|
|
12
|
+
],
|
|
13
|
+
"keywords": [],
|
|
14
|
+
"author": "",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@openapi-io-ts/cli": "^0.5.0",
|
|
18
|
+
"@openapi-io-ts/runtime": "^0.3.1",
|
|
19
|
+
"@reduxjs/toolkit": "^2.2.3",
|
|
20
|
+
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
21
|
+
"@types/node": "^20.11.24",
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "^7.1.0",
|
|
23
|
+
"@typescript-eslint/parser": "^7.1.0",
|
|
24
|
+
"esbuild": "^0.20.2",
|
|
25
|
+
"eslint": "^8.57.0",
|
|
26
|
+
"eslint-plugin-import": "^2.29.1",
|
|
27
|
+
"eslint-plugin-react": "^7.33.2",
|
|
28
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
29
|
+
"eslint-plugin-react-refresh": "^0.4.5",
|
|
30
|
+
"eslint-plugin-unused-imports": "^3.1.0",
|
|
31
|
+
"fp-ts": "^2.16.5",
|
|
32
|
+
"io-ts": "^2.2.21",
|
|
33
|
+
"io-ts-types": "^0.5.19",
|
|
34
|
+
"prettier": "^3.2.5",
|
|
35
|
+
"rimraf": "^5.0.5",
|
|
36
|
+
"ts-node": "^10.9.2",
|
|
37
|
+
"typescript": "^5.4.3",
|
|
38
|
+
"vite": "^5.2.8"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=18.19.0"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build:service-module": "node --no-warnings=ExperimentalWarning --experimental-specifier-resolution=node --loader ts-node/esm src/codegen/service/generator/index.ts",
|
|
45
|
+
"build:store": "node --no-warnings=ExperimentalWarning --experimental-specifier-resolution=node --loader ts-node/esm src/codegen/store/generator/index.ts",
|
|
46
|
+
"build:types": "tsc src/index.ts --declaration --emitDeclarationOnly --jsx react-jsx --esModuleInterop --module esnext --moduleResolution node",
|
|
47
|
+
"build:esm": "pnpm run build:service-module && pnpm run build:store && pnpm run build:types && node --no-warnings=ExperimentalWarning --experimental-specifier-resolution=node --loader ts-node/esm ./build.ts"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as t from 'io-ts';
|
|
2
|
+
export declare const Address: t.IntersectionC<[t.TypeC<{
|
|
3
|
+
line_1: t.StringC;
|
|
4
|
+
city: t.StringC;
|
|
5
|
+
country: t.StringC;
|
|
6
|
+
}>, t.PartialC<{
|
|
7
|
+
line_2: t.StringC;
|
|
8
|
+
county: t.StringC;
|
|
9
|
+
postcode: t.StringC;
|
|
10
|
+
}>]>;
|
|
11
|
+
export interface Address {
|
|
12
|
+
line_1: string;
|
|
13
|
+
line_2?: string;
|
|
14
|
+
city: string;
|
|
15
|
+
county?: string;
|
|
16
|
+
country: string;
|
|
17
|
+
postcode?: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as t from 'io-ts';
|
|
2
|
+
import { LineItem } from './LineItem';
|
|
3
|
+
import { Money } from './Money';
|
|
4
|
+
import { Recipient } from './Recipient';
|
|
5
|
+
export declare const JobQuote: t.IntersectionC<[t.TypeC<{
|
|
6
|
+
id: t.StringC;
|
|
7
|
+
title: t.StringC;
|
|
8
|
+
items: t.ArrayC<t.IntersectionC<[t.TypeC<{
|
|
9
|
+
unit: t.NumberC;
|
|
10
|
+
unit_price: t.TypeC<{
|
|
11
|
+
pence: t.NumberC;
|
|
12
|
+
currency: t.LiteralC<"GBP">;
|
|
13
|
+
vat: t.StringC;
|
|
14
|
+
}>;
|
|
15
|
+
}>, t.PartialC<{
|
|
16
|
+
summary: t.StringC;
|
|
17
|
+
}>]>>;
|
|
18
|
+
total_price: t.TypeC<{
|
|
19
|
+
pence: t.NumberC;
|
|
20
|
+
currency: t.LiteralC<"GBP">;
|
|
21
|
+
vat: t.StringC;
|
|
22
|
+
}>;
|
|
23
|
+
}>, t.PartialC<{
|
|
24
|
+
description: t.StringC;
|
|
25
|
+
category: t.StringC;
|
|
26
|
+
recipient: t.TypeC<{
|
|
27
|
+
name: t.StringC;
|
|
28
|
+
email: t.StringC;
|
|
29
|
+
mobile: t.StringC;
|
|
30
|
+
address: t.IntersectionC<[t.TypeC<{
|
|
31
|
+
line_1: t.StringC;
|
|
32
|
+
city: t.StringC;
|
|
33
|
+
country: t.StringC;
|
|
34
|
+
}>, t.PartialC<{
|
|
35
|
+
line_2: t.StringC;
|
|
36
|
+
county: t.StringC;
|
|
37
|
+
postcode: t.StringC;
|
|
38
|
+
}>]>;
|
|
39
|
+
}>;
|
|
40
|
+
}>]>;
|
|
41
|
+
export interface JobQuote {
|
|
42
|
+
id: string;
|
|
43
|
+
title: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
category?: string;
|
|
46
|
+
recipient?: Recipient;
|
|
47
|
+
items: Array<LineItem>;
|
|
48
|
+
total_price: Money;
|
|
49
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as t from 'io-ts';
|
|
2
|
+
import { Money } from './Money';
|
|
3
|
+
export declare const LineItem: t.IntersectionC<[t.TypeC<{
|
|
4
|
+
unit: t.NumberC;
|
|
5
|
+
unit_price: t.TypeC<{
|
|
6
|
+
pence: t.NumberC;
|
|
7
|
+
currency: t.LiteralC<"GBP">;
|
|
8
|
+
vat: t.StringC;
|
|
9
|
+
}>;
|
|
10
|
+
}>, t.PartialC<{
|
|
11
|
+
summary: t.StringC;
|
|
12
|
+
}>]>;
|
|
13
|
+
export interface LineItem {
|
|
14
|
+
summary?: string;
|
|
15
|
+
unit: number;
|
|
16
|
+
unit_price: Money;
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as t from 'io-ts';
|
|
2
|
+
import { GenerateType } from './GenerateType';
|
|
3
|
+
export declare const PostPDFInput: t.IntersectionC<[t.TypeC<{
|
|
4
|
+
generate_type: t.UnionC<[t.LiteralC<"job_quote">, t.LiteralC<"public_liability_insurance">]>;
|
|
5
|
+
body: t.StringC;
|
|
6
|
+
}>, t.PartialC<{
|
|
7
|
+
id: t.StringC;
|
|
8
|
+
}>]>;
|
|
9
|
+
export interface PostPDFInput {
|
|
10
|
+
id?: string;
|
|
11
|
+
generate_type: GenerateType;
|
|
12
|
+
body: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as t from 'io-ts';
|
|
2
|
+
import { JobQuote } from './JobQuote';
|
|
3
|
+
import { PublicLiabilityInsurance } from './PublicLiabilityInsurance';
|
|
4
|
+
export declare const PostPDFOutput: t.UnionC<[t.IntersectionC<[t.TypeC<{
|
|
5
|
+
id: t.StringC;
|
|
6
|
+
title: t.StringC;
|
|
7
|
+
items: t.ArrayC<t.IntersectionC<[t.TypeC<{
|
|
8
|
+
unit: t.NumberC;
|
|
9
|
+
unit_price: t.TypeC<{
|
|
10
|
+
pence: t.NumberC;
|
|
11
|
+
currency: t.LiteralC<"GBP">;
|
|
12
|
+
vat: t.StringC;
|
|
13
|
+
}>;
|
|
14
|
+
}>, t.PartialC<{
|
|
15
|
+
summary: t.StringC;
|
|
16
|
+
}>]>>;
|
|
17
|
+
total_price: t.TypeC<{
|
|
18
|
+
pence: t.NumberC;
|
|
19
|
+
currency: t.LiteralC<"GBP">;
|
|
20
|
+
vat: t.StringC;
|
|
21
|
+
}>;
|
|
22
|
+
}>, t.PartialC<{
|
|
23
|
+
description: t.StringC;
|
|
24
|
+
category: t.StringC;
|
|
25
|
+
recipient: t.TypeC<{
|
|
26
|
+
name: t.StringC;
|
|
27
|
+
email: t.StringC;
|
|
28
|
+
mobile: t.StringC;
|
|
29
|
+
address: t.IntersectionC<[t.TypeC<{
|
|
30
|
+
line_1: t.StringC;
|
|
31
|
+
city: t.StringC;
|
|
32
|
+
country: t.StringC;
|
|
33
|
+
}>, t.PartialC<{
|
|
34
|
+
line_2: t.StringC;
|
|
35
|
+
county: t.StringC;
|
|
36
|
+
postcode: t.StringC;
|
|
37
|
+
}>]>;
|
|
38
|
+
}>;
|
|
39
|
+
}>]>, t.IntersectionC<[t.TypeC<{
|
|
40
|
+
id: t.StringC;
|
|
41
|
+
}>, t.PartialC<{
|
|
42
|
+
expiry: import("io-ts-types").DateFromISOStringC;
|
|
43
|
+
}>]>]>;
|
|
44
|
+
export type PostPDFOutput = JobQuote | PublicLiabilityInsurance;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as t from 'io-ts';
|
|
2
|
+
export declare const PublicLiabilityInsurance: t.IntersectionC<[t.TypeC<{
|
|
3
|
+
id: t.StringC;
|
|
4
|
+
}>, t.PartialC<{
|
|
5
|
+
expiry: import("io-ts-types").DateFromISOStringC;
|
|
6
|
+
}>]>;
|
|
7
|
+
export interface PublicLiabilityInsurance {
|
|
8
|
+
id: string;
|
|
9
|
+
expiry?: Date;
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as t from 'io-ts';
|
|
2
|
+
import { Address } from './Address';
|
|
3
|
+
export declare const Recipient: t.TypeC<{
|
|
4
|
+
name: t.StringC;
|
|
5
|
+
email: t.StringC;
|
|
6
|
+
mobile: t.StringC;
|
|
7
|
+
address: t.IntersectionC<[t.TypeC<{
|
|
8
|
+
line_1: t.StringC;
|
|
9
|
+
city: t.StringC;
|
|
10
|
+
country: t.StringC;
|
|
11
|
+
}>, t.PartialC<{
|
|
12
|
+
line_2: t.StringC;
|
|
13
|
+
county: t.StringC;
|
|
14
|
+
postcode: t.StringC;
|
|
15
|
+
}>]>;
|
|
16
|
+
}>;
|
|
17
|
+
export interface Recipient {
|
|
18
|
+
name: string;
|
|
19
|
+
email: string;
|
|
20
|
+
mobile: string;
|
|
21
|
+
address: Address;
|
|
22
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as t from 'io-ts';
|
|
2
|
+
import { Address } from './Address';
|
|
3
|
+
export declare const User: t.IntersectionC<[t.TypeC<{
|
|
4
|
+
id: t.StringC;
|
|
5
|
+
name: t.StringC;
|
|
6
|
+
email: t.StringC;
|
|
7
|
+
phone: t.StringC;
|
|
8
|
+
verified: t.BooleanC;
|
|
9
|
+
is_admin: t.BooleanC;
|
|
10
|
+
suspended: t.BooleanC;
|
|
11
|
+
}>, t.PartialC<{
|
|
12
|
+
address: t.IntersectionC<[t.TypeC<{
|
|
13
|
+
line_1: t.StringC;
|
|
14
|
+
city: t.StringC;
|
|
15
|
+
country: t.StringC;
|
|
16
|
+
}>, t.PartialC<{
|
|
17
|
+
line_2: t.StringC;
|
|
18
|
+
county: t.StringC;
|
|
19
|
+
postcode: t.StringC;
|
|
20
|
+
}>]>;
|
|
21
|
+
token: t.StringC;
|
|
22
|
+
}>]>;
|
|
23
|
+
export interface User {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
email: string;
|
|
27
|
+
phone: string;
|
|
28
|
+
address?: Address;
|
|
29
|
+
token?: string;
|
|
30
|
+
verified: boolean;
|
|
31
|
+
is_admin: boolean;
|
|
32
|
+
suspended: boolean;
|
|
33
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './User';
|
|
2
|
+
export * from './GenerateType';
|
|
3
|
+
export * from './PostPDFInput';
|
|
4
|
+
export * from './PostPDFOutput';
|
|
5
|
+
export * from './PublicLiabilityInsurance';
|
|
6
|
+
export * from './JobQuote';
|
|
7
|
+
export * from './LineItem';
|
|
8
|
+
export * from './Money';
|
|
9
|
+
export * from './Recipient';
|
|
10
|
+
export * from './Address';
|
|
11
|
+
export * from './Error';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { RequestFunction } from '@openapi-io-ts/runtime';
|
|
2
|
+
import * as schemas from '../components/schemas';
|
|
3
|
+
export declare const getMeOperation: {
|
|
4
|
+
readonly path: "/api/me";
|
|
5
|
+
readonly method: "get";
|
|
6
|
+
readonly responses: {
|
|
7
|
+
readonly '200': {
|
|
8
|
+
readonly _tag: "JsonResponse";
|
|
9
|
+
readonly decoder: import("io-ts").IntersectionC<[import("io-ts").TypeC<{
|
|
10
|
+
id: import("io-ts").StringC;
|
|
11
|
+
name: import("io-ts").StringC;
|
|
12
|
+
email: import("io-ts").StringC;
|
|
13
|
+
phone: import("io-ts").StringC;
|
|
14
|
+
verified: import("io-ts").BooleanC;
|
|
15
|
+
is_admin: import("io-ts").BooleanC;
|
|
16
|
+
suspended: import("io-ts").BooleanC;
|
|
17
|
+
}>, import("io-ts").PartialC<{
|
|
18
|
+
address: import("io-ts").IntersectionC<[import("io-ts").TypeC<{
|
|
19
|
+
line_1: import("io-ts").StringC;
|
|
20
|
+
city: import("io-ts").StringC;
|
|
21
|
+
country: import("io-ts").StringC;
|
|
22
|
+
}>, import("io-ts").PartialC<{
|
|
23
|
+
line_2: import("io-ts").StringC;
|
|
24
|
+
county: import("io-ts").StringC;
|
|
25
|
+
postcode: import("io-ts").StringC;
|
|
26
|
+
}>]>;
|
|
27
|
+
token: import("io-ts").StringC;
|
|
28
|
+
}>]>;
|
|
29
|
+
};
|
|
30
|
+
readonly default: {
|
|
31
|
+
readonly _tag: "JsonResponse";
|
|
32
|
+
readonly decoder: import("io-ts").TypeC<{
|
|
33
|
+
code: import("io-ts").NumberC;
|
|
34
|
+
message: import("io-ts").StringC;
|
|
35
|
+
}>;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
readonly parameters: readonly [];
|
|
39
|
+
readonly requestDefaultHeaders: {
|
|
40
|
+
readonly Accept: "application/json";
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export type GetMeRequestFunction = RequestFunction<undefined, schemas.User>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { HttpRequestAdapter } from '@openapi-io-ts/runtime';
|
|
2
|
+
import { GetMeRequestFunction, getMeOperation } from './getMe';
|
|
3
|
+
import { PostPDFRequestFunction, postPDFOperation } from './postPDF';
|
|
4
|
+
export declare const operations: Operations;
|
|
5
|
+
export interface OperationRequestFunctionMap {
|
|
6
|
+
getMe: GetMeRequestFunction;
|
|
7
|
+
postPDF: PostPDFRequestFunction;
|
|
8
|
+
}
|
|
9
|
+
export declare const requestFunctionsBuilder: (requestAdapter: HttpRequestAdapter) => OperationRequestFunctionMap;
|
|
10
|
+
export declare const usersServiceBuilder: (requestFunctions: OperationRequestFunctionMap) => {
|
|
11
|
+
getMe: GetMeRequestFunction;
|
|
12
|
+
};
|
|
13
|
+
export declare const pdfServiceBuilder: (requestFunctions: OperationRequestFunctionMap) => {
|
|
14
|
+
postPDF: PostPDFRequestFunction;
|
|
15
|
+
};
|
|
16
|
+
export interface Operations {
|
|
17
|
+
getMe: typeof getMeOperation;
|
|
18
|
+
postPDF: typeof postPDFOperation;
|
|
19
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { RequestFunction } from '@openapi-io-ts/runtime';
|
|
2
|
+
import * as schemas from '../components/schemas';
|
|
3
|
+
export declare const postPDFOperation: {
|
|
4
|
+
readonly path: "/api/pdf";
|
|
5
|
+
readonly method: "post";
|
|
6
|
+
readonly responses: {
|
|
7
|
+
readonly '200': {
|
|
8
|
+
readonly _tag: "JsonResponse";
|
|
9
|
+
readonly decoder: import("io-ts").UnionC<[import("io-ts").IntersectionC<[import("io-ts").TypeC<{
|
|
10
|
+
id: import("io-ts").StringC;
|
|
11
|
+
title: import("io-ts").StringC;
|
|
12
|
+
items: import("io-ts").ArrayC<import("io-ts").IntersectionC<[import("io-ts").TypeC<{
|
|
13
|
+
unit: import("io-ts").NumberC;
|
|
14
|
+
unit_price: import("io-ts").TypeC<{
|
|
15
|
+
pence: import("io-ts").NumberC;
|
|
16
|
+
currency: import("io-ts").LiteralC<"GBP">;
|
|
17
|
+
vat: import("io-ts").StringC;
|
|
18
|
+
}>;
|
|
19
|
+
}>, import("io-ts").PartialC<{
|
|
20
|
+
summary: import("io-ts").StringC;
|
|
21
|
+
}>]>>;
|
|
22
|
+
total_price: import("io-ts").TypeC<{
|
|
23
|
+
pence: import("io-ts").NumberC;
|
|
24
|
+
currency: import("io-ts").LiteralC<"GBP">;
|
|
25
|
+
vat: import("io-ts").StringC;
|
|
26
|
+
}>;
|
|
27
|
+
}>, import("io-ts").PartialC<{
|
|
28
|
+
description: import("io-ts").StringC;
|
|
29
|
+
category: import("io-ts").StringC;
|
|
30
|
+
recipient: import("io-ts").TypeC<{
|
|
31
|
+
name: import("io-ts").StringC;
|
|
32
|
+
email: import("io-ts").StringC;
|
|
33
|
+
mobile: import("io-ts").StringC;
|
|
34
|
+
address: import("io-ts").IntersectionC<[import("io-ts").TypeC<{
|
|
35
|
+
line_1: import("io-ts").StringC;
|
|
36
|
+
city: import("io-ts").StringC;
|
|
37
|
+
country: import("io-ts").StringC;
|
|
38
|
+
}>, import("io-ts").PartialC<{
|
|
39
|
+
line_2: import("io-ts").StringC;
|
|
40
|
+
county: import("io-ts").StringC;
|
|
41
|
+
postcode: import("io-ts").StringC;
|
|
42
|
+
}>]>;
|
|
43
|
+
}>;
|
|
44
|
+
}>]>, import("io-ts").IntersectionC<[import("io-ts").TypeC<{
|
|
45
|
+
id: import("io-ts").StringC;
|
|
46
|
+
}>, import("io-ts").PartialC<{
|
|
47
|
+
expiry: import("io-ts-types").DateFromISOStringC;
|
|
48
|
+
}>]>]>;
|
|
49
|
+
};
|
|
50
|
+
readonly default: {
|
|
51
|
+
readonly _tag: "JsonResponse";
|
|
52
|
+
readonly decoder: import("io-ts").TypeC<{
|
|
53
|
+
code: import("io-ts").NumberC;
|
|
54
|
+
message: import("io-ts").StringC;
|
|
55
|
+
}>;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
readonly parameters: readonly [];
|
|
59
|
+
readonly requestDefaultHeaders: {
|
|
60
|
+
readonly 'Content-Type': "application/json";
|
|
61
|
+
readonly Accept: "application/json";
|
|
62
|
+
};
|
|
63
|
+
readonly body: {
|
|
64
|
+
readonly _tag: "JsonBody";
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export type PostPDFRequestFunction = RequestFunction<{
|
|
68
|
+
body: schemas.PostPDFInput;
|
|
69
|
+
}, schemas.PostPDFOutput>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const servers: string[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { KandaAuth, TrackingFunctionsBuilder } from './types';
|
|
2
|
+
import { PostPDFRequestFunction } from '../generated/operations/postPDF';
|
|
3
|
+
import { GetMeRequestFunction } from '../generated/operations/getMe';
|
|
4
|
+
/**
|
|
5
|
+
* Interfaces for AI service exported
|
|
6
|
+
*/
|
|
7
|
+
export interface AiService<ServiceRequestFunction> {
|
|
8
|
+
key: string;
|
|
9
|
+
method: (auth?: KandaAuth, tracking?: TrackingFunctionsBuilder) => ServiceRequestFunction;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Interfaces for each specifc AI service exported
|
|
13
|
+
*/
|
|
14
|
+
export interface PDFServices {
|
|
15
|
+
postPDF: AiService<PostPDFRequestFunction>;
|
|
16
|
+
}
|
|
17
|
+
export interface UsersServices {
|
|
18
|
+
getMe: AiService<GetMeRequestFunction>;
|
|
19
|
+
}
|
|
20
|
+
declare const pdf: PDFServices;
|
|
21
|
+
declare const users: UsersServices;
|
|
22
|
+
/**
|
|
23
|
+
* A list of all possible services the frontend can use.
|
|
24
|
+
*/
|
|
25
|
+
declare const services: {
|
|
26
|
+
pdf: PDFServices;
|
|
27
|
+
users: UsersServices;
|
|
28
|
+
};
|
|
29
|
+
export { pdf, users, };
|
|
30
|
+
export default services;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StringIndexedObject } from '../../types';
|
|
2
|
+
export type KandaAuth = {
|
|
3
|
+
intercept?: boolean;
|
|
4
|
+
token?: string;
|
|
5
|
+
additionalHeaders?: StringIndexedObject;
|
|
6
|
+
refreshToken?: () => string;
|
|
7
|
+
};
|
|
8
|
+
export interface AuthenticationHeaders {
|
|
9
|
+
Authorization?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface HttpRequest extends StringIndexedObject {
|
|
12
|
+
headers: StringIndexedObject & AuthenticationHeaders;
|
|
13
|
+
}
|
|
14
|
+
export interface TrackingFunctions {
|
|
15
|
+
attempted?: () => void;
|
|
16
|
+
succeeded?: () => void;
|
|
17
|
+
failed?: () => void;
|
|
18
|
+
}
|
|
19
|
+
export type TrackingFunctionsBuilder = (url?: string, options?: RequestInit) => TrackingFunctions;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { KandaAuth, StringIndexedObject } from '../../../types';
|
|
2
|
+
import { AuthenticationHeaders, HttpRequest, TrackingFunctionsBuilder } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Build the needed authorization headers for API requests
|
|
5
|
+
* @param token
|
|
6
|
+
*/
|
|
7
|
+
export declare const buildAuth: (token: string) => AuthenticationHeaders;
|
|
8
|
+
/**
|
|
9
|
+
* Build the needed headers for API requests, including any needed auth
|
|
10
|
+
* @param init
|
|
11
|
+
* @param token
|
|
12
|
+
*/
|
|
13
|
+
export declare const cleanHeaders: (headers: StringIndexedObject) => StringIndexedObject;
|
|
14
|
+
/**
|
|
15
|
+
* Build the needed headers for API requests, including any needed auth
|
|
16
|
+
* @param init
|
|
17
|
+
* @param token
|
|
18
|
+
*/
|
|
19
|
+
export declare const buildRequestHeaders: (init: RequestInit, token?: string, additionalHeaders?: StringIndexedObject, ...args: any[]) => HttpRequest;
|
|
20
|
+
export declare const originalFetch: () => any;
|
|
21
|
+
export declare const interceptedFetch: (url: string, options: RequestInit, authOptions?: Omit<KandaAuth, 'intercept'>, trackingFunction?: TrackingFunctionsBuilder, ...args: any[]) => Promise<Response>;
|
|
22
|
+
declare const fetchers: {
|
|
23
|
+
base: () => any;
|
|
24
|
+
intercepted: (url: string, options: RequestInit, authOptions?: Omit<KandaAuth, 'intercept'>, trackingFunction?: TrackingFunctionsBuilder, ...args: any[]) => Promise<Response>;
|
|
25
|
+
};
|
|
26
|
+
export default fetchers;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as operations from '../../generated/operations';
|
|
2
|
+
import { KandaAuth, TrackingFunctionsBuilder } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Call fetch, including the baseUrl and attaching headers including authentication
|
|
5
|
+
* @param baseURL
|
|
6
|
+
*/
|
|
7
|
+
export declare const fetchRequestAdapter: (baseURL: string, auth?: KandaAuth, tracking?: TrackingFunctionsBuilder) => (url: string, init: RequestInit) => Promise<Response>;
|
|
8
|
+
/**
|
|
9
|
+
* Build request functions for operations using baseUrl
|
|
10
|
+
* @param baseURL
|
|
11
|
+
* @param token
|
|
12
|
+
*/
|
|
13
|
+
export declare const requestFunctions: (baseURL: string, auth?: KandaAuth, tracking?: TrackingFunctionsBuilder) => operations.OperationRequestFunctionMap;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as aiServices } from '../../service';
|
|
2
|
+
import { RequestFunctionReturnType } from '../types';
|
|
3
|
+
export type AIPdfPostPDFReturn = RequestFunctionReturnType<ReturnType<typeof aiServices.pdf.postPDF.method>>;
|
|
4
|
+
export type AIPdfPostPDFEntity = AIPdfPostPDFReturn[0];
|
|
5
|
+
export type AIPdfPostPDFEntityId = AIPdfPostPDFEntity['id'];
|
|
6
|
+
export type AIPdfPostPDFArgs = AIPdfPostPDFReturn[1];
|
|
7
|
+
declare const aiPdfPostPDFAdapter: import("@reduxjs/toolkit").EntityAdapter<import("index").PostPDFOutput, string>;
|
|
8
|
+
export default aiPdfPostPDFAdapter;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as aiServices } from '../../service';
|
|
2
|
+
import { RequestFunctionReturnType } from '../types';
|
|
3
|
+
export type AIUsersGetMeReturn = RequestFunctionReturnType<ReturnType<typeof aiServices.users.getMe.method>>;
|
|
4
|
+
export type AIUsersGetMeEntity = AIUsersGetMeReturn[0];
|
|
5
|
+
export type AIUsersGetMeEntityId = AIUsersGetMeEntity['id'];
|
|
6
|
+
export type AIUsersGetMeArgs = AIUsersGetMeReturn[1];
|
|
7
|
+
declare const aiUsersGetMeAdapter: import("@reduxjs/toolkit").EntityAdapter<import("index").User, string>;
|
|
8
|
+
export default aiUsersGetMeAdapter;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as aiServices } from '../../service';
|
|
2
|
+
import { RequestFunctionReturnType } from '../types';
|
|
3
|
+
export type AIPdfPostPDFReturn = RequestFunctionReturnType<ReturnType<typeof aiServices.pdf.postPDF.method>>;
|
|
4
|
+
export type AIPdfPostPDFEntity = AIPdfPostPDFReturn[0];
|
|
5
|
+
export type AIPdfPostPDFEntityId = AIPdfPostPDFEntity['id'];
|
|
6
|
+
export type AIPdfPostPDFArgs = AIPdfPostPDFReturn[1];
|
|
7
|
+
export type AIUsersGetMeReturn = RequestFunctionReturnType<ReturnType<typeof aiServices.users.getMe.method>>;
|
|
8
|
+
export type AIUsersGetMeEntity = AIUsersGetMeReturn[0];
|
|
9
|
+
export type AIUsersGetMeEntityId = AIUsersGetMeEntity['id'];
|
|
10
|
+
export type AIUsersGetMeArgs = AIUsersGetMeReturn[1];
|
|
11
|
+
export declare const aiPdfPostPDFAdapter: import("@reduxjs/toolkit").EntityAdapter<import("../../..").PostPDFOutput, string>;
|
|
12
|
+
export declare const aiUsersGetMeAdapter: import("@reduxjs/toolkit").EntityAdapter<import("../../..").User, string>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ApiError, ApiResponse } from '@openapi-io-ts/runtime';
|
|
2
|
+
import { AsyncThunk, EntityAdapter, EntityId, PayloadAction } from '@reduxjs/toolkit';
|
|
3
|
+
import { Either } from 'fp-ts/lib/Either';
|
|
4
|
+
import { StringIndexedObject } from '../../types';
|
|
5
|
+
import { TrackingFunctionsBuilder } from '../service/types';
|
|
6
|
+
import { AiService, AsyncThunkActionArgs, BaseState, DataWithId, ExtractedError, Selectors } from './types';
|
|
7
|
+
export declare const handleApiResponse: <T>(response: Either<ApiError, ApiResponse<T>>) => Promise<T>;
|
|
8
|
+
export declare const extractError: (error: StringIndexedObject | string | undefined) => ExtractedError;
|
|
9
|
+
export declare const createAsyncThunkAction: <Entity extends void | StringIndexedObject, Args extends StringIndexedObject<any>>(service: AiService<Entity, Args>, trackingFunctionsBuilder?: TrackingFunctionsBuilder) => AsyncThunk<Entity, AsyncThunkActionArgs<Args, Entity>, {
|
|
10
|
+
rejectValue: ExtractedError;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const createSuccessHandler: <T extends DataWithId, TId extends EntityId>(entityAdapter: EntityAdapter<T, TId>) => (state: BaseState<T, TId>, action: PayloadAction<T>) => BaseState<T, TId>;
|
|
13
|
+
export declare const createArraySuccessHandler: <T extends DataWithId, TId extends EntityId>(entityAdapter: EntityAdapter<T, TId>) => (state: BaseState<T, TId>, action: PayloadAction<T[]>) => BaseState<T, TId>;
|
|
14
|
+
export declare const createVoidSuccessHandler: <T extends DataWithId, TId extends EntityId>(entityAdapter: EntityAdapter<T, TId>) => (state: BaseState<T, TId>) => BaseState<T, TId>;
|
|
15
|
+
export declare const createErrorHandler: <T, TId extends EntityId>() => (state: BaseState<T, TId>, action: PayloadAction<ExtractedError | undefined>) => {
|
|
16
|
+
error: ExtractedError;
|
|
17
|
+
isSubmitting: boolean;
|
|
18
|
+
latestIds?: EntityId[];
|
|
19
|
+
isLoading: boolean;
|
|
20
|
+
isValidating: boolean;
|
|
21
|
+
ids: TId[];
|
|
22
|
+
entities: Record<TId, T>;
|
|
23
|
+
};
|
|
24
|
+
export declare const generateSelectors: <T, TId extends EntityId, State extends StringIndexedObject<BaseState<T, TId>>>(reducer: keyof State, entityAdapter: EntityAdapter<T, TId>) => Selectors<T, TId, State>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './slices';
|
|
2
|
+
export * as aiActions from './slices/generated/actions';
|
|
3
|
+
export * as aiSlices from './slices/generated/';
|
|
4
|
+
export declare const aiSelectors: {
|
|
5
|
+
aiPdfPostPDF: import("./types").Selectors<import("../..").PostPDFOutput, string, import("../../types").StringIndexedObject<import("./types").BaseState<import("../..").PostPDFOutput, string>>>;
|
|
6
|
+
aiUsersGetMe: import("./types").Selectors<import("../..").User, string, import("../../types").StringIndexedObject<import("./types").BaseState<import("../..").User, string>>>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StringIndexedObject } from '../../../types';
|
|
2
|
+
import { BaseState } from '../types';
|
|
3
|
+
export declare const getSelectors: () => {
|
|
4
|
+
aiPdfPostPDF: import("../types").Selectors<import("../../..").PostPDFOutput, string, StringIndexedObject<BaseState<import("../../..").PostPDFOutput, string>>>;
|
|
5
|
+
aiUsersGetMe: import("../types").Selectors<import("../../..").User, string, StringIndexedObject<BaseState<import("../../..").User, string>>>;
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const reset: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"RESET">;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AIPdfPostPDFEntity, AIPdfPostPDFEntityId } from '../../adapters';
|
|
2
|
+
import { AsyncThunkReturnType, BaseState } from '../../types';
|
|
3
|
+
export declare const aiPdfPostPDF: import("@reduxjs/toolkit").AsyncThunk<import("../../../..").PostPDFOutput, {
|
|
4
|
+
body: import("../../../..").PostPDFInput;
|
|
5
|
+
} & import("../../types").SharedAsyncThunkActionArgs<import("../../../..").PostPDFOutput>, {
|
|
6
|
+
rejectValue: import("../../types").ExtractedError;
|
|
7
|
+
}>;
|
|
8
|
+
export type AIPdfPostPDFThunkReturn = AsyncThunkReturnType<typeof aiPdfPostPDF>;
|
|
9
|
+
export type AIPdfPostPDFThunkArgs = AIPdfPostPDFThunkReturn[1];
|
|
10
|
+
export type AIPdfPostPDFConfig = AIPdfPostPDFThunkReturn[2];
|
|
11
|
+
export type AIPdfPostPDFState = BaseState<AIPdfPostPDFEntity, AIPdfPostPDFEntityId>;
|
|
12
|
+
export declare const aiPdfPostPDFInitialState: AIPdfPostPDFState;
|
|
13
|
+
export declare const aiPdfPostPDFSlice: import("@reduxjs/toolkit").Slice<AIPdfPostPDFState, {
|
|
14
|
+
resetService: () => AIPdfPostPDFState;
|
|
15
|
+
}, "ai.pdf.postPDF", "ai.pdf.postPDF", import("@reduxjs/toolkit").SliceSelectors<AIPdfPostPDFState>>;
|
|
16
|
+
declare const _default: import("@reduxjs/toolkit").Reducer<AIPdfPostPDFState>;
|
|
17
|
+
export default _default;
|