iom-sdk 0.1.2
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 +31 -0
- package/dist/client.d.ts +96 -0
- package/dist/core/http-client.d.ts +32 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/logger.d.ts +17 -0
- package/dist/facade/address-facade.d.ts +62 -0
- package/dist/facade/aggregate-facade.d.ts +59 -0
- package/dist/facade/common-facade.d.ts +33 -0
- package/dist/facade/file-facade.d.ts +84 -0
- package/dist/facade/index.d.ts +6 -0
- package/dist/facade/object-facade.d.ts +19 -0
- package/dist/facade/property-facade.d.ts +39 -0
- package/dist/facade/property-value-facade.d.ts +37 -0
- package/dist/index.d.ts +2064 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/services/address-service.d.ts +87 -0
- package/dist/services/aggregate-service.d.ts +69 -0
- package/dist/services/common-service.d.ts +33 -0
- package/dist/services/file-service.d.ts +84 -0
- package/dist/services/index.d.ts +9 -0
- package/dist/services/object-service.d.ts +50 -0
- package/dist/services/property-service.d.ts +68 -0
- package/dist/services/property-value-service.d.ts +50 -0
- package/dist/services/statement-service.d.ts +175 -0
- package/dist/services/uuid-service.d.ts +97 -0
- package/dist/types/index.d.ts +457 -0
- package/dist/validation/index.d.ts +3 -0
- package/dist/validation/query-params.d.ts +32 -0
- package/dist/validation/schemas.d.ts +1177 -0
- package/dist/validation/validate.d.ts +36 -0
- package/package.json +82 -0
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# IoM SDK
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/iom-sdk)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
A TypeScript SDK for the Internet of Materials (IoM) - A client library for interacting with UUProtocol-based building/material management systems.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install iom-sdk
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The SDK provides both high-level facades and low-level services:
|
|
15
|
+
|
|
16
|
+
### High-Level Facades
|
|
17
|
+
- `client.objects` - Object management with relationships
|
|
18
|
+
- `client.properties` - Property and value management
|
|
19
|
+
- `client.files` - File attachment handling
|
|
20
|
+
- `client.statements` - Relationship management
|
|
21
|
+
|
|
22
|
+
### Low-Level Services
|
|
23
|
+
- `client.services.object` - Direct object API access
|
|
24
|
+
- `client.services.property` - Direct property API access
|
|
25
|
+
- `client.services.file` - Direct file API access
|
|
26
|
+
- And more...
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
MIT
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ClientConfig, UUID, QueryParams, UUObjectDTO, UUPropertyDTO, UUPropertyValueDTO, UUFileDTO, UUStatementDTO, ComplexObjectCreationInput, AggregateFindDTO, AggregateCreateDTO, StatementQueryParams, UUAddressDTO } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Initialize the client with the given configuration
|
|
4
|
+
*
|
|
5
|
+
* @param config - Client configuration including baseUrl and optional certificate
|
|
6
|
+
*/
|
|
7
|
+
export declare const initializeClient: (config: ClientConfig) => void;
|
|
8
|
+
export declare const createClient: (config: ClientConfig) => {
|
|
9
|
+
debug: {
|
|
10
|
+
/**
|
|
11
|
+
* Enable or disable debug mode at runtime
|
|
12
|
+
*/
|
|
13
|
+
configure: (options: ClientConfig["debug"]) => void;
|
|
14
|
+
};
|
|
15
|
+
auth: {
|
|
16
|
+
requestBaseAuth: () => Promise<import("./types").ApiResponse<import("./types").AuthResponse | null>>;
|
|
17
|
+
requestUuidAuth: () => Promise<import("./types").ApiResponse<import("./types").AuthResponse | null>>;
|
|
18
|
+
};
|
|
19
|
+
aggregate: {
|
|
20
|
+
findByUUID: (uuid: UUID) => Promise<import("./types").ApiResponse<import("./types").AggregateEntity[] | null>>;
|
|
21
|
+
getAggregateEntities: (params?: AggregateFindDTO) => Promise<import("./types").ApiResponse<import("./types").PageAggregateEntity>>;
|
|
22
|
+
createAggregateObject: (data: AggregateCreateDTO) => Promise<import("./types").ApiResponse<any>>;
|
|
23
|
+
importAggregateObjects: (data: AggregateCreateDTO) => Promise<import("./types").ApiResponse<any>>;
|
|
24
|
+
};
|
|
25
|
+
objects: {
|
|
26
|
+
create: (object: UUObjectDTO) => Promise<import("./types").ApiResponse<UUObjectDTO>>;
|
|
27
|
+
createFullObject: (objectData: ComplexObjectCreationInput) => Promise<import("./types").ApiResponse<import("./types").ComplexObjectOutput | null>>;
|
|
28
|
+
getObjects: (params?: QueryParams) => Promise<import("./types").ApiResponse<UUObjectDTO[]>>;
|
|
29
|
+
delete: (uuid: UUID) => Promise<import("./types").ApiResponse<any>>;
|
|
30
|
+
};
|
|
31
|
+
properties: {
|
|
32
|
+
addToObject: (objectUuid: UUID, property: Partial<UUPropertyDTO> & {
|
|
33
|
+
key: string;
|
|
34
|
+
}) => Promise<import("./types").ApiResponse<UUPropertyDTO>>;
|
|
35
|
+
create: (property: UUPropertyDTO) => Promise<import("./types").ApiResponse<UUPropertyDTO>>;
|
|
36
|
+
getProperties: (params?: QueryParams) => Promise<import("./types").ApiResponse<UUPropertyDTO[]>>;
|
|
37
|
+
getPropertyByKey: (key: string, params?: QueryParams) => Promise<import("./types").ApiResponse<UUPropertyDTO | null>>;
|
|
38
|
+
delete: (uuid: UUID) => Promise<import("./types").ApiResponse<any>>;
|
|
39
|
+
};
|
|
40
|
+
values: {
|
|
41
|
+
setForProperty: (propertyUuid: UUID, value: Partial<UUPropertyValueDTO>) => Promise<import("./types").ApiResponse<UUPropertyValueDTO>>;
|
|
42
|
+
create: (value: UUPropertyValueDTO) => Promise<import("./types").ApiResponse<UUPropertyValueDTO>>;
|
|
43
|
+
getPropertyValues: (params?: QueryParams) => Promise<import("./types").ApiResponse<UUPropertyValueDTO[]>>;
|
|
44
|
+
delete: (uuid: UUID) => Promise<import("./types").ApiResponse<any>>;
|
|
45
|
+
};
|
|
46
|
+
files: {
|
|
47
|
+
create: (file: UUFileDTO) => Promise<import("./types").ApiResponse<UUFileDTO>>;
|
|
48
|
+
getFiles: (params?: QueryParams) => Promise<import("./types").ApiResponse<UUFileDTO[]>>;
|
|
49
|
+
delete: (uuid: UUID) => Promise<import("./types").ApiResponse<any>>;
|
|
50
|
+
uploadByReference: (input: {
|
|
51
|
+
fileReference: string;
|
|
52
|
+
uuidToAttach: UUID;
|
|
53
|
+
label?: string;
|
|
54
|
+
}) => Promise<import("./types").ApiResponse<UUFileDTO | null>>;
|
|
55
|
+
uploadDirect: (input: {
|
|
56
|
+
file: File | Blob | ArrayBuffer | FormData;
|
|
57
|
+
uuidToAttach: UUID;
|
|
58
|
+
}) => Promise<import("./types").ApiResponse<UUFileDTO | null>>;
|
|
59
|
+
uploadFormData: (input: {
|
|
60
|
+
formData: FormData;
|
|
61
|
+
uuidFile: UUID;
|
|
62
|
+
uuidToAttach: UUID;
|
|
63
|
+
}) => Promise<import("./types").ApiResponse<any>>;
|
|
64
|
+
download: (uuid: UUID) => Promise<import("./types").ApiResponse<ArrayBuffer>>;
|
|
65
|
+
};
|
|
66
|
+
statements: {
|
|
67
|
+
getStatements: (params?: StatementQueryParams) => Promise<import("./types").ApiResponse<UUStatementDTO[]>>;
|
|
68
|
+
create: (statement: UUStatementDTO) => Promise<import("./types").ApiResponse<UUStatementDTO>>;
|
|
69
|
+
delete: (statement: UUStatementDTO) => Promise<import("./types").ApiResponse<any>>;
|
|
70
|
+
};
|
|
71
|
+
uuid: {
|
|
72
|
+
create: () => Promise<import("./types").ApiResponse<{
|
|
73
|
+
uuid: UUID;
|
|
74
|
+
}>>;
|
|
75
|
+
getOwned: () => Promise<import("./types").ApiResponse<any>>;
|
|
76
|
+
getRecord: (uuid: UUID) => Promise<import("./types").ApiResponse<any>>;
|
|
77
|
+
updateRecordMeta: (params: {
|
|
78
|
+
uuid?: UUID;
|
|
79
|
+
nodeType: string;
|
|
80
|
+
}) => Promise<import("./types").ApiResponse<any>>;
|
|
81
|
+
authorize: (params: {
|
|
82
|
+
userUUID: UUID;
|
|
83
|
+
resourceId: UUID;
|
|
84
|
+
}) => Promise<import("./types").ApiResponse<any>>;
|
|
85
|
+
};
|
|
86
|
+
addresses: {
|
|
87
|
+
create: (address: Omit<UUAddressDTO, "uuid">) => Promise<import("./types").ApiResponse<UUAddressDTO>>;
|
|
88
|
+
update: (address: UUAddressDTO) => Promise<import("./types").ApiResponse<UUAddressDTO>>;
|
|
89
|
+
get: (params?: QueryParams) => Promise<import("./types").ApiResponse<UUAddressDTO[]>>;
|
|
90
|
+
delete: (uuid: UUID) => Promise<import("./types").ApiResponse<any>>;
|
|
91
|
+
createForObject: (objectUuid: UUID, address: Omit<UUAddressDTO, "uuid">) => Promise<import("./types").ApiResponse<{
|
|
92
|
+
address: UUAddressDTO;
|
|
93
|
+
statement: any;
|
|
94
|
+
}>>;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { ApiResponse, ClientConfig } from '@/types';
|
|
3
|
+
/**
|
|
4
|
+
* Create a HTTP client for making API requests to the IoM backend
|
|
5
|
+
*
|
|
6
|
+
* @param config - Configuration for the client
|
|
7
|
+
* @returns An object with methods for making HTTP requests
|
|
8
|
+
*/
|
|
9
|
+
export declare const createHttpClient: (config: ClientConfig) => {
|
|
10
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
11
|
+
getBinary: <T = ArrayBuffer>(url: string) => Promise<ApiResponse<T>>;
|
|
12
|
+
post: <T>(url: string, data?: any, config?: AxiosRequestConfig) => Promise<ApiResponse<T>>;
|
|
13
|
+
postForm: <T>(url: string, formData: any) => Promise<ApiResponse<T>>;
|
|
14
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
15
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
16
|
+
config: ClientConfig;
|
|
17
|
+
};
|
|
18
|
+
export declare let httpClient: {
|
|
19
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
20
|
+
getBinary: <T = ArrayBuffer>(url: string) => Promise<ApiResponse<T>>;
|
|
21
|
+
post: <T>(url: string, data?: any, config?: AxiosRequestConfig) => Promise<ApiResponse<T>>;
|
|
22
|
+
postForm: <T>(url: string, formData: any) => Promise<ApiResponse<T>>;
|
|
23
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
24
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
25
|
+
config: ClientConfig;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Set the global default HTTP client
|
|
29
|
+
*
|
|
30
|
+
* @param config - The client configuration
|
|
31
|
+
*/
|
|
32
|
+
export declare const setHttpClient: (config: ClientConfig) => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ClientConfig } from '@/types';
|
|
2
|
+
/**
|
|
3
|
+
* Configure the logger with the provided debug options
|
|
4
|
+
*/
|
|
5
|
+
export declare const configureLogger: (config?: ClientConfig["debug"]) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Log a message if debug is enabled
|
|
8
|
+
*/
|
|
9
|
+
export declare const log: (level: "error" | "info", message: string, data?: any) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Log request/response information
|
|
12
|
+
*/
|
|
13
|
+
export declare const logHttp: (method: string, url: string, status?: number, data?: any) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Log error information
|
|
16
|
+
*/
|
|
17
|
+
export declare const logError: (operation: string, error: any) => void;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ApiResponse, UUAddressDTO, UUStatementDTO, UUID } from '@/types';
|
|
2
|
+
/**
|
|
3
|
+
* Create an address and establish relationship with an object
|
|
4
|
+
*
|
|
5
|
+
* @param client - HTTP client instance
|
|
6
|
+
* @param objectUuid - UUID of the object to associate the address with
|
|
7
|
+
* @param addressData - Address data (without UUID, will be generated)
|
|
8
|
+
* @returns The created address with its relationship statement
|
|
9
|
+
*/
|
|
10
|
+
export declare const createAddressForObject: (client?: {
|
|
11
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
12
|
+
post: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
13
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
14
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
15
|
+
config: import("@/types").IOBClientConfig;
|
|
16
|
+
}) => (objectUuid: UUID, addressData: Omit<UUAddressDTO, "uuid">) => Promise<ApiResponse<{
|
|
17
|
+
address: UUAddressDTO;
|
|
18
|
+
statement: UUStatementDTO;
|
|
19
|
+
}>>;
|
|
20
|
+
/**
|
|
21
|
+
* Get address for an object by finding the HAS_ADDRESS relationship
|
|
22
|
+
*
|
|
23
|
+
* @param client - HTTP client instance
|
|
24
|
+
* @param objectUuid - UUID of the object
|
|
25
|
+
* @returns The address associated with the object, or null if none found
|
|
26
|
+
*/
|
|
27
|
+
export declare const getAddressForObject: (client?: {
|
|
28
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
29
|
+
post: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
30
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
31
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
32
|
+
config: import("@/types").IOBClientConfig;
|
|
33
|
+
}) => (objectUuid: UUID) => Promise<ApiResponse<UUAddressDTO | null>>;
|
|
34
|
+
/**
|
|
35
|
+
* Update address for an object
|
|
36
|
+
*
|
|
37
|
+
* @param client - HTTP client instance
|
|
38
|
+
* @param objectUuid - UUID of the object
|
|
39
|
+
* @param addressData - Updated address data
|
|
40
|
+
* @returns The updated address
|
|
41
|
+
*/
|
|
42
|
+
export declare const updateAddressForObject: (client?: {
|
|
43
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
44
|
+
post: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
45
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
46
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
47
|
+
config: import("@/types").IOBClientConfig;
|
|
48
|
+
}) => (objectUuid: UUID, addressData: Partial<UUAddressDTO>) => Promise<ApiResponse<UUAddressDTO | null>>;
|
|
49
|
+
/**
|
|
50
|
+
* Remove address from an object
|
|
51
|
+
*
|
|
52
|
+
* @param client - HTTP client instance
|
|
53
|
+
* @param objectUuid - UUID of the object
|
|
54
|
+
* @returns Response indicating success or failure
|
|
55
|
+
*/
|
|
56
|
+
export declare const removeAddressFromObject: (client?: {
|
|
57
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
58
|
+
post: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
59
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
60
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
61
|
+
config: import("@/types").IOBClientConfig;
|
|
62
|
+
}) => (objectUuid: UUID) => Promise<ApiResponse<any>>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ApiResponse, AggregateFindDTO, AggregateEntity, PageAggregateEntity, UUID } from '@/types';
|
|
2
|
+
/**
|
|
3
|
+
* Search for any entity by UUID using the aggregate API
|
|
4
|
+
* This provides rich aggregated data including relationships, properties, and files
|
|
5
|
+
*
|
|
6
|
+
* @param client - HTTP client instance
|
|
7
|
+
* @param params - Search parameters including pagination and filters
|
|
8
|
+
* @returns The aggregate entity with all related data if found
|
|
9
|
+
*/
|
|
10
|
+
export declare const findByUUID: (client?: {
|
|
11
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
12
|
+
getBinary: <T = ArrayBuffer>(url: string) => Promise<ApiResponse<T>>;
|
|
13
|
+
post: <T>(url: string, data?: any, config?: import("axios").AxiosRequestConfig) => Promise<ApiResponse<T>>;
|
|
14
|
+
postForm: <T>(url: string, formData: any) => Promise<ApiResponse<T>>;
|
|
15
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
16
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
17
|
+
config: import("@/types").ClientConfig;
|
|
18
|
+
}) => (uuid: UUID) => Promise<ApiResponse<AggregateEntity[] | null>>;
|
|
19
|
+
/**
|
|
20
|
+
* Search aggregate entities with pagination and filtering
|
|
21
|
+
*
|
|
22
|
+
* @param client - HTTP client instance
|
|
23
|
+
* @param params - Search parameters including pagination and filters
|
|
24
|
+
* @returns Paginated list of aggregate entities
|
|
25
|
+
*/
|
|
26
|
+
export declare const getAggregateEntities: (client?: {
|
|
27
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
28
|
+
getBinary: <T = ArrayBuffer>(url: string) => Promise<ApiResponse<T>>;
|
|
29
|
+
post: <T>(url: string, data?: any, config?: import("axios").AxiosRequestConfig) => Promise<ApiResponse<T>>;
|
|
30
|
+
postForm: <T>(url: string, formData: any) => Promise<ApiResponse<T>>;
|
|
31
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
32
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
33
|
+
config: import("@/types").ClientConfig;
|
|
34
|
+
}) => (params?: AggregateFindDTO) => Promise<ApiResponse<PageAggregateEntity>>;
|
|
35
|
+
export declare const createAggregateObject: (client?: {
|
|
36
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
37
|
+
getBinary: <T = ArrayBuffer>(url: string) => Promise<ApiResponse<T>>;
|
|
38
|
+
post: <T>(url: string, data?: any, config?: import("axios").AxiosRequestConfig) => Promise<ApiResponse<T>>;
|
|
39
|
+
postForm: <T>(url: string, formData: any) => Promise<ApiResponse<T>>;
|
|
40
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
41
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
42
|
+
config: import("@/types").ClientConfig;
|
|
43
|
+
}) => (data: any) => Promise<ApiResponse<any | null>>;
|
|
44
|
+
/**
|
|
45
|
+
* Import multiple aggregate objects
|
|
46
|
+
*
|
|
47
|
+
* @param client - HTTP client instance
|
|
48
|
+
* @param data - Aggregate creation data with user context
|
|
49
|
+
* @returns Import response
|
|
50
|
+
*/
|
|
51
|
+
export declare const importAggregateObjects: (client?: {
|
|
52
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
53
|
+
getBinary: <T = ArrayBuffer>(url: string) => Promise<ApiResponse<T>>;
|
|
54
|
+
post: <T>(url: string, data?: any, config?: import("axios").AxiosRequestConfig) => Promise<ApiResponse<T>>;
|
|
55
|
+
postForm: <T>(url: string, formData: any) => Promise<ApiResponse<T>>;
|
|
56
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
57
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
58
|
+
config: import("@/types").ClientConfig;
|
|
59
|
+
}) => (data: any) => Promise<ApiResponse<any | null>>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ApiResponse, AuthResponse } from '@/types';
|
|
2
|
+
/**
|
|
3
|
+
* Authenticate with the base service using client certificate (mTLS)
|
|
4
|
+
* This will trigger the browser certificate selection popup
|
|
5
|
+
*
|
|
6
|
+
* @param client - HTTP client instance
|
|
7
|
+
* @returns Base service authentication data
|
|
8
|
+
*/
|
|
9
|
+
export declare const requestBaseAuth: (client?: {
|
|
10
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
11
|
+
getBinary: <T = ArrayBuffer>(url: string) => Promise<ApiResponse<T>>;
|
|
12
|
+
post: <T>(url: string, data?: any, config?: import("axios").AxiosRequestConfig) => Promise<ApiResponse<T>>;
|
|
13
|
+
postForm: <T>(url: string, formData: any) => Promise<ApiResponse<T>>;
|
|
14
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
15
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
16
|
+
config: import("@/types").ClientConfig;
|
|
17
|
+
}) => () => Promise<ApiResponse<AuthResponse | null>>;
|
|
18
|
+
/**
|
|
19
|
+
* Authenticate with the UUID service using client certificate (mTLS)
|
|
20
|
+
* This will trigger the browser certificate selection popup
|
|
21
|
+
*
|
|
22
|
+
* @param client - HTTP client instance
|
|
23
|
+
* @returns UUID service authentication data
|
|
24
|
+
*/
|
|
25
|
+
export declare const requestUuidAuth: (client?: {
|
|
26
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
27
|
+
getBinary: <T = ArrayBuffer>(url: string) => Promise<ApiResponse<T>>;
|
|
28
|
+
post: <T>(url: string, data?: any, config?: import("axios").AxiosRequestConfig) => Promise<ApiResponse<T>>;
|
|
29
|
+
postForm: <T>(url: string, formData: any) => Promise<ApiResponse<T>>;
|
|
30
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
31
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
32
|
+
config: import("@/types").ClientConfig;
|
|
33
|
+
}) => () => Promise<ApiResponse<AuthResponse | null>>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ApiResponse, UUFileDTO, UUID } from '@/types';
|
|
2
|
+
/**
|
|
3
|
+
* Upload a file by external URL reference
|
|
4
|
+
*
|
|
5
|
+
* This creates a UUFile record with a provided URL in `fileReference` and links it to a parent object.
|
|
6
|
+
* Always creates a new UUID first, then creates the file record and statement.
|
|
7
|
+
*
|
|
8
|
+
* @param client - HTTP client instance
|
|
9
|
+
* @param input - File reference input with required fileReference and uuidToAttach
|
|
10
|
+
* @returns The created file record
|
|
11
|
+
*/
|
|
12
|
+
export declare const uploadByReference: (client?: {
|
|
13
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
14
|
+
getBinary: <T = ArrayBuffer>(url: string) => Promise<ApiResponse<T>>;
|
|
15
|
+
post: <T>(url: string, data?: any, config?: import("axios").AxiosRequestConfig) => Promise<ApiResponse<T>>;
|
|
16
|
+
postForm: <T>(url: string, formData: any) => Promise<ApiResponse<T>>;
|
|
17
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
18
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
19
|
+
config: import("@/types").ClientConfig;
|
|
20
|
+
}) => (input: {
|
|
21
|
+
fileReference: string;
|
|
22
|
+
uuidToAttach: UUID;
|
|
23
|
+
label?: string;
|
|
24
|
+
}) => Promise<ApiResponse<UUFileDTO | null>>;
|
|
25
|
+
/**
|
|
26
|
+
* Upload a file's binary content directly
|
|
27
|
+
*
|
|
28
|
+
* Complete flow for direct binary upload:
|
|
29
|
+
* 1) Create UUID for the file
|
|
30
|
+
* 2) Create UUFile record with fileName
|
|
31
|
+
* 3) POST the binary to /api/UUFile/upload with uuidFile and uuidToAttach
|
|
32
|
+
* 4) Create statement to link file to parent object
|
|
33
|
+
*
|
|
34
|
+
* @param client - HTTP client instance
|
|
35
|
+
* @param input - File upload input
|
|
36
|
+
* @returns The created file record
|
|
37
|
+
*/
|
|
38
|
+
export declare const uploadDirect: (client?: {
|
|
39
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
40
|
+
getBinary: <T = ArrayBuffer>(url: string) => Promise<ApiResponse<T>>;
|
|
41
|
+
post: <T>(url: string, data?: any, config?: import("axios").AxiosRequestConfig) => Promise<ApiResponse<T>>;
|
|
42
|
+
postForm: <T>(url: string, formData: any) => Promise<ApiResponse<T>>;
|
|
43
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
44
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
45
|
+
config: import("@/types").ClientConfig;
|
|
46
|
+
}) => (input: {
|
|
47
|
+
file: File | Blob | ArrayBuffer | FormData;
|
|
48
|
+
uuidToAttach: UUID;
|
|
49
|
+
}) => Promise<ApiResponse<UUFileDTO | null>>;
|
|
50
|
+
/**
|
|
51
|
+
* Upload using pre-constructed FormData from UI
|
|
52
|
+
*
|
|
53
|
+
* For cases where the UI has already constructed FormData with additional fields.
|
|
54
|
+
* This method bypasses the internal FormData construction and uses the provided FormData directly.
|
|
55
|
+
*
|
|
56
|
+
* @param client - HTTP client instance
|
|
57
|
+
* @param input - Upload input with pre-constructed FormData
|
|
58
|
+
* @returns Upload response
|
|
59
|
+
*/
|
|
60
|
+
export declare const uploadFormData: (client?: {
|
|
61
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
62
|
+
getBinary: <T = ArrayBuffer>(url: string) => Promise<ApiResponse<T>>;
|
|
63
|
+
post: <T>(url: string, data?: any, config?: import("axios").AxiosRequestConfig) => Promise<ApiResponse<T>>;
|
|
64
|
+
postForm: <T>(url: string, formData: any) => Promise<ApiResponse<T>>;
|
|
65
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
66
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
67
|
+
config: import("@/types").ClientConfig;
|
|
68
|
+
}) => (input: {
|
|
69
|
+
formData: FormData;
|
|
70
|
+
uuidFile: UUID;
|
|
71
|
+
uuidToAttach: UUID;
|
|
72
|
+
}) => Promise<ApiResponse<any>>;
|
|
73
|
+
/**
|
|
74
|
+
* Download file binary via UUID
|
|
75
|
+
*/
|
|
76
|
+
export declare const download: (client?: {
|
|
77
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
78
|
+
getBinary: <T = ArrayBuffer>(url: string) => Promise<ApiResponse<T>>;
|
|
79
|
+
post: <T>(url: string, data?: any, config?: import("axios").AxiosRequestConfig) => Promise<ApiResponse<T>>;
|
|
80
|
+
postForm: <T>(url: string, formData: any) => Promise<ApiResponse<T>>;
|
|
81
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
82
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
83
|
+
config: import("@/types").ClientConfig;
|
|
84
|
+
}) => (uuid: UUID) => Promise<ApiResponse<ArrayBuffer>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ApiResponse, ComplexObjectCreationInput, ComplexObjectOutput } from '@/types';
|
|
2
|
+
/**
|
|
3
|
+
* Create a complex object with multiple properties, multiple values per property,
|
|
4
|
+
* and files attached to the object, properties, and values.
|
|
5
|
+
* This high-level operation handles creating the complete object hierarchy in a single function call.
|
|
6
|
+
*
|
|
7
|
+
* @param client - HTTP client instance
|
|
8
|
+
* @param objectData - The complex object data including properties, values, files, and optional parents
|
|
9
|
+
* @returns The created complex object with all its relationships
|
|
10
|
+
*/
|
|
11
|
+
export declare const createFullObject: (client?: {
|
|
12
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
13
|
+
getBinary: <T = ArrayBuffer>(url: string) => Promise<ApiResponse<T>>;
|
|
14
|
+
post: <T>(url: string, data?: any, config?: import("axios").AxiosRequestConfig) => Promise<ApiResponse<T>>;
|
|
15
|
+
postForm: <T>(url: string, formData: any) => Promise<ApiResponse<T>>;
|
|
16
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
17
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
18
|
+
config: import("@/types").ClientConfig;
|
|
19
|
+
}) => (objectData: ComplexObjectCreationInput) => Promise<ApiResponse<ComplexObjectOutput | null>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ApiResponse, UUPropertyDTO, UUID, QueryParams } from '@/types';
|
|
2
|
+
/**
|
|
3
|
+
* Add a property to an object
|
|
4
|
+
* This high-level operation automatically gets a UUID, creates the property,
|
|
5
|
+
* and establishes the relationship with the object
|
|
6
|
+
*
|
|
7
|
+
* @param client - HTTP client instance
|
|
8
|
+
* @param objectUuid - UUID of the object to add the property to
|
|
9
|
+
* @param property - Property data (UUID will be generated if not provided)
|
|
10
|
+
* @returns The created property
|
|
11
|
+
*/
|
|
12
|
+
export declare const addPropertyToObject: (client?: {
|
|
13
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
14
|
+
getBinary: <T = ArrayBuffer>(url: string) => Promise<ApiResponse<T>>;
|
|
15
|
+
post: <T>(url: string, data?: any, config?: import("axios").AxiosRequestConfig) => Promise<ApiResponse<T>>;
|
|
16
|
+
postForm: <T>(url: string, formData: any) => Promise<ApiResponse<T>>;
|
|
17
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
18
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
19
|
+
config: import("@/types").ClientConfig;
|
|
20
|
+
}) => (objectUuid: UUID, property: Partial<UUPropertyDTO> & {
|
|
21
|
+
key: string;
|
|
22
|
+
}) => Promise<ApiResponse<UUPropertyDTO>>;
|
|
23
|
+
/**
|
|
24
|
+
* Get all properties for an object
|
|
25
|
+
*
|
|
26
|
+
* @param client - HTTP client instance
|
|
27
|
+
* @param objectUuid - UUID of the object to get properties for
|
|
28
|
+
* @param params - Query parameters
|
|
29
|
+
* @returns List of properties for the object
|
|
30
|
+
*/
|
|
31
|
+
export declare const getPropertiesForObject: (client?: {
|
|
32
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
33
|
+
getBinary: <T = ArrayBuffer>(url: string) => Promise<ApiResponse<T>>;
|
|
34
|
+
post: <T>(url: string, data?: any, config?: import("axios").AxiosRequestConfig) => Promise<ApiResponse<T>>;
|
|
35
|
+
postForm: <T>(url: string, formData: any) => Promise<ApiResponse<T>>;
|
|
36
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
37
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
38
|
+
config: import("@/types").ClientConfig;
|
|
39
|
+
}) => (objectUuid: UUID, params?: QueryParams) => Promise<ApiResponse<UUPropertyDTO[]>>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ApiResponse, UUPropertyValueDTO, UUID, QueryParams } from '@/types';
|
|
2
|
+
/**
|
|
3
|
+
* Set a value for a property
|
|
4
|
+
* This high-level operation automatically gets a UUID, creates the value,
|
|
5
|
+
* and establishes the relationship with the property
|
|
6
|
+
*
|
|
7
|
+
* @param client - HTTP client instance
|
|
8
|
+
* @param propertyUuid - UUID of the property to set the value for
|
|
9
|
+
* @param value - Value data (UUID will be generated if not provided)
|
|
10
|
+
* @returns The created property value
|
|
11
|
+
*/
|
|
12
|
+
export declare const setValueForProperty: (client?: {
|
|
13
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
14
|
+
getBinary: <T = ArrayBuffer>(url: string) => Promise<ApiResponse<T>>;
|
|
15
|
+
post: <T>(url: string, data?: any, config?: import("axios").AxiosRequestConfig) => Promise<ApiResponse<T>>;
|
|
16
|
+
postForm: <T>(url: string, formData: any) => Promise<ApiResponse<T>>;
|
|
17
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
18
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
19
|
+
config: import("@/types").ClientConfig;
|
|
20
|
+
}) => (propertyUuid: UUID, value: Partial<UUPropertyValueDTO>) => Promise<ApiResponse<UUPropertyValueDTO>>;
|
|
21
|
+
/**
|
|
22
|
+
* Get all values for a property
|
|
23
|
+
*
|
|
24
|
+
* @param client - HTTP client instance
|
|
25
|
+
* @param propertyUuid - UUID of the property to get values for
|
|
26
|
+
* @param params - Query parameters
|
|
27
|
+
* @returns List of values for the property
|
|
28
|
+
*/
|
|
29
|
+
export declare const getValuesForProperty: (client?: {
|
|
30
|
+
get: <T>(url: string, params?: Record<string, any>) => Promise<ApiResponse<T>>;
|
|
31
|
+
getBinary: <T = ArrayBuffer>(url: string) => Promise<ApiResponse<T>>;
|
|
32
|
+
post: <T>(url: string, data?: any, config?: import("axios").AxiosRequestConfig) => Promise<ApiResponse<T>>;
|
|
33
|
+
postForm: <T>(url: string, formData: any) => Promise<ApiResponse<T>>;
|
|
34
|
+
put: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
35
|
+
delete: <T>(url: string, data?: any) => Promise<ApiResponse<T>>;
|
|
36
|
+
config: import("@/types").ClientConfig;
|
|
37
|
+
}) => (propertyUuid: UUID, params?: QueryParams) => Promise<ApiResponse<UUPropertyValueDTO[]>>;
|