@luminocity/lemonate-gateway 8.0.6 → 8.1.1-dev1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -2,9 +2,13 @@ import moment from 'moment';
2
2
  import { AxiosInstance, ResponseType } from 'axios';
3
3
  import WebSocket from 'isomorphic-ws';
4
4
  import FormData from 'form-data';
5
+ import { CustomField as CustomField$1, CustomFieldDefinition as CustomFieldDefinition$1 } from '@/repo/CustomField';
5
6
  import { WebsocketProvider } from 'y-websocket';
6
7
  import * as awarenessProtocol from 'y-protocols/awareness';
7
8
  import { CollabDocument } from '@/collabstate/CollabDocument';
9
+ import { ScriptItem as ScriptItem$1, Script as Script$1 } from '@/repo/Script';
10
+ import { ScriptField as ScriptField$1 } from '@/repo/ScriptField';
11
+ import { TemplateEntry as TemplateEntry$1 } from '@/repo/TemplateEntry';
8
12
 
9
13
  declare class Snapshot {
10
14
  id: string;
@@ -265,7 +269,6 @@ declare class AggregatedItem extends Item {
265
269
  }[];
266
270
  fields?: any[];
267
271
  userFields?: any[];
268
- additionalUserAttributes?: Record<string, unknown>;
269
272
  readonly isAggregatedItem: boolean;
270
273
  constructor(data: any);
271
274
  }
@@ -850,25 +853,6 @@ declare class Connection extends Snapshotable {
850
853
  rollbackFromSnapshot(snapshot: Snapshot): void;
851
854
  }
