@openfn/language-asana 5.0.0 → 5.0.2
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/ast.json +30 -2
- package/dist/index.cjs +3 -1
- package/dist/index.js +3 -1
- package/package.json +2 -2
- package/types/Adaptor.d.ts +16 -2
package/ast.json
CHANGED
|
@@ -376,9 +376,24 @@
|
|
|
376
376
|
},
|
|
377
377
|
{
|
|
378
378
|
"title": "example",
|
|
379
|
-
"description": "searchTask(\"Test Search Task\", {\n
|
|
379
|
+
"description": "searchTask(\"Test Search Task\", {\n sort_by: \"modified_at\"\n});",
|
|
380
380
|
"caption": "Search for a task by name"
|
|
381
381
|
},
|
|
382
|
+
{
|
|
383
|
+
"title": "example",
|
|
384
|
+
"description": "searchTask(\"\", {\n \"custom_fields.12345.value\": $.data.custom_field_value,\n});",
|
|
385
|
+
"caption": "Search for a task by custom field only"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"title": "example",
|
|
389
|
+
"description": "searchTask(\"Test Search Task\", {\n \"custom_fields.12345.is_set\": true,\n});",
|
|
390
|
+
"caption": "Search for a task by name and custom field"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"title": "example",
|
|
394
|
+
"description": "searchTask(\"Test Search Task\", {\n resource_subtype: \"milestone\",\n});",
|
|
395
|
+
"caption": "Search for a milestone by name"
|
|
396
|
+
},
|
|
382
397
|
{
|
|
383
398
|
"title": "function",
|
|
384
399
|
"description": null,
|
|
@@ -405,6 +420,19 @@
|
|
|
405
420
|
},
|
|
406
421
|
"name": "query"
|
|
407
422
|
},
|
|
423
|
+
{
|
|
424
|
+
"title": "param",
|
|
425
|
+
"description": "The resource subtype to search for. Must be either `\"default_task\"` or `\"milestone\"`. Defaults to `\"default_task\"`.",
|
|
426
|
+
"type": {
|
|
427
|
+
"type": "OptionalType",
|
|
428
|
+
"expression": {
|
|
429
|
+
"type": "NameExpression",
|
|
430
|
+
"name": "string"
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
"name": "query.resource_subtype",
|
|
434
|
+
"default": "default_task"
|
|
435
|
+
},
|
|
408
436
|
{
|
|
409
437
|
"title": "param",
|
|
410
438
|
"description": "(Optional) options argument.",
|
|
@@ -634,7 +662,7 @@
|
|
|
634
662
|
"operation"
|
|
635
663
|
],
|
|
636
664
|
"docs": {
|
|
637
|
-
"description": "
|
|
665
|
+
"description": "Execute a function only when the condition returns true",
|
|
638
666
|
"tags": [
|
|
639
667
|
{
|
|
640
668
|
"title": "public",
|
package/dist/index.cjs
CHANGED
|
@@ -255,6 +255,7 @@ function searchTask(task, query = {}, options = {}) {
|
|
|
255
255
|
options
|
|
256
256
|
);
|
|
257
257
|
const { workspaceGid = state.configuration.workspaceGid } = resolvedOptions;
|
|
258
|
+
const { resource_subtype = "default_task", ...restQuery } = resolvedQuery;
|
|
258
259
|
if (!workspaceGid)
|
|
259
260
|
throw new Error("You need to specify Workspace GID");
|
|
260
261
|
const response = await request(
|
|
@@ -262,8 +263,9 @@ function searchTask(task, query = {}, options = {}) {
|
|
|
262
263
|
`workspaces/${workspaceGid}/tasks/search`,
|
|
263
264
|
{
|
|
264
265
|
query: {
|
|
266
|
+
resource_subtype,
|
|
265
267
|
text: resolvedTask,
|
|
266
|
-
...
|
|
268
|
+
...restQuery
|
|
267
269
|
}
|
|
268
270
|
}
|
|
269
271
|
);
|
package/dist/index.js
CHANGED
|
@@ -235,6 +235,7 @@ function searchTask(task, query = {}, options = {}) {
|
|
|
235
235
|
options
|
|
236
236
|
);
|
|
237
237
|
const { workspaceGid = state.configuration.workspaceGid } = resolvedOptions;
|
|
238
|
+
const { resource_subtype = "default_task", ...restQuery } = resolvedQuery;
|
|
238
239
|
if (!workspaceGid)
|
|
239
240
|
throw new Error("You need to specify Workspace GID");
|
|
240
241
|
const response = await request(
|
|
@@ -242,8 +243,9 @@ function searchTask(task, query = {}, options = {}) {
|
|
|
242
243
|
`workspaces/${workspaceGid}/tasks/search`,
|
|
243
244
|
{
|
|
244
245
|
query: {
|
|
246
|
+
resource_subtype,
|
|
245
247
|
text: resolvedTask,
|
|
246
|
-
...
|
|
248
|
+
...restQuery
|
|
247
249
|
}
|
|
248
250
|
}
|
|
249
251
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-asana",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"label": "Asana",
|
|
5
5
|
"description": "OpenFn adaptor for accessing objects in Asana",
|
|
6
6
|
"homepage": "https://docs.openfn.org",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"configuration-schema.json"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@openfn/language-common": "3.0.
|
|
28
|
+
"@openfn/language-common": "3.0.3"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"assertion-error": "2.0.0",
|
package/types/Adaptor.d.ts
CHANGED
|
@@ -114,17 +114,31 @@ export function upsertTask(projectGid: string, params: {
|
|
|
114
114
|
* @public
|
|
115
115
|
* @example <caption>Search for a task by name</caption>
|
|
116
116
|
* searchTask("Test Search Task", {
|
|
117
|
-
* resource_subtype: "default_task",
|
|
118
117
|
* sort_by: "modified_at"
|
|
119
118
|
* });
|
|
119
|
+
* @example <caption>Search for a task by custom field only</caption>
|
|
120
|
+
* searchTask("", {
|
|
121
|
+
* "custom_fields.12345.value": $.data.custom_field_value,
|
|
122
|
+
* });
|
|
123
|
+
* @example <caption>Search for a task by name and custom field</caption>
|
|
124
|
+
* searchTask("Test Search Task", {
|
|
125
|
+
* "custom_fields.12345.is_set": true,
|
|
126
|
+
* });
|
|
127
|
+
* @example <caption>Search for a milestone by name</caption>
|
|
128
|
+
* searchTask("Test Search Task", {
|
|
129
|
+
* resource_subtype: "milestone",
|
|
130
|
+
* });
|
|
120
131
|
* @function
|
|
121
132
|
* @param {string} task - The text or name of the task to search for.
|
|
122
133
|
* @param {object} [query] - Query params. See {@link https://developers.asana.com/reference/searchtasksforworkspace Docs} for a list of valid parameters.
|
|
134
|
+
* @param {string} [query.resource_subtype = default_task] - The resource subtype to search for. Must be either `"default_task"` or `"milestone"`. Defaults to `"default_task"`.
|
|
123
135
|
* @param {object} [options] - (Optional) options argument.
|
|
124
136
|
* @param {string} [options.workspaceGid] - The workspace to search in. Defaults to the workspace specified in the configuration.
|
|
125
137
|
* @returns {Operation} An operation that, when executed, returns the search results in state.data.
|
|
126
138
|
*/
|
|
127
|
-
export function searchTask(task: string, query?:
|
|
139
|
+
export function searchTask(task: string, query?: {
|
|
140
|
+
resource_subtype?: string;
|
|
141
|
+
}, options?: {
|
|
128
142
|
workspaceGid?: string;
|
|
129
143
|
}): Operation;
|
|
130
144
|
/**
|