@dizmo/dcs-client-library 4.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.
Files changed (55) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +67 -0
  3. package/dist/data/errorTypes/errorTypes.de.d.ts +3 -0
  4. package/dist/data/errorTypes/errorTypes.de.js +20 -0
  5. package/dist/data/errorTypes/errorTypes.en.d.ts +3 -0
  6. package/dist/data/errorTypes/errorTypes.en.js +20 -0
  7. package/dist/data/errorTypes/errorTypes.es.d.ts +3 -0
  8. package/dist/data/errorTypes/errorTypes.es.js +4 -0
  9. package/dist/data/errorTypes/errorTypes.fr.d.ts +3 -0
  10. package/dist/data/errorTypes/errorTypes.fr.js +4 -0
  11. package/dist/data/errorTypes/errorTypes.it.d.ts +3 -0
  12. package/dist/data/errorTypes/errorTypes.it.js +4 -0
  13. package/dist/data/errorTypes.dev.d.ts +3 -0
  14. package/dist/data/errorTypes.dev.js +71 -0
  15. package/dist/helper/api.d.ts +2 -0
  16. package/dist/helper/api.js +25 -0
  17. package/dist/helper/httpHelper.d.ts +32 -0
  18. package/dist/helper/httpHelper.js +145 -0
  19. package/dist/helper/language.d.ts +5 -0
  20. package/dist/helper/language.js +69 -0
  21. package/dist/helper/parse.d.ts +8 -0
  22. package/dist/helper/parse.js +28 -0
  23. package/dist/helper/token.d.ts +1 -0
  24. package/dist/helper/token.js +28 -0
  25. package/dist/helper/transform.d.ts +3 -0
  26. package/dist/helper/transform.js +18 -0
  27. package/dist/helper/validate.d.ts +4 -0
  28. package/dist/helper/validate.js +21 -0
  29. package/dist/index.d.ts +11 -0
  30. package/dist/index.js +15 -0
  31. package/dist/modules/allocations.d.ts +29 -0
  32. package/dist/modules/allocations.js +148 -0
  33. package/dist/modules/analytics.d.ts +7 -0
  34. package/dist/modules/analytics.js +33 -0
  35. package/dist/modules/configurator.d.ts +8 -0
  36. package/dist/modules/configurator.js +10 -0
  37. package/dist/modules/dcs.d.ts +32 -0
  38. package/dist/modules/dcs.js +130 -0
  39. package/dist/modules/events.d.ts +5 -0
  40. package/dist/modules/events.js +10 -0
  41. package/dist/modules/items.d.ts +21 -0
  42. package/dist/modules/items.js +70 -0
  43. package/dist/modules/language.d.ts +18 -0
  44. package/dist/modules/language.js +106 -0
  45. package/dist/modules/needs.d.ts +12 -0
  46. package/dist/modules/needs.js +35 -0
  47. package/dist/modules/packages.d.ts +16 -0
  48. package/dist/modules/packages.js +71 -0
  49. package/dist/modules/templates.d.ts +19 -0
  50. package/dist/modules/templates.js +64 -0
  51. package/dist/modules/translations.d.ts +6 -0
  52. package/dist/modules/translations.js +17 -0
  53. package/dist/types/types.d.ts +589 -0
  54. package/dist/types/types.js +1 -0
  55. package/package.json +24 -0
