@edraj/tsdmart 1.0.17 → 2.1.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/dmart.model.ts ADDED
@@ -0,0 +1,331 @@
1
+ export enum Status {
2
+ success = "success",
3
+ failed = "failed",
4
+ }
5
+
6
+ export interface ClientError {
7
+ code: string,
8
+ status: string,
9
+ message: string,
10
+ request?: {
11
+ url: string,
12
+ method: string
13
+ },
14
+ response: ApiResponse
15
+ }
16
+
17
+ export type Error = {
18
+ type: string;
19
+ code: number;
20
+ message: string;
21
+ info: any;
22
+ };
23
+
24
+ export type ApiResponseRecord = {
25
+ resource_type: string;
26
+ shortname: string;
27
+ branch_name?: string;
28
+ subpath: string;
29
+ attributes: Record<string, any>;
30
+ };
31
+
32
+ export type ApiResponse = {
33
+ status: Status;
34
+ error?: Error;
35
+ records: Array<ApiResponseRecord>;
36
+ };
37
+
38
+ export type Translation = {
39
+ ar: string;
40
+ en: string;
41
+ kd: string;
42
+ };
43
+
44
+ export enum UserType {
45
+ web = "web",
46
+ mobile = "mobile",
47
+ bot = "bot",
48
+ }
49
+
50
+ export type LoginResponseRecord = ApiResponseRecord & {
51
+ attributes: {
52
+ access_token: string;
53
+ type: UserType;
54
+ displayname: Translation;
55
+ };
56
+ };
57
+
58
+ export type LoginResponse = ApiResponse & {
59
+ records: Array<LoginResponseRecord>;
60
+ };
61
+
62
+ export type Permission = {
63
+ allowed_actions: Array<ActionType>;
64
+ conditions: Array<string>;
65
+ restricted_fields: Array<any>;
66
+ allowed_fields_values: Map<string, any>;
67
+ };
68
+
69
+ export enum Language {
70
+ arabic = "arabic",
71
+ english = "engligh",
72
+ kurdish = "kurdish",
73
+ french = "french",
74
+ turkish = "turkish",
75
+ }
76
+
77
+ export type ProfileResponseRecord = ApiResponseRecord & {
78
+ attributes: {
79
+ email: string;
80
+ displayname: Translation;
81
+ type: string;
82
+ language: Language;
83
+ is_email_verified: boolean;
84
+ is_msisdn_verified: boolean;
85
+ force_password_change: boolean;
86
+ permissions: Record<string, Permission>;
87
+ };
88
+ };
89
+
90
+ export enum ActionType {
91
+ query = "query",
92
+ view = "view",
93
+ update = "update",
94
+ create = "create",
95
+ delete = "delete",
96
+ attach = "attach",
97
+ move = "move",
98
+ progress_ticket = "progress_ticket",
99
+ }
100
+
101
+ export type ProfileResponse = ApiResponse & {
102
+ records: Array<ProfileResponseRecord>;
103
+ };
104
+
105
+ export let headers: { [key: string]: string } = {
106
+ "Content-type": "application/json",
107
+ Authorization: "",
108
+ };
109
+
110
+ export type AggregationReducer = {
111
+ name: string;
112
+ alias: string;
113
+ args: Array<string>;
114
+ };
115
+
116
+ export type AggregationType = {
117
+ load: Array<string>;
118
+ group_by: Array<string>;
119
+ reducers: Array<AggregationReducer> | Array<string>;
120
+ };
121
+
122
+ export enum QueryType {
123
+ aggregation = "aggregation",
124
+ search = "search",
125
+ subpath = "subpath",
126
+ events = "events",
127
+ history = "history",
128
+ tags = "tags",
129
+ spaces = "spaces",
130
+ counters = "counters",
131
+ reports = "reports",
132
+ attachments = "attachments",
133
+ attachments_aggregation = "attachments_aggregation",
134
+ }
135
+
136
+ export enum SortyType {
137
+ ascending = "ascending",
138
+ descending = "descending",
139
+ }
140
+
141
+ // enum NotificationPriority {
142
+ // high = "high",
143
+ // medium = "medium",
144
+ // low = "low"
145
+ // };
146
+
147
+ export type QueryRequest = {
148
+ type: QueryType;
149
+ space_name: string;
150
+ subpath: string;
151
+ filter_types?: Array<ResourceType>;
152
+ filter_schema_names?: Array<string>;
153
+ filter_shortnames?: Array<string>;
154
+ search: string;
155
+ from_date?: string;
156
+ to_date?: string;
157
+ sort_by?: string;
158
+ sort_type?: SortyType;
159
+ retrieve_json_payload?: boolean;
160
+ retrieve_attachments?: boolean;
161
+ validate_schema?: boolean;
162
+ jq_filter?: string;
163
+ exact_subpath?: boolean;
164
+ limit?: number;
165
+ offset?: number;
166
+ aggregation_data?: AggregationType;
167
+ };
168
+
169
+ export enum RequestType {
170
+ create = "create",
171
+ update = "update",
172
+ replace = "replace",
173
+ delete = "delete",
174
+ move = "move",
175
+ updateACL = "update_acl",
176
+ assign = "assign",
177
+ }
178
+
179
+ export enum ResourceAttachmentType {
180
+ json = "json",
181
+ comment = "comment",
182
+ media = "media",
183
+ relationship = "relationship",
184
+ alteration = "alteration",
185
+ csv = "csv",
186
+ parquet = "parquet",
187
+ jsonl = "jsonl",
188
+ sqlite = "sqlite",
189
+ }
190
+
191
+ export enum ResourceType {
192
+ user = "user",
193
+ group = "group",
194
+ folder = "folder",
195
+ schema = "schema",
196
+ content = "content",
197
+ acl = "acl",
198
+ comment = "comment",
199
+ reaction = "reaction",
200
+ media = "media",
201
+ locator = "locator",
202
+ relationship = "relationship",
203
+ alteration = "alteration",
204
+ history = "history",
205
+ space = "space",
206
+ branch = "branch",
207
+ permission = "permission",
208
+ role = "role",
209
+ ticket = "ticket",
210
+ json = "json",
211
+ post = "post",
212
+ plugin_wrapper = "plugin_wrapper",
213
+ notification = "notification",
214
+ jsonl = "jsonl",
215
+ csv = "csv",
216
+ sqlite = "sqlite",
217
+ parquet = "parquet",
218
+ }
219
+
220
+ export enum ContentType {
221
+ text = "text",
222
+ html = "html",
223
+ markdown = "markdown",
224
+ json = "json",
225
+ image = "image",
226
+ python = "python",
227
+ pdf = "pdf",
228
+ audio = "audio",
229
+ video = "video",
230
+ jsonl = "jsonl",
231
+ csv = "csv",
232
+ sqlite = "sqlite",
233
+ parquet = "parquet",
234
+ }
235
+
236
+ export enum ContentTypeMedia {
237
+ text = "text",
238
+ html = "html",
239
+ markdown = "markdown",
240
+ image = "image",
241
+ python = "python",
242
+ pdf = "pdf",
243
+ audio = "audio",
244
+ video = "video",
245
+ }
246
+
247
+ export type Payload = {
248
+ content_type: ContentType;
249
+ schema_shortname?: string;
250
+ checksum?: string;
251
+ body: string | Record<string, any> | any;
252
+ last_validated?: string;
253
+ validation_status?: "valid" | "invalid";
254
+ };
255
+
256
+ export type MetaExtended = {
257
+ email: string;
258
+ msisdn: string;
259
+ is_email_verified: boolean;
260
+ is_msisdn_verified: boolean;
261
+ force_password_change: boolean;
262
+ password: string;
263
+ workflow_shortname: string;
264
+ state: string;
265
+ is_open: boolean;
266
+ };
267
+
268
+ export type ResponseEntry = MetaExtended & {
269
+ uuid: string;
270
+ shortname: string;
271
+ subpath: string;
272
+ is_active: boolean;
273
+ displayname: Translation;
274
+ description: Translation;
275
+ tags: Set<string>;
276
+ created_at: string;
277
+ updated_at: string;
278
+ owner_shortname: string;
279
+ payload?: Payload;
280
+ relationships?: any;
281
+ attachments?: Object;
282
+ workflow_shortname?: string;
283
+ state?: string;
284
+ };
285
+
286
+ export type ResponseRecord = {
287
+ resource_type: ResourceType;
288
+ uuid: string;
289
+ shortname: string;
290
+ subpath: string;
291
+ attributes: {
292
+ is_active: boolean;
293
+ displayname: Translation;
294
+ description: Translation;
295
+ tags: Set<string>;
296
+ created_at: string;
297
+ updated_at: string;
298
+ owner_shortname: string;
299
+ payload?: Payload;
300
+ };
301
+ };
302
+
303
+ export type ActionResponse = ApiResponse & {
304
+ records: Array<
305
+ ResponseRecord & {
306
+ attachments: {
307
+ media: Array<ResponseRecord>;
308
+ json: Array<ResponseRecord>;
309
+ };
310
+ }
311
+ >;
312
+ };
313
+
314
+ export type ActionRequestRecord = {
315
+ resource_type: ResourceType;
316
+ uuid?: string;
317
+ shortname: string;
318
+ subpath: string;
319
+ attributes: Record<string, any>;
320
+ attachments?: Record<ResourceType, Array<any>>;
321
+ };
322
+
323
+ export type ActionRequest = {
324
+ space_name: string;
325
+ request_type: RequestType;
326
+ records: Array<ActionRequestRecord>;
327
+ };
328
+
329
+ export type ApiQueryResponse = ApiResponse & {
330
+ attributes: { total: number; returned: number };
331
+ };