@coasy/piece-coasy 0.3.0 → 0.4.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,6 +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
+ - **`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
+
37
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.
38
40
  - **`createFunnelParticipant`** lowercases `email` server-side. The response includes server-generated `funnelParticipantId`, `registrationTime`, and `timestamp`.
39
41
  - **`createVoucher`** auto-generates the voucher ID (`VOC-…`) and sets `status: "ACTIVE"`. Setting `countLeft` implicitly sets `isCountLimited: true`.
package/README.md CHANGED
@@ -140,11 +140,11 @@ 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.3.0`.
143
+ The piece is published as `@coasy/piece-coasy` to npm. Version is currently `0.4.0`.
144
144
 
145
145
  To publish a new version:
146
146
 
147
- 1. Update the `version` in `package.json` in Coasy community folder (e.g., from `0.3.0` to `0.3.1`)
147
+ 1. Update the `version` in `package.json` in Coasy community folder (e.g., from `0.4.0` to `0.4.1`)
148
148
  2. Build the package with:
149
149
  ```bash
150
150
  npm run build-piece coasy
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coasy/piece-coasy",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "dependencies": {
5
5
  "@sinclair/typebox": "0.34.11",
6
6
  "axios": "1.8.3",
@@ -4,4 +4,5 @@ export declare const enrollUserCourse: import("@activepieces/pieces-framework").
4
4
  }>, {
5
5
  userId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
6
6
  courseId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ directGrant: import("@activepieces/pieces-framework").CheckboxProperty<false>;
7
8
  }>;
@@ -21,6 +21,12 @@ exports.enrollUserCourse = (0, pieces_framework_1.createAction)({
21
21
  description: 'ID of Course',
22
22
  required: true,
23
23
  }),
24
+ directGrant: pieces_framework_1.Property.Checkbox({
25
+ displayName: 'Direct Grant Course',
26
+ description: 'Also grants the course to the user. Without it the enrollment is only progress tracking and the course stays locked.',
27
+ required: false,
28
+ defaultValue: true,
29
+ }),
24
30
  },
25
31
  run: (configValue) => (0, actions_1.runCoasyAction)(configValue, name),
26
32
  });
@@ -1 +1 @@
1
- {"version":3,"file":"enroll-user-course.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/coasy/src/lib/actions/enroll-user-course.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,6BAAkC;AAClC,+CAAmD;AAEnD,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAEnB,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,aAAS;IACf,IAAI;IACJ,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,qBAAqB;IAClC,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,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,GAAG,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,IAAA,wBAAc,EAAC,WAAW,EAAE,IAAI,CAAC;CACxD,CAAC,CAAC"}
1
+ {"version":3,"file":"enroll-user-course.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/coasy/src/lib/actions/enroll-user-course.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,6BAAkC;AAClC,+CAAmD;AAEnD,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAEnB,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,aAAS;IACf,IAAI;IACJ,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,qBAAqB;IAClC,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,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC7B,WAAW,EAAE,qBAAqB;YAClC,WAAW,EACT,sHAAsH;YACxH,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SACnB,CAAC;KACH;IACD,GAAG,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,IAAA,wBAAc,EAAC,WAAW,EAAE,IAAI,CAAC;CACxD,CAAC,CAAC"}
Binary file