@ccw-api/api 0.5.0 → 0.6.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.
Files changed (52) hide show
  1. package/README.md +591 -439
  2. package/dist/esm/community-web/ccw-mall/ccw/product/fe/query.js +34 -0
  3. package/dist/esm/community-web/ccw-mall/ccw/product/fe/query.test.js +8 -0
  4. package/dist/esm/community-web/extensions/creation-like/detail.js +14 -0
  5. package/dist/esm/community-web/extensions/creation-like/detail.test.js +4 -0
  6. package/dist/esm/community-web/extensions/following/status.js +14 -0
  7. package/dist/esm/community-web/extensions/following/status.test.js +4 -0
  8. package/dist/esm/community-web/index.js +14 -0
  9. package/dist/esm/community-web/post/post.test.js +0 -1
  10. package/dist/esm/community-web/smart_contract/account.js +13 -0
  11. package/dist/esm/community-web/smart_contract/account.test.js +4 -0
  12. package/dist/esm/community-web/smart_contract/detail.js +13 -0
  13. package/dist/esm/community-web/smart_contract/detail.test.js +4 -0
  14. package/dist/esm/community-web/smart_contract/execute.js +17 -0
  15. package/dist/esm/community-web/smart_contract/execute.test.js +4 -0
  16. package/dist/esm/community-web/study-community/following/follow.js +13 -0
  17. package/dist/esm/community-web/study-community/following/follow.test.js +4 -0
  18. package/dist/esm/community-web-cloud-database/cloud_variable/detail/v2.js +16 -0
  19. package/dist/esm/community-web-cloud-database/cloud_variable/detail/v2.test.js +4 -0
  20. package/dist/esm/community-web-cloud-database/index.js +2 -0
  21. package/dist/node/community-web/ccw-mall/ccw/product/fe/query.js +38 -0
  22. package/dist/node/community-web/ccw-mall/ccw/product/fe/query.test.js +10 -0
  23. package/dist/node/community-web/extensions/creation-like/detail.js +18 -0
  24. package/dist/node/community-web/extensions/creation-like/detail.test.js +6 -0
  25. package/dist/node/community-web/extensions/following/status.js +18 -0
  26. package/dist/node/community-web/extensions/following/status.test.js +6 -0
  27. package/dist/node/community-web/index.js +14 -0
  28. package/dist/node/community-web/post/post.test.js +0 -1
  29. package/dist/node/community-web/smart_contract/account.js +17 -0
  30. package/dist/node/community-web/smart_contract/account.test.js +6 -0
  31. package/dist/node/community-web/smart_contract/detail.js +17 -0
  32. package/dist/node/community-web/smart_contract/detail.test.js +6 -0
  33. package/dist/node/community-web/smart_contract/execute.js +21 -0
  34. package/dist/node/community-web/smart_contract/execute.test.js +6 -0
  35. package/dist/node/community-web/study-community/following/follow.js +17 -0
  36. package/dist/node/community-web/study-community/following/follow.test.js +6 -0
  37. package/dist/node/community-web-cloud-database/cloud_variable/detail/v2.js +20 -0
  38. package/dist/node/community-web-cloud-database/cloud_variable/detail/v2.test.js +6 -0
  39. package/dist/node/community-web-cloud-database/index.js +2 -0
  40. package/dist/types/community-web/ccw-mall/ccw/product/fe/query.d.ts +54 -0
  41. package/dist/types/community-web/extensions/creation-like/detail.d.ts +18 -0
  42. package/dist/types/community-web/extensions/following/status.d.ts +19 -0
  43. package/dist/types/community-web/index.d.ts +14 -0
  44. package/dist/types/community-web/post/detail.d.ts +1 -1
  45. package/dist/types/community-web/smart_contract/account.d.ts +13 -0
  46. package/dist/types/community-web/smart_contract/detail.d.ts +24 -0
  47. package/dist/types/community-web/smart_contract/execute.d.ts +25 -0
  48. package/dist/types/community-web/study-community/following/follow.d.ts +12 -0
  49. package/dist/types/community-web-cloud-database/cloud_variable/detail/v2.d.ts +17 -0
  50. package/dist/types/community-web-cloud-database/index.d.ts +2 -0
  51. package/dist/types/index.d.ts +8 -0
  52. package/package.json +2 -2
