nesoi 3.3.5 → 3.3.6

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 (39) hide show
  1. package/lib/elements/blocks/job/internal/resource_job.builder.js +3 -1
  2. package/lib/elements/blocks/resource/resource.builder.js +1 -1
  3. package/lib/elements/entities/bucket/adapters/bucket_adapter.d.ts +1 -1
  4. package/lib/elements/entities/bucket/adapters/bucket_adapter.js +2 -2
  5. package/lib/elements/entities/bucket/adapters/memory.nql.d.ts +1 -1
  6. package/lib/elements/entities/bucket/adapters/memory.nql.js +33 -15
  7. package/lib/elements/entities/bucket/bucket.builder.js +1 -1
  8. package/lib/elements/entities/bucket/bucket.d.ts +4 -0
  9. package/lib/elements/entities/bucket/bucket.infer.d.ts +7 -7
  10. package/lib/elements/entities/bucket/bucket.js +9 -9
  11. package/lib/elements/entities/bucket/cache/bucket_cache.js +3 -3
  12. package/lib/elements/entities/bucket/graph/bucket_graph.d.ts +13 -3
  13. package/lib/elements/entities/bucket/graph/bucket_graph.infer.d.ts +1 -1
  14. package/lib/elements/entities/bucket/graph/bucket_graph.js +21 -11
  15. package/lib/elements/entities/bucket/graph/bucket_graph_link.builder.d.ts +6 -5
  16. package/lib/elements/entities/bucket/model/bucket_model.convert.js +4 -4
  17. package/lib/elements/entities/bucket/query/nql.schema.d.ts +2 -0
  18. package/lib/elements/entities/bucket/query/nql_compiler.js +6 -1
  19. package/lib/elements/entities/bucket/query/nql_engine.d.ts +2 -2
  20. package/lib/elements/entities/bucket/query/nql_engine.js +2 -2
  21. package/lib/elements/entities/bucket/view/bucket_view.builder.d.ts +3 -2
  22. package/lib/elements/entities/bucket/view/bucket_view.builder.js +3 -3
  23. package/lib/elements/entities/bucket/view/bucket_view.js +123 -32
  24. package/lib/elements/entities/bucket/view/bucket_view.schema.d.ts +6 -3
  25. package/lib/elements/entities/bucket/view/bucket_view.schema.js +2 -1
  26. package/lib/elements/entities/bucket/view/bucket_view_field.builder.d.ts +25 -24
  27. package/lib/elements/entities/bucket/view/bucket_view_field.builder.js +65 -25
  28. package/lib/engine/app/inline.app.js +6 -0
  29. package/lib/engine/app/native/distributed_node.app.js +6 -0
  30. package/lib/engine/app/service.d.ts +7 -0
  31. package/lib/engine/app/service.js +2 -0
  32. package/lib/engine/transaction/nodes/bucket.trx_node.d.ts +2 -2
  33. package/lib/engine/transaction/nodes/bucket.trx_node.js +6 -4
  34. package/lib/engine/transaction/nodes/bucket_query.trx_node.d.ts +2 -0
  35. package/lib/engine/transaction/nodes/bucket_query.trx_node.js +15 -4
  36. package/lib/engine/transaction/trx_engine.js +1 -1
  37. package/lib/engine/transaction/trx_node.js +3 -3
  38. package/package.json +1 -1
  39. package/tsconfig.build.tsbuildinfo +1 -1
