@coasy/piece-coasy 0.3.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 +2 -0
- package/README.md +2 -2
- package/coasy-piece-coasy-0.5.0.tgz +0 -0
- package/package.json +1 -1
- package/src/lib/actions/assign-to-user.d.ts +2 -1
- package/src/lib/actions/assign-to-user.js +7 -2
- package/src/lib/actions/assign-to-user.js.map +1 -1
- package/src/lib/actions/enroll-user-course.d.ts +1 -0
- package/src/lib/actions/enroll-user-course.js +6 -0
- package/src/lib/actions/enroll-user-course.js.map +1 -1
- package/src/lib/actions/remove-from-user.d.ts +2 -1
- package/src/lib/actions/remove-from-user.js +7 -2
- package/src/lib/actions/remove-from-user.js.map +1 -1
- package/coasy-piece-coasy-0.3.0.tgz +0 -0
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
|
+
- **`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}}`.
|
|
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).
|
|
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.
|
|
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
|
|
|
147
|
-
1. Update the `version` in `package.json` in Coasy community folder (e.g., from `0.
|
|
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
|
@@ -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<
|
|
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:
|
|
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,
|
|
1
|
+
{"version":3,"file":"assign-to-user.js","sourceRoot":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 +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"}
|
|
@@ -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<
|
|
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:
|
|
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,
|
|
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
|