@bitsocial/bitsocial-react-hooks 0.1.57 → 0.1.59
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/CHANGELOG.md +23 -0
- package/dist/lib/validator.d.ts +2 -0
- package/dist/lib/validator.d.ts.map +1 -1
- package/dist/lib/validator.js +29 -0
- package/dist/lib/validator.js.map +1 -1
- package/dist/stores/accounts/accounts-actions.d.ts.map +1 -1
- package/dist/stores/accounts/accounts-actions.js +54 -10
- package/dist/stores/accounts/accounts-actions.js.map +1 -1
- package/dist/stores/accounts/utils.d.ts.map +1 -1
- package/dist/stores/accounts/utils.js +5 -2
- package/dist/stores/accounts/utils.js.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
## [0.1.59](https://github.com/bitsocialnet/bitsocial-react-hooks/compare/v0.1.58...v0.1.59) (2026-10-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **accounts-store:** link previousCommentCid to comments stored by hooks <= 0.1.51 ([#161](https://github.com/bitsocialnet/bitsocial-react-hooks/issues/161)) ([8efb6b5](https://github.com/bitsocialnet/bitsocial-react-hooks/commit/8efb6b597ab14eb90285b398fd6df9e2a0fe3360))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## [0.1.58](https://github.com/bitsocialnet/bitsocial-react-hooks/compare/v0.1.57...v0.1.58) (2026-10-24)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **accounts-store:** keep video dimensions when the audio probe loads first ([eaa808b](https://github.com/bitsocialnet/bitsocial-react-hooks/commit/eaa808b53c8a849a49f884c89a84ac5e6121440f))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **accounts-store:** reject author and community names with uppercase letters ([999dbd2](https://github.com/bitsocialnet/bitsocial-react-hooks/commit/999dbd215af0d20a1c345a1e90c842ab38d1d0d1)), closes [#160](https://github.com/bitsocialnet/bitsocial-react-hooks/issues/160)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
1
24
|
## [0.1.57](https://github.com/bitsocialnet/bitsocial-react-hooks/compare/v0.1.56...v0.1.57) (2026-10-21)
|
|
2
25
|
|
|
3
26
|
|
package/dist/lib/validator.d.ts
CHANGED
|
@@ -3,10 +3,12 @@ declare const validator: {
|
|
|
3
3
|
validateAccountsActionsPublishCommentEditArguments: ({ publishCommentEditOptions, accountName, account, }: any) => void;
|
|
4
4
|
validateAccountsActionsPublishCommentModerationArguments: ({ publishCommentModerationOptions, accountName, account, }: any) => void;
|
|
5
5
|
validateAccountsActionsPublishCommunityEditArguments: ({ communityAddress, publishCommunityEditOptions, accountName, account, }: any) => void;
|
|
6
|
+
validateAccountsActionsCreateCommunityArguments: (createCommunityOptions: any) => void;
|
|
6
7
|
validateAccountsActionsPublishVoteArguments: ({ publishVoteOptions, accountName, account, }: any) => void;
|
|
7
8
|
validateAccountsActionsExportAccountArguments: (accountName: any) => void;
|
|
8
9
|
validateAccountsActionsSetAccountsOrderArguments: (newOrderedAccountNames: any, accountNames: any) => void;
|
|
9
10
|
validateAccountsActionsSetAccountArguments: (account: any) => void;
|
|
11
|
+
validateAccountsActionsSetAccountAuthorName: (author: any, previousAuthor: any) => void;
|
|
10
12
|
validateAccountsActionsSetActiveAccountArguments: (accountName: any) => void;
|
|
11
13
|
validateAccountsDatabaseAddAccountArguments: (account: any) => void;
|
|
12
14
|
validateAccountsDatabaseGetAccountsArguments: (accountIds: any) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/lib/validator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/lib/validator.ts"],"names":[],"mappings":"AAwsBA,QAAA,MAAM,SAAS;uGAlrBZ,GAAG;+GA6HH,GAAG;2HA4CH,GAAG;qIA6FH,GAAG;8EAZ2E,GAAG;iGA/KjF,GAAG;iEAsO8D,GAAG;+EAS7C,GAAG,gBACb,GAAG;0DAQ0C,GAAG;0DArFH,GAAG,kBAAkB,GAAG;oEAgGd,GAAG;2DAuCZ,GAAG;+DA/BC,GAAG;yDAkBT,GAAG;8CA8Bd,GAAG,WAAW,GAAG;gDAQf,GAAG,WAAW,GAAG;8EAgCa,GAAG;0EAUP,GAAG;oGAqC7E,GAAG;iGAqIH,GAAG;qCA3HkC,GAAG;6JAgBxC,GAAG;wEA6CH;QACD,YAAY,CAAC,EAAE,GAAG,CAAC;QACnB,WAAW,CAAC,EAAE,GAAG,CAAC;KACnB;wCAoE0C,GAAG;4CAOlC,GAAG,aACF,GAAG,gBACA,GAAG,iBACF,GAAG,SACX,GAAG,oBACQ,GAAG,iBACN,GAAG,WACT,GAAG;CAmFb,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/dist/lib/validator.js
CHANGED
|
@@ -77,6 +77,32 @@ const validateAccountsActionsPublishCommentModerationArguments = ({ publishComme
|
|
|
77
77
|
assert(publishCommentModerationOptions.commentModeration &&
|
|
78
78
|
typeof publishCommentModerationOptions.commentModeration === "object", "publishCommentModeration publishCommentModerationOptions.commentModeration is not an object");
|
|
79
79
|
};
|
|
80
|
+
// communities reject a domain name with an uppercase letter, the same check as pkc-js
|
|
81
|
+
// doesDomainAddressHaveCapitalLetter. public keys have no "." and are case-sensitive, so they are not checked
|
|
82
|
+
const assertDomainNameIsLowercase = (name, code, message) => {
|
|
83
|
+
if (typeof name === "string" && name.includes(".") && /[A-Z]/.test(name)) {
|
|
84
|
+
const error = new Error(message);
|
|
85
|
+
error.code = code;
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const validateCommunityNameIsLowercase = (options, optionsName) => {
|
|
90
|
+
for (const field of ["name", "address"]) {
|
|
91
|
+
assertDomainNameIsLowercase(options === null || options === void 0 ? void 0 : options[field], "ERR_COMMUNITY_NAME_HAS_CAPITAL_LETTER", `${optionsName}.${field} '${options === null || options === void 0 ? void 0 : options[field]}' has an uppercase letter, community names must be lowercase`);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
// pkc-js publishes author.name, or author.address when the account stores its domain name there. only a
|
|
95
|
+
// changed name is checked, so a name saved before this check does not block unrelated account edits
|
|
96
|
+
const validateAccountsActionsSetAccountAuthorName = (author, previousAuthor) => {
|
|
97
|
+
for (const field of ["name", "address"]) {
|
|
98
|
+
if ((author === null || author === void 0 ? void 0 : author[field]) !== (previousAuthor === null || previousAuthor === void 0 ? void 0 : previousAuthor[field])) {
|
|
99
|
+
assertDomainNameIsLowercase(author === null || author === void 0 ? void 0 : author[field], "ERR_AUTHOR_NAME_HAS_CAPITAL_LETTER", `setAccount account.author.${field} '${author === null || author === void 0 ? void 0 : author[field]}' has an uppercase letter, author names must be lowercase`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const validateAccountsActionsCreateCommunityArguments = (createCommunityOptions) => {
|
|
104
|
+
validateCommunityNameIsLowercase(createCommunityOptions, "createCommunity createCommunityOptions");
|
|
105
|
+
};
|
|
80
106
|
const validateAccountsActionsPublishCommunityEditArguments = ({ communityAddress, publishCommunityEditOptions, accountName, account, }) => {
|
|
81
107
|
assert(!accountName || typeof accountName === "string", `publishCommunityEdit accountName '${accountName}' not a string`);
|
|
82
108
|
assert(accountName !== "", `publishCommunityEdit accountName argument is empty string`);
|
|
@@ -90,6 +116,7 @@ const validateAccountsActionsPublishCommunityEditArguments = ({ communityAddress
|
|
|
90
116
|
assert(typeof communityAddress === "string", "publishCommunityEdit communityAddress not a string");
|
|
91
117
|
assert(!publishCommunityEditOptions.timestamp ||
|
|
92
118
|
typeof publishCommunityEditOptions.timestamp === "number", "publishCommunityEdit publishCommunityEditOptions.timestamp is not a number");
|
|
119
|
+
validateCommunityNameIsLowercase(publishCommunityEditOptions, "publishCommunityEdit publishCommunityEditOptions");
|
|
93
120
|
};
|
|
94
121
|
const validateAccountsActionsExportAccountArguments = (accountName) => {
|
|
95
122
|
assert(typeof accountName === "string", `exportAccount accountName '${accountName}' not a string`);
|
|
@@ -253,10 +280,12 @@ const validator = {
|
|
|
253
280
|
validateAccountsActionsPublishCommentEditArguments,
|
|
254
281
|
validateAccountsActionsPublishCommentModerationArguments,
|
|
255
282
|
validateAccountsActionsPublishCommunityEditArguments,
|
|
283
|
+
validateAccountsActionsCreateCommunityArguments,
|
|
256
284
|
validateAccountsActionsPublishVoteArguments,
|
|
257
285
|
validateAccountsActionsExportAccountArguments,
|
|
258
286
|
validateAccountsActionsSetAccountsOrderArguments,
|
|
259
287
|
validateAccountsActionsSetAccountArguments,
|
|
288
|
+
validateAccountsActionsSetAccountAuthorName,
|
|
260
289
|
validateAccountsActionsSetActiveAccountArguments,
|
|
261
290
|
validateAccountsDatabaseAddAccountArguments,
|
|
262
291
|
validateAccountsDatabaseGetAccountsArguments,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/lib/validator.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,QAAQ,GAAG,CAAC,KAAU,EAAE,EAAE;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,WAAM,CAAC,CAAA,CAAC;IACV,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,8BAA8B,GAAG,CAAC,OAAY,EAAE,EAAE,CACtD,CAAA,OAAO,aA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C","sourcesContent":["import assert from \"./assert\";\nimport { assertCommunityRef } from \"./community-ref\";\n\nconst toString = (value: any) => {\n if (typeof value === \"string\") {\n return value;\n }\n try {\n const string = JSON.stringify(value);\n return string;\n } catch {}\n return value;\n};\n\nconst getPublicationCommunityAddress = (options: any) =>\n options?.communityAddress || options?.communityAddress;\nconst getAccountProtocolClient = (account: any) => account?.pkc || account?.pkc;\n\nconst validateAccountsActionsPublishCommentArguments = ({\n publishCommentOptions,\n accountName,\n account,\n}: any) => {\n assert(\n !accountName || typeof accountName === \"string\",\n `publishComment accountName '${accountName}' not a string`,\n );\n assert(accountName !== \"\", `publishComment accountName argument is empty string`);\n assert(\n !accountName || account,\n `publishComment no account with name '${accountName}' in accountsStore`,\n );\n assert(\n publishCommentOptions && typeof publishCommentOptions === \"object\",\n \"publishComment publishCommentOptions not an object\",\n );\n assert(\n typeof publishCommentOptions.onChallenge === \"function\",\n \"publishComment publishCommentOptions.onChallenge not a function\",\n );\n assert(\n typeof publishCommentOptions.onChallengeVerification === \"function\",\n \"publishComment publishCommentOptions.onChallengeVerification not a function\",\n );\n assert(\n !publishCommentOptions.onError || typeof publishCommentOptions.onError === \"function\",\n \"publishComment publishCommentOptions.onError not a function\",\n );\n assert(\n publishCommentOptions.onPendingComment == null ||\n typeof publishCommentOptions.onPendingComment === \"function\",\n \"publishComment publishCommentOptions.onPendingComment not a function\",\n );\n assert(\n typeof getPublicationCommunityAddress(publishCommentOptions) === \"string\",\n \"publishComment publishCommentOptions.communityAddress/communityAddress not a string\",\n );\n assert(\n !publishCommentOptions.parentCid || typeof publishCommentOptions.parentCid === \"string\",\n \"publishComment publishCommentOptions.parentCid not a string\",\n );\n assert(\n !publishCommentOptions.timestamp || typeof publishCommentOptions.timestamp === \"number\",\n \"publishComment publishCommentOptions.timestamp is not a number\",\n );\n\n // validate content\n assert(\n !publishCommentOptions.content || typeof publishCommentOptions.content === \"string\",\n \"publishComment publishCommentOptions.content not a string\",\n );\n assert(\n publishCommentOptions.content !== \"\",\n \"publishComment publishCommentOptions.content is an empty string\",\n );\n assert(\n !publishCommentOptions.link || typeof publishCommentOptions.link === \"string\",\n \"publishComment publishCommentOptions.link not a string\",\n );\n assert(\n publishCommentOptions.link !== \"\",\n \"publishComment publishCommentOptions.link is an empty string\",\n );\n assert(\n !publishCommentOptions.title || typeof publishCommentOptions.title === \"string\",\n \"publishComment publishCommentOptions.title not a string\",\n );\n assert(\n publishCommentOptions.title !== \"\",\n \"publishComment publishCommentOptions.title is an empty string\",\n );\n};\n\nconst validateAccountsActionsPublishVoteArguments = ({\n publishVoteOptions,\n accountName,\n account,\n}: any) => {\n assert(\n !accountName || typeof accountName === \"string\",\n `publishVote accountName '${accountName}' not a string`,\n );\n assert(accountName !== \"\", `publishVote accountName argument is empty string`);\n assert(\n !accountName || account,\n `publishVote no account with name '${accountName}' in accountsStore`,\n );\n assert(\n publishVoteOptions && typeof publishVoteOptions === \"object\",\n \"publishVote publishVoteOptions not an object\",\n );\n assert(\n typeof publishVoteOptions.onChallenge === \"function\",\n \"publishVote publishVoteOptions.onChallenge not a function\",\n );\n assert(\n typeof publishVoteOptions.onChallengeVerification === \"function\",\n \"publishVote publishVoteOptions.onChallengeVerification not a function\",\n );\n assert(\n !publishVoteOptions.onError || typeof publishVoteOptions.onError === \"function\",\n \"publishVote publishVoteOptions.onError not a function\",\n );\n assert(\n typeof getPublicationCommunityAddress(publishVoteOptions) === \"string\",\n \"publishVote publishVoteOptions.communityAddress/communityAddress not a string\",\n );\n assert(\n typeof publishVoteOptions.commentCid === \"string\",\n \"publishVote publishVoteOptions.commentCid not a string\",\n );\n assert(\n publishVoteOptions.vote === 1 ||\n publishVoteOptions.vote === 0 ||\n publishVoteOptions.vote === -1,\n \"publishVote publishVoteOptions.vote not 1, 0 or -1\",\n );\n assert(\n !publishVoteOptions.timestamp || typeof publishVoteOptions.timestamp === \"number\",\n \"publishVote publishVoteOptions.timestamp is not a number\",\n );\n};\n\nconst validateAccountsActionsPublishCommentEditArguments = ({\n publishCommentEditOptions,\n accountName,\n account,\n}: any) => {\n assert(\n !accountName || typeof accountName === \"string\",\n `publishCommentEdit accountName '${accountName}' not a string`,\n );\n assert(accountName !== \"\", `publishCommentEdit accountName argument is empty string`);\n assert(\n !accountName || account,\n `publishCommentEdit no account with name '${accountName}' in accountsStore`,\n );\n assert(\n publishCommentEditOptions && typeof publishCommentEditOptions === \"object\",\n \"publishCommentEdit publishCommentEditOptions not an object\",\n );\n assert(\n typeof publishCommentEditOptions.onChallenge === \"function\",\n \"publishCommentEdit publishCommentEditOptions.onChallenge not a function\",\n );\n assert(\n typeof publishCommentEditOptions.onChallengeVerification === \"function\",\n \"publishCommentEdit publishCommentEditOptions.onChallengeVerification not a function\",\n );\n assert(\n !publishCommentEditOptions.onError || typeof publishCommentEditOptions.onError === \"function\",\n \"publishCommentEditOptions publishCommentEditOptions.onError not a function\",\n );\n assert(\n typeof getPublicationCommunityAddress(publishCommentEditOptions) === \"string\",\n \"publishCommentEdit publishCommentEditOptions.communityAddress/communityAddress not a string\",\n );\n assert(\n typeof publishCommentEditOptions.commentCid === \"string\",\n \"publishCommentEdit publishCommentEditOptions.commentCid not a string\",\n );\n assert(\n !publishCommentEditOptions.timestamp || typeof publishCommentEditOptions.timestamp === \"number\",\n \"publishCommentEdit publishCommentEditOptions.timestamp is not a number\",\n );\n};\n\nconst validateAccountsActionsPublishCommentModerationArguments = ({\n publishCommentModerationOptions,\n accountName,\n account,\n}: any) => {\n assert(\n !accountName || typeof accountName === \"string\",\n `publishCommentModeration accountName '${accountName}' not a string`,\n );\n assert(accountName !== \"\", `publishCommentModeration accountName argument is empty string`);\n assert(\n !accountName || account,\n `publishCommentModeration no account with name '${accountName}' in accountsStore`,\n );\n assert(\n publishCommentModerationOptions && typeof publishCommentModerationOptions === \"object\",\n \"publishCommentModeration publishCommentModerationOptions not an object\",\n );\n assert(\n typeof publishCommentModerationOptions.onChallenge === \"function\",\n \"publishCommentModeration publishCommentModerationOptions.onChallenge not a function\",\n );\n assert(\n typeof publishCommentModerationOptions.onChallengeVerification === \"function\",\n \"publishCommentModeration publishCommentModerationOptions.onChallengeVerification not a function\",\n );\n assert(\n !publishCommentModerationOptions.onError ||\n typeof publishCommentModerationOptions.onError === \"function\",\n \"publishCommentModerationOptions publishCommentModerationOptions.onError not a function\",\n );\n assert(\n typeof getPublicationCommunityAddress(publishCommentModerationOptions) === \"string\",\n \"publishCommentModeration publishCommentModerationOptions.communityAddress/communityAddress not a string\",\n );\n assert(\n typeof publishCommentModerationOptions.commentCid === \"string\",\n \"publishCommentModeration publishCommentModerationOptions.commentCid not a string\",\n );\n assert(\n !publishCommentModerationOptions.timestamp ||\n typeof publishCommentModerationOptions.timestamp === \"number\",\n \"publishCommentModeration publishCommentModerationOptions.timestamp is not a number\",\n );\n assert(\n publishCommentModerationOptions.commentModeration &&\n typeof publishCommentModerationOptions.commentModeration === \"object\",\n \"publishCommentModeration publishCommentModerationOptions.commentModeration is not an object\",\n );\n};\n\nconst validateAccountsActionsPublishCommunityEditArguments = ({\n communityAddress,\n publishCommunityEditOptions,\n accountName,\n account,\n}: any) => {\n assert(\n !accountName || typeof accountName === \"string\",\n `publishCommunityEdit accountName '${accountName}' not a string`,\n );\n assert(accountName !== \"\", `publishCommunityEdit accountName argument is empty string`);\n assert(\n !accountName || account,\n `publishCommunityEdit no account with name '${accountName}' in accountsStore`,\n );\n assert(\n publishCommunityEditOptions && typeof publishCommunityEditOptions === \"object\",\n \"publishCommunityEdit publishCommunityEditOptions not an object\",\n );\n assert(\n typeof publishCommunityEditOptions.onChallenge === \"function\",\n \"publishCommunityEdit publishCommunityEditOptions.onChallenge not a function\",\n );\n assert(\n typeof publishCommunityEditOptions.onChallengeVerification === \"function\",\n \"publishCommunityEdit publishCommunityEditOptions.onChallengeVerification not a function\",\n );\n assert(\n !publishCommunityEditOptions.onError ||\n typeof publishCommunityEditOptions.onError === \"function\",\n \"publishCommunityEdit publishCommunityEditOptions.onError not a function\",\n );\n assert(communityAddress !== \"\", `publishCommunityEdit communityAddress argument is empty string`);\n assert(\n typeof communityAddress === \"string\",\n \"publishCommunityEdit communityAddress not a string\",\n );\n assert(\n !publishCommunityEditOptions.timestamp ||\n typeof publishCommunityEditOptions.timestamp === \"number\",\n \"publishCommunityEdit publishCommunityEditOptions.timestamp is not a number\",\n );\n};\n\nconst validateAccountsActionsExportAccountArguments = (accountName: any) => {\n assert(\n typeof accountName === \"string\",\n `exportAccount accountName '${accountName}' not a string`,\n );\n assert(accountName !== \"\", `exportAccount accountName argument is empty string`);\n};\n\nconst validateAccountsActionsSetAccountsOrderArguments = (\n newOrderedAccountNames: any,\n accountNames: any,\n) => {\n assert(\n JSON.stringify([...accountNames].sort()) === JSON.stringify([...newOrderedAccountNames].sort()),\n `previous account names '${accountNames} contain different account names than argument newOrderedAccountNames '${newOrderedAccountNames}'`,\n );\n};\n\nconst validateAccountsActionsSetAccountArguments = (account: any) => {\n assert(account && typeof account === \"object\", `setAccount account '${account}' not an object`);\n assert(\n typeof account.name === \"string\",\n `setAccount account.name '${account.name}' not a string`,\n );\n assert(account.name !== \"\", `setAccount account.name is empty string`);\n assert(typeof account.id === \"string\", `setAccount account.id '${account.id}' not a string`);\n assert(account.id !== \"\", `setAccount account.id is empty string`);\n};\n\nconst validateAccountsActionsSetActiveAccountArguments = (accountName: any) => {\n assert(\n typeof accountName === \"string\",\n `setActiveAccountName accountName '${accountName}' not a string`,\n );\n assert(accountName !== \"\", `setActiveAccountName accountName argument is empty string`);\n};\n\nconst validateAccountsDatabaseGetAccountsArguments = (accountIds: any) => {\n assert(\n Array.isArray(accountIds),\n `accountsDatabase.getAccounts accountIds '${accountIds}' not an array`,\n );\n assert(accountIds.length > 0, `accountsDatabase.getAccounts accountIds array is empty`);\n for (const accountId of accountIds) {\n assert(\n typeof accountId === \"string\",\n `accountsDatabase.getAccountsaccountIds '${accountIds}' accountId '${accountId}' not a string`,\n );\n assert(\n accountId !== \"\",\n `accountsDatabase.getAccounts accountIds '${accountIds}' an accountId argument is empty string`,\n );\n }\n};\n\nconst validateAccountsDatabaseAccountNames = (accountNames: any) => {\n assert(\n Array.isArray(accountNames),\n `accountsDatabase accountNames '${accountNames}' not an array`,\n );\n for (const accountName of accountNames) {\n assert(\n typeof accountName === \"string\",\n `accountsDatabase accountNames '${accountNames}' accountName '${accountName}' not a string`,\n );\n }\n};\n\nconst validateAccountsDatabaseAddAccountArguments = (account: any) => {\n assert(\n account && typeof account === \"object\",\n `accountsDatabase.addAccount '${account}' not an object`,\n );\n assert(\n typeof account.name === \"string\",\n `accountsDatabase.addAccount account.name '${account.name}' not a string`,\n );\n assert(account.name !== \"\", `accountsDatabase.addAccount account.name is empty string`);\n assert(\n typeof account.id === \"string\",\n `accountsDatabase.addAccount account.id '${account.id}' not a string`,\n );\n assert(account.id !== \"\", `accountsDatabase.addAccount account.id is empty string`);\n};\n\nconst validateUseCommentArguments = (commentCid: any, account: any) => {\n assert(typeof commentCid === \"string\", `useComment commentCid '${commentCid}' not a string`);\n assert(\n getAccountProtocolClient(account) && typeof getAccountProtocolClient(account) === \"object\",\n `useComment account.pkc/account.pkc '${getAccountProtocolClient(account)}' not an object`,\n );\n};\n\nconst validateUseCommentsArguments = (commentCids: any, account: any) => {\n assert(\n Array.isArray(commentCids),\n `useComment commentCids '${toString(commentCids)}' not an array`,\n );\n for (const commentCid of commentCids) {\n assert(\n typeof commentCid === \"string\",\n `useComments commentCids '${toString(commentCids)}' commentCid '${toString(commentCid)}' not a string`,\n );\n }\n assert(\n getAccountProtocolClient(account) && typeof getAccountProtocolClient(account) === \"object\",\n `useComments account.pkc/account.pkc '${getAccountProtocolClient(account)}' not an object`,\n );\n};\n\nconst validateCommunityIdentifierArguments = (\n community: any,\n legacyCommunityAddress: any,\n scope: string,\n) => {\n assert(\n legacyCommunityAddress === undefined,\n `${scope} communityAddress has been removed, pass { community: { name, publicKey } }`,\n );\n if (community === undefined) {\n return;\n }\n assertCommunityRef(community, `${scope} community`);\n};\n\nconst validateUseCommunityArguments = ({ community, communityAddress, account }: any) => {\n validateCommunityIdentifierArguments(community, communityAddress, \"useCommunity\");\n if (account !== undefined && account !== null) {\n assert(\n getAccountProtocolClient(account) && typeof getAccountProtocolClient(account) === \"object\",\n `useCommunity account.pkc/account.pkc '${getAccountProtocolClient(account)}' not an object`,\n );\n }\n};\n\nconst validateUseCommunityStatsArguments = ({ community, communityAddress }: any) => {\n validateCommunityIdentifierArguments(community, communityAddress, \"useCommunityStats\");\n};\n\nconst validateCommunitiesArguments = (\n communities: any,\n communityRefs: any,\n communityAddresses: any,\n scope: string,\n) => {\n assert(\n communityRefs === undefined,\n `${scope} communityRefs has been removed, pass communities instead`,\n );\n assert(\n communityAddresses === undefined,\n `${scope} communityAddresses has been removed, pass communities instead`,\n );\n if (communities !== undefined) {\n assert(\n Array.isArray(communities),\n `${scope} communities '${toString(communities)}' not an array`,\n );\n for (const community of communities) {\n assertCommunityRef(\n community,\n `${scope} communities '${toString(communities)}' community '${toString(community)}'`,\n );\n }\n }\n};\n\nconst validateUseCommunitiesArguments = ({\n communities,\n communityRefs,\n communityAddresses,\n account,\n}: any) => {\n validateCommunitiesArguments(communities, communityRefs, communityAddresses, \"useCommunities\");\n if (account !== undefined && account !== null) {\n assert(\n getAccountProtocolClient(account) && typeof getAccountProtocolClient(account) === \"object\",\n `useCommunity account.pkc/account.pkc '${getAccountProtocolClient(account)}' not an object`,\n );\n }\n};\n\nconst validateFeedSortType = (sortType: any) => {\n assert(\n sortType === undefined || (typeof sortType === \"string\" && sortType.length > 0),\n `invalid feed sort type '${sortType}'`,\n );\n};\nconst validateUseFeedArguments = ({\n communities,\n communityRefs,\n communityAddresses,\n sortType,\n accountName,\n postsPerPage,\n filter,\n newerThan,\n accountComments,\n}: any) => {\n validateCommunitiesArguments(communities, communityRefs, communityAddresses, \"useFeed\");\n assert(\n sortType === undefined || (typeof sortType === \"string\" && sortType.length > 0),\n `useFeed sortType argument '${sortType}' invalid`,\n );\n if (accountName) {\n assert(\n typeof accountName === \"string\",\n `useFeed accountName argument '${accountName}' not a string`,\n );\n }\n if (postsPerPage !== undefined && postsPerPage !== null) {\n assert(\n typeof postsPerPage === \"number\",\n `useFeed postsPerPage argument '${postsPerPage}' not a number`,\n );\n }\n if (filter) {\n assert(\n typeof filter.filter === \"function\",\n `useFeed filter.filter argument '${filter.filter}' not a function, useFeedOptions.filter is now an object Filter {filter: (comment: Comment) => Boolean, key: string}`,\n );\n assert(\n typeof filter.key === \"string\",\n `useFeed filter.key argument '${filter.key}' not a string, a unique filter.key is now required to cache the filter`,\n );\n }\n if (newerThan !== undefined && newerThan !== null) {\n assert(typeof newerThan === \"number\", `useFeed newerThan argument '${newerThan}' not a number`);\n }\n if (accountComments) {\n assert(\n typeof accountComments === \"object\",\n `useFeed accountComments argument '${accountComments}' not an object`,\n );\n assert(\n typeof accountComments.newerThan === \"number\",\n `useFeed accountComments.newerThan argument '${accountComments}' not a number`,\n );\n }\n};\nconst validateUseBufferedFeedsArguments = ({\n feedsOptions,\n accountName,\n}: {\n feedsOptions?: any;\n accountName?: any;\n}) => {\n assert(\n Array.isArray(feedsOptions),\n `useBufferedFeeds feedsOptions argument '${toString(feedsOptions)}' not an array`,\n );\n for (const {\n communities,\n communityRefs,\n communityAddresses,\n sortType,\n postsPerPage,\n filter,\n newerThan,\n } of feedsOptions) {\n validateCommunitiesArguments(\n communities,\n communityRefs,\n communityAddresses,\n \"useBufferedFeeds feedOptions\",\n );\n assert(\n sortType === undefined || (typeof sortType === \"string\" && sortType.length > 0),\n `useBufferedFeeds feedOptions.sortType argument '${sortType}' invalid`,\n );\n if (postsPerPage !== undefined && postsPerPage !== null) {\n assert(\n typeof postsPerPage === \"number\",\n `useBufferedFeeds feedOptions.postsPerPage argument '${postsPerPage}' not a number`,\n );\n }\n if (filter) {\n assert(\n typeof filter.filter === \"function\",\n `useBufferedFeeds feedOptions.filter.filter argument '${filter.filter}' not a function, useFeedOptions.filter is now an object Filter {filter: (comment: Comment) => Boolean, key: string}`,\n );\n assert(\n typeof filter.key === \"string\",\n `useBufferedFeeds feedOptions.filter.key argument '${filter.key}' not a string, a unique filter.key is now required to cache the filter`,\n );\n }\n if (newerThan !== undefined && newerThan !== null) {\n assert(\n typeof newerThan === \"number\",\n `useBufferedFeeds feedOptions.newerThan argument '${newerThan}' not a number`,\n );\n }\n }\n if (accountName) {\n assert(\n typeof accountName === \"string\",\n `useBufferedFeeds accountName argument '${accountName}' not a string`,\n );\n }\n};\n\nconst validateUseCommunitiesStatesArguments = ({\n communities,\n communityRefs,\n communityAddresses,\n}: any) => {\n validateCommunitiesArguments(\n communities,\n communityRefs,\n communityAddresses,\n \"useCommunitiesStates\",\n );\n};\n\nconst validateRepliesSortType = (sortType: any) => {\n assert(\n sortType === undefined || (typeof sortType === \"string\" && sortType.length > 0),\n `invalid replies sort type '${sortType}'`,\n );\n};\nconst validateUseRepliesArguments = (\n comment?: any,\n sortType?: any,\n accountName?: any,\n onlyIfCached?: any,\n flat?: any,\n accountComments?: any,\n postsPerPage?: any,\n filter?: any,\n) => {\n assert(\n !comment || typeof comment === \"object\",\n `useReplies comment argument '${comment}' not an object`,\n );\n assert(\n !comment?.cid || typeof comment.cid === \"string\",\n `useReplies comment.cid argument '${comment?.cid}' not a string`,\n );\n assert(\n sortType === undefined || (typeof sortType === \"string\" && sortType.length > 0),\n `useReplies sortType argument '${sortType}' invalid`,\n );\n if (accountName) {\n assert(\n typeof accountName === \"string\",\n `useReplies accountName argument '${accountName}' not a string`,\n );\n }\n if (onlyIfCached !== undefined && onlyIfCached !== null) {\n assert(\n typeof onlyIfCached === \"boolean\",\n `useReplies onlyIfCached argument '${onlyIfCached}' not a boolean`,\n );\n }\n if (postsPerPage !== undefined && postsPerPage !== null) {\n assert(\n typeof postsPerPage === \"number\",\n `useReplies postsPerPage argument '${postsPerPage}' not a number`,\n );\n }\n if (flat !== undefined && flat !== null) {\n assert(typeof flat === \"boolean\", `useReplies flat argument '${flat}' not a boolean`);\n }\n if (accountComments !== undefined && accountComments !== null) {\n assert(\n typeof accountComments.newerThan === \"number\",\n `useReplies accountComments.newerThan argument '${accountComments.newerThan}' not a number`,\n );\n assert(\n !accountComments.append || typeof accountComments.append === \"boolean\",\n `useReplies accountComments.append argument '${accountComments.append}' not a boolean`,\n );\n }\n if (filter) {\n assert(\n typeof filter.filter === \"function\",\n `useReplies filter.filter argument '${filter.filter}' not a function, useRepliesOptions.filter is now an object Filter {filter: (comment: Comment) => Boolean, key: string}`,\n );\n assert(\n typeof filter.key === \"string\",\n `useReplies filter.key argument '${filter.key}' not a string, a unique filter.key is now required to cache the filter`,\n );\n }\n};\n\nconst validator = {\n validateAccountsActionsPublishCommentArguments,\n validateAccountsActionsPublishCommentEditArguments,\n validateAccountsActionsPublishCommentModerationArguments,\n validateAccountsActionsPublishCommunityEditArguments,\n validateAccountsActionsPublishVoteArguments,\n validateAccountsActionsExportAccountArguments,\n validateAccountsActionsSetAccountsOrderArguments,\n validateAccountsActionsSetAccountArguments,\n validateAccountsActionsSetActiveAccountArguments,\n validateAccountsDatabaseAddAccountArguments,\n validateAccountsDatabaseGetAccountsArguments,\n validateAccountsDatabaseAccountNames,\n validateUseCommentArguments,\n validateUseCommentsArguments,\n validateUseCommunityArguments,\n validateUseCommunityStatsArguments,\n validateUseCommunitiesArguments,\n validateUseCommunitiesStatesArguments,\n validateFeedSortType,\n validateUseFeedArguments,\n validateUseBufferedFeedsArguments,\n validateRepliesSortType,\n validateUseRepliesArguments,\n};\n\nexport default validator;\n"]}
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/lib/validator.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,QAAQ,GAAG,CAAC,KAAU,EAAE,EAAE;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI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mCAAmC,MAAM,CAAC,GAAG,yEAAyE,CACvH,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG;IAChB,8CAA8C;IAC9C,kDAAkD;IAClD,wDAAwD;IACxD,oDAAoD;IACpD,+CAA+C;IAC/C,2CAA2C;IAC3C,6CAA6C;IAC7C,gDAAgD;IAChD,0CAA0C;IAC1C,2CAA2C;IAC3C,gDAAgD;IAChD,2CAA2C;IAC3C,4CAA4C;IAC5C,oCAAoC;IACpC,2BAA2B;IAC3B,4BAA4B;IAC5B,6BAA6B;IAC7B,kCAAkC;IAClC,+BAA+B;IAC/B,qCAAqC;IACrC,oBAAoB;IACpB,wBAAwB;IACxB,iCAAiC;IACjC,uBAAuB;IACvB,2BAA2B;CAC5B,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import assert from \"./assert\";\nimport { assertCommunityRef } from \"./community-ref\";\n\nconst toString = (value: any) => {\n if (typeof value === \"string\") {\n return value;\n }\n try {\n const string = JSON.stringify(value);\n return string;\n } catch {}\n return value;\n};\n\nconst getPublicationCommunityAddress = (options: any) =>\n options?.communityAddress || options?.communityAddress;\nconst getAccountProtocolClient = (account: any) => account?.pkc || account?.pkc;\n\nconst validateAccountsActionsPublishCommentArguments = ({\n publishCommentOptions,\n accountName,\n account,\n}: any) => {\n assert(\n !accountName || typeof accountName === \"string\",\n `publishComment accountName '${accountName}' not a string`,\n );\n assert(accountName !== \"\", `publishComment accountName argument is empty string`);\n assert(\n !accountName || account,\n `publishComment no account with name '${accountName}' in accountsStore`,\n );\n assert(\n publishCommentOptions && typeof publishCommentOptions === \"object\",\n \"publishComment publishCommentOptions not an object\",\n );\n assert(\n typeof publishCommentOptions.onChallenge === \"function\",\n \"publishComment publishCommentOptions.onChallenge not a function\",\n );\n assert(\n typeof publishCommentOptions.onChallengeVerification === \"function\",\n \"publishComment publishCommentOptions.onChallengeVerification not a function\",\n );\n assert(\n !publishCommentOptions.onError || typeof publishCommentOptions.onError === \"function\",\n \"publishComment publishCommentOptions.onError not a function\",\n );\n assert(\n publishCommentOptions.onPendingComment == null ||\n typeof publishCommentOptions.onPendingComment === \"function\",\n \"publishComment publishCommentOptions.onPendingComment not a function\",\n );\n assert(\n typeof getPublicationCommunityAddress(publishCommentOptions) === \"string\",\n \"publishComment publishCommentOptions.communityAddress/communityAddress not a string\",\n );\n assert(\n !publishCommentOptions.parentCid || typeof publishCommentOptions.parentCid === \"string\",\n \"publishComment publishCommentOptions.parentCid not a string\",\n );\n assert(\n !publishCommentOptions.timestamp || typeof publishCommentOptions.timestamp === \"number\",\n \"publishComment publishCommentOptions.timestamp is not a number\",\n );\n\n // validate content\n assert(\n !publishCommentOptions.content || typeof publishCommentOptions.content === \"string\",\n \"publishComment publishCommentOptions.content not a string\",\n );\n assert(\n publishCommentOptions.content !== \"\",\n \"publishComment publishCommentOptions.content is an empty string\",\n );\n assert(\n !publishCommentOptions.link || typeof publishCommentOptions.link === \"string\",\n \"publishComment publishCommentOptions.link not a string\",\n );\n assert(\n publishCommentOptions.link !== \"\",\n \"publishComment publishCommentOptions.link is an empty string\",\n );\n assert(\n !publishCommentOptions.title || typeof publishCommentOptions.title === \"string\",\n \"publishComment publishCommentOptions.title not a string\",\n );\n assert(\n publishCommentOptions.title !== \"\",\n \"publishComment publishCommentOptions.title is an empty string\",\n );\n};\n\nconst validateAccountsActionsPublishVoteArguments = ({\n publishVoteOptions,\n accountName,\n account,\n}: any) => {\n assert(\n !accountName || typeof accountName === \"string\",\n `publishVote accountName '${accountName}' not a string`,\n );\n assert(accountName !== \"\", `publishVote accountName argument is empty string`);\n assert(\n !accountName || account,\n `publishVote no account with name '${accountName}' in accountsStore`,\n );\n assert(\n publishVoteOptions && typeof publishVoteOptions === \"object\",\n \"publishVote publishVoteOptions not an object\",\n );\n assert(\n typeof publishVoteOptions.onChallenge === \"function\",\n \"publishVote publishVoteOptions.onChallenge not a function\",\n );\n assert(\n typeof publishVoteOptions.onChallengeVerification === \"function\",\n \"publishVote publishVoteOptions.onChallengeVerification not a function\",\n );\n assert(\n !publishVoteOptions.onError || typeof publishVoteOptions.onError === \"function\",\n \"publishVote publishVoteOptions.onError not a function\",\n );\n assert(\n typeof getPublicationCommunityAddress(publishVoteOptions) === \"string\",\n \"publishVote publishVoteOptions.communityAddress/communityAddress not a string\",\n );\n assert(\n typeof publishVoteOptions.commentCid === \"string\",\n \"publishVote publishVoteOptions.commentCid not a string\",\n );\n assert(\n publishVoteOptions.vote === 1 ||\n publishVoteOptions.vote === 0 ||\n publishVoteOptions.vote === -1,\n \"publishVote publishVoteOptions.vote not 1, 0 or -1\",\n );\n assert(\n !publishVoteOptions.timestamp || typeof publishVoteOptions.timestamp === \"number\",\n \"publishVote publishVoteOptions.timestamp is not a number\",\n );\n};\n\nconst validateAccountsActionsPublishCommentEditArguments = ({\n publishCommentEditOptions,\n accountName,\n account,\n}: any) => {\n assert(\n !accountName || typeof accountName === \"string\",\n `publishCommentEdit accountName '${accountName}' not a string`,\n );\n assert(accountName !== \"\", `publishCommentEdit accountName argument is empty string`);\n assert(\n !accountName || account,\n `publishCommentEdit no account with name '${accountName}' in accountsStore`,\n );\n assert(\n publishCommentEditOptions && typeof publishCommentEditOptions === \"object\",\n \"publishCommentEdit publishCommentEditOptions not an object\",\n );\n assert(\n typeof publishCommentEditOptions.onChallenge === \"function\",\n \"publishCommentEdit publishCommentEditOptions.onChallenge not a function\",\n );\n assert(\n typeof publishCommentEditOptions.onChallengeVerification === \"function\",\n \"publishCommentEdit publishCommentEditOptions.onChallengeVerification not a function\",\n );\n assert(\n !publishCommentEditOptions.onError || typeof publishCommentEditOptions.onError === \"function\",\n \"publishCommentEditOptions publishCommentEditOptions.onError not a function\",\n );\n assert(\n typeof getPublicationCommunityAddress(publishCommentEditOptions) === \"string\",\n \"publishCommentEdit publishCommentEditOptions.communityAddress/communityAddress not a string\",\n );\n assert(\n typeof publishCommentEditOptions.commentCid === \"string\",\n \"publishCommentEdit publishCommentEditOptions.commentCid not a string\",\n );\n assert(\n !publishCommentEditOptions.timestamp || typeof publishCommentEditOptions.timestamp === \"number\",\n \"publishCommentEdit publishCommentEditOptions.timestamp is not a number\",\n );\n};\n\nconst validateAccountsActionsPublishCommentModerationArguments = ({\n publishCommentModerationOptions,\n accountName,\n account,\n}: any) => {\n assert(\n !accountName || typeof accountName === \"string\",\n `publishCommentModeration accountName '${accountName}' not a string`,\n );\n assert(accountName !== \"\", `publishCommentModeration accountName argument is empty string`);\n assert(\n !accountName || account,\n `publishCommentModeration no account with name '${accountName}' in accountsStore`,\n );\n assert(\n publishCommentModerationOptions && typeof publishCommentModerationOptions === \"object\",\n \"publishCommentModeration publishCommentModerationOptions not an object\",\n );\n assert(\n typeof publishCommentModerationOptions.onChallenge === \"function\",\n \"publishCommentModeration publishCommentModerationOptions.onChallenge not a function\",\n );\n assert(\n typeof publishCommentModerationOptions.onChallengeVerification === \"function\",\n \"publishCommentModeration publishCommentModerationOptions.onChallengeVerification not a function\",\n );\n assert(\n !publishCommentModerationOptions.onError ||\n typeof publishCommentModerationOptions.onError === \"function\",\n \"publishCommentModerationOptions publishCommentModerationOptions.onError not a function\",\n );\n assert(\n typeof getPublicationCommunityAddress(publishCommentModerationOptions) === \"string\",\n \"publishCommentModeration publishCommentModerationOptions.communityAddress/communityAddress not a string\",\n );\n assert(\n typeof publishCommentModerationOptions.commentCid === \"string\",\n \"publishCommentModeration publishCommentModerationOptions.commentCid not a string\",\n );\n assert(\n !publishCommentModerationOptions.timestamp ||\n typeof publishCommentModerationOptions.timestamp === \"number\",\n \"publishCommentModeration publishCommentModerationOptions.timestamp is not a number\",\n );\n assert(\n publishCommentModerationOptions.commentModeration &&\n typeof publishCommentModerationOptions.commentModeration === \"object\",\n \"publishCommentModeration publishCommentModerationOptions.commentModeration is not an object\",\n );\n};\n\n// communities reject a domain name with an uppercase letter, the same check as pkc-js\n// doesDomainAddressHaveCapitalLetter. public keys have no \".\" and are case-sensitive, so they are not checked\nconst assertDomainNameIsLowercase = (name: unknown, code: string, message: string) => {\n if (typeof name === \"string\" && name.includes(\".\") && /[A-Z]/.test(name)) {\n const error: Error & { code?: string } = new Error(message);\n error.code = code;\n throw error;\n }\n};\n\nconst validateCommunityNameIsLowercase = (options: any, optionsName: string) => {\n for (const field of [\"name\", \"address\"]) {\n assertDomainNameIsLowercase(\n options?.[field],\n \"ERR_COMMUNITY_NAME_HAS_CAPITAL_LETTER\",\n `${optionsName}.${field} '${options?.[field]}' has an uppercase letter, community names must be lowercase`,\n );\n }\n};\n\n// pkc-js publishes author.name, or author.address when the account stores its domain name there. only a\n// changed name is checked, so a name saved before this check does not block unrelated account edits\nconst validateAccountsActionsSetAccountAuthorName = (author: any, previousAuthor: any) => {\n for (const field of [\"name\", \"address\"]) {\n if (author?.[field] !== previousAuthor?.[field]) {\n assertDomainNameIsLowercase(\n author?.[field],\n \"ERR_AUTHOR_NAME_HAS_CAPITAL_LETTER\",\n `setAccount account.author.${field} '${author?.[field]}' has an uppercase letter, author names must be lowercase`,\n );\n }\n }\n};\n\nconst validateAccountsActionsCreateCommunityArguments = (createCommunityOptions: any) => {\n validateCommunityNameIsLowercase(\n createCommunityOptions,\n \"createCommunity createCommunityOptions\",\n );\n};\n\nconst validateAccountsActionsPublishCommunityEditArguments = ({\n communityAddress,\n publishCommunityEditOptions,\n accountName,\n account,\n}: any) => {\n assert(\n !accountName || typeof accountName === \"string\",\n `publishCommunityEdit accountName '${accountName}' not a string`,\n );\n assert(accountName !== \"\", `publishCommunityEdit accountName argument is empty string`);\n assert(\n !accountName || account,\n `publishCommunityEdit no account with name '${accountName}' in accountsStore`,\n );\n assert(\n publishCommunityEditOptions && typeof publishCommunityEditOptions === \"object\",\n \"publishCommunityEdit publishCommunityEditOptions not an object\",\n );\n assert(\n typeof publishCommunityEditOptions.onChallenge === \"function\",\n \"publishCommunityEdit publishCommunityEditOptions.onChallenge not a function\",\n );\n assert(\n typeof publishCommunityEditOptions.onChallengeVerification === \"function\",\n \"publishCommunityEdit publishCommunityEditOptions.onChallengeVerification not a function\",\n );\n assert(\n !publishCommunityEditOptions.onError ||\n typeof publishCommunityEditOptions.onError === \"function\",\n \"publishCommunityEdit publishCommunityEditOptions.onError not a function\",\n );\n assert(communityAddress !== \"\", `publishCommunityEdit communityAddress argument is empty string`);\n assert(\n typeof communityAddress === \"string\",\n \"publishCommunityEdit communityAddress not a string\",\n );\n assert(\n !publishCommunityEditOptions.timestamp ||\n typeof publishCommunityEditOptions.timestamp === \"number\",\n \"publishCommunityEdit publishCommunityEditOptions.timestamp is not a number\",\n );\n validateCommunityNameIsLowercase(\n publishCommunityEditOptions,\n \"publishCommunityEdit publishCommunityEditOptions\",\n );\n};\n\nconst validateAccountsActionsExportAccountArguments = (accountName: any) => {\n assert(\n typeof accountName === \"string\",\n `exportAccount accountName '${accountName}' not a string`,\n );\n assert(accountName !== \"\", `exportAccount accountName argument is empty string`);\n};\n\nconst validateAccountsActionsSetAccountsOrderArguments = (\n newOrderedAccountNames: any,\n accountNames: any,\n) => {\n assert(\n JSON.stringify([...accountNames].sort()) === JSON.stringify([...newOrderedAccountNames].sort()),\n `previous account names '${accountNames} contain different account names than argument newOrderedAccountNames '${newOrderedAccountNames}'`,\n );\n};\n\nconst validateAccountsActionsSetAccountArguments = (account: any) => {\n assert(account && typeof account === \"object\", `setAccount account '${account}' not an object`);\n assert(\n typeof account.name === \"string\",\n `setAccount account.name '${account.name}' not a string`,\n );\n assert(account.name !== \"\", `setAccount account.name is empty string`);\n assert(typeof account.id === \"string\", `setAccount account.id '${account.id}' not a string`);\n assert(account.id !== \"\", `setAccount account.id is empty string`);\n};\n\nconst validateAccountsActionsSetActiveAccountArguments = (accountName: any) => {\n assert(\n typeof accountName === \"string\",\n `setActiveAccountName accountName '${accountName}' not a string`,\n );\n assert(accountName !== \"\", `setActiveAccountName accountName argument is empty string`);\n};\n\nconst validateAccountsDatabaseGetAccountsArguments = (accountIds: any) => {\n assert(\n Array.isArray(accountIds),\n `accountsDatabase.getAccounts accountIds '${accountIds}' not an array`,\n );\n assert(accountIds.length > 0, `accountsDatabase.getAccounts accountIds array is empty`);\n for (const accountId of accountIds) {\n assert(\n typeof accountId === \"string\",\n `accountsDatabase.getAccountsaccountIds '${accountIds}' accountId '${accountId}' not a string`,\n );\n assert(\n accountId !== \"\",\n `accountsDatabase.getAccounts accountIds '${accountIds}' an accountId argument is empty string`,\n );\n }\n};\n\nconst validateAccountsDatabaseAccountNames = (accountNames: any) => {\n assert(\n Array.isArray(accountNames),\n `accountsDatabase accountNames '${accountNames}' not an array`,\n );\n for (const accountName of accountNames) {\n assert(\n typeof accountName === \"string\",\n `accountsDatabase accountNames '${accountNames}' accountName '${accountName}' not a string`,\n );\n }\n};\n\nconst validateAccountsDatabaseAddAccountArguments = (account: any) => {\n assert(\n account && typeof account === \"object\",\n `accountsDatabase.addAccount '${account}' not an object`,\n );\n assert(\n typeof account.name === \"string\",\n `accountsDatabase.addAccount account.name '${account.name}' not a string`,\n );\n assert(account.name !== \"\", `accountsDatabase.addAccount account.name is empty string`);\n assert(\n typeof account.id === \"string\",\n `accountsDatabase.addAccount account.id '${account.id}' not a string`,\n );\n assert(account.id !== \"\", `accountsDatabase.addAccount account.id is empty string`);\n};\n\nconst validateUseCommentArguments = (commentCid: any, account: any) => {\n assert(typeof commentCid === \"string\", `useComment commentCid '${commentCid}' not a string`);\n assert(\n getAccountProtocolClient(account) && typeof getAccountProtocolClient(account) === \"object\",\n `useComment account.pkc/account.pkc '${getAccountProtocolClient(account)}' not an object`,\n );\n};\n\nconst validateUseCommentsArguments = (commentCids: any, account: any) => {\n assert(\n Array.isArray(commentCids),\n `useComment commentCids '${toString(commentCids)}' not an array`,\n );\n for (const commentCid of commentCids) {\n assert(\n typeof commentCid === \"string\",\n `useComments commentCids '${toString(commentCids)}' commentCid '${toString(commentCid)}' not a string`,\n );\n }\n assert(\n getAccountProtocolClient(account) && typeof getAccountProtocolClient(account) === \"object\",\n `useComments account.pkc/account.pkc '${getAccountProtocolClient(account)}' not an object`,\n );\n};\n\nconst validateCommunityIdentifierArguments = (\n community: any,\n legacyCommunityAddress: any,\n scope: string,\n) => {\n assert(\n legacyCommunityAddress === undefined,\n `${scope} communityAddress has been removed, pass { community: { name, publicKey } }`,\n );\n if (community === undefined) {\n return;\n }\n assertCommunityRef(community, `${scope} community`);\n};\n\nconst validateUseCommunityArguments = ({ community, communityAddress, account }: any) => {\n validateCommunityIdentifierArguments(community, communityAddress, \"useCommunity\");\n if (account !== undefined && account !== null) {\n assert(\n getAccountProtocolClient(account) && typeof getAccountProtocolClient(account) === \"object\",\n `useCommunity account.pkc/account.pkc '${getAccountProtocolClient(account)}' not an object`,\n );\n }\n};\n\nconst validateUseCommunityStatsArguments = ({ community, communityAddress }: any) => {\n validateCommunityIdentifierArguments(community, communityAddress, \"useCommunityStats\");\n};\n\nconst validateCommunitiesArguments = (\n communities: any,\n communityRefs: any,\n communityAddresses: any,\n scope: string,\n) => {\n assert(\n communityRefs === undefined,\n `${scope} communityRefs has been removed, pass communities instead`,\n );\n assert(\n communityAddresses === undefined,\n `${scope} communityAddresses has been removed, pass communities instead`,\n );\n if (communities !== undefined) {\n assert(\n Array.isArray(communities),\n `${scope} communities '${toString(communities)}' not an array`,\n );\n for (const community of communities) {\n assertCommunityRef(\n community,\n `${scope} communities '${toString(communities)}' community '${toString(community)}'`,\n );\n }\n }\n};\n\nconst validateUseCommunitiesArguments = ({\n communities,\n communityRefs,\n communityAddresses,\n account,\n}: any) => {\n validateCommunitiesArguments(communities, communityRefs, communityAddresses, \"useCommunities\");\n if (account !== undefined && account !== null) {\n assert(\n getAccountProtocolClient(account) && typeof getAccountProtocolClient(account) === \"object\",\n `useCommunity account.pkc/account.pkc '${getAccountProtocolClient(account)}' not an object`,\n );\n }\n};\n\nconst validateFeedSortType = (sortType: any) => {\n assert(\n sortType === undefined || (typeof sortType === \"string\" && sortType.length > 0),\n `invalid feed sort type '${sortType}'`,\n );\n};\nconst validateUseFeedArguments = ({\n communities,\n communityRefs,\n communityAddresses,\n sortType,\n accountName,\n postsPerPage,\n filter,\n newerThan,\n accountComments,\n}: any) => {\n validateCommunitiesArguments(communities, communityRefs, communityAddresses, \"useFeed\");\n assert(\n sortType === undefined || (typeof sortType === \"string\" && sortType.length > 0),\n `useFeed sortType argument '${sortType}' invalid`,\n );\n if (accountName) {\n assert(\n typeof accountName === \"string\",\n `useFeed accountName argument '${accountName}' not a string`,\n );\n }\n if (postsPerPage !== undefined && postsPerPage !== null) {\n assert(\n typeof postsPerPage === \"number\",\n `useFeed postsPerPage argument '${postsPerPage}' not a number`,\n );\n }\n if (filter) {\n assert(\n typeof filter.filter === \"function\",\n `useFeed filter.filter argument '${filter.filter}' not a function, useFeedOptions.filter is now an object Filter {filter: (comment: Comment) => Boolean, key: string}`,\n );\n assert(\n typeof filter.key === \"string\",\n `useFeed filter.key argument '${filter.key}' not a string, a unique filter.key is now required to cache the filter`,\n );\n }\n if (newerThan !== undefined && newerThan !== null) {\n assert(typeof newerThan === \"number\", `useFeed newerThan argument '${newerThan}' not a number`);\n }\n if (accountComments) {\n assert(\n typeof accountComments === \"object\",\n `useFeed accountComments argument '${accountComments}' not an object`,\n );\n assert(\n typeof accountComments.newerThan === \"number\",\n `useFeed accountComments.newerThan argument '${accountComments}' not a number`,\n );\n }\n};\nconst validateUseBufferedFeedsArguments = ({\n feedsOptions,\n accountName,\n}: {\n feedsOptions?: any;\n accountName?: any;\n}) => {\n assert(\n Array.isArray(feedsOptions),\n `useBufferedFeeds feedsOptions argument '${toString(feedsOptions)}' not an array`,\n );\n for (const {\n communities,\n communityRefs,\n communityAddresses,\n sortType,\n postsPerPage,\n filter,\n newerThan,\n } of feedsOptions) {\n validateCommunitiesArguments(\n communities,\n communityRefs,\n communityAddresses,\n \"useBufferedFeeds feedOptions\",\n );\n assert(\n sortType === undefined || (typeof sortType === \"string\" && sortType.length > 0),\n `useBufferedFeeds feedOptions.sortType argument '${sortType}' invalid`,\n );\n if (postsPerPage !== undefined && postsPerPage !== null) {\n assert(\n typeof postsPerPage === \"number\",\n `useBufferedFeeds feedOptions.postsPerPage argument '${postsPerPage}' not a number`,\n );\n }\n if (filter) {\n assert(\n typeof filter.filter === \"function\",\n `useBufferedFeeds feedOptions.filter.filter argument '${filter.filter}' not a function, useFeedOptions.filter is now an object Filter {filter: (comment: Comment) => Boolean, key: string}`,\n );\n assert(\n typeof filter.key === \"string\",\n `useBufferedFeeds feedOptions.filter.key argument '${filter.key}' not a string, a unique filter.key is now required to cache the filter`,\n );\n }\n if (newerThan !== undefined && newerThan !== null) {\n assert(\n typeof newerThan === \"number\",\n `useBufferedFeeds feedOptions.newerThan argument '${newerThan}' not a number`,\n );\n }\n }\n if (accountName) {\n assert(\n typeof accountName === \"string\",\n `useBufferedFeeds accountName argument '${accountName}' not a string`,\n );\n }\n};\n\nconst validateUseCommunitiesStatesArguments = ({\n communities,\n communityRefs,\n communityAddresses,\n}: any) => {\n validateCommunitiesArguments(\n communities,\n communityRefs,\n communityAddresses,\n \"useCommunitiesStates\",\n );\n};\n\nconst validateRepliesSortType = (sortType: any) => {\n assert(\n sortType === undefined || (typeof sortType === \"string\" && sortType.length > 0),\n `invalid replies sort type '${sortType}'`,\n );\n};\nconst validateUseRepliesArguments = (\n comment?: any,\n sortType?: any,\n accountName?: any,\n onlyIfCached?: any,\n flat?: any,\n accountComments?: any,\n postsPerPage?: any,\n filter?: any,\n) => {\n assert(\n !comment || typeof comment === \"object\",\n `useReplies comment argument '${comment}' not an object`,\n );\n assert(\n !comment?.cid || typeof comment.cid === \"string\",\n `useReplies comment.cid argument '${comment?.cid}' not a string`,\n );\n assert(\n sortType === undefined || (typeof sortType === \"string\" && sortType.length > 0),\n `useReplies sortType argument '${sortType}' invalid`,\n );\n if (accountName) {\n assert(\n typeof accountName === \"string\",\n `useReplies accountName argument '${accountName}' not a string`,\n );\n }\n if (onlyIfCached !== undefined && onlyIfCached !== null) {\n assert(\n typeof onlyIfCached === \"boolean\",\n `useReplies onlyIfCached argument '${onlyIfCached}' not a boolean`,\n );\n }\n if (postsPerPage !== undefined && postsPerPage !== null) {\n assert(\n typeof postsPerPage === \"number\",\n `useReplies postsPerPage argument '${postsPerPage}' not a number`,\n );\n }\n if (flat !== undefined && flat !== null) {\n assert(typeof flat === \"boolean\", `useReplies flat argument '${flat}' not a boolean`);\n }\n if (accountComments !== undefined && accountComments !== null) {\n assert(\n typeof accountComments.newerThan === \"number\",\n `useReplies accountComments.newerThan argument '${accountComments.newerThan}' not a number`,\n );\n assert(\n !accountComments.append || typeof accountComments.append === \"boolean\",\n `useReplies accountComments.append argument '${accountComments.append}' not a boolean`,\n );\n }\n if (filter) {\n assert(\n typeof filter.filter === \"function\",\n `useReplies filter.filter argument '${filter.filter}' not a function, useRepliesOptions.filter is now an object Filter {filter: (comment: Comment) => Boolean, key: string}`,\n );\n assert(\n typeof filter.key === \"string\",\n `useReplies filter.key argument '${filter.key}' not a string, a unique filter.key is now required to cache the filter`,\n );\n }\n};\n\nconst validator = {\n validateAccountsActionsPublishCommentArguments,\n validateAccountsActionsPublishCommentEditArguments,\n validateAccountsActionsPublishCommentModerationArguments,\n validateAccountsActionsPublishCommunityEditArguments,\n validateAccountsActionsCreateCommunityArguments,\n validateAccountsActionsPublishVoteArguments,\n validateAccountsActionsExportAccountArguments,\n validateAccountsActionsSetAccountsOrderArguments,\n validateAccountsActionsSetAccountArguments,\n validateAccountsActionsSetAccountAuthorName,\n validateAccountsActionsSetActiveAccountArguments,\n validateAccountsDatabaseAddAccountArguments,\n validateAccountsDatabaseGetAccountsArguments,\n validateAccountsDatabaseAccountNames,\n validateUseCommentArguments,\n validateUseCommentsArguments,\n validateUseCommunityArguments,\n validateUseCommunityStatsArguments,\n validateUseCommunitiesArguments,\n validateUseCommunitiesStatesArguments,\n validateFeedSortType,\n validateUseFeedArguments,\n validateUseBufferedFeedsArguments,\n validateRepliesSortType,\n validateUseRepliesArguments,\n};\n\nexport default validator;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts-actions.d.ts","sourceRoot":"","sources":["../../../src/stores/accounts/accounts-actions.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,OAAO,EAEP,qBAAqB,EAGrB,kBAAkB,EAClB,yBAAyB,EACzB,+BAA+B,EAC/B,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EAIhB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"accounts-actions.d.ts","sourceRoot":"","sources":["../../../src/stores/accounts/accounts-actions.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,OAAO,EAEP,qBAAqB,EAGrB,kBAAkB,EAClB,yBAAyB,EACzB,+BAA+B,EAC/B,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EAIhB,MAAM,aAAa,CAAC;AA+UrB,sGAAsG;AACtG,eAAO,MAAM,yBAAyB,GACpC,kBAAkB,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,EACvC,WAAW,MAAM,EACjB,OAAO,MAAM,EACb,SAAS,CAAC,eAAe,EAAE,GAAG,EAAE,EAAE,cAAc,EAAE,GAAG,KAAK,IAAI;;;;;;CAO/D,CAAC;AA2BF,eAAO,MAAM,0BAA0B,GAAI,mBAAmB,GAAG,EAAE,yBAAyB,GAAG,YAGtC,CAAC;AAE1D,eAAO,MAAM,yBAAyB,GAAI,mBAAmB,GAAG,QAK/D,CAAC;AAuCF,eAAO,MAAM,kCAAkC,GAC7C,wBAAwB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAC3D,WAAW,MAAM,EACjB,mBAAmB,GAAG;;CAsCvB,CAAC;AAEF,eAAO,MAAM,uCAAuC,GAClD,wBAAwB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAC3D,eAAe,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAC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imisticVoteMetadata } from "../../lib/utils/optimistic-vote-counts.js";
|
|
38
38
|
import { applyCommunityWordfilters } from "../../lib/wordfilters.js";
|
|
39
39
|
const PUBLICATION_COMMUNITY_LOAD_TIMEOUT_MS = 30000;
|
|
40
|
+
const COMMENT_AUTHOR_LOAD_TIMEOUT_MS = 10000;
|
|
40
41
|
const communityHasPublicationConfig = (community) => community &&
|
|
41
42
|
(typeof community.updatedAt === "number" ||
|
|
42
43
|
Object.prototype.hasOwnProperty.call(community, "challenges"));
|
|
@@ -96,6 +97,24 @@ const loadPublicationCommunity = (communityAddress, account) => __awaiter(void 0
|
|
|
96
97
|
yield ((_a = community.stop) === null || _a === void 0 ? void 0 : _a.call(community));
|
|
97
98
|
}
|
|
98
99
|
});
|
|
100
|
+
const loadCommentAuthorAddress = (account, commentCid) => __awaiter(void 0, void 0, void 0, function* () {
|
|
101
|
+
var _a;
|
|
102
|
+
const abortController = new AbortController();
|
|
103
|
+
const timeout = setTimeout(() => abortController.abort(), COMMENT_AUTHOR_LOAD_TIMEOUT_MS);
|
|
104
|
+
try {
|
|
105
|
+
const comment = yield account.pkc.getComment({
|
|
106
|
+
cid: commentCid,
|
|
107
|
+
abortSignal: abortController.signal,
|
|
108
|
+
});
|
|
109
|
+
return (_a = comment === null || comment === void 0 ? void 0 : comment.author) === null || _a === void 0 ? void 0 : _a.address;
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
log.error("accountsActions.loadCommentAuthorAddress error", { commentCid, error });
|
|
113
|
+
}
|
|
114
|
+
finally {
|
|
115
|
+
clearTimeout(timeout);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
99
118
|
const applyPublicationWordfilters = (publicationType, options, account) => __awaiter(void 0, void 0, void 0, function* () {
|
|
100
119
|
const communityAddress = options.communityAddress;
|
|
101
120
|
if (typeof communityAddress !== "string" || !communityAddress)
|
|
@@ -513,6 +532,7 @@ export const setAccount = (account) => __awaiter(void 0, void 0, void 0, functio
|
|
|
513
532
|
const { accounts } = accountsStore.getState();
|
|
514
533
|
validator.validateAccountsActionsSetAccountArguments(account);
|
|
515
534
|
assert(accounts === null || accounts === void 0 ? void 0 : accounts[account.id], `cannot set account with account.id '${account.id}' id does not exist in database`);
|
|
535
|
+
validator.validateAccountsActionsSetAccountAuthorName(account.author, accounts[account.id].author);
|
|
516
536
|
// if author.address has changed, add new community roles of author.address found in communities store
|
|
517
537
|
// TODO: add test to check if roles get added
|
|
518
538
|
if (account.author.address !== accounts[account.id].author.address) {
|
|
@@ -884,7 +904,7 @@ export const unsaveComment = (commentCid, accountName) => __awaiter(void 0, void
|
|
|
884
904
|
yield updateSavedComments(commentCid, accountName, false);
|
|
885
905
|
});
|
|
886
906
|
export const publishComment = (publishCommentOptions, accountName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
887
|
-
var _a, _b, _c, _d, _e;
|
|
907
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
888
908
|
const { accounts, accountsComments, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();
|
|
889
909
|
assert(accounts && accountNamesToAccountIds && activeAccountId, `can't use accountsStore.accountActions before initialized`);
|
|
890
910
|
let account = accounts[activeAccountId];
|
|
@@ -900,18 +920,41 @@ export const publishComment = (publishCommentOptions, accountName) => __awaiter(
|
|
|
900
920
|
// find author.previousCommentCid if any
|
|
901
921
|
const accountCommentsWithCids = accountsComments[account.id]
|
|
902
922
|
.filter((comment) => comment.cid)
|
|
903
|
-
//
|
|
904
|
-
.filter((comment) =>
|
|
905
|
-
|
|
923
|
+
// a pseudonymous community published the comment under an alias, linking it would reveal the account
|
|
924
|
+
.filter((comment) => !comment.pseudonymityMode)
|
|
925
|
+
// author can change his address, his previousCommentCid becomes invalid. hooks <= 0.1.51 replaced
|
|
926
|
+
// the stored author with commentUpdate.author, so those comments have no author.address at all
|
|
927
|
+
.filter((comment) => { var _a, _b; return !((_a = comment.author) === null || _a === void 0 ? void 0 : _a.address) || comment.author.address === ((_b = account.author) === null || _b === void 0 ? void 0 : _b.address); });
|
|
928
|
+
const previousComment = accountCommentsWithCids[accountCommentsWithCids.length - 1];
|
|
906
929
|
const author = Object.assign({}, account.author);
|
|
907
|
-
if (
|
|
908
|
-
author.previousCommentCid =
|
|
930
|
+
if (previousComment) {
|
|
931
|
+
author.previousCommentCid = previousComment.cid;
|
|
909
932
|
}
|
|
910
933
|
const publicationAuthor = Object.assign(Object.assign({}, author), publishCommentOptions.author);
|
|
911
|
-
if (publicationAuthor.address !== ((
|
|
912
|
-
((
|
|
934
|
+
if (publicationAuthor.address !== ((_a = account.author) === null || _a === void 0 ? void 0 : _a.address) &&
|
|
935
|
+
((_b = publishCommentOptions.author) === null || _b === void 0 ? void 0 : _b.previousCommentCid) === undefined) {
|
|
913
936
|
delete publicationAuthor.previousCommentCid;
|
|
914
937
|
}
|
|
938
|
+
// a comment without author.address may have been published under an alternate author passed to
|
|
939
|
+
// publishComment, so only link it once its immutable author, loaded from its cid, is the account's
|
|
940
|
+
if (previousComment &&
|
|
941
|
+
!((_c = previousComment.author) === null || _c === void 0 ? void 0 : _c.address) &&
|
|
942
|
+
((_d = publishCommentOptions.author) === null || _d === void 0 ? void 0 : _d.previousCommentCid) === undefined &&
|
|
943
|
+
publicationAuthor.previousCommentCid === previousComment.cid) {
|
|
944
|
+
const previousCommentAuthorAddress = yield loadCommentAuthorAddress(account, previousComment.cid);
|
|
945
|
+
if (!previousCommentAuthorAddress || previousCommentAuthorAddress !== ((_e = account.author) === null || _e === void 0 ? void 0 : _e.address)) {
|
|
946
|
+
// fall back to the newest stored comment that kept the account author address
|
|
947
|
+
const previousAccountAuthorComment = accountCommentsWithCids
|
|
948
|
+
.filter((comment) => { var _a; return (_a = comment.author) === null || _a === void 0 ? void 0 : _a.address; })
|
|
949
|
+
.pop();
|
|
950
|
+
if (previousAccountAuthorComment) {
|
|
951
|
+
publicationAuthor.previousCommentCid = previousAccountAuthorComment.cid;
|
|
952
|
+
}
|
|
953
|
+
else {
|
|
954
|
+
delete publicationAuthor.previousCommentCid;
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
}
|
|
915
958
|
let createCommentOptions = normalizePublicationOptionsForPkc(account.pkc, Object.assign(Object.assign({ timestamp: Math.floor(Date.now() / 1000), signer: account.signer }, publishCommentOptions), { author: publicationAuthor }));
|
|
916
959
|
delete createCommentOptions.onChallenge;
|
|
917
960
|
delete createCommentOptions.onChallengeVerification;
|
|
@@ -928,7 +971,7 @@ export const publishComment = (publishCommentOptions, accountName) => __awaiter(
|
|
|
928
971
|
// set fetching link dimensions state
|
|
929
972
|
let fetchingLinkDimensionsStates;
|
|
930
973
|
if (publishCommentOptions.link) {
|
|
931
|
-
(
|
|
974
|
+
(_f = publishCommentOptions.onPublishingStateChange) === null || _f === void 0 ? void 0 : _f.call(publishCommentOptions, "fetching-link-dimensions");
|
|
932
975
|
fetchingLinkDimensionsStates = {
|
|
933
976
|
state: "publishing",
|
|
934
977
|
publishingState: "fetching-link-dimensions",
|
|
@@ -1000,7 +1043,7 @@ export const publishComment = (publishCommentOptions, accountName) => __awaiter(
|
|
|
1000
1043
|
if (pendingCommentIndex !== accountCommentIndex) {
|
|
1001
1044
|
notifyPendingComment(pendingCommentIndex, createdAccountComment);
|
|
1002
1045
|
}
|
|
1003
|
-
(
|
|
1046
|
+
(_g = publishCommentOptions._onPendingCommentIndex) === null || _g === void 0 ? void 0 : _g.call(publishCommentOptions, pendingCommentIndex, createdAccountComment);
|
|
1004
1047
|
let comment;
|
|
1005
1048
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
1006
1049
|
// fetch comment.link dimensions
|
|
@@ -1705,6 +1748,7 @@ export const createCommunity = (createCommunityOptions, accountName) => __awaite
|
|
|
1705
1748
|
const accountId = accountNamesToAccountIds[accountName];
|
|
1706
1749
|
account = accounts[accountId];
|
|
1707
1750
|
}
|
|
1751
|
+
validator.validateAccountsActionsCreateCommunityArguments(createCommunityOptions);
|
|
1708
1752
|
const community = yield communitiesStore
|
|
1709
1753
|
.getState()
|
|
1710
1754
|
.createCommunity(createCommunityOptions, account);
|