@livinglogic/livingapi 1.38.0 → 1.40.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.38.0",
3
+ "version": "1.40.0",
4
4
  "description": "Javascript version of the LivingAPI classes of LivingApps",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,6 +14,13 @@
14
14
  "scripts": {
15
15
  "build": "npx rollup -c"
16
16
  },
17
+ "files": [
18
+ "dist",
19
+ "src",
20
+ "rollup.config.js",
21
+ "CHANGELOG.md",
22
+ "HOWTO-release.md"
23
+ ],
17
24
  "main": "dist/umd/livingapi.js",
18
25
  "module": "dist/esm-node/livingapi.js",
19
26
  "browser": "dist/umd/livingapi.js",
package/src/livingapi.js CHANGED
@@ -236,8 +236,14 @@ export class Globals extends Base
236
236
  this.maxdbactions = null;
237
237
  this.maxtemplateruntime = null;
238
238
  this.flashmessages = null;
239
+ this.form = null;
239
240
  this.view_template_id = null;
240
241
  this.email_template_id = null;
242
+ this.view_id = null;
243
+ this.externaldatasources = null;
244
+ this.template_params = null;
245
+ this.template_library_version = 0;
246
+ this.template_libraries = null;
241
247
  this.handler = new Handler();
242
248
  this._log_stack = [];
243
249
  this._current_geo = null;
@@ -249,6 +255,15 @@ export class Globals extends Base
249
255
  return globalstype;
250
256
  }
251
257
 
258
+ _setDefaultUL4ONAttr(name)
259
+ {
260
+ // Only dumps from a database before version 143 lack the version; such a database can't be used with this LivingAPI
261
+ if (name === "template_library_version")
262
+ this.template_library_version = this.app !== null ? this.app.template_library_version : 0;
263
+ else
264
+ super._setDefaultUL4ONAttr(name);
265
+ }
266
+
252
267
  // distance between two geo coordinates (see https://de.wikipedia.org/wiki/Orthodrome#Genauere_Formel_zur_Abstandsberechnung_auf_der_Erde)
253
268
  dist(geo1, geo2)
254
269
  {
@@ -531,8 +546,8 @@ export class Globals extends Base
531
546
  }
532
547
  };
533
548
 
534
- Globals.prototype._ul4onattrs = ["version", "platform", "user", "maxdbactions", "maxtemplateruntime", "lang", "sys_lang", "datasources", "hostname", "free", "app", "record", "mode", "view_template_id", "email_template_id", "view_id"];
535
- Globals.prototype._ul4attrs = new Set(["id", "version", "hostname", "platform", "free", "mode", "form", "app", "record", "datasources", "externaldatasources", "groups", "user", "lang", "sys_lang", "templates", "pparams", "geo", "dist", "maxdbactions", "maxtemplateruntime", "flashmessages", "scaled_url", "qrcode_url", "current_geo", "log_debug", "log_info", "log_warning", "log_error", "my_apps_url", "my_tasks_url", "catalog_url", "chats_url", "profile_url", "account_url", "logout_url"]);
549
+ Globals.prototype._ul4onattrs = ["version", "platform", "user", "maxdbactions", "maxtemplateruntime", "lang", "sys_lang", "datasources", "hostname", "free", "app", "record", "mode", "form", "view_template_id", "email_template_id", "view_id", "externaldatasources", "template_params", "template_library_version", "template_libraries"];
550
+ Globals.prototype._ul4attrs = new Set(["id", "version", "hostname", "platform", "free", "mode", "form", "app", "record", "datasources", "externaldatasources", "groups", "user", "lang", "sys_lang", "templates", "pparams", "geo", "dist", "maxdbactions", "maxtemplateruntime", "flashmessages", "template_library_version", "template_libraries", "scaled_url", "qrcode_url", "current_geo", "log_debug", "log_info", "log_warning", "log_error", "my_apps_url", "my_tasks_url", "catalog_url", "chats_url", "profile_url", "account_url", "logout_url"]);
536
551
  ul4.expose(Globals.prototype.log_debug, ["message", "*"]);
537
552
  ul4.expose(Globals.prototype.log_info, ["message", "*"]);
538
553
  ul4.expose(Globals.prototype.log_warning, ["message", "*"]);
@@ -686,6 +701,44 @@ Permission.prototype._ul4onattrs = ["permissions"];
686
701
  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"]);
687
702
 
688
703
 
