@coasy/piece-coasy 0.2.4 → 0.2.6

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/CLAUDE.md CHANGED
@@ -15,7 +15,7 @@ The doc is **private** — fetch it with `gh api repos/coasy/coasy-core/contents
15
15
  - **Validation:** Server-side via `class-validator`. Bad bodies return `400` with field details.
16
16
  - **Response shape:** `{ "message": "...", "<entity>": { ... } }`
17
17
 
18
- ### Available actions (as of 2026-05-06)
18
+ ### Available actions (as of 2026-07-08)
19
19
 
20
20
  | Action | Endpoint | Purpose |
21
21
  | --- | --- | --- |
@@ -26,14 +26,17 @@ The doc is **private** — fetch it with `gh api repos/coasy/coasy-core/contents
26
26
  | `createVoucher` | `POST /apps/actions/createVoucher` | Create a discount voucher tied to offers |
27
27
  | `enrollUserCourse` | `POST /apps/actions/enrollUserCourse` | Enroll a user in a course |
28
28
  | `findEvent` | `POST /apps/actions/findEvent` | Find events of the calling app by exact title |
29
+ | `removeFromUser` | `POST /apps/actions/removeFromUser` | Remove features / community topics / topic groups / meditation categories from a user |
29
30
  | `sendPushNotification` | `POST /apps/actions/sendPushNotification` | Send a push notification to all of a user's devices |
30
31
 
31
32
  ### Gotchas worth remembering
32
33
 