@@ -0,0 +1,34 @@
1
+ import { ccwAxios } from "@ccw-api/axios";
2
+ import { DEFAULT_PAGE_ARGS, queryPage } from "src/queryPages";
3
+ export const url = "https://community-web.ccw.site/ccw-mall/ccw/product/fe/query";
4
+ export var ProductCategory;
5
+ (function (ProductCategory) {
6
+ ProductCategory[ProductCategory["Merchandise"] = 7] = "Merchandise";
7
+ ProductCategory[ProductCategory["AvatarFrame"] = 5] = "AvatarFrame";
8
+ ProductCategory[ProductCategory["EMOJI"] = 10] = "EMOJI";
9
+ })(ProductCategory || (ProductCategory = {}));
10
+ /**
11
+ * 分页查询CCW小商店商品列表
12
+ * @param {ProductCategory | undefined} productCategory 商品分类(可选):5=头像框,7=周边商品,10=表情 等
13
+ * @param {Partial<PageArgs<ProductSortField>>} pageArgs_ 分页参数(默认 page=1, perPage=30, sortType="DESC")
14
+ * @returns {Promise<Res>} 商品分页结果 PagesRes<Product>
15
+ */
16
+ export async function queryMallProducts(productCategory, pageArgs_ = {
17
+ sortField: "createdAt",
18
+ }) {
19
+ const pageArgs = {
20
+ ...DEFAULT_PAGE_ARGS,
21
+ ...pageArgs_,
22
+ };
23
+ const queryUrl = queryPage(url, pageArgs);
24
+ const req = {
25
+ page: pageArgs.page,
26
+ perPage: pageArgs.perPage,
27
+ sortType: pageArgs.sortType,
28
+ productCategory,
29
+ source: "CCW_OFFICIAL",
30
+ };
31
+ return await ccwAxios
32
+ .post(queryUrl, req)
33
+ .then((res) => res.data.body);
34
+ }
@@ -0,0 +1,8 @@
1
+ import { queryMallProducts } from "./query";
2
+ test("query mall product page should fail without token", async () => {
3
+ await expect(queryMallProducts(7, {
4
+ page: 1,
5
+ perPage: 30,
6
+ sortType: "DESC",
7
+ })).rejects.toThrow();
8
+ });
@@ -0,0 +1,14 @@
1
+ import { ccwAxios } from "@ccw-api/axios";
2
+ export const url = "https://community-web.ccw.site/extensions/creation-like/detail";
3
+ /**
4
+ * [连接社区扩展] 查询用户对作品的点赞交互状态
5
+ * @param {MongoDBId} playingCreationOid 当前播放的作品 OID
6
+ * @param {MongoDBId} creationOid 目标作品 OID
7
+ * @returns {Promise<Res>} 点赞状态及作品信息
8
+ */
9
+ export async function getConnectCommunityCreationLikeStatus(playingCreationOid, creationOid) {
10
+ const req = { playingCreationOid, creationOid };
11
+ return await ccwAxios
12
+ .post(url, req)
13
+ .then((res) => res.data.body);
14
+ }
@@ -0,0 +1,4 @@
1
+ import { getConnectCommunityCreationLikeStatus } from "./detail";
2
+ test("should fail without token when getting creation like status", async () => {
3
+ await expect(getConnectCommunityCreationLikeStatus("6a3fa1ed159ed52f170c34d2", "6a3fa1ed159ed52f170c34d2")).rejects.toThrow();
4
+ });
@@ -0,0 +1,14 @@
1
+ import { ccwAxios } from "@ccw-api/axios";
2
+ export const url = "https://community-web.ccw.site/extensions/following/status";
3
+ /**
4
+ * [连接社区扩展] 查询是否关注了指定创作者
5
+ * @param {MongoDBId} playingCreationOid 当前播放的作品 OID
6
+ * @param {MongoDBId} userOid 目标用户 OID
7
+ * @returns {Promise<Res>} 关注状态及用户信息
8
+ */
9
+ export async function getConnectCommunityFollowingStatus(playingCreationOid, userOid) {
10
+ const req = { playingCreationOid, userOid };
11
+ return await ccwAxios
12
+ .post(url, req)
13
+ .then((res) => res.data.body);
14
+ }
@@ -0,0 +1,4 @@
1
+ import { getConnectCommunityFollowingStatus } from "./status";
2
+ test("should fail without token when getting following status", async () => {
3
+ await expect(getConnectCommunityFollowingStatus("6a3fa1ed159ed52f170c34d2", "651e3f7310b0530e7f80fe7a")).rejects.toThrow();
4
+ });
@@ -9,6 +9,7 @@ import { searchCloudAssets } from "./cloud_asset/search";
9
9
  import { getCommentReplies } from "./comment/page";
