@luminocity/lemonate-gateway 8.1.0 → 8.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ import * as awarenessProtocol from 'y-protocols/awareness';
8
8
  import { CollabDocument } from '@/collabstate/CollabDocument';
9
9
  import { ScriptItem as ScriptItem$1, Script as Script$1 } from '@/repo/Script';
10
10
  import { ScriptField as ScriptField$1 } from '@/repo/ScriptField';
11
+ import { TemplateEntry as TemplateEntry$1 } from '@/repo/TemplateEntry';
11
12
 
12
13
  declare class Snapshot {
13
14
  id: string;
@@ -852,25 +853,6 @@ declare class Connection extends Snapshotable {
852
853
  rollbackFromSnapshot(snapshot: Snapshot): void;
853
854
  }
854
855
 
855
- declare class ItemCache {
856
- itemCache: Map<string, any>;
857
- apiGateway: ApiGateway;
858
- constructor(apiGateway: any);
859
- clear(): void;
860
- getItem(id: string): Promise<any>;
861
- }
862
-
863
- declare class LinkableItemsCache {
864
- linkableItemsCache: Map<string, any[]>;
865
- apiGateway: ApiGateway;
866
- itemCache: ItemCache;
867
- usePublicApi: boolean;
868
- constructor(apiGateway: ApiGateway, itemCache: ItemCache, usePublicApi?: boolean);
869
- clear(): void;
870
- resolveItem(id: string, linkableItems: any[]): any;
871
- loadLinkableItems(item: any, field: Field): Promise<any[] | undefined>;
872
- }
873
-
874
856
  declare class Template {
875
857
  fields: Field[];
876
858
  constructor(fields: Field[]);
@@ -880,7 +862,7 @@ declare class Template {
880
862
  * @param fieldValues object an object with new values for every field that should be changed
881
863
  */
882
864
  specialize(fieldValues: any): this;
883
- instantiate(): Field[];
865
+ instantiate(copyInstantiate: boolean): Field[];
884
866
  }
885
867
 
886
868
  type TemplateEntry = {
@@ -906,7 +888,6 @@ declare class Field extends Snapshotable {
906
888
  dependantFields: Field[];
907
889
  dependenciesInitialized: boolean;
908
890
  linkableTypes: string[];
909
- linkableItemsCache: LinkableItemsCache | undefined;
910
891
  collapsed: boolean;
911
892
  presets: any[];
912
893
  datatype: string | null;
@@ -919,8 +900,6 @@ declare class Field extends Snapshotable {
919
900
  labelType: string | null;
920
901
  blocks: Block[];
921
902
  connections: Connection[];
922
- templates: TemplateEntry[];
923
- elementName: string | null;
924
903
  private _id;
925
904
  private _internalValue;
926
905
  private _internalOptions;
@@ -932,8 +911,7 @@ declare class Field extends Snapshotable {
932
911
  set options(value: string[]);
933
912
  get value(): any;
934
913
  set value(value: any);
935
- get linkableItems(): never[] | Promise<any[] | undefined>;
936
- 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);
937
915
  updateConditions(): void;
938
916
  getId(): string;
939
917
  resetValue(): void;
@@ -964,8 +942,6 @@ declare class Field extends Snapshotable {
964
942
  setWidget(widget: any): void;
965
943
  setBlocks(blocks: any): void;
966
944
  setConnections(connections: any): void;
967
- setTemplates(templates: any): void;
968
- setElementName(name: any): void;
969
945
  setCollapsed(value: any): void;
970
946
  setPresets(value: any): void;
971
947
  setLabelType(value: string): void;
@@ -1199,7 +1175,7 @@ declare class Serializer {
1199
1175
  * @param {boolean} [options.omitPath] don't return path
1200
1176
  * @return {string|*[]}
1201
1177
  */
1202
- grab(item: PreparedItem, field: Field, blocks: Block[], options: any): string | any[];
1178
+ grab(item: PreparedItem, field: Field, blocks: Block[], options: any): string | any[] | any;
1203
1179
  /**
1204
1180
  * Put elements in the project
1205
1181
  * @param msg the data to use to create new elements in the project
@@ -1235,7 +1211,6 @@ declare class Serializer {
1235
1211
  _findItemById(id: string): PreparedItem | undefined;
1236
1212
  _findItemField(item: PreparedItem, fieldName: string): Field | null;
1237
1213
  _findParentBlock(item: PreparedItem, fieldName: string, path: string): Block | null;
1238
- _getBlockTemplate(field: Field, name: string): TemplateEntry | null;
1239
1214
  _getBlockIndex(block: Block): number;
1240
1215
  _getBlockPath(block: Block): string;
1241
1216
  private _serializeBlockFields;
@@ -3922,6 +3897,14 @@ declare class ApiGateway {
3922
3897
  call(caller: string, method: string, ...params: any[]): Promise<any>;
3923
3898
  }
3924
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
+
3925
3908
  declare class ItemChangeProcessor {
3926
3909
  updateItemLinksAndAttributes(item: PreparedItem, includeLinkItems: boolean, clearUnusedLinks: boolean): void;
3927
3910
  getLinksAndAttributes(item: PreparedItem, links: Array<any>, attributes: object, userAttributes: object, includeItems: boolean, clearUnusedLinks: boolean): void;
@@ -3953,12 +3936,12 @@ declare class ItemPreparator {
3953
3936
  linkItem: null;
3954
3937
  stopRecursion?: undefined;
3955
3938
  }>;
3956
- 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>>;
3957
3940
  readScripts(item: PreparedItem, parentBlock: Block, treeNamespace: string, attributes: Record<string, unknown>): Promise<Array<any>>;
3958
3941
  existsScriptNamespace(item: PreparedItem, attributes: Record<string, unknown>, namespace: string): boolean;
3959
3942
  readConnections(item: PreparedItem, graphNamespace: string, attributes: Record<string, unknown>): Array<Connection>;
3960
3943
  existsBlockNamespace(item: PreparedItem, attributes: Record<string, unknown>, namespace: string): boolean;
3961
- 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[]>;
3962
3945
  static refreshFieldDependencies(fields: Field[]): void;
3963
3946
  }
3964
3947
 
@@ -4096,7 +4079,6 @@ declare class ItemRepo {
4096
4079
  jail: any;
4097
4080
  apiGateway: ApiGateway;
4098
4081
  itemCache: ItemCache;
4099
- linkableItemsCache: LinkableItemsCache;
4100
4082
  undoManager: UndoManager;
4101
4083
  itemPreparator: ItemPreparator;
4102
4084
  itemChangeProcessor: ItemChangeProcessor;
@@ -4110,7 +4092,7 @@ declare class ItemRepo {
4110
4092
  findLoadedItem(id: string): PreparedItem | undefined;
4111
4093
  _handleError(err: any, message: string): void;
4112
4094
  getUndoManager(): UndoManager;
4113
- createFieldsForItem(block: Block, template: Template, ownerItem: PreparedItem): Promise<Field[]>;
4095
+ createFieldsForItem(block: Block, template: Template, ownerItem: PreparedItem, copyInstantiate?: boolean): Promise<Field[]>;
4114
4096
  createScriptsForItem(block: Block, scriptData: any[] | undefined, ownerItem: PreparedItem, proxify?: boolean): Promise<void>;
4115
4097
  clear(): void;
4116
4098
  removeBlock(block: Block, parent: any): void;
@@ -4140,6 +4122,7 @@ declare class ItemRepo {
4140
4122
  _loadItemFromApi(id: string, options?: any): Promise<any[]>;
4141
4123
  _relinkItems(items: PreparedItem[], referenceMap: Map<string, PreparedItem>): void;
4142
4124
  createItem(typeName: string, attributes: any): Promise<PreparedItem>;
4125
+ getLoadedItem(id: string): PreparedItem | undefined;
4143
4126
  /**
4144
4127
  *
4145
4128
  * @param id
@@ -4303,6 +4286,7 @@ declare class Proxifier {
4303
4286
 
4304
4287
  declare const _default: {
4305
4288
  createItemOrBlockID: () => string;
4289
+ createFieldID: () => string;
4306
4290
  createGUID: () => string;
4307
4291
  createGeneratedItemId: () => string;
4308
4292
  toUserFriendlyName: (variableName: string) => string;
@@ -4333,6 +4317,8 @@ declare class ProfilerEntry {
4333
4317
  parent?: ProfilerEntry;
4334
4318
  constructor(name: string, level: number, time: number, parent?: ProfilerEntry);
4335
4319
  }
4320
+ declare function profileBlock(key: string, func: Function): any;
4321
+ declare function profileAsyncBlock(key: string, func: Function): Promise<any>;
4336
4322
  declare class Profiler {
4337
4323
  startTime: number;
4338
4324
  endTime: number;
@@ -12175,6 +12161,25 @@ declare function getDatatypes(): ({
12175
12161
  declare function verifyAcl(userInfo: any, acls: any, action: string): true | undefined;
12176
12162
  declare function hasPermission(userInfo: any, perm: any, needsSuperadmin: boolean): boolean;
12177
12163
 
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
+
12178
12183
  type CustomFieldDefinition = {
12179
12184
  name: string;
12180
12185
  defaultValue: any;
@@ -12203,5 +12208,5 @@ declare class CustomField extends Snapshotable {
12203
12208
  rollbackFromSnapshot(snapshot: Snapshot): void;
12204
12209
  }
12205
12210
 
12206
- 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, ThumbCache, UndoManager, eventBus, getDatatypeByName, getDatatypes, hasPermission, _default as tools, verifyAcl };
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 };
12207
12212
  export type { Acl, Attachments, BaseBlogArticle, ConversationEntry, CustomFieldDefinition, FolderListingOptions, FolderListingWithOptions, ItemOptions, ItemQueryOptions, ItemQueryWithOptions, ItemWithOptions, JobState, Me, ProgressCallback, UserInfo };