@openfn/language-asana 4.3.0 → 5.0.1
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 +29 -1
- package/dist/index.cjs +3 -4
- package/dist/index.js +3 -4
- package/package.json +1 -1
- package/types/Adaptor.d.ts +17 -3
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.",
|
package/dist/index.cjs
CHANGED
|
@@ -36,7 +36,6 @@ __export(src_exports, {
|
|
|
36
36
|
fnIf: () => import_language_common3.fnIf,
|
|
37
37
|
getTask: () => getTask,
|
|
38
38
|
getTasks: () => getTasks,
|
|
39
|
-
http: () => import_language_common3.http,
|
|
40
39
|
lastReferenceValue: () => import_language_common3.lastReferenceValue,
|
|
41
40
|
merge: () => import_language_common3.merge,
|
|
42
41
|
request: () => request2,
|
|
@@ -66,7 +65,6 @@ __export(Adaptor_exports, {
|
|
|
66
65
|
fnIf: () => import_language_common3.fnIf,
|
|
67
66
|
getTask: () => getTask,
|
|
68
67
|
getTasks: () => getTasks,
|
|
69
|
-
http: () => import_language_common3.http,
|
|
70
68
|
lastReferenceValue: () => import_language_common3.lastReferenceValue,
|
|
71
69
|
merge: () => import_language_common3.merge,
|
|
72
70
|
request: () => request2,
|
|
@@ -257,6 +255,7 @@ function searchTask(task, query = {}, options = {}) {
|
|
|
257
255
|
options
|
|
258
256
|
);
|
|
259
257
|
const { workspaceGid = state.configuration.workspaceGid } = resolvedOptions;
|
|
258
|
+
const { resource_subtype = "default_task", ...restQuery } = resolvedQuery;
|
|
260
259
|
if (!workspaceGid)
|
|
261
260
|
throw new Error("You need to specify Workspace GID");
|
|
262
261
|
const response = await request(
|
|
@@ -264,8 +263,9 @@ function searchTask(task, query = {}, options = {}) {
|
|
|
264
263
|
`workspaces/${workspaceGid}/tasks/search`,
|
|
265
264
|
{
|
|
266
265
|
query: {
|
|
266
|
+
resource_subtype,
|
|
267
267
|
text: resolvedTask,
|
|
268
|
-
...
|
|
268
|
+
...restQuery
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
);
|
|
@@ -337,7 +337,6 @@ var src_default = Adaptor_exports;
|
|
|
337
337
|
fnIf,
|
|
338
338
|
getTask,
|
|
339
339
|
getTasks,
|
|
340
|
-
http,
|
|
341
340
|
lastReferenceValue,
|
|
342
341
|
merge,
|
|
343
342
|
request,
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,6 @@ __export(Adaptor_exports, {
|
|
|
23
23
|
fnIf: () => fnIf,
|
|
24
24
|
getTask: () => getTask,
|
|
25
25
|
getTasks: () => getTasks,
|
|
26
|
-
http: () => http,
|
|
27
26
|
lastReferenceValue: () => lastReferenceValue,
|
|
28
27
|
merge: () => merge,
|
|
29
28
|
request: () => request2,
|
|
@@ -124,7 +123,6 @@ import {
|
|
|
124
123
|
fields,
|
|
125
124
|
fn,
|
|
126
125
|
fnIf,
|
|
127
|
-
http,
|
|
128
126
|
lastReferenceValue,
|
|
129
127
|
merge,
|
|
130
128
|
sourceValue,
|
|
@@ -237,6 +235,7 @@ function searchTask(task, query = {}, options = {}) {
|
|
|
237
235
|
options
|
|
238
236
|
);
|
|
239
237
|
const { workspaceGid = state.configuration.workspaceGid } = resolvedOptions;
|
|
238
|
+
const { resource_subtype = "default_task", ...restQuery } = resolvedQuery;
|
|
240
239
|
if (!workspaceGid)
|
|
241
240
|
throw new Error("You need to specify Workspace GID");
|
|
242
241
|
const response = await request(
|
|
@@ -244,8 +243,9 @@ function searchTask(task, query = {}, options = {}) {
|
|
|
244
243
|
`workspaces/${workspaceGid}/tasks/search`,
|
|
245
244
|
{
|
|
246
245
|
query: {
|
|
246
|
+
resource_subtype,
|
|
247
247
|
text: resolvedTask,
|
|
248
|
-
...
|
|
248
|
+
...restQuery
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
);
|
|
@@ -317,7 +317,6 @@ export {
|
|
|
317
317
|
fnIf,
|
|
318
318
|
getTask,
|
|
319
319
|
getTasks,
|
|
320
|
-
http,
|
|
321
320
|
lastReferenceValue,
|
|
322
321
|
merge,
|
|
323
322
|
request2 as request,
|
package/package.json
CHANGED
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
|
/**
|
|
@@ -193,4 +207,4 @@ export type StoryOptions = any;
|
|
|
193
207
|
* Options provided to the Asana API request
|
|
194
208
|
*/
|
|
195
209
|
export type RequestOptions = any;
|
|
196
|
-
export { alterState, cursor, dataPath, dataValue, dateFns, each, field, fields, fn, fnIf,
|
|
210
|
+
export { alterState, cursor, dataPath, dataValue, dateFns, each, field, fields, fn, fnIf, lastReferenceValue, merge, sourceValue, as } from "@openfn/language-common";
|