@activepieces/piece-ghostcms 0.0.1
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/README.md +7 -0
- package/package.json +17 -0
- package/src/index.d.ts +8 -0
- package/src/index.js +62 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/create-member.d.ts +9 -0
- package/src/lib/actions/create-member.js +60 -0
- package/src/lib/actions/create-member.js.map +1 -0
- package/src/lib/actions/create-post.d.ts +14 -0
- package/src/lib/actions/create-post.js +84 -0
- package/src/lib/actions/create-post.js.map +1 -0
- package/src/lib/actions/find-member.d.ts +6 -0
- package/src/lib/actions/find-member.js +36 -0
- package/src/lib/actions/find-member.js.map +1 -0
- package/src/lib/actions/find-user.d.ts +6 -0
- package/src/lib/actions/find-user.js +36 -0
- package/src/lib/actions/find-user.js.map +1 -0
- package/src/lib/actions/update-member.d.ts +10 -0
- package/src/lib/actions/update-member.js +65 -0
- package/src/lib/actions/update-member.js.map +1 -0
- package/src/lib/common/index.d.ts +15 -0
- package/src/lib/common/index.js +198 -0
- package/src/lib/common/index.js.map +1 -0
- package/src/lib/triggers/member-added.d.ts +5 -0
- package/src/lib/triggers/member-added.js +101 -0
- package/src/lib/triggers/member-added.js.map +1 -0
- package/src/lib/triggers/member-deleted.d.ts +5 -0
- package/src/lib/triggers/member-deleted.js +101 -0
- package/src/lib/triggers/member-deleted.js.map +1 -0
- package/src/lib/triggers/member-edited.d.ts +5 -0
- package/src/lib/triggers/member-edited.js +106 -0
- package/src/lib/triggers/member-edited.js.map +1 -0
- package/src/lib/triggers/page-published.d.ts +5 -0
- package/src/lib/triggers/page-published.js +208 -0
- package/src/lib/triggers/page-published.js.map +1 -0
- package/src/lib/triggers/post-published.d.ts +5 -0
- package/src/lib/triggers/post-published.js +209 -0
- package/src/lib/triggers/post-published.js.map +1 -0
- package/src/lib/triggers/post-scheduled.d.ts +5 -0
- package/src/lib/triggers/post-scheduled.js +209 -0
- package/src/lib/triggers/post-scheduled.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-ghostcms",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@sinclair/typebox": "^0.26.3",
|
|
6
|
+
"axios": "1.4.0",
|
|
7
|
+
"jsonwebtoken": "^9.0.0",
|
|
8
|
+
"nanoid": "^3.3.4",
|
|
9
|
+
"semver": "7.5.3",
|
|
10
|
+
"@activepieces/pieces-common": "0.2.1",
|
|
11
|
+
"@activepieces/pieces-framework": "0.6.3",
|
|
12
|
+
"@activepieces/shared": "0.5.10",
|
|
13
|
+
"tslib": "1.14.1"
|
|
14
|
+
},
|
|
15
|
+
"main": "./src/index.js",
|
|
16
|
+
"types": "./src/index.d.ts"
|
|
17
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const ghostAuth: import("@activepieces/pieces-framework").CustomAuthProperty<true, {
|
|
2
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const ghostcms: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<true, {
|
|
6
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
8
|
+
}>>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ghostcms = exports.ghostAuth = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
+
const member_added_1 = require("./lib/triggers/member-added");
|
|
6
|
+
const member_edited_1 = require("./lib/triggers/member-edited");
|
|
7
|
+
const member_deleted_1 = require("./lib/triggers/member-deleted");
|
|
8
|
+
const post_published_1 = require("./lib/triggers/post-published");
|
|
9
|
+
const post_scheduled_1 = require("./lib/triggers/post-scheduled");
|
|
10
|
+
const page_published_1 = require("./lib/triggers/page-published");
|
|
11
|
+
const create_member_1 = require("./lib/actions/create-member");
|
|
12
|
+
const update_member_1 = require("./lib/actions/update-member");
|
|
13
|
+
const find_member_1 = require("./lib/actions/find-member");
|
|
14
|
+
const create_post_1 = require("./lib/actions/create-post");
|
|
15
|
+
const find_user_1 = require("./lib/actions/find-user");
|
|
16
|
+
const authMarkdown = `
|
|
17
|
+
To generate an API key, follow the steps below in GhostCMS:
|
|
18
|
+
1. Go to Settings -> Advanced -> Integrations.
|
|
19
|
+
2. Scroll down to Custom Integrations and click Add custom integration.
|
|
20
|
+
3. Enter integration name and click create.
|
|
21
|
+
4. Copy the API URL and the Admin API Key into the fields below.
|
|
22
|
+
`;
|
|
23
|
+
exports.ghostAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
24
|
+
displayName: 'Authentication',
|
|
25
|
+
description: authMarkdown,
|
|
26
|
+
required: true,
|
|
27
|
+
props: {
|
|
28
|
+
baseUrl: pieces_framework_1.Property.ShortText({
|
|
29
|
+
displayName: 'API URL',
|
|
30
|
+
description: 'The API URL of your application (https://test-publication.ghost.io)',
|
|
31
|
+
required: true
|
|
32
|
+
}),
|
|
33
|
+
apiKey: pieces_framework_1.PieceAuth.SecretText({
|
|
34
|
+
displayName: 'Admin API Key',
|
|
35
|
+
description: 'The admin API key for your application',
|
|
36
|
+
required: true
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
exports.ghostcms = (0, pieces_framework_1.createPiece)({
|
|
41
|
+
displayName: "GhostCMS",
|
|
42
|
+
auth: exports.ghostAuth,
|
|
43
|
+
minimumSupportedRelease: '0.5.0',
|
|
44
|
+
logoUrl: "https://cdn.activepieces.com/pieces/ghostcms.png",
|
|
45
|
+
authors: ['MoShizzle'],
|
|
46
|
+
actions: [
|
|
47
|
+
create_member_1.createMember,
|
|
48
|
+
update_member_1.updateMember,
|
|
49
|
+
create_post_1.createPost,
|
|
50
|
+
find_member_1.findMember,
|
|
51
|
+
find_user_1.findUser
|
|
52
|
+
],
|
|
53
|
+
triggers: [
|
|
54
|
+
member_added_1.memberAdded,
|
|
55
|
+
member_edited_1.memberEdited,
|
|
56
|
+
member_deleted_1.memberDeleted,
|
|
57
|
+
post_published_1.postPublished,
|
|
58
|
+
post_scheduled_1.postScheduled,
|
|
59
|
+
page_published_1.pagePublished
|
|
60
|
+
],
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/ghostcms/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAkF;AAElF,8DAA0D;AAC1D,gEAA4D;AAC5D,kEAA8D;AAC9D,kEAA8D;AAC9D,kEAA8D;AAC9D,kEAA8D;AAC9D,+DAA2D;AAC3D,+DAA2D;AAC3D,2DAAuD;AACvD,2DAAuD;AACvD,uDAAmD;AAEnD,MAAM,YAAY,GAAG;;;;;;CAMpB,CAAC;AAEW,QAAA,SAAS,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC1C,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,YAAY;IACzB,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACH,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,qEAAqE;YAClF,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,MAAM,EAAE,4BAAS,CAAC,UAAU,CAAC;YACzB,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,IAAI;SACjB,CAAC;KACL;CACJ,CAAC,CAAC;AAEU,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IAChC,WAAW,EAAE,UAAU;IACvB,IAAI,EAAE,iBAAS;IACf,uBAAuB,EAAE,OAAO;IAChC,OAAO,EAAE,kDAAkD;IAC3D,OAAO,EAAE,CAAC,WAAW,CAAC;IACtB,OAAO,EAAE;QACL,4BAAY;QACZ,4BAAY;QACZ,wBAAU;QACV,wBAAU;QACV,oBAAQ;KACX;IACD,QAAQ,EAAE;QACN,0BAAW;QACX,4BAAY;QACZ,8BAAa;QACb,8BAAa;QACb,8BAAa;QACb,8BAAa;KAChB;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const createMember: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<true, {
|
|
2
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
note: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
newsletters: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<any, false> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<any, true>;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMember = 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 common_1 = require("../common");
|
|
9
|
+
exports.createMember = (0, pieces_framework_1.createAction)({
|
|
10
|
+
name: 'create_member',
|
|
11
|
+
displayName: 'Create Member',
|
|
12
|
+
description: 'Create a new member',
|
|
13
|
+
auth: __1.ghostAuth,
|
|
14
|
+
props: {
|
|
15
|
+
email: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Email',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
name: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'Full Name',
|
|
21
|
+
required: false,
|
|
22
|
+
}),
|
|
23
|
+
note: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'Note',
|
|
25
|
+
required: false
|
|
26
|
+
}),
|
|
27
|
+
newsletters: common_1.common.properties.newsletters(false)
|
|
28
|
+
},
|
|
29
|
+
run(context) {
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const newsletters = [];
|
|
32
|
+
if (context.propsValue.newsletters) {
|
|
33
|
+
context.propsValue.newsletters.forEach((newsletter) => {
|
|
34
|
+
newsletters.push({
|
|
35
|
+
id: newsletter
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
40
|
+
url: `${context.auth.baseUrl}/ghost/api/admin/members`,
|
|
41
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
42
|
+
headers: {
|
|
43
|
+
'Authorization': `Ghost ${common_1.common.jwtFromApiKey(context.auth.apiKey)}`
|
|
44
|
+
},
|
|
45
|
+
body: {
|
|
46
|
+
members: [
|
|
47
|
+
{
|
|
48
|
+
email: context.propsValue.email,
|
|
49
|
+
name: context.propsValue.name,
|
|
50
|
+
note: context.propsValue.note,
|
|
51
|
+
newsletters: newsletters
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return response.body;
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=create-member.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-member.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/ghostcms/src/lib/actions/create-member.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AAErE,6BAAkC;AAClC,sCAAmC;AAEtB,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,qBAAqB;IAClC,IAAI,EAAE,aAAS;IACf,KAAK,EAAE;QACH,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,OAAO;YACpB,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,WAAW,EAAE,eAAM,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC;KACpD;IAEK,GAAG,CAAC,OAAO;;YACb,MAAM,WAAW,GAAU,EAAE,CAAC;YAC9B,IAAI,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE;gBAChC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,UAAe,EAAE,EAAE;oBACvD,WAAW,CAAC,IAAI,CAAC;wBACb,EAAE,EAAE,UAAU;qBACjB,CAAC,CAAA;gBACN,CAAC,CAAC,CAAA;aACL;YAED,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC1C,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,0BAA0B;gBACtD,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,OAAO,EAAE;oBACL,eAAe,EAAE,SAAS,eAAM,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;iBACxE;gBACD,IAAI,EAAE;oBACF,OAAO,EAAE;wBACL;4BACI,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;4BAC/B,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;4BAC7B,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;4BAC7B,WAAW,EAAE,WAAW;yBAC3B;qBACJ;iBACJ;aACJ,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACzB,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const createPost: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<true, {
|
|
2
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
title: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
slug: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
status: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
8
|
+
publishedAt: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
9
|
+
html: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
10
|
+
customExcerpt: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
author: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
12
|
+
featured: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
13
|
+
tags: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, false>;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createPost = 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 common_1 = require("../common");
|
|
9
|
+
exports.createPost = (0, pieces_framework_1.createAction)({
|
|
10
|
+
name: 'create_post',
|
|
11
|
+
displayName: 'Create Post',
|
|
12
|
+
description: 'Create a new post',
|
|
13
|
+
auth: __1.ghostAuth,
|
|
14
|
+
props: {
|
|
15
|
+
title: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Title',
|
|
17
|
+
required: true
|
|
18
|
+
}),
|
|
19
|
+
slug: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'Slug',
|
|
21
|
+
required: false
|
|
22
|
+
}),
|
|
23
|
+
status: pieces_framework_1.Property.StaticDropdown({
|
|
24
|
+
displayName: 'Status',
|
|
25
|
+
required: true,
|
|
26
|
+
options: {
|
|
27
|
+
options: [
|
|
28
|
+
{ label: 'Draft', value: 'draft' },
|
|
29
|
+
{ label: 'Published', value: 'published' },
|
|
30
|
+
{ label: 'Scheduled', value: 'scheduled' }
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
}),
|
|
34
|
+
publishedAt: pieces_framework_1.Property.DateTime({
|
|
35
|
+
displayName: 'Published At',
|
|
36
|
+
required: false
|
|
37
|
+
}),
|
|
38
|
+
html: pieces_framework_1.Property.LongText({
|
|
39
|
+
displayName: 'Content (HTML)',
|
|
40
|
+
required: true
|
|
41
|
+
}),
|
|
42
|
+
customExcerpt: pieces_framework_1.Property.ShortText({
|
|
43
|
+
displayName: 'Custom Excerpt',
|
|
44
|
+
required: false
|
|
45
|
+
}),
|
|
46
|
+
author: common_1.common.properties.author,
|
|
47
|
+
featured: pieces_framework_1.Property.Checkbox({
|
|
48
|
+
displayName: 'Featured',
|
|
49
|
+
required: false
|
|
50
|
+
}),
|
|
51
|
+
tags: common_1.common.properties.tags
|
|
52
|
+
},
|
|
53
|
+
run(context) {
|
|
54
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
56
|
+
url: `${context.auth.baseUrl}/ghost/api/admin/posts`,
|
|
57
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
58
|
+
headers: {
|
|
59
|
+
'Authorization': `Ghost ${common_1.common.jwtFromApiKey(context.auth.apiKey)}`
|
|
60
|
+
},
|
|
61
|
+
body: {
|
|
62
|
+
posts: [
|
|
63
|
+
{
|
|
64
|
+
title: context.propsValue.title,
|
|
65
|
+
slug: context.propsValue.slug,
|
|
66
|
+
status: context.propsValue.status,
|
|
67
|
+
html: context.propsValue.html,
|
|
68
|
+
published_at: context.propsValue.publishedAt,
|
|
69
|
+
authors: [context.propsValue.author],
|
|
70
|
+
featured: context.propsValue.featured,
|
|
71
|
+
custom_excerpt: context.propsValue.customExcerpt,
|
|
72
|
+
tags: context.propsValue.tags
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
queryParams: {
|
|
77
|
+
source: 'html'
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return response.body;
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=create-post.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-post.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/ghostcms/src/lib/actions/create-post.ts"],"names":[],"mappings":";;;;AAAA,qEAA2F;AAC3F,+DAAqE;AAErE,6BAAkC;AAClC,sCAAmC;AAEtB,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACnC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,mBAAmB;IAChC,IAAI,EAAE,aAAS;IACf,KAAK,EAAE;QACH,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,OAAO;YACpB,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC5B,WAAW,EAAE,QAAQ;YACrB,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACL,OAAO,EAAE;oBACL,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;oBAClC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;oBAC1C,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;iBAC7C;aACJ;SACJ,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC3B,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACpB,WAAW,EAAE,gBAAgB;YAC7B,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,gBAAgB;YAC7B,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,MAAM,EAAE,eAAM,CAAC,UAAU,CAAC,MAAM;QAChC,QAAQ,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACxB,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,IAAI,EAAE,eAAM,CAAC,UAAU,CAAC,IAAI;KAC/B;IAEK,GAAG,CAAC,OAAO;;YACb,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC1C,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,wBAAwB;gBACpD,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,OAAO,EAAE;oBACL,eAAe,EAAE,SAAS,eAAM,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;iBACxE;gBACD,IAAI,EAAE;oBACF,KAAK,EAAE;wBACH;4BACI,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;4BAC/B,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;4BAC7B,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM;4BACjC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;4BAC7B,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,WAAW;4BAC5C,OAAO,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;4BACpC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ;4BACrC,cAAc,EAAE,OAAO,CAAC,UAAU,CAAC,aAAa;4BAChD,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;yBAChC;qBACJ;iBACJ;gBACD,WAAW,EAAE;oBACT,MAAM,EAAE,MAAM;iBACjB;aACJ,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACzB,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const findMember: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<true, {
|
|
2
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findMember = 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 common_1 = require("../common");
|
|
9
|
+
exports.findMember = (0, pieces_framework_1.createAction)({
|
|
10
|
+
name: 'find_member',
|
|
11
|
+
displayName: 'Find Member',
|
|
12
|
+
description: 'Find a member by email',
|
|
13
|
+
auth: __1.ghostAuth,
|
|
14
|
+
props: {
|
|
15
|
+
email: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Email',
|
|
17
|
+
required: true,
|
|
18
|
+
})
|
|
19
|
+
},
|
|
20
|
+
run(context) {
|
|
21
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
23
|
+
url: `${context.auth.baseUrl}/ghost/api/admin/members`,
|
|
24
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
25
|
+
headers: {
|
|
26
|
+
'Authorization': `Ghost ${common_1.common.jwtFromApiKey(context.auth.apiKey)}`
|
|
27
|
+
},
|
|
28
|
+
queryParams: {
|
|
29
|
+
filter: `email:${context.propsValue.email}`
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
return response.body;
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=find-member.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-member.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/ghostcms/src/lib/actions/find-member.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AAErE,6BAAkC;AAClC,sCAAmC;AAEtB,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACnC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,wBAAwB;IACrC,IAAI,EAAE,aAAS;IACf,KAAK,EAAE;QACH,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,OAAO;YACpB,QAAQ,EAAE,IAAI;SACjB,CAAC;KACL;IAEK,GAAG,CAAC,OAAO;;YACb,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC1C,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,0BAA0B;gBACtD,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,OAAO,EAAE;oBACL,eAAe,EAAE,SAAS,eAAM,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;iBACxE;gBACD,WAAW,EAAE;oBACT,MAAM,EAAE,SAAS,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE;iBAC9C;aACJ,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACzB,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const findUser: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<true, {
|
|
2
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findUser = 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 common_1 = require("../common");
|
|
9
|
+
exports.findUser = (0, pieces_framework_1.createAction)({
|
|
10
|
+
name: 'find_user',
|
|
11
|
+
displayName: 'Find User',
|
|
12
|
+
description: 'Find a staff user by email',
|
|
13
|
+
auth: __1.ghostAuth,
|
|
14
|
+
props: {
|
|
15
|
+
email: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Email',
|
|
17
|
+
required: true,
|
|
18
|
+
})
|
|
19
|
+
},
|
|
20
|
+
run(context) {
|
|
21
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
23
|
+
url: `${context.auth.baseUrl}/ghost/api/admin/users`,
|
|
24
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
25
|
+
headers: {
|
|
26
|
+
'Authorization': `Ghost ${common_1.common.jwtFromApiKey(context.auth.apiKey)}`
|
|
27
|
+
},
|
|
28
|
+
queryParams: {
|
|
29
|
+
filter: `email:${context.propsValue.email}`
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
return response.body;
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=find-user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-user.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/ghostcms/src/lib/actions/find-user.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AAErE,6BAAkC;AAClC,sCAAmC;AAEtB,QAAA,QAAQ,GAAG,IAAA,+BAAY,EAAC;IACjC,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,4BAA4B;IACzC,IAAI,EAAE,aAAS;IACf,KAAK,EAAE;QACH,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,OAAO;YACpB,QAAQ,EAAE,IAAI;SACjB,CAAC;KACL;IAEK,GAAG,CAAC,OAAO;;YACb,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC1C,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,wBAAwB;gBACpD,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,OAAO,EAAE;oBACL,eAAe,EAAE,SAAS,eAAM,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;iBACxE;gBACD,WAAW,EAAE;oBACT,MAAM,EAAE,SAAS,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE;iBAC9C;aACJ,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACzB,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const updateMember: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<true, {
|
|
2
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
member: import("@activepieces/pieces-framework").DropdownProperty<any, false> | import("@activepieces/pieces-framework").DropdownProperty<any, true>;
|
|
6
|
+
email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
note: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
newsletters: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<any, false> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<any, true>;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateMember = 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 common_1 = require("../common");
|
|
9
|
+
exports.updateMember = (0, pieces_framework_1.createAction)({
|
|
10
|
+
name: 'update_member',
|
|
11
|
+
displayName: 'Update Member',
|
|
12
|
+
description: 'Update a member',
|
|
13
|
+
auth: __1.ghostAuth,
|
|
14
|
+
props: {
|
|
15
|
+
member: common_1.common.properties.member(),
|
|
16
|
+
email: pieces_framework_1.Property.ShortText({
|
|
17
|
+
displayName: 'Email',
|
|
18
|
+
required: false,
|
|
19
|
+
}),
|
|
20
|
+
name: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Full Name',
|
|
22
|
+
required: false,
|
|
23
|
+
}),
|
|
24
|
+
note: pieces_framework_1.Property.ShortText({
|
|
25
|
+
displayName: 'Note',
|
|
26
|
+
required: false
|
|
27
|
+
}),
|
|
28
|
+
newsletters: common_1.common.properties.newsletters(false)
|
|
29
|
+
},
|
|
30
|
+
run(context) {
|
|
31
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const newsletters = [];
|
|
33
|
+
if (context.propsValue.newsletters) {
|
|
34
|
+
context.propsValue.newsletters.forEach((newsletter) => {
|
|
35
|
+
newsletters.push({
|
|
36
|
+
id: newsletter
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const data = {};
|
|
41
|
+
if (context.propsValue.email)
|
|
42
|
+
data.email = context.propsValue.email;
|
|
43
|
+
if (context.propsValue.name)
|
|
44
|
+
data.name = context.propsValue.name;
|
|
45
|
+
if (context.propsValue.note)
|
|
46
|
+
data.note = context.propsValue.note;
|
|
47
|
+
if (context.propsValue.newsletters)
|
|
48
|
+
data.newsletters = context.propsValue.newsletters;
|
|
49
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
50
|
+
url: `${context.auth.baseUrl}/ghost/api/admin/members/${context.propsValue.member}`,
|
|
51
|
+
method: pieces_common_1.HttpMethod.PUT,
|
|
52
|
+
headers: {
|
|
53
|
+
'Authorization': `Ghost ${common_1.common.jwtFromApiKey(context.auth.apiKey)}`
|
|
54
|
+
},
|
|
55
|
+
body: {
|
|
56
|
+
members: [
|
|
57
|
+
data
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return response.body;
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=update-member.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-member.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/ghostcms/src/lib/actions/update-member.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AAErE,6BAAkC;AAClC,sCAAmC;AAEtB,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,iBAAiB;IAC9B,IAAI,EAAE,aAAS;IACf,KAAK,EAAE;QACH,MAAM,EAAE,eAAM,CAAC,UAAU,CAAC,MAAM,EAAE;QAClC,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,OAAO;YACpB,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,WAAW,EAAE,eAAM,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC;KACpD;IAEK,GAAG,CAAC,OAAO;;YACb,MAAM,WAAW,GAAU,EAAE,CAAC;YAC9B,IAAI,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE;gBAChC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,UAAe,EAAE,EAAE;oBACvD,WAAW,CAAC,IAAI,CAAC;wBACb,EAAE,EAAE,UAAU;qBACjB,CAAC,CAAA;gBACN,CAAC,CAAC,CAAA;aACL;YAED,MAAM,IAAI,GAKN,EAAE,CAAA;YAEN,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK;gBAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC;YACpE,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI;gBAAE,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;YACjE,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI;gBAAE,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;YACjE,IAAI,OAAO,CAAC,UAAU,CAAC,WAAW;gBAAE,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC;YAEtF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC1C,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,4BAA4B,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE;gBACnF,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,OAAO,EAAE;oBACL,eAAe,EAAE,SAAS,eAAM,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;iBACxE;gBACD,IAAI,EAAE;oBACF,OAAO,EAAE;wBACL,IAAI;qBACP;iBACJ;aACJ,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACzB,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const common: {
|
|
2
|
+
properties: {
|
|
3
|
+
newsletters: (required?: boolean) => import("@activepieces/pieces-framework").MultiSelectDropdownProperty<any, false> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<any, true>;
|
|
4
|
+
member: (required?: boolean) => import("@activepieces/pieces-framework").DropdownProperty<any, false> | import("@activepieces/pieces-framework").DropdownProperty<any, true>;
|
|
5
|
+
author: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
6
|
+
tags: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, false>;
|
|
7
|
+
};
|
|
8
|
+
jwtFromApiKey: (apiKey: string) => string;
|
|
9
|
+
subscribeWebhook(auth: any, webhookType: string, webhookUrl: string): Promise<import("@activepieces/pieces-common").HttpMessageBody>;
|
|
10
|
+
unsubscribeWebhook(auth: any, webhookId: string): Promise<import("@activepieces/pieces-common").HttpMessageBody>;
|
|
11
|
+
getNewsletters(auth: any): Promise<import("@activepieces/pieces-common").HttpMessageBody>;
|
|
12
|
+
getMembers(auth: any): Promise<import("@activepieces/pieces-common").HttpMessageBody>;
|
|
13
|
+
getUsers(auth: any): Promise<import("@activepieces/pieces-common").HttpMessageBody>;
|
|
14
|
+
getTags(auth: any): Promise<import("@activepieces/pieces-common").HttpMessageBody>;
|
|
15
|
+
};
|