@edraj/tsdmart 5.3.0 → 5.3.3
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/CHANGELOG.md +15 -0
- package/dist/dmart.model.d.ts +388 -0
- package/dist/dmart.model.d.ts.map +1 -0
- package/dist/dmart.model.js +140 -0
- package/dist/dmart.model.js.map +1 -0
- package/dist/dmart.service.d.ts +248 -0
- package/dist/dmart.service.d.ts.map +1 -0
- package/{dmart.service.ts → dist/dmart.service.js} +91 -298
- package/dist/dmart.service.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/{index.ts → dist/index.js} +1 -1
- package/dist/index.js.map +1 -0
- package/package.json +32 -4
- package/a +0 -2
- package/dmart.model.ts +0 -442
- package/test.ts +0 -70
- package/tsconfig.json +0 -45
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import type { AxiosInstance } from "axios";
|
|
2
|
+
import { DmartScope } from "./dmart.model";
|
|
3
|
+
import type { ActionRequest, ActionRequestRecord, ActionResponse, ApiQueryResponse, ApiResponse, ConfirmOTPRequest, FetchDataAssetRequest, GetAttachmentURLRequest, GetChildrenRequest, GetPayloadRequest, LoginResponse, PasswordResetRequest, ProfileResponse, ProgressTicketRequest, QueryRequest, ResourcesFromCSVRequest, ResponseEntry, RetrieveEntryRequest, SendOTPRequest, SubmitRequest, UploadWithPayloadRequest } from "./dmart.model";
|
|
4
|
+
export declare class Dmart {
|
|
5
|
+
static axiosDmartInstance: AxiosInstance;
|
|
6
|
+
/**
|
|
7
|
+
* Sets the Axios instance to be used for all HTTP requests
|
|
8
|
+
* @param axiosInstance - The Axios instance to use for API calls
|
|
9
|
+
*/
|
|
10
|
+
static setAxiosInstance(axiosInstance: AxiosInstance): void;
|
|
11
|
+
/**
|
|
12
|
+
* Gets the current Axios instance
|
|
13
|
+
* @returns The configured Axios instance
|
|
14
|
+
* @throws Error if no Axios instance has been set
|
|
15
|
+
*/
|
|
16
|
+
static getAxiosInstance(): AxiosInstance;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the current headers object used for API requests
|
|
19
|
+
* @returns The headers object containing request headers
|
|
20
|
+
*/
|
|
21
|
+
static getHeaders(): {
|
|
22
|
+
[key: string]: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Updates the headers object with new headers
|
|
26
|
+
* @param newHeaders - Object containing headers to merge with existing headers
|
|
27
|
+
*/
|
|
28
|
+
static setHeaders(newHeaders: Record<string, string>): void;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the base URL from the Axios instance
|
|
31
|
+
* @returns The base URL string
|
|
32
|
+
* @throws Error if no Axios instance has been set
|
|
33
|
+
*/
|
|
34
|
+
static getBaseURL(): string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Sets the base URL for the Axios instance
|
|
37
|
+
* @param url - The base URL to set
|
|
38
|
+
*/
|
|
39
|
+
static setBaseURL(url: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Gets the current authentication token
|
|
42
|
+
* @returns The token string without the "Bearer " prefix, or null if not set
|
|
43
|
+
*/
|
|
44
|
+
static getToken(): string | null;
|
|
45
|
+
/**
|
|
46
|
+
* Sets the authentication token in the headers
|
|
47
|
+
* @param token - The JWT token to use for authentication
|
|
48
|
+
*/
|
|
49
|
+
static setToken(token: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Authenticates a user with shortname and password
|
|
52
|
+
* @param shortname - The user's shortname (username)
|
|
53
|
+
* @param password - The user's password
|
|
54
|
+
* @returns Promise resolving to LoginResponse containing authentication data and access token
|
|
55
|
+
*/
|
|
56
|
+
static login(shortname: string, password: string): Promise<LoginResponse>;
|
|
57
|
+
/**
|
|
58
|
+
* Authenticates a user with custom credentials and password
|
|
59
|
+
* @param credentials - Object containing login credentials (e.g., email, phone, etc.)
|
|
60
|
+
* @param password - The user's password
|
|
61
|
+
* @returns Promise resolving to LoginResponse containing authentication data and access token
|
|
62
|
+
*/
|
|
63
|
+
static loginBy(credentials: Record<string, string>, password: string): Promise<LoginResponse>;
|
|
64
|
+
/**
|
|
65
|
+
* Logs out the current user session
|
|
66
|
+
* @returns Promise resolving to ApiResponse indicating logout status
|
|
67
|
+
*/
|
|
68
|
+
static logout(): Promise<ApiResponse>;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a new user account
|
|
71
|
+
* @param request - ActionRequestRecord containing user creation data
|
|
72
|
+
* @returns Promise resolving to ActionResponse with creation result
|
|
73
|
+
*/
|
|
74
|
+
static createUser(request: ActionRequestRecord): Promise<ActionResponse>;
|
|
75
|
+
/**
|
|
76
|
+
* Updates an existing user's profile information
|
|
77
|
+
* @param request - ActionRequestRecord containing user update data
|
|
78
|
+
* @returns Promise resolving to ActionResponse with update result
|
|
79
|
+
*/
|
|
80
|
+
static updateUser(request: ActionRequestRecord): Promise<ActionResponse>;
|
|
81
|
+
/**
|
|
82
|
+
* Checks if a user property value already exists in the system
|
|
83
|
+
* @param prop - The property name to check (e.g., 'email', 'shortname')
|
|
84
|
+
* @param value - The value to check for existence
|
|
85
|
+
* @returns Promise resolving to ResponseEntry indicating if the value exists
|
|
86
|
+
*/
|
|
87
|
+
static checkExisting(prop: string, value: string): Promise<ResponseEntry>;
|
|
88
|
+
/**
|
|
89
|
+
* Retrieves the current user's profile information
|
|
90
|
+
* @returns Promise resolving to ProfileResponse containing user profile data, permissions, and roles
|
|
91
|
+
*/
|
|
92
|
+
static getProfile(): Promise<ProfileResponse>;
|
|
93
|
+
/**
|
|
94
|
+
* Executes a query against the Dmart API to retrieve data
|
|
95
|
+
* @param query - QueryRequest object containing query parameters, filters, and sorting options
|
|
96
|
+
* @param scope - The scope for the query (default: DmartScope.managed)
|
|
97
|
+
* @returns Promise resolving to ApiQueryResponse with query results or null
|
|
98
|
+
*/
|
|
99
|
+
static query(query: QueryRequest, scope?: DmartScope): Promise<ApiQueryResponse | null>;
|
|
100
|
+
/**
|
|
101
|
+
* Exports query results as CSV format
|
|
102
|
+
* @param query - Query object with parameters for CSV export
|
|
103
|
+
* @returns Promise resolving to ApiQueryResponse containing CSV data
|
|
104
|
+
*/
|
|
105
|
+
static csv(query: QueryRequest): Promise<ApiQueryResponse>;
|
|
106
|
+
/**
|
|
107
|
+
* Creates resources from an uploaded CSV file
|
|
108
|
+
* @param request - ResourcesFromCSVRequest containing file data and resource configuration
|
|
109
|
+
* @returns Promise resolving to ApiResponse with creation results
|
|
110
|
+
*/
|
|
111
|
+
static resourcesFromCsv(request: ResourcesFromCSVRequest): Promise<ApiResponse>;
|
|
112
|
+
/**
|
|
113
|
+
* Executes a general request action against the Dmart API
|
|
114
|
+
* @param action - ActionRequest containing the request details and parameters
|
|
115
|
+
* @returns Promise resolving to ActionResponse with request result
|
|
116
|
+
*/
|
|
117
|
+
static request(action: ActionRequest): Promise<ActionResponse>;
|
|
118
|
+
/**
|
|
119
|
+
* Retrieves a specific entry from the Dmart system
|
|
120
|
+
* @param request - RetrieveEntryRequest containing entry identification and retrieval options
|
|
121
|
+
* @param scope - The scope for the retrieval (default: DmartScope.managed)
|
|
122
|
+
* @returns Promise resolving to ResponseEntry with entry data or null if not found
|
|
123
|
+
*/
|
|
124
|
+
static retrieveEntry(request: RetrieveEntryRequest, scope?: DmartScope): Promise<ResponseEntry | null>;
|
|
125
|
+
/**
|
|
126
|
+
* Uploads a resource with an attached payload file
|
|
127
|
+
* @param request - UploadWithPayloadRequest containing resource data and payload file
|
|
128
|
+
* @param scope - The scope for the upload operation (default: DmartScope.managed)
|
|
129
|
+
* @returns Promise resolving to ApiResponse with upload result
|
|
130
|
+
*/
|
|
131
|
+
static uploadWithPayload(request: UploadWithPayloadRequest, scope?: DmartScope): Promise<ApiResponse>;
|
|
132
|
+
/**
|
|
133
|
+
* Fetches data assets from the Dmart system with optional SQL query filtering
|
|
134
|
+
* @param request - FetchDataAssetRequest containing asset identification and query parameters
|
|
135
|
+
* @returns Promise resolving to data asset response
|
|
136
|
+
*/
|
|
137
|
+
static fetchDataAsset(request: FetchDataAssetRequest): Promise<any>;
|
|
138
|
+
/**
|
|
139
|
+
* Retrieves a list of all available spaces in the system
|
|
140
|
+
* @returns Promise resolving to ApiResponse containing spaces data or null
|
|
141
|
+
*/
|
|
142
|
+
static getSpaces(): Promise<ApiResponse | null>;
|
|
143
|
+
/**
|
|
144
|
+
* Gets child resources within a specified space and subpath
|
|
145
|
+
* @param request - GetChildrenRequest containing search parameters and filters
|
|
146
|
+
* @returns Promise resolving to ApiResponse with child resources or null
|
|
147
|
+
*/
|
|
148
|
+
static getChildren(request: GetChildrenRequest): Promise<ApiResponse | null>;
|
|
149
|
+
/**
|
|
150
|
+
* Generates a URL for accessing attachment resources
|
|
151
|
+
* @param request - GetAttachmentURLRequest containing attachment identification parameters
|
|
152
|
+
* @param scope - The scope for the attachment URL (default: DmartScope.managed)
|
|
153
|
+
* @returns String URL for accessing the attachment
|
|
154
|
+
*/
|
|
155
|
+
static getAttachmentUrl(request: GetAttachmentURLRequest, scope?: DmartScope): string;
|
|
156
|
+
/**
|
|
157
|
+
* Retrieves health information and statistics for a specific space
|
|
158
|
+
* @param space_name - The name of the space to check health for
|
|
159
|
+
* @returns Promise resolving to ApiQueryResponse with health data and folders report
|
|
160
|
+
*/
|
|
161
|
+
static getSpaceHealth(space_name: string): Promise<ApiResponse & {
|
|
162
|
+
attributes: {
|
|
163
|
+
total: number;
|
|
164
|
+
returned: number;
|
|
165
|
+
};
|
|
166
|
+
} & {
|
|
167
|
+
attributes: {
|
|
168
|
+
folders_report: Record<string, unknown>;
|
|
169
|
+
};
|
|
170
|
+
}>;
|
|
171
|
+
/**
|
|
172
|
+
* Retrieves payload data for a specific resource
|
|
173
|
+
* @param request - GetPayloadRequest containing payload identification parameters
|
|
174
|
+
* @param scope - The scope for the payload retrieval (default: DmartScope.managed)
|
|
175
|
+
* @returns Promise resolving to payload data
|
|
176
|
+
*/
|
|
177
|
+
static getPayload(request: GetPayloadRequest, scope?: DmartScope): Promise<any>;
|
|
178
|
+
/**
|
|
179
|
+
* Updates the progress of a ticket with resolution and comments
|
|
180
|
+
* @param request - ProgressTicketRequest containing ticket identification and update data
|
|
181
|
+
* @returns Promise resolving to ApiQueryResponse with progress update result
|
|
182
|
+
*/
|
|
183
|
+
static progressTicket(request: ProgressTicketRequest): Promise<ApiResponse & {
|
|
184
|
+
attributes: {
|
|
185
|
+
total: number;
|
|
186
|
+
returned: number;
|
|
187
|
+
};
|
|
188
|
+
} & {
|
|
189
|
+
attributes: {
|
|
190
|
+
folders_report: Record<string, unknown>;
|
|
191
|
+
};
|
|
192
|
+
}>;
|
|
193
|
+
/**
|
|
194
|
+
* Submits data to a public endpoint with optional workflow processing
|
|
195
|
+
* @param request - SubmitRequest containing submission data and routing information
|
|
196
|
+
* @returns Promise resolving to submission response data
|
|
197
|
+
*/
|
|
198
|
+
static submit(request: SubmitRequest): Promise<any>;
|
|
199
|
+
/**
|
|
200
|
+
* Retrieves the system manifest containing configuration and metadata
|
|
201
|
+
* @returns Promise resolving to manifest data
|
|
202
|
+
*/
|
|
203
|
+
static getManifest(): Promise<any>;
|
|
204
|
+
/**
|
|
205
|
+
* Retrieves the system settings and configuration
|
|
206
|
+
* @returns Promise resolving to settings data
|
|
207
|
+
*/
|
|
208
|
+
static getSettings(): Promise<any>;
|
|
209
|
+
/**
|
|
210
|
+
* Sends an OTP (One-Time Password) request to a user
|
|
211
|
+
* @param request - SendOTPRequest containing recipient information
|
|
212
|
+
* @param acceptLanguage - Optional language preference for the OTP message (default: null)
|
|
213
|
+
* @returns Promise resolving to ApiResponse with OTP request result
|
|
214
|
+
*/
|
|
215
|
+
static otpRequest(request: SendOTPRequest, acceptLanguage?: string | null): Promise<ApiResponse>;
|
|
216
|
+
/**
|
|
217
|
+
* Sends an OTP (One-Time Password) request for login purposes
|
|
218
|
+
* @param request - SendOTPRequest containing recipient information for login OTP
|
|
219
|
+
* @param acceptLanguage - Optional language preference for the OTP message (default: null)
|
|
220
|
+
* @returns Promise resolving to ApiResponse with OTP login request result
|
|
221
|
+
*/
|
|
222
|
+
static otpRequestLogin(request: SendOTPRequest, acceptLanguage?: string | null): Promise<ApiResponse>;
|
|
223
|
+
/**
|
|
224
|
+
* Initiates a password reset request for a user
|
|
225
|
+
* @param request - PasswordResetRequest containing user identification for password reset
|
|
226
|
+
* @returns Promise resolving to ApiResponse with password reset request result
|
|
227
|
+
*/
|
|
228
|
+
static passwordResetRequest(request: PasswordResetRequest): Promise<ApiResponse>;
|
|
229
|
+
/**
|
|
230
|
+
* Confirms an OTP (One-Time Password) code provided by the user
|
|
231
|
+
* @param request - ConfirmOTPRequest containing the OTP code and verification details
|
|
232
|
+
* @returns Promise resolving to ApiResponse with OTP confirmation result
|
|
233
|
+
*/
|
|
234
|
+
static confirmOtp(request: ConfirmOTPRequest): Promise<ApiResponse>;
|
|
235
|
+
/**
|
|
236
|
+
* Resets a user's account or session state
|
|
237
|
+
* @param shortname - The shortname (username) of the user to reset
|
|
238
|
+
* @returns Promise resolving to ApiResponse with user reset result
|
|
239
|
+
*/
|
|
240
|
+
static userReset(shortname: string): Promise<ApiResponse>;
|
|
241
|
+
/**
|
|
242
|
+
* Validates a password against system password policies and requirements
|
|
243
|
+
* @param password - The password string to validate
|
|
244
|
+
* @returns Promise resolving to ApiResponse with validation result
|
|
245
|
+
*/
|
|
246
|
+
static validatePassword(password: string): Promise<ApiResponse>;
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=dmart.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dmart.service.d.ts","sourceRoot":"","sources":["../dmart.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AACzC,OAAO,EACH,UAAU,EAKb,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACR,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAClB,i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