@openfn/language-asana 4.2.2 → 5.0.0
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 +82 -0
- package/configuration-schema.json +10 -1
- package/dist/index.cjs +27 -3
- package/dist/index.js +26 -3
- package/package.json +1 -1
- package/types/Adaptor.d.ts +19 -1
package/ast.json
CHANGED
|
@@ -359,6 +359,88 @@
|
|
|
359
359
|
},
|
|
360
360
|
"valid": false
|
|
361
361
|
},
|
|
362
|
+
{
|
|
363
|
+
"name": "searchTask",
|
|
364
|
+
"params": [
|
|
365
|
+
"task",
|
|
366
|
+
"query",
|
|
367
|
+
"options"
|
|
368
|
+
],
|
|
369
|
+
"docs": {
|
|
370
|
+
"description": "Search for tasks in a workspace by task name.",
|
|
371
|
+
"tags": [
|
|
372
|
+
{
|
|
373
|
+
"title": "public",
|
|
374
|
+
"description": null,
|
|
375
|
+
"type": null
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"title": "example",
|
|
379
|
+
"description": "searchTask(\"Test Search Task\", {\n resource_subtype: \"default_task\",\n sort_by: \"modified_at\"\n});",
|
|
380
|
+
"caption": "Search for a task by name"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"title": "function",
|
|
384
|
+
"description": null,
|
|
385
|
+
"name": null
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"title": "param",
|
|
389
|
+
"description": "The text or name of the task to search for.",
|
|
390
|
+
"type": {
|
|
391
|
+
"type": "NameExpression",
|
|
392
|
+
"name": "string"
|
|
393
|
+
},
|
|
394
|
+
"name": "task"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"title": "param",
|
|
398
|
+
"description": "Query params. See {@link https://developers.asana.com/reference/searchtasksforworkspace Docs} for a list of valid parameters.",
|
|
399
|
+
"type": {
|
|
400
|
+
"type": "OptionalType",
|
|
401
|
+
"expression": {
|
|
402
|
+
"type": "NameExpression",
|
|
403
|
+
"name": "object"
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
"name": "query"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"title": "param",
|
|
410
|
+
"description": "(Optional) options argument.",
|
|
411
|
+
"type": {
|
|
412
|
+
"type": "OptionalType",
|
|
413
|
+
"expression": {
|
|
414
|
+
"type": "NameExpression",
|
|
415
|
+
"name": "object"
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
"name": "options"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"title": "param",
|
|
422
|
+
"description": "The workspace to search in. Defaults to the workspace specified in the configuration.",
|
|
423
|
+
"type": {
|
|
424
|
+
"type": "OptionalType",
|
|
425
|
+
"expression": {
|
|
426
|
+
"type": "NameExpression",
|
|
427
|
+
"name": "string"
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
"name": "options.workspaceGid"
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
"title": "returns",
|
|
434
|
+
"description": "An operation that, when executed, returns the search results in state.data.",
|
|
435
|
+
"type": {
|
|
436
|
+
"type": "NameExpression",
|
|
437
|
+
"name": "Operation"
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
]
|
|
441
|
+
},
|
|
442
|
+
"valid": false
|
|
443
|
+
},
|
|
362
444
|
{
|
|
363
445
|
"name": "createTaskStory",
|
|
364
446
|
"params": [
|
|
@@ -17,11 +17,20 @@
|
|
|
17
17
|
"examples": [
|
|
18
18
|
"sample-tokenyWSJdXBACMLLWMNGgADFA"
|
|
19
19
|
]
|
|
20
|
+
},
|
|
21
|
+
"workspaceGid": {
|
|
22
|
+
"title": "Workspace GID",
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "Globally unique identifier for the workspace or organization.",
|
|
25
|
+
"examples": [
|
|
26
|
+
"12345"
|
|
27
|
+
]
|
|
20
28
|
}
|
|
21
29
|
},
|
|
22
30
|
"type": "object",
|
|
23
31
|
"additionalProperties": true,
|
|
24
32
|
"required": [
|
|
25
|
-
"token"
|
|
33
|
+
"token",
|
|
34
|
+
"workspaceGid"
|
|
26
35
|
]
|
|
27
36
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -36,10 +36,10 @@ __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,
|
|
42
|
+
searchTask: () => searchTask,
|
|
43
43
|
sourceValue: () => import_language_common3.sourceValue,
|
|
44
44
|
updateTask: () => updateTask,
|
|
45
45
|
upsertTask: () => upsertTask
|
|
@@ -65,10 +65,10 @@ __export(Adaptor_exports, {
|
|
|
65
65
|
fnIf: () => import_language_common3.fnIf,
|
|
66
66
|
getTask: () => getTask,
|
|
67
67
|
getTasks: () => getTasks,
|
|
68
|
-
http: () => import_language_common3.http,
|
|
69
68
|
lastReferenceValue: () => import_language_common3.lastReferenceValue,
|
|
70
69
|
merge: () => import_language_common3.merge,
|
|
71
70
|
request: () => request2,
|
|
71
|
+
searchTask: () => searchTask,
|
|
72
72
|
sourceValue: () => import_language_common3.sourceValue,
|
|
73
73
|
updateTask: () => updateTask,
|
|
74
74
|
upsertTask: () => upsertTask
|
|
@@ -246,6 +246,30 @@ function upsertTask(projectGid, params, callback) {
|
|
|
246
246
|
});
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
|
+
function searchTask(task, query = {}, options = {}) {
|
|
250
|
+
return async (state) => {
|
|
251
|
+
const [resolvedTask, resolvedQuery, resolvedOptions] = (0, import_util2.expandReferences)(
|
|
252
|
+
state,
|
|
253
|
+
task,
|
|
254
|
+
query,
|
|
255
|
+
options
|
|
256
|
+
);
|
|
257
|
+
const { workspaceGid = state.configuration.workspaceGid } = resolvedOptions;
|
|
258
|
+
if (!workspaceGid)
|
|
259
|
+
throw new Error("You need to specify Workspace GID");
|
|
260
|
+
const response = await request(
|
|
261
|
+
state,
|
|
262
|
+
`workspaces/${workspaceGid}/tasks/search`,
|
|
263
|
+
{
|
|
264
|
+
query: {
|
|
265
|
+
text: resolvedTask,
|
|
266
|
+
...resolvedQuery
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
);
|
|
270
|
+
return prepareNextState(state, response);
|
|
271
|
+
};
|
|
272
|
+
}
|
|
249
273
|
function createTaskStory(taskGid, params, callback) {
|
|
250
274
|
return async (state) => {
|
|
251
275
|
const [
|
|
@@ -311,10 +335,10 @@ var src_default = Adaptor_exports;
|
|
|
311
335
|
fnIf,
|
|
312
336
|
getTask,
|
|
313
337
|
getTasks,
|
|
314
|
-
http,
|
|
315
338
|
lastReferenceValue,
|
|
316
339
|
merge,
|
|
317
340
|
request,
|
|
341
|
+
searchTask,
|
|
318
342
|
sourceValue,
|
|
319
343
|
updateTask,
|
|
320
344
|
upsertTask
|
package/dist/index.js
CHANGED
|
@@ -23,10 +23,10 @@ __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,
|
|
29
|
+
searchTask: () => searchTask,
|
|
30
30
|
sourceValue: () => sourceValue,
|
|
31
31
|
updateTask: () => updateTask,
|
|
32
32
|
upsertTask: () => upsertTask
|
|
@@ -123,7 +123,6 @@ import {
|
|
|
123
123
|
fields,
|
|
124
124
|
fn,
|
|
125
125
|
fnIf,
|
|
126
|
-
http,
|
|
127
126
|
lastReferenceValue,
|
|
128
127
|
merge,
|
|
129
128
|
sourceValue,
|
|
@@ -227,6 +226,30 @@ function upsertTask(projectGid, params, callback) {
|
|
|
227
226
|
});
|
|
228
227
|
};
|
|
229
228
|
}
|
|
229
|
+
function searchTask(task, query = {}, options = {}) {
|
|
230
|
+
return async (state) => {
|
|
231
|
+
const [resolvedTask, resolvedQuery, resolvedOptions] = expandReferences(
|
|
232
|
+
state,
|
|
233
|
+
task,
|
|
234
|
+
query,
|
|
235
|
+
options
|
|
236
|
+
);
|
|
237
|
+
const { workspaceGid = state.configuration.workspaceGid } = resolvedOptions;
|
|
238
|
+
if (!workspaceGid)
|
|
239
|
+
throw new Error("You need to specify Workspace GID");
|
|
240
|
+
const response = await request(
|
|
241
|
+
state,
|
|
242
|
+
`workspaces/${workspaceGid}/tasks/search`,
|
|
243
|
+
{
|
|
244
|
+
query: {
|
|
245
|
+
text: resolvedTask,
|
|
246
|
+
...resolvedQuery
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
return prepareNextState(state, response);
|
|
251
|
+
};
|
|
252
|
+
}
|
|
230
253
|
function createTaskStory(taskGid, params, callback) {
|
|
231
254
|
return async (state) => {
|
|
232
255
|
const [
|
|
@@ -292,10 +315,10 @@ export {
|
|
|
292
315
|
fnIf,
|
|
293
316
|
getTask,
|
|
294
317
|
getTasks,
|
|
295
|
-
http,
|
|
296
318
|
lastReferenceValue,
|
|
297
319
|
merge,
|
|
298
320
|
request2 as request,
|
|
321
|
+
searchTask,
|
|
299
322
|
sourceValue,
|
|
300
323
|
updateTask,
|
|
301
324
|
upsertTask
|
package/package.json
CHANGED
package/types/Adaptor.d.ts
CHANGED
|
@@ -109,6 +109,24 @@ export function upsertTask(projectGid: string, params: {
|
|
|
109
109
|
externalId: string;
|
|
110
110
|
data: object;
|
|
111
111
|
}, callback: Function): Operation;
|
|
112
|
+
/**
|
|
113
|
+
* Search for tasks in a workspace by task name.
|
|
114
|
+
* @public
|
|
115
|
+
* @example <caption>Search for a task by name</caption>
|
|
116
|
+
* searchTask("Test Search Task", {
|
|
117
|
+
* resource_subtype: "default_task",
|
|
118
|
+
* sort_by: "modified_at"
|
|
119
|
+
* });
|
|
120
|
+
* @function
|
|
121
|
+
* @param {string} task - The text or name of the task to search for.
|
|
122
|
+
* @param {object} [query] - Query params. See {@link https://developers.asana.com/reference/searchtasksforworkspace Docs} for a list of valid parameters.
|
|
123
|
+
* @param {object} [options] - (Optional) options argument.
|
|
124
|
+
* @param {string} [options.workspaceGid] - The workspace to search in. Defaults to the workspace specified in the configuration.
|
|
125
|
+
* @returns {Operation} An operation that, when executed, returns the search results in state.data.
|
|
126
|
+
*/
|
|
127
|
+
export function searchTask(task: string, query?: object, options?: {
|
|
128
|
+
workspaceGid?: string;
|
|
129
|
+
}): Operation;
|
|
112
130
|
/**
|
|
113
131
|
* Options provided to the createTaskStory request
|
|
114
132
|
* @typedef {Object} StoryOptions
|
|
@@ -175,4 +193,4 @@ export type StoryOptions = any;
|
|
|
175
193
|
* Options provided to the Asana API request
|
|
176
194
|
*/
|
|
177
195
|
export type RequestOptions = any;
|
|
178
|
-
export { alterState, cursor, dataPath, dataValue, dateFns, each, field, fields, fn, fnIf,
|
|
196
|
+
export { alterState, cursor, dataPath, dataValue, dateFns, each, field, fields, fn, fnIf, lastReferenceValue, merge, sourceValue, as } from "@openfn/language-common";
|