@luminocity/lemonate-gateway 7.7.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.
@@ -0,0 +1,4368 @@
1
+ import moment from 'moment';
2
+ import { AxiosInstance, ResponseType } from 'axios';
3
+ import WebSocket from 'isomorphic-ws';
4
+ import FormData from 'form-data';
5
+ import { WebsocketProvider } from 'y-websocket';
6
+ import * as awarenessProtocol from 'y-protocols/awareness';
7
+ import { CollabDocument } from '@/collabstate/CollabDocument';
8
+
9
+ declare class Snapshot {
10
+ id: string;
11
+ type: string;
12
+ data: any;
13
+ constructor(id: string, type: string, data: any);
14
+ }
15
+
16
+ declare class Storage {
17
+ databaseName: string;
18
+ collectionName: string;
19
+ size: number;
20
+ type: number;
21
+ private _impl;
22
+ constructor(databaseName: string, collectionName: string, type?: number, sizeMb?: number);
23
+ init(): Promise<any>;
24
+ _keys(): Promise<any>;
25
+ fixKey(key: string): string;
26
+ _set(key: string, data: any): Promise<any>;
27
+ _clear(): Promise<any>;
28
+ _get(key: string, mimeType?: string): Promise<any>;
29
+ _remove(key: string): Promise<any>;
30
+ }
31
+
32
+ declare class ItemCache$1 extends Storage {
33
+ apiClient: ApiClient;
34
+ cache: Map<string, any>;
35
+ urlToIdMap: Map<string, string>;
36
+ logging: boolean;
37
+ ready: boolean;
38
+ usePublicApi: boolean;
39
+ quota: number;
40
+ size: number;
41
+ usePersistentStorage: boolean;
42
+ saveIndex: Function;
43
+ constructor(usePublicApi: boolean, usePersistentStorage: boolean, apiClient: ApiClient, persistentStorageSizeMb: number);
44
+ init(): Promise<void>;
45
+ getQuota(): number;
46
+ setQuota(value: any): void;
47
+ getCount(): number;
48
+ getSize(): number;
49
+ initFromStorage(): Promise<void>;
50
+ addToStorage(object: any, blob: any): Promise<void>;
51
+ waitUntilReady(): Promise<void>;
52
+ findObject(id: string): any;
53
+ getEntries(): MapIterator<any>;
54
+ clear(): void;
55
+ clearMemory(): void;
56
+ checkQuota(increase?: number): void;
57
+ removeObjectFromCache(id: string): void;
58
+ getIdFromUrl(url: string): string | null | undefined;
59
+ getById(id: string): any;
60
+ getObjectUrl(url: string): any;
61
+ getBufferById(id: string): Promise<ArrayBuffer | null>;
62
+ getBlobById(id: string): Promise<Blob | null>;
63
+ loadFromStorage(object: any): Promise<boolean>;
64
+ getCacheKey(id: any, lodLevel: any): any;
65
+ _getLodLevelUrl(itemId: any, lodLevel: any): any;
66
+ loadItem(id: any, lodLevel: any, loadingProgressFunc: any): Promise<any>;
67
+ addItemToCache(id: string, lodLevel?: any, hash?: any, loadingProgressFunc?: Function): Promise<any>;
68
+ getObjectCount(): number;
69
+ getObjectSize(): number;
70
+ handleRename({ id, newName }: {
71
+ id: any;
72
+ newName: any;
73
+ }): void;
74
+ }
75
+
76
+ declare class FolderCache extends Storage {
77
+ apiClient: ApiClient;
78
+ ready: boolean;
79
+ maxNumItems: number;
80
+ constructor(apiClient: ApiClient);
81
+ init(): Promise<void>;
82
+ clear(): Promise<any>;
83
+ checkStorage(): Promise<void>;
84
+ getFolderListing(id: string): Promise<any>;
85
+ getItemListing(folderId: string): Promise<any>;
86
+ getFolderACLs(id: string, timeout: number): Promise<any>;
87
+ refreshCacheForFolder(folderId: string): Promise<void>;
88
+ addFolderListing(folderId: string, listing: any[]): Promise<void>;
89
+ addItemListing(folderId: string, itemListing: any): Promise<void>;
90
+ addACL(folderId: string, acls: any[]): Promise<void>;
91
+ }
92
+
93
+ declare class ThumbCache extends Storage {
94
+ apiClient: ApiClient;
95
+ constructor(apiClient: ApiClient);
96
+ clear(): void;
97
+ _loadThumbnail(size: number, id: string): Promise<any>;
98
+ get(id: string, size: number, hash?: string, timestamp?: number): Promise<any>;
99
+ }
100
+
101
+ declare class EventEmitter {
102
+ private _debugMode;
103
+ private _listeners;
104
+ private _onceListeners;
105
+ private _catchAllListeners;
106
+ private _capturedEvents;
107
+ private _capturedAccumulatedDuration;
108
+ constructor();
109
+ setDebugMode(mode: boolean): void;
110
+ $clear(): void;
111
+ clearCatchAllListeners(): void;
112
+ listenerCount(eventType: string): number;
113
+ $hasListener(eventType: string): boolean;
114
+ $catchAll(func: Function, owner: any): void;
115
+ $on(eventType: string, func: Function, owner?: any): void;
116
+ $once(eventType: string, func: Function, owner?: any): void;
117
+ $off(eventType: string, func: Function, owner?: any): number;
118
+ $offByOwner(eventType: string, owner?: any): number;
119
+ $emitSync(eventType: string, ...args: any[]): Promise<any[]> | null;
120
+ $emit(eventType: string, ...args: any[]): Promise<unknown>;
121
+ }
122
+
123
+ /**
124
+ * To generate the return type of a function based on the options that are
125
+ * supplied to it as an object, without having to define every combination
126
+ * manually, we use a generic mapped type that can determine the returned type
127
+ * at compile-time.
128
+ *
129
+ * The mapped type is complicated and consists of the following parts:
130
+ *
131
+ *
132
+ * A map of options and how they effect the returned type:
133
+ * type ItemOptionsMap = {
134
+ * returnClonedFrom: { clonedFrom?: string },
135
+ * withThumbnails: { thumbnails?: string[] };
136
+ * };
137
+ *
138
+ * An object where every available item option is mapped to the type it accepts.
139
+ * This can be written by hand in case different options require different values,
140
+ * or it can be generated if they're all of the same type:
141
+ * type ItemOptions = {
142
+ * [K in keyof ItemOptionsMap]?: boolean;
143
+ * };
144
+ *
145
+ * Turn an object of item options into a union of their values:
146
+ * type ItemOptionsUnion<O extends ItemOptions> = Extract<{
147
+ * [K in keyof O]: O[K] extends true ? K : never
148
+ * }[keyof O], keyof ItemOptionsMap>;
149
+ *
150
+ * For example:
151
+ * {
152
+ * returnClonedFrom: true,
153
+ * withThumbnails: true
154
+ * }
155
+ * will be turned into: "returnClonedFrom" | "withThumbnails".
156
+ *
157
+ * Finally we can generate the return type from the base type (Item in this case)
158
+ * and the modifications based on the supplied options:
159
+ * type ItemWithOptions<O extends ItemOptions> = Item & UnionToIntersection<ItemOptionsMap[OptionsUnion<O>]>;
160
+ *
161
+ *
162
+ * To make this easier to use, these individual steps are combined into a OptionsUnion and OptionalResponses type.
163
+ * They can be used like this:
164
+ * type ItemWithOptions<O extends ItemOptions> = Item & OptionalResponses<ItemOptions, ItemOptionsMap, O>;
165
+ */
166
+ type OptionsUnion<OptionParameters, SelectedOptions extends OptionParameters> = Extract<{
167
+ [K in keyof SelectedOptions]: SelectedOptions[K] extends (true | string) ? K : never;
168
+ }[keyof SelectedOptions], keyof OptionParameters>;
169
+ type OptionalResponses<OptionParameters, OptionResponses extends {
170
+ [Option in keyof OptionParameters]: any;
171
+ }, SelectedOptions extends OptionParameters> = UnionToIntersection<OptionResponses[OptionsUnion<OptionParameters, SelectedOptions>]>;
172
+ /**
173
+ * Turn a union of objects into an intersection of objects.
174
+ * Taken from https://stackoverflow.com/a/50375286.
175
+ */
176
+ type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never;
177
+ type AllOrNothing<T> = {
178
+ [K in keyof T]?: never;
179
+ } | T;
180
+
181
+ type Acl = {
182
+ group?: string;
183
+ user?: string;
184
+ can: string[];
185
+ }[];
186
+ type Attachments = {
187
+ name?: string;
188
+ queryParam?: number;
189
+ index?: number;
190
+ perceptiveHash?: string;
191
+ filesize?: number;
192
+ mimeType?: string;
193
+ hash?: string;
194
+ storages?: string[];
195
+ storageHash?: string;
196
+ }[];
197
+ declare class Item {
198
+ _id: string;
199
+ name: string;
200
+ folder: string;
201
+ folderPath: string[];
202
+ links?: {
203
+ to: string;
204
+ usage: string;
205
+ }[];
206
+ attributes?: Record<string, unknown>;
207
+ userAttributes?: Record<string, unknown>;
208
+ filename?: string;
209
+ createdAt: string;
210
+ updatedAt: string;
211
+ version: {
212
+ major: number;
213
+ minor: number;
214
+ revision: number;
215
+ };
216
+ filesize?: number;
217
+ hash?: string;
218
+ mimeType?: string;
219
+ type: string;
220
+ packageType?: string;
221
+ createdBy?: string;
222
+ updatedBy?: string;
223
+ acl?: Acl;
224
+ visibility: number;
225
+ properties: Record<string, string>;
226
+ allowConversation?: boolean;
227
+ conversation?: string;
228
+ tags?: string[];
229
+ contributors?: string[];
230
+ description?: string;
231
+ shortDescription?: string;
232
+ userAttributeTemplate?: string;
233
+ categories?: string[];
234
+ attachments?: Attachments;
235
+ license?: string;
236
+ quotaUser?: string;
237
+ quotaGroup?: string;
238
+ itemSize?: number;
239
+ totalSize?: number;
240
+ flags?: string[];
241
+ perceptiveHash?: string;
242
+ unpackagedSize?: number;
243
+ location?: string;
244
+ itemFlag?: {
245
+ isStaffPick: boolean;
246
+ isGame: boolean;
247
+ featureWeight: number;
248
+ };
249
+ constructor(data: any);
250
+ }
251
+ declare class AggregatedItem extends Item {
252
+ links?: {
253
+ to: string;
254
+ usage: string;
255
+ stopRecursion?: boolean;
256
+ }[];
257
+ thumbnails?: {
258
+ _id: string;
259
+ data: string;
260
+ size: number;
261
+ }[];
262
+ fieldSets?: {
263
+ name: string;
264
+ fields: any[];
265
+ }[];
266
+ fields?: any[];
267
+ userFields?: any[];
268
+ additionalUserAttributes?: Record<string, unknown>;
269
+ readonly isAggregatedItem: boolean;
270
+ constructor(data: any);
271
+ }
272
+ type ItemOptionsMap = {
273
+ returnClonedFrom: {
274
+ clonedFrom?: string;
275
+ };
276
+ withThumbnails: {
277
+ thumbnails?: string[];
278
+ };
279
+ };
280
+ type ItemOptions = {
281
+ returnClonedFrom?: boolean;
282
+ withThumbnails?: boolean;
283
+ };
284
+ type ItemWithOptions<O extends ItemOptions> = Item & OptionalResponses<ItemOptions, ItemOptionsMap, O>;
285
+ type FolderListing = {
286
+ parent: {
287
+ _id: string;
288
+ name: string;
289
+ parent?: string;
290
+ createdAt: string;
291
+ createdBy?: string;
292
+ updatedAt: string;
293
+ updatedBy?: string;
294
+ acl?: Acl;
295
+ };
296
+ children: {
297
+ _id: string;
298
+ name: string;
299
+ parent?: string;
300
+ createdAt: string;
301
+ createdBy?: string;
302
+ updatedAt: string;
303
+ updatedBy?: string;
304
+ acl?: Acl;
305
+ contentSize?: number;
306
+ allowWrite?: boolean;
307
+ allowPublish?: boolean;
308
+ }[];
309
+ };
310
+ type FolderListingWithItem = {
311
+ children: {
312
+ item: {
313
+ _id: string;
314
+ name: string;
315
+ folder?: string;
316
+ visibility: number;
317
+ createdAt: string;
318
+ createdBy?: string;
319
+ updatedAt: string;
320
+ updatedBy?: string;
321
+ filesize?: number;
322
+ filename?: string;
323
+ acl?: Acl;
324
+ hash?: string;
325
+ mimeType?: string;
326
+ type: string;
327
+ packageType?: string;
328
+ allowConversation?: boolean;
329
+ attachments?: Attachments;
330
+ };
331
+ }[];
332
+ };
333
+ type FolderListingWithItemStats = {
334
+ children: {
335
+ item: {
336
+ counts: {
337
+ views?: number;
338
+ downloads?: number;
339
+ trafficBytes?: number;
340
+ };
341
+ };
342
+ }[];
343
+ };
344
+ type FolderListingWithItemLatestPackage = {
345
+ children: {
346
+ item: {
347
+ latestPackage?: string;
348
+ };
349
+ }[];
350
+ };
351
+ type FolderListingOptionsMap = {
352
+ resolveNames: {};
353
+ folderAsItemType: FolderListingWithItem;
354
+ folderAsItemName: FolderListingWithItem;
355
+ folderAsItemFlag: FolderListingWithItem;
356
+ withStats: FolderListingWithItemStats;
357
+ returnLatestPackage: FolderListingWithItemLatestPackage;
358
+ };
359
+ type FolderListingOptions = {
360
+ resolveNames?: boolean;
361
+ folderAsItemType?: string;
362
+ folderAsItemName?: string;
363
+ folderAsItemFlag?: string;
364
+ withStats?: boolean;
365
+ returnLatestPackage?: boolean;
366
+ };
367
+ type FolderListingWithOptions<O extends FolderListingOptions> = FolderListing & OptionalResponses<FolderListingOptions, FolderListingOptionsMap, O>;
368
+ type ItemQuery = {
369
+ _id: string;
370
+ name: string;
371
+ type: string;
372
+ mimeType?: string;
373
+ packageType?: string;
374
+ hash?: string;
375
+ acl?: Acl;
376
+ visibility?: number;
377
+ folder?: string;
378
+ createdBy?: string;
379
+ updatedBy?: string;
380
+ createdAt: string;
381
+ updatedAt: string;
382
+ quotaUser?: string;
383
+ quotaGroup?: string;
384
+ tags?: string[];
385
+ contributors?: string[];
386
+ categories?: string[];
387
+ links?: {
388
+ to: string;
389
+ usage: string;
390
+ }[];
391
+ license?: string;
392
+ filesize?: number;
393
+ filename?: string;
394
+ itemSize?: number;
395
+ totalSize?: number;
396
+ }[];
397
+ type ItemQueryOptionsMap = {
398
+ fulltext: {
399
+ score: number;
400
+ }[];
401
+ client: {};
402
+ types: {};
403
+ includePackagedTypes: {};
404
+ onlyPackagedTypes: {};
405
+ name: {};
406
+ folderName: {};
407
+ user: {};
408
+ categories: {};
409
+ licenses: {};
410
+ tags: {};
411
+ flags: {};
412
+ contributors: {};
413
+ anyCategories: {};
414
+ anyTags: {};
415
+ anyFlags: {};
416
+ anyContributors: {};
417
+ mimeType: {};
418
+ quotaUser: {};
419
+ quotaGroup: {};
420
+ attribute: {};
421
+ attributeValue: {};
422
+ userAttribute: {};
423
+ userAttributeValue: {};
424
+ withAttributes: {
425
+ attributes?: Record<string, unknown>;
426
+ }[];
427
+ withUserAttributes: {
428
+ userAttributes?: Record<string, unknown>;
429
+ }[];
430
+ withProperties: {
431
+ properties: Record<string, string>;
432
+ }[];
433
+ withAttachmentInfo: {
434
+ attachments: {
435
+ name?: string;
436
+ index?: number;
437
+ queryParam?: number;
438
+ filesize?: number;
439
+ mimeType?: string;
440
+ hash?: string;
441
+ }[];
442
+ }[];
443
+ withStats: {
444
+ counts: {
445
+ views?: number;
446
+ downloads?: number;
447
+ trafficBytes?: number;
448
+ };
449
+ }[];
450
+ withThumbnailCount: {
451
+ thumbnailCount: number;
452
+ }[];
453
+ withFolderName: {
454
+ folderName?: string;
455
+ }[];
456
+ withLatestPackage: {
457
+ latestPackage?: any;
458
+ }[];
459
+ resolveQuotaUser: {
460
+ quotaUserObject?: {
461
+ _id: string;
462
+ name: string;
463
+ };
464
+ }[];
465
+ resolveQuotaGroup: {
466
+ quotaGroupObject?: {
467
+ _id: string;
468
+ name: string;
469
+ };
470
+ }[];
471
+ userAttributeTemplate: {};
472
+ dateFrom: {};
473
+ dateTo: {};
474
+ sort: {};
475
+ sortOrder: {};
476
+ pageSize: {};
477
+ pageIndex: {};
478
+ isStaffPick: {
479
+ featureWeight?: number;
480
+ }[];
481
+ };
482
+ type ItemQueryOptionsBase = {
483
+ fullText?: string;
484
+ client?: string;
485
+ types?: string[];
486
+ includePackagedTypes?: boolean;
487
+ onlyPackagedTypes?: boolean;
488
+ name?: string;
489
+ folderName?: string;
490
+ user?: string;
491
+ categories?: string;
492
+ licenses?: string;
493
+ tags?: string[];
494
+ flags?: string[];
495
+ contributors?: string[];
496
+ anyCategories?: boolean;
497
+ anyTags?: boolean;
498
+ anyFlags?: boolean;
499
+ anyContributors?: boolean;
500
+ mimeType?: string;
501
+ quotaUser?: string;
502
+ quotaGroup?: string;
503
+ returnIdOnly?: boolean;
504
+ returnCountOnly?: boolean;
505
+ returnHashesAndDatesOnly?: boolean;
506
+ withAttributes?: boolean;
507
+ withUserAttributes?: boolean;
508
+ withProperties?: boolean;
509
+ withAttachmentInfo?: boolean;
510
+ withStats?: boolean;
511
+ withThumbnailCount?: boolean;
512
+ withFolderName?: boolean;
513
+ withLatestPackage?: boolean;
514
+ resolveQuotaUser?: boolean;
515
+ resolveQuotaGroup?: boolean;
516
+ userAttributeTemplate?: string;
517
+ dateFrom?: string;
518
+ dateTo?: string;
519
+ sort?: string;
520
+ sortOrder?: string;
521
+ pageSize?: number;
522
+ pageIndex?: number;
523
+ isStaffPick?: boolean;
524
+ };
525
+ type ItemQueryOptions = ItemQueryOptionsBase & AllOrNothing<{
526
+ attribute: string;
527
+ attributeValue: string;
528
+ }> & AllOrNothing<{
529
+ userAttribute: string;
530
+ userAttributeValue: string;
531
+ }>;
532
+ type ItemQueryWithOptions<O extends ItemQueryOptions> = O["returnCountOnly"] extends true ? number : O["returnIdOnly"] extends true ? {
533
+ _id: string;
534
+ }[] : O["returnHashesAndDatesOnly"] extends true ? {
535
+ _id: string;
536
+ hash?: string;
537
+ updatedAt: string;
538
+ }[] : ItemQuery & OptionalResponses<ItemQueryOptions, ItemQueryOptionsMap, O>;
539
+ type Me = {
540
+ _id: string;
541
+ name: string;
542
+ displayName?: string;
543
+ client: string;
544
+ clientId: string;
545
+ memberships: {
546
+ permissions?: string[];
547
+ admin?: boolean;
548
+ primary?: boolean;
549
+ contacts?: {
550
+ addedAt?: string;
551
+ user?: string;
552
+ }[];
553
+ client: string;
554
+ paymentSetup?: string;
555
+ storageQuotaGb?: number;
556
+ storageUsedGb?: number;
557
+ trafficQuotaGb?: number;
558
+ usedTrafficQuotaBytes?: number;
559
+ allowedJobtypes?: string[];
560
+ allowedDatatypes?: string[];
561
+ allowedFeatures?: string[];
562
+ attributes?: Record<string, unknown>;
563
+ properties?: Record<string, unknown>;
564
+ }[];
565
+ account: string;
566
+ superadmin?: boolean;
567
+ admin?: boolean;
568
+ location?: string;
569
+ permissions?: string[];
570
+ groups: {
571
+ _id: string;
572
+ name: string;
573
+ hasFolder: boolean;
574
+ }[];
575
+ emailToConfirm?: string;
576
+ emailConfirmationDate?: string;
577
+ paymentSetup?: {
578
+ cardInfo: {
579
+ last4?: string;
580
+ brand?: string;
581
+ exp_month?: number;
582
+ exp_year?: number;
583
+ };
584
+ currency: string;
585
+ address: {
586
+ email?: string;
587
+ name?: string;
588
+ street?: string;
589
+ zipcode?: string;
590
+ city?: string;
591
+ country?: string;
592
+ };
593
+ };
594
+ storageQuotaGb: number;
595
+ storageUsedGb: number;
596
+ features: string[];
597
+ };
598
+ type UserInfo = {
599
+ avatar?: string;
600
+ initials: string;
601
+ name?: string;
602
+ displayName?: string;
603
+ properties?: Record<string, unknown>;
604
+ };
605
+ type BaseBlogArticle = {
606
+ _id: string;
607
+ title: string;
608
+ tags: string[];
609
+ slug?: string;
610
+ };
611
+ type ProgressCallback = (percent: number, loaded: number, total: number | undefined) => void;
612
+ type ConversationEntry = {
613
+ _id: string;
614
+ text: string;
615
+ createdBy: {
616
+ _id: string;
617
+ name: string;
618
+ };
619
+ createdAt: string;
620
+ liked: boolean;
621
+ numLikes?: number;
622
+ location?: string;
623
+ };
624
+ type JobState = {
625
+ _id: string;
626
+ state?: number;
627
+ error?: string;
628
+ log?: string;
629
+ progress?: number;
630
+ startedAt?: string;
631
+ stoppedAt?: string;
632
+ attempts?: number;
633
+ };
634
+
635
+ declare class UserCache {
636
+ apiClient: ApiClient;
637
+ cache: Map<string, Promise<UserInfo>>;
638
+ /**
639
+ *
640
+ * @param apiClient {ApiClient}
641
+ */
642
+ constructor(apiClient: ApiClient);
643
+ /**
644
+ *
645
+ * @param id {string}
646
+ * @return {Promise<*>}
647
+ */
648
+ resolve(id: string): Promise<UserInfo | undefined>;
649
+ }
650
+
651
+ declare class GroupCache {
652
+ apiClient: ApiClient;
653
+ cache: Map<string, any>;
654
+ constructor(apiClient: ApiClient);
655
+ resolve(id: string): Promise<any>;
656
+ }
657
+
658
+ declare class AttachmentCache {
659
+ apiClient: ApiClient;
660
+ cache: Map<string, any>;
661
+ constructor(apiClient: ApiClient);
662
+ get(itemId: string, attachmentName: string, queryParam: number, index: number, forcePublic?: boolean): Promise<any>;
663
+ invalidateAttachment(itemId: string, attachmentName: string, queryParam?: number, index?: number): void;
664
+ }
665
+
666
+ declare class JobEntry {
667
+ id: string;
668
+ job?: JobState;
669
+ nextCheckMs: number;
670
+ constructor(id: string, nextCheckMs: number, job?: JobState);
671
+ }
672
+ declare class JobManager {
673
+ apiClient: ApiClient;
674
+ jobs: Map<string, JobEntry>;
675
+ constructor(apiClient: any);
676
+ getJobs(): JobEntry[];
677
+ execute(type: string, elements: any[], parameters: any[], progressCallback?: Function | undefined): Promise<JobState>;
678
+ }
679
+
680
+ type PublishedVersion = {
681
+ itemId: string;
682
+ folderId: string;
683
+ version: string;
684
+ name: string;
685
+ filesize: number;
686
+ visibility: number;
687
+ };
688
+ declare class Publisher {
689
+ apiClient: ApiClient;
690
+ itemRepo: ItemRepo;
691
+ jobManager: JobManager;
692
+ items: any[];
693
+ hasExternalResources: boolean;
694
+ totalSize: number;
695
+ affectedFolderIds: Set<string>;
696
+ constructor(apiClient: ApiClient);
697
+ _updateQuota(): void;
698
+ getPreviousVersions(projectFolderId: string, subfolderName: string): Promise<PublishedVersion[]>;
699
+ verify(item: any): Promise<boolean>;
700
+ getItems(): any[];
701
+ unpackToProject(packageItemId: string, projectFolderId: string, subdirectoryName: string | undefined, updateCallback: Function | undefined): Promise<string | undefined>;
702
+ copyItemToProject(itemId: string, projectFolderId: string, subdirectoryName: string, updateCallback?: Function): Promise<string>;
703
+ copyItemsToProject(itemIds: any[], projectFolderId: string, subdirectoryName: string, updateCallback?: Function): Promise<{
704
+ oldId: string;
705
+ newId: string;
706
+ }[]>;
707
+ copyToProject(projectFolderId: string, subdirectoryName: string, updateCallback: Function | undefined): Promise<{
708
+ oldId: string;
709
+ newId: string;
710
+ }[]>;
711
+ unpublish(packageId: string): Promise<void>;
712
+ publish(item: any, name: string, projectFolderId: string, subfolderPath: string, makePublic: boolean, copyExternal: boolean, createNewPackage: boolean): Promise<void>;
713
+ }
714
+
715
+ declare class Snapshotable {
716
+ ownerItem: PreparedItem | undefined;
717
+ constructor(ownerItem?: PreparedItem | undefined);
718
+ createSnapshot(): void;
719
+ restoreFromSnapshot(snapshot: Snapshot, parent: any): void;
720
+ rollbackFromSnapshot(snapshot: Snapshot): void;
721
+ _getElementById(id: string, array: any[]): any;
722
+ _rollbackArray(array: any[], arraySnapshot: Snapshot[], elementCreator: any): void;
723
+ }
724
+
725
+ declare class ScriptField extends Snapshotable {
726
+ id: string;
727
+ name: string | undefined;
728
+ displayName: string | undefined;
729
+ value: any;
730
+ script: Script | undefined;
731
+ type: string | undefined;
732
+ datatype: string | undefined;
733
+ minValue: number | undefined;
734
+ maxValue: number | undefined;
735
+ order: number;
736
+ inject: any | undefined;
737
+ info: string | undefined;
738
+ constructor(script?: Script | undefined, name?: string | undefined, value?: any | undefined, item?: PreparedItem | undefined);
739
+ getId(): string;
740
+ setName(name: string | undefined): void;
741
+ setOrder(order: number): void;
742
+ setInfo(info: string): void;
743
+ clone(fieldOverrides?: Map<string, string>): ScriptField;
744
+ clearDefinition(): void;
745
+ setDefinition(def: any): void;
746
+ _toBoolean(value: any): any;
747
+ _updateDisplayName(): void;
748
+ _parseTypeParams(text: string, expectedCount: number): string[] | null;
749
+ createSnapshot(): Snapshot;
750
+ }
751
+
752
+ type ScriptItem = {
753
+ value: PreparedItem | undefined;
754
+ linkableItems: string[];
755
+ linkableTypes: string[];
756
+ };
757
+ declare class Script extends Snapshotable {
758
+ id: string | undefined;
759
+ block: Block | undefined;
760
+ fields: ScriptField[];
761
+ item: ScriptItem | null;
762
+ deferInitCall: boolean;
763
+ constructor(id?: string | Snapshot | undefined, block?: Block | undefined, item?: PreparedItem | undefined, scriptItem?: PreparedItem | undefined);
764
+ getId(): string | undefined;
765
+ makeIdsUnique(map: Map<string, string>, force?: boolean): void;
766
+ transformNodeIds(map: Map<string, string>): void;
767
+ clone(cloneIdMapping?: Map<string, string>): Script;
768
+ createFieldsFromDefinition(fieldDefArray?: any[]): void;
769
+ clearFieldTypes(): void;
770
+ addField(scriptField: ScriptField): void;
771
+ createSnapshot(): Snapshot;
772
+ restoreFromSnapshot(snapshot: Snapshot, block: Block | undefined): void;
773
+ rollbackFromSnapshot(snapshot: Snapshot): void;
774
+ }
775
+
776
+ declare class Block extends Snapshotable {
777
+ id: string;
778
+ parent: Block | undefined;
779
+ type: string | undefined;
780
+ name: string;
781
+ displayName: string;
782
+ fields: Field[];
783
+ blocks: Block[];
784
+ isSelected: boolean;
785
+ isExpanded: boolean;
786
+ scripts: Script[];
787
+ inputs: any[];
788
+ outputs: any[];
789
+ posX: number;
790
+ posY: number;
791
+ constructor(id?: string | Snapshot | undefined, parent?: Block | undefined, type?: string | undefined, name?: string | undefined, displayName?: string | undefined, item?: PreparedItem | undefined);
792
+ getId(): string;
793
+ refreshFieldDependencies(): void;
794
+ resetFieldValues(withChildren?: boolean): void;
795
+ makeIdsUnique(map?: Map<string, string>, force?: boolean): Map<string, string>;
796
+ transformNodeIds(map: Map<string, string>): void;
797
+ clone(proxyItem: PreparedItem | undefined, cloneScripts?: boolean, fieldOverrides?: any, keepBlockIds?: boolean): Block;
798
+ getDescendantBlocks(descendantBlocks?: Block[]): Block[];
799
+ setFields(fields: Field[]): void;
800
+ setInputs(inputs: any[]): void;
801
+ setOutputs(outputs: any[]): void;
802
+ setPosition(x: number, y: number): void;
803
+ setSelected(value: boolean): void;
804
+ setExpanded(value: boolean): void;
805
+ getRoot(): Block;
806
+ forEachField(func: (field: Field) => void): void;
807
+ findField(name: string): Field | null;
808
+ findBlock(id: string): Block | null;
809
+ removeBlock(block: Block): void;
810
+ addBlock(block: Block, position: number): void;
811
+ moveBlock(block: Block, position: number): void;
812
+ moveToPosition(position: number): void;
813
+ moveBlockToParent(newParent: Block, position?: number): void;
814
+ moveToParent(parentId: string, position?: number): void;
815
+ getField(name: string): Field | null;
816
+ hasTag(tag: string): boolean;
817
+ hasOneTag(tags: string[]): boolean;
818
+ getNameFieldValue(): any;
819
+ getActiveFieldValue(): any;
820
+ createSnapshot(dontRecurseIntoBlocks?: boolean): Snapshot;
821
+ restoreFromSnapshot(snapshot: Snapshot, parent: Block | undefined): void;
822
+ rollbackFromSnapshot(snapshot: Snapshot, dontRecurseIntoBlocks?: boolean): void;
823
+ _getFieldByName(name: string, fields: Field[]): Field | null;
824
+ }
825
+
826
+ declare class Connection extends Snapshotable {
827
+ id: string;
828
+ srcNode: string;
829
+ srcSlot: number;
830
+ destNode: string;
831
+ destSlot: number;
832
+ posX: number;
833
+ posY: number;
834
+ constructor(data: any, item: PreparedItem);
835
+ getId(): string;
836
+ setPosition(x: number, y: number): void;
837
+ getPosX(): number;
838
+ getPosY(): number;
839
+ getSrcNode(): string;
840
+ getDestNode(): string;
841
+ getSrcSlot(): number;
842
+ getDestSlot(): number;
843
+ setSrcNode(value: string): void;
844
+ setDestNode(value: string): void;
845
+ setSrcSlot(value: number): void;
846
+ setDestSlot(value: number): void;
847
+ clone(): Connection;
848
+ createSnapshot(): Snapshot;
849
+ restoreFromSnapshot(snapshot: Snapshot): void;
850
+ rollbackFromSnapshot(snapshot: Snapshot): void;
851
+ }
852
+
853
+ declare class ItemCache {
854
+ itemCache: Map<string, any>;
855
+ apiGateway: ApiGateway;
856
+ constructor(apiGateway: any);
857
+ clear(): void;
858
+ getItem(id: string): Promise<any>;
859
+ }
860
+
861
+ declare class LinkableItemsCache {
862
+ linkableItemsCache: Map<string, any[]>;
863
+ apiGateway: ApiGateway;
864
+ itemCache: ItemCache;
865
+ usePublicApi: boolean;
866
+ constructor(apiGateway: ApiGateway, itemCache: ItemCache, usePublicApi?: boolean);
867
+ clear(): void;
868
+ resolveItem(id: string, linkableItems: any[]): any;
869
+ loadLinkableItems(item: any, field: Field): Promise<any[] | undefined>;
870
+ }
871
+
872
+ declare class Template {
873
+ fields: Field[];
874
+ constructor(fields: Field[]);
875
+ clone(): Template;
876
+ /**
877
+ * Changes the default values of the template
878
+ * @param fieldValues object an object with new values for every field that should be changed
879
+ */
880
+ specialize(fieldValues: any): this;
881
+ instantiate(): Field[];
882
+ }
883
+
884
+ type TemplateEntry = {
885
+ typeName: string;
886
+ displayName: string;
887
+ template: Template;
888
+ inputs: any[];
889
+ outputs: any[];
890
+ };
891
+
892
+ declare class Field extends Snapshotable {
893
+ name: string;
894
+ displayName: string;
895
+ type: string | undefined;
896
+ info?: string;
897
+ preload: boolean;
898
+ loadingManagerRule: string;
899
+ item: PreparedItem | undefined;
900
+ itemRepo: ItemRepo | undefined;
901
+ condition: any;
902
+ conditionFields: Field[];
903
+ conditionFieldNames: string[];
904
+ dependantFields: Field[];
905
+ dependenciesInitialized: boolean;
906
+ linkableTypes: string[];
907
+ linkableItemsCache: LinkableItemsCache | undefined;
908
+ collapsed: boolean;
909
+ presets: any[];
910
+ datatype: string | null;
911
+ defaultValue: any;
912
+ minValue: any;
913
+ maxValue: any;
914
+ language: string | null;
915
+ widget: string | null;
916
+ length: number | null;
917
+ labelType: string | null;
918
+ blocks: Block[];
919
+ connections: Connection[];
920
+ templates: TemplateEntry[];
921
+ elementName: string | null;
922
+ private _id;
923
+ private _internalValue;
924
+ private _internalOptions;
925
+ private _updateConditions;
926
+ private _hidden;
927
+ get hidden(): boolean;
928
+ get id(): string;
929
+ get options(): string[];
930
+ set options(value: string[]);
931
+ get value(): any;
932
+ set value(value: any);
933
+ get linkableItems(): Promise<any[] | undefined> | never[];
934
+ constructor(name: string | Snapshot, displayName?: string | undefined, type?: string | undefined, value?: any | undefined, item?: PreparedItem | undefined, itemRepo?: ItemRepo | undefined, linkableItemsCache?: LinkableItemsCache | undefined);
935
+ updateConditions(): void;
936
+ getId(): string;
937
+ resetValue(): void;
938
+ makeIdsUnique(map?: Map<string, string>, force?: boolean): Map<string, string>;
939
+ transformNodeIds(map: any): void;
940
+ findBlock(id: any): Block | null;
941
+ clone(proxyItem?: PreparedItem | undefined, keepBlockIds?: boolean): Field;
942
+ _processDependencies(): void;
943
+ _getConditionField(name: string): Field | null;
944
+ _calculateConditionField(name: string, value: any): boolean;
945
+ _calculateConditionBlock(condition: any): boolean;
946
+ refreshFieldDependencies(): void;
947
+ refreshDependantFields(fieldMap: Map<string, Field>, dependantFields?: Field[]): void;
948
+ setCondition(condition: any): void;
949
+ _scanConditions(condition: any): void;
950
+ forEachField(func: (field: Field) => void): void;
951
+ setInfo(info: string): void;
952
+ setPreload(preload: boolean): void;
953
+ setLoadingManagerRule(rule: string): void;
954
+ setLinkableTypes(types: string[]): void;
955
+ setDefaultValue(value: any): void;
956
+ setMinValue(value: any): void;
957
+ setMaxValue(value: any): void;
958
+ setOptions(options: string[]): void;
959
+ setDatatype(datatype: string): void;
960
+ setLanguage(language: any): void;
961
+ setLength(length: any): void;
962
+ setWidget(widget: any): void;
963
+ setBlocks(blocks: any): void;
964
+ setConnections(connections: any): void;
965
+ setTemplates(templates: any): void;
966
+ setElementName(name: any): void;
967
+ setCollapsed(value: any): void;
968
+ setPresets(value: any): void;
969
+ setLabelType(value: string): void;
970
+ createSnapshot(dontRecurseIntoBlocks?: boolean): Snapshot;
971
+ restoreFromSnapshot(snapshot: Snapshot): void;
972
+ rollbackFromSnapshot(snapshot: any): void;
973
+ }
974
+
975
+ declare class PreparedItem extends AggregatedItem {
976
+ links?: {
977
+ to: string;
978
+ usage: string;
979
+ stopRecursion?: boolean;
980
+ item?: PreparedItem;
981
+ }[];
982
+ instanceId: string;
983
+ isDirty: boolean;
984
+ fieldInstances: Field[];
985
+ userFieldInstances: Field[];
986
+ packageContent?: PreparedItem;
987
+ packageType?: string;
988
+ public: boolean;
989
+ readOnly: boolean;
990
+ isPackaged: boolean;
991
+ packageItem?: PreparedItem;
992
+ readonly isPreparedItem: boolean;
993
+ resultingAcl?: Acl;
994
+ constructor(data: any);
995
+ markDirty(): void;
996
+ makeIdsUnique(): void;
997
+ clone(makeIdsUnique?: boolean): PreparedItem;
998
+ findBlock(id: string): Block | null;
999
+ refreshFieldDependencies(): void;
1000
+ forEachItem(func: (item: PreparedItem) => void): void;
1001
+ forEachFieldInstance(func: (field: Field) => void): void;
1002
+ toString(): string;
1003
+ }
1004
+
1005
+ declare class UploadItem {
1006
+ name: string;
1007
+ blob: Blob;
1008
+ processing: boolean;
1009
+ progress: number;
1010
+ size: number;
1011
+ type?: string;
1012
+ collectionType?: string;
1013
+ collectionEntryName?: string;
1014
+ action?: string;
1015
+ actions?: string[];
1016
+ folderName?: string;
1017
+ itemType?: string;
1018
+ constructor(name: string, blob: Blob, ext: string);
1019
+ }
1020
+ type DetectionResult = {
1021
+ valid: boolean;
1022
+ assetType?: string;
1023
+ itemCount?: number;
1024
+ folderName?: string;
1025
+ reason?: string;
1026
+ };
1027
+ type ItemEntry = {
1028
+ _id: string;
1029
+ name: string;
1030
+ type: string;
1031
+ size: number;
1032
+ path: string;
1033
+ item: PreparedItem;
1034
+ external: boolean;
1035
+ };
1036
+ declare class AssetCreator {
1037
+ apiClient: ApiClient;
1038
+ itemRepo: ItemRepo;
1039
+ jobManager: JobManager;
1040
+ items: ItemEntry[];
1041
+ mainItem: any;
1042
+ totalSize: number;
1043
+ oldMainItemId?: string;
1044
+ originalItemIds: string[];
1045
+ affectedFolderIds: Set<string>;
1046
+ packageId?: string;
1047
+ converter?: Function;
1048
+ supportedExtensions: string[];
1049
+ hasExternalResources: boolean;
1050
+ constructor(apiClient: ApiClient);
1051
+ _updateQuota(): void;
1052
+ _addAffectedFolder(folder: any): void;
1053
+ getAffectedFolderIds(): string[];
1054
+ /**
1055
+ * Return list of supported file extensions
1056
+ * @return {*[string]}
1057
+ */
1058
+ getSupportedExtensions(): string[];
1059
+ /**
1060
+ * Set a converter function. That way items can be converted before uploading
1061
+ * @param converter
1062
+ */
1063
+ setConverter(converter: Function): void;
1064
+ setItems(items: any[]): void;
1065
+ /**
1066
+ * Scan an item Id for all required items that are linked by it. Returns a list of items
1067
+ * @param itemId Item Id to search. Typically a project item.
1068
+ * @return {Promise<[]|any[]|*>}
1069
+ */
1070
+ scan(itemId: string): Promise<ItemEntry[]>;
1071
+ /**
1072
+ * Get previously scanned items
1073
+ * @return {[]|any[]|*}
1074
+ */
1075
+ getItems(): ItemEntry[];
1076
+ /**
1077
+ * Save the main item's changes back to cloud
1078
+ * @return {Promise<void>}
1079
+ */
1080
+ saveMainItemChanges(): Promise<void>;
1081
+ /**
1082
+ * Create a folder for an asset.
1083
+ * @param {number} rootFolderId Root folder id of where the asset should be created
1084
+ * @param {string} path Path to the actual asset folder
1085
+ * @return {Promise<*>} Promise that resolves to the folder's Id
1086
+ */
1087
+ createAssetFolder(rootFolderId: any, path: any): Promise<any>;
1088
+ /**
1089
+ * Creates the standard folder path for an asset based on type and name
1090
+ * @param item
1091
+ * @return {string}
1092
+ */
1093
+ createStandardAssetFolderPath(item: any): string;
1094
+ /**
1095
+ * Execute any actions on the items
1096
+ * @return {Promise<void>}
1097
+ */
1098
+ executeActions(): Promise<any>;
1099
+ /**
1100
+ * Create an asset from already existing items
1101
+ * @param {string} assetFolderId The asset folder's Id
1102
+ * @param {boolean} moveItems Move the items or copy them.
1103
+ * @param {function} updateCallback callback for progress. It will be passed the job object of the copy
1104
+ * @return {Promise<*>}
1105
+ */
1106
+ createAsset(assetFolderId: string, moveItems?: boolean, updateCallback?: Function): Promise<any>;
1107
+ /**
1108
+ * Create a package from the main item. The package will have the name of the main item
1109
+ * @param {string} subfolderPath subfolder path to where the package should be created. Default is published/<version>
1110
+ * @param {boolean} makePublic make the package public. Default is true
1111
+ * @param {boolean} copyExternal Copy external items into the package. Default is false
1112
+ * @return {Promise<void>}
1113
+ */
1114
+ createPackage(subfolderPath: string, makePublic?: boolean, copyExternal?: boolean): Promise<void>;
1115
+ /**
1116
+ * Replace any references to the old main item id with the package id
1117
+ * @return {Promise<void>}
1118
+ */
1119
+ replaceReferences(): Promise<void>;
1120
+ /**
1121
+ * Delete the original items
1122
+ * @return {Promise<void>}
1123
+ */
1124
+ deleteOriginalItems(): Promise<void>;
1125
+ /**
1126
+ * Send a folder refresh event for all affected folders
1127
+ */
1128
+ sendFolderRefreshEvent(): void;
1129
+ /**
1130
+ * Process uploaded files and unpackage any included ZIP files. Returns a list of processed items with their type, blob
1131
+ * and possible actions.
1132
+ * @param {Array<File>} files files to process
1133
+ * @return {Promise<*[]>} List of processed files
1134
+ */
1135
+ processUploads(files: File[]): Promise<UploadItem[]>;
1136
+ /**
1137
+ * Detect assets to be created from the processed files
1138
+ * @param processedFiles
1139
+ */
1140
+ detectAssets(processedFiles: any[]): DetectionResult;
1141
+ _filterUploadFiles(files: any[]): any[];
1142
+ /**
1143
+ * Create a new empty item with default values
1144
+ * @return {Object}
1145
+ */
1146
+ createNewItem(): {
1147
+ name: string;
1148
+ type: string;
1149
+ description: string;
1150
+ shortDescription: string;
1151
+ tags: never[];
1152
+ flags: string[];
1153
+ categories: never[];
1154
+ license: string;
1155
+ allowConversation: boolean;
1156
+ version: {
1157
+ major: number;
1158
+ minor: number;
1159
+ revision: number;
1160
+ };
1161
+ };
1162
+ /**
1163
+ * Create asset from processed files. If successful, this function will fill _id and folder fields in itemData and store it so it
1164
+ * can be used with the createPackage() method.
1165
+ * @param {Array<object>} processedFiles processed files list to use for the asset
1166
+ * @param {string} assetBaseFolderId base folder ID for assets. Below this folder there will be an asset type folder like "textures" and then a folder for the asset.
1167
+ * @param {Object} itemData item properties. most notable name and type
1168
+ * @param {string} itemData.name name of the asset
1169
+ * @param {string} itemData.type type of the asset. the processed files need to be compatible with that type
1170
+ * @param {string} itemData.shortDescription
1171
+ * @param {string} itemData.description
1172
+ * @param {string} itemData.tags
1173
+ * @param {string} itemData.categories
1174
+ * @param {boolean} forceReplace if true, the asset will replace anything that already exists in the target location
1175
+ * @param {boolean} [returnFolderInfo] if true, the function will return an object containing the item and the parent folder.
1176
+ * @return {Promise<any>}
1177
+ */
1178
+ createAssetFromFiles(processedFiles: any[], assetBaseFolderId: string, itemData: any, forceReplace?: boolean, returnFolderInfo?: boolean): Promise<any>;
1179
+ }
1180
+
1181
+ declare class Serializer {
1182
+ apiClient: ApiClient;
1183
+ itemRepo: ItemRepo;
1184
+ constructor(apiClient: ApiClient);
1185
+ /**
1186
+ * Grab elements from the project and serialize them
1187
+ * @param {PreparedItem} item source item to grab from
1188
+ * @param {Field} field source field to grab from
1189
+ * @param {Block[]} blocks the blocks to serialize
1190
+ * @param {object} options
1191
+ * @param {boolean} [options.withChildren] return children of block also
1192
+ * @param {boolean} [options.returnArray] return result as array, not json string
1193
+ * @param {boolean} [options.omitPath] don't return path
1194
+ * @return {string|*[]}
1195
+ */
1196
+ grab(item: PreparedItem, field: Field, blocks: Block[], options: any): string | any[];
1197
+ /**
1198
+ * Put elements in the project
1199
+ * @param msg the data to use to create new elements in the project
1200
+ * @param field the field name
1201
+ * @param targetBlock the target block to put the elements in case the data contains blocks
1202
+ * @param {object} options
1203
+ * @param {boolean} [options.dontCopyScripts] if true, scripts will not be copied
1204
+ * @param {boolean} [putOptions.fieldOverrides] if true, field overrides will be applied to new blocks
1205
+ */
1206
+ put(msg: any, field: Field, targetBlock: Block, options?: any): Promise<any[]>;
1207
+ /**
1208
+ * Validate the clipboard message and parse it if necessary.
1209
+ * @param msg the message to be validated
1210
+ * @return {object}
1211
+ */
1212
+ validateMessage(msg: any): any;
1213
+ /**
1214
+ * Clone a block from the source block to the new parent block.
1215
+ * @param {object} srcBlock source block to grab from
1216
+ * @param {string} field source field to grab from
1217
+ * @param {object} newParentBlock new parent block to place the cloned block into
1218
+ * @param {PreparedItem} grabFromItem item to grab from.
1219
+ * @param {object} putOptions
1220
+ * @param {boolean} [putOptions.dontCopyScripts] if true, scripts will not be copied
1221
+ * @param {boolean} [putOptions.fieldOverrides] if true, field overrides will be applied to new blocks
1222
+ * @return {object}
1223
+ */
1224
+ clone(srcBlock: Block, field: Field, newParentBlock: Block, grabFromItem: PreparedItem, putOptions?: any): Promise<any[]>;
1225
+ _updateScriptFieldReferences(oldBlockSerialized: any, newBlock: Block): void;
1226
+ _putBlock(entry: any, field: Field, targetBlock: Block, options?: any, attachToParent?: boolean): Promise<any>;
1227
+ _createUnproxifiedBlock(type: string, fieldOverrides: any, scriptsData: any[], field: Field, ownerItem: PreparedItem): Promise<Block | null>;
1228
+ _proxifyAndAttachTree(root: Block, parent: Block, ownerItem: PreparedItem): any;
1229
+ _findItemById(id: string): PreparedItem | undefined;
1230
+ _findItemField(item: PreparedItem, fieldName: string): Field | null;
1231
+ _findParentBlock(item: PreparedItem, fieldName: string, path: string): Block | null;
1232
+ _getBlockTemplate(field: Field, name: string): TemplateEntry | null;
1233
+ _getBlockIndex(block: Block): number;
1234
+ _getBlockPath(block: Block): string;
1235
+ private _serializeBlockFields;
1236
+ private _serializeScripts;
1237
+ }
1238
+
1239
+ declare const eventBus: EventEmitter;
1240
+
1241
+ declare global {
1242
+ interface Array<T> {
1243
+ pushAll(array: Array<T>): void;
1244
+ removeObject(obj: T): void;
1245
+ moveObjectToArray(object: T, targetArray: T[], targetIndex?: number): boolean;
1246
+ removeByFilterFunc(func: (t: T) => boolean): number;
1247
+ clone(): Array<T>;
1248
+ }
1249
+ }
1250
+
1251
+ type CollabUser = {
1252
+ id: string;
1253
+ key: number;
1254
+ name: string;
1255
+ avatar?: string;
1256
+ color: string;
1257
+ itsMe: boolean;
1258
+ };
1259
+ declare class Collab {
1260
+ apiClient: ApiClient;
1261
+ collabDocument: CollabDocument;
1262
+ yWebsocketProvider?: WebsocketProvider;
1263
+ item?: PreparedItem;
1264
+ awareness?: awarenessProtocol.Awareness;
1265
+ users: CollabUser[];
1266
+ avatars: Map<string, string | undefined>;
1267
+ constructor(apiClient: ApiClient);
1268
+ isActive(): boolean;
1269
+ getAwarenessStates(): Map<number, {
1270
+ [p: string]: any;
1271
+ }>;
1272
+ getUsersList(): CollabUser[];
1273
+ private _getUser;
1274
+ getLocalState(): {
1275
+ [x: string]: any;
1276
+ } | null;
1277
+ setLocalStateField(key: string, value: any): void;
1278
+ private _updateUsersList;
1279
+ startCollaboration(item: PreparedItem): Promise<boolean>;
1280
+ endCollaboration(): void;
1281
+ }
1282
+
1283
+ /**
1284
+ * @fileoverview ApiClient class for handling API interactions with the Lumino cloud service.
1285
+ * @module ApiClient
1286
+ */
1287
+
1288
+ /**
1289
+ * Enumeration for item visibility levels.
1290
+ * @readonly
1291
+ * @enum {number}
1292
+ */
1293
+ declare const ItemVisibility: {
1294
+ Draft: number;
1295
+ Private: number;
1296
+ NotListed: number;
1297
+ Public: number;
1298
+ };
1299
+
1300
+ type ApiClientOptions = {
1301
+ host: "auto" | string;
1302
+ viewerHost: "auto" | string;
1303
+ collabHost: "auto" | string;
1304
+ accessToken: string | null;
1305
+ apiToken: string | null;
1306
+ https: boolean;
1307
+ wsAutoReconnect: boolean;
1308
+ wsAutoConnect: boolean;
1309
+ viewerHttps: boolean;
1310
+ collabHttps: boolean;
1311
+ forcePublicApi: boolean;
1312
+ usePersistentStorage: boolean;
1313
+ storageSizeMib: number;
1314
+ requestClientId: string | null;
1315
+ path: string;
1316
+ websocketPath: string;
1317
+ debug: boolean;
1318
+ };
1319
+ /**
1320
+ * Class representing an ApiClient.
1321
+ * @extends EventEmitter
1322
+ */
1323
+ declare class ApiClient extends EventEmitter {
1324
+ accessToken: string | null;
1325
+ apiToken: string | null;
1326
+ options: ApiClientOptions;
1327
+ forcePublicApi: boolean;
1328
+ usePublicApi: boolean;
1329
+ usePersistentStorage: boolean;
1330
+ storageSizeMib: number;
1331
+ requestClientId: string | null;
1332
+ webProtocol: "https" | "http";
1333
+ wsProtocol: "wss" | "ws";
1334
+ viewerProtocol: "https" | "http";
1335
+ collabProtocol: "wss" | "ws";
1336
+ restUrl: string;
1337
+ wsUrl: string;
1338
+ viewerUrl: string;
1339
+ collabUrl: string;
1340
+ itemRepo: ItemRepo;
1341
+ itemCache: ItemCache$1;
1342
+ folderCache: FolderCache;
1343
+ thumbCache: ThumbCache;
1344
+ userCache: UserCache;
1345
+ groupCache: GroupCache;
1346
+ attachmentCache: AttachmentCache;
1347
+ jobManager: JobManager;
1348
+ serializer: Serializer;
1349
+ collab: Collab;
1350
+ eventBus: typeof eventBus;
1351
+ api: AxiosInstance;
1352
+ ws: WebSocket | null;
1353
+ cachedMe: Me | null;
1354
+ profiler: {
1355
+ start: (name: string, msg: string) => {
1356
+ done: () => void;
1357
+ };
1358
+ } | null;
1359
+ wsLastPing: Date | null;
1360
+ last2faCode: string;
1361
+ /**
1362
+ * Create an ApiClient.
1363
+ * @param {Object} options - Configuration options.
1364
+ */
1365
+ constructor(options?: Partial<ApiClientOptions>);
1366
+ initCaches(): Promise<[void, void, any]>;
1367
+ clearCaches(): void;
1368
+ isDevPlatform(): boolean;
1369
+ isOnLocalhost(): boolean;
1370
+ isDevOrLocalhost(): boolean;
1371
+ clearIndexedDb(name: string): Promise<void>;
1372
+ logout(): Promise<void>;
1373
+ setDebugMode(mode: boolean): void;
1374
+ /**
1375
+ * Connect to the websocket.
1376
+ * @param {boolean} force - Force reconnection if already connected.
1377
+ */
1378
+ websocketConnect(force?: boolean): void;
1379
+ /**
1380
+ * Disconnect from the websocket.
1381
+ */
1382
+ websocketDisconnect(): void;
1383
+ /**
1384
+ * Send a message over the websocket.
1385
+ * @param data - The message to send.
1386
+ */
1387
+ websocketSend(data: string): void;
1388
+ getCollab(): Collab;
1389
+ getCollabUrl(): string;
1390
+ /**
1391
+ * Get a new Publisher instance.
1392
+ * @returns {Publisher} The Publisher instance.
1393
+ */
1394
+ getPublisher(): Publisher;
1395
+ /**
1396
+ * Get a new AssetCreator instance
1397
+ * @return {AssetCreator} The AssetCreator instance.
1398
+ */
1399
+ getAssetCreator(): AssetCreator;
1400
+ /**
1401
+ * Get the Job Manager instance.
1402
+ * @returns {JobManager} The Job Manager instance.
1403
+ */
1404
+ getJobManager(): JobManager;
1405
+ /**
1406
+ * Get the Thumbnail Cache instance.
1407
+ * @returns {ThumbCache} The Thumbnail Cache instance.
1408
+ */
1409
+ getThumbCache(): ThumbCache;
1410
+ /**
1411
+ * Get the Item Cache instance.
1412
+ * @returns {ItemCache} The Item Cache instance.
1413
+ */
1414
+ getItemCache(): ItemCache$1;
1415
+ /**
1416
+ * Get the Item Repository instance.
1417
+ * @returns {ItemRepo} The Item Repository instance.
1418
+ */
1419
+ getItemRepo(): ItemRepo;
1420
+ /**
1421
+ * Get the visibility of the root item.
1422
+ * @returns {number} The visibility level.
1423
+ */
1424
+ getRootVisibility(): number;
1425
+ /**
1426
+ * Get the Event Bus instance.
1427
+ * @returns {Object} The Event Bus instance.
1428
+ */
1429
+ getEventBus(): EventEmitter;
1430
+ /**
1431
+ * Retrieve instance of the serializer
1432
+ * @return {*}
1433
+ */
1434
+ getSerializer(): Serializer;
1435
+ /**
1436
+ * Set the force public API option.
1437
+ * @param {boolean} value - The value to set.
1438
+ */
1439
+ setForcePublicApi(value: any): void;
1440
+ /**
1441
+ * Update the use of the public API based on the current configuration.
1442
+ * @private
1443
+ */
1444
+ _updateUsePublicApi(): void;
1445
+ /**
1446
+ * Set the API token.
1447
+ * @param {string} token - The API token.
1448
+ */
1449
+ setApiToken(token: any): void;
1450
+ /**
1451
+ * Set the access token.
1452
+ * @param {string} token - The access token.
1453
+ */
1454
+ setAccessToken(token: any): void;
1455
+ /**
1456
+ * Get the API token.
1457
+ * @returns {string} The API token.
1458
+ */
1459
+ getApiToken(): string | null;
1460
+ /**
1461
+ * Get the access token.
1462
+ * @returns The access token.
1463
+ */
1464
+ getAccessToken(): string | null;
1465
+ /**
1466
+ * Update the base URL.
1467
+ * @param {string} host - The new host.
1468
+ */
1469
+ updateBaseUrl(host: any): void;
1470
+ /**
1471
+ * Set the API base URL.
1472
+ * @param url - The new API base URL.
1473
+ */
1474
+ setApiBaseUrl(url: string): void;
1475
+ /**
1476
+ * Set the WebSocket base URL.
1477
+ * @param {string} url - The new WebSocket base URL.
1478
+ */
1479
+ setWsBaseUrl(url: any): void;
1480
+ /**
1481
+ * Set the request client ID.
1482
+ * @param {string} id - The client ID.
1483
+ */
1484
+ setRequestClientId(id: any): void;
1485
+ /**
1486
+ * Get the API base URL.
1487
+ * @returns {string} The API base URL.
1488
+ */
1489
+ getApiBaseUrl(): string;
1490
+ /**
1491
+ * Get the WebSocket base URL.
1492
+ * @returns {string} The WebSocket base URL.
1493
+ */
1494
+ getWsBaseUrl(): string;
1495
+ /**
1496
+ * Get the viewer base URL.
1497
+ * @returns {string} The viewer base URL.
1498
+ */
1499
+ getViewerBaseUrl(): string;
1500
+ /**
1501
+ * Set the profiler.
1502
+ * @param {Object} profiler - The profiler instance.
1503
+ * @throws {Error} If the profiler does not provide a start function.
1504
+ */
1505
+ setProfiler(profiler: any): void;
1506
+ /**
1507
+ * Logs in a user using two-factor authentication.
1508
+ *
1509
+ * @param account - The account identifier (username or email).
1510
+ * @param password - The account password.
1511
+ * @param client - The client identifier.
1512
+ */
1513
+ login2FA(account: string, password: string, client: string): Promise<void>;
1514
+ /**
1515
+ * Confirms the two-factor authentication code for a user.
1516
+ *
1517
+ * @param account - The account identifier (username or email).
1518
+ * @param code - The 2FA code.
1519
+ * @returns The session token.
1520
+ */
1521
+ confirm2FA(account: string, code: string): Promise<string>;
1522
+ /**
1523
+ * Checks if the user is authenticated.
1524
+ *
1525
+ * @returns {boolean} - True if the user is authenticated, false otherwise.
1526
+ */
1527
+ isAuthenticated(): boolean;
1528
+ /**
1529
+ * Checks if a feature is enabled. For this to work, cachedMe must be filled so at least one
1530
+ * call to me() must have been made.
1531
+ * @param feature
1532
+ */
1533
+ isFeatureEnabled(feature: any): boolean;
1534
+ /**
1535
+ * Resolves the user or group information for a given item.
1536
+ *
1537
+ * @param {Object} item - The item containing user or group information.
1538
+ * @param {string} item.quotaUser - The user quota identifier.
1539
+ * @param {string} item.quotaGroup - The group quota identifier.
1540
+ * @param {string} item.createdBy - The identifier of the user who created the item.
1541
+ * @returns {Promise<Object>} - A promise that resolves to an object containing the resolved user or group information.
1542
+ */
1543
+ resolveUserOrGroupInfoForItem(item: any): Promise<any>;
1544
+ /**
1545
+ * Start an operation that is being monitored for its running time. If it runs too long, events will be produced.
1546
+ * @param name
1547
+ * @return {{runningMs: number, name, startTimeMs: DOMHighResTimeStamp, finish: op.finish, reportProgress: op.reportProgress, percent: number}}
1548
+ * @private
1549
+ */
1550
+ _startOp(name: any): {
1551
+ id: string;
1552
+ name: any;
1553
+ startTimeMs: number;
1554
+ runningMs: number;
1555
+ percent: number;
1556
+ reportProgress: (percent: any) => void;
1557
+ interval: NodeJS.Timeout | null;
1558
+ finish: () => void;
1559
+ };
1560
+ _createOpName(method: any, resource: any): string;
1561
+ addAuthenticationHeaders(headers: any): void;
1562
+ /**
1563
+ * Execute an API request.
1564
+ * @param method - HTTP method.
1565
+ * @param resource - API resource path.
1566
+ * @param data - Request payload.
1567
+ * @param options - Options object
1568
+ * @param options.responseType - Response type.
1569
+ * @param options.withNext - Include pagination cursor.
1570
+ * @param options.progressCallback - Upload progress callback.
1571
+ * @param options.emitOnSuccess - Event to emit on success
1572
+ * @param options.headers - Additional headers to send
1573
+ * @param options.controller - Abort controller for the request.
1574
+ * @returns The response data.
1575
+ */
1576
+ execute(method: string, resource: string, data?: unknown, options?: Partial<{
1577
+ responseType: ResponseType;
1578
+ withNext: boolean;
1579
+ progressCallback?: ProgressCallback;
1580
+ emitOnSuccess: string;
1581
+ headers: {
1582
+ [key: string]: string;
1583
+ };
1584
+ controller: AbortController;
1585
+ opName: string;
1586
+ }>): Promise<any>;
1587
+ /**
1588
+ * Create a FormData instance from a buffer or file.
1589
+ * @param {Buffer|Blob} data - The file data
1590
+ * @param {string} filename - The filename.
1591
+ * @returns {FormData} The FormData instance.
1592
+ * @private
1593
+ */
1594
+ _createFormData(data: any, filename?: string): FormData;
1595
+ /**
1596
+ * Get the current user details.
1597
+ * @returns {Promise<Object>} The user details.
1598
+ */
1599
+ me(useFromCache: boolean): Promise<Me>;
1600
+ /**
1601
+ * Get the home folder.
1602
+ * @returns The ID of the home folder.
1603
+ */
1604
+ getHomeFolder(): Promise<string>;
1605
+ /**
1606
+ * Get the list of clients for the current user.
1607
+ * @returns {Promise<Array>} The list of clients.
1608
+ */
1609
+ myClients(): Promise<any>;
1610
+ getCollabToken(): Promise<any>;
1611
+ checkCollabToken(token: string): Promise<any>;
1612
+ /**
1613
+ * Register a new user.
1614
+ * @param data - The registration data.
1615
+ * @param data.account - The email address.
1616
+ * @param data.password - The password.
1617
+ * @param data.name - The unique username.
1618
+ * @param data.country - The country code for the new user.
1619
+ * @param data.clientInvitationToken - Optionally a token to be added to a
1620
+ * client automatically once this account is activated.
1621
+ */
1622
+ register(data: {
1623
+ account: string;
1624
+ password: string;
1625
+ name: string;
1626
+ country: string;
1627
+ clientInvitationToken?: string;
1628
+ }): Promise<void>;
1629
+ /**
1630
+ * Delete the current user account.
1631
+ * @param password - The password for confirmation.
1632
+ */
1633
+ deleteMyAccount(password: string): Promise<void>;
1634
+ /**
1635
+ * Confirm the user's email.
1636
+ * @param token - The email confirmation token.
1637
+ */
1638
+ confirmEmail(token: string): Promise<void>;
1639
+ /**
1640
+ * Confirm the change of email.
1641
+ * @param token - The email change confirmation token.
1642
+ */
1643
+ confirmEmailChange(token: string): Promise<void>;
1644
+ /**
1645
+ * Request a password reset.
1646
+ * @param email - The user's email.
1647
+ * @param [optionalClientId] - Optional client ID.
1648
+ */
1649
+ forgotPassword(email: string, optionalClientId?: string): Promise<void>;
1650
+ /**
1651
+ * Set a new password using a token.
1652
+ * @param token - The password reset token.
1653
+ * @param password - The new password.
1654
+ */
1655
+ setNewPassword(token: string, password: string): Promise<void>;
1656
+ /**
1657
+ * Check if an account exists.
1658
+ * @param data - The account data.
1659
+ * @param data.account - The account to check for.
1660
+ * @returns A boolean indicating if an account exists.
1661
+ */
1662
+ accountExists(data: {
1663
+ account: string;
1664
+ }): Promise<boolean>;
1665
+ /**
1666
+ * Get items in a folder.
1667
+ * @param {string} folderId - The folder ID.
1668
+ * @param {boolean} [forceReload] - Forces the reload of the data, so no cached data is used
1669
+ * @returns {Promise<Array>} The list of items.
1670
+ */
1671
+ getItemsInFolderList(folderId: string, forceReload?: boolean): Promise<any>;
1672
+ /**
1673
+ * Get an item by ID.
1674
+ * @param id - The item ID.
1675
+ * @param options - Can be either an object with options or true to return the clonedFrom field.
1676
+ * @param options.returnClonedFrom - If the clonedFrom field should be returned.
1677
+ * @param options.withThumbnails - Return thumbnails array
1678
+ * @returns The item details.
1679
+ */
1680
+ getItem<O extends ItemOptions>(id: string, options?: O): Promise<ItemWithOptions<O>>;
1681
+ /**
1682
+ * Get aggregated item data, using public or authenticated API based on configuration.
1683
+ * @param {string} id - The item ID.
1684
+ * @param {Object} [options] - Query options.
1685
+ * @returns {Promise<Object>} The aggregated item data.
1686
+ */
1687
+ getItemAggregatedPOP(id: any, options: any): Promise<any>;
1688
+ /**
1689
+ * Get aggregated item data from the public API.
1690
+ * @param {string} id - The item ID.
1691
+ * @param {Object} [options] - Query options.
1692
+ * @returns {Promise<Object>} The aggregated item data.
1693
+ */
1694
+ getItemPublicAggregated(id: any, options: any): Promise<any>;
1695
+ /**
1696
+ * Get aggregated item data from the authenticated API.
1697
+ * @param {string} id - The item ID.
1698
+ * @param {Object} [options] - Query options.
1699
+ * @param {boolean} [options.withFieldInstances] - Return field instances
1700
+ * @param {boolean} [options.withAttachmentInfo] - Return attachment information
1701
+ * @param {boolean} [options.noAttributes] - Return no attributes
1702
+ * @param {boolean} [options.noUserAttributes] - Return no user attributes
1703
+ * @param {boolean} [options.noFields] - Return no field data
1704
+ * @param {boolean} [options.noThumbnails] - Return no thumbnail data
1705
+ * @param {boolean} [options.noLinks] - Return no link data
1706
+ * @returns {Promise<Object>} The aggregated item data.
1707
+ */
1708
+ getItemAggregated(id: any, options: any): Promise<any>;
1709
+ /**
1710
+ * Get recursively aggregated item data.
1711
+ * @param {string} id - The item ID.
1712
+ * @param {Object} [options] - Query options.
1713
+ * @param {boolean} [options.withFieldInstances] - Return field instances
1714
+ * @param {boolean} [options.withAttachmentInfo] - Return attachment information
1715
+ * @param {boolean} [options.noAttributes] - Return no attributes
1716
+ * @param {boolean} [options.noUserAttributes] - Return no user attributes
1717
+ * @param {boolean} [options.noFields] - Return no field data
1718
+ * @param {boolean} [options.noThumbnails] - Return no thumbnail data
1719
+ * @returns {Promise<Object>} The recursively aggregated item data.
1720
+ */
1721
+ getItemAggregatedRecursive(id: any, options: any): Promise<any>;
1722
+ /**
1723
+ * Get recursively aggregated public item data.
1724
+ * @param {string} id - The item ID.
1725
+ * @param {boolean} [withFeatures] - Include features.
1726
+ * @returns {Promise<Object>} The recursively aggregated public item data.
1727
+ */
1728
+ getItemPublicRecursive(id: any, withFeatures: any): Promise<any>;
1729
+ /**
1730
+ * Get public item data.
1731
+ * @param {string} id - The item ID.
1732
+ * @param {boolean} [returnClonedFrom] - If the clonedFrom field should be returned.
1733
+ * @returns {Promise<Object>} The public item data.
1734
+ */
1735
+ getItemPublic<O extends boolean>(id: string, returnClonedFrom?: O): Promise<{
1736
+ _id: string;
1737
+ links?: {
1738
+ to: string;
1739
+ usage: string;
1740
+ }[];
1741
+ attributes?: Record<string, unknown>;
1742
+ userAttributes?: Record<string, unknown>;
1743
+ name: string;
1744
+ folder: string;
1745
+ filename?: string;
1746
+ createdAt: string;
1747
+ updatedAt: string;
1748
+ version?: {
1749
+ major: number;
1750
+ minor: number;
1751
+ revision: number;
1752
+ };
1753
+ filesize?: number;
1754
+ hash?: string;
1755
+ mimeType?: string;
1756
+ type: string;
1757
+ packageType?: string;
1758
+ properties: Record<string, string>;
1759
+ description?: string;
1760
+ flags?: string[];
1761
+ shortDescription?: string;
1762
+ tags?: string[];
1763
+ contributors?: string[];
1764
+ userAttributeTemplate?: string;
1765
+ attachments?: Attachments;
1766
+ itemSize?: number;
1767
+ totalSize?: number;
1768
+ allowConversation?: boolean;
1769
+ itemFlag?: {
1770
+ isStaffPick: boolean;
1771
+ isGame: boolean;
1772
+ featureWeight: number;
1773
+ };
1774
+ unpackagedSize?: number;
1775
+ conversation?: string;
1776
+ categories?: string[];
1777
+ createdBy?: string;
1778
+ quotaUser?: string;
1779
+ quotaGroup?: string;
1780
+ license?: string;
1781
+ } & (O extends true ? {
1782
+ clonedFrom?: string;
1783
+ } : {})>;
1784
+ /**
1785
+ * Get item history.
1786
+ * @param {string} id - The item ID.
1787
+ * @returns {Promise<Object>} The item history.
1788
+ */
1789
+ getItemHistory(id: any): Promise<any>;
1790
+ /**
1791
+ * Create a new item.
1792
+ * @param data - The item data.
1793
+ * @param data.type - The type of the item. For example "Image", "Mesh", "Material", etc.
1794
+ * @param data.name - The name of the item
1795
+ * @param data.folder - The folder ID of the item or null/undefined if it should be in the root folder
1796
+ * @param [data.itemTemplate] - Item template to use, if any
1797
+ * @param [data.version] - Version of the item, has to be an object. Example: { major: 0, minor: 0, revision: 1}
1798
+ * @param [data.visibility] - Visibility of the object. Default is Private
1799
+ * @param [data.allowConversation] - True, if this item should allow conversations
1800
+ * @param [data.fixNameCollisions] - Fix name collisions. If the item name exists already, an index will be appended
1801
+ * @param [data.overwrite] - Overwrite item if it is already existing. Should not be used together with fixNameCollisions
1802
+ * @param [data.client] - Client ID for the item. Default client will be used if omitted
1803
+ * @param [data.userAttributeTemplate] - User attribute templated to be used
1804
+ * @param [data.flags] - Flags for the new item
1805
+ * @returns The created item ID.
1806
+ */
1807
+ createItem(data: {
1808
+ name: string;
1809
+ type: string;
1810
+ itemTemplateId?: string;
1811
+ itemTemplateReplacements?: any;
1812
+ version?: {
1813
+ major: number;
1814
+ minor: number;
1815
+ revision: number;
1816
+ };
1817
+ folder?: string;
1818
+ visibility?: number;
1819
+ allowConversation?: boolean;
1820
+ fixNameCollisions?: boolean;
1821
+ overwrite?: boolean;
1822
+ client?: string;
1823
+ userAttributeTemplate?: string;
1824
+ flags?: string[];
1825
+ acl?: Acl;
1826
+ attributes?: Item["attributes"];
1827
+ userAttributes?: Item["userAttributes"];
1828
+ links?: Item["links"];
1829
+ }): Promise<string>;
1830
+ /**
1831
+ * Update an existing item.
1832
+ * @param data - The item data.
1833
+ * @returns The new version of the item.
1834
+ */
1835
+ updateItem(data: {
1836
+ _id: string;
1837
+ name: string;
1838
+ version?: {
1839
+ major: number;
1840
+ minor: number;
1841
+ revision: number;
1842
+ };
1843
+ description?: string;
1844
+ shortDescription?: string;
1845
+ tags?: string[];
1846
+ contributors?: string[];
1847
+ flags?: string[];
1848
+ visibility?: number;
1849
+ allowConversation?: boolean;
1850
+ userAttributeTemplateId?: string;
1851
+ categories?: string[];
1852
+ license?: string;
1853
+ acl?: Acl;
1854
+ links?: {
1855
+ to: string;
1856
+ usage: string;
1857
+ }[];
1858
+ attributes?: Record<string, unknown>;
1859
+ userAttributes?: Record<string, unknown>;
1860
+ properties?: Record<string, string>;
1861
+ }): Promise<{
1862
+ version: {
1863
+ major: number;
1864
+ minor: number;
1865
+ revision: number;
1866
+ };
1867
+ }>;
1868
+ /**
1869
+ * Delete an item by ID.
1870
+ * @param id - The item ID or an array of item IDs.
1871
+ * @returns The deletion response.
1872
+ */
1873
+ deleteItem(id: string | string[]): Promise<void>;
1874
+ /**
1875
+ * Rename item
1876
+ * @param id - The item ID.
1877
+ * @param name - The new item name.
1878
+ * @returns The new version of the item.
1879
+ */
1880
+ renameItem(id: string, name: string): Promise<{
1881
+ version: {
1882
+ major: number;
1883
+ minor: number;
1884
+ revision: number;
1885
+ };
1886
+ }>;
1887
+ /**
1888
+ * Query public items list.
1889
+ * @param query - The query parameters.
1890
+ * @returns The list of items.
1891
+ */
1892
+ queryPublicItemsList<O extends ItemQueryOptions>(query: O): Promise<ItemQueryWithOptions<O>>;
1893
+ /**
1894
+ * Query items list, using public or authenticated API based on configuration.
1895
+ * @param query - The query parameters.
1896
+ * @returns The list of items.
1897
+ */
1898
+ queryItemsListPOP<O extends ItemQueryOptions>(query: O): Promise<ItemQueryWithOptions<O>>;
1899
+ /**
1900
+ * Query items list.
1901
+ * @param query - The query parameters.
1902
+ * @returns The list of items.
1903
+ */
1904
+ queryItemsList<O extends ItemQueryOptions>(query: O): Promise<ItemQueryWithOptions<O>>;
1905
+ /**
1906
+ * Query items list and export as Excel.
1907
+ * @param {Object} query - The query parameters.
1908
+ */
1909
+ queryItemsListAsExcel(query: any): Promise<void>;
1910
+ /**
1911
+ * Move items to a different folder.
1912
+ * @param {Object} data - The move data.
1913
+ * @param {Array<string>} data.items - An array of item IDs
1914
+ * @param {string} [data.dest] - The destination folder. If omitted, the destination folder is the root folder
1915
+ * @returns {Promise<number>} The amount of moved items
1916
+ */
1917
+ moveItems(data: any): Promise<any>;
1918
+ /**
1919
+ * Download an item by ID.
1920
+ * @param {string} id - The item ID.
1921
+ * @param {Function} [progressCallback] - Download progress callback.
1922
+ * @returns {Promise<Blob>} The downloaded item.
1923
+ */
1924
+ downloadItem(id: string, progressCallback?: ProgressCallback): Promise<any>;
1925
+ /**
1926
+ * Download a public item by ID.
1927
+ * @param {string} id - The item ID.
1928
+ * @param {Function} [loadingProgressFunc] - Download progress callback.
1929
+ * @returns {Promise<Blob>} The downloaded item.
1930
+ */
1931
+ publicDownloadItem(id: any, loadingProgressFunc?: ProgressCallback): Promise<any>;
1932
+ /**
1933
+ * Get the hash of an item by ID.
1934
+ * @param {string} id - The item ID.
1935
+ * @returns {Promise<string>} The item hash.
1936
+ */
1937
+ getItemHash(id: any): Promise<any>;
1938
+ /**
1939
+ * Request a secure download for an item.
1940
+ * @param {string} id - The item ID.
1941
+ * @returns {Promise<Object>} The request response.
1942
+ */
1943
+ requestSecureDownload(id: any): Promise<any>;
1944
+ /**
1945
+ * Get a thumbnail for an item.
1946
+ * @param {string} size - The thumbnail size.
1947
+ * @param {string} id - The item ID.
1948
+ * @returns {Promise<Blob>} The thumbnail.
1949
+ */
1950
+ getThumbnail(size: any, id: any): Promise<any>;
1951
+ /**
1952
+ * Upload a single thumbnail for an item
1953
+ * @param {string} id - The item ID.
1954
+ * @param {number} size - The thumbnail size.
1955
+ * @param {Buffer|File} bufferOrFile - The file buffer or file.
1956
+ * @param {string} filename - The filename.
1957
+ * @param {Function} [progressCallback] - Upload progress callback.
1958
+ * @param {AbortController} [controller] - Abort controller for the request.
1959
+ * @returns {Promise<Object>} The response.
1960
+ */
1961
+ uploadThumbnail(id: string, size: number, bufferOrFile: any, filename?: string, progressCallback?: ProgressCallback, controller?: AbortController): Promise<any>;
1962
+ /**
1963
+ * Get a public thumbnail for an item.
1964
+ * @param {string} size - The thumbnail size.
1965
+ * @param {string} id - The item ID.
1966
+ * @returns {Promise<Blob>} The thumbnail.
1967
+ */
1968
+ getPublicThumbnail(size: any, id: any): Promise<any>;
1969
+ /**
1970
+ * Make an item public.
1971
+ * @param id - single ID or list of IDs
1972
+ * @param recursive - Apply to sub-items.
1973
+ * @param inSubfolders - Apply to items in subfolders.
1974
+ */
1975
+ makeItemPublic(id: string, recursive: boolean, inSubfolders: boolean): Promise<void>;
1976
+ /**
1977
+ * Change item visibility
1978
+ * @param id single ID or list of IDs
1979
+ * @param visibility visibility. 0 = Draft, 1 = Private, 2 = Not listed, 3 = Public
1980
+ * @param recursive
1981
+ * @param inSubfolders
1982
+ * @return {Promise<Object>}
1983
+ */
1984
+ setVisibility(id: any, visibility: any, recursive: any, inSubfolders: any): Promise<any>;
1985
+ /**
1986
+ * Make an item private.
1987
+ * @param {string} id - single ID or list of IDs
1988
+ * @param {boolean} recursive - Apply to sub-items.
1989
+ * @param {boolean} inSubfolders - Apply to items in subfolders.
1990
+ * @returns {Promise<Object>} The response.
1991
+ */
1992
+ makeItemPrivate(id: any, recursive: any, inSubfolders: any): Promise<any>;
1993
+ /**
1994
+ * Set omit LOD generation for an item, so the renderjobagentt wont process it again.
1995
+ * @param {string} id - The item ID.
1996
+ * @returns {Promise<Object>} The response.
1997
+ */
1998
+ setOmitLodGeneration(id: any, value: any): Promise<any>;
1999
+ /**
2000
+ * Set omit thumbnail generation for an item, so the renderjobagentt wont process it again.
2001
+ * @param {string} id - The item ID.
2002
+ * @returns {Promise<Object>} The response.
2003
+ */
2004
+ setOmitThumbnailGeneration(id: any, value: any): Promise<any>;
2005
+ /**
2006
+ * Set omit preview generation for an item, so the renderjobagentt wont process it again.
2007
+ * @param {string} id - The item ID.
2008
+ * @returns {Promise<Object>} The response.
2009
+ */
2010
+ setOmitPreviewGeneration(id: any, value: any): Promise<any>;
2011
+ /**
2012
+ * Upload a file and create a new item.
2013
+ * @param {string} folderId - The folder ID.
2014
+ * @param {Buffer|Blob} data - The file data
2015
+ * @param {string} filename - The filename.
2016
+ * @param {Object} [options] - Options for the item
2017
+ * @param {number} [options.autoDestructIn] - Auto-destruct time in minutes.
2018
+ * @param {ItemVisibility} [options.visibility] - Visibility of the object. Default is Private
2019
+ * @param {string} [options.nameOverride] - Override the name of the created item. Default is filename without extension
2020
+ * @param {string} [options.flags] - Item flags to use
2021
+ * @param {boolean} [options.overwrite] - Overwrite item if already existing.
2022
+ * @param {Function} [progressCallback] - Upload progress callback.
2023
+ * @param {AbortController} [controller] - Abort controller for the request.
2024
+ * @returns {Promise<Object>} The created item.
2025
+ */
2026
+ uploadAndCreate(folderId: string, data: any, filename: string, options: any, progressCallback?: ProgressCallback, controller?: AbortController): Promise<any>;
2027
+ /**
2028
+ * Upload a file to an existing item.
2029
+ * @param itemId - The item ID.
2030
+ * @param bufferOrFile - The file buffer or file.
2031
+ * @param filename - The filename.
2032
+ * @param [progressCallback] - Upload progress callback.
2033
+ * @param [controller] - Abort controller for the request.
2034
+ * @param [options.omitHandleDependencyChange] - If true, will not cause previews and thumbnails to rerender
2035
+ * @param [options.keepThumbnails] - If true, will not remove thumbnails to be rerendered
2036
+ */
2037
+ upload(itemId: string, bufferOrFile: Buffer | File | Blob | string, filename: string, progressCallback?: ProgressCallback, controller?: AbortController, options?: {
2038
+ omitHandleDependencyChange?: boolean;
2039
+ keepThumbnails?: boolean;
2040
+ }): Promise<void>;
2041
+ /**
2042
+ * Clear the preview for an item and mark it for preview regeneration.
2043
+ * @param {string} id - The item ID.
2044
+ * @returns {Promise<Array<Object>>} The responses.
2045
+ */
2046
+ resetPreview(id: any): Promise<[any, any]>;
2047
+ /**
2048
+ * Clear the preview for an item and omit preview generation.
2049
+ * @param {string} id - The item ID.
2050
+ * @returns {Promise<Array<Object>>} The responses.
2051
+ */
2052
+ clearPreview(id: any): Promise<[any, any]>;
2053
+ /**
2054
+ * Clear the thumbnail for an item.
2055
+ * @param {string} id - The item ID.
2056
+ * @returns {Promise<Object>} The response.
2057
+ */
2058
+ clearThumbnail(id: any): Promise<any>;
2059
+ /**
2060
+ * Clear the thumbnail for an item and mark it for thumbnail regeneration.
2061
+ * @param {string} id - The item ID.
2062
+ * @returns {Promise<Object>} The response.
2063
+ */
2064
+ resetThumbnail(id: any): Promise<any>;
2065
+ /**
2066
+ * Download an attachment of an item.
2067
+ * @param {string} id - The item ID.
2068
+ * @param {string} name - The attachment name.
2069
+ * @param {number} queryParam - The attachment query parameter. Might be a dimension or index, based on the attachment type.
2070
+ * @param {number} index - The attachment index.
2071
+ * @param {Function} [progressCallback] - Download progress callback.
2072
+ * @returns {Promise<Blob>} The downloaded attachment.
2073
+ */
2074
+ downloadAttachmentPOP(id: string, name: string, queryParam?: number, index?: number, progressCallback?: ProgressCallback): Promise<any>;
2075
+ _getAttachmentUrlPath(id: string, name: string, queryParam?: number, index?: number, isPublic?: boolean): string;
2076
+ /**
2077
+ * Download attachment
2078
+ * @param id - The item ID.
2079
+ * @param name - The attachment name.
2080
+ * @param queryParam - The attachment query parameter. Might be a dimension or index, based on the attachment type.
2081
+ * @param index - The (optional) index of the attachment of that type/name. If not provided, defaults to 0.
2082
+ * @param [progressCallback] - Download progress callback.
2083
+ * @returns The attachment data.
2084
+ */
2085
+ downloadAttachment(id: string, name: string, queryParam?: number, index?: number, progressCallback?: ProgressCallback): Promise<{
2086
+ blob: Blob;
2087
+ }>;
2088
+ /**
2089
+ * Download public attachment
2090
+ * @param {string} id - The item ID.
2091
+ * @param {string} name - The attachment name.
2092
+ * @param {number} queryParam - The attachment query parameter. Might be a dimension or index, based on the attachment type.
2093
+ * @param {number} index - The (optional) index of the attachment of that type/name. If not provided, defaults to 0.
2094
+ * @param {Function} [progressCallback] - Download progress callback.
2095
+ * @returns {Promise<Blob>} The downloaded attachment.
2096
+ */
2097
+ downloadPublicAttachment(id: string, name: string, queryParam?: number, index?: number, progressCallback?: ProgressCallback): Promise<any>;
2098
+ /**
2099
+ * Upload an attachment to an item. This endpoint needs admin permissions.
2100
+ * @param {string} id - Id of the item to attach the file to
2101
+ * @param {string} name - Name of the attachment
2102
+ * @param {string} queryParam - Query param of the attachment
2103
+ * @param {number} index - Index of the attachment
2104
+ * @param {Buffer|File} bufferOrFile - The file buffer or file.
2105
+ * @param {string} filename - The filename.
2106
+ * @param {Function} [progressCallback] - Upload progress callback.
2107
+ * @param {AbortController} [controller] - Abort controller for the request.
2108
+ * @return {Promise<Object>}
2109
+ */
2110
+ uploadAttachment(id: string, name: string, queryParam?: number, index?: number, bufferOrFile?: any, filename?: string, progressCallback?: ProgressCallback, controller?: AbortController): Promise<any>;
2111
+ /**
2112
+ * Invalidates attachment in attachmentCache and then deletes attachment
2113
+ * @param {string} id - The item ID.
2114
+ * @param {string} name - The attachment name.
2115
+ * @param {number} queryParam - The (optional) query parameter. Might be a dimension or index, based on the attachment type.
2116
+ * If not provided, delete all attachments of name.
2117
+ * @param {number} index - The (optional) index of the attachment of that type/name.
2118
+ * @param {Function} [progressCallback] - Download progress callback.
2119
+ * @returns {Promise<undefined>}
2120
+ */
2121
+ deleteAttachment(id: string, name: string, queryParam?: number, index?: number): Promise<any>;
2122
+ /**
2123
+ * Sets perceptive hash on attachment
2124
+ * @param {string} itemId - The item ID.
2125
+ * @param {string} attachmentId - The attachment ID.
2126
+ * @param {string} perceptiveHash - The perceptive hash.
2127
+ * @returns {Promise<undefined>}
2128
+ */
2129
+ setPerceptiveHashOnAttachment(itemId: any, attachmentId: any, perceptiveHash: any): Promise<any>;
2130
+ /**
2131
+ * Sets perceptive hash on item
2132
+ * @param {string} id - The item ID.
2133
+ * @param {string} perceptiveHash - The perceptive hash.
2134
+ * @returns {Promise<undefined>}
2135
+ */
2136
+ setPerceptiveHash(id: any, perceptiveHash: any): Promise<any>;
2137
+ /**
2138
+ * Get client information for an item.
2139
+ * @param {string} id - The item ID.
2140
+ * @returns {Promise<Object>} The client information.
2141
+ */
2142
+ getItemClient(id: any): Promise<any>;
2143
+ /**
2144
+ * Get ACL (Access Control List) for an item.
2145
+ * @param {string} id - The item ID.
2146
+ * @returns {Promise<Object>} The item ACL.
2147
+ */
2148
+ getItemAcl(id: any): Promise<any>;
2149
+ /**
2150
+ * Get items linking to a specified item.
2151
+ * @param {string} id - The item ID.
2152
+ * @returns {Promise<Array>} The list of linking items.
2153
+ */
2154
+ getItemsLinking(id: any): Promise<any>;
2155
+ /**
2156
+ * Set attributes for a list of items.
2157
+ * @param {Array<string>} idList - The list of item IDs.
2158
+ * @param {Object} attributes - The attributes to set.
2159
+ * @returns {Promise<Object>} The response.
2160
+ */
2161
+ setAttributes(idList: any, attributes: any): Promise<any>;
2162
+ /**
2163
+ * Get the item sync list since a specified date.
2164
+ * @param {Date} date - The sync date.
2165
+ * @returns {Promise<Array>} The sync list.
2166
+ */
2167
+ getItemSyncList(date: any): Promise<any>;
2168
+ /**
2169
+ * Increase views count for an item.
2170
+ * @param {string} id - The item ID.
2171
+ * @returns {Promise<Object>} The response.
2172
+ */
2173
+ increaseViews(id: any): Promise<any>;
2174
+ /**
2175
+ * Get the views count for an item.
2176
+ * @param id - The item ID.
2177
+ * @returns The views count.
2178
+ */
2179
+ getViews(id: string): Promise<number>;
2180
+ /**
2181
+ * Get public item counts.
2182
+ * @param {string} id - The item ID.
2183
+ * @returns {Promise<Object>} The public item counts.
2184
+ */
2185
+ getPublicItemCounts(id: any): Promise<any>;
2186
+ /**
2187
+ * Get item counts.
2188
+ * @param {string} id - The item ID.
2189
+ * @returns {Promise<Object>} The item counts.
2190
+ */
2191
+ getItemCounts(id: any): Promise<any>;
2192
+ /**
2193
+ * Like an item.
2194
+ * @param id - The item ID.
2195
+ */
2196
+ likeItem(id: string): Promise<void>;
2197
+ /**
2198
+ * Unlike an item.
2199
+ * @param id - The item ID.
2200
+ */
2201
+ unlikeItem(id: string): Promise<void>;
2202
+ /**
2203
+ * Check if the current user likes an item.
2204
+ * @param id - The item ID.
2205
+ * @returns Whether the user likes the item.
2206
+ */
2207
+ doILike(id: string): Promise<boolean>;
2208
+ /**
2209
+ * Set auto-destruct date for an item.
2210
+ * @param {string} id - The item ID.
2211
+ * @param {Date} date - The auto-destruct date.
2212
+ * @returns {Promise<Object>} The response.
2213
+ */
2214
+ setItemAutoDestruct(id: any, date: any): Promise<any>;
2215
+ /**
2216
+ * Clear auto-destruct date for an item.
2217
+ * @param {string} id - The item ID.
2218
+ * @returns {Promise<Object>} The response.
2219
+ */
2220
+ clearItemAutoDestruct(id: any): Promise<any>;
2221
+ /**
2222
+ * Resolve relative item path.
2223
+ * @param {string} id - The item ID.
2224
+ * @param {string} path - The relative path.
2225
+ * @returns {Promise<string>} The resolved item ID.
2226
+ */
2227
+ resolveRelativeItem(id: any, path: any): Promise<any>;
2228
+ /**
2229
+ * Resolve public relative item path.
2230
+ * @param {string} id - The item ID.
2231
+ * @param {string} path - The relative path.
2232
+ * @returns {Promise<string>} The resolved item ID.
2233
+ */
2234
+ publicResolveRelativeItem(id: any, path: any): Promise<any>;
2235
+ /**
2236
+ * Rewire one or more items, also setting attributes
2237
+ * @param {Array<Object>} items - Array of objects, containing { _id: "itemId", links: [ { to: "itemId", usage: "<usage>"} ], attributes: { ... }}
2238
+ * @return {Promise<void>}
2239
+ */
2240
+ rewireItems(items: any): Promise<any>;
2241
+ /**
2242
+ * Get a folder by ID.
2243
+ * @param id - The folder ID.
2244
+ * @returns The folder details.
2245
+ */
2246
+ getFolder(id: string): Promise<{
2247
+ _id: string;
2248
+ name: string;
2249
+ parent?: string;
2250
+ createdAt: string;
2251
+ createdBy?: string;
2252
+ updatedAt: string;
2253
+ updatedBy?: string;
2254
+ location?: string;
2255
+ contentSize?: number;
2256
+ acl?: Acl;
2257
+ resultingAcl?: Acl;
2258
+ }>;
2259
+ /**
2260
+ * Get the full folder tree up to depth MAX_FULLTREE_DEPTH_SUBLEVELS as defined in service limits.js.
2261
+ * @param {string} folderId - The folder ID ("0" for root).
2262
+ * @returns {Promise<Object>} The folder tree structure.
2263
+ */
2264
+ getFullFolderTree(folderId: any): Promise<any>;
2265
+ /**
2266
+ * Get folders in a folder.
2267
+ * @param parentId - The parent folder ID.
2268
+ * @param options - Options object
2269
+ * @param options.resolveNames - Resolve names of folders.
2270
+ * @param options.folderAsItemType - Fetch folders as items of a specific type.
2271
+ * @param options.folderAsItemName - Fetch folders as items of a specific name.
2272
+ * @param options.folderAsItemFlag - Fetch folders as items with a specific flag.
2273
+ * @param options.withStats - If the counts for every item should be returned.
2274
+ * @param options.returnLatestPackage - If the latest package should be returned.
2275
+ * @returns The list of folders.
2276
+ */
2277
+ getFoldersInFolderList<O extends FolderListingOptions>(parentId: string | undefined | null, options?: O): Promise<FolderListingWithOptions<O>>;
2278
+ /**
2279
+ * Update the folder cache for a list of folders.
2280
+ * @param {Array<string>} IDs - The list of folder IDs.
2281
+ */
2282
+ updateFolderCache(IDs: any): Promise<void>;
2283
+ /**
2284
+ * Create a new folder.
2285
+ * @param {Object} data - The folder data.
2286
+ * @param {string} data.name - The name of the folder
2287
+ * @param {string} [data.parent] - The ID of the parent folder or omit to create in root folder
2288
+ * @param {boolean} [data.returnIfExists] - true, if the folder should be returned in case it already exists.
2289
+ * @param {boolean} [data.hidden] - true, if the folder should be marked as hidden
2290
+ * @param {boolean} [data.fixNameCollisions] - Fix name collisions. If the folder name exists already, an index will be appended
2291
+ * @returns {Promise<string>} The folder's ID
2292
+ */
2293
+ createFolder(data: {
2294
+ name: string;
2295
+ parent?: string;
2296
+ hidden?: boolean;
2297
+ returnIfExists?: boolean;
2298
+ fixNameCollisions?: boolean;
2299
+ acl?: {
2300
+ user: string;
2301
+ group: string;
2302
+ can: string[];
2303
+ }[];
2304
+ }): Promise<string>;
2305
+ /**
2306
+ * Update an existing folder.
2307
+ * @param data - The folder data.
2308
+ * @param data._id - The id of the folder
2309
+ * @param data.name - The name of the folder
2310
+ * @param [data.acl] - Optional acl array in case it should be updated
2311
+ */
2312
+ updateFolder(data: {
2313
+ _id: string;
2314
+ name: string;
2315
+ acl?: Acl;
2316
+ }): Promise<void>;
2317
+ /**
2318
+ * Delete a folder by ID.
2319
+ * @param id - The folder ID.
2320
+ */
2321
+ deleteFolder(id: string): Promise<void>;
2322
+ /**
2323
+ * Rename folder
2324
+ * @param {string} id - The folder ID.
2325
+ * @param {string} name - The new folder name.
2326
+ * @returns {Promise<Object>} The updated folder details.
2327
+ */
2328
+ renameFolder(id: any, name: any): Promise<void>;
2329
+ /**
2330
+ * Move folders to a different location.
2331
+ * @param data - The move data.
2332
+ * @param data.folders - List of folder IDs that should be moved
2333
+ * @param data.dest - Destination folder where the listed folders should be moved to. Either the ID or null for the root folder.
2334
+ * @returns The amount of modified folders.
2335
+ */
2336
+ moveFolders(data: {
2337
+ folders: string[];
2338
+ dest?: string;
2339
+ }): Promise<number>;
2340
+ /**
2341
+ * Get the path of a folder by ID.
2342
+ * @param id - The folder ID or a folder object with _id field
2343
+ * @returns The folder path and all elements of it.
2344
+ */
2345
+ getFolderPath(id?: string | {
2346
+ _id: string;
2347
+ }): Promise<{
2348
+ path: string;
2349
+ elements: {
2350
+ id: string;
2351
+ name: string;
2352
+ originalName: string;
2353
+ }[];
2354
+ }>;
2355
+ /**
2356
+ * Resolve a folder path. Returns the folder ID if it exists. returns null for the root folder
2357
+ * @param path path to the folder
2358
+ * @return {Promise<Object>}
2359
+ */
2360
+ resolveFolderPath(path: any): Promise<any>;
2361
+ /**
2362
+ * Get client information for a folder.
2363
+ * @param {string} id - The folder ID.
2364
+ * @returns {Promise<Object>} The client information.
2365
+ */
2366
+ getFolderClient(id: any): Promise<any>;
2367
+ /**
2368
+ * Get the Access Control List (ACL) for a folder.
2369
+ * @param {string} id - The folder ID.
2370
+ * @returns {Promise<Object>} The folder ACL.
2371
+ */
2372
+ getFolderAcl(id: any): Promise<any>;
2373
+ /**
2374
+ * Get the ACL list for multiple folders.
2375
+ * @param {Array<string>} ids - The list of folder IDs.
2376
+ * @returns {Promise<Array>} The list of ACLs.
2377
+ */
2378
+ getFolderAclList(ids: any): Promise<any>;
2379
+ /**
2380
+ * Get a user by ID.
2381
+ * @param {string} id - The user ID.
2382
+ * @returns {Promise<Object>} The user details.
2383
+ */
2384
+ getUser(id: any): Promise<any>;
2385
+ /**
2386
+ * Get the list of users.
2387
+ * @returns {Promise<Array>} The list of users.
2388
+ */
2389
+ getUsersList(): Promise<any>;
2390
+ /**
2391
+ * Create a new user.
2392
+ * @param {Object} data - The user data.
2393
+ * @returns {Promise<Object>} The created user details.
2394
+ */
2395
+ createUser(data: any): Promise<any>;
2396
+ /**
2397
+ * Query users with a search query.
2398
+ * @param [searchQuery] - The search query.
2399
+ * @param [groupID] - The group ID.
2400
+ * @param [cursor] - Pagination cursor.
2401
+ * @returns The query response.
2402
+ */
2403
+ queryUser(searchQuery?: string, groupID?: string, cursor?: string): Promise<{
2404
+ data: {
2405
+ _id: string;
2406
+ name: string;
2407
+ displayName?: string;
2408
+ }[];
2409
+ withNext?: string;
2410
+ }>;
2411
+ /**
2412
+ * Update an existing user.
2413
+ * @param {Object} data - The user data.
2414
+ * @returns {Promise<Object>} The updated user details.
2415
+ */
2416
+ updateUser(data: any): Promise<any>;
2417
+ /**
2418
+ * Delete a user by ID.
2419
+ * @param {string} id - The user ID.
2420
+ * @returns {Promise<Object>} The deletion response.
2421
+ */
2422
+ deleteUser(id: any): Promise<any>;
2423
+ /**
2424
+ * Update the profile of the current user.
2425
+ * @param data - The profile data.
2426
+ */
2427
+ updateMyProfile(data: {
2428
+ name: string;
2429
+ account: string;
2430
+ displayName?: string;
2431
+ currentPassword?: string;
2432
+ newPassword?: string;
2433
+ location?: string;
2434
+ properties?: Record<string, any>;
2435
+ paymentSetup?: {
2436
+ address: {
2437
+ email: string;
2438
+ name: string;
2439
+ street: string;
2440
+ zipcode: string;
2441
+ city: string;
2442
+ country: string;
2443
+ };
2444
+ };
2445
+ }): Promise<void>;
2446
+ /**
2447
+ * Switch to a different client.
2448
+ * @param {string} id - The client ID.
2449
+ * @returns {Promise<Object>} The switch response.
2450
+ */
2451
+ switchClient(id: any): Promise<any>;
2452
+ /**
2453
+ * Activate a user account with a token.
2454
+ * @param {string} password - The user password.
2455
+ * @param {string} token - The activation token.
2456
+ * @returns {Promise<Object>} The activation response.
2457
+ */
2458
+ activateUser(password: any, token: any): Promise<any>;
2459
+ /**
2460
+ * Get the list of users pending approval.
2461
+ * @returns {Promise<Array>} The list of users.
2462
+ */
2463
+ getUsersToApprove(): Promise<any>;
2464
+ /**
2465
+ * Approve a user's registration.
2466
+ * @param {string} userId - The user ID.
2467
+ * @returns {Promise<Object>} The approval response.
2468
+ */
2469
+ approveUserRegistration(userId: any): Promise<any>;
2470
+ /**
2471
+ * Reject a user's registration.
2472
+ * @param {string} userId - The user ID.
2473
+ * @returns {Promise<Object>} The rejection response.
2474
+ */
2475
+ rejectUserRegistration(userId: any): Promise<any>;
2476
+ /**
2477
+ * Upload an avatar for the current user.
2478
+ * @param data - The avatar data
2479
+ */
2480
+ uploadAvatar(data: Buffer | Blob): Promise<void>;
2481
+ /**
2482
+ * Clear the avatar of the current user.
2483
+ * @returns {Promise<Object>} The response.
2484
+ */
2485
+ clearAvatar(): Promise<any>;
2486
+ /**
2487
+ * Get the avatar of a user.
2488
+ * @param userId - The user ID.
2489
+ * @param size - The avatar size.
2490
+ * @returns The user information.
2491
+ */
2492
+ getAvatar(userId: string, size: number): Promise<UserInfo>;
2493
+ /**
2494
+ * Get the public information of a user.
2495
+ * @param userId - The user ID.
2496
+ * @param clientId - The client ID.
2497
+ * @param avatarSize - The avatar size.
2498
+ * @returns The user public information.
2499
+ */
2500
+ getUserPublicInfo(userId: string, clientId: string, avatarSize: number): Promise<UserInfo>;
2501
+ /**
2502
+ * Get a user attribute by key.
2503
+ * @param {string} key - The attribute key.
2504
+ * @returns {Promise<Object>} The attribute value.
2505
+ */
2506
+ getUserAttribute(key: any): Promise<any>;
2507
+ /**
2508
+ * Clear a user attribute by key.
2509
+ * @param {string} key - The attribute key.
2510
+ * @returns {Promise<Object>} The response.
2511
+ */
2512
+ clearUserAttribute(key: any): Promise<any>;
2513
+ /**
2514
+ * Set a user attribute.
2515
+ * @param {string} key - The attribute key.
2516
+ * @param {string} value - The attribute value.
2517
+ * @returns {Promise<Object>} The response.
2518
+ */
2519
+ setUserAttribute(key: any, value: any): Promise<any>;
2520
+ /**
2521
+ * Get a group by ID.
2522
+ * @param id - The group ID.
2523
+ * @returns The group details.
2524
+ */
2525
+ getGroup(id: string): Promise<{
2526
+ _id: string;
2527
+ name: string;
2528
+ description: string;
2529
+ hasFolder?: boolean;
2530
+ storageQuotaGb: number;
2531
+ trafficQuotaGb: number;
2532
+ allowedDatatypes?: string[];
2533
+ allowedJobtypes?: string[];
2534
+ allowedFeatures?: string[];
2535
+ createdAt: string;
2536
+ updatedAt: string;
2537
+ users: {
2538
+ _id: string;
2539
+ name: string;
2540
+ }[];
2541
+ location?: string;
2542
+ }>;
2543
+ /**
2544
+ * Get the folder of a group.
2545
+ * @param id - The group ID.
2546
+ * @returns The ID of the group folder.
2547
+ */
2548
+ getGroupFolder(id: string): Promise<string | null>;
2549
+ /**
2550
+ * Get the list of groups.
2551
+ * @returns {Promise<Array>} The list of groups.
2552
+ */
2553
+ getGroupsList(): Promise<any>;
2554
+ /**
2555
+ * Create a new group.
2556
+ * @param {Object} data - The group data.
2557
+ * @returns {Promise<Object>} The created group details.
2558
+ */
2559
+ createGroup(data: any): Promise<any>;
2560
+ /**
2561
+ * Query groups with a search query.
2562
+ * @param {string} searchQuery - The search query.
2563
+ * @param {string} [cursor] - Pagination cursor.
2564
+ * @returns {Promise<Object>} The query response.
2565
+ */
2566
+ queryGroup(searchQuery: any, cursor: any): Promise<any>;
2567
+ /**
2568
+ * Update an existing group.
2569
+ * @param data - The group data.
2570
+ * @param [data.headerImageMobile] - ID of an item to be used as the header image on mobile devices.
2571
+ * @param [data.headerImageDesktop] - ID of an item to be used as the header image on desktop devices.
2572
+ * @param [data.publicMembers] - Array of user IDs that should be shown as members to the public.
2573
+ * @param [data.users] - Array of user IDs that should be in this group.
2574
+ */
2575
+ updateGroup(data: {
2576
+ _id: string;
2577
+ name: string;
2578
+ description?: string;
2579
+ storageQuotaGb?: number;
2580
+ trafficQuotaGb?: number;
2581
+ allowedDatatypes?: string[];
2582
+ allowedJobtypes?: string[];
2583
+ allowedFeatures?: string[];
2584
+ hasFolder?: boolean;
2585
+ headerImageDesktop?: string;
2586
+ headerImageMobile?: string;
2587
+ publicMembers?: string[];
2588
+ users?: string[];
2589
+ }): Promise<void>;
2590
+ /**
2591
+ * Delete a group by ID.
2592
+ * @param {string} id - The group ID.
2593
+ * @returns {Promise<Object>} The deletion response.
2594
+ */
2595
+ deleteGroup(id: any): Promise<any>;
2596
+ /**
2597
+ * Get quota information for a group.
2598
+ * @param {string} id - The group ID.
2599
+ * @returns {Promise<Object>} The quota information.
2600
+ */
2601
+ getGroupQuotaInfo(id: any): Promise<any>;
2602
+ /**
2603
+ * Get public information for a group.
2604
+ * @param groupId - The group ID.
2605
+ * @param clientId - The client ID.
2606
+ * @param avatarSize - The avatar size.
2607
+ * @returns The public group information.
2608
+ */
2609
+ getGroupPublicInfo(groupId: string, clientId: string, avatarSize: number): Promise<{
2610
+ avatar?: string;
2611
+ initials: string;
2612
+ name?: string;
2613
+ description?: string;
2614
+ headerImageDesktop?: string;
2615
+ headerImageMobile?: string;
2616
+ members: {
2617
+ _id: string;
2618
+ name: string;
2619
+ }[];
2620
+ }>;
2621
+ /**
2622
+ * Get list of users in a group. Only accessible for members of the group.
2623
+ * @param {string} groupId - The group ID.
2624
+ * @returns {Promise<{_id: string, name: string}[]>} The list of users.
2625
+ */
2626
+ getGroupUsers(groupId: any): Promise<any>;
2627
+ /**
2628
+ * Upload an avatar for a specific group.
2629
+ * @param groupId - The ID of the group
2630
+ * @param data - The avatar data. Can be passed as a buffer or a blob
2631
+ */
2632
+ uploadGroupAvatar(groupId: string, data: Buffer | Blob): Promise<void>;
2633
+ /**
2634
+ * Get the list of clients.
2635
+ * @returns {Promise<Array>} The list of clients.
2636
+ */
2637
+ getClientsList(): Promise<any>;
2638
+ /**
2639
+ * Get a client by ID.
2640
+ * @param {string} id - The client ID.
2641
+ * @returns {Promise<Object>} The client details.
2642
+ */
2643
+ getClient(id: any): Promise<any>;
2644
+ /**
2645
+ * Create a new client.
2646
+ * @param {Object} data - The client data.
2647
+ * @returns {Promise<Object>} The created client details.
2648
+ */
2649
+ createClient(data: any): Promise<any>;
2650
+ /**
2651
+ * Query clients with a search query.
2652
+ * @param {string} searchQuery - The search query.
2653
+ * @param {string} [cursor] - Pagination cursor.
2654
+ * @returns {Promise<Object>} The query response.
2655
+ */
2656
+ queryClient(searchQuery: any, cursor: any): Promise<any>;
2657
+ /**
2658
+ * Update an existing client.
2659
+ * @param {Object} data - The client data.
2660
+ * @returns {Promise<Object>} The updated client details.
2661
+ */
2662
+ updateClient(data: any): Promise<any>;
2663
+ /**
2664
+ * Delete a client by ID.
2665
+ * @param {string} id - The client ID.
2666
+ * @returns {Promise<Object>} The deletion response.
2667
+ */
2668
+ deleteClient(id: any): Promise<any>;
2669
+ /**
2670
+ * Get client metrics for a specific month and year.
2671
+ * @param {string} id - The client ID.
2672
+ * @param {number} year - The year.
2673
+ * @param {number} month - The month.
2674
+ * @returns {Promise<Object>} The client metrics.
2675
+ */
2676
+ getClientMetrics(id: any, year: any, month: any): Promise<any>;
2677
+ /**
2678
+ * Join a client.
2679
+ * @param {string} id - The client ID.
2680
+ * @returns {Promise<Object>} The join response.
2681
+ */
2682
+ joinClient(id: any): Promise<any>;
2683
+ /**
2684
+ * Leave a client.
2685
+ * @param {string} id - The client ID.
2686
+ * @returns {Promise<Object>} The leave response.
2687
+ */
2688
+ leaveClient(id: any): Promise<any>;
2689
+ /**
2690
+ * Get the current user's client.
2691
+ * @returns {Promise<Object>} The current user's client.
2692
+ */
2693
+ myClient(): Promise<any>;
2694
+ /**
2695
+ * Save the current user's client.
2696
+ * @param {Object} data - The client data.
2697
+ * @returns {Promise<Object>} The saved client details.
2698
+ */
2699
+ saveMyClient(data: any): Promise<any>;
2700
+ /**
2701
+ * Get public categories for a client.
2702
+ * @param clientId - The client ID.
2703
+ * @returns The list of public categories.
2704
+ */
2705
+ getPublicCategories(clientId: string): Promise<{
2706
+ _id: string;
2707
+ name: string;
2708
+ }[]>;
2709
+ /**
2710
+ * Get the list of categories.
2711
+ * @returns {Promise<Array>} The list of categories.
2712
+ */
2713
+ getCategories(): Promise<any>;
2714
+ /**
2715
+ * Get the categories in a client.
2716
+ * @param {string} clientId - The client ID.
2717
+ * @returns {Promise<Array>} The list of categories.
2718
+ */
2719
+ getCategoriesInClient(clientId: any): Promise<any>;
2720
+ /**
2721
+ * Update the categories in a client.
2722
+ * @param {string} clientId - The client ID.
2723
+ * @param {Array} categories - The categories to update.
2724
+ * @returns {Promise<Object>} The update response.
2725
+ */
2726
+ updateCategoriesInClient(clientId: any, categories: any): Promise<any>;
2727
+ /**
2728
+ * Get the list of licenses.
2729
+ * @returns The list of licenses.
2730
+ */
2731
+ getLicenses(): Promise<{
2732
+ _id: string;
2733
+ name?: string;
2734
+ link?: string;
2735
+ text?: string;
2736
+ shorttext?: string;
2737
+ }[]>;
2738
+ /**
2739
+ * Get licenses in a client.
2740
+ * @param {string} clientId - The client ID.
2741
+ * @returns {Promise<Array>} The list of licenses.
2742
+ */
2743
+ getLicensesInClient(clientId: any): Promise<any>;
2744
+ /**
2745
+ * Get a license by ID.
2746
+ * @param {string} id - The license ID.
2747
+ * @returns {Promise<Object>} The license details.
2748
+ */
2749
+ getLicense(id: any): Promise<any>;
2750
+ /**
2751
+ * Create a new license.
2752
+ * @param {Object} data - The license data.
2753
+ * @returns {Promise<Object>} The created license details.
2754
+ */
2755
+ createLicense(data: any): Promise<any>;
2756
+ /**
2757
+ * Update an existing license.
2758
+ * @param {Object} data - The license data.
2759
+ * @returns {Promise<Object>} The updated license details.
2760
+ */
2761
+ updateLicense(data: any): Promise<any>;
2762
+ /**
2763
+ * Delete a license by ID.
2764
+ * @param {string} id - The license ID.
2765
+ * @param {string} clientId - The client ID.
2766
+ * @returns {Promise<Object>} The deletion response.
2767
+ */
2768
+ deleteLicense(id: any, clientId: any): Promise<any>;
2769
+ /**
2770
+ * Get the list of public licenses for a client.
2771
+ * @param {string} clientId - The client ID.
2772
+ * @returns {Promise<Array>} The list of public licenses.
2773
+ */
2774
+ getPublicLicenses(clientId: any): Promise<any>;
2775
+ /**
2776
+ * Get a public license by ID.
2777
+ * @param {string} id - The license ID.
2778
+ * @returns {Promise<Object>} The license details.
2779
+ */
2780
+ getPublicLicense(id: any): Promise<any>;
2781
+ /**
2782
+ * Get the list of data types.
2783
+ * @returns {Promise<Array>} The list of data types.
2784
+ */
2785
+ getDatatypesList(): Promise<any>;
2786
+ /**
2787
+ * Get the list of data types.
2788
+ * @returns {Promise<Array>} The list of data types.
2789
+ */
2790
+ getPublicDatatypesList(clientId: any): Promise<any>;
2791
+ /**
2792
+ * Get the list of data types on the client.
2793
+ * @returns {Promise<Array>} The list of data types.
2794
+ */
2795
+ getDatatypesListOnClient(): Promise<any>;
2796
+ /**
2797
+ * Get the list of data types on the client for all users.
2798
+ * @returns {Promise<Array>} The list of data types.
2799
+ */
2800
+ getDatatypesListOnClientForAll(): Promise<any>;
2801
+ /**
2802
+ * Get the list of all data types.
2803
+ * @returns {Promise<Array>} The list of all data types.
2804
+ */
2805
+ getAllDatatypesList(): Promise<any>;
2806
+ /**
2807
+ * Get a data type by ID.
2808
+ * @param {string} id - The data type ID.
2809
+ * @returns {Promise<Object>} The data type details.
2810
+ */
2811
+ getDatatype(id: any): Promise<any>;
2812
+ /**
2813
+ * Create a new data type.
2814
+ * @param {Object} data - The data type data.
2815
+ * @returns {Promise<Object>} The created data type details.
2816
+ */
2817
+ createDatatype(data: any): Promise<any>;
2818
+ /**
2819
+ * Update an existing data type.
2820
+ * @param {Object} data - The data type data.
2821
+ * @returns {Promise<Object>} The updated data type details.
2822
+ */
2823
+ updateDatatype(data: any): Promise<any>;
2824
+ /**
2825
+ * Delete a data type by ID.
2826
+ * @param {string} id - The data type ID.
2827
+ * @returns {Promise<Object>} The deletion response.
2828
+ */
2829
+ deleteDatatype(id: any): Promise<any>;
2830
+ /**
2831
+ * Get the list of notifications for the current user.
2832
+ * @param {number} [maxCount] - Maximum number of notifications.
2833
+ * @returns {Promise<Array>} The list of notifications.
2834
+ */
2835
+ getMyNotifications(maxCount: any): Promise<any>;
2836
+ /**
2837
+ * Mark a notification as read.
2838
+ * @param {string} id - The notification ID.
2839
+ * @returns {Promise<Object>} The response.
2840
+ */
2841
+ markNotificationAsRead(id: any): Promise<any>;
2842
+ /**
2843
+ * Mark all notifications as read.
2844
+ * @returns {Promise<Object>} The response.
2845
+ */
2846
+ markAllNotificationsAsRead(): Promise<any>;
2847
+ /**
2848
+ * Create a new job.
2849
+ * @param data - The job data.
2850
+ * @returns The ID of the created job.
2851
+ */
2852
+ createJob(data: {
2853
+ type: string;
2854
+ elements: any[];
2855
+ parameters: any[];
2856
+ }): Promise<string>;
2857
+ /**
2858
+ * Get the list of manual job types.
2859
+ * @returns {Promise<Array>} The list of manual job types.
2860
+ */
2861
+ getManualJobTypes(): Promise<any>;
2862
+ /**
2863
+ * Get the list of manual job types on the client.
2864
+ * @returns {Promise<Array>} The list of manual job types.
2865
+ */
2866
+ getManualJobTypesOnClient(): Promise<any>;
2867
+ /**
2868
+ * Get the list of manual job types on the client for all users.
2869
+ * @returns {Promise<Array>} The list of manual job types.
2870
+ */
2871
+ getManualJobTypesOnClientForAll(): Promise<any>;
2872
+ /**
2873
+ * Get the list of all manual job types.
2874
+ * @returns {Promise<Array>} The list of manual job types.
2875
+ */
2876
+ getAllManualJobTypes(): Promise<any>;
2877
+ /**
2878
+ * Get the list of all manual job types for a client.
2879
+ * @param {string} id - The client ID.
2880
+ * @returns {Promise<Array>} The list of manual job types.
2881
+ */
2882
+ getAllManualJobTypesForClient(id: any): Promise<any>;
2883
+ /**
2884
+ * Get the list of client job types.
2885
+ * @returns {Promise<Array>} The list of client job types.
2886
+ */
2887
+ getClientJobTypes(): Promise<any>;
2888
+ /**
2889
+ * Get the list of jobs for the current user.
2890
+ * @returns The list of jobs.
2891
+ */
2892
+ getMyJobs(): Promise<{
2893
+ _id: string;
2894
+ type?: string;
2895
+ message?: string;
2896
+ state?: number;
2897
+ createdAt: string;
2898
+ elementCount: number;
2899
+ startedAt?: string;
2900
+ stoppedAt?: string;
2901
+ }[]>;
2902
+ /**
2903
+ * Get the list of all jobs.
2904
+ * @returns {Promise<Array>} The list of jobs.
2905
+ */
2906
+ getJobs(): Promise<any>;
2907
+ /**
2908
+ * Get the aggregated list of jobs.
2909
+ * @returns {Promise<Array>} The aggregated list of jobs.
2910
+ */
2911
+ getJobsAggregated(): Promise<any>;
2912
+ /**
2913
+ * Get the list of jobs within a specific timeframe.
2914
+ * @param {string} from - The start date.
2915
+ * @param {string} till - The end date.
2916
+ * @returns {Promise<Array>} The list of jobs.
2917
+ */
2918
+ getJobsTimeframe(from: any, till: any): Promise<any>;
2919
+ /**
2920
+ * Get a job by ID.
2921
+ * @param {string} id - The job ID.
2922
+ * @returns {Promise<Object>} The job details.
2923
+ */
2924
+ getJob(id: any): Promise<any>;
2925
+ /**
2926
+ * Get the state of a job.
2927
+ * @param id - The job ID.
2928
+ * @returns The job state.
2929
+ */
2930
+ getJobState(id: string): Promise<JobState>;
2931
+ /**
2932
+ * Get the list of job agents.
2933
+ * @returns {Promise<Array>} The list of job agents.
2934
+ */
2935
+ getAgents(): Promise<any>;
2936
+ /**
2937
+ * Get the aggregated list of job agents.
2938
+ * @returns {Promise<Array>} The aggregated list of job agents.
2939
+ */
2940
+ getAgentsAggregated(): Promise<any>;
2941
+ /**
2942
+ * Enable a job agent.
2943
+ * @param {string} id - The job agent ID.
2944
+ * @returns {Promise<Object>} The enable response.
2945
+ */
2946
+ enableJobAgent(id: any): Promise<any>;
2947
+ /**
2948
+ * Disable a job agent.
2949
+ * @param {string} id - The job agent ID.
2950
+ * @returns {Promise<Object>} The disable response.
2951
+ */
2952
+ disableJobAgent(id: any): Promise<any>;
2953
+ /**
2954
+ * Restart a job agent.
2955
+ * @param {string} id - The job agent ID.
2956
+ * @returns {Promise<Object>} The restart response.
2957
+ */
2958
+ restartJobAgent(id: any): Promise<any>;
2959
+ /**
2960
+ * Get the list of permissions.
2961
+ * @returns {Promise<Array>} The list of permissions.
2962
+ */
2963
+ getPermissionsList(): Promise<any>;
2964
+ /**
2965
+ * Get the list of plugins.
2966
+ * @returns {Promise<Array>} The list of plugins.
2967
+ */
2968
+ getPlugins(): Promise<any>;
2969
+ /**
2970
+ * Get the list of plans.
2971
+ * @returns {Promise<Array>} The list of plans.
2972
+ */
2973
+ getPlans(): Promise<any>;
2974
+ /**
2975
+ * Get a plan by ID.
2976
+ * @param {string} id - The plan ID.
2977
+ * @returns {Promise<Object>} The plan details.
2978
+ */
2979
+ getPlan(id: any): Promise<any>;
2980
+ /**
2981
+ * Create a new plan.
2982
+ * @param {Object} data - The plan data.
2983
+ * @returns {Promise<Object>} The created plan details.
2984
+ */
2985
+ createPlan(data: any): Promise<any>;
2986
+ /**
2987
+ * Update an existing plan.
2988
+ * @param {Object} data - The plan data.
2989
+ * @returns {Promise<Object>} The updated plan details.
2990
+ */
2991
+ updatePlan(data: any): Promise<any>;
2992
+ /**
2993
+ * Delete a plan by ID.
2994
+ * @param {string} id - The plan ID.
2995
+ * @returns {Promise<Object>} The deletion response.
2996
+ */
2997
+ deletePlan(id: any): Promise<any>;
2998
+ /**
2999
+ * Get the list of workflows.
3000
+ * @returns {Promise<Array>} The list of workflows.
3001
+ */
3002
+ getWorkflows(): Promise<any>;
3003
+ /**
3004
+ * Get a workflow by ID.
3005
+ * @param {string} id - The workflow ID.
3006
+ * @returns {Promise<Object>} The workflow details.
3007
+ */
3008
+ getWorkflow(id: any): Promise<any>;
3009
+ /**
3010
+ * Create a new workflow.
3011
+ * @param {Object} data - The workflow data.
3012
+ * @returns {Promise<Object>} The created workflow details.
3013
+ */
3014
+ createWorkflow(data: any): Promise<any>;
3015
+ /**
3016
+ * Update an existing workflow.
3017
+ * @param {Object} data - The workflow data.
3018
+ * @returns {Promise<Object>} The updated workflow details.
3019
+ */
3020
+ updateWorkflow(data: any): Promise<any>;
3021
+ /**
3022
+ * Delete a workflow by ID.
3023
+ * @param {string} id - The workflow ID.
3024
+ * @returns {Promise<Object>} The deletion response.
3025
+ */
3026
+ deleteWorkflow(id: any): Promise<any>;
3027
+ /**
3028
+ * Start a workflow.
3029
+ * @param {Object} data - The workflow data.
3030
+ * @returns {Promise<Object>} The start response.
3031
+ */
3032
+ startWorkflow(data: any): Promise<any>;
3033
+ /**
3034
+ * Get the list of access tokens.
3035
+ * @returns {Promise<Array>} The list of access tokens.
3036
+ */
3037
+ getAccessTokens(): Promise<any>;
3038
+ /**
3039
+ * Get the list of client access tokens.
3040
+ * @returns {Promise<Array>} The list of client access tokens.
3041
+ */
3042
+ getClientAccessTokens(): Promise<any>;
3043
+ /**
3044
+ * Create a new access token.
3045
+ * @param {Object} data - The access token data.
3046
+ * @returns {Promise<Object>} The created access token details.
3047
+ */
3048
+ createAccessToken(data: any): Promise<any>;
3049
+ /**
3050
+ * Create a new client access token.
3051
+ * @param {Object} data - The access token data.
3052
+ * @returns {Promise<Object>} The created client access token details.
3053
+ */
3054
+ createClientAccessToken(data: any): Promise<any>;
3055
+ /**
3056
+ * Delete an access token by ID.
3057
+ * @param {string} id - The access token ID.
3058
+ * @returns {Promise<Object>} The deletion response.
3059
+ */
3060
+ deleteAccessToken(id: any): Promise<any>;
3061
+ /**
3062
+ * Delete a client access token by ID.
3063
+ * @param {string} id - The access token ID.
3064
+ * @returns {Promise<Object>} The deletion response.
3065
+ */
3066
+ deleteClientAccessToken(id: any): Promise<any>;
3067
+ /**
3068
+ * Enable an access token.
3069
+ * @param {string} id - The access token ID.
3070
+ * @returns {Promise<Object>} The enable response.
3071
+ */
3072
+ enableAccessToken(id: any): Promise<any>;
3073
+ /**
3074
+ * Disable an access token.
3075
+ * @param {string} id - The access token ID.
3076
+ * @returns {Promise<Object>} The disable response.
3077
+ */
3078
+ disableAccessToken(id: any): Promise<any>;
3079
+ /**
3080
+ * Get the list of API tokens.
3081
+ * @returns {Promise<Array>} The list of API tokens.
3082
+ */
3083
+ getApiTokens(): Promise<any>;
3084
+ /**
3085
+ * Create a new API token.
3086
+ * @param {Object} data - The API token data.
3087
+ * @returns {Promise<Object>} The created API token details.
3088
+ */
3089
+ createApiToken(data: any): Promise<any>;
3090
+ /**
3091
+ * Delete an API token by ID.
3092
+ * @param {string} id - The API token ID.
3093
+ * @returns {Promise<Object>} The deletion response.
3094
+ */
3095
+ deleteApiToken(id: any): Promise<any>;
3096
+ /**
3097
+ * Get the list of invoices for the current user's client.
3098
+ * @returns {Promise<Array>} The list of invoices.
3099
+ */
3100
+ getMyClientInvoices(): Promise<any>;
3101
+ /**
3102
+ * Get the list of invoices for the current user.
3103
+ * @returns {Promise<Array>} The list of invoices.
3104
+ */
3105
+ getMyUserInvoices(): Promise<any>;
3106
+ /**
3107
+ * Get the list of invoices for a client.
3108
+ * @param {string} clientId - The client ID.
3109
+ * @returns {Promise<Array>} The list of invoices.
3110
+ */
3111
+ getClientInvoices(clientId: any): Promise<any>;
3112
+ /**
3113
+ * Download an invoice by ID.
3114
+ * @param {string} invoiceId - The invoice ID.
3115
+ * @param {string} [filename] - The filename for the download.
3116
+ * @returns {Promise<void>} The download action.
3117
+ */
3118
+ downloadInvoice(invoiceId: any, filename: any): Promise<void>;
3119
+ /**
3120
+ * Regenerate an invoice by ID.
3121
+ * @param {string} invoiceId - The invoice ID.
3122
+ * @returns {Promise<Object>} The regeneration response.
3123
+ */
3124
+ regenerateInvoice(invoiceId: any): Promise<any>;
3125
+ /**
3126
+ * Get the list of invoices for a specific month and year.
3127
+ * @param {number} year - The year.
3128
+ * @param {number} month - The month.
3129
+ * @returns {Promise<Array>} The list of invoices.
3130
+ */
3131
+ getInvoicesForMonth(year: any, month: any): Promise<any>;
3132
+ /**
3133
+ * Refund an invoice.
3134
+ * @param {string} invoice - The invoice ID.
3135
+ * @param {number} amount - The refund amount.
3136
+ * @param {string} reason - The reason for the refund.
3137
+ * @returns {Promise<Object>} The refund response.
3138
+ */
3139
+ refundInvoice(invoice: any, amount: any, reason: any): Promise<any>;
3140
+ /**
3141
+ * Start a checkout process for payment.
3142
+ * @param {string} successUrl - The success URL.
3143
+ * @param {string} cancelUrl - The cancel URL.
3144
+ * @returns {Promise<Object>} The checkout response.
3145
+ */
3146
+ paymentStartCheckout(successUrl: any, cancelUrl: any): Promise<any>;
3147
+ /**
3148
+ * Start a checkout process for user payment.
3149
+ * @param {string} successUrl - The success URL.
3150
+ * @param {string} cancelUrl - The cancel URL.
3151
+ * @returns {Promise<Object>} The checkout response.
3152
+ */
3153
+ paymentStartUserCheckout(successUrl: any, cancelUrl: any): Promise<any>;
3154
+ /**
3155
+ * Get the list of supported currencies.
3156
+ * @returns {Promise<Array>} The list of currencies.
3157
+ */
3158
+ getSupportedCurrencies(): Promise<any>;
3159
+ /**
3160
+ * Get the list of purchasable items.
3161
+ * @returns {Promise<Array>} The list of purchasables.
3162
+ */
3163
+ getPurchasables(): Promise<any>;
3164
+ /**
3165
+ * Get a purchasable item by ID.
3166
+ * @param {string} id - The purchasable ID.
3167
+ * @returns {Promise<Object>} The purchasable details.
3168
+ */
3169
+ getPurchasable(id: any): Promise<any>;
3170
+ /**
3171
+ * Create a new purchasable item.
3172
+ * @param {Object} data - The purchasable data.
3173
+ * @returns {Promise<Object>} The created purchasable details.
3174
+ */
3175
+ createPurchasable(data: any): Promise<any>;
3176
+ /**
3177
+ * Update an existing purchasable item.
3178
+ * @param {Object} data - The purchasable data.
3179
+ * @returns {Promise<Object>} The updated purchasable details.
3180
+ */
3181
+ updatePurchasable(data: any): Promise<any>;
3182
+ /**
3183
+ * Delete a purchasable item by ID.
3184
+ * @param {string} id - The purchasable ID.
3185
+ * @returns {Promise<Object>} The deletion response.
3186
+ */
3187
+ deletePurchasable(id: any): Promise<any>;
3188
+ /**
3189
+ * Get the list of public purchasables for a client.
3190
+ * @param clientId - The client ID.
3191
+ * @returns The list of public purchasables.
3192
+ */
3193
+ getPublicPurchasables(clientId: string): Promise<{
3194
+ _id: string;
3195
+ name?: string;
3196
+ description?: string;
3197
+ options?: {
3198
+ _id: string;
3199
+ name?: string;
3200
+ prices?: Record<string, number>;
3201
+ interval?: string;
3202
+ fastSpringProductPath?: string;
3203
+ }[];
3204
+ groupId?: string;
3205
+ pricesContainVat?: boolean;
3206
+ }[]>;
3207
+ /**
3208
+ * Get the list of purchases.
3209
+ * @returns {Promise<Array>} The list of purchases.
3210
+ */
3211
+ getPurchases(): Promise<any>;
3212
+ /**
3213
+ * Get the list of active purchases for the current user.
3214
+ * @returns {Promise<Array>} The list of purchases.
3215
+ */
3216
+ getMyActivePurchases(): Promise<{
3217
+ _id: string;
3218
+ purchasableName?: string;
3219
+ purchasableId?: string;
3220
+ active?: boolean;
3221
+ createdAt: string;
3222
+ canceledAt?: string;
3223
+ paidUntil?: string;
3224
+ priceDisplay?: string;
3225
+ intervalUnit?: string;
3226
+ intervalLength?: number;
3227
+ }[]>;
3228
+ /**
3229
+ * Make a purchase.
3230
+ * @param {Object} data - The purchase data.
3231
+ * @returns {Promise<Object>} The purchase details.
3232
+ */
3233
+ purchase(data: any): Promise<any>;
3234
+ /**
3235
+ * Change the purchasable of an existing subscription.
3236
+ * Only supported for purchases made through FastSpring.
3237
+ * @param purchaseID - The ID of the purchase / subscription to modify.
3238
+ * @param purchasableID - The ID of the new purchasable that should be used for this subscription.
3239
+ * @param optionID - The ID of the purchasables option.
3240
+ */
3241
+ changePurchaseProduct(purchaseID: any, purchasableID: string, optionID: string): Promise<void>;
3242
+ /**
3243
+ * Cancel a purchase by ID.
3244
+ * @param id - The purchase ID.
3245
+ */
3246
+ cancelPurchase(id: string): Promise<void>;
3247
+ /**
3248
+ * Uncancel an already cancelled purchase.
3249
+ * @param id - The purchase ID.
3250
+ */
3251
+ uncancelPurchase(id: string): Promise<void>;
3252
+ /**
3253
+ * Get an encrypted session payload for a FastSpring checkout.
3254
+ * @param purchasableID - The ID of the purchasable.
3255
+ * @param optionID - The ID of the option.
3256
+ * @returns The encrypted session payload and key.
3257
+ */
3258
+ getSecureSessionPayload(purchasableID: string, optionID: string): Promise<{
3259
+ payload: string;
3260
+ key: string;
3261
+ }>;
3262
+ /**
3263
+ * Query purchases with various parameters.
3264
+ * @param {string} startDate - The start date.
3265
+ * @param {string} endDate - The end date.
3266
+ * @param {string} email - The email associated with the purchase.
3267
+ * @param {string} invoice - The invoice number.
3268
+ * @param {string} [cursor] - Pagination cursor.
3269
+ * @param {number} [limit] - Result limit.
3270
+ * @returns {Promise<Array>} The list of purchases.
3271
+ */
3272
+ queryPurchases(startDate: any, endDate: any, email: any, invoice: any, cursor: any, limit: any): Promise<any>;
3273
+ /**
3274
+ * Get the list of attribute templates.
3275
+ * @returns {Promise<Array>} The list of attribute templates.
3276
+ */
3277
+ getAttributeTemplates(): Promise<any>;
3278
+ /**
3279
+ * Get an attribute template by ID.
3280
+ * @param {string} id - The attribute template ID.
3281
+ * @returns {Promise<Object>} The attribute template details.
3282
+ */
3283
+ getAttributeTemplate(id: any): Promise<any>;
3284
+ /**
3285
+ * Create a new attribute template.
3286
+ * @param {Object} data - The attribute template data.
3287
+ * @returns {Promise<Object>} The created attribute template details.
3288
+ */
3289
+ createAttributeTemplate(data: any): Promise<any>;
3290
+ /**
3291
+ * Update an existing attribute template.
3292
+ * @param {Object} data - The attribute template data.
3293
+ * @returns {Promise<Object>} The updated attribute template details.
3294
+ */
3295
+ updateAttributeTemplate(data: any): Promise<any>;
3296
+ /**
3297
+ * Delete an attribute template by ID.
3298
+ * @param {string} id - The attribute template ID.
3299
+ * @returns {Promise<Object>} The deletion response.
3300
+ */
3301
+ deleteAttributeTemplate(id: any): Promise<any>;
3302
+ /**
3303
+ * Get the list of storages.
3304
+ * @returns {Promise<Array>} The list of storages.
3305
+ */
3306
+ getStorages(): Promise<any>;
3307
+ /**
3308
+ * Get a conversation by ID.
3309
+ * @param id - The conversation ID.
3310
+ * @returns The conversation details.
3311
+ */
3312
+ getConversation(id: string): Promise<{
3313
+ conversation: {
3314
+ parent: string;
3315
+ parentType: string;
3316
+ subscribed: boolean;
3317
+ location?: string;
3318
+ };
3319
+ entries: ConversationEntry[];
3320
+ }>;
3321
+ /**
3322
+ * Get a public conversation by ID.
3323
+ * @param id - The conversation ID.
3324
+ * @returns The conversation details.
3325
+ */
3326
+ getPublicConversation(id: string): Promise<{
3327
+ conversation: {
3328
+ parent: string;
3329
+ parentType: string;
3330
+ };
3331
+ entries: ConversationEntry[];
3332
+ }>;
3333
+ /**
3334
+ * Create a new conversation.
3335
+ * @param {string} parentId - The parent ID.
3336
+ * @param {string} parentType - The parent type.
3337
+ * @returns {Promise<Object>} The created conversation details.
3338
+ */
3339
+ createConversation(parentId: any, parentType: any): Promise<any>;
3340
+ /**
3341
+ * Post a message in a conversation.
3342
+ * @param id - The conversation ID.
3343
+ * @param text - The message text.
3344
+ * @param [replyTo] - The ID of the message to reply to.
3345
+ * @returns The ID of the posted message.
3346
+ */
3347
+ postConversationMessage(id: string, text: string, replyTo?: string): Promise<string>;
3348
+ /**
3349
+ * Edit a message in a conversation.
3350
+ * @param id - The message ID.
3351
+ * @param text - The new message text.
3352
+ */
3353
+ editConversationMessage(id: string, text: string): Promise<void>;
3354
+ /**
3355
+ * Delete a message from a conversation.
3356
+ * @param id - The message ID.
3357
+ * @returns The deletion response.
3358
+ */
3359
+ deleteConversationMessage(id: string): Promise<void>;
3360
+ /**
3361
+ * Subscribe to a conversation.
3362
+ * @param {string} id - The conversation ID.
3363
+ * @returns {Promise<Object>} The subscription response.
3364
+ */
3365
+ subscribeToConversation(id: any): Promise<any>;
3366
+ /**
3367
+ * Unsubscribe from a conversation.
3368
+ * @param {string} id - The conversation ID.
3369
+ * @returns {Promise<Object>} The unsubscription response.
3370
+ */
3371
+ unsubscribeFromConversation(id: any): Promise<any>;
3372
+ /**
3373
+ * Like a conversation entry by ID.
3374
+ * @param id - The conversation entry ID.
3375
+ */
3376
+ likeConversationEntry(id: string): Promise<void>;
3377
+ /**
3378
+ * Unlike a conversation entry by ID.
3379
+ * @param id - The conversation entry ID.
3380
+ */
3381
+ unlikeConversationEntry(id: string): Promise<void>;
3382
+ /**
3383
+ * Execute a command.
3384
+ * @param {Object} data - The command data.
3385
+ * @returns {Promise<Object>} The command response.
3386
+ */
3387
+ command(data: any): Promise<any>;
3388
+ /**
3389
+ * Get the list of mail templates.
3390
+ * @returns {Promise<Array>} The list of mail templates.
3391
+ */
3392
+ getMailTemplates(): Promise<any>;
3393
+ /**
3394
+ * Get a mail template by ID.
3395
+ * @param {string} id - The mail template ID.
3396
+ * @returns {Promise<Object>} The mail template details.
3397
+ */
3398
+ getMailTemplate(id: any): Promise<any>;
3399
+ /**
3400
+ * Create a new mail template.
3401
+ * @param {Object} data - The mail template data.
3402
+ * @returns {Promise<Object>} The created mail template details.
3403
+ */
3404
+ createMailTemplate(data: any): Promise<any>;
3405
+ /**
3406
+ * Update an existing mail template.
3407
+ * @param {Object} data - The mail template data.
3408
+ * @returns {Promise<Object>} The updated mail template details.
3409
+ */
3410
+ updateMailTemplate(data: any): Promise<any>;
3411
+ /**
3412
+ * Delete a mail template by ID.
3413
+ * @param {string} id - The mail template ID.
3414
+ * @returns {Promise<Object>} The deletion response.
3415
+ */
3416
+ deleteMailTemplate(id: any): Promise<any>;
3417
+ /**
3418
+ * Add an image to a mail template.
3419
+ * @param {string} id - The mail template ID.
3420
+ * @param {string} name - The image name.
3421
+ * @param {Buffer|File} buffer - The image buffer or file.
3422
+ * @returns {Promise<Object>} The response.
3423
+ */
3424
+ addMailTemplateImage(id: any, name: any, buffer: any): Promise<any>;
3425
+ /**
3426
+ * Delete an image from a mail template.
3427
+ * @param {string} id - The mail template ID.
3428
+ * @param {string} name - The image name.
3429
+ * @returns {Promise<Object>} The deletion response.
3430
+ */
3431
+ deleteMailTemplateImage(id: any, name: any): Promise<any>;
3432
+ /**
3433
+ * Get the list of mail template names.
3434
+ * @returns {Promise<Array>} The list of mail template names.
3435
+ */
3436
+ getMailTemplateNames(): Promise<any>;
3437
+ /**
3438
+ * Get mail query results.
3439
+ * @param {string} templateName - The template name.
3440
+ * @param {string} dateStart - The start date.
3441
+ * @param {string} dateEnd - The end date.
3442
+ * @param {boolean} success - Filter by success status.
3443
+ * @returns {Promise<Array>} The query results.
3444
+ */
3445
+ getMailQuery(templateName: any, dateStart: any, dateEnd: any, success: any): Promise<any>;
3446
+ /**
3447
+ * Get mail subject and html from "viewOnline" token.
3448
+ * @param {string} token - The token from the mail.
3449
+ * @returns {Promise<{subject: string; html: string}>} The mail data.
3450
+ */
3451
+ getMail(token: any): Promise<any>;
3452
+ /**
3453
+ * Get the list of invoice templates.
3454
+ * @returns {Promise<Array>} The list of invoice templates.
3455
+ */
3456
+ getInvoiceTemplates(): Promise<any>;
3457
+ /**
3458
+ * Get an invoice template by ID.
3459
+ * @param {string} id - The invoice template ID.
3460
+ * @returns {Promise<Object>} The invoice template details.
3461
+ */
3462
+ getInvoiceTemplate(id: any): Promise<any>;
3463
+ /**
3464
+ * Create a new invoice template.
3465
+ * @param {Object} data - The invoice template data.
3466
+ * @returns {Promise<Object>} The created invoice template details.
3467
+ */
3468
+ createInvoiceTemplate(data: any): Promise<any>;
3469
+ /**
3470
+ * Update an existing invoice template.
3471
+ * @param {Object} data - The invoice template data.
3472
+ * @returns {Promise<Object>} The updated invoice template details.
3473
+ */
3474
+ updateInvoiceTemplate(data: any): Promise<any>;
3475
+ /**
3476
+ * Delete an invoice template by ID.
3477
+ * @param {string} id - The invoice template ID.
3478
+ * @returns {Promise<Object>} The deletion response.
3479
+ */
3480
+ deleteInvoiceTemplate(id: any): Promise<any>;
3481
+ /**
3482
+ * Add an image to an invoice template.
3483
+ * @param {string} id - The invoice template ID.
3484
+ * @param {string} name - The image name.
3485
+ * @param {Buffer|File} buffer - The image buffer or file.
3486
+ * @returns {Promise<Object>} The response.
3487
+ */
3488
+ addInvoiceTemplateImage(id: any, name: any, buffer: any): Promise<any>;
3489
+ /**
3490
+ * Delete an image from an invoice template.
3491
+ * @param {string} id - The invoice template ID.
3492
+ * @param {string} name - The image name.
3493
+ * @returns {Promise<Object>} The deletion response.
3494
+ */
3495
+ deleteInvoiceTemplateImage(id: any, name: any): Promise<any>;
3496
+ /**
3497
+ * Get the list of item templates.
3498
+ * @returns {Promise<Array>} The list of item templates.
3499
+ */
3500
+ getItemTemplatesList(): Promise<any>;
3501
+ /**
3502
+ * Get the list of item templates.
3503
+ * @returns {Promise<Array>} The list of item templates.
3504
+ */
3505
+ getItemTemplates(): Promise<any>;
3506
+ /**
3507
+ * Create a new item template.
3508
+ * @param {Object} data - The item template data.
3509
+ * @returns {Promise<Object>} The created item template details.
3510
+ */
3511
+ createItemTemplate(data: any): Promise<any>;
3512
+ /**
3513
+ * Update an existing item template.
3514
+ * @param {Object} data - The item template data.
3515
+ * @returns {Promise<Object>} The updated item template details.
3516
+ */
3517
+ updateItemTemplate(data: any): Promise<any>;
3518
+ /**
3519
+ * Delete an item template by ID.
3520
+ * @param {string} id - The item template ID.
3521
+ * @returns {Promise<Object>} The deletion response.
3522
+ */
3523
+ deleteItemTemplate(id: any): Promise<any>;
3524
+ /**
3525
+ * Get the list of features.
3526
+ * @returns {Promise<Array>} The list of features.
3527
+ */
3528
+ getFeatures(): Promise<any>;
3529
+ /**
3530
+ * Get the list of features on the client.
3531
+ * @returns {Promise<Array>} The list of features.
3532
+ */
3533
+ getFeaturesOnClient(): Promise<any>;
3534
+ /**
3535
+ * Get the list of features on the client for all users.
3536
+ * @returns {Promise<Array>} The list of features.
3537
+ */
3538
+ getFeaturesOnClientForAll(): Promise<any>;
3539
+ /**
3540
+ * Get the list of all features.
3541
+ * @returns {Promise<Array>} The list of features.
3542
+ */
3543
+ getAllFeatures(): Promise<any>;
3544
+ /**
3545
+ * List all blogs from the current client that the requesting user has access
3546
+ * to (i.e. blogs the user is an owner or editor of).
3547
+ * @returns {Promise<Array>} The list of accessible blogs.
3548
+ */
3549
+ getBlogs(): Promise<any>;
3550
+ /**
3551
+ * Get a specific blog from the current client that the requesting user has
3552
+ * access to (i.e. a blog the user is an owner or editor of).
3553
+ * @param {string} id - The blog ID.
3554
+ * @returns {Promise<Object>} The requested blog.
3555
+ */
3556
+ getBlog(id: any): Promise<any>;
3557
+ /**
3558
+ * Get the public information about a public blog.
3559
+ * @param {string} id - The blog ID.
3560
+ * @returns {Promise<Object>} The requested blog.
3561
+ */
3562
+ getPublicBlog(id: any): Promise<any>;
3563
+ /**
3564
+ * Create a new blog.
3565
+ * @param {string} name - The blog name.
3566
+ * @param {boolean} isPublic - Whether the blog is public.
3567
+ * @param {boolean} commentsEnabled - Whether comments are enabled.
3568
+ * @param {Array<string>} editors - The list of editor user IDs.
3569
+ * @returns {Promise<void>}
3570
+ */
3571
+ createBlog(name: any, isPublic: any, commentsEnabled: any, editors: any): Promise<any>;
3572
+ /**
3573
+ * Save an update to a blog.
3574
+ * @param {string} id - The blog ID.
3575
+ * @param {string} name - The blog name.
3576
+ * @param {boolean} isPublic - Whether the blog is public.
3577
+ * @param {boolean} commentsEnabled - Whether comments are enabled.
3578
+ * @param {Array<string>} editors - The list of editor user IDs.
3579
+ * @returns {Promise<void>}
3580
+ */
3581
+ saveBlog(id: any, name: any, isPublic: any, commentsEnabled: any, editors: any): Promise<any>;
3582
+ /**
3583
+ * Delete a blog.
3584
+ * @param {string} id - The blog ID.
3585
+ * @returns {Promise<void>}
3586
+ */
3587
+ deleteBlog(id: any): Promise<any>;
3588
+ /**
3589
+ * Get articles for an overview of a blog.
3590
+ * @param id - The blog ID.
3591
+ * @returns An overview of the featured article and the most recent amd most popular articles.
3592
+ */
3593
+ getBlogOverview(id: string): Promise<{
3594
+ featured: BaseBlogArticle & {
3595
+ imageID?: string;
3596
+ text: string;
3597
+ publishedAt?: string;
3598
+ };
3599
+ mostRecent: (BaseBlogArticle & {
3600
+ imageID?: string;
3601
+ publishedAt?: string;
3602
+ })[];
3603
+ mostPopular: (BaseBlogArticle & {
3604
+ imageID?: string;
3605
+ publishedAt?: string;
3606
+ })[];
3607
+ }>;
3608
+ /**
3609
+ * Query a blog for articles.
3610
+ * @param id - The blog ID.
3611
+ * @param tag - Require the articles to include this exact.
3612
+ * @param text - Require the articles to contain this text in their content or title.
3613
+ * @param limit - Limit the amount of returned articles, min = 2, max = 24, default = 24.
3614
+ * @param previousArticle - publishedAt date of the previous article to get the next page of articles.
3615
+ * @param searchTag - Find all tags that include this substring.
3616
+ * @param sortBy - By default the list is sorted by publishing date, if this field is 'views', they will be sorted by amount of views instead.
3617
+ * @returns An object with two arrays: "articles" (which includes the articles that match the query) and "tags" (which contains the tags that match the searchTag string, only exists if searchTag was specified)
3618
+ */
3619
+ queryBlog(id: string, tag?: string, text?: string, limit?: number, previousArticle?: string, searchTag?: string, sortBy?: string): Promise<{
3620
+ articles: BaseBlogArticle & {
3621
+ text: string;
3622
+ publishedAt: string;
3623
+ imageID?: string;
3624
+ }[];
3625
+ tags: string[];
3626
+ }>;
3627
+ /**
3628
+ * List all accessible articles from a blog (i.e. articles from blogs that the
3629
+ * user is an owner or editor of).
3630
+ * @param {string} blogID - The blog ID.
3631
+ * @returns {Promise<Array>} The list of articles.
3632
+ */
3633
+ getArticles(blogID: any): Promise<any>;
3634
+ /**
3635
+ * Get a specific accessible article from a blog (i.e. articles from blogs that the
3636
+ * user is an owner or editor of).
3637
+ * @param {string} blogID - The blog ID.
3638
+ * @param {string} id - The article ID.
3639
+ * @returns {Promise<Object>} The requested article.
3640
+ */
3641
+ getArticle(blogID: any, id: any): Promise<any>;
3642
+ /**
3643
+ * Get a specific public article from a blog by specifying the unique slug.
3644
+ * @param blogID - The blog ID.
3645
+ * @param slug - The slug of the article.
3646
+ * @returns The requested article.
3647
+ */
3648
+ getArticleBySlug(clientID: string, slug: string): Promise<BaseBlogArticle & {
3649
+ author: string;
3650
+ content: string;
3651
+ publishedAt?: string;
3652
+ }>;
3653
+ /**
3654
+ * Create a new article in an accesible blog.
3655
+ * @param {string} blogID - The blog ID.
3656
+ * @param {string} title - The article title.
3657
+ * @param {string} slug - The article slug.
3658
+ * @returns {Promise<void>}
3659
+ */
3660
+ createArticle(blogID: any, title: any, slug: any): Promise<any>;
3661
+ /**
3662
+ * Save an update to an article.
3663
+ * @param {string} blogID - The blog ID.
3664
+ * @param {string} id - The article ID.
3665
+ * @param {string} title - The article title.
3666
+ * @param {string} slug - The article slug.
3667
+ * @param {boolean} isPublic - Whether the article is public.
3668
+ * @param {Array<string>} tags - The list of tags.
3669
+ * @param {string} author - The author user ID.
3670
+ * @param {string} content - The article content.
3671
+ * @returns {Promise<void>}
3672
+ */
3673
+ saveArticle(blogID: any, id: any, title: any, slug: any, isPublic: any, tags: any, author: any, content: any): Promise<any>;
3674
+ /**
3675
+ * Delete an article.
3676
+ * @param {string} blogID - The blog ID.
3677
+ * @param {string} id - The article ID.
3678
+ * @returns {Promise<void>}
3679
+ */
3680
+ deleteArticle(blogID: any, id: any): Promise<any>;
3681
+ /**
3682
+ * List all accessible newsletters of the current client. Users without the
3683
+ * newsletter_admin permission will only receive the newsletters they are an
3684
+ * editor of.
3685
+ * @returns {Promise<Array>} The list of newsletters.
3686
+ */
3687
+ getNewsletters(): Promise<any>;
3688
+ /**
3689
+ * Create a new newsletter, only available for client admins.
3690
+ * @param {string} name - The name of the newsletter.
3691
+ * @param {Array<string>} editors - The list of editor user IDs.
3692
+ * @returns {Promise<Object>} Object with the id of the created newsletter.
3693
+ */
3694
+ createNewsletter(name: any, editors: any): Promise<any>;
3695
+ /**
3696
+ * Get a specific newsletter
3697
+ * @param {string} id - The newsletter ID.
3698
+ * @returns {Promise<Object>} The requested newsletter.
3699
+ */
3700
+ getNewsletter(id: any): Promise<any>;
3701
+ /**
3702
+ * Edit a newsletter, only available for client admins.
3703
+ * @param {string} id - The newsletter ID.
3704
+ * @param {string} name - The name of the newsletter.
3705
+ * @param {string} sender - The sender name of the newsletter.
3706
+ * @param {Array<string>} editors - The list of editor user IDs.
3707
+ * @returns {Promise<Object>} The new state of the newsletter.
3708
+ */
3709
+ updateNewsletter(id: any, name: any, sender: any, editors: any): Promise<any>;
3710
+ /**
3711
+ * Delete a newsletter, only available for client admins.
3712
+ * @param {string} id - The newsletter ID.
3713
+ * @returns {Promise<void>}
3714
+ */
3715
+ deleteNewsletter(id: any): Promise<any>;
3716
+ /**
3717
+ * Join a newsletter.
3718
+ * @param id - The newsletter ID.
3719
+ * @param email - The email of the user that wants to join the newsletter.
3720
+ */
3721
+ joinNewsletter(id: string, email: string): Promise<void>;
3722
+ /**
3723
+ * Confirm the email address that wants to receive a newsletter.
3724
+ * @param {string} token - The token from the email.
3725
+ * @returns {Promise<void>}
3726
+ */
3727
+ confirmNewsletter(token: any): Promise<any>;
3728
+ /**
3729
+ * Unsubscribe an email address from a newsletter.
3730
+ * @param token - The token from the email.
3731
+ */
3732
+ unsubscribeFromNewsletter(token: string): Promise<void>;
3733
+ /**
3734
+ * List all newsletter blocks of the current client. Requires the newsletter_admin permission.
3735
+ * @returns {Promise<Array>} The list of newsletter blocks.
3736
+ */
3737
+ getNewsletterBlocks(): Promise<any>;
3738
+ /**
3739
+ * Returns one specific newsletter block from the current client. Requires the newsletter_admin permission.
3740
+ * @param {string} id - The block ID.
3741
+ * @returns {Promise<Object>} The requested newsletter blocks.
3742
+ */
3743
+ getNewsletterBlock(id: any): Promise<any>;
3744
+ /**
3745
+ * Create a new newsletter block in the current client.
3746
+ * @param {string} name - The name of the new block.
3747
+ * @returns {Promise<void>}
3748
+ */
3749
+ createNewsletterBlock(name: any): Promise<any>;
3750
+ /**
3751
+ * Update a newsletter block in the current client.
3752
+ * @param {string} id - The ID of the block
3753
+ * @param {string} name - The new name name.
3754
+ * @param {object} inputs - The new inputs data, see API documentation.
3755
+ * @param {string} html - The new HTML content.
3756
+ * @param {string} css - The new CSS content.
3757
+ * @param {boolean} acceptsChildren - Whether the block accepts children.
3758
+ * @returns {Promise<void>}
3759
+ */
3760
+ updateNewsletterBlock(id: any, name: any, inputs: any, html: any, css: any, acceptsChildren: any): Promise<any>;
3761
+ /**
3762
+ * Delete a newsletter block.
3763
+ * @param {string} id - The newsletter block ID.
3764
+ * @returns {Promise<void>}
3765
+ */
3766
+ deleteNewsletterBlock(id: any): Promise<any>;
3767
+ /**
3768
+ * List all newsletter mails of the from a specific newsletter. The user needs to be an editor of the newsletter or have the newsletter_admin permission.
3769
+ * @param {string} newsletterID - The newsletter ID.
3770
+ * @returns {Promise<Array>} The list of newsletter mails.
3771
+ */
3772
+ getNewsletterMails(newsletterID: any): Promise<any>;
3773
+ /**
3774
+ * Returns one specific newsletter mail. The user needs to be an editor of the newsletter or have the newsletter_admin permission.
3775
+ * @param {string} newsletterID - The newsletter ID.
3776
+ * @param {string} mailID - The newsletter mail ID.
3777
+ * @returns {Promise<Object>} The requested newsletter mail.
3778
+ */
3779
+ getNewsletterMail(newsletterID: any, mailID: any): Promise<any>;
3780
+ /**
3781
+ * Create a new newsletter mail in the current client. The user needs to be an editor of the newsletter or have the newsletter_admin permission.
3782
+ * @param {string} newsletterID - The newsletter ID.
3783
+ * @param {string} title - The title of the new mail.
3784
+ * @returns {Promise<void>}
3785
+ */
3786
+ createNewsletterMail(newsletterID: any, title: any): Promise<any>;
3787
+ /**
3788
+ * Update a newsletter mail in the current client. The user needs to be an editor of the newsletter or have the newsletter_admin permission.
3789
+ * @param {string} newsletterID - The newsletter ID.
3790
+ * @param {string} mailID - The newsletter mail ID.
3791
+ * @param {string} title - The title of the mail.
3792
+ * @param {Array} blocks - The blocks that make up the mail.
3793
+ * @param {string} parentBlock - The parent block of the mail.
3794
+ * @returns {Promise<void>}
3795
+ */
3796
+ updateNewsletterMail(newsletterID: any, mailID: any, title: any, blocks: any, parentBlock: any): Promise<any>;
3797
+ /**
3798
+ * Render a newsletter mail from the specified blocks. Requires the newsletter_admin permission.
3799
+ * @param {Array} blocks - The blocks that make up the mail.
3800
+ * @param {string} parentBlock - The parent block of the mail.
3801
+ * @returns {Promise<void>}
3802
+ */
3803
+ generatePreviewNewsletterMail(blocks: any, parentBlock: any): Promise<any>;
3804
+ /**
3805
+ * Send out a test of this newsletter mail to a specified recipient. The user needs to be an editor of the newsletter or have the newsletter_admin permission.
3806
+ * @param {string} newsletterID - The newsletter ID.
3807
+ * @param {string} mailID - The newsletter mail ID.
3808
+ * @param {string} recipientEmail - The recipient of this test mail.
3809
+ * @returns {Promise<void>}
3810
+ */
3811
+ sendTestNewsletter(newsletterID: any, mailID: any, recipientEmail: any): Promise<any>;
3812
+ /**
3813
+ * Send out this newsletter mail to all subscribers. Requires the newsletter_admin permission.
3814
+ * @param {string} newsletterID - The newsletter ID.
3815
+ * @param {string} mailID - The newsletter mail ID.
3816
+ * @returns {Promise<void>}
3817
+ */
3818
+ sendOutNewsletter(newsletterID: any, mailID: any): Promise<any>;
3819
+ /**
3820
+ * List all pages of the current client. Only available for page admins.
3821
+ * @returns {Promise<Array>} The list of pages.
3822
+ */
3823
+ getPages(): Promise<any>;
3824
+ /**
3825
+ * Create a new page. only available for page admins.
3826
+ * @param {string} title - The title of the page.
3827
+ * @param {string} slug - The slug of the page.
3828
+ * @returns {Promise<void>}
3829
+ */
3830
+ createPage(title: any, slug: any): Promise<any>;
3831
+ /**
3832
+ * Get a specific page. Only available for page admins.
3833
+ * @param {string} id - The page ID.
3834
+ * @returns {Promise<Object>} The requested page.
3835
+ */
3836
+ getPage(id: any): Promise<any>;
3837
+ /**
3838
+ * Edit a page. Only available for page admins.
3839
+ * @param {string} id - The page ID.
3840
+ * @param {string} title - The title of the page.
3841
+ * @param {string} slug - The slug of the page.
3842
+ * @param {boolean} isPublic - Whether or not the page is public.
3843
+ * @param {string} content - The slug of the page.
3844
+ * @returns {Promise<void>}
3845
+ */
3846
+ updatePage(id: any, title: any, slug: any, isPublic: any, content: any): Promise<any>;
3847
+ /**
3848
+ * Delete a page. Only available for page admins.
3849
+ * @param {string} id - The page ID.
3850
+ * @returns {Promise<void>}
3851
+ */
3852
+ deletePage(id: any): Promise<any>;
3853
+ /**
3854
+ * Get a public page by slug from a client.
3855
+ * @param {string} clientID - The ID of the client.
3856
+ * @param {string} slug - The slug of the page.
3857
+ * @returns {Promise<Object>} The requested page.
3858
+ */
3859
+ getPublicPage(clientID: any, slug: any): Promise<any>;
3860
+ /**
3861
+ * Set the item flags for an item
3862
+ * @param {string} itemID - The ID of the item.
3863
+ * @param {boolean} isStaffPick - Whether the item is a staff pick.
3864
+ * @param {number} featureWeight - The feature weight of the item, lower values are shown higher in Lemonate.
3865
+ * @param {boolean} isGame - Whether the item is a game.
3866
+ * @param {boolean} replaceIndex - If the current item at this index should be replaced.
3867
+ * @param {number} internalRating - The internal rating of this item.
3868
+ * @returns {Promise<void>}
3869
+ */
3870
+ setItemFlag(itemID: any, isStaffPick: any, featureWeight: any, isGame: any, replaceIndex: any, internalRating: any): Promise<any>;
3871
+ /**
3872
+ * Get the download URL for an item.
3873
+ * @param {string} id - The item ID.
3874
+ * @returns {string} The download URL.
3875
+ */
3876
+ getDownloadUrl(id: any): string;
3877
+ /**
3878
+ * Get the download URL for an item attachment.
3879
+ * @param id - The item ID.
3880
+ * @param name - The attachment name.
3881
+ * @param queryParam - The attachment query parameter. Can be the dimension of the image, index of that type etc.
3882
+ * @param index - The attachment index. Optional, defaults to 0.
3883
+ * @returns The attachment download URL.
3884
+ */
3885
+ getAttachmentDownloadUrl(id: string, name: string, queryParam: number, index?: number): string;
3886
+ /**
3887
+ * Get the public download URL for an item attachment.
3888
+ * @param id - The item ID.
3889
+ * @param name - The attachment name.
3890
+ * @param queryParam - The attachment query parameter. Can be the dimension of the image, index of that type etc.
3891
+ * @param index - The attachment index. Optional, defaults to 0.
3892
+ * @returns The attachment download URL.
3893
+ */
3894
+ getPublicAttachmentDownloadUrl(id: string, name: string, queryParam: number, index?: number): string;
3895
+ /**
3896
+ * Get the public download URL for an item.
3897
+ * @param id - The item ID.
3898
+ * @returns The public download URL.
3899
+ */
3900
+ getPublicDownloadUrl(id: string): string;
3901
+ /**
3902
+ * Post new feedback.
3903
+ * @param text - The text of the feedback
3904
+ */
3905
+ postFeedback(text: string): Promise<void>;
3906
+ }
3907
+
3908
+ declare class ApiGateway {
3909
+ apiClient: ApiClient;
3910
+ debug: boolean;
3911
+ apiCalls: any[];
3912
+ apiCallsStartTime: moment.Moment | null;
3913
+ constructor(apiClient: ApiClient);
3914
+ start(): void;
3915
+ end(): void;
3916
+ call(caller: string, method: string, ...params: any[]): Promise<any>;
3917
+ }
3918
+
3919
+ declare class ItemChangeProcessor {
3920
+ updateItemLinksAndAttributes(item: PreparedItem, includeLinkItems: boolean, clearUnusedLinks: boolean): void;
3921
+ getLinksAndAttributes(item: PreparedItem, links: Array<any>, attributes: object, userAttributes: object, includeItems: boolean, clearUnusedLinks: boolean): void;
3922
+ retrieveLinksAndAttributesFromFieldInstances(fieldInstances: Array<any>, links: Array<any>, attributes: object, includeLinkItems: boolean, clearUnusedLinks: boolean): void;
3923
+ traverseTreeFieldInstance(blocks: Array<any>, links: Array<any>, attributes: object, path: string, includeLinkItems: boolean): void;
3924
+ traverseListFieldInstances(blocks: Array<any>, links: Array<any>, attributes: object, path: string, includeLinkItems: boolean): void;
3925
+ processScripts(scripts: Array<any>, links: Array<any>, attributes: object, path: string, includeLinkItems: boolean): void;
3926
+ }
3927
+
3928
+ declare class ItemPreparator {
3929
+ itemRepo: ItemRepo;
3930
+ itemFetcher: Function;
3931
+ constructor(itemRepo: ItemRepo);
3932
+ setItemFetcher(itemFetcher: Function): void;
3933
+ setFieldsFromDatatypes(item: PreparedItem): void;
3934
+ prepare(item: any): Promise<PreparedItem>;
3935
+ createFieldInstances(item: PreparedItem, fields: any[], attributes: Record<string, unknown>, path: string, attributeSrc: string, doNotFillValues?: boolean): Promise<Field[]>;
3936
+ getFieldSet(item: PreparedItem, name: string): {
3937
+ name: string;
3938
+ fields: any[];
3939
+ } | null;
3940
+ fetchLinkValue(item: PreparedItem, linkUsage: string): Promise<{
3941
+ id: string;
3942
+ linkItem: any;
3943
+ stopRecursion: boolean | undefined;
3944
+ } | {
3945
+ id: null;
3946
+ linkItem: null;
3947
+ stopRecursion?: undefined;
3948
+ }>;
3949
+ readBlocks(item: PreparedItem, parentBlock: Block | undefined, templates: Array<any>, treeNamespace: string, attributes: Record<string, unknown>, readChildren: boolean, readScripts: boolean, parentType: string): Promise<Array<any>>;
3950
+ readScripts(item: PreparedItem, parentBlock: Block, treeNamespace: string, attributes: Record<string, unknown>): Promise<Array<any>>;
3951
+ existsScriptNamespace(item: PreparedItem, attributes: Record<string, unknown>, namespace: string): boolean;
3952
+ readConnections(item: PreparedItem, graphNamespace: string, attributes: Record<string, unknown>): Array<Connection>;
3953
+ existsBlockNamespace(item: PreparedItem, attributes: Record<string, unknown>, namespace: string): boolean;
3954
+ createFields(block: Block, item: PreparedItem, template: Template, blockPath: string, isGraphBlockField: boolean, attributes: Record<string, unknown>): Promise<Field[]>;
3955
+ static refreshFieldDependencies(fields: Field[]): void;
3956
+ }
3957
+
3958
+ type MetadataItem = {
3959
+ _id: string;
3960
+ name: string;
3961
+ hash: string;
3962
+ type: string;
3963
+ mimeType: string;
3964
+ folder: {
3965
+ _id: string;
3966
+ };
3967
+ links: {
3968
+ to: string;
3969
+ item?: MetadataItem;
3970
+ }[];
3971
+ filesize: number;
3972
+ packageFileOffset?: number;
3973
+ attachments: {
3974
+ name: string;
3975
+ queryParam: number;
3976
+ index: number;
3977
+ filesize: number;
3978
+ packageFileOffset?: number;
3979
+ mimeType: string;
3980
+ hash: string;
3981
+ type: string;
3982
+ }[];
3983
+ };
3984
+ type MetadataItemMap = {
3985
+ [id: string]: MetadataItem;
3986
+ };
3987
+ type PackageCache = {
3988
+ files: {
3989
+ [id: string]: {
3990
+ blob: Blob;
3991
+ hash: string;
3992
+ itemName: string;
3993
+ itemType: string;
3994
+ mimeType: string;
3995
+ };
3996
+ };
3997
+ folders: {
3998
+ [id: string]: {
3999
+ _id: string;
4000
+ name: string;
4001
+ parent: string;
4002
+ };
4003
+ };
4004
+ items: MetadataItemMap;
4005
+ };
4006
+ type ParsedPackage = {
4007
+ metadata: MetadataItemMap;
4008
+ rootItem: MetadataItem;
4009
+ folders: typeof packageCache["folders"];
4010
+ files: {
4011
+ [key: string]: Buffer<any>;
4012
+ };
4013
+ };
4014
+ declare const packageCache: PackageCache;
4015
+ declare function getFileFromCache(itemID: string): {
4016
+ blob: Blob;
4017
+ hash: string;
4018
+ itemName: string;
4019
+ itemType: string;
4020
+ mimeType: string;
4021
+ };
4022
+ declare function getFolders(): {
4023
+ [id: string]: {
4024
+ _id: string;
4025
+ name: string;
4026
+ parent: string;
4027
+ };
4028
+ };
4029
+ declare function getFolder(id: string): {
4030
+ _id: string;
4031
+ name: string;
4032
+ parent: string;
4033
+ };
4034
+ declare function findFolder(name: string, parentID: string): {
4035
+ _id: string;
4036
+ name: string;
4037
+ parent: string;
4038
+ } | undefined;
4039
+ declare function findItem(name: string, parentID: string): MetadataItem | undefined;
4040
+ declare function getItems(): MetadataItemMap;
4041
+ declare function getItemFromCache(itemID: string): MetadataItem;
4042
+ declare function addPackageToCache(packageID: string, packageContent: ParsedPackage): void;
4043
+ declare function parsePackage(binaryBlob: Blob, pkgID: string): Promise<ParsedPackage>;
4044
+ declare function createAttachmentID(id: string, name: string, queryParam: number, index: number): string;
4045
+ declare function queryAttachments(item: MetadataItem, name: string, queryParam?: number, index?: number): {
4046
+ name: string;
4047
+ queryParam: number;
4048
+ index: number;
4049
+ filesize: number;
4050
+ packageFileOffset?: number;
4051
+ mimeType: string;
4052
+ hash: string;
4053
+ type: string;
4054
+ } | null;
4055
+ declare function getAttachmentFromPackageCache(id: string, name: string, queryParam?: number, index?: number): {
4056
+ blob: Blob;
4057
+ hash: string;
4058
+ itemName: string;
4059
+ itemType: string;
4060
+ mimeType: string;
4061
+ } | null | undefined;
4062
+
4063
+ type Package_MetadataItem = MetadataItem;
4064
+ declare const Package_addPackageToCache: typeof addPackageToCache;
4065
+ declare const Package_createAttachmentID: typeof createAttachmentID;
4066
+ declare const Package_findFolder: typeof findFolder;
4067
+ declare const Package_findItem: typeof findItem;
4068
+ declare const Package_getAttachmentFromPackageCache: typeof getAttachmentFromPackageCache;
4069
+ declare const Package_getFileFromCache: typeof getFileFromCache;
4070
+ declare const Package_getFolder: typeof getFolder;
4071
+ declare const Package_getFolders: typeof getFolders;
4072
+ declare const Package_getItemFromCache: typeof getItemFromCache;
4073
+ declare const Package_getItems: typeof getItems;
4074
+ declare const Package_parsePackage: typeof parsePackage;
4075
+ declare const Package_queryAttachments: typeof queryAttachments;
4076
+ declare namespace Package {
4077
+ export { Package_addPackageToCache as addPackageToCache, Package_createAttachmentID as createAttachmentID, Package_findFolder as findFolder, Package_findItem as findItem, Package_getAttachmentFromPackageCache as getAttachmentFromPackageCache, Package_getFileFromCache as getFileFromCache, Package_getFolder as getFolder, Package_getFolders as getFolders, Package_getItemFromCache as getItemFromCache, Package_getItems as getItems, Package_parsePackage as parsePackage, Package_queryAttachments as queryAttachments };
4078
+ export type { Package_MetadataItem as MetadataItem };
4079
+ }
4080
+
4081
+ declare class ItemRepo {
4082
+ apiClient: ApiClient;
4083
+ activeItem: PreparedItem | undefined;
4084
+ rootItemId: string | undefined;
4085
+ loadingItems: Map<string, Promise<PreparedItem | undefined>>;
4086
+ loadedItems: Map<string, PreparedItem>;
4087
+ itemInstances: Map<string, Map<string, PreparedItem>>;
4088
+ resolvedPaths: Map<string, string>;
4089
+ jail: any;
4090
+ apiGateway: ApiGateway;
4091
+ itemCache: ItemCache;
4092
+ linkableItemsCache: LinkableItemsCache;
4093
+ undoManager: UndoManager;
4094
+ itemPreparator: ItemPreparator;
4095
+ itemChangeProcessor: ItemChangeProcessor;
4096
+ usePublicApi: boolean;
4097
+ constructor(usePublicApi: boolean, apiClient: ApiClient);
4098
+ _logGroup(msg: string): void;
4099
+ _logGroupEnd(): void;
4100
+ _log(msg: string): void;
4101
+ getLoadedItems(): PreparedItem[];
4102
+ getItemInstances(): Map<string, Map<string, PreparedItem>>;
4103
+ findLoadedItem(id: string): PreparedItem | undefined;
4104
+ _handleError(err: any, message: string): void;
4105
+ getUndoManager(): UndoManager;
4106
+ createFieldsForItem(block: Block, template: Template, ownerItem: PreparedItem): Promise<Field[]>;
4107
+ createScriptsForItem(block: Block, scriptData: any[] | undefined, ownerItem: PreparedItem, proxify?: boolean): Promise<void>;
4108
+ clear(): void;
4109
+ removeBlock(block: Block, parent: any): void;
4110
+ traverseBlockPairs(b1: Block, b2: Block, func: Function): void;
4111
+ copyScripts(oldBlock: Block, newBlock: Block, deferInitCall?: boolean): Script[];
4112
+ updateScriptFieldReferences(oldBlock: Block, newBlock: Block): void;
4113
+ updateScriptFieldReferencesFromMap(nodeFieldMap: Map<string, string>, block: Block): void;
4114
+ createNewBlock(templateEntry: TemplateEntry, parent: Block, ownerItem: PreparedItem): Promise<Block>;
4115
+ addBlockToParent(block: Block, parent: Block, item: PreparedItem): Block;
4116
+ createNewListEntry(templateEntry: TemplateEntry, field: Field, ownerItem: PreparedItem): Promise<any>;
4117
+ createNewGraphNode(templateEntry: TemplateEntry, graph: Field, x: number, y: number, ownerItem: PreparedItem): Promise<Block>;
4118
+ addNodeToGraph(block: Block, graph: Field, item: PreparedItem): void;
4119
+ removeGraphNode(graph: Field, node: Block): void;
4120
+ addGraphLink(graph: Field, srcNode: string, srcSlot: number, destNode: string, destSlot: number, ownerItem: PreparedItem): void;
4121
+ removeGraphLink(graph: Field, srcNode: string, srcSlot: number, destNode: string, destSlot: number): void;
4122
+ createNewScript(parent: Block, index: number | undefined, ownerItem: PreparedItem): Script;
4123
+ removeScript(script: Script, parent: Block): void;
4124
+ findBlock(id: string): Block | null;
4125
+ loadPackage(url: string): Promise<PreparedItem>;
4126
+ createPackageItemUrl(itemId: string): string | null;
4127
+ revokePackageItemUrl(url: string): void;
4128
+ _loadPackageContentRecursively(item: any, reportProgressFunc: Function): Promise<PreparedItem[]>;
4129
+ createNewItemInstance(itemId: string): PreparedItem | null;
4130
+ _addLoadedItem(item: any): void;
4131
+ _addItemInstance(item: any): void;
4132
+ loadItemByRelativePath(itemId: string, path: string, options?: any): Promise<PreparedItem | undefined>;
4133
+ _loadItemFromApi(id: string, options?: any): Promise<any[]>;
4134
+ _relinkItems(items: PreparedItem[], referenceMap: Map<string, PreparedItem>): void;
4135
+ /**
4136
+ *
4137
+ * @param id
4138
+ * @param options object
4139
+ * @param options.parentId
4140
+ * @param options.recursive boolean
4141
+ * @param options.withCollaboration boolean
4142
+ * @param options.progressCallback function
4143
+ * @returns {Promise<PreparedItem | null>}
4144
+ */
4145
+ loadItem(id: string, options?: any): Promise<PreparedItem | undefined>;
4146
+ _loadItemInternal(id: string, options?: any): Promise<PreparedItem | undefined>;
4147
+ _linkAndPrepareItems(items: PreparedItem[]): Promise<PreparedItem[]>;
4148
+ resolveRelativePath(path: string, itemId?: string | null): Promise<any>;
4149
+ traverseItems(func: Function, rootItem?: PreparedItem | MetadataItem | undefined): Promise<void>;
4150
+ traverseBlocks(func: Function, blocks: Block[]): Promise<void>;
4151
+ traverseFieldInstances(func: Function, fieldInstances: Field[]): Promise<void>;
4152
+ replaceLink(oldId: string, newId: string): Promise<void>;
4153
+ saveItem(item: PreparedItem): Promise<PreparedItem> | null;
4154
+ save(): Promise<void>;
4155
+ existsUnsavedChanges(): Promise<boolean>;
4156
+ handleRename({ id, newName }: {
4157
+ id: any;
4158
+ newName: any;
4159
+ }): void;
4160
+ }
4161
+
4162
+ declare class ProxyEvent {
4163
+ type?: string;
4164
+ itemId?: string;
4165
+ elementId?: string;
4166
+ target?: string;
4167
+ prop?: string;
4168
+ value?: any;
4169
+ oldValue?: any;
4170
+ createdAt: number;
4171
+ moveTargetArray?: any[];
4172
+ moveTargetArrayIndex?: number;
4173
+ moveTargetElementId?: string;
4174
+ start?: number;
4175
+ length?: number;
4176
+ position?: number;
4177
+ elementsToDelete?: any[];
4178
+ field?: Field;
4179
+ fieldId?: string;
4180
+ isLink?: boolean;
4181
+ bundleIndex: number;
4182
+ private _undoFunction?;
4183
+ private _redoFunction?;
4184
+ constructor(type?: string, itemId?: string, elementId?: string, target?: any, prop?: any, value?: any, oldValue?: any);
4185
+ undo(): Promise<void>;
4186
+ redo(): Promise<void>;
4187
+ setUndoFunction(fn: Function): void;
4188
+ setRedoFunction(fn: Function): void;
4189
+ setMoveTarget(array: any[], index: number, elementId: string): void;
4190
+ setRange(start: number, length: number): void;
4191
+ setPosition(position: number): void;
4192
+ setElementsToDelete(elements: any[]): void;
4193
+ setField(field: Field): void;
4194
+ setFieldId(id: string): void;
4195
+ setIsLink(isLink: boolean): void;
4196
+ clone(): ProxyEvent & this;
4197
+ isWithinMergeDeltaOf(other: ProxyEvent): boolean;
4198
+ isMergeableWith(other: ProxyEvent): any;
4199
+ merge(other: ProxyEvent): (ProxyEvent & this) | null;
4200
+ }
4201
+
4202
+ declare class SnapshotEntry {
4203
+ id: string;
4204
+ items: {
4205
+ _id: string;
4206
+ instanceId: string;
4207
+ data: Snapshot;
4208
+ }[];
4209
+ }
4210
+ declare class UndoManager {
4211
+ itemRepo: ItemRepo;
4212
+ undoEvents: ProxyEvent[];
4213
+ redoEvents: ProxyEvent[];
4214
+ maxUndoCount: number;
4215
+ enabled: boolean;
4216
+ snapshots: Map<string, SnapshotEntry>;
4217
+ private _undoRedoPromise;
4218
+ constructor(itemRepo: ItemRepo, maxUndoCount?: number);
4219
+ clear(): void;
4220
+ createSnapshot(): string;
4221
+ rollbackFromSnapshot(id: string): void;
4222
+ _grabSnapshot(item: PreparedItem): Snapshot;
4223
+ _getFieldInstance(item: PreparedItem, id: string): Field | null;
4224
+ _rollbackFromSnapshot(item: PreparedItem, snapshot: Snapshot): void;
4225
+ getEnabled(): boolean;
4226
+ setEnabled(value: boolean): void;
4227
+ ignore(func: Function): any;
4228
+ undo(count: number): Promise<void>;
4229
+ redo(count: number): Promise<void>;
4230
+ private _performUndo;
4231
+ private _performRedo;
4232
+ getUndoSteps(): {
4233
+ type: string | undefined;
4234
+ itemId: string | undefined;
4235
+ prop: string | undefined;
4236
+ }[];
4237
+ getRedoSteps(): {
4238
+ type: string | undefined;
4239
+ itemId: string | undefined;
4240
+ prop: string | undefined;
4241
+ }[];
4242
+ event(event: ProxyEvent): void;
4243
+ getNumberOfUndoBundles(): number;
4244
+ getNumberOfRedoBundles(): number;
4245
+ spliceLastEventBundle(events: ProxyEvent[]): ProxyEvent[];
4246
+ spliceFirstEventBundle(events: any): any;
4247
+ assignBundleIndexToEvent(event: ProxyEvent): void;
4248
+ }
4249
+
4250
+ declare class Proxifier {
4251
+ suppressDirty: boolean;
4252
+ undoManager?: UndoManager;
4253
+ private _promises;
4254
+ private _capturePromises;
4255
+ private _profiledEvents;
4256
+ private _profiling;
4257
+ private _profilerStartTime;
4258
+ private _profiledCount;
4259
+ private static _instance;
4260
+ static get instance(): Proxifier;
4261
+ private constructor();
4262
+ suppressDirtyFlag(value: boolean): void;
4263
+ setUndoManager(manager: UndoManager): void;
4264
+ isUndoManagerActive(): boolean | undefined;
4265
+ private _postUndoManagerEvent;
4266
+ setItemDirty(item: PreparedItem, prop: any, origValue: any, value: any): void;
4267
+ capturePromise(func: Function): Promise<any[]>;
4268
+ startProfiling(): void;
4269
+ endProfiling(): void;
4270
+ private _addPromise;
4271
+ private _proxyObject;
4272
+ private _proxyArray;
4273
+ proxyBlockArray(arr: any[], block: Block, item: PreparedItem): any[];
4274
+ proxyListArray(arr: any[], field: Field, item: PreparedItem): any[];
4275
+ proxyScriptArray(arr: any[], block: Block, item: PreparedItem): any[];
4276
+ proxyBlock(block: Block, item: PreparedItem): any;
4277
+ proxyGraphBlock(block: Block, item: PreparedItem): any;
4278
+ proxyGraphBlockArray(arr: Block[], graphItem: any): any[];
4279
+ proxyConnection(connection: Connection, graphItem: any): any;
4280
+ proxyConnectionArray(arr: Connection[], graphItem: any): any[];
4281
+ proxyItemField(field: Field, item: any): any;
4282
+ proxyGraphBlockField(field: Field, block: Block, item: PreparedItem): any;
4283
+ proxyBlockField(field: Field, block: Block, item: PreparedItem): any;
4284
+ proxyScriptItem(scriptItem: any, script: any, item: any): any;
4285
+ proxyScriptFieldsArray(fields: any, script: any, item: any): any[];
4286
+ proxyScriptField(field: any, script: any, item: any): any;
4287
+ }
4288
+
4289
+ declare const _default: {
4290
+ createGUID: () => string;
4291
+ toUserFriendlyName: (variableName: string) => string;
4292
+ assert: (value: any, msg: string) => void;
4293
+ matchItemIdAndObject(value1: any, value2: any): boolean;
4294
+ areValuesEqual(a: any, b: any, maxLevels?: number): boolean;
4295
+ startTimer(msg: string): (msg: string) => void;
4296
+ dataURItoBlob(dataURI: string): Blob;
4297
+ xmur3(str: any): () => number;
4298
+ mulberry32(seed: number): () => number;
4299
+ hslToRgb(h: number, s: number, l: number): number[];
4300
+ rgbToHex(r: number, g: number, b: number): string;
4301
+ /**
4302
+ * Create a bright, saturated color from a string (deterministic).
4303
+ * @param {string} str
4304
+ * @param {{minS?:number, maxS?:number, minL?:number, maxL?:number, return?:'hex'|'hsl'|'rgb'}} [opts]
4305
+ */
4306
+ colorFromString(str: string, opts?: any): string;
4307
+ };
4308
+
4309
+ declare class ProfilerEntry {
4310
+ level: number;
4311
+ name: string;
4312
+ times: number[];
4313
+ durations: number[];
4314
+ childrenMap: Map<string, ProfilerEntry>;
4315
+ children: ProfilerEntry[];
4316
+ parent?: ProfilerEntry;
4317
+ constructor(name: string, level: number, time: number, parent?: ProfilerEntry);
4318
+ }
4319
+ declare class Profiler {
4320
+ startTime: number;
4321
+ endTime: number;
4322
+ startIteration: number;
4323
+ currentLevel: number;
4324
+ root: ProfilerEntry;
4325
+ currentEntry: ProfilerEntry;
4326
+ active: boolean;
4327
+ private static _instance;
4328
+ static get instance(): Profiler;
4329
+ private constructor();
4330
+ start(): void;
4331
+ end(printResults?: boolean): void;
4332
+ private _iterate;
4333
+ getResults(): any[];
4334
+ printResults(): void;
4335
+ newIteration(): void;
4336
+ asyncBlock(key: string, func: Function): Promise<any>;
4337
+ block(key: string, func: Function): any;
4338
+ beginBlock(name: string): ProfilerEntry | undefined;
4339
+ endBlock(entry?: ProfilerEntry): void;
4340
+ }
4341
+
4342
+ declare class Exception extends Error {
4343
+ constructor(msg?: any, name?: string);
4344
+ toString(): string;
4345
+ }
4346
+ declare class InvalidArgumentException extends Exception {
4347
+ constructor(msg?: any);
4348
+ }
4349
+ declare class InvalidStateException extends Exception {
4350
+ constructor(msg?: any);
4351
+ }
4352
+ declare class LoaderException extends Exception {
4353
+ constructor(msg?: any);
4354
+ }
4355
+ declare class QuotaExceededException extends Exception {
4356
+ constructor(msg?: any);
4357
+ }
4358
+ declare class AccessDeniedException extends Exception {
4359
+ constructor(msg?: any);
4360
+ }
4361
+
4362
+ declare function getDatatypeByName(name: string, solveInheritance?: boolean): any;
4363
+
4364
+ declare function verifyAcl(userInfo: any, acls: any, action: string): true | undefined;
4365
+ declare function hasPermission(userInfo: any, perm: any, needsSuperadmin: boolean): boolean;
4366
+
4367
+ export { AccessDeniedException, AggregatedItem, ApiClient, ApiGateway, Block, EventEmitter, Field, InvalidArgumentException, InvalidStateException, Item, ItemCache$1 as ItemCache, ItemRepo, ItemVisibility, LinkableItemsCache, LoaderException, Package as PackageTools, PreparedItem, Profiler, Proxifier, ProxyEvent, QuotaExceededException, Script, ScriptField, Snapshot, Storage, Template, ThumbCache, UndoManager, eventBus, getDatatypeByName, hasPermission, _default as tools, verifyAcl };
4368
+ export type { Acl, Attachments, BaseBlogArticle, ConversationEntry, FolderListingOptions, FolderListingWithOptions, ItemOptions, ItemQueryOptions, ItemQueryWithOptions, ItemWithOptions, JobState, Me, ProgressCallback, UserInfo };