@livinglogic/livingapi 1.30.0 → 1.32.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livinglogic/livingapi",
3
- "version": "1.30.0",
3
+ "version": "1.32.0",
4
4
  "description": "Javascript version of the LivingAPI classes of LivingApps",
5
5
  "repository": {
6
6
  "type": "git",
package/src/livingapi.js CHANGED
@@ -240,6 +240,7 @@ export class Globals extends Base
240
240
  this.handler = new Handler();
241
241
  this._log_stack = [];
242
242
  this._current_geo = null;
243
+ this._next_attachment_id = 0;
243
244
  }
244
245
 
245
246
  [ul4.symbols.type]()
@@ -684,6 +685,48 @@ Permission.prototype._ul4onattrs = ["permissions"];
684
685
  Permission.prototype._ul4attrs = new Set(["permissions", "edit", "config", "delete", "task_manage", "data_edit", "data_view", "task_view", "frontend", "data_connect_external", "perform_evaluation", "to_catalog", "data_import_export", "mydata_view", "mydata_edit", "user_admin"]);
685
686
 
686
687
 
688
+ class WithAttachments extends Base
689
+ {
690
+ _add_attachment(type, label, namespace, active, value)
691
+ {
692
+ if (this.attachments === null)
693
+ this.attachments = new Map();
694
+
695
+ const attachment = new type(
696
+ null,
697
+ this,
698
+ label,
699
+ namespace,
700
+ active,
701
+ value
702
+ );
703
+
704
+ this.attachments[`attachment_${this.globals._next_attachment_id += 1}`] = attachment;
705
+
706
+ return attachment
707
+ }
708
+
709
+ add_note_attachment(label, namespace, active, value)
710
+ {
711
+ return this._add_attachment(NoteAttachment, label, namespace, active, value);
712
+ }
713
+
714
+ add_url_attachment(label, namespace, active, value)
715
+ {
716
+ return this._add_attachment(URLAttachment, label, namespace, active, value);
717
+ }
718
+
719
+ add_json_attachment(label, namespace, active, value)
720
+ {
721
+ return this._add_attachment(JSONAttachment, label, namespace, active, value);
722
+ }
723
+
724
+ add_file_attachment(label, namespace, active, value)
725
+ {
726
+ return this._add_attachment(fileAttachment, label, namespace, active, value);
727
+ }
728
+ }
729
+
687
730
  class AppType extends ul4.Type
