nesoi 3.3.11 → 3.3.13

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.
Files changed (160) hide show
  1. package/lib/bundler/browser/browser.bundler.js +4 -7
  2. package/lib/bundler/browser/stages/8_replace_nesoi_for_browser_stage.js +1 -0
  3. package/lib/bundler/distributed/distributed.bundler.js +6 -4
  4. package/lib/bundler/distributed/stages/1_mkdir_stage.js +2 -0
  5. package/lib/bundler/distributed/stages/2_build_typescript_stage.js +3 -1
  6. package/lib/bundler/distributed/stages/3_copy_types_stage.js +2 -0
  7. package/lib/bundler/distributed/stages/4_dump_modules_stage.js +2 -0
  8. package/lib/bundler/monolyth/monolyth.bundler.js +7 -5
  9. package/lib/bundler/monolyth/stages/1_mkdir_stage.js +2 -0
  10. package/lib/bundler/monolyth/stages/2_build_typescript_stage.js +3 -1
  11. package/lib/bundler/monolyth/stages/3_copy_types_stage.js +2 -0
  12. package/lib/bundler/monolyth/stages/4_dump_modules_stage.js +2 -0
  13. package/lib/bundler/monolyth/stages/5_copy_static_stage.js +2 -0
  14. package/lib/bundler/monolyth/stages/6_dump_cli_stage.js +2 -0
  15. package/lib/bundler/monolyth/stages/7_dump_package_json_stage.js +2 -0
  16. package/lib/compiler/compiler.js +7 -2
  17. package/lib/compiler/elements/bucket.element.js +3 -5
  18. package/lib/compiler/elements/constants.element.js +2 -2
  19. package/lib/compiler/elements/controller.element.js +1 -1
  20. package/lib/compiler/elements/element.js +15 -2
  21. package/lib/compiler/elements/externals.element.js +12 -4
  22. package/lib/compiler/elements/message.element.js +7 -0
  23. package/lib/compiler/elements/queue.element.js +1 -1
  24. package/lib/compiler/elements/topic.element.js +1 -1
  25. package/lib/compiler/module.js +6 -1
  26. package/lib/compiler/stages/1_scan_stage.js +1 -0
  27. package/lib/compiler/stages/2_treeshake_stage.js +1 -0
  28. package/lib/compiler/stages/3_extract_ts_stage.js +1 -0
  29. package/lib/compiler/stages/4_build_schemas_stage.js +3 -3
  30. package/lib/compiler/stages/5_inject_ts_stage.js +1 -0
  31. package/lib/compiler/stages/6_build_elements_stage.js +1 -0
  32. package/lib/compiler/stages/7_dump_stage.js +5 -3
  33. package/lib/compiler/stages/8_diagnose_stage.js +1 -0
  34. package/lib/compiler/typescript/bridge/inject.js +1 -1
  35. package/lib/compiler/typescript/bridge/organize.js +25 -32
  36. package/lib/compiler/typescript/parser.js +10 -0
  37. package/lib/compiler/typescript/source.js +6 -4
  38. package/lib/compiler/typescript/typescript_compiler.js +8 -3
  39. package/lib/elements/blocks/block.builder.js +16 -14
  40. package/lib/elements/blocks/block.js +3 -0
  41. package/lib/elements/blocks/block.schema.js +10 -1
  42. package/lib/elements/blocks/job/internal/machine_job.builder.js +10 -3
  43. package/lib/elements/blocks/job/internal/machine_job.schema.js +2 -0
  44. package/lib/elements/blocks/job/internal/resource_job.builder.js +16 -4
  45. package/lib/elements/blocks/job/internal/resource_job.schema.js +7 -0
  46. package/lib/elements/blocks/job/job.builder.js +5 -3
  47. package/lib/elements/blocks/job/job.js +2 -0
  48. package/lib/elements/blocks/job/job.schema.js +11 -1
  49. package/lib/elements/blocks/machine/machine.builder.js +6 -3
  50. package/lib/elements/blocks/machine/machine.js +7 -0
  51. package/lib/elements/blocks/machine/machine.schema.js +38 -3
  52. package/lib/elements/blocks/machine/machine_state.builder.js +6 -4
  53. package/lib/elements/blocks/machine/machine_transition.builder.js +8 -1
  54. package/lib/elements/blocks/queue/adapters/bucket.queue_adapter.js +1 -0
  55. package/lib/elements/blocks/queue/queue.builder.js +1 -1
  56. package/lib/elements/blocks/queue/queue.js +2 -0
  57. package/lib/elements/blocks/queue/queue.schema.js +7 -2
  58. package/lib/elements/blocks/resource/resource.builder.js +4 -3
  59. package/lib/elements/blocks/resource/resource.js +2 -0
  60. package/lib/elements/blocks/resource/resource.schema.js +13 -1
  61. package/lib/elements/blocks/topic/topic.builder.js +1 -1
  62. package/lib/elements/blocks/topic/topic.js +3 -1
  63. package/lib/elements/blocks/topic/topic.schema.js +8 -2
  64. package/lib/elements/edge/controller/adapters/cli.controller_adapter.js +2 -5
  65. package/lib/elements/edge/controller/adapters/controller_adapter.js +3 -0
  66. package/lib/elements/edge/controller/controller.builder.js +32 -17
  67. package/lib/elements/edge/controller/controller.js +10 -0
  68. package/lib/elements/edge/controller/controller.schema.js +38 -5
  69. package/lib/elements/edge/externals/externals.builder.js +9 -8
  70. package/lib/elements/edge/externals/externals.schema.js +9 -1
  71. package/lib/elements/entities/bucket/adapters/browserdb.bucket_adapter.js +7 -6
  72. package/lib/elements/entities/bucket/adapters/browserdb.service.d.ts +1 -1
  73. package/lib/elements/entities/bucket/adapters/browserdb.service.js +9 -10
  74. package/lib/elements/entities/bucket/adapters/bucket_adapter.js +3 -0
  75. package/lib/elements/entities/bucket/adapters/json.bucket_adapter.js +4 -2
  76. package/lib/elements/entities/bucket/adapters/memory.bucket_adapter.js +3 -0
  77. package/lib/elements/entities/bucket/adapters/memory.nql.js +1 -0
  78. package/lib/elements/entities/bucket/bucket.builder.js +9 -3
  79. package/lib/elements/entities/bucket/bucket.js +15 -8
  80. package/lib/elements/entities/bucket/bucket.schema.js +14 -1
  81. package/lib/elements/entities/bucket/cache/bucket_cache.js +10 -0
  82. package/lib/elements/entities/bucket/graph/bucket_graph.builder.js +1 -3
  83. package/lib/elements/entities/bucket/graph/bucket_graph.js +3 -0
  84. package/lib/elements/entities/bucket/graph/bucket_graph.schema.js +13 -2
  85. package/lib/elements/entities/bucket/graph/bucket_graph_link.builder.js +11 -2
  86. package/lib/elements/entities/bucket/model/bucket_model.builder.js +2 -1
  87. package/lib/elements/entities/bucket/model/bucket_model.convert.js +2 -1
  88. package/lib/elements/entities/bucket/model/bucket_model.js +3 -0
  89. package/lib/elements/entities/bucket/model/bucket_model.schema.js +15 -2
  90. package/lib/elements/entities/bucket/model/bucket_model_field.builder.js +17 -4
  91. package/lib/elements/entities/bucket/query/nql_compiler.js +28 -21
  92. package/lib/elements/entities/bucket/query/nql_engine.js +2 -1
  93. package/lib/elements/entities/bucket/view/bucket_view.builder.js +2 -1
  94. package/lib/elements/entities/bucket/view/bucket_view.js +4 -3
  95. package/lib/elements/entities/bucket/view/bucket_view.schema.js +13 -2
  96. package/lib/elements/entities/bucket/view/bucket_view_field.builder.js +8 -1
  97. package/lib/elements/entities/constants/constants.builder.js +12 -5
  98. package/lib/elements/entities/constants/constants.js +1 -0
  99. package/lib/elements/entities/constants/constants.schema.js +19 -3
  100. package/lib/elements/entities/drive/drive_adapter.js +1 -0
  101. package/lib/elements/entities/drive/local.drive_adapter.d.ts +1 -1
  102. package/lib/elements/entities/drive/local.drive_adapter.js +1 -0
  103. package/lib/elements/entities/message/message.builder.js +5 -2
  104. package/lib/elements/entities/message/message.js +2 -0
  105. package/lib/elements/entities/message/message.schema.js +7 -1
  106. package/lib/elements/entities/message/message_parser.js +1 -0
  107. package/lib/elements/entities/message/template/message_template.builder.js +2 -3
  108. package/lib/elements/entities/message/template/message_template.schema.js +16 -2
  109. package/lib/elements/entities/message/template/message_template_field.builder.js +14 -4
  110. package/lib/engine/app/app.config.js +3 -2
  111. package/lib/engine/app/app.js +21 -14
  112. package/lib/engine/app/inc/inc.client.d.ts +1 -1
  113. package/lib/engine/app/inc/inc.client.js +2 -0
  114. package/lib/engine/app/inc/inc.server.d.ts +1 -1
  115. package/lib/engine/app/inc/inc.server.js +3 -1
  116. package/lib/engine/app/inline.app.js +4 -1
  117. package/lib/engine/app/native/browser.app.js +2 -1
  118. package/lib/engine/app/native/distributed.app.config.js +1 -0
  119. package/lib/engine/app/native/distributed.app.js +2 -2
  120. package/lib/engine/app/native/distributed_node.app.js +6 -1
  121. package/lib/engine/app/native/monolyth.app.js +2 -0
  122. package/lib/engine/app/service.js +8 -0
  123. package/lib/engine/auth/zero.authn_provider.js +1 -4
  124. package/lib/engine/cli/cli.js +6 -2
  125. package/lib/engine/cli/cli_adapter.js +9 -1
  126. package/lib/engine/cli/cli_input.js +6 -4
  127. package/lib/engine/cli/script.js +8 -6
  128. package/lib/engine/daemon.js +14 -0
  129. package/lib/engine/data/date.js +3 -0
  130. package/lib/engine/data/datetime.js +34 -26
  131. package/lib/engine/data/decimal.js +6 -1
  132. package/lib/engine/data/duration.js +28 -26
  133. package/lib/engine/data/error.js +3 -0
  134. package/lib/engine/data/file.js +21 -6
  135. package/lib/engine/data/tree.js +3 -1
  136. package/lib/engine/dependency.js +17 -0
  137. package/lib/engine/module.js +35 -12
  138. package/lib/engine/space.js +3 -2
  139. package/lib/engine/transaction/nodes/bucket.trx_node.d.ts +1 -1
  140. package/lib/engine/transaction/nodes/bucket.trx_node.js +10 -1
  141. package/lib/engine/transaction/nodes/bucket_query.trx_node.js +9 -2
  142. package/lib/engine/transaction/nodes/external.trx_node.js +3 -0
  143. package/lib/engine/transaction/nodes/job.trx_node.js +5 -0
  144. package/lib/engine/transaction/nodes/machine.trx_node.js +4 -0
  145. package/lib/engine/transaction/nodes/queue.trx_node.js +4 -0
  146. package/lib/engine/transaction/nodes/resource.trx_node.js +4 -0
  147. package/lib/engine/transaction/nodes/topic.trx_node.js +4 -0
  148. package/lib/engine/transaction/trx.js +18 -3
  149. package/lib/engine/transaction/trx_engine.js +12 -1
  150. package/lib/engine/transaction/trx_node.js +23 -11
  151. package/lib/engine/tree.js +6 -5
  152. package/lib/engine/util/crypto.js +17 -17
  153. package/lib/engine/util/log.js +9 -9
  154. package/lib/engine/util/path.js +1 -1
  155. package/lib/engine/util/random.d.ts +1 -1
  156. package/lib/engine/util/regex.d.ts +3 -0
  157. package/lib/engine/util/regex.js +82 -0
  158. package/package.json +1 -4
  159. package/tools/joaquin/mock.js +10 -0
  160. package/tsconfig.build.tsbuildinfo +1 -1
