@activepieces/piece-freshservice 0.0.1 → 0.1.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.
Files changed (53) hide show
  1. package/package.json +5 -5
  2. package/src/i18n/translation.json +104 -0
  3. package/src/index.d.ts.map +1 -1
  4. package/src/index.js +19 -1
  5. package/src/index.js.map +1 -1
  6. package/src/lib/actions/add-note-to-change.d.ts +15 -0
  7. package/src/lib/actions/add-note-to-change.d.ts.map +1 -0
  8. package/src/lib/actions/add-note-to-change.js +45 -0
  9. package/src/lib/actions/add-note-to-change.js.map +1 -0
  10. package/src/lib/actions/create-change-task.d.ts +32 -0
  11. package/src/lib/actions/create-change-task.d.ts.map +1 -0
  12. package/src/lib/actions/create-change-task.js +70 -0
  13. package/src/lib/actions/create-change-task.js.map +1 -0
  14. package/src/lib/actions/create-change.d.ts +47 -0
  15. package/src/lib/actions/create-change.d.ts.map +1 -0
  16. package/src/lib/actions/create-change.js +113 -0
  17. package/src/lib/actions/create-change.js.map +1 -0
  18. package/src/lib/actions/delete-change-task.d.ts +14 -0
  19. package/src/lib/actions/delete-change-task.d.ts.map +1 -0
  20. package/src/lib/actions/delete-change-task.js +34 -0
  21. package/src/lib/actions/delete-change-task.js.map +1 -0
  22. package/src/lib/actions/delete-change.d.ts +13 -0
  23. package/src/lib/actions/delete-change.d.ts.map +1 -0
  24. package/src/lib/actions/delete-change.js +29 -0
  25. package/src/lib/actions/delete-change.js.map +1 -0
  26. package/src/lib/actions/update-change-task.d.ts +33 -0
  27. package/src/lib/actions/update-change-task.d.ts.map +1 -0
  28. package/src/lib/actions/update-change-task.js +78 -0
  29. package/src/lib/actions/update-change-task.js.map +1 -0
  30. package/src/lib/actions/update-change.d.ts +54 -0
  31. package/src/lib/actions/update-change.d.ts.map +1 -0
  32. package/src/lib/actions/update-change.js +118 -0
  33. package/src/lib/actions/update-change.js.map +1 -0
  34. package/src/lib/common/props.d.ts +41 -0
  35. package/src/lib/common/props.d.ts.map +1 -1
  36. package/src/lib/common/props.js +77 -0
  37. package/src/lib/common/props.js.map +1 -1
  38. package/src/lib/triggers/new-change-task.d.ts +47 -0
  39. package/src/lib/triggers/new-change-task.d.ts.map +1 -0
  40. package/src/lib/triggers/new-change-task.js +83 -0
  41. package/src/lib/triggers/new-change-task.js.map +1 -0
  42. package/src/lib/triggers/new-change.d.ts +15 -0
  43. package/src/lib/triggers/new-change.d.ts.map +1 -0
  44. package/src/lib/triggers/new-change.js +84 -0
  45. package/src/lib/triggers/new-change.js.map +1 -0
  46. package/src/lib/triggers/updated-change-task.d.ts +47 -0
  47. package/src/lib/triggers/updated-change-task.d.ts.map +1 -0
  48. package/src/lib/triggers/updated-change-task.js +83 -0
  49. package/src/lib/triggers/updated-change-task.js.map +1 -0
  50. package/src/lib/triggers/updated-change.d.ts +15 -0
  51. package/src/lib/triggers/updated-change.d.ts.map +1 -0
  52. package/src/lib/triggers/updated-change.js +84 -0
  53. package/src/lib/triggers/updated-change.js.map +1 -0
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newChangeTask = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const __1 = require("../../");
8
+ const client_1 = require("../common/client");
9
+ const props_1 = require("../common/props");
10
+ const polling = {
11
+ strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
12
+ items(_a) {
13
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, lastFetchEpochMS, propsValue }) {
14
+ if (!propsValue.change_id)
15
+ return [];
16
+ const response = yield (0, client_1.freshserviceApiCall)({
17
+ method: pieces_common_1.HttpMethod.GET,
18
+ endpoint: `changes/${propsValue.change_id}/tasks`,
19
+ auth,
20
+ queryParams: {
21
+ order_by: 'created_at',
22
+ order_type: 'desc',
23
+ per_page: lastFetchEpochMS === 0 ? '10' : '100',
24
+ },
25
+ });
26
+ return response.body.tasks.map((task) => ({
27
+ epochMilliSeconds: new Date(task.created_at).getTime(),
28
+ data: task,
29
+ }));
30
+ });
31
+ },
32
+ };
33
+ exports.newChangeTask = (0, pieces_framework_1.createTrigger)({
34
+ auth: __1.freshserviceAuth,
35
+ name: 'new_change_task',
36
+ displayName: 'New Change Task',
37
+ description: 'Triggers when a new task is created on a specific change request.',
38
+ props: {
39
+ change_id: props_1.freshserviceCommon.change(true),
40
+ },
41
+ sampleData: {
42
+ id: 1,
43
+ title: 'Review change impact',
44
+ description: 'Assess the blast radius before proceeding.',
45
+ status: 1,
46
+ agent_id: 5,
47
+ group_id: 1,
48
+ due_date: '2025-01-20T17:00:00Z',
49
+ notify_before: 0,
50
+ created_at: '2025-01-15T09:30:00Z',
51
+ updated_at: '2025-01-15T09:30:00Z',
52
+ },
53
+ type: pieces_framework_1.TriggerStrategy.POLLING,
54
+ test(context) {
55
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
56
+ return yield pieces_common_1.pollingHelper.test(polling, context);
57
+ });
58
+ },
59
+ onEnable(context) {
60
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
61
+ yield pieces_common_1.pollingHelper.onEnable(polling, {
62
+ auth: context.auth,
63
+ store: context.store,
64
+ propsValue: context.propsValue,
65
+ });
66
+ });
67
+ },
68
+ onDisable(context) {
69
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
70
+ yield pieces_common_1.pollingHelper.onDisable(polling, {
71
+ auth: context.auth,
72
+ store: context.store,
73
+ propsValue: context.propsValue,
74
+ });
75
+ });
76
+ },
77
+ run(context) {
78
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
79
+ return yield pieces_common_1.pollingHelper.poll(polling, context);
80
+ });
81
+ },
82
+ });
83
+ //# sourceMappingURL=new-change-task.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-change-task.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-change-task.ts"],"names":[],"mappings":";;;;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QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,sBAAsB;QAChC,aAAa,EAAE,CAAC;QAChB,UAAU,EAAE,sBAAsB;QAClC,UAAU,EAAE,sBAAsB;KACnC;IACD,IAAI,EAAE,kCAAe,CAAC,OAAO;IAEvB,IAAI,CAAC,OAAO;;YAChB,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;IAEK,QAAQ,CAAC,OAAO;;YACpB,MAAM,6BAAa,CAAC,QAAQ,CAAC,OAAO,EAAE;gBACpC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;IAEK,SAAS,CAAC,OAAO;;YACrB,MAAM,6BAAa,CAAC,SAAS,CAAC,OAAO,EAAE;gBACrC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;IAEK,GAAG,CAAC,OAAO;;YACf,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { TriggerStrategy } from '@activepieces/pieces-framework';
2
+ export declare const newChange: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
3
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
+ }>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
6
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
8
+ }>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
9
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
10
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
11
+ }>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
12
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
13
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
14
+ }>, {}>;
15
+ //# sourceMappingURL=new-change.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-change.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-change.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAqCxC,eAAO,MAAM,SAAS;;;;;;;;;;;;OAiDpB,CAAC"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newChange = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const __1 = require("../../");
8
+ const client_1 = require("../common/client");
9
+ const polling = {
10
+ strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
11
+ items(_a) {
12
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, lastFetchEpochMS }) {
13
+ const response = yield (0, client_1.freshserviceApiCall)({
14
+ method: pieces_common_1.HttpMethod.GET,
15
+ endpoint: 'changes',
16
+ auth,
17
+ queryParams: {
18
+ order_by: 'created_at',
19
+ order_type: 'desc',
20
+ per_page: lastFetchEpochMS === 0 ? '10' : '100',
21
+ },
22
+ });
23
+ return response.body.changes.map((change) => ({
24
+ epochMilliSeconds: new Date(change.created_at).getTime(),
25
+ data: change,
26
+ }));
27
+ });
28
+ },
29
+ };
30
+ exports.newChange = (0, pieces_framework_1.createTrigger)({
31
+ auth: __1.freshserviceAuth,
32
+ name: 'new_change',
33
+ displayName: 'New Change',
34
+ description: 'Triggers when a new change request is created in Freshservice.',
35
+ props: {},
36
+ sampleData: {
37
+ id: 1,
38
+ subject: 'Upgrade server RAM',
39
+ description: '<div>Upgrade RAM on production server from 16GB to 32GB.</div>',
40
+ status: 1,
41
+ priority: 2,
42
+ impact: 2,
43
+ risk: 2,
44
+ change_type: 2,
45
+ requester_id: 1,
46
+ agent_id: 5,
47
+ department_id: 2,
48
+ group_id: 1,
49
+ planned_start_date: '2025-01-20T08:00:00Z',
50
+ planned_end_date: '2025-01-20T12:00:00Z',
51
+ created_at: '2025-01-15T09:30:00Z',
52
+ updated_at: '2025-01-15T09:30:00Z',
53
+ },
54
+ type: pieces_framework_1.TriggerStrategy.POLLING,
55
+ test(context) {
56
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
57
+ return yield pieces_common_1.pollingHelper.test(polling, context);
58
+ });
59
+ },
60
+ onEnable(context) {
61
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
+ yield pieces_common_1.pollingHelper.onEnable(polling, {
63
+ auth: context.auth,
64
+ store: context.store,
65
+ propsValue: context.propsValue,
66
+ });
67
+ });
68
+ },
69
+ onDisable(context) {
70
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
71
+ yield pieces_common_1.pollingHelper.onDisable(polling, {
72
+ auth: context.auth,
73
+ store: context.store,
74
+ propsValue: context.propsValue,
75
+ });
76
+ });
77
+ },
78
+ run(context) {
79
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
80
+ return yield pieces_common_1.pollingHelper.poll(polling, context);
81
+ });
82
+ },
83
+ });
84
+ //# sourceMappingURL=new-change.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-change.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-change.ts"],"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C;QACX,kBAAkB,EAAE,sBAAsB;QAC1C,gBAAgB,EAAE,sBAAsB;QACxC,UAAU,EAAE,sBAAsB;QAClC,UAAU,EAAE,sBAAsB;KACnC;IACD,IAAI,EAAE,kCAAe,CAAC,OAAO;IAEvB,IAAI,CAAC,OAAO;;YAChB,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;IAEK,QAAQ,CAAC,OAAO;;YACpB,MAAM,6BAAa,CAAC,QAAQ,CAAC,OAAO,EAAE;gBACpC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;IAEK,SAAS,CAAC,OAAO;;YACrB,MAAM,6BAAa,CAAC,SAAS,CAAC,OAAO,EAAE;gBACrC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;IAEK,GAAG,CAAC,OAAO;;YACf,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { TriggerStrategy } from '@activepieces/pieces-framework';
2
+ export declare const updatedChangeTask: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
3
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
+ }>, {
6
+ change_id: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
7
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
8
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
9
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
10
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
11
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
12
+ }>>;
13
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
14
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
15
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
16
+ }>, {
17
+ change_id: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
18
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
19
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
20
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
21
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
22
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
23
+ }>>;
24
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
25
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
26
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
27
+ }>, {
28
+ change_id: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
29
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
30
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
31
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
32
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
33
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
34
+ }>>;
35
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
36
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
37
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
38
+ }>, {
39
+ change_id: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
40
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
41
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
42
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
43
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
44
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
45
+ }>>;
46
+ }>;
47
+ //# sourceMappingURL=updated-change-task.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updated-change-task.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/updated-change-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAwCxC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6C5B,CAAC"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updatedChangeTask = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const __1 = require("../../");
8
+ const client_1 = require("../common/client");
9
+ const props_1 = require("../common/props");
10
+ const polling = {
11
+ strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
12
+ items(_a) {
13
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, lastFetchEpochMS, propsValue }) {
14
+ if (!propsValue.change_id)
15
+ return [];
16
+ const response = yield (0, client_1.freshserviceApiCall)({
17
+ method: pieces_common_1.HttpMethod.GET,
18
+ endpoint: `changes/${propsValue.change_id}/tasks`,
19
+ auth,
20
+ queryParams: {
21
+ order_by: 'updated_at',
22
+ order_type: 'desc',
23
+ per_page: lastFetchEpochMS === 0 ? '10' : '100',
24
+ },
25
+ });
26
+ return response.body.tasks.map((task) => ({
27
+ epochMilliSeconds: new Date(task.updated_at).getTime(),
28
+ data: task,
29
+ }));
30
+ });
31
+ },
32
+ };
33
+ exports.updatedChangeTask = (0, pieces_framework_1.createTrigger)({
34
+ auth: __1.freshserviceAuth,
35
+ name: 'updated_change_task',
36
+ displayName: 'Updated Change Task',
37
+ description: 'Triggers when a task on a specific change request is updated. Note: newly created tasks may also fire this trigger because their updated_at matches created_at.',
38
+ props: {
39
+ change_id: props_1.freshserviceCommon.change(true),
40
+ },
41
+ sampleData: {
42
+ id: 1,
43
+ title: 'Review change impact',
44
+ description: 'Assess the blast radius before proceeding.',
45
+ status: 2,
46
+ agent_id: 5,
47
+ group_id: 1,
48
+ due_date: '2025-01-20T17:00:00Z',
49
+ notify_before: 0,
50
+ created_at: '2025-01-15T09:30:00Z',
51
+ updated_at: '2025-01-15T11:45:00Z',
52
+ },
53
+ type: pieces_framework_1.TriggerStrategy.POLLING,
54
+ test(context) {
55
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
56
+ return yield pieces_common_1.pollingHelper.test(polling, context);
57
+ });
58
+ },
59
+ onEnable(context) {
60
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
61
+ yield pieces_common_1.pollingHelper.onEnable(polling, {
62
+ auth: context.auth,
63
+ store: context.store,
64
+ propsValue: context.propsValue,
65
+ });
66
+ });
67
+ },
68
+ onDisable(context) {
69
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
70
+ yield pieces_common_1.pollingHelper.onDisable(polling, {
71
+ auth: context.auth,
72
+ store: context.store,
73
+ propsValue: context.propsValue,
74
+ });
75
+ });
76
+ },
77
+ run(context) {
78
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
79
+ return yield pieces_common_1.pollingHelper.poll(polling, context);
80
+ });
81
+ },
82
+ });
83
+ //# sourceMappingURL=updated-change-task.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updated-change-task.js","sourceRoot":"","sources":["../../../../src/lib/triggers/updated-change-task.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,+DAKqC;AACrC,8BAA0C;AAC1C,6CAAuD;AACvD,2CAA6E;AAI7E,MAAM,OAAO,GAGT;IACF,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAC5B,KAAK;qEAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE;YAChD,IAAI,CAAC,UAAU,CAAC,SAAS;gBAAE,OAAO,EAAE,CAAC;YACrC,MAAM,QAAQ,GAAG,MAAM,IAAA,4BAAmB,EAEvC;gBACD,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,QAAQ,EAAE,WAAW,UAAU,CAAC,SAAS,QAAQ;gBACjD,IAAI;gBACJ,WAAW,EAAE;oBACX,QAAQ,EAAE,YAAY;oBACtB,UAAU,EAAE,MAAM;oBAClB,QAAQ,EAAE,gBAAgB,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;iBAChD;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACxC,iBAAiB,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE;gBACtD,IAAI,EAAE,IAAI;aACX,CAAC,CAAC,CAAC;QACN,CAAC;KAAA;CACF,CAAC;AAEW,QAAA,iBAAiB,GAAG,IAAA,gCAAa,EAAC;IAC7C,IAAI,EAAE,oBAAgB;IACtB,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,iKAAiK;IAC9K,KAAK,EAAE;QACL,SAAS,EAAE,0BAAkB,CAAC,MAAM,CAAC,IAAI,CAAC;KAC3C;IACD,UAAU,EAAE;QACV,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EAAE,4CAA4C;QACzD,MAAM,EAAE,CAAC;QACT,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,sBAAsB;QAChC,aAAa,EAAE,CAAC;QAChB,UAAU,EAAE,sBAAsB;QAClC,UAAU,EAAE,sBAAsB;KACnC;IACD,IAAI,EAAE,kCAAe,CAAC,OAAO;IAEvB,IAAI,CAAC,OAAO;;YAChB,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;IAEK,QAAQ,CAAC,OAAO;;YACpB,MAAM,6BAAa,CAAC,QAAQ,CAAC,OAAO,EAAE;gBACpC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;IAEK,SAAS,CAAC,OAAO;;YACrB,MAAM,6BAAa,CAAC,SAAS,CAAC,OAAO,EAAE;gBACrC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;IAEK,GAAG,CAAC,OAAO;;YACf,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { TriggerStrategy } from '@activepieces/pieces-framework';
2
+ export declare const updatedChange: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
3
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
+ }>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
6
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
8
+ }>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
9
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
10
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
11
+ }>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
12
+ domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
13
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
14
+ }>, {}>;
15
+ //# sourceMappingURL=updated-change.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updated-change.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/updated-change.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAqCxC,eAAO,MAAM,aAAa;;;;;;;;;;;;OAiDxB,CAAC"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updatedChange = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const __1 = require("../../");
8
+ const client_1 = require("../common/client");
9
+ const polling = {
10
+ strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
11
+ items(_a) {
12
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, lastFetchEpochMS }) {
13
+ const response = yield (0, client_1.freshserviceApiCall)({
14
+ method: pieces_common_1.HttpMethod.GET,
15
+ endpoint: 'changes',
16
+ auth,
17
+ queryParams: {
18
+ order_by: 'updated_at',
19
+ order_type: 'desc',
20
+ per_page: lastFetchEpochMS === 0 ? '10' : '100',
21
+ },
22
+ });
23
+ return response.body.changes.map((change) => ({
24
+ epochMilliSeconds: new Date(change.updated_at).getTime(),
25
+ data: change,
26
+ }));
27
+ });
28
+ },
29
+ };
30
+ exports.updatedChange = (0, pieces_framework_1.createTrigger)({
31
+ auth: __1.freshserviceAuth,
32
+ name: 'updated_change',
33
+ displayName: 'Updated Change',
34
+ description: 'Triggers when an existing change request is updated in Freshservice. Note: newly created changes may also fire this trigger because their updated_at matches created_at.',
35
+ props: {},
36
+ sampleData: {
37
+ id: 1,
38
+ subject: 'Upgrade server RAM',
39
+ description: '<div>Upgrade RAM on production server from 16GB to 32GB.</div>',
40
+ status: 2,
41
+ priority: 3,
42
+ impact: 2,
43
+ risk: 2,
44
+ change_type: 2,
45
+ requester_id: 1,
46
+ agent_id: 5,
47
+ department_id: 2,
48
+ group_id: 1,
49
+ planned_start_date: '2025-01-20T08:00:00Z',
50
+ planned_end_date: '2025-01-20T12:00:00Z',
51
+ created_at: '2025-01-15T09:30:00Z',
52
+ updated_at: '2025-01-15T11:45:00Z',
53
+ },
54
+ type: pieces_framework_1.TriggerStrategy.POLLING,
55
+ test(context) {
56
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
57
+ return yield pieces_common_1.pollingHelper.test(polling, context);
58
+ });
59
+ },
60
+ onEnable(context) {
61
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
+ yield pieces_common_1.pollingHelper.onEnable(polling, {
63
+ auth: context.auth,
64
+ store: context.store,
65
+ propsValue: context.propsValue,
66
+ });
67
+ });
68
+ },
69
+ onDisable(context) {
70
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
71
+ yield pieces_common_1.pollingHelper.onDisable(polling, {
72
+ auth: context.auth,
73
+ store: context.store,
74
+ propsValue: context.propsValue,
75
+ });
76
+ });
77
+ },
78
+ run(context) {
79
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
80
+ return yield pieces_common_1.pollingHelper.poll(polling, context);
81
+ });
82
+ },
83
+ });
84
+ //# sourceMappingURL=updated-change.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updated-change.js","sourceRoot":"","sources":["../../../../src/lib/triggers/updated-change.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,+DAKqC;AACrC,8BAA0C;AAC1C,6CAAuD;AAGvD,MAAM,OAAO,GAGT;IACF,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAC5B,KAAK;qEAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE;YACpC,MAAM,QAAQ,GAAG,MAAM,IAAA,4BAAmB,EAEvC;gBACD,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,QAAQ,EAAE,SAAS;gBACnB,IAAI;gBACJ,WAAW,EAAE;oBACX,QAAQ,EAAE,YAAY;oBACtB,UAAU,EAAE,MAAM;oBAClB,QAAQ,EAAE,gBAAgB,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;iBAChD;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBAC5C,iBAAiB,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE;gBACxD,IAAI,EAAE,MAAM;aACb,CAAC,CAAC,CAAC;QACN,CAAC;KAAA;CACF,CAAC;AAEW,QAAA,aAAa,GAAG,IAAA,gCAAa,EAAC;IACzC,IAAI,EAAE,oBAAgB;IACtB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,0KAA0K;IACvL,KAAK,EAAE,EAAE;IACT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