@activepieces/piece-google-tasks 0.2.2 → 0.3.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/package.json +12 -9
- package/src/index.d.ts +2 -1
- package/src/index.js +13 -3
- package/src/index.js.map +1 -1
- package/src/lib/actions/new-task.d.ts +6 -1
- package/src/lib/actions/new-task.js +4 -3
- package/src/lib/actions/new-task.js.map +1 -1
- package/src/lib/common/index.d.ts +5 -5
- package/src/lib/common/index.js +24 -16
- package/src/lib/common/index.js.map +1 -1
- package/src/lib/triggers/new-task.d.ts +4 -0
- package/src/lib/triggers/new-task.js +67 -0
- package/src/lib/triggers/new-task.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-google-tasks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@sinclair/typebox": "0.26.
|
|
6
|
-
"axios": "1.
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
5
|
+
"@sinclair/typebox": "^0.26.3",
|
|
6
|
+
"axios": "1.4.0",
|
|
7
|
+
"dayjs": "^1.11.8",
|
|
8
|
+
"is-base64": "^1.1.0",
|
|
9
|
+
"nanoid": "^3.3.4",
|
|
10
|
+
"object-sizeof": "^2.6.3",
|
|
11
|
+
"semver": "7.5.4",
|
|
12
|
+
"@activepieces/pieces-common": "0.2.2",
|
|
13
|
+
"@activepieces/pieces-framework": "0.6.12",
|
|
14
|
+
"@activepieces/shared": "0.7.2",
|
|
15
|
+
"tslib": "2.6.1"
|
|
13
16
|
},
|
|
14
17
|
"main": "./src/index.js",
|
|
15
18
|
"types": "./src/index.d.ts"
|
package/src/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const googleTasksAuth: import("@activepieces/pieces-framework").OAuth2Property<true, import("@activepieces/pieces-framework").OAuth2Props>;
|
|
2
|
+
export declare const googleTasks: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").OAuth2Property<true, import("@activepieces/pieces-framework").OAuth2Props>>;
|
package/src/index.js
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.googleTasks = void 0;
|
|
3
|
+
exports.googleTasks = exports.googleTasksAuth = void 0;
|
|
4
4
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
5
|
const new_task_1 = require("./lib/actions/new-task");
|
|
6
|
+
const new_task_2 = require("./lib/triggers/new-task");
|
|
7
|
+
exports.googleTasksAuth = pieces_framework_1.PieceAuth.OAuth2({
|
|
8
|
+
description: "",
|
|
9
|
+
authUrl: "https://accounts.google.com/o/oauth2/auth",
|
|
10
|
+
tokenUrl: "https://oauth2.googleapis.com/token",
|
|
11
|
+
required: true,
|
|
12
|
+
scope: ["https://www.googleapis.com/auth/tasks", "https://www.googleapis.com/auth/tasks.readonly"]
|
|
13
|
+
});
|
|
6
14
|
exports.googleTasks = (0, pieces_framework_1.createPiece)({
|
|
15
|
+
minimumSupportedRelease: '0.5.0',
|
|
7
16
|
logoUrl: 'https://cdn.activepieces.com/pieces/google-tasks.png',
|
|
8
17
|
actions: [new_task_1.googleTasksAddNewTaskAction],
|
|
9
18
|
displayName: "Google Tasks",
|
|
10
|
-
authors: ['abaza738'],
|
|
11
|
-
triggers: [],
|
|
19
|
+
authors: ['abaza738', 'Salem-Alaa'],
|
|
20
|
+
triggers: [new_task_2.newTaskTrigger],
|
|
21
|
+
auth: exports.googleTasksAuth,
|
|
12
22
|
});
|
|
13
23
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/google-tasks/src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/google-tasks/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,qDAAqE;AACrE,sDAAyD;AAE5C,QAAA,eAAe,GAAG,4BAAS,CAAC,MAAM,CAAC;IAC5C,WAAW,EAAE,EAAE;IAEf,OAAO,EAAE,2CAA2C;IACpD,QAAQ,EAAE,qCAAqC;IAC/C,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,CAAC,uCAAuC,EAAC,gDAAgD,CAAC;CACpG,CAAC,CAAA;AAEW,QAAA,WAAW,GAAG,IAAA,8BAAW,EAAC;IACtC,uBAAuB,EAAE,OAAO;IAC7B,OAAO,EAAE,sDAAsD;IAClE,OAAO,EAAE,CAAC,sCAA2B,CAAC;IACtC,WAAW,EAAE,cAAc;IAC3B,OAAO,EAAE,CAAC,UAAU,EAAC,YAAY,CAAC;IAClC,QAAQ,EAAE,CAAE,yBAAc,CAAC;IACxB,IAAI,EAAE,uBAAe;CACxB,CAAC,CAAC"}
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
export declare const googleTasksAddNewTaskAction: import("@activepieces/pieces-framework").
|
|
1
|
+
export declare const googleTasksAddNewTaskAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<true, import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
+
tasks_list: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
title: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
notes: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
5
|
+
completed: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
6
|
+
}>;
|
|
@@ -4,18 +4,19 @@ exports.googleTasksAddNewTaskAction = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const common_1 = require("../common");
|
|
7
|
+
const __1 = require("../../");
|
|
7
8
|
exports.googleTasksAddNewTaskAction = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: __1.googleTasksAuth,
|
|
8
10
|
name: 'add_task',
|
|
9
11
|
description: 'Add a new task to a specified task list',
|
|
10
12
|
displayName: 'Add Task',
|
|
11
13
|
props: {
|
|
12
|
-
authentication: common_1.googleTasksCommon.authentication,
|
|
13
14
|
tasks_list: common_1.googleTasksCommon.tasksList,
|
|
14
15
|
title: common_1.googleTasksCommon.title,
|
|
15
16
|
notes: common_1.googleTasksCommon.notes,
|
|
16
17
|
completed: common_1.googleTasksCommon.completed,
|
|
17
18
|
},
|
|
18
|
-
run({ propsValue }) {
|
|
19
|
+
run({ auth, propsValue }) {
|
|
19
20
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
21
|
const task = {
|
|
21
22
|
kind: 'tasks#task',
|
|
@@ -24,7 +25,7 @@ exports.googleTasksAddNewTaskAction = (0, pieces_framework_1.createAction)({
|
|
|
24
25
|
completed: propsValue.completed ? new Date().toISOString() : '',
|
|
25
26
|
notes: propsValue.notes,
|
|
26
27
|
};
|
|
27
|
-
return (0, common_1.createTask)(
|
|
28
|
+
return (0, common_1.createTask)(auth, propsValue.tasks_list, task);
|
|
28
29
|
});
|
|
29
30
|
},
|
|
30
31
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-task.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/google-tasks/src/lib/actions/new-task.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,sCAA4E;
|
|
1
|
+
{"version":3,"file":"new-task.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/google-tasks/src/lib/actions/new-task.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,sCAA4E;AAC5E,8BAAyC;AAE5B,QAAA,2BAA2B,GAAG,IAAA,+BAAY,EAAC;IACpD,IAAI,EAAE,mBAAe;IACjB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,yCAAyC;IACtD,WAAW,EAAE,UAAU;IACvB,KAAK,EAAE;QACH,UAAU,EAAE,0BAAiB,CAAC,SAAS;QACvC,KAAK,EAAE,0BAAiB,CAAC,KAAK;QAC9B,KAAK,EAAE,0BAAiB,CAAC,KAAK;QAC9B,SAAS,EAAE,0BAAiB,CAAC,SAAS;KACzC;IACK,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE;;YAC1B,MAAM,IAAI,GAAS;gBACf,IAAI,EAAE,YAAY;gBAClB,MAAM,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,mBAAU,CAAC,SAAS,CAAC,CAAC,CAAC,mBAAU,CAAC,YAAY;gBAC7E,KAAK,EAAE,UAAU,CAAC,KAAK;gBACvB,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE;gBAC/D,KAAK,EAAE,UAAU,CAAC,KAAK;aAC1B,CAAC;YAEF,OAAO,IAAA,mBAAU,EAAC,IAAI,EAAE,UAAU,CAAC,UAAW,EAAE,IAAI,CAAC,CAAC;QAC1D,CAAC;KAAA;CAER,CAAC,CAAC"}
|
|
@@ -6,7 +6,7 @@ export declare enum TaskStatus {
|
|
|
6
6
|
/**
|
|
7
7
|
* @see https://developers.google.com/tasks/reference/rest/v1/tasklists/list#response-body
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type TasksListResponse = {
|
|
10
10
|
"kind": string;
|
|
11
11
|
"etag": string;
|
|
12
12
|
"nextPageToken": string;
|
|
@@ -15,7 +15,7 @@ export declare type TasksListResponse = {
|
|
|
15
15
|
/**
|
|
16
16
|
* @see https://developers.google.com/tasks/reference/rest/v1/tasklists#resource:-tasklist
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export type TasksList = {
|
|
19
19
|
kind: string;
|
|
20
20
|
id: string;
|
|
21
21
|
etag: string;
|
|
@@ -26,7 +26,7 @@ export declare type TasksList = {
|
|
|
26
26
|
/**
|
|
27
27
|
* @see https://developers.google.com/tasks/reference/rest/v1/tasks#resource:-task
|
|
28
28
|
*/
|
|
29
|
-
export
|
|
29
|
+
export type Task = {
|
|
30
30
|
kind: "tasks#task";
|
|
31
31
|
title: string;
|
|
32
32
|
status: TaskStatus;
|
|
@@ -43,7 +43,6 @@ export declare type Task = {
|
|
|
43
43
|
};
|
|
44
44
|
export declare const googleTasksCommon: {
|
|
45
45
|
baseUrl: string;
|
|
46
|
-
authentication: import("@activepieces/pieces-framework").OAuth2Property<true, import("@activepieces/pieces-framework").OAuth2Props>;
|
|
47
46
|
/**
|
|
48
47
|
* @property Target task list ID where the new task will be created
|
|
49
48
|
*/
|
|
@@ -52,5 +51,6 @@ export declare const googleTasksCommon: {
|
|
|
52
51
|
notes: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
53
52
|
completed: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
54
53
|
};
|
|
55
|
-
export declare function
|
|
54
|
+
export declare function getLists(authProp: OAuth2PropertyValue): Promise<TasksList[]>;
|
|
55
|
+
export declare function getTasks(authProp: OAuth2PropertyValue, tasklist: string): Promise<TasksList[]>;
|
|
56
56
|
export declare function createTask(authProp: OAuth2PropertyValue, taskListId: string, task: Task): Promise<import("@activepieces/pieces-common").HttpResponse<import("@activepieces/pieces-common").HttpMessageBody>>;
|
package/src/lib/common/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createTask = exports.getTasks = exports.googleTasksCommon = exports.TaskStatus = void 0;
|
|
3
|
+
exports.createTask = exports.getTasks = exports.getLists = exports.googleTasksCommon = exports.TaskStatus = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
@@ -8,34 +8,26 @@ var TaskStatus;
|
|
|
8
8
|
(function (TaskStatus) {
|
|
9
9
|
TaskStatus["NEEDS_ACTION"] = "needsAction";
|
|
10
10
|
TaskStatus["COMPLETED"] = "completed";
|
|
11
|
-
})(TaskStatus
|
|
11
|
+
})(TaskStatus || (exports.TaskStatus = TaskStatus = {}));
|
|
12
12
|
exports.googleTasksCommon = {
|
|
13
13
|
baseUrl: `https://tasks.googleapis.com`,
|
|
14
|
-
authentication: pieces_framework_1.Property.OAuth2({
|
|
15
|
-
description: "",
|
|
16
|
-
displayName: 'Authentication',
|
|
17
|
-
authUrl: "https://accounts.google.com/o/oauth2/auth",
|
|
18
|
-
tokenUrl: "https://oauth2.googleapis.com/token",
|
|
19
|
-
required: true,
|
|
20
|
-
scope: ["https://www.googleapis.com/auth/tasks"]
|
|
21
|
-
}),
|
|
22
14
|
/**
|
|
23
15
|
* @property Target task list ID where the new task will be created
|
|
24
16
|
*/
|
|
25
17
|
tasksList: pieces_framework_1.Property.Dropdown({
|
|
26
18
|
displayName: 'Tasks List',
|
|
27
|
-
refreshers: [
|
|
19
|
+
refreshers: [],
|
|
28
20
|
required: true,
|
|
29
|
-
options: (
|
|
30
|
-
if (!
|
|
21
|
+
options: ({ auth }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
+
if (!auth) {
|
|
31
23
|
return {
|
|
32
24
|
disabled: true,
|
|
33
25
|
placeholder: "Please connect your account first",
|
|
34
26
|
options: [],
|
|
35
27
|
};
|
|
36
28
|
}
|
|
37
|
-
const authProp =
|
|
38
|
-
const tasksLists = yield
|
|
29
|
+
const authProp = auth;
|
|
30
|
+
const tasksLists = yield getLists(authProp);
|
|
39
31
|
return {
|
|
40
32
|
disabled: false,
|
|
41
33
|
options: tasksLists.map(list => {
|
|
@@ -61,7 +53,7 @@ exports.googleTasksCommon = {
|
|
|
61
53
|
required: false,
|
|
62
54
|
}),
|
|
63
55
|
};
|
|
64
|
-
function
|
|
56
|
+
function getLists(authProp) {
|
|
65
57
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
66
58
|
// docs: https://developers.google.com/tasks/reference/rest/v1/tasklists/list
|
|
67
59
|
const request = {
|
|
@@ -76,6 +68,22 @@ function getTasks(authProp) {
|
|
|
76
68
|
return response.body.items;
|
|
77
69
|
});
|
|
78
70
|
}
|
|
71
|
+
exports.getLists = getLists;
|
|
72
|
+
function getTasks(authProp, tasklist) {
|
|
73
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
// docs: https://developers.google.com/tasks/reference/rest/v1/tasklists/list
|
|
75
|
+
const request = {
|
|
76
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
77
|
+
url: `${exports.googleTasksCommon.baseUrl}/tasks/v1/lists/${tasklist}/tasks`,
|
|
78
|
+
authentication: {
|
|
79
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
80
|
+
token: authProp.access_token,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
84
|
+
return response.body.items;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
79
87
|
exports.getTasks = getTasks;
|
|
80
88
|
function createTask(authProp, taskListId, task) {
|
|
81
89
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/google-tasks/src/lib/common/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA+E;AAC/E,+DAAsG;AAEtG,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,0CAA4B,CAAA;IAC5B,qCAAuB,CAAA;AAC3B,CAAC,EAHW,UAAU,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../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AAK,EAAE,QAAQ,CAAC,YAAY;aAC/B;YACD,IAAI,EAAE,IAAI;SACb,CAAC;QAEF,OAAO,0BAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;CAAA;AAZD,gCAYC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { OAuth2Props, TriggerStrategy } from "@activepieces/pieces-framework";
|
|
2
|
+
export declare const newTaskTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").OAuth2Property<true, OAuth2Props>, {
|
|
3
|
+
tasks_list: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newTaskTrigger = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const __1 = require("../..");
|
|
7
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
const props = {
|
|
10
|
+
tasks_list: common_1.googleTasksCommon.tasksList,
|
|
11
|
+
};
|
|
12
|
+
const polling = {
|
|
13
|
+
strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
|
|
14
|
+
items: ({ auth, propsValue, lastFetchEpochMS }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
const records = yield (0, common_1.getTasks)(auth, propsValue.tasks_list);
|
|
16
|
+
const filtered_records = records.filter((record) => {
|
|
17
|
+
const updated = Date.parse(record.updated);
|
|
18
|
+
return updated > lastFetchEpochMS;
|
|
19
|
+
});
|
|
20
|
+
return filtered_records.map((record) => ({
|
|
21
|
+
epochMilliSeconds: Date.parse(record.updated),
|
|
22
|
+
data: record,
|
|
23
|
+
}));
|
|
24
|
+
})
|
|
25
|
+
};
|
|
26
|
+
exports.newTaskTrigger = (0, pieces_framework_1.createTrigger)({
|
|
27
|
+
auth: __1.googleTasksAuth,
|
|
28
|
+
name: "new_task",
|
|
29
|
+
displayName: "New Task",
|
|
30
|
+
description: 'Triggers when a task is created',
|
|
31
|
+
type: pieces_framework_1.TriggerStrategy.POLLING,
|
|
32
|
+
props,
|
|
33
|
+
sampleData: {},
|
|
34
|
+
test(context) {
|
|
35
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const store = context.store;
|
|
37
|
+
const auth = context.auth;
|
|
38
|
+
const propsValue = context.propsValue;
|
|
39
|
+
return yield pieces_common_1.pollingHelper.test(polling, { store, auth, propsValue });
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
onEnable(context) {
|
|
43
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const store = context.store;
|
|
45
|
+
const auth = context.auth;
|
|
46
|
+
const propsValue = context.propsValue;
|
|
47
|
+
yield pieces_common_1.pollingHelper.onEnable(polling, { store, auth, propsValue });
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
onDisable(context) {
|
|
51
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const store = context.store;
|
|
53
|
+
const auth = context.auth;
|
|
54
|
+
const propsValue = context.propsValue;
|
|
55
|
+
yield pieces_common_1.pollingHelper.onEnable(polling, { store, auth, propsValue });
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
run(context) {
|
|
59
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const store = context.store;
|
|
61
|
+
const auth = context.auth;
|
|
62
|
+
const propsValue = context.propsValue;
|
|
63
|
+
return yield pieces_common_1.pollingHelper.poll(polling, { store, auth, propsValue });
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=new-task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-task.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/google-tasks/src/lib/triggers/new-task.ts"],"names":[],"mappings":";;;;AAAA,qEAAoI;AACpI,6BAAwC;AACxC,+DAAqF;AACrF,sCAAwD;AAExD,MAAM,KAAK,GAAG;IACV,UAAU,EAAE,0BAAiB,CAAC,SAAS;CAC1C,CAAC;AAEF,MAAM,OAAO,GAAgF;IACzF,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,CAAO,EAAE,IAAI,EAAE,UAAU,EAAG,gBAAgB,EAAE,EAAE,EAAE;QACrD,MAAM,OAAO,GAAI,MAAM,IAAA,iBAAQ,EAAE,IAAI,EAAG,UAAU,CAAC,UAAW,CAAC,CAAC;QAEhE,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE;YAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC3C,OAAO,OAAO,GAAG,gBAAgB,CAAC;QACtC,CAAC,CAAC,CAAC;QAEH,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACrC,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAE,MAAM,CAAC,OAAO,CAAE;YAC/C,IAAI,EAAE,MAAM;SACf,CAAC,CAAC,CAAC;IACR,CAAC,CAAA;CACJ,CAAA;AAEY,QAAA,cAAc,GAAG,IAAA,gCAAa,EAAC;IACxC,IAAI,EAAE,mBAAe;IACrB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,iCAAiC;IAC9C,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,KAAK;IACL,UAAU,EAAE,EAAE;IACR,IAAI,CAAC,OAAO;;YACd,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;YAC5B,MAAM,IA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