@@ -7,6 +7,40 @@ const error_1 = require("./error");
7
7
  * @subcategory Data
8
8
  */
9
9
  class NesoiDatetime {
10
+ static tz = {
11
+ '-12:00': 'Etc/GMT+12',
12
+ '-11:00': 'Etc/GMT+11',
13
+ '-10:00': 'Etc/GMT+10',
14
+ '-07:00': 'Etc/GMT+7',
15
+ '-06:00': 'Etc/GMT+6',
16
+ '-05:00': 'Etc/GMT+5',
17
+ '-04:00': 'Etc/GMT+4',
18
+ '-03:00': 'Etc/GMT+3',
19
+ '-02:00': 'Etc/GMT+2',
20
+ '-01:00': 'Etc/GMT+1',
21
+ 'Z': 'Etc/GMT',
22
+ '+01:00': 'Etc/GMT-1',
23
+ '+02:00': 'Etc/GMT-2',
24
+ '+03:00': 'Etc/GMT-3',
25
+ '+04:00': 'Etc/GMT-4',
26
+ '+05:00': 'Etc/GMT-5',
27
+ '+06:00': 'Etc/GMT-6',
28
+ '+07:00': 'Etc/GMT-7',
29
+ '+08:00': 'Etc/GMT-8',
30
+ '+09:00': 'Etc/GMT-9',
31
+ '+10:00': 'Etc/GMT-10',
32
+ '+11:00': 'Etc/GMT-11',
33
+ '+12:00': 'Etc/GMT-12',
34
+ '+13:00': 'Etc/GMT-13',
35
+ };
36
+ /**
37
+ * Time in milliseconds since 1970-01-01T00:00:00.000Z
38
+ */
39
+ epoch;
40
+ /**
41
+ * Timezone represented as string (Z, -03, +05, ...)
42
+ */
43
+ tz;
10
44
  constructor(epoch, tz = 'Z') {
11
45
  this.epoch = epoch || new Date().getTime();
12
46
  this.tz = tz;
@@ -66,29 +100,3 @@ class NesoiDatetime {
66
100
  }
67
101
  }
68
102
  exports.NesoiDatetime = NesoiDatetime;
69
- NesoiDatetime.tz = {
70
- '-12:00': 'Etc/GMT+12',
71
- '-11:00': 'Etc/GMT+11',
72
- '-10:00': 'Etc/GMT+10',
73
- '-07:00': 'Etc/GMT+7',
74
- '-06:00': 'Etc/GMT+6',
75
- '-05:00': 'Etc/GMT+5',
76
- '-04:00': 'Etc/GMT+4',
77
- '-03:00': 'Etc/GMT+3',
78
- '-02:00': 'Etc/GMT+2',
79
- '-01:00': 'Etc/GMT+1',
80
- 'Z': 'Etc/GMT',
81
- '+01:00': 'Etc/GMT-1',
82
- '+02:00': 'Etc/GMT-2',
83
- '+03:00': 'Etc/GMT-3',
84
- '+04:00': 'Etc/GMT-4',
85
- '+05:00': 'Etc/GMT-5',
86
- '+06:00': 'Etc/GMT-6',
87
- '+07:00': 'Etc/GMT-7',
88
- '+08:00': 'Etc/GMT-8',
89
- '+09:00': 'Etc/GMT-9',
90
- '+10:00': 'Etc/GMT-10',
91
- '+11:00': 'Etc/GMT-11',
92
- '+12:00': 'Etc/GMT-12',
93
- '+13:00': 'Etc/GMT-13',
94
- };
@@ -7,8 +7,13 @@ const error_1 = require("./error");
7
7
  * @subcategory Data
8
8
  */
9
9
  class NesoiDecimal {
10
+ neg = false;
11
+ left;
12
+ right;
13
+ prec;
14
+ r_pad; // Number of zeros before right value
15
+ r_exp; // Number to be multiplied with right value when converting to float
10
16
  constructor(value, pLeft = 12, pRight = 12) {
11
- this.neg = false;
12
17
  let payload = value.trim();
13
18
  if (value[0] === '-') {
14
19
  this.neg = true;
@@ -7,6 +7,34 @@ const error_1 = require("./error");
7
7
  * @subcategory Data
8
8
  */
9
9
  class NesoiDuration {
10
+ static UNITS = {
11
+ ms: 'miliseconds',
12
+ milisecond: 'miliseconds',
13
+ miliseconds: 'miliseconds',
14
+ s: 'seconds',
15
+ second: 'seconds',
16
+ seconds: 'seconds',
17
+ min: 'minutes',
18
+ mins: 'minutes',
19
+ minute: 'minutes',
20
+ minutes: 'minutes',
21
+ h: 'hours',
22
+ hour: 'hours',
23
+ hours: 'hours',
24
+ d: 'days',
25
+ day: 'days',
26
+ days: 'days',
27
+ w: 'weeks',
28
+ week: 'weeks',
29
+ weeks: 'weeks',
30
+ month: 'months',
31
+ months: 'months',
32
+ y: 'years',
33
+ year: 'years',
34
+ years: 'years',
35
+ };
36
+ value;
37
+ unit;
10
38
  constructor(value) {
11
39
  this.unit = Object.keys(value)[0];
12
40
  this.value = value[this.unit];
@@ -34,29 +62,3 @@ class NesoiDuration {
34
62
  }
35
63
  }
36
64
  exports.NesoiDuration = NesoiDuration;
37
- NesoiDuration.UNITS = {
38
- ms: 'miliseconds',
39
- milisecond: 'miliseconds',
40
- miliseconds: 'miliseconds',
41
- s: 'seconds',
42
- second: 'seconds',
43
- seconds: 'seconds',
44
- min: 'minutes',
45
- mins: 'minutes',
46
- minute: 'minutes',
47
- minutes: 'minutes',
48
- h: 'hours',
49
- hour: 'hours',
50
- hours: 'hours',
51
- d: 'days',
52
- day: 'days',
53
- days: 'days',
54
- w: 'weeks',
55
- week: 'weeks',
56
- weeks: 'weeks',
57
- month: 'months',
58
- months: 'months',
59
- y: 'years',
60
- year: 'years',
61
- years: 'years',
62
- };
@@ -4,6 +4,9 @@ exports.NesoiError = void 0;
4
4
  var NesoiError;
5
5
  (function (NesoiError) {
6
6
  class BaseError extends Error {
7
+ name;
8
+ status;
9
+ data;
7
10
  constructor(name, message, status = 400, data) {
8
11
  super(message);
9
12
  this.name = name;
@@ -61,12 +61,27 @@ exports.LocalNesoiFile = LocalNesoiFile;
61
61
  * @subcategory Data
62
62
  */
63
63
  class NesoiFile {
64
+ __nesoi_file = true;
65
+ // The full path to the file on the drive where it belongs
66
+ filepath;
67
+ // The filename extracted from the filepath
68
+ filename;
69
+ // The file extension name, without '.', for example: 'svg', 'png'
70
+ extname;
71
+ // The mime type of this file, calculated from the extension
72
+ mimetype;
73
+ // The size of the uploaded file in bytes.
74
+ size;
75
+ // The name this file had according to the uploading client.
76
+ originalFilename;
77
+ // A Date object (or `null`) containing the time this file was last written to.
78
+ // Mostly here for compatibility with the [W3C File API Draft](http://dev.w3.org/2006/webapi/FileAPI/).
79
+ mtime;
80
+ // Algorithm used to generate the hash
81
+ hashAlgorithm = false;
82
+ // Only available after `.hash` is called
83
+ hash = null;
64
84
  constructor(filepath, filename, extname, mimetype, size, originalFilename, mtime) {
65
- this.__nesoi_file = true;
66
- // Algorithm used to generate the hash
67
- this.hashAlgorithm = false;
68
- // Only available after `.hash` is called
69
- this.hash = null;
70
85
  this.filepath = filepath;
71
86
  this.filename = filename;
72
87
  this.extname = extname;
@@ -90,6 +105,6 @@ class NesoiFile {
90
105
  hash: file.hash
91
106
  };
92
107
  }
108
+ static local = LocalNesoiFile;
93
109
  }
94
110
  exports.NesoiFile = NesoiFile;
95
- NesoiFile.local = LocalNesoiFile;
@@ -129,6 +129,8 @@ class Tree {
129
129
  static set(obj, fieldpath, replacer, __index = []) {
130
130
  const paths = fieldpath.split('.');
131
131
  class Ptr {
132
+ obj;
133
+ key;
132
134
  constructor(obj) {
133
135
  this.obj = obj;
134
136
  }
@@ -144,7 +146,7 @@ class Tree {
144
146
  return this.obj?.[this.key];
145
147
  }
146
148
  replace(replacer, i) {
147
- this.obj ?? (this.obj = {});
149
+ this.obj ??= {};
148
150
  this.obj[this.key] = replacer(this.obj?.[this.key], i);
149
151
  }
150
152
  }
@@ -13,6 +13,11 @@ const trx_node_1 = require("./transaction/trx_node");
13
13
  * @category Engine
14
14
  */
15
15
  class Tag {
16
+ module;
17
+ type;
18
+ name;
19
+ full;
20
+ short;
16
21
  constructor(module, type, name) {
17
22
  this.module = module;
18
23
  this.type = type;
@@ -259,6 +264,12 @@ exports.__unsafe_Tag = __unsafe_Tag;
259
264
  * @category Engine
260
265
  */
261
266
  class Dependency {
267
+ fromModule;
268
+ tag;
269
+ external;
270
+ build;
271
+ compile;
272
+ runtime;
262
273
  constructor(fromModule, tag, options) {
263
274
  this.fromModule = fromModule;
264
275
  this.tag = tag;
@@ -276,6 +287,12 @@ exports.Dependency = Dependency;
276
287
  * @category Engine
277
288
  */
278
289
  class BuilderNode {
290
+ tag;
291
+ isInline;
292
+ filepath;
293
+ dependencies;
294
+ builder;
295
+ progressive;
279
296
  constructor($) {
280
297
  this.tag = $.tag;
281
298
  this.isInline = $.isInline;
@@ -65,6 +65,40 @@ const topic_1 = require("../elements/blocks/topic/topic");
65
65
  * @category Engine
66
66
  */
67
67
  class Module {
68
+ name;
69
+ subdir;
70
+ schema;
71
+ /* Entities */
72
+ buckets = {};
73
+ messages = {};
74
+ /* Blocks */
75
+ jobs = {};
76
+ resources = {};
77
+ machines = {};
78
+ queues = {};
79
+ topics = {};
80
+ /* Edge */
81
+ controllers = {};
82
+ /* Trash */
83
+ trash;
84
+ /* Daemon */
85
+ /**
86
+ * Daemon which is running the current module.
87
+ * This is `undefined` when the _Module_ is created for compiling.
88
+ */
89
+ daemon;
90
+ /**
91
+ * NQL (Nesoi Query Language) Engine for this module.
92
+ */
93
+ nql;
94
+ /**
95
+ * The boot source for this module:
96
+ * - `dirpath`: This module is being run from a Space (Framework mode), so
97
+ * source is the module directory, from which builders will be read
98
+ * - `builders`: This module is being run in Library mode, so source is
99
+ * a list of builders
100
+ */
101
+ boot;
68
102
  /**
69
103
  * @param name A module name
70
104
  * @param boot The boot source for this module
@@ -73,6 +107,7 @@ class Module {
73
107
  this.name = name;
74
108
  this.subdir = subdir;
75
109
  this.schema = {
110
+ name: name,
76
111
  constants: new constants_schema_1.$Constants(this.name),
77
112
  externals: new externals_schema_1.$Externals(this.name),
78
113
  buckets: {},
@@ -84,18 +119,6 @@ class Module {
84
119
  queues: {},
85
120
  topics: {},
86
121
  };
87
- /* Entities */
88
- this.buckets = {};
89
- this.messages = {};
90
- /* Blocks */
91
- this.jobs = {};
92
- this.resources = {};
93
- this.machines = {};
94
- this.queues = {};
95
- this.topics = {};
96
- /* Edge */
97
- this.controllers = {};
98
- this.schema.name = name;
99
122
  this.boot = boot;
100
123
  }
101
124
  /**
@@ -63,13 +63,14 @@ const error_1 = require("./data/error");
63
63
  * @category Engine
64
64
  */
65
65
  class Space {
66
+ dirpath;
67
+ _authn = {};
68
+ _name = 'Space';
66
69
  /**
67
70
  * @param dirpath The path for the Space root directory
68
71
  */
69
72
  constructor(dirpath) {
70
73
  this.dirpath = dirpath;
71
- this._authn = {};
72
- this._name = 'Space';
73
74
  }
74
75
  /*
75
76
  * ROOT
@@ -237,7 +237,7 @@ export declare class BucketDriveTrxNode<M extends $Module, $ extends $Bucket> {
237
237
  */
238
238
  read(file: NesoiFile, options?: {
239
239
  silent?: boolean;
240
- }): Promise<Buffer> | undefined;
240
+ }): Promise<Buffer<ArrayBufferLike>> | undefined;
241
241
  /**
242
242
  * Move the file on disk
243
243
  */
@@ -12,10 +12,14 @@ const daemon_1 = require("../../daemon");
12
12
  * @subcategory Transaction
13
13
  */
14
14
  class BucketTrxNode {
15
+ trx;
16
+ tag;
17
+ enableTenancy = true;
18
+ external;
19
+ bucket;
15
20
  constructor(trx, tag) {
16
21
  this.trx = trx;
17
22
  this.tag = tag;
18
- this.enableTenancy = true;
19
23
  const module = trx_node_1.TrxNode.getModule(trx);
20
24
  this.external = tag.module !== module.name;
21
25
  if (!this.external) {
@@ -366,6 +370,9 @@ exports.BucketTrxNode = BucketTrxNode;
366
370
  * @subcategory Transaction
367
371
  */
368
372
  class BucketUnsafeTrxNode {
373
+ bucketTrx;
374
+ bucket;
375
+ enableTenancy;
369
376
  constructor(bucketTrx, bucket, enableTenancy) {
370
377
  this.bucketTrx = bucketTrx;
371
378
  this.bucket = bucket;
@@ -447,6 +454,8 @@ exports.BucketUnsafeTrxNode = BucketUnsafeTrxNode;
447
454
  * @subcategory Transaction
448
455
  */
449
456
  class BucketDriveTrxNode {
457
+ bucketTrx;
458
+ drive;
450
459
  constructor(bucketTrx, drive) {
451
460
  this.bucketTrx = bucketTrx;
452
461
  this.drive = drive;
@@ -10,14 +10,21 @@ const external_trx_node_1 = require("./external.trx_node");
10
10
  * @subcategory Transaction
11
11
  */
12
12
  class BucketQueryTrxNode {
13
+ trx;
14
+ tag;
15
+ query;
16
+ enableTenancy;
17
+ view;
18
+ _params = [];
19
+ _param_templates = [];
20
+ external;
21
+ bucket;
13
22
  constructor(trx, tag, query, enableTenancy, view) {
14
23
  this.trx = trx;
15
24
  this.tag = tag;
16
25
  this.query = query;
17
26
  this.enableTenancy = enableTenancy;
18
27
  this.view = view;
19
- this._params = [];
20
- this._param_templates = [];
21
28
  const module = trx_node_1.TrxNode.getModule(trx);
22
29
  this.external = tag.module !== module.name;
23
30
  if (!this.external) {
@@ -8,6 +8,9 @@ const error_1 = require("../../data/error");
8
8
  * @subcategory Transaction
9
9
  */
10
10
  class ExternalTrxNode {
11
+ trx;
12
+ tag;
13
+ daemon;
11
14
  constructor(trx, tag) {
12
15
  this.trx = trx;
13
16
  this.tag = tag;
@@ -10,6 +10,11 @@ const external_trx_node_1 = require("./external.trx_node");
10
10
  * @subcategory Transaction
11
11
  */
12
12
  class JobTrxNode {
13
+ trx;
14
+ tag;
15
+ ctx;
16
+ external;
17
+ job;
13
18
  constructor(trx, tag, ctx) {
14
19
  this.trx = trx;
15
20
  this.tag = tag;
@@ -10,6 +10,10 @@ const external_trx_node_1 = require("./external.trx_node");
10
10
  * @subcategory Transaction
11
11
  */
12
12
  class MachineTrxNode {
13
+ trx;
14
+ tag;
15
+ external;
16
+ machine;
13
17
  constructor(trx, tag) {
14
18
  this.trx = trx;
15
19
  this.tag = tag;
@@ -10,6 +10,10 @@ const error_1 = require("../../data/error");
10
10
  * @subcategory Transaction
11
11
  */
12
12
  class QueueTrxNode {
13
+ trx;
14
+ tag;
15
+ external;
16
+ queue;
13
17
  constructor(trx, tag) {
14
18
  this.trx = trx;
15
19
  this.tag = tag;
@@ -10,6 +10,10 @@ const external_trx_node_1 = require("./external.trx_node");
10
10
  * @subcategory Transaction
11
11
  */
12
12
  class ResourceTrxNode {
13
+ trx;
14
+ tag;
15
+ external;
16
+ resource;
13
17
  constructor(trx, tag) {
14
18
  this.trx = trx;
15
19
  this.tag = tag;
@@ -10,6 +10,10 @@ const external_trx_node_1 = require("./external.trx_node");
10
10
  * @subcategory Transaction
11
11
  */
12
12
  class TopicTrxNode {
13
+ trx;
14
+ tag;
15
+ external;
16
+ resource;
13
17
  constructor(trx, tag) {
14
18
  this.trx = trx;
15
19
  this.tag = tag;
@@ -13,6 +13,14 @@ const datetime_1 = require("../data/datetime");
13
13
  * @subcategory Transaction
14
14
  */
15
15
  class TrxStatus {
16
+ id;
17
+ origin;
18
+ start;
19
+ end;
20
+ state;
21
+ output;
22
+ error;
23
+ nodes;
16
24
  constructor(id, origin, start, end, state, output, error, nodes = []) {
17
25
  this.id = id;
18
26
  this.origin = origin;
@@ -56,11 +64,18 @@ exports.TrxStatus = TrxStatus;
56
64
  * @subcategory Transaction
57
65
  */
58
66
  class Trx {
67
+ engine;
68
+ module;
69
+ id;
70
+ origin;
71
+ root;
72
+ nodes;
73
+ holds = {};
74
+ start = datetime_1.NesoiDatetime.now();
75
+ end;
76
+ ctx = {};
59
77
  constructor(engine, module, origin, auth, id, root, nodes) {
60
78
  this.engine = engine;
61
- this.holds = {};
62
- this.start = datetime_1.NesoiDatetime.now();
63
- this.ctx = {};
64
79
  this.module = module;
65
80
  this.id = id || (Math.random() + 1).toString(36).substring(7);
66
81
  this.origin = origin;
@@ -15,12 +15,24 @@ const datetime_1 = require("../data/datetime");
15
15
  * @subcategory Transaction
16
16
  */
17
17
  class TrxEngine {
18
+ origin;
19
+ module;
20
+ authnProviders;
21
+ config;
22
+ services;
23
+ $TrxBucket;
24
+ /**
25
+ * Transaction used to read/write transactions on the adapter
26
+ */
27
+ innerTrx;
28
+ adapter;
18
29
  constructor(origin, module, authnProviders, config, services = {}) {
19
30
  this.origin = origin;
20
31
  this.module = module;
21
32
  this.authnProviders = authnProviders;
22
33
  this.config = config;
23
34
  this.services = services;
35
+ this.innerTrx = new trx_1.Trx(this, this.module, `trx:${origin}`);
24
36
  this.$TrxBucket = new elements_1.$Bucket(this.module.name, '__trx__', `Transaction of Module '${this.module.name}'`, new bucket_model_schema_1.$BucketModel({
25
37
  id: new bucket_model_schema_1.$BucketModelField('id', 'id', 'string', 'ID', true),
26
38
  origin: new bucket_model_schema_1.$BucketModelField('origin', 'origin', 'string', 'Origin', true),
@@ -28,7 +40,6 @@ class TrxEngine {
28
40
  start: new bucket_model_schema_1.$BucketModelField('start', 'start', 'datetime', 'Start', true),
29
41
  end: new bucket_model_schema_1.$BucketModelField('end', 'end', 'datetime', 'Start', false),
30
42
  }), new bucket_graph_schema_1.$BucketGraph(), {});
31
- this.innerTrx = new trx_1.Trx(this, this.module, `trx:${origin}`);
32
43
  this.adapter = config?.adapter?.(module.schema) || new memory_bucket_adapter_1.MemoryBucketAdapter(this.$TrxBucket, {});
33
44
  }
34
45
  getModule() {
@@ -23,6 +23,25 @@ const log_1 = require("../util/log");
23
23
  * @subcategory Transaction
24
24
  */
25
25
  class TrxNode {
26
+ scope;
27
+ trx;
28
+ parent;
29
+ module;
30
+ auth;
31
+ external;
32
+ id;
33
+ globalId;
34
+ children = [];
35
+ state;
36
+ action;
37
+ input;
38
+ output;
39
+ error;
40
+ time = {
41
+ start: datetime_1.NesoiDatetime.now(),
42
+ hold: undefined,
43
+ end: undefined
44
+ };
26
45
  constructor(scope, trx, parent, module, auth, external, id) {
27
46
  this.scope = scope;
28
47
  this.trx = trx;
@@ -30,12 +49,6 @@ class TrxNode {
30
49
  this.module = module;
31
50
  this.auth = auth;
32
51
  this.external = external;
33
- this.children = [];
34
- this.time = {
35
- start: datetime_1.NesoiDatetime.now(),
36
- hold: undefined,
37
- end: undefined
38
- };
39
52
  if (parent) {
40
53
  this.id = id || (Math.random() + 1).toString(36).substring(7);
41
54
  }
@@ -206,17 +219,16 @@ class TrxNode {
206
219
  return child;
207
220
  }
208
221
  static addAuthn(node, tokens, users) {
209
- var _a, _b;
210
222
  log_1.Log.trace('trx', node.globalId, 'Transaction authenticated', {
211
223
  tokens,
212
224
  users
213
225
  });
214
- node.auth ?? (node.auth = {
226
+ node.auth ??= {
215
227
  tokens: {},
216
228
  users: {}
217
- });
218
- (_a = node.auth).tokens ?? (_a.tokens = {});
219
- (_b = node.auth).users ?? (_b.users = {});
229
+ };
230
+ node.auth.tokens ??= {};
231
+ node.auth.users ??= {};
220
232
  Object.assign(node.auth.tokens, tokens);
221
233
  Object.assign(node.auth.users, users);
222
234
  }
@@ -13,6 +13,9 @@ const error_1 = require("./data/error");
13
13
  * @category Engine
14
14
  */
15
15
  class ModuleTree {
16
+ modules;
17
+ config;
18
+ layers = [];
16
19
  /**
17
20
  * @param modules A dictionary of modules by name
18
21
  * @param config Optional configuration for the treeshaking process
@@ -20,7 +23,6 @@ class ModuleTree {
20
23
  constructor(modules, config) {
21
24
  this.modules = modules;
22
25
  this.config = config;
23
- this.layers = [];
24
26
  }
25
27
  /**
26
28
  * Build the tree from existing modules on the Space.
@@ -29,7 +31,7 @@ class ModuleTree {
29
31
  * - Groups tree into layers which can be built in isolation
30
32
  */
31
33
  async resolve(cache) {
32
- cache ?? (cache = {
34
+ cache ??= {
33
35
  nesoidir: '',
34
36
  hash: {
35
37
  $: '',
@@ -44,7 +46,7 @@ class ModuleTree {
44
46
  modules: {},
45
47
  elements: {}
46
48
  }
47
- });
49
+ };
48
50
  const nodesByModule = await this.treeshake(cache);
49
51
  const resolvedNodes = await this.resolveDependencies(nodesByModule);
50
52
  this.layers = this.resolveLayers(resolvedNodes);
@@ -314,11 +316,10 @@ class ModuleTree {
314
316
  * @returns A list of resolved builder nodes
315
317
  */
316
318
  allNodesByModule() {
317
- var _a;
318
319
  const modules = {};
319
320
  for (const layer of this.layers) {
320
321
  for (const node of layer) {
321
- modules[_a = node.tag.module] ?? (modules[_a] = []);
322
+ modules[node.tag.module] ??= [];
322
323
  modules[node.tag.module].push(node);
323
324
  }
324
325
  }