@oondemand/oon-core-back 0.3.63 → 0.3.64

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": "@oondemand/oon-core-back",
3
- "version": "0.3.63",
3
+ "version": "0.3.64",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/oondemand/oon-platform.git",
@@ -2,7 +2,7 @@
2
2
 
3
3
  const SENSITIVE_KEY = /(authorization|cookie|password|passwd|secret|token|api[-_]?key|app[-_]?key|app[-_]?secret|private[-_]?key|credential|senha)/i;
4
4
  const DEFAULTS = {
5
- maxDepth: 6,
5
+ maxDepth: 12,
6
6
  maxArrayItems: 20,
7
7
  maxObjectKeys: 100,
8
8
  maxStringLength: 4000,
@@ -106,6 +106,17 @@ function wait(ms) {
106
106
  return ms > 0 ? new Promise((resolve) => setTimeout(resolve, ms)) : Promise.resolve();
107
107
  }
108
108
 
109
+ async function resolveCallParam(callDefinition, input = {}, context = {}) {
110
+ const declared = typeof callDefinition.param === "function"
111
+ ? await callDefinition.param({ input, context, cursor: context.cursor })
112
+ : callDefinition.param;
113
+ return resolveTemplate(declared ?? [{}], {
114
+ input,
115
+ context,
116
+ cursor: context.cursor,
117
+ });
118
+ }
119
+
109
120
  function createOmieClient(options = {}) {
110
121
  const credentials = options.credentials || {};
111
122
  const appKey = String(credentials.appKey || "").trim();
@@ -148,11 +159,7 @@ function createOmieClient(options = {}) {
148
159
  code: "OMIE_CALL_MISSING",
149
160
  });
150
161
  }
151
- const resolvedParam = resolveTemplate(callDefinition.param ?? [{}], {
152
- input,
153
- context,
154
- cursor: context.cursor,
155
- });
162
+ const resolvedParam = await resolveCallParam(callDefinition, input, context);
156
163
  const body = {
157
164
  call,
158
165
  app_key: appKey,
@@ -247,6 +254,7 @@ module.exports = {
247
254
  createOmieClient,
248
255
  getPath,
249
256
  normalizeEndpoint,
257
+ resolveCallParam,
250
258
  resolveTemplate,
251
259
  responseError,
252
260
  };