704
+ class TemplateLibraryType extends ul4.Type
705
+ {
706
+ instancecheck(obj)
707
+ {
708
+ return obj instanceof TemplateLibrary;
709
+ }
710
+ };
711
+
712
+ let templatelibrarytype = new TemplateLibraryType("la", "TemplateLibrary", "A version of the template library");
713
+
714
+
715
+ export class TemplateLibrary extends Base
716
+ {
717
+ constructor(id)
718
+ {
719
+ super(id);
720
+ this.version = null;
721
+ this.label = null;
722
+ this.description = null;
723
+ this.templates = null;
724
+ this.parameters = null;
725
+ }
726
+
727
+ [ul4.symbols.type]()
728
+ {
729
+ return templatelibrarytype;
730
+ }
731
+
732
+ [ul4.symbols.repr]()
733
+ {
734
+ return "<TemplateLibrary version=" + ul4._repr(this.version) + " label=" + ul4._repr(this.label) + ">";
735
+ }
736
+ };
737
+
738
+ TemplateLibrary.prototype._ul4onattrs = ["version", "label", "description", "templates", "parameters"];
739
+ TemplateLibrary.prototype._ul4attrs = new Set(["id", "version", "label", "description", "templates", "parameters"]);
740
+
741
+
689
742
  class WithAttachments extends Base
690
743
  {
691
744
  _add_attachment(type, label, namespace, active, value)
@@ -1054,6 +1107,12 @@ let apptype = new AppType("la", "App", "A LivingApps application");
1054
1107
 
1055
1108
  export class App extends WithAttachments
1056
1109
  {
1110
+ constructor(id)
1111
+ {
1112
+ super(id);
1113
+ this._template_library_version = 0;
1114
+ }
1115
+
1057
1116
  [ul4.symbols.type]()
1058
1117
  {
1059
1118
  return apptype;
@@ -1064,6 +1123,28 @@ export class App extends WithAttachments
1064
1123
  return "<App id=" + ul4._repr(this.id) + " name=" + ul4._repr(this.name) + ">";
1065
1124
  }
1066
1125
 
1126
+ get template_library_version()
1127
+ {
1128
+ return this._template_library_version;
1129
+ }
1130
+
1131
+ set template_library_version(version)
1132
+ {
1133
+ if (typeof(version) !== "number" || !Number.isInteger(version))
1134
+ throw new ul4.TypeError("template_library_version must be an int");
1135
+ if (this.globals !== null && this.globals !== undefined && this.globals.template_libraries !== null && !this.globals.template_libraries.has(version))
1136
+ throw new ul4.ValueError("Template library version " + ul4._repr(version) + " not found!");
1137
+ this._template_library_version = version;
1138
+ }
1139
+
1140
+ [ul4.symbols.setattr](name, value)
1141
+ {
1142
+ if (name === "template_library_version")
1143
+ this.template_library_version = value;
1144
+ else
1145
+ super[ul4.symbols.setattr](name, value);
1146
+ }
1147
+
1067
1148
  /* For backwards compatibility */
1068
1149
  get group()
1069
1150
  {
@@ -1260,6 +1341,8 @@ export class App extends WithAttachments
1260
1341
  {
1261
1342
  if (name === "translations")
1262
1343
  this.translations.langs = null;
1344
+ else if (name === "template_library_version")
1345
+ this._template_library_version = 0; // only dumps from a database before version 143 lack the version
1263
1346
  else
1264
1347
  this[name] = null;
1265
1348
  }
@@ -1473,8 +1556,8 @@ App._legacy_typename_attrs = new Map([
1473
1556
  ["acc_plu", "_typename_accusative_plural"],
1474
1557
  ]);
1475
1558
  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",
1476
- "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", "order", "translations"];
1477
- App.prototype._ul4attrs = new Set(["id", "globals", "name", "description", "translations", "lang", "appgroup", "group", "main", "order", "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", "typename", "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"]);
1559
+ "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", "order", "translations", "template_library_version"];
1560
+ App.prototype._ul4attrs = new Set(["id", "globals", "name", "description", "translations", "lang", "appgroup", "group", "main", "order", "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", "typename", "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_library_version", "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"]);
1478
1561
  ul4.expose(App.prototype[ul4.symbols.call], ["values", "**"], {"needsobject": true});
1479
1562
  ul4.expose(App.prototype.insert, ["values", "**"], {"needsobject": true});
1480
1563
  ul4.expose(App.prototype.template_url, ["identifier", "p", "record", "p=", null, "params", "**"]);
@@ -5727,8 +5810,9 @@ export class AppLookupControl extends Control
5727
5810
 
5728
5811
  AppLookupControl.prototype.type = "applookup";
5729
5812
  AppLookupControl.prototype.fieldtype = AppLookupField;
5730
- AppLookupControl.prototype._ul4onattrs = [...Control.prototype._ul4onattrs, "lookup_app", "lookup_controls", "local_master_control", "local_detail_controls", "remote_master_control"];
5731
- AppLookupControl.prototype._ul4attrs = new Set([...Control.prototype._ul4attrs, "lookup_app", "lookup_controls", "local_master_control", "local_detail_controls", "remote_master_control"]);
5813
+ // `on_delete` is `null`, `"restrict"` or `"cascade"`
5814
+ AppLookupControl.prototype._ul4onattrs = [...Control.prototype._ul4onattrs, "lookup_app", "lookup_controls", "local_master_control", "local_detail_controls", "remote_master_control", "on_delete"];
5815
+ AppLookupControl.prototype._ul4attrs = new Set([...Control.prototype._ul4attrs, "lookup_app", "lookup_controls", "local_master_control", "local_detail_controls", "remote_master_control", "on_delete"]);
5732
5816
 
5733
5817
 
5734
5818
  class AppLookupSelectControlType extends AppLookupControlType
@@ -6566,10 +6650,19 @@ export class User extends Base
6566
6650
  {
6567
6651
  return "<User id=" + ul4._repr(this.id) + " firstname=" + ul4._repr(this.firstname) + " surname=" + ul4._repr(this.surname) + " email=" + ul4._repr(this.email) + ">";
6568
6652
  }
6653
+
6654
+ _setDefaultUL4ONAttr(name)
6655
+ {
6656
+ // Dumps from a database before version 143 lack the color scheme
6657
+ if (name === "colorscheme")
6658
+ this.colorscheme = "auto";
6659
+ else
6660
+ super._setDefaultUL4ONAttr(name);
6661
+ }
6569
6662
  };
