@coasy/piece-coasy 0.4.0 → 0.5.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/CLAUDE.md CHANGED
@@ -34,8 +34,8 @@ The doc is **private** — fetch it with `gh api repos/coasy/coasy-core/contents
34
34
 
35
35
  - **`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.
36
36
  - **`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`).
37
+ - **`assignToUser` / `removeFromUser` email fallback** (coasy-core PR #738, CSY-407): both accept `email` besides `userId`. `userId` wins; `email` is used only when `userId` is empty or absent, and a blank string counts as absent for both. The lookup is scoped to the API key's app and goes through Elasticsearch, so a just-created user may not be found yet. Neither given → `400`, several users with that email → `400 Multiple users found for this email.`, none → `404`. Lets flows triggered by `NEW_FUNNEL_PARTICIPANT` (no `userId` in the payload) map `{{trigger.funnelParticipant.email}}`.
37
38
  - **`enrollUserCourse`** writes a `UserCourse` progress row; access itself comes from `user.courses`. Without `directGrant: true` the course stays `LOCKED` in the member app, and `ALL_COURSES` cannot cover a `PRIVATE` course. The piece sends `directGrant` (default on).
38
-
39
39
  - **`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.
40
40
  - **`createFunnelParticipant`** lowercases `email` server-side. The response includes server-generated `funnelParticipantId`, `registrationTime`, and `timestamp`.
41
41
  - **`createVoucher`** auto-generates the voucher ID (`VOC-…`) and sets `status: "ACTIVE"`. Setting `countLeft` implicitly sets `isCountLimited: true`.
package/README.md CHANGED
@@ -140,7 +140,7 @@ The piece uses custom authentication with:
140
140
 
141
141
  ## Publishing
142
142
 
143
- The piece is published as `@coasy/piece-coasy` to npm. Version is currently `0.4.0`.
143
+ The piece is published as `@coasy/piece-coasy` to npm. Version is currently `0.5.0`.
144
144
 
145
145
  To publish a new version:
146
146
 
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coasy/piece-coasy",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "dependencies": {
5
5
  "@sinclair/typebox": "0.34.11",
6
6
  "axios": "1.8.3",
@@ -2,7 +2,8 @@ export declare const assignToUser: import("@activepieces/pieces-framework").IAct
2
2
  baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
3
3
  apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
4
  }>, {
5
- userId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
5
+ userId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
+ email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
7
  features: import("@activepieces/pieces-framework").ArrayProperty<false>;
7
8
  communityTopics: import("@activepieces/pieces-framework").ArrayProperty<false>;
8
9
  communityTopicGroups: import("@activepieces/pieces-framework").ArrayProperty<false>;
@@ -13,8 +13,13 @@ exports.assignToUser = (0, pieces_framework_1.createAction)({
13
13
  props: {
14
14
  userId: pieces_framework_1.Property.ShortText({
15
15
  displayName: 'User ID',
16
- description: 'ID of User',
17
- required: true,
16
+ description: 'ID of User. Takes precedence over Email',
17
+ required: false,
18
+ }),
19
+ email: pieces_framework_1.Property.ShortText({
20
+ displayName: 'Email',
21
+ description: 'Resolves the user by email within the app when User ID is empty. One of User ID or Email is required',
22
+ required: false,
18
23
  }),
19
24
  features: pieces_framework_1.Property.Array({
20
25
  displayName: 'Features',
@@ -1 +1 @@
1
- {"version":3,"file":"assign-to-user.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/coasy/src/lib/actions/assign-to-user.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,6BAAkC;AAClC,+CAAmD;AAEnD,MAAM,IAAI,GAAG,cAAc,CAAC;AAEf,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,aAAS;IACf,IAAI;IACJ,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EACT,gGAAgG;IAClG,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
+ {"version":3,"file":"assign-to-user.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/coasy/src/lib/actions/assign-to-user.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,6BAAkC;AAClC,+CAAmD;AAEnD,MAAM,IAAI,GAAG,cAAc,CAAC;AAEf,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,aAAS;IACf,IAAI;IACJ,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EACT,gGAAgG;IAClG,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,yCAAyC;YACtD,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EACT,sGAAsG;YACxG,QAAQ,EAAE,KAAK;SAChB,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"}
@@ -2,7 +2,8 @@ export declare const removeFromUser: import("@activepieces/pieces-framework").IA
2
2
  baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
3
3
  apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
4
  }>, {
5
- userId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
5
+ userId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
+ email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
7
  features: import("@activepieces/pieces-framework").ArrayProperty<false>;
7
8
  communityTopics: import("@activepieces/pieces-framework").ArrayProperty<false>;
8
9
  communityTopicGroups: import("@activepieces/pieces-framework").ArrayProperty<false>;
@@ -13,8 +13,13 @@ exports.removeFromUser = (0, pieces_framework_1.createAction)({
13
13
  props: {
14
14
  userId: pieces_framework_1.Property.ShortText({
15
15
  displayName: 'User ID',
16
- description: 'ID of User',
17
- required: true,
16
+ description: 'ID of User. Takes precedence over Email',
17
+ required: false,
18
+ }),
19
+ email: pieces_framework_1.Property.ShortText({
20
+ displayName: 'Email',
21
+ description: 'Resolves the user by email within the app when User ID is empty. One of User ID or Email is required',
22
+ required: false,
18
23
  }),
19
24
  features: pieces_framework_1.Property.Array({
20
25
  displayName: 'Features',
@@ -1 +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
+ {"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,yCAAyC;YACtD,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EACT,sGAAsG;YACxG,QAAQ,EAAE,KAAK;SAChB,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"}
Binary file