@@ -67,12 +67,12 @@ export declare class BucketTrxNode<M extends $Module, $ extends $Bucket> {
67
67
  * Returns one or more objects referenced by the graph link,
68
68
  * or `undefined` if the graph link doesn't resolve.
69
69
  */
70
- readLink<LinkName extends keyof $['graph']['links'], Link extends $['graph']['links'][LinkName], Obj extends Link['#bucket']['#data']>(id: $['#data']['id'], link: LinkName): Promise<Link['#many'] extends true ? Obj[] : (Obj | undefined)>;
70
+ readLink<LinkName extends keyof $['graph']['links'], Link extends $['graph']['links'][LinkName], Obj extends Link['#bucket']['#data']>(id: $['#data']['id'], link: LinkName, index?: string[]): Promise<Link['#many'] extends true ? Obj[] : (Obj | undefined)>;
71
71
  /**
72
72
  * Returns one or more objects referenced by the graph link,
73
73
  * or `undefined` if the graph link doesn't resolve.
74
74
  */
75
- readManyLinks<LinkName extends keyof $['graph']['links'], Link extends $['graph']['links'][LinkName], Obj extends Link['#bucket']['#data']>(ids: $['#data']['id'][], link: LinkName): Promise<Link['#many'] extends true ? Obj[] : (Obj | undefined)>;
75
+ readManyLinks<LinkName extends keyof $['graph']['links'], Link extends $['graph']['links'][LinkName], Obj extends Link['#bucket']['#data']>(ids: $['#data']['id'][], link: LinkName, indexes?: string[][]): Promise<Link['#many'] extends true ? Obj[] : (Obj | undefined)>;
76
76
  /**
77
77
  * Returns one or more objects referenced by the graph link built with a view,
78
78
  * or `undefined` if the graph link doesn't resolve.
@@ -145,20 +145,22 @@ class BucketTrxNode {
145
145
  * Returns one or more objects referenced by the graph link,
146
146
  * or `undefined` if the graph link doesn't resolve.
147
147
  */
148
- async readLink(id, link) {
148
+ async readLink(id, link, index) {
149
149
  return this.wrap('readLink', { id, link }, (trx, bucket) => bucket.readLink(trx, id, link, {
150
150
  silent: true,
151
- no_tenancy: !this.enableTenancy
151
+ no_tenancy: !this.enableTenancy,
152
+ index
152
153
  }));
153
154
  }
154
155
  /**
155
156
  * Returns one or more objects referenced by the graph link,
156
157
  * or `undefined` if the graph link doesn't resolve.
157
158
  */
158
- async readManyLinks(ids, link) {
159
+ async readManyLinks(ids, link, indexes) {
159
160
  return this.wrap('readLinks', { ids, link }, (trx, bucket) => bucket.readManyLinks(trx, ids, link, {
160
161
  silent: true,
161
- no_tenancy: !this.enableTenancy
162
+ no_tenancy: !this.enableTenancy,
163
+ indexes
162
164
  }));
163
165
  }
164
166
  /**
@@ -16,11 +16,13 @@ export declare class BucketQueryTrxNode<M extends $Module, B extends $Bucket, V
16
16
  private enableTenancy;
17
17
  private view?;
18
18
  private _params?;
19
+ private _path_params?;
19
20
  private external;
20
21
  private bucket?;
21
22
  constructor(trx: TrxNode<any, M, any>, tag: Tag, query: NQL_AnyQuery, enableTenancy: boolean, view?: V | undefined);
22
23
  merge($: NQL_Query<M, B>): void;
23
24
  params(value?: Record<string, any> | Record<string, any>[]): this;
25
+ path_params(value?: Record<string, any> | Record<string, any>[]): this;
24
26
  wrap(action: string, input: Record<string, any>, fn: (trx: AnyTrxNode, element: Bucket<M, B>) => Promise<any>): Promise<{
25
27
  data: any[];
26
28
  }>;
@@ -17,6 +17,7 @@ class BucketQueryTrxNode {
17
17
  this.enableTenancy = enableTenancy;
18
18
  this.view = view;
19
19
  this._params = [];
20
+ this._path_params = [];
20
21
  const module = trx_node_1.TrxNode.getModule(trx);
21
22
  this.external = tag.module !== module.name;
22
23
  if (!this.external) {
@@ -38,6 +39,12 @@ class BucketQueryTrxNode {
38
39
  : [];
39
40
  return this;
40
41
  }
42
+ path_params(value) {
43
+ this._path_params = value
44
+ ? Array.isArray(value) ? value : [value]
45
+ : undefined;
46
+ return this;
47
+ }
41
48
  /*
42
49
  Wrap
43
50
  */
@@ -69,7 +76,8 @@ class BucketQueryTrxNode {
69
76
  perPage: 1
70
77
  }, this.view, {
71
78
  no_tenancy: !this.enableTenancy,
72
- params: this._params
79
+ params: this._params,
80
+ path_params: this._path_params
73
81
  });
74
82
  });
75
83
  return results.data.length
@@ -80,7 +88,8 @@ class BucketQueryTrxNode {
80
88
  const results = await this.wrap('queryFirstOrFail', { schema: this.query, view: this.view }, async (trx, bucket) => {
81
89
  const results = await bucket.query(trx, this.query, undefined, this.view, {
82
90
  no_tenancy: !this.enableTenancy,
83
- params: this._params
91
+ params: this._params,
92
+ path_params: this._path_params
84
93
  });
85
94
  if (!results.data.length) {
86
95
  throw error_1.NesoiError.Bucket.Query.NoResults({ bucket: bucket.schema.alias, query: this.query });
@@ -92,7 +101,8 @@ class BucketQueryTrxNode {
92
101
  async all() {
93
102
  const results = await this.wrap('queryAll', { schema: this.query, view: this.view }, async (trx, bucket) => {
94
103
  return bucket.query(trx, this.query, undefined, this.view, {
95
- params: this._params
104
+ params: this._params,
105
+ path_params: this._path_params
96
106
  });
97
107
  });
98
108
  return results.data;
@@ -106,7 +116,8 @@ class BucketQueryTrxNode {
106
116
  }
107
117
  const results = await this.wrap('queryPage', { schema: this.query, view: this.view }, async (trx, bucket) => {
108
118
  return bucket.query(trx, this.query, pagination, this.view, {
109
- params: this._params
119
+ params: this._params,
120
+ path_params: this._path_params
110
121
  });
111
122
  });
112
123
  return results;
@@ -144,7 +144,7 @@ class TrxEngine {
144
144
  _tokens[providerName] = token;
145
145
  if (provider.eager || force) {
146
146
  const { user } = await provider.authenticate({ trx: node, token });
147
- users[providerName] = user;
147
+ _users[providerName] = user;
148
148
  }
149
149
  }
150
150
  }
@@ -237,11 +237,11 @@ class TrxNode {
237
237
  static async checkAuth(node, options) {
238
238
  if (!options?.length)
239
239
  return;
240
- if (!Object.keys(node.auth?.tokens || {}).length) {
240
+ if (!node.auth || !Object.keys(node.auth?.tokens || {}).length) {
241
241
  throw error_1.NesoiError.Trx.Unauthorized({ providers: options.map(opt => opt.provider) });
242
242
  }
243
- const users = node.auth?.users || {};
244
- const tokens = node.auth?.tokens || {};
243
+ const users = node.auth.users;
244
+ const tokens = node.auth.tokens;
245
245
  for (const opt of options) {
246
246
  // Eager provider or previously authenticated user
247
247
  if (opt.provider in users) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nesoi",
3
- "version": "3.3.5",
3
+ "version": "3.3.6",
4
4
  "description": "Declarative framework for data-driven applications",
5
5
  "repository": {
6
6
  "type": "git",