@@ -0,0 +1,589 @@
1
+ import type { TranslateTextOptions } from "deepl-node";
2
+ export type Filter = {
3
+ equals: [string, boolean | string | number | null];
4
+ } | {
5
+ greater: [string, number | string];
6
+ } | {
7
+ greaterOrEqual: [string, number | string];
8
+ } | {
9
+ less: [string, number | string];
10
+ } | {
11
+ lessOrEqual: [string, number | string];
12
+ } | {
13
+ stringContains: [string, string];
14
+ } | {
15
+ arrayContains: [string, string | number | null | boolean];
16
+ } | {
17
+ length: [string, number];
18
+ } | {
19
+ startsWith: [string, string];
20
+ } | {
21
+ endsWith: [string, string];
22
+ } | {
23
+ and: Filter[];
24
+ } | {
25
+ or: Filter[];
26
+ } | {
27
+ not: Filter;
28
+ } | null;
29
+ export type AllocationFilter = {
30
+ root?: Filter;
31
+ relationship?: Filter;
32
+ leaf?: Filter;
33
+ };
34
+ export type Input = {
35
+ [property: string]: any;
36
+ };
37
+ export type ItemOptions = {
38
+ markAbsent?: {
39
+ from: number;
40
+ to: number;
41
+ };
42
+ allocatable?: {
43
+ templateSearch: string;
44
+ item: string;
45
+ from: number;
46
+ to: number;
47
+ };
48
+ table?: "auth_user";
49
+ start?: number;
50
+ count?: number;
51
+ };
52
+ export type AllocFilter = {
53
+ root?: Filter;
54
+ relationship?: Filter;
55
+ leaf?: Filter;
56
+ };
57
+ export type AllocSort = {
58
+ root?: Sort[];
59
+ relationship?: Sort[];
60
+ leaf?: Sort[];
61
+ };
62
+ export type AllocOptions = {
63
+ spreadAllocations?: boolean;
64
+ includeConsolidatedAllocations?: boolean;
65
+ checkAllocationRules?: boolean;
66
+ includeFreeItems?: boolean;
67
+ includeConcurrent?: boolean;
68
+ start?: number;
69
+ count?: number;
70
+ relationship?: {
71
+ start?: number;
72
+ count?: number;
73
+ };
74
+ };
75
+ export type Sort = {
76
+ attribute: string;
77
+ ascending: boolean;
78
+ };
79
+ export type BulkCommand = {
80
+ create?: CreateAllocBulk[];
81
+ update?: UpdateAllocBulk[];
82
+ delete?: string[];
83
+ };
84
+ export type CreateAllocBulk = {
85
+ from: number;
86
+ to: number;
87
+ item1Id: string;
88
+ item2Id: string;
89
+ name?: string;
90
+ };
91
+ export type UpdateAllocBulk = {
92
+ allocId: string;
93
+ from?: number;
94
+ to?: number;
95
+ item1Id?: string;
96
+ item2Id?: string;
97
+ name?: string;
98
+ };
99
+ export type UpdateAlloc = {
100
+ from?: number;
101
+ to?: number;
102
+ name?: string;
103
+ };
104
+ export type CreateAlloc = {
105
+ from: number;
106
+ to: number;
107
+ name?: string;
108
+ timezone?: string;
109
+ };
110
+ export type DevErrorCollection = {
111
+ [errName: string]: {
112
+ message: string;
113
+ number: number;
114
+ };
115
+ };
116
+ export type LanguageObj = {
117
+ [key: string]: string;
118
+ };
119
+ export type StringParams = {
120
+ [param: string]: string | number;
121
+ };
122
+ export type UserErrorCollection = {
123
+ [property: string]: string;
124
+ };
125
+ export type ErrorParams = {
126
+ [param: string]: string | number;
127
+ };
128
+ export type RawErrorData = {
129
+ [language: string]: UserErrorCollection;
130
+ };
131
+ export type FullError = {
132
+ [errName: string]: {
133
+ errorName: string;
134
+ userMessage: string;
135
+ devMessage: string;
136
+ errorNumber: number;
137
+ };
138
+ };
139
+ export type TemplateFilter = {
140
+ name?: string;
141
+ root?: {
142
+ name: string;
143
+ };
144
+ };
145
+ export type ExportSettings = {
146
+ timezone?: string;
147
+ items?: ExportItemsConfig;
148
+ allocations?: ExportAllocConfig;
149
+ };
150
+ export type ExportItemsConfig = string | string[];
151
+ export type ExportAllocConfig = string | {
152
+ all: {
153
+ [itemType: string]: string;
154
+ };
155
+ } | {
156
+ primary: {
157
+ itemType1: string;
158
+ };
159
+ secondary: {
160
+ [itemType: string]: string;
161
+ };
162
+ };
163
+ export type UpdateCalendarInfo = {
164
+ day?: string;
165
+ text?: {
166
+ [key: string]: string;
167
+ };
168
+ textColor?: string;
169
+ bgColor?: string;
170
+ overlayColor?: string;
171
+ freeTime?: boolean;
172
+ };
173
+ export type GetCalendarOptions = {
174
+ id?: string;
175
+ start?: string;
176
+ end?: string;
177
+ };
178
+ export type CalendarInfo = {
179
+ day: string;
180
+ text: {
181
+ [key: string]: string;
182
+ };
183
+ textColor: string;
184
+ bgColor: string;
185
+ overlayColor: string;
186
+ freeTime: boolean;
187
+ };
188
+ export type RepetitionInfo = {
189
+ pattern: "day" | "week" | "month_weekday" | "month_date" | "year_occurrence" | "year_date" | "on_certain_days";
190
+ durationType: "on" | "after";
191
+ durationValue: number;
192
+ originalId?: string;
193
+ days_of_the_week?: string[];
194
+ skip_weekends?: boolean;
195
+ };
196
+ export type EditOrDeletionType = "this" | "future" | "all" | "past";
197
+ export type PackageFilter = {
198
+ name?: string;
199
+ template?: string;
200
+ };
201
+ export type UpdatePackage = {
202
+ name?: string;
203
+ description?: string;
204
+ };
205
+ export type CreatePackage = {
206
+ name: string;
207
+ description: string;
208
+ rootItemTypeId: string;
209
+ packageAllocations: PackageAlloc[];
210
+ originalPackageDate?: number;
211
+ };
212
+ export type PackageAlloc = {
213
+ startOffset: number;
214
+ duration: number;
215
+ leafId: string;
216
+ };
217
+ export type FullPackageAlloc = {
218
+ startOffset: number;
219
+ duration: number;
220
+ leafId: string;
221
+ leafData: ItemResult | null;
222
+ };
223
+ export type ItemResult = {
224
+ labels: string[];
225
+ properties: {
226
+ id: string;
227
+ _created_by: string;
228
+ _edited_by: string;
229
+ isAbsent?: boolean;
230
+ [prop: string]: any;
231
+ };
232
+ _datatype?: "item";
233
+ };
234
+ export type NeedResult = {
235
+ _id: string;
236
+ _created_by?: string;
237
+ _edited_by?: string;
238
+ _datatype: "need";
239
+ type: string;
240
+ name: string;
241
+ filter: Filter;
242
+ };
243
+ export type CreateResult = {
244
+ properties: {
245
+ id: string;
246
+ };
247
+ };
248
+ export type Allocation = {
249
+ properties: {
250
+ id: string;
251
+ from: number;
252
+ to: number;
253
+ _created_by?: string;
254
+ _edited_by?: string;
255
+ name?: string;
256
+ _repetitionId?: string;
257
+ overbooked?: boolean;
258
+ pivotOverbooked?: boolean;
259
+ };
260
+ };
261
+ export type AllocationResult = {
262
+ root: ItemResult;
263
+ relationships: AllocationRelationship[];
264
+ };
265
+ export type AllocationRelationship = {
266
+ leaf: ItemResult;
267
+ allocations: Allocation[];
268
+ };
269
+ export type SpreadAllocationRelationship = {
270
+ leaf: ItemResult;
271
+ allocation: Allocation;
272
+ };
273
+ export type SpreadAllocationResult = {
274
+ root: ItemResult;
275
+ relationships: SpreadAllocationRelationship[];
276
+ };
277
+ export type AllocationResult3 = {
278
+ root: ItemResult | NeedResult;
279
+ relationships: AllocationRelationship3[];
280
+ };
281
+ export type AllocationRelationship3 = {
282
+ leaf: ItemResult | NeedResult;
283
+ allocations: Allocation[];
284
+ };
285
+ export type SpreadAllocationRelationship3 = {
286
+ leaf: ItemResult | NeedResult;
287
+ allocation: Allocation;
288
+ };
289
+ export type SpreadAllocationResult3 = {
290
+ root: ItemResult | NeedResult;
291
+ relationships: SpreadAllocationRelationship3[];
292
+ };
293
+ export type RepetitionCreateResult = {
294
+ _repetitionId: string;
295
+ };
296
+ export type TemplateAttributeResult = {
297
+ default_value: number | string | boolean | string[] | {
298
+ long: number;
299
+ lat: number;
300
+ } | null;
301
+ editable_by: Permissions;
302
+ id: string;
303
+ label: {
304
+ [language: string]: string;
305
+ };
306
+ type: string;
307
+ value_type: string;
308
+ options: any;
309
+ visible_by: Permissions;
310
+ };
311
+ export type TemplateSettingsResult = {
312
+ card_first_line: string;
313
+ card_second_line: string;
314
+ id_dizmoauthid?: string;
315
+ sort?: string;
316
+ icon_url: string;
317
+ confirm_changes_popup: boolean;
318
+ individual_color: string;
319
+ createable_by: Permissions;
320
+ deleteable_by: Permissions;
321
+ allocateable_by: Permissions;
322
+ };
323
+ export type TemplateResult = {
324
+ _created_by: string;
325
+ _edited_by: string;
326
+ attributes: TemplateAttributeResult[];
327
+ color: string;
328
+ id: string;
329
+ options: any;
330
+ settings: TemplateSettingsResult | null;
331
+ title: {
332
+ [key: string]: string;
333
+ };
334
+ type: string;
335
+ };
336
+ export type RawTemplate = {
337
+ properties: {
338
+ id: string;
339
+ type: string;
340
+ _created_by: string;
341
+ _edited_by: string;
342
+ data: string;
343
+ };
344
+ };
345
+ export type UserInfo = {
346
+ role: "admin" | "viewer" | "editor";
347
+ username: string;
348
+ company: string;
349
+ db_found: boolean;
350
+ };
351
+ export type CalendarResult = {
352
+ _id: string;
353
+ _created_by: string;
354
+ _edited_by: string;
355
+ day: string;
356
+ text: {
357
+ [lang: string]: string;
358
+ };
359
+ textColor: string;
360
+ bgColor: string;
361
+ overlayColor: string;
362
+ freeTime: boolean;
363
+ };
364
+ export type PackagesResult = {
365
+ _id: string;
366
+ _created_by: string;
367
+ _created_on: number;
368
+ _edited_by: string;
369
+ _last_used: number;
370
+ numberOfAllocations: number;
371
+ totalDuration: number;
372
+ name: string;
373
+ description: string;
374
+ originalPackageDate: number;
375
+ rootItemTypeId: string;
376
+ packageAllocations: PackageAlloc[];
377
+ };
378
+ export type PackageResult = {
379
+ _id: string;
380
+ _created_by: string;
381
+ _created_on: number;
382
+ _edited_by: string;
383
+ _last_used: number;
384
+ numberOfAllocations: number;
385
+ totalDuration: number;
386
+ name: string;
387
+ description: string;
388
+ originalPackageDate: number;
389
+ rootItemTypeId: string;
390
+ packageAllocations: FullPackageAlloc[];
391
+ };
392
+ export type CreateNeed = {
393
+ type: string;
394
+ name: string;
395
+ filter: Filter;
396
+ };
397
+ export type UpdateNeed = {
398
+ filter?: Filter;
399
+ name?: string;
400
+ };
401
+ export type Need = CreateNeed & {
402
+ _id: string;
403
+ _created_by: string;
404
+ _edited_by: string;
405
+ _datatype: "need";
406
+ };
407
+ export type GetNeeds = {
408
+ type: string;
409
+ };
410
+ export type DeepLResponse = {
411
+ text: string;
412
+ detectedSourceLang: string;
413
+ billedCharacters: string;
414
+ };
415
+ export type ProcessedDeepLResponse = {
416
+ text: string;
417
+ detectedSourceLang: string;
418
+ };
419
+ export type DeepLInput = {
420
+ texts: string | string[];
421
+ sourceLang: string | null;
422
+ targetLang: string;
423
+ options?: TranslateTextOptions;
424
+ };
425
+ export type BulkOperationOptions = {
426
+ skipUndefined?: boolean;
427
+ type?: string;
428
+ [key: string]: unknown;
429
+ };
430
+ export type BulkOperationResult = {
431
+ success: boolean;
432
+ createdIds: string[];
433
+ updatedIds: string[];
434
+ deletedIds: string[];
435
+ };
436
+ export type CompanySettingsResult = {
437
+ properties: {
438
+ [key: string]: any;
439
+ };
440
+ };
441
+ export type NotificationInform = {
442
+ inform: "self";
443
+ } | {
444
+ inform: "responsible";
445
+ responsibleAttribute: string;
446
+ };
447
+ export type NotificationRule = {
448
+ change: "alloc";
449
+ templateNotified: string;
450
+ templateOther: string;
451
+ notify: NotificationInform;
452
+ } | {
453
+ change: "attribute";
454
+ templateChanged: string;
455
+ templateToInform: string | null;
456
+ notify: NotificationInform;
457
+ };
458
+ export type PermissionVar = {
459
+ userid: Record<string, never>;
460
+ } | {
461
+ allocatedItemIds: Record<string, never>;
462
+ };
463
+ export type PermissionFilter = {
464
+ equals: [string, boolean | string | number | null | PermissionVar];
465
+ } | {
466
+ greater: [string, number | string | PermissionVar];
467
+ } | {
468
+ greaterOrEqual: [string, number | string | PermissionVar];
469
+ } | {
470
+ less: [string, number | string | PermissionVar];
471
+ } | {
472
+ lessOrEqual: [string, number | string | PermissionVar];
473
+ } | {
474
+ stringContains: [string, string | PermissionVar];
475
+ } | {
476
+ arrayContains: [string, string | number | null | boolean | PermissionVar];
477
+ } | {
478
+ length: [string, number | PermissionVar];
479
+ } | {
480
+ startsWith: [string, string | PermissionVar];
481
+ } | {
482
+ endsWith: [string, string | PermissionVar];
483
+ } | {
484
+ in: [string, PermissionVar | string[]];
485
+ } | {
486
+ and: PermissionFilter[];
487
+ } | {
488
+ or: PermissionFilter[];
489
+ } | {
490
+ not: PermissionFilter;
491
+ } | null;
492
+ export type AccessPermission = {
493
+ match: PermissionFilter;
494
+ read: string[] | {
495
+ any: Record<string, never>;
496
+ };
497
+ write: string[] | {
498
+ any: Record<string, never>;
499
+ };
500
+ create: boolean;
501
+ delete: boolean;
502
+ visible: boolean;
503
+ };
504
+ export type AccessPermissions = {
505
+ [role: string]: {
506
+ items: AccessPermission[];
507
+ allocs: AccessPermission[];
508
+ };
509
+ };
510
+ export type CompanySettingsInput = {
511
+ allocationRules: {
512
+ [key: string]: number;
513
+ };
514
+ supported_languages?: string[];
515
+ default_language?: string;
516
+ _edited_by?: string;
517
+ name?: string;
518
+ company?: string;
519
+ notificationRules?: NotificationRule[];
520
+ notificationCoolDown?: number;
521
+ notificationSendIfSooner?: number;
522
+ notificationSendImmediately?: number;
523
+ accessPermissions?: AccessPermissions;
524
+ allocationPageSize?: number;
525
+ };
526
+ export type Permissions = ("editor" | "admin" | "viewer")[];
527
+ export type TemplateAttributeInput = {
528
+ id: string;
529
+ label: {
530
+ [language: string]: string;
531
+ };
532
+ type: string;
533
+ default_value: number | string | boolean | string[] | {
534
+ long: number;
535
+ lat: number;
536
+ } | null;
537
+ editable_by: Permissions;
538
+ visible_by: Permissions;
539
+ options?: unknown;
540
+ };
541
+ export type TemplateSettingsInput = {
542
+ card_first_line?: string;
543
+ card_second_line?: string;
544
+ id_dizmoauthid?: string;
545
+ sort?: string;
546
+ icon_url?: string;
547
+ confirm_changes_popup?: boolean;
548
+ individual_color?: string;
549
+ createable_by?: Permissions;
550
+ allocateable_by?: Permissions;
551
+ deleteable_by?: Permissions;
552
+ };
553
+ export type TemplateInput = {
554
+ _id?: string;
555
+ type?: string;
556
+ color: string | null;
557
+ title: {
558
+ [language: string]: string;
559
+ };
560
+ options?: {
561
+ geometry?: {
562
+ width: number;
563
+ height: number;
564
+ };
565
+ };
566
+ settings: TemplateSettingsInput;
567
+ attributes: TemplateAttributeInput[];
568
+ };
569
+ export type RestoreResult = {
570
+ message: string;
571
+ id?: string;
572
+ };
573
+ export type UpdateResult = {
574
+ _id: string;
575
+ };
576
+ export type DeleteResult = Record<string, never>;
577
+ export type CsvImportResult = {
578
+ message: string;
579
+ id?: string;
580
+ };
581
+ export type FileInfoResult = {
582
+ successOnAPI: boolean;
583
+ isDCSFile: boolean;
584
+ fileCategory: string | undefined;
585
+ fileType: string | null | undefined;
586
+ originalURL: string;
587
+ blobURL: string | undefined;
588
+ previewURL: string;
589
+ };
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@dizmo/dcs-client-library",
3
+ "version": "4.0.1",
4
+ "description": "A library that allows connection and management of dcs",
5
+ "source": "source/index.ts",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": ["dist"],
9
+ "scripts": {
10
+ "test": "mocha source/test/**/*.js",
11
+ "build": "tsc",
12
+ "prepublishOnly": "tsc"
13
+ },
14
+ "author": "",
15
+ "license": "ISC",
16
+ "devDependencies": {
17
+ "@dizmo/dizmo.js": "^1.4.77",
18
+ "prettier": "3.1.0",
19
+ "typescript": "^5.7.3"
20
+ },
21
+ "dependencies": {
22
+ "deepl-node": "^1.19.0"
23
+ }
24
+ }