10
10
  import { getCommentsByTopic } from "./comment/page_by_topic";
11
11
  import { getConfigDetail } from "./config/detail";
12
+ import { queryMallProducts } from "./ccw-mall/ccw/product/fe/query";
12
13
  import { getCreationDetail } from "./creation/detail";
13
14
  import { getExcellentCreations } from "./creation/excellent/list";
14
15
  import { getCreationIntroduction } from "./creation/introduction/detail";
@@ -96,11 +97,18 @@ import { donateTrade } from "./study-trade/trade/donate";
96
97
  import { getUserProductsPage } from "./user_package/user_product";
97
98
  import { setUserProductStatus } from "./user_package/status";
98
99
  import { updateGreatCreation } from "./great_creation/update";
100
+ import { executeSmartContract } from "./smart_contract/execute";
101
+ import { getSmartContractAccount } from "./smart_contract/account";
102
+ import { getSmartContractDetail } from "./smart_contract/detail";
99
103
  import { getSmartContractList } from "./smart_contract/list";
104
+ import { getConnectCommunityFollowingStatus } from "./extensions/following/status";
105
+ import { getConnectCommunityCreationLikeStatus } from "./extensions/creation-like/detail";
106
+ import { followCreator } from "./study-community/following/follow";
100
107
  export const communityWeb = {
101
108
  acceptAward,
102
109
  donateTrade,
103
110
  encodeShortCode,
111
+ executeSmartContract,
104
112
  createCloudVariable,
105
113
  createComment,
106
114
  createShortUrl,
@@ -108,6 +116,7 @@ export const communityWeb = {
108
116
  decompressShortUrl,
109
117
  deleteComment,
110
118
  foldComment,
119
+ followCreator,
111
120
  getApprovalTags,
112
121
  getCampaignResources,
113
122
  getCcwMainStatus: getCCWMainStatus,
@@ -121,6 +130,7 @@ export const communityWeb = {
121
130
  getCreationDetail,
122
131
  getCreationFavoriteDetail,
123
132
  getCreationIntroduction,
133
+ getConnectCommunityCreationLikeStatus,
124
134
  getCreationRecommendPositionList,
125
135
  getCreationReleasePage,
126
136
  getCreationScreenshotPage,
@@ -129,6 +139,7 @@ export const communityWeb = {
129
139
  getCreatorScore,
130
140
  getDonatedRecordRanking,
131
141
  getExcellentCreations,
142
+ getConnectCommunityFollowingStatus,
132
143
  getEmojiCategoryList,
133
144
  getEmojiPage,
134
145
  getAllEmojis,
@@ -157,6 +168,8 @@ export const communityWeb = {
157
168
  getRemixedCreationPage,
158
169
  getReputationScoreLogPage: getReputationScoreLog,
159
170
  getSearchHotWords,
171
+ getSmartContractAccount,
172
+ getSmartContractDetail,
160
173
  getSmartContractList,
161
174
  getSplitRuleDetail,
162
175
  getSpreadFeedUnreadCount,
@@ -182,6 +195,7 @@ export const communityWeb = {
182
195
  getUserCardDetail,
183
196
  getUserLabelList,
184
197
  getUserProductsPage,
198
+ queryMallProducts,
185
199
  getCreationsByStudent,
186
200
  insertCheckInRecord,
187
201
  likeComment,
@@ -1,7 +1,6 @@
1
1
  import { getPostDetail } from "./detail";
2
2
  test("get post detail", async () => {
3
3
  const detail = await getPostDetail("0173b23d-139d-4c48-ad98-0aa17b5d3b60");
4
- console.log(detail);
5
4
  await expect(detail.title.includes("【公告通知】")).toBeTruthy();
6
5
  });
7
6
  test("error when post detail not found", async () => {
@@ -0,0 +1,13 @@
1
+ import { ccwAxios } from "@ccw-api/axios";
2
+ export const url = "https://community-web.ccw.site/smart_contract/account";
3
+ /**
4
+ * 查询智能合约账户余额
5
+ * @param {number} id 合约 ID
6
+ * @returns {Promise<Res>} 合约账户余额
7
+ */
8
+ export async function getSmartContractAccount(id) {
9
+ const req = { id };
10
+ return await ccwAxios
11
+ .post(url, req)
12
+ .then((res) => res.data.body);
13
+ }
@@ -0,0 +1,4 @@
1
+ import { getSmartContractAccount } from "./account";
2
+ test("should fail without token when getting smart contract account", async () => {
3
+ await expect(getSmartContractAccount(2022277721908162)).rejects.toThrow();
4
+ });
@@ -0,0 +1,13 @@
1
+ import { ccwAxios } from "@ccw-api/axios";
2
+ export const url = "https://community-web.ccw.site/smart_contract/detail";
3
+ /**
4
+ * 获取智能合约详情
5
+ * @param {number} id 合约 ID
6
+ * @returns {Promise<Res>} 合约详情
7
+ */
8
+ export async function getSmartContractDetail(id) {
9
+ const req = { id };
10
+ return await ccwAxios
11
+ .post(url, req)
12
+ .then((res) => res.data.body);
13
+ }
@@ -0,0 +1,4 @@
1
+ import { getSmartContractDetail } from "./detail";
2
+ test("should fail without token when getting smart contract detail", async () => {
3
+ await expect(getSmartContractDetail(2022277721908162)).rejects.toThrow();
4
+ });
@@ -0,0 +1,17 @@
1
+ import { ccwAxios } from "@ccw-api/axios";
2
+ export const url = "https://community-web.ccw.site/smart_contract/execute";
3
+ /**
4
+ * 执行智能合约(投币/领取奖励)
5
+ * @param {MongoDBId} bizId 业务 ID(如作品 OID)
6
+ * @param {SmartContractBizType} bizType 业务类型,CREATION
7
+ * @param {number} id 合约 ID
8
+ * @param {number} ruleId 规则 ID
9
+ * @param {number} bucks 金币数量
10
+ * @returns {Promise<Res>} 执行结果
11
+ */
12
+ export async function executeSmartContract(bizId, id, ruleId, bucks, bizType = "CREATION") {
13
+ const req = { bizId, bizType, id, ruleId, params: { bucks } };
14
+ return await ccwAxios
15
+ .post(url, req)
16
+ .then((res) => res.data.body);
17
+ }
@@ -0,0 +1,4 @@
1
+ import { executeSmartContract } from "./execute";
2
+ test("should fail without token when executing smart contract", async () => {
3
+ await expect(executeSmartContract("6a3fa1ed159ed52f170c34d2", 2022277721908162, 378074, 1)).rejects.toThrow();
4
+ });
@@ -0,0 +1,13 @@
1
+ import { ccwAxios } from "@ccw-api/axios";
2
+ export const url = "https://community-web.ccw.site/study-community/following/follow";
3
+ /**
4
+ * 关注创作者
5
+ * @param {MongoDBId} followingOid 要关注的用户 OID
6
+ * @returns {Promise<Res>} "FOLLOWED" 表示关注成功
7
+ */
8
+ export async function followCreator(followingOid) {
9
+ const req = { followingOid };
10
+ return await ccwAxios
11
+ .post(url, req)
12
+ .then((res) => res.data.body);
13
+ }
@@ -0,0 +1,4 @@
1
+ import { followCreator } from "./follow";
2
+ test("should fail without token when following creator", async () => {
3
+ await expect(followCreator("651e3f7310b0530e7f80fe7a")).rejects.toThrow();
4
+ });
@@ -0,0 +1,16 @@
1
+ import { ccwAxios } from "@ccw-api/axios";
2
+ export const url = "https://community-web-cloud-database.ccw.site/cloud_variable/detail/v2";
3
+ /**
4
+ * 查询云变量详情 V2
5
+ * @param {string} accessKey 访问密钥(如作品 OID)
6
+ * @param {string} primaryKey 主键(如 `${projectId}-u`)
7
+ * @param {string} secondaryKey 次级键
8
+ * @param {string[]} filterKeys 过滤的变量名列表
9
+ * @returns {Promise<Res>} 云变量详情
10
+ */
11
+ export async function getCloudVariableDetailV2(accessKey, primaryKey, secondaryKey, filterKeys) {
12
+ const req = { accessKey, primaryKey, secondaryKey, filterKeys };
13
+ return await ccwAxios
14
+ .post(url, req)
15
+ .then((res) => res.data.body);
16
+ }
@@ -0,0 +1,4 @@
1
+ import { getCloudVariableDetailV2 } from "./v2";
2
+ test("get cloud variable detail v2 should reject with invalid params", async () => {
3
+ await expect(getCloudVariableDetailV2("6a3fa1ed159ed52f170c34d2", "6a3fa1ed159ed52f170c34d2-u", "244373873", ["4576y!!2"])).rejects.toThrow();
4
+ });
@@ -1,5 +1,7 @@
1
1
  import { saveProjectCloudVariable, saveUserCloudVariable, } from "./cloud_variable/save";
2
+ import { getCloudVariableDetailV2 } from "./cloud_variable/detail/v2";
2
3
  export const communityWebCloudDatabase = {
3
4
  saveProjectCloudVariable,
4
5
  saveUserCloudVariable,
6
+ getCloudVariableDetailV2,
5
7
  };
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductCategory = exports.url = void 0;
4
+ exports.queryMallProducts = queryMallProducts;
5
+ const axios_1 = require("@ccw-api/axios");
6
+ const queryPages_1 = require("src/queryPages");
7
+ exports.url = "https://community-web.ccw.site/ccw-mall/ccw/product/fe/query";
8
+ var ProductCategory;
9
+ (function (ProductCategory) {
10
+ ProductCategory[ProductCategory["Merchandise"] = 7] = "Merchandise";
11
+ ProductCategory[ProductCategory["AvatarFrame"] = 5] = "AvatarFrame";
12
+ ProductCategory[ProductCategory["EMOJI"] = 10] = "EMOJI";
13
+ })(ProductCategory || (exports.ProductCategory = ProductCategory = {}));
14
+ /**
15
+ * 分页查询CCW小商店商品列表
16
+ * @param {ProductCategory | undefined} productCategory 商品分类(可选):5=头像框,7=周边商品,10=表情 等
17
+ * @param {Partial<PageArgs<ProductSortField>>} pageArgs_ 分页参数(默认 page=1, perPage=30, sortType="DESC")
18
+ * @returns {Promise<Res>} 商品分页结果 PagesRes<Product>
19
+ */
20
+ async function queryMallProducts(productCategory, pageArgs_ = {
21
+ sortField: "createdAt",
22
+ }) {
23
+ const pageArgs = {
24
+ ...queryPages_1.DEFAULT_PAGE_ARGS,
25
+ ...pageArgs_,
26
+ };
27
+ const queryUrl = (0, queryPages_1.queryPage)(exports.url, pageArgs);
28
+ const req = {
29
+ page: pageArgs.page,
30
+ perPage: pageArgs.perPage,
31
+ sortType: pageArgs.sortType,
32
+ productCategory,
33
+ source: "CCW_OFFICIAL",
34
+ };
35
+ return await axios_1.ccwAxios
36
+ .post(queryUrl, req)
37
+ .then((res) => res.data.body);
38
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const query_1 = require("./query");
4
+ test("query mall product page should fail without token", async () => {
5
+ await expect((0, query_1.queryMallProducts)(7, {
6
+ page: 1,
7
+ perPage: 30,
8
+ sortType: "DESC",
9
+ })).rejects.toThrow();
10
+ });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.url = void 0;
4
+ exports.getConnectCommunityCreationLikeStatus = getConnectCommunityCreationLikeStatus;
5
+ const axios_1 = require("@ccw-api/axios");
6
+ exports.url = "https://community-web.ccw.site/extensions/creation-like/detail";
7
+ /**
8
+ * [连接社区扩展] 查询用户对作品的点赞交互状态
9
+ * @param {MongoDBId} playingCreationOid 当前播放的作品 OID
10
+ * @param {MongoDBId} creationOid 目标作品 OID
11
+ * @returns {Promise<Res>} 点赞状态及作品信息
12
+ */
13
+ async function getConnectCommunityCreationLikeStatus(playingCreationOid, creationOid) {
14
+ const req = { playingCreationOid, creationOid };
15
+ return await axios_1.ccwAxios
16
+ .post(exports.url, req)
17
+ .then((res) => res.data.body);
18
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const detail_1 = require("./detail");
4
+ test("should fail without token when getting creation like status", async () => {
5
+ await expect((0, detail_1.getConnectCommunityCreationLikeStatus)("6a3fa1ed159ed52f170c34d2", "6a3fa1ed159ed52f170c34d2")).rejects.toThrow();
6
+ });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.url = void 0;
4
+ exports.getConnectCommunityFollowingStatus = getConnectCommunityFollowingStatus;
5
+ const axios_1 = require("@ccw-api/axios");
6
+ exports.url = "https://community-web.ccw.site/extensions/following/status";
7
+ /**
8
+ * [连接社区扩展] 查询是否关注了指定创作者
9
+ * @param {MongoDBId} playingCreationOid 当前播放的作品 OID
10
+ * @param {MongoDBId} userOid 目标用户 OID
11
+ * @returns {Promise<Res>} 关注状态及用户信息
12
+ */
13
+ async function getConnectCommunityFollowingStatus(playingCreationOid, userOid) {
14
+ const req = { playingCreationOid, userOid };
15
+ return await axios_1.ccwAxios
16
+ .post(exports.url, req)
17
+ .then((res) => res.data.body);
18
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const status_1 = require("./status");
4
+ test("should fail without token when getting following status", async () => {
5
+ await expect((0, status_1.getConnectCommunityFollowingStatus)("6a3fa1ed159ed52f170c34d2", "651e3f7310b0530e7f80fe7a")).rejects.toThrow();
6
+ });
@@ -12,6 +12,7 @@ const search_1 = require("./cloud_asset/search");
12
12
  const page_1 = require("./comment/page");
13
13
  const page_by_topic_1 = require("./comment/page_by_topic");
14
14
  const detail_3 = require("./config/detail");
15
+ const query_1 = require("./ccw-mall/ccw/product/fe/query");
15
16
  const detail_4 = require("./creation/detail");
16
17
  const list_2 = require("./creation/excellent/list");
17
18
  const detail_5 = require("./creation/introduction/detail");
@@ -99,11 +100,18 @@ const donate_1 = require("./study-trade/trade/donate");
99
100
  const user_product_1 = require("./user_package/user_product");
100
101
  const status_3 = require("./user_package/status");
101
102
  const update_3 = require("./great_creation/update");
103
+ const execute_1 = require("./smart_contract/execute");
104
+ const account_1 = require("./smart_contract/account");
105
+ const detail_21 = require("./smart_contract/detail");
102
106
  const list_15 = require("./smart_contract/list");
107
+ const status_4 = require("./extensions/following/status");
108
+ const detail_22 = require("./extensions/creation-like/detail");
109
+ const follow_1 = require("./study-community/following/follow");
103
110
  exports.communityWeb = {
104
111
  acceptAward: award_1.acceptAward,
105
112
  donateTrade: donate_1.donateTrade,
106
113
  encodeShortCode: encode_1.encodeShortCode,
114
+ executeSmartContract: execute_1.executeSmartContract,
107
115
  createCloudVariable: create_3.createCloudVariable,
108
116
  createComment: create_4.createComment,
109
117
  createShortUrl: create_1.createShortUrl,
@@ -111,6 +119,7 @@ exports.communityWeb = {
111
119
  decompressShortUrl: decompress_1.decompressShortUrl,
112
120
  deleteComment: delete_1.deleteComment,
113
121
  foldComment: fold_1.foldComment,
122
+ followCreator: follow_1.followCreator,
114
123
  getApprovalTags: list_1.getApprovalTags,
115
124
  getCampaignResources: detail_1.getCampaignResources,
116
125
  getCcwMainStatus: status_2.getCCWMainStatus,
@@ -124,6 +133,7 @@ exports.communityWeb = {
124
133
  getCreationDetail: detail_4.getCreationDetail,
125
134
  getCreationFavoriteDetail: detail_10.getCreationFavoriteDetail,
126
135
  getCreationIntroduction: detail_5.getCreationIntroduction,
136
+ getConnectCommunityCreationLikeStatus: detail_22.getConnectCommunityCreationLikeStatus,
127
137
  getCreationRecommendPositionList: list_6.getCreationRecommendPositionList,
128
138
  getCreationReleasePage: page_12.getCreationReleasePage,
129
139
  getCreationScreenshotPage: page_4.getCreationScreenshotPage,
@@ -132,6 +142,7 @@ exports.communityWeb = {
132
142
  getCreatorScore: creator_score_1.getCreatorScore,
133
143
  getDonatedRecordRanking: ranking_list_1.getDonatedRecordRanking,
134
144
  getExcellentCreations: list_2.getExcellentCreations,
145
+ getConnectCommunityFollowingStatus: status_4.getConnectCommunityFollowingStatus,
135
146
  getEmojiCategoryList: list_10.getEmojiCategoryList,
136
147
  getEmojiPage: page_7.getEmojiPage,
137
148
  getAllEmojis: all_1.getAllEmojis,
@@ -160,6 +171,8 @@ exports.communityWeb = {
160
171
  getRemixedCreationPage: page_2.getRemixedCreationPage,
161
172
  getReputationScoreLogPage: page_5.getReputationScoreLog,
162
173
  getSearchHotWords: hot_words_1.getSearchHotWords,
174
+ getSmartContractAccount: account_1.getSmartContractAccount,
175
+ getSmartContractDetail: detail_21.getSmartContractDetail,
163
176
  getSmartContractList: list_15.getSmartContractList,
164
177
  getSplitRuleDetail: detail_18.getSplitRuleDetail,
165
178
  getSpreadFeedUnreadCount: count_1.getSpreadFeedUnreadCount,
@@ -185,6 +198,7 @@ exports.communityWeb = {
185
198
  getUserCardDetail: detail_15.getUserCardDetail,
186
199
  getUserLabelList: list_9.getUserLabelList,
187
200
  getUserProductsPage: user_product_1.getUserProductsPage,
201
+ queryMallProducts: query_1.queryMallProducts,
188
202
  getCreationsByStudent: page_by_student_1.getCreationsByStudent,
189
203
  insertCheckInRecord: insert_1.insertCheckInRecord,
190
204
  likeComment: create_5.likeComment,
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const detail_1 = require("./detail");
4
4
  test("get post detail", async () => {
5
5
  const detail = await (0, detail_1.getPostDetail)("0173b23d-139d-4c48-ad98-0aa17b5d3b60");
6
- console.log(detail);
7
6
  await expect(detail.title.includes("【公告通知】")).toBeTruthy();
8
7
  });
9
8
  test("error when post detail not found", async () => {
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.url = void 0;
4
+ exports.getSmartContractAccount = getSmartContractAccount;
5
+ const axios_1 = require("@ccw-api/axios");
6
+ exports.url = "https://community-web.ccw.site/smart_contract/account";
7
+ /**
8
+ * 查询智能合约账户余额
9
+ * @param {number} id 合约 ID
10
+ * @returns {Promise<Res>} 合约账户余额
11
+ */
12
+ async function getSmartContractAccount(id) {
13
+ const req = { id };
14
+ return await axios_1.ccwAxios
15
+ .post(exports.url, req)
16
+ .then((res) => res.data.body);
17
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const account_1 = require("./account");
4
+ test("should fail without token when getting smart contract account", async () => {
5
+ await expect((0, account_1.getSmartContractAccount)(2022277721908162)).rejects.toThrow();
6
+ });
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.url = void 0;
4
+ exports.getSmartContractDetail = getSmartContractDetail;
5
+ const axios_1 = require("@ccw-api/axios");
6
+ exports.url = "https://community-web.ccw.site/smart_contract/detail";
7
+ /**
8
+ * 获取智能合约详情
9
+ * @param {number} id 合约 ID
10
+ * @returns {Promise<Res>} 合约详情
11
+ */
12
+ async function getSmartContractDetail(id) {
13
+ const req = { id };
14
+ return await axios_1.ccwAxios
15
+ .post(exports.url, req)
16
+ .then((res) => res.data.body);
17
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const detail_1 = require("./detail");
4
+ test("should fail without token when getting smart contract detail", async () => {
5
+ await expect((0, detail_1.getSmartContractDetail)(2022277721908162)).rejects.toThrow();
6
+ });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.url = void 0;
4
+ exports.executeSmartContract = executeSmartContract;
5
+ const axios_1 = require("@ccw-api/axios");
6
+ exports.url = "https://community-web.ccw.site/smart_contract/execute";
7
+ /**
8
+ * 执行智能合约(投币/领取奖励)
9
+ * @param {MongoDBId} bizId 业务 ID(如作品 OID)
10
+ * @param {SmartContractBizType} bizType 业务类型,CREATION
11
+ * @param {number} id 合约 ID
12
+ * @param {number} ruleId 规则 ID
13
+ * @param {number} bucks 金币数量
14
+ * @returns {Promise<Res>} 执行结果
15
+ */
16
+ async function executeSmartContract(bizId, id, ruleId, bucks, bizType = "CREATION") {
17
+ const req = { bizId, bizType, id, ruleId, params: { bucks } };
18
+ return await axios_1.ccwAxios
19
+ .post(exports.url, req)
20
+ .then((res) => res.data.body);
21
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const execute_1 = require("./execute");
4
+ test("should fail without token when executing smart contract", async () => {
5
+ await expect((0, execute_1.executeSmartContract)("6a3fa1ed159ed52f170c34d2", 2022277721908162, 378074, 1)).rejects.toThrow();
6
+ });
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.url = void 0;
4
+ exports.followCreator = followCreator;
5
+ const axios_1 = require("@ccw-api/axios");
6
+ exports.url = "https://community-web.ccw.site/study-community/following/follow";
7
+ /**
8
+ * 关注创作者
9
+ * @param {MongoDBId} followingOid 要关注的用户 OID
10
+ * @returns {Promise<Res>} "FOLLOWED" 表示关注成功
11
+ */
12
+ async function followCreator(followingOid) {
13
+ const req = { followingOid };
14
+ return await axios_1.ccwAxios
15
+ .post(exports.url, req)
16
+ .then((res) => res.data.body);
17
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const follow_1 = require("./follow");
4
+ test("should fail without token when following creator", async () => {
5
+ await expect((0, follow_1.followCreator)("651e3f7310b0530e7f80fe7a")).rejects.toThrow();
6
+ });
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.url = void 0;
4
+ exports.getCloudVariableDetailV2 = getCloudVariableDetailV2;
5
+ const axios_1 = require("@ccw-api/axios");
6
+ exports.url = "https://community-web-cloud-database.ccw.site/cloud_variable/detail/v2";
7
+ /**
8
+ * 查询云变量详情 V2
9
+ * @param {string} accessKey 访问密钥(如作品 OID)
10
+ * @param {string} primaryKey 主键(如 `${projectId}-u`)
11
+ * @param {string} secondaryKey 次级键
12
+ * @param {string[]} filterKeys 过滤的变量名列表
13
+ * @returns {Promise<Res>} 云变量详情
14
+ */
15
+ async function getCloudVariableDetailV2(accessKey, primaryKey, secondaryKey, filterKeys) {
16
+ const req = { accessKey, primaryKey, secondaryKey, filterKeys };
17
+ return await axios_1.ccwAxios
18
+ .post(exports.url, req)
19
+ .then((res) => res.data.body);
20
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const v2_1 = require("./v2");
4
+ test("get cloud variable detail v2 should reject with invalid params", async () => {
5
+ await expect((0, v2_1.getCloudVariableDetailV2)("6a3fa1ed159ed52f170c34d2", "6a3fa1ed159ed52f170c34d2-u", "244373873", ["4576y!!2"])).rejects.toThrow();
6
+ });
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.communityWebCloudDatabase = void 0;
4
4
  const save_1 = require("./cloud_variable/save");
5
+ const v2_1 = require("./cloud_variable/detail/v2");
5
6
  exports.communityWebCloudDatabase = {
6
7
  saveProjectCloudVariable: save_1.saveProjectCloudVariable,
7
8
  saveUserCloudVariable: save_1.saveUserCloudVariable,
9
+ getCloudVariableDetailV2: v2_1.getCloudVariableDetailV2,
8
10
  };