33
- - **`assignToUser`** requires at least one of `features` / `communityTopics` / `communityTopicGroups` / `meditationCategories`; otherwise the server returns `400`. Cross-app `userId` returns `401`, not `404`.
34
+ - **`assignToUser`** requires at least one of `features` / `communityTopics` / `communityTopicGroups` / `meditationCategories`; otherwise the server returns `400`. Cross-app `userId` returns `401`, not `404`. It **does** validate that every referenced entity exists (`404` if not) — `removeFromUser` deliberately does not.
35
+ - **`removeFromUser`** (coasy-core PR #452) is the idempotent counterpart to `assignToUser`, same four array fields. Removing a value the user does not have is a **success**, not an error: HTTP `200`, `message: "Nothing to remove for user."`, `removed: {}`, and no write to the user record. Referenced entities are **not** existence-checked, so a deleted feature or meditation category stays removable. Same guards as `assignToUser` otherwise: unknown `userId` → `404`, cross-app `userId` → `401`, no field provided → `400`. The response adds a `removed` map reporting which values were actually present. Note the server rejects unknown body fields (`courses` is **not** supported here — courses use `enrollUserCourse`).
34
36
  - **`sendPushNotification`** accepts a `topic` field in the DTO but it is silently discarded by the current `buildNotification` implementation — do not expose it as a piece property until the upstream handler is fixed.
35
37
  - **`createFunnelParticipant`** lowercases `email` server-side. The response includes server-generated `funnelParticipantId`, `registrationTime`, and `timestamp`.
36
38
  - **`createVoucher`** auto-generates the voucher ID (`VOC-…`) and sets `status: "ACTIVE"`. Setting `countLeft` implicitly sets `isCountLimited: true`.
37
39
  - **`addTrialPeriod`** has its own domain error model (`AppSubscriptionError`) mapped to HTTP via `toApiErrorIfAppSubscriptionError` — surface the server's error message rather than masking it.
40
+ - **`addTrialPeriod` funnel guard** (coasy-core PR #220): the piece's `funnelGuard` array maps to the nested body `guards: { funnel: string[] }`. Guards are checked before the user is resolved; a match is a **silent no-op success** (`subscriptionStatus: "BLOCKED"`, `blockedBy` set, HTTP 200) — nothing is created/extended. Omitting it preserves original behavior.
38
41
 
39
42
  When the upstream doc changes, refresh this file by re-fetching the source via `gh api`.
package/package.json CHANGED
@@ -1,13 +1,23 @@
1
1
  {
2
2
  "name": "@coasy/piece-coasy",
3
- "version": "0.2.4",
4
- "resolutions": {
5
- "rollup": "npm:@rollup/wasm-node"
6
- },
3
+ "version": "0.2.6",
7
4
  "dependencies": {
5
+ "@sinclair/typebox": "0.34.11",
6
+ "axios": "1.8.3",
7
+ "axios-retry": "4.4.1",
8
+ "deepmerge-ts": "7.1.0",
9
+ "mime-types": "2.1.35",
10
+ "nanoid": "3.3.8",
11
+ "semver": "7.6.0",
12
+ "socket.io-client": "4.8.1",
13
+ "zod": "3.25.76",
8
14
  "@activepieces/pieces-common": "0.8.1",
9
15
  "@activepieces/pieces-framework": "0.20.2",
10
- "@activepieces/shared": "0.25.2"
16
+ "@activepieces/shared": "0.25.2",
17
+ "tslib": "2.6.2"
18
+ },
19
+ "resolutions": {
20
+ "rollup": "npm:@rollup/wasm-node"
11
21
  },
12
22
  "types": "./src/index.d.ts",
13
23
  "main": "./src/index.js",
package/src/index.js CHANGED
@@ -25,6 +25,7 @@ const webinar_participant_attend_1 = require("./lib/triggers/webinar-participant
25
25
  const webinar_participant_reminder_1 = require("./lib/triggers/webinar-participant-reminder");
26
26
  const add_trial_period_1 = require("./lib/actions/add-trial-period");
27
27
  const assign_to_user_1 = require("./lib/actions/assign-to-user");
28
+ const remove_from_user_1 = require("./lib/actions/remove-from-user");
28
29
  exports.coasyAuth = pieces_framework_1.PieceAuth.CustomAuth({
29
30
  required: true,
30
31
  description: 'Enter coasy authentication details',
@@ -57,6 +58,7 @@ exports.coasy = (0, pieces_framework_1.createPiece)({
57
58
  create_voucher_1.createVoucher,
58
59
  enroll_user_course_1.enrollUserCourse,
59
60
  find_event_1.findEvent,
61
+ remove_from_user_1.removeFromUser,
60
62
  send_push_notification_1.sendPushNotification,
61
63
  ],
62
64
  triggers: [
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/coasy/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAIwC;AACxC,qFAAgF;AAChF,uFAAkF;AAClF,iEAA6D;AAC7D,yEAAoE;AACpE,yDAAqD;AACrD,iFAA4E;AAC5E,8EAA0E;AAC1E,oEAAgE;AAChE,8EAAyE;AACzE,kFAA8E;AAC9E,kFAA8E;AAC9E,kEAA6D;AAC7D,8DAA0D;AAC1D,kFAA6E;AAC7E,kEAA8D;AAC9D,wDAAoD;AACpD,kEAA6D;AAC7D,sEAAkE;AAClE,oFAA+E;AAC/E,0FAAqF;AACrF,8FAAyF;AACzF,qEAAgE;AAChE,iEAA4D;AAE/C,QAAA,SAAS,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC5C,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,oCAAoC;IACjD,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,mCAAmC;SAClD,CAAC;QACF,MAAM,EAAE,4BAAS,CAAC,UAAU,CAAC;YAC3B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,mBAAmB;YAChC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;CACF,CAAC,CAAC;AAEU,QAAA,KAAK,GAAG,IAAA,8BAAW,EAAC;IAC/B,WAAW,EAAE,OAAO;IACpB,IAAI,EAAE,iBAAS;IACf,WAAW,EAAE,wBAAwB;IACrC,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,iDAAiD;IAC1D,OAAO,EAAE,CAAC,iBAAiB,CAAC;IAC5B,OAAO,EAAE;QACP,iCAAc;QACd,6BAAY;QACZ,iDAAsB;QACtB,mDAAuB;QACvB,8BAAa;QACb,qCAAgB;QAChB,sBAAS;QACT,6CAAoB;KACrB;IACD,QAAQ,EAAE;QACR,0CAAmB;QACnB,gCAAc;QACd,yCAAkB;QAClB,8CAAqB;QACrB,8CAAqB;QACrB,6BAAY;QACZ,0BAAW;QACX,6CAAoB;QACpB,8BAAa;QACb,oBAAQ;QACR,6BAAY;QACZ,kCAAe;QACf,+CAAqB;QACrB,qDAAwB;QACxB,yDAA0B;KAC3B;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/coasy/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAIwC;AACxC,qFAAgF;AAChF,uFAAkF;AAClF,iEAA6D;AAC7D,yEAAoE;AACpE,yDAAqD;AACrD,iFAA4E;AAC5E,8EAA0E;AAC1E,oEAAgE;AAChE,8EAAyE;AACzE,kFAA8E;AAC9E,kFAA8E;AAC9E,kEAA6D;AAC7D,8DAA0D;AAC1D,kFAA6E;AAC7E,kEAA8D;AAC9D,wDAAoD;AACpD,kEAA6D;AAC7D,sEAAkE;AAClE,oFAA+E;AAC/E,0FAAqF;AACrF,8FAAyF;AACzF,qEAAgE;AAChE,iEAA4D;AAC5D,qEAAgE;AAEnD,QAAA,SAAS,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC5C,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,oCAAoC;IACjD,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,mCAAmC;SAClD,CAAC;QACF,MAAM,EAAE,4BAAS,CAAC,UAAU,CAAC;YAC3B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,mBAAmB;YAChC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;CACF,CAAC,CAAC;AAEU,QAAA,KAAK,GAAG,IAAA,8BAAW,EAAC;IAC/B,WAAW,EAAE,OAAO;IACpB,IAAI,EAAE,iBAAS;IACf,WAAW,EAAE,wBAAwB;IACrC,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,iDAAiD;IAC1D,OAAO,EAAE,CAAC,iBAAiB,CAAC;IAC5B,OAAO,EAAE;QACP,iCAAc;QACd,6BAAY;QACZ,iDAAsB;QACtB,mDAAuB;QACvB,8BAAa;QACb,qCAAgB;QAChB,sBAAS;QACT,iCAAc;QACd,6CAAoB;KACrB;IACD,QAAQ,EAAE;QACR,0CAAmB;QACnB,gCAAc;QACd,yCAAkB;QAClB,8CAAqB;QACrB,8CAAqB;QACrB,6BAAY;QACZ,0BAAW;QACX,6CAAoB;QACpB,8BAAa;QACb,oBAAQ;QACR,6BAAY;QACZ,kCAAe;QACf,+CAAqB;QACrB,qDAAwB;QACxB,yDAA0B;KAC3B;CACF,CAAC,CAAC"}
@@ -7,4 +7,5 @@ export declare const addTrialPeriod: import("@activepieces/pieces-framework").IA
7
7
  offerId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
8
8
  paymentPlanId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
9
9
  firstName: import("@activepieces/pieces-framework").ShortTextProperty<false>;
10
+ funnelGuard: import("@activepieces/pieces-framework").ArrayProperty<false>;
10
11
  }>;
@@ -5,6 +5,25 @@ const pieces_framework_1 = require("@activepieces/pieces-framework");
5
5
  const index_1 = require("../../index");
6
6
  const actions_1 = require("../common/actions");
7
7
  const name = 'addTrialPeriod';
8
+ // Reshapes flat guard props into the nested `guards: { ... }` body the server
9
+ // expects. `guardSources` maps a prop name to its server guard key (e.g.
10
+ // `{ funnelGuard: 'funnel' }`). Blank entries are dropped and `guards` is omitted
11
+ // when no guard has any value.
12
+ const buildGuardedRequest = (request, guardSources) => {
13
+ const rest = Object.assign({}, request);
14
+ const guards = {};
15
+ for (const [propName, guardKey] of Object.entries(guardSources)) {
16
+ const value = rest[propName];
17
+ delete rest[propName];
18
+ const ids = Array.isArray(value)
19
+ ? value.filter((id) => typeof id === 'string' && id.trim() !== '')
20
+ : [];
21
+ if (ids.length > 0) {
22
+ guards[guardKey] = ids;
23
+ }
24
+ }
25
+ return Object.keys(guards).length > 0 ? Object.assign(Object.assign({}, rest), { guards }) : rest;
26
+ };
8
27
  exports.addTrialPeriod = (0, pieces_framework_1.createAction)({
9
28
  auth: index_1.coasyAuth,
10
29
  name,
@@ -36,7 +55,12 @@ exports.addTrialPeriod = (0, pieces_framework_1.createAction)({
36
55
  description: 'Optional first name, forwarded when a new user is created.',
37
56
  required: false,
38
57
  }),
58
+ funnelGuard: pieces_framework_1.Property.Array({
59
+ displayName: 'Funnel Guard',
60
+ description: 'Guards against extending the trial period if the user is already a funnel participant in one of these funnels.',
61
+ required: false,
62
+ }),
39
63
  },
40
- run: (configValue) => (0, actions_1.runCoasyAction)(configValue, name),
64
+ run: (configValue) => (0, actions_1.runCoasyAction)(configValue, name, buildGuardedRequest(configValue.propsValue, { funnelGuard: 'funnel' })),
41
65
  });
42
66
  //# sourceMappingURL=add-trial-period.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"add-trial-period.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/coasy/src/lib/actions/add-trial-period.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,uCAAwC;AACxC,+CAAmD;AAEnD,MAAM,IAAI,GAAG,gBAAgB,CAAC;AAEjB,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,iBAAS;IACf,IAAI;IACJ,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EACT,0MAA0M;IAC5M,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,6DAA6D;YAC1E,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACpB,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,4DAA4D;YACzE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,2DAA2D;YACxE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAChC,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EACT,wFAAwF;YAC1F,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,4DAA4D;YACzE,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACD,GAAG,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,IAAA,wBAAc,EAAC,WAAW,EAAE,IAAI,CAAC;CACxD,CAAC,CAAC"}
1
+ {"version":3,"file":"add-trial-period.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/coasy/src/lib/actions/add-trial-period.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,uCAAwC;AACxC,+CAAmD;AAEnD,MAAM,IAAI,GAAG,gBAAgB,CAAC;AAE9B,8EAA8E;AAC9E,yEAAyE;AACzE,kFAAkF;AAClF,+BAA+B;AAC/B,MAAM,mBAAmB,GAAG,CAC1B,OAAgC,EAChC,YAAoC,EACX,EAAE;IAC3B,MAAM,IAAI,qBAAQ,OAAO,CAAE,CAAC;IAC5B,MAAM,MAAM,GAA4B,EAAE,CAAC;IAE3C,KAAK,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QAChE,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtB,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAC9B,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;YAClE,CAAC,CAAC,EAAE,CAAC;QACP,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnB,MAAM,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC;QACzB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,iCAAM,IAAI,KAAE,MAAM,IAAG,CAAC,CAAC,IAAI,CAAC;AACrE,CAAC,CAAC;AAEW,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,iBAAS;IACf,IAAI;IACJ,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EACT,0MAA0M;IAC5M,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,6DAA6D;YAC1E,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACpB,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,4DAA4D;YACzE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,2DAA2D;YACxE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAChC,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EACT,wFAAwF;YAC1F,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,4DAA4D;YACzE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,KAAK,CAAC;YAC1B,WAAW,EAAE,cAAc;YAC3B,WAAW,EACT,gHAAgH;YAClH,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACD,GAAG,EAAE,CAAC,WAAW,EAAE,EAAE,CACnB,IAAA,wBAAc,EACZ,WAAW,EACX,IAAI,EACJ,mBAAmB,CAAC,WAAW,CAAC,UAAU,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,CACvE;CACJ,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare const removeFromUser: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
3
+ apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ userId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
6
+ features: import("@activepieces/pieces-framework").ArrayProperty<false>;
7
+ communityTopics: import("@activepieces/pieces-framework").ArrayProperty<false>;
8
+ communityTopicGroups: import("@activepieces/pieces-framework").ArrayProperty<false>;
9
+ meditationCategories: import("@activepieces/pieces-framework").ArrayProperty<false>;
10
+ }>;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeFromUser = void 0;
4
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
5
+ const __1 = require("../..");
6
+ const actions_1 = require("../common/actions");
7
+ const name = 'removeFromUser';
8
+ exports.removeFromUser = (0, pieces_framework_1.createAction)({
9
+ auth: __1.coasyAuth,
10
+ name,
11
+ displayName: 'Remove From User',
12
+ description: 'Removes features, community topics, community topic groups, or meditation categories from a user. Values the user does not have are ignored without raising an error',
13
+ props: {
14
+ userId: pieces_framework_1.Property.ShortText({
15
+ displayName: 'User ID',
16
+ description: 'ID of User',
17
+ required: true,
18
+ }),
19
+ features: pieces_framework_1.Property.Array({
20
+ displayName: 'Features',
21
+ description: 'List of feature IDs to remove',
22
+ required: false,
23
+ }),
24
+ communityTopics: pieces_framework_1.Property.Array({
25
+ displayName: 'Community Topics',
26
+ description: 'List of community topic IDs to remove',
27
+ required: false,
28
+ }),
29
+ communityTopicGroups: pieces_framework_1.Property.Array({
30
+ displayName: 'Community Topic Groups',
31
+ description: 'List of community topic group IDs to remove',
32
+ required: false,
33
+ }),
34
+ meditationCategories: pieces_framework_1.Property.Array({
35
+ displayName: 'Meditation Categories',
36
+ description: 'List of meditation category IDs to remove. The format is "libraryId/categoryId"',
37
+ required: false,
38
+ }),
39
+ },
40
+ run: (configValue) => (0, actions_1.runCoasyAction)(configValue, name),
41
+ });
42
+ //# sourceMappingURL=remove-from-user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-from-user.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/coasy/src/lib/actions/remove-from-user.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,6BAAkC;AAClC,+CAAmD;AAEnD,MAAM,IAAI,GAAG,gBAAgB,CAAC;AAEjB,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,aAAS;IACf,IAAI;IACJ,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EACT,sKAAsK;IACxK,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACvB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,+BAA+B;YAC5C,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,eAAe,EAAE,2BAAQ,CAAC,KAAK,CAAC;YAC9B,WAAW,EAAE,kBAAkB;YAC/B,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,oBAAoB,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACnC,WAAW,EAAE,wBAAwB;YACrC,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,oBAAoB,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACnC,WAAW,EAAE,uBAAuB;YACpC,WAAW,EACT,iFAAiF;YACnF,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACD,GAAG,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,IAAA,wBAAc,EAAC,WAAW,EAAE,IAAI,CAAC;CACxD,CAAC,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import { ActionContext, InputPropertyMap } from '@activepieces/pieces-framework';
2
2
  import { coasyAuth } from '../..';
3
- export declare const runCoasyAction: <T extends InputPropertyMap>(configValue: ActionContext<typeof coasyAuth, T>, action: string) => Promise<any>;
3
+ export declare const runCoasyAction: <T extends InputPropertyMap>(configValue: ActionContext<typeof coasyAuth, T>, action: string, request?: Record<string, unknown>) => Promise<any>;
@@ -3,14 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runCoasyAction = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const coasyClient_1 = require("./coasyClient");
6
- const runCoasyAction = (configValue, action) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
6
+ const runCoasyAction = (configValue, action, request) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
7
7
  var _a;
8
8
  const { propsValue, auth: authPayload } = configValue;
9
9
  const client = new coasyClient_1.CoasyClient((_a = authPayload.baseUrl) !== null && _a !== void 0 ? _a : 'https://backend.api.prod.coasy.io', authPayload.apiKey);
10
- const restPropsValue = tslib_1.__rest(propsValue, []);
11
- delete restPropsValue['auth'];
12
- const request = Object.assign({}, restPropsValue);
13
- return client.action(action, request);
10
+ const body = Object.assign({}, (request !== null && request !== void 0 ? request : propsValue));
11
+ delete body['auth'];
12
+ return client.action(action, body);
14
13
  });
15
14
  exports.runCoasyAction = runCoasyAction;
16
15
  //# sourceMappingURL=actions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/coasy/src/lib/common/actions.ts"],"names":[],"mappings":";;;;AAKA,+CAA4C;AAErC,MAAM,cAAc,GAAG,CAC5B,WAA+C,EAC/C,MAAc,EACd,EAAE;;IACF,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC;IACtD,MAAM,MAAM,GAAG,IAAI,yBAAW,CAC5B,MAAA,WAAW,CAAC,OAAO,mCAAI,mCAAmC,EAC1D,WAAW,CAAC,MAAM,CACnB,CAAC;IAEF,MAAW,cAAc,kBAAK,UAAU,EAAlC,EAAqB,CAAa,CAAC;IAEzC,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;IAE9B,MAAM,OAAO,qBAAQ,cAAc,CAAE,CAAC;IACtC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC,CAAA,CAAC;AAhBW,QAAA,cAAc,kBAgBzB"}
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/coasy/src/lib/common/actions.ts"],"names":[],"mappings":";;;;AAKA,+CAA4C;AAErC,MAAM,cAAc,GAAG,CAC5B,WAA+C,EAC/C,MAAc,EACd,OAAiC,EACjC,EAAE;;IACF,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC;IACtD,MAAM,MAAM,GAAG,IAAI,yBAAW,CAC5B,MAAA,WAAW,CAAC,OAAO,mCAAI,mCAAmC,EAC1D,WAAW,CAAC,MAAM,CACnB,CAAC;IAEF,MAAM,IAAI,qBAAQ,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,UAAU,CAAC,CAAE,CAAC;IAC5C,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;IAEpB,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC,CAAA,CAAC;AAfW,QAAA,cAAc,kBAezB"}