852
855
 
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
856
  declare class Template {
873
857
  fields: Field[];
874
858
  constructor(fields: Field[]);
@@ -878,7 +862,7 @@ declare class Template {
878
862
  * @param fieldValues object an object with new values for every field that should be changed
879
863
  */
880
864
  specialize(fieldValues: any): this;
881
- instantiate(): Field[];
865
+ instantiate(copyInstantiate: boolean): Field[];
882
866
  }
883
867
 
884
868
  type TemplateEntry = {
@@ -904,7 +888,6 @@ declare class Field extends Snapshotable {
904
888
  dependantFields: Field[];
905
889
  dependenciesInitialized: boolean;
906
890
  linkableTypes: string[];
907
- linkableItemsCache: LinkableItemsCache | undefined;
908
891
  collapsed: boolean;
909
892
  presets: any[];
910
893
  datatype: string | null;
@@ -917,8 +900,6 @@ declare class Field extends Snapshotable {
917
900
  labelType: string | null;
918
901
  blocks: Block[];
919
902
  connections: Connection[];
920
- templates: TemplateEntry[];
921
- elementName: string | null;
922
903
  private _id;
923
904
  private _internalValue;
924
905
  private _internalOptions;
@@ -930,8 +911,7 @@ declare class Field extends Snapshotable {
930
911
  set options(value: string[]);
931
912
  get value(): any;
932
913
  set value(value: any);
933
- get linkableItems(): never[] | Promise<any[] | undefined>;
934
- constructor(name: string | Snapshot, displayName?: string | undefined, type?: string | undefined, value?: any | undefined, item?: PreparedItem | undefined, itemRepo?: ItemRepo | undefined, linkableItemsCache?: LinkableItemsCache | undefined);
914
+ constructor(name: string | Snapshot, displayName?: string | undefined, type?: string | undefined, value?: any | undefined, item?: PreparedItem | undefined, itemRepo?: ItemRepo | undefined);
935
915
  updateConditions(): void;
936
916
  getId(): string;
937
917
  resetValue(): void;
@@ -962,14 +942,12 @@ declare class Field extends Snapshotable {
962
942
  setWidget(widget: any): void;
963
943
  setBlocks(blocks: any): void;
964
944
  setConnections(connections: any): void;
965
- setTemplates(templates: any): void;
966
- setElementName(name: any): void;
967
945
  setCollapsed(value: any): void;
968
946
  setPresets(value: any): void;
969
947
  setLabelType(value: string): void;
970
948
  createSnapshot(dontRecurseIntoBlocks?: boolean): Snapshot;
971
949
  restoreFromSnapshot(snapshot: Snapshot): void;
972
- rollbackFromSnapshot(snapshot: any): void;
950
+ rollbackFromSnapshot(snapshot: Snapshot): void;
973
951
  }
974
952
 
975
953
  declare class PreparedItem extends AggregatedItem {
@@ -983,6 +961,7 @@ declare class PreparedItem extends AggregatedItem {
983
961
  isDirty: boolean;
984
962
  fieldInstances: Field[];
985
963
  userFieldInstances: Field[];
964
+ customFieldInstances: CustomField$1[];
986
965
  packageContent?: PreparedItem;
987
966
  packageType?: string;
988
967
  public: boolean;
@@ -993,6 +972,8 @@ declare class PreparedItem extends AggregatedItem {
993
972
  readonly isPreparedItem: boolean;
994
973
  resultingAcl?: Acl;
995
974
  constructor(data: any);
975
+ createCustomFieldInstances(definitions: CustomFieldDefinition$1[]): void;
976
+ addCustomField(customField: CustomField$1): void;
996
977
  markDirty(): void;
997
978
  makeIdsUnique(): void;
998
979
  clone(makeIdsUnique?: boolean): PreparedItem;
@@ -1194,7 +1175,7 @@ declare class Serializer {
1194
1175
  * @param {boolean} [options.omitPath] don't return path
1195
1176
  * @return {string|*[]}
1196
1177
  */
1197
- grab(item: PreparedItem, field: Field, blocks: Block[], options: any): string | any[];
1178
+ grab(item: PreparedItem, field: Field, blocks: Block[], options: any): string | any[] | any;
1198
1179
  /**
1199
1180
  * Put elements in the project
1200
1181
  * @param msg the data to use to create new elements in the project
@@ -1230,7 +1211,6 @@ declare class Serializer {
1230
1211
  _findItemById(id: string): PreparedItem | undefined;
1231
1212
  _findItemField(item: PreparedItem, fieldName: string): Field | null;
1232
1213
  _findParentBlock(item: PreparedItem, fieldName: string, path: string): Block | null;
1233
- _getBlockTemplate(field: Field, name: string): TemplateEntry | null;
1234
1214
  _getBlockIndex(block: Block): number;
1235
1215
  _getBlockPath(block: Block): string;
1236
1216
  private _serializeBlockFields;
@@ -3917,10 +3897,18 @@ declare class ApiGateway {
3917
3897
  call(caller: string, method: string, ...params: any[]): Promise<any>;
3918
3898
  }
3919
3899
 
3900
+ declare class ItemCache {
3901
+ itemCache: Map<string, any>;
3902
+ apiGateway: ApiGateway;
3903
+ constructor(apiGateway: any);
3904
+ clear(): void;
3905
+ getItem(id: string): Promise<any>;
3906
+ }
3907
+
3920
3908
  declare class ItemChangeProcessor {
3921
3909
  updateItemLinksAndAttributes(item: PreparedItem, includeLinkItems: boolean, clearUnusedLinks: boolean): void;
3922
3910
  getLinksAndAttributes(item: PreparedItem, links: Array<any>, attributes: object, userAttributes: object, includeItems: boolean, clearUnusedLinks: boolean): void;
3923
- retrieveLinksAndAttributesFromFieldInstances(fieldInstances: Array<any>, links: Array<any>, attributes: object, includeLinkItems: boolean, clearUnusedLinks: boolean): void;
3911
+ retrieveLinksAndAttributesFromFieldInstances(fieldInstances: Array<any>, links: Array<any>, attributes: object, includeLinkItems: boolean, clearUnusedLinks: boolean, fieldPrefix?: string): void;
3924
3912
  traverseTreeFieldInstance(blocks: Array<any>, links: Array<any>, attributes: object, path: string, includeLinkItems: boolean): void;
3925
3913
  traverseListFieldInstances(blocks: Array<any>, links: Array<any>, attributes: object, path: string, includeLinkItems: boolean): void;
3926
3914
  processScripts(scripts: Array<any>, links: Array<any>, attributes: object, path: string, includeLinkItems: boolean): void;
@@ -3933,6 +3921,7 @@ declare class ItemPreparator {
3933
3921
  setItemFetcher(itemFetcher: Function): void;
3934
3922
  setFieldsFromDatatypes(item: PreparedItem): void;
3935
3923
  prepare(item: any): Promise<PreparedItem>;
3924
+ createCustomFieldInstances(item: PreparedItem, attributes: Record<string, unknown>, prefix?: string): Promise<CustomField$1[]>;
3936
3925
  createFieldInstances(item: PreparedItem, fields: any[], attributes: Record<string, unknown>, path: string, attributeSrc: string, doNotFillValues?: boolean): Promise<Field[]>;
3937
3926
  getFieldSet(item: PreparedItem, name: string): {
3938
3927
  name: string;
@@ -3947,12 +3936,12 @@ declare class ItemPreparator {
3947
3936
  linkItem: null;
3948
3937
  stopRecursion?: undefined;
3949
3938
  }>;
3950
- readBlocks(item: PreparedItem, parentBlock: Block | undefined, templates: Array<any>, treeNamespace: string, attributes: Record<string, unknown>, readChildren: boolean, readScripts: boolean, parentType: string): Promise<Array<any>>;
3939
+ readBlocks(item: PreparedItem, parentBlock: Block | undefined, fieldName: string, treeNamespace: string, attributes: Record<string, unknown>, readChildren: boolean, readScripts: boolean, parentType: string): Promise<Array<any>>;
3951
3940
  readScripts(item: PreparedItem, parentBlock: Block, treeNamespace: string, attributes: Record<string, unknown>): Promise<Array<any>>;
3952
3941
  existsScriptNamespace(item: PreparedItem, attributes: Record<string, unknown>, namespace: string): boolean;
3953
3942
  readConnections(item: PreparedItem, graphNamespace: string, attributes: Record<string, unknown>): Array<Connection>;
3954
3943
  existsBlockNamespace(item: PreparedItem, attributes: Record<string, unknown>, namespace: string): boolean;
3955
- createFields(block: Block, item: PreparedItem, template: Template, blockPath: string, isGraphBlockField: boolean, attributes: Record<string, unknown>): Promise<Field[]>;
3944
+ createFields(block: Block, item: PreparedItem, template: Template, blockPath: string, isGraphBlockField: boolean, attributes: Record<string, unknown>, copyInstantiate?: boolean): Promise<Field[]>;
3956
3945
  static refreshFieldDependencies(fields: Field[]): void;
3957
3946
  }
3958
3947
 
@@ -4090,7 +4079,6 @@ declare class ItemRepo {
4090
4079
  jail: any;
4091
4080
  apiGateway: ApiGateway;
4092
4081
  itemCache: ItemCache;
4093
- linkableItemsCache: LinkableItemsCache;
4094
4082
  undoManager: UndoManager;
4095
4083
  itemPreparator: ItemPreparator;
4096
4084
  itemChangeProcessor: ItemChangeProcessor;
@@ -4104,7 +4092,7 @@ declare class ItemRepo {
4104
4092
  findLoadedItem(id: string): PreparedItem | undefined;
4105
4093
  _handleError(err: any, message: string): void;
4106
4094
  getUndoManager(): UndoManager;
4107
- createFieldsForItem(block: Block, template: Template, ownerItem: PreparedItem): Promise<Field[]>;
4095
+ createFieldsForItem(block: Block, template: Template, ownerItem: PreparedItem, copyInstantiate?: boolean): Promise<Field[]>;
4108
4096
  createScriptsForItem(block: Block, scriptData: any[] | undefined, ownerItem: PreparedItem, proxify?: boolean): Promise<void>;
4109
4097
  clear(): void;
4110
4098
  removeBlock(block: Block, parent: any): void;
@@ -4134,6 +4122,7 @@ declare class ItemRepo {
4134
4122
  _loadItemFromApi(id: string, options?: any): Promise<any[]>;
4135
4123
  _relinkItems(items: PreparedItem[], referenceMap: Map<string, PreparedItem>): void;
4136
4124
  createItem(typeName: string, attributes: any): Promise<PreparedItem>;
4125
+ getLoadedItem(id: string): PreparedItem | undefined;
4137
4126
  /**
4138
4127
  *
4139
4128
  * @param id
@@ -4161,6 +4150,7 @@ declare class ItemRepo {
4161
4150
  id: any;
4162
4151
  newName: any;
4163
4152
  }): void;
4153
+ isItemKnown(itemId: string): boolean;
4164
4154
  invalidateId(itemId: string): void;
4165
4155
  }
4166
4156
 
@@ -4180,7 +4170,7 @@ declare class ProxyEvent {
4180
4170
  length?: number;
4181
4171
  position?: number;
4182
4172
  elementsToDelete?: any[];
4183
- field?: Field;
4173
+ field?: string;
4184
4174
  fieldId?: string;
4185
4175
  isLink?: boolean;
4186
4176
  bundleIndex: number;
@@ -4195,7 +4185,7 @@ declare class ProxyEvent {
4195
4185
  setRange(start: number, length: number): void;
4196
4186
  setPosition(position: number): void;
4197
4187
  setElementsToDelete(elements: any[]): void;
4198
- setField(field: Field): void;
4188
+ setField(field: string): void;
4199
4189
  setFieldId(id: string): void;
4200
4190
  setIsLink(isLink: boolean): void;
4201
4191
  clone(): ProxyEvent & this;
@@ -4226,6 +4216,7 @@ declare class UndoManager {
4226
4216
  rollbackFromSnapshot(id: string): void;
4227
4217
  _grabSnapshot(item: PreparedItem): Snapshot;
4228
4218
  _getFieldInstance(item: PreparedItem, id: string): Field | null;
4219
+ _getCustomFieldInstance(item: PreparedItem, id: string): CustomField | null;
4229
4220
  _rollbackFromSnapshot(item: PreparedItem, snapshot: Snapshot): void;
4230
4221
  getEnabled(): boolean;
4231
4222
  setEnabled(value: boolean): void;
@@ -4286,12 +4277,16 @@ declare class Proxifier {
4286
4277
  proxyItemField(field: Field, item: any): any;
4287
4278
  proxyGraphBlockField(field: Field, block: Block, item: PreparedItem): any;
4288
4279
  proxyBlockField(field: Field, block: Block, item: PreparedItem): any;
4289
- proxyScriptItem(scriptItem: any, script: any, item: any): any;
4290
- proxyScriptFieldsArray(fields: any, script: any, item: any): any[];
4291
- proxyScriptField(field: any, script: any, item: any): any;
4280
+ proxyScriptItem(scriptItem: ScriptItem$1, script: Script$1, item: PreparedItem): any;
4281
+ proxyScriptFieldsArray(fields: ScriptField$1[], script: Script$1, item: PreparedItem): any[];
4282
+ proxyScriptField(field: ScriptField$1, script: Script$1, item: PreparedItem): any;
4283
+ proxyCustomFieldsArray(fields: CustomField$1[], item: PreparedItem): any[];
4284
+ proxyCustomField(field: CustomField$1, item: PreparedItem): any;
4292
4285
  }
4293
4286
 
4294
4287
  declare const _default: {
4288
+ createItemOrBlockID: () => string;
4289
+ createFieldID: () => string;
4295
4290
  createGUID: () => string;
4296
4291
  createGeneratedItemId: () => string;
4297
4292
  toUserFriendlyName: (variableName: string) => string;
@@ -4322,6 +4317,8 @@ declare class ProfilerEntry {
4322
4317
  parent?: ProfilerEntry;
4323
4318
  constructor(name: string, level: number, time: number, parent?: ProfilerEntry);
4324
4319
  }
4320
+ declare function profileBlock(key: string, func: Function): any;
4321
+ declare function profileAsyncBlock(key: string, func: Function): Promise<any>;
4325
4322
  declare class Profiler {
4326
4323
  startTime: number;
4327
4324
  endTime: number;
@@ -12164,5 +12161,52 @@ declare function getDatatypes(): ({
12164
12161
  declare function verifyAcl(userInfo: any, acls: any, action: string): true | undefined;
12165
12162
  declare function hasPermission(userInfo: any, perm: any, needsSuperadmin: boolean): boolean;
12166
12163
 
12167
- 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, getDatatypes, hasPermission, _default as tools, verifyAcl };
12168
- export type { Acl, Attachments, BaseBlogArticle, ConversationEntry, FolderListingOptions, FolderListingWithOptions, ItemOptions, ItemQueryOptions, ItemQueryWithOptions, ItemWithOptions, JobState, Me, ProgressCallback, UserInfo };
12164
+ declare class TemplateFactory {
12165
+ private templates;
12166
+ private static _instance;
12167
+ static get instance(): TemplateFactory;
12168
+ addTemplates(fieldName: string, templates: TemplateEntry$1[]): void;
12169
+ getTemplate(fieldName: string, templateName: string): TemplateEntry$1 | undefined;
12170
+ }
12171
+
12172
+ declare class LinkableItemsCache {
12173
+ linkableItemsCache: Map<string, any[]>;
12174
+ apiGateway: ApiGateway;
12175
+ itemCache: ItemCache;
12176
+ usePublicApi: boolean;
12177
+ constructor(apiGateway: ApiGateway, itemCache: ItemCache, usePublicApi?: boolean);
12178
+ clear(): void;
12179
+ resolveItem(id: string, linkableItems: any[]): any;
12180
+ loadLinkableItems(item: any, field: Field): Promise<any[] | undefined>;
12181
+ }
12182
+
12183
+ type CustomFieldDefinition = {
12184
+ name: string;
12185
+ defaultValue: any;
12186
+ type: string;
12187
+ };
12188
+ declare class CustomField extends Snapshotable {
12189
+ id: string;
12190
+ name: string | undefined;
12191
+ displayName: string | undefined;
12192
+ value: any;
12193
+ type: string | undefined;
12194
+ datatype: string | undefined;
12195
+ linkableTypes: string[];
12196
+ order: number;
12197
+ constructor(name?: string | undefined, value?: any | undefined, item?: PreparedItem | undefined);
12198
+ getId(): string;
12199
+ setName(name: string | undefined): void;
12200
+ setType(name: string): void;
12201
+ setOrder(order: number): void;
12202
+ clone(fieldOverrides?: Map<string, string>): CustomField;
12203
+ clearDefinition(): void;
12204
+ setDefinition(def: any): void;
12205
+ _toBoolean(value: any): any;
12206
+ _updateDisplayName(): void;
12207
+ createSnapshot(): Snapshot;
12208
+ rollbackFromSnapshot(snapshot: Snapshot): void;
12209
+ }
12210
+
12211
+ export { AccessDeniedException, AggregatedItem, ApiClient, ApiGateway, Block, CustomField, 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, TemplateFactory, ThumbCache, UndoManager, eventBus, getDatatypeByName, getDatatypes, hasPermission, profileAsyncBlock, profileBlock, _default as tools, verifyAcl };
12212
+ export type { Acl, Attachments, BaseBlogArticle, ConversationEntry, CustomFieldDefinition, FolderListingOptions, FolderListingWithOptions, ItemOptions, ItemQueryOptions, ItemQueryWithOptions, ItemWithOptions, JobState, Me, ProgressCallback, UserInfo };