datagrok-tools 4.14.20 → 4.14.22

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.
@@ -109,7 +109,7 @@ const replacers = exports.replacers = {
109
109
  FUNC_NAME_LOWERCASE: (s, name) => s.replace(/#{FUNC_NAME_LOWERCASE}/g, friendlyNameToName(name, false)),
110
110
  PARAMS_OBJECT: (s, params) => s.replace(/#{PARAMS_OBJECT}/g, params.length ? `{ ${params.map(p => p.name).join(', ')} }` : `{}`),
111
111
  OUTPUT_TYPE: (s, type) => s.replace(/#{OUTPUT_TYPE}/g, type),
112
- TYPED_PARAMS: (s, params) => s.replace(/#{TYPED_PARAMS}/g, params.map(p => `${p.name}${p.isOptional ? '?' : ''}: ${p.type}`).join(', '))
112
+ TYPED_PARAMS: (s, params) => s.replace(/#{TYPED_PARAMS}/g, params.map(p => `${p.name}${p.isOptional ? '?' : ''}: ${p.type} ${p.nullable ? '| null' : ''}`).join(', '))
113
113
  };
114
114
  class TemplateBuilder {
115
115
  static sep = '\n';
@@ -204,13 +204,15 @@ function getScriptInputs(script, comment = '#') {
204
204
  const regex = new RegExp(`${comment}\\s*input:\\s?([a-z_]+)(?:<[^>]*>)?\\s+(\\w+)(?:[^{\\n]*{[^}\\n]*})?`, 'g');
205
205
  const inputs = [];
206
206
  for (const match of script.matchAll(regex)) {
207
- const isOptional = /isOptional\s*:\s*true/.test(match[0]);
207
+ const isOptional = /isOptional\s*:\s*true/.test(match[0]) || /optional\s*:\s*true/.test(match[0]);
208
+ const nullable = /nullable\s*:\s*true/.test(match[0]);
208
209
  const type = dgToTsTypeMap[match[1]] || 'any';
209
210
  const name = match[2];
210
211
  inputs.push({
211
212
  type,
212
213
  name,
213
- isOptional
214
+ isOptional,
215
+ nullable
214
216
  });
215
217
  }
216
218
  return inputs;
@@ -10,7 +10,7 @@
10
10
  "@datagrok-libraries/utils": "^4.5.7"
11
11
  },
12
12
  "devDependencies": {
13
- "datagrok-tools": "^4.14.19",
13
+ "datagrok-tools": "^4.14.20",
14
14
  "webpack": "^5.95.0",
15
15
  "webpack-cli": "^5.1.4"
16
16
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datagrok-tools",
3
- "version": "4.14.20",
3
+ "version": "4.14.22",
4
4
  "description": "Utility to upload and publish packages to Datagrok",
5
5
  "homepage": "https://github.com/datagrok-ai/public/tree/master/tools#readme",
6
6
  "dependencies": {