688
731
  {
689
732
  instancecheck(obj)
@@ -695,7 +738,7 @@ class AppType extends ul4.Type
695
738
  let apptype = new AppType("la", "App", "A LivingApps application");
696
739
 
697
740
 
698
- export class App extends Base
741
+ export class App extends WithAttachments
699
742
  {
700
743
  [ul4.symbols.type]()
701
744
  {
@@ -912,8 +955,8 @@ export class App extends Base
912
955
 
913
956
 
914
957
  App.prototype._ul4onattrs = ["globals", "internal_id", "name", "description", "lang", "appgroup", "typename_grammatical_gender", "typename_nominative_singular", "typename_genitive_singular", "typename_dative_singular", "typename_accusative_singular", "typename_nominative_plural", "typename_genitive_plural", "typename_dative_plural", "typename_accusative_plural",
915
- "startlink", "image", "createdby", "controls", "records", "record_start", "record_count", "record_total", "installation", "categories", "params", "views", "datamanagement_identifier", "basetable", "primarykey", "insertprocedure", "updateprocedure", "deleteprocedure", "templates", "createdat", "updatedat", "updatedby", "superid", "favorite", "_active_view", "datasource", "main", "ai_generated", "viewtemplates", "filter_default", "sort_default", "filter_owndata", "_permissions", "data_actions"];
916
- App.prototype._ul4attrs = new Set(["id", "globals", "name", "description", "lang", "appgroup", "group", "main", "ai_generated", "typename_grammatical_gender", "typename_nominative_singular", "typename_genitive_singular", "typename_dative_singular", "typename_accusative_singular", "typename_nominative_plural", "typename_genitive_plural", "typename_dative_plural", "typename_accusative_plural", "startlink", "image", "createdat", "createdby", "updatedat", "updatedby", "controls", "layout_controls", "records", "record_start", "record_count", "record_total", "installation", "categories", "params", "views", "menus", "panels", "datasource", "datamanagement_identifier", "insert", "favorite", "_active_view", "filter_default", "sort_default", "filter_owndata", "permissions", "data_actions", "template_url", "new_embedded_url", "new_standalone_url", "home_url", "datamanagement_url", "import_url", "tasks_url", /*"formbuilder_url", "tasks_config_url",*/ "datamanagement_config_url", "permissions_url", "datamanageview_url"]);
958
+ "startlink", "image", "createdby", "controls", "records", "record_start", "record_count", "record_total", "installation", "categories", "params", "views", "datamanagement_identifier", "basetable", "primarykey", "insertprocedure", "updateprocedure", "deleteprocedure", "templates", "createdat", "updatedat", "updatedby", "superid", "favorite", "_active_view", "datasource", "main", "ai_generated", "viewtemplates", "filter_default", "sort_default", "filter_owndata", "_permissions", "data_actions", "attachments"];
959
+ App.prototype._ul4attrs = new Set(["id", "globals", "name", "description", "lang", "appgroup", "group", "main", "ai_generated", "typename_grammatical_gender", "typename_nominative_singular", "typename_genitive_singular", "typename_dative_singular", "typename_accusative_singular", "typename_nominative_plural", "typename_genitive_plural", "typename_dative_plural", "typename_accusative_plural", "startlink", "image", "createdat", "createdby", "updatedat", "updatedby", "controls", "layout_controls", "records", "record_start", "record_count", "record_total", "installation", "categories", "params", "views", "menus", "panels", "datasource", "datamanagement_identifier", "insert", "favorite", "_active_view", "filter_default", "sort_default", "filter_owndata", "permissions", "data_actions", "attachments", "template_url", "new_embedded_url", "new_standalone_url", "home_url", "datamanagement_url", "import_url", "tasks_url", /*"formbuilder_url", "tasks_config_url",*/ "datamanagement_config_url", "permissions_url", "datamanageview_url"]);
917
960
  ul4.expose(App.prototype[ul4.symbols.call], ["values", "**"], {"needsobject": true});
918
961
  ul4.expose(App.prototype.insert, ["values", "**"], {"needsobject": true});
919
962
  ul4.expose(App.prototype.template_url, ["identifier", "p", "record", "p=", null, "params", "**"]);
@@ -932,7 +975,7 @@ class AppGroupType extends ul4.Type
932
975
  let appgrouptype = new AppType("la", "AppGroup", "A group of LivingApps");
933
976
 
934
977
 
935
- export class AppGroup extends Base
978
+ export class AppGroup extends WithAttachments
936
979
  {
937
980
  [ul4.symbols.type]()
938
981
  {
@@ -944,8 +987,8 @@ export class AppGroup extends Base
944
987
  return "<AppGroup id=" + ul4._repr(this.id) + " name=" + ul4._repr(this.name) + ">";
945
988
  }
946
989
  };
947
- AppGroup.prototype._ul4onattrs = ["globals", "name", "description", "image", "apps", "main_app", "params"];
948
- AppGroup.prototype._ul4attrs = new Set(["globals", "id", "name", "description", "image", "apps", "main_app", "params"]);
990
+ AppGroup.prototype._ul4onattrs = ["globals", "name", "description", "image", "apps", "main_app", "params", "attachments"];
991
+ AppGroup.prototype._ul4attrs = new Set(["globals", "id", "name", "description", "image", "apps", "main_app", "params", "attachments"]);
949
992
 
950
993
 
951
994
  class ViewType extends ul4.Type
@@ -1076,7 +1119,7 @@ class RecordType extends ul4.Type
1076
1119
  let recordtype = new RecordType("la", "Record", "A record of a LivingApp application");
1077
1120
 
1078
1121
 
1079
- export class Record extends Base
1122
+ export class Record extends WithAttachments
1080
1123
  {
1081
1124
  constructor(id, app)
1082
1125
  {
@@ -1105,6 +1148,11 @@ export class Record extends Base
1105
1148
  return recordtype;
1106
1149
  }
1107
1150
 
1151
+ get globals()
1152
+ {
1153
+ return this.app.globals;
1154
+ }
1155
+
1108
1156
  as_text(maxlevel=3, controls=null)
1109
1157
  {
1110
1158
  if (maxlevel == 0)
@@ -5942,6 +5990,16 @@ let attachmenttype = new AttachmentType("la", "Attachment", "An attachment of a
5942
5990
 
5943
5991
  export class Attachment extends Base
5944
5992
  {
5993
+ constructor(id, owner, label, namespace, active, value)
5994
+ {
5995
+ super(id);
5996
+ this.owner = owner;
5997
+ this.label = label;
5998
+ this.namespace = namespace;
5999
+ this.active = active;
6000
+ this.value = value;
6001
+ }
6002
+
5945
6003
  [ul4.symbols.type]()
5946
6004
  {
5947
6005
  return attachmenttype;
@@ -5951,10 +6009,25 @@ export class Attachment extends Base
5951
6009
  {
5952
6010
  return "<" + this.constructor.name + " id=" + ul4._repr(this.id) + " label=" + ul4._repr(this.label) + ">";
5953
6011
  }
6012
+
6013
+ get app()
6014
+ {
6015
+ return this.owner instanceof App ? this.owner : null;
6016
+ }
6017
+
6018
+ get appgroup()
6019
+ {
6020
+ return this.owner instanceof AppGroup ? this.owner : null;
6021
+ }
6022
+
6023
+ get record()
6024
+ {
6025
+ return this.owner instanceof Record ? this.owner : null;
6026
+ }
5954
6027
  };
5955
6028
 
5956
- Attachment.prototype._ul4onattrs = ["record", "label", "active"];
5957
- Attachment.prototype._ul4attrs = new Set(["id", "record", "label", "active"]);
6029
+ Attachment.prototype._ul4onattrs = ["owner", "label", "namespace", "active"];
6030
+ Attachment.prototype._ul4attrs = new Set(["id", "owner", "label", "namespace", "active"]);
5958
6031
 
5959
6032
 
5960
6033
  class NoteAttachmentType extends AttachmentType
@@ -6093,8 +6166,8 @@ export class DataAction extends Base
6093
6166
  }
6094
6167
  };
6095
6168
 
6096
- DataAction.prototype._ul4onattrs = ["app", "identifier", "label", "order", "permission", "active", "icon", "description", "message", "filter", "as_multiple_action", "as_single_action", "as_mail_link", "on_edit_form_show", "on_record_edit", "on_record_new", "on_record_delete"];
6097
- DataAction.prototype._ul4attrs = new Set(["app", "id", "identifier", "label", "order", "permission", "active", "icon", "description", "message", "filter", "as_multiple_action", "as_single_action", "as_link", "on_edit_form_show", "on_record_new", "on_record_edit", "on_record_delete"]);
6169
+ DataAction.prototype._ul4onattrs = ["app", "identifier", "label", "order", "permission", "active", "icon", "description", "message", "filter", "as_multiple_action", "as_single_action", "as_mail_link", "before_record_update_form", "after_record_update", "after_record_insert", "before_record_delete"];
6170
+ DataAction.prototype._ul4attrs = new Set(["app", "id", "identifier", "label", "order", "permission", "active", "icon", "description", "message", "filter", "as_multiple_action", "as_single_action", "as_link", "before_record_update_form", "after_record_update", "after_record_insert", "before_record_delete"]);
6098
6171
 
6099
6172
 
6100
6173
  class InstallationType extends ul4.Type
@@ -6211,14 +6284,24 @@ export class AppParameter extends Base
6211
6284
  return "<AppParameter id=" + ul4._repr(this.id) + " identifier=" + ul4._repr(this.identifier) + ">";
6212
6285
  }
6213
6286
 
6287
+ get app()
6288
+ {
6289
+ return this.owner instanceof App ? this.owner : null;
6290
+ }
6291
+
6292
+ get appgroup()
6293
+ {
6294
+ return this.owner instanceof AppGroup ? this.owner : null;
6295
+ }
6296
+
6214
6297
  get full_identifier()
6215
6298
  {
6216
- return this.namespace === null ? this.identifier : `${this.namespace}.${this.identifier}`;
6299
+ return this.namespace === null || this.identifier === null ? this.identifier : `${this.namespace}.${this.identifier}`;
6217
6300
  }
6218
6301
  };
6219
6302
 
6220
- AppParameter.prototype._ul4onattrs = ["app", "appgroup", "parent", "type", "order", "identifier", "description", "value", "createdat", "createdby", "updatedat", "updatedby", "namespace"];
6221
- AppParameter.prototype._ul4attrs = new Set(["id", "app", "appgroup", "parent", "app", "type", "order", "identifier", "namespace", "full_identifier", "description", "value", "createdat", "createdby", "updatedat", "updatedby"]);
6303
+ AppParameter.prototype._ul4onattrs = ["owner", "parent", "type", "order", "identifier", "namespace", "description", "value", "createdat", "createdby", "updatedat", "updatedby"];
6304
+ AppParameter.prototype._ul4attrs = new Set(["id", "owner", "parent", "app", "type", "order", "identifier", "namespace", "full_identifier", "description", "value", "createdat", "createdby", "updatedat", "updatedby"]);
6222
6305
 
6223
6306
 
6224
6307
  class MutableAppParameterType extends AppParameterType