6570
6663
 
6571
- User.prototype._ul4onattrs = ["_id", "gender", "title", "firstname", "surname", "initials", "email", "streetname", "streetnumber", "zip", "city", "phone", "fax", "lang", "image", "summary", "interests", "personalwebsite", "companywebsite", "company", "position", "department", "keyviews", "globals"];
6572
- User.prototype._ul4attrs = new Set(["id", "globals", "_id", "gender", "title", "firstname", "surname", "initials", "email", "streetname", "streetnumber", "zip", "city", "phone", "fax", "lang", "image", "summary", "interests", "personalwebsite", "companywebsite", "company", "position", "department", "keyviews"]);
6664
+ User.prototype._ul4onattrs = ["_id", "gender", "title", "firstname", "surname", "initials", "email", "streetname", "streetnumber", "zip", "city", "phone", "fax", "lang", "image", "summary", "interests", "personalwebsite", "companywebsite", "company", "position", "department", "keyviews", "globals", "colorscheme"];
6665
+ User.prototype._ul4attrs = new Set(["id", "globals", "_id", "gender", "title", "firstname", "surname", "initials", "email", "streetname", "streetnumber", "zip", "city", "phone", "fax", "lang", "image", "summary", "interests", "personalwebsite", "companywebsite", "company", "position", "department", "keyviews", "colorscheme"]);
6573
6666
 
6574
6667
 
6575
6668
  class FileType extends ul4.Type
@@ -7339,7 +7432,8 @@ let classes = [
7339
7432
  KeyView,
7340
7433
  AppParameter,
7341
7434
  MutableAppParameter,
7342
- ViewTemplateInfo
7435
+ ViewTemplateInfo,
7436
+ TemplateLibrary
7343
7437
  ];
7344
7438
 
7345
7439
  for (let constructor of classes)
@@ -7414,6 +7508,7 @@ export const module = new ul4.Module(
7414
7508
  MutableAppParameter: MutableAppParameter,
7415
7509
  MenuItem: MenuItem,
7416
7510
  Panel: Panel,
7417
- ViewTemplateInfo: ViewTemplateInfo
7511
+ ViewTemplateInfo: ViewTemplateInfo,
7512
+ TemplateLibrary: TemplateLibrary
7418
7513
  }
7419
7514
  );
@@ -1,7 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(npm run build:*)"
5
- ]
6
- }
7
- }