@pkcprotocol/pkc-js 0.0.83 → 0.0.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +1 -0
- package/dist/browser/clients/rpc-client/schema.d.ts +1 -0
- package/dist/browser/community/rpc-remote-community.js +15 -8
- package/dist/browser/community/rpc-remote-community.js.map +1 -1
- package/dist/browser/community/schema.d.ts +106 -2
- package/dist/browser/community/schema.js +28 -7
- package/dist/browser/community/schema.js.map +1 -1
- package/dist/browser/errors.d.ts +9 -1
- package/dist/browser/errors.js +11 -0
- package/dist/browser/errors.js.map +1 -1
- package/dist/browser/generated-version.d.ts +1 -1
- package/dist/browser/generated-version.js +1 -1
- package/dist/browser/index-with-compile-cache.d.ts +88 -2
- package/dist/browser/index.d.ts +88 -2
- package/dist/browser/pkc/pkc-with-rpc-client.d.ts +5 -3
- package/dist/browser/pkc/pkc-with-rpc-client.js +45 -7
- package/dist/browser/pkc/pkc-with-rpc-client.js.map +1 -1
- package/dist/browser/pkc/pkc.d.ts +6 -3
- package/dist/browser/pkc/pkc.js +71 -9
- package/dist/browser/pkc/pkc.js.map +1 -1
- package/dist/browser/pkc-error.d.ts +1 -1
- package/dist/browser/publications/comment/schema.d.ts +1 -1
- package/dist/browser/publications/comment/schema.js +5 -1
- package/dist/browser/publications/comment/schema.js.map +1 -1
- package/dist/browser/publications/community-edit/schema.d.ts +4 -0
- package/dist/browser/publications/publication-client-manager.js +10 -2
- package/dist/browser/publications/publication-client-manager.js.map +1 -1
- package/dist/browser/publications/publication.d.ts +4 -0
- package/dist/browser/publications/publication.js +36 -2
- package/dist/browser/publications/publication.js.map +1 -1
- package/dist/browser/pubsub-messages/schema.d.ts +2 -0
- package/dist/browser/rpc/src/index.js +4 -1
- package/dist/browser/rpc/src/index.js.map +1 -1
- package/dist/browser/rpc/src/lib/pkc-js/index.d.ts +44 -1
- package/dist/browser/rpc/src/schema.d.ts +265 -7
- package/dist/browser/rpc/src/schema.js +4 -2
- package/dist/browser/rpc/src/schema.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/exclude/exclude.d.ts +2 -2
- package/dist/browser/runtime/node/community/challenges/exclude/exclude.js +5 -1
- package/dist/browser/runtime/node/community/challenges/exclude/exclude.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/index.d.ts +7 -3
- package/dist/browser/runtime/node/community/challenges/index.js +29 -6
- package/dist/browser/runtime/node/community/challenges/index.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/address-list-validation.d.ts +4 -0
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/address-list-validation.js +27 -0
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/address-list-validation.js.map +1 -0
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/blacklist.js +2 -1
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/blacklist.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/publication-match.js +34 -1
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/publication-match.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/question.js +8 -1
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/question.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/whitelist.js +2 -1
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/whitelist.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/validate-challenge-settings.d.ts +22 -0
- package/dist/browser/runtime/node/community/challenges/validate-challenge-settings.js +92 -0
- package/dist/browser/runtime/node/community/challenges/validate-challenge-settings.js.map +1 -0
- package/dist/browser/runtime/node/community/db-handler.d.ts +1 -0
- package/dist/browser/runtime/node/community/local-community/db-state.js +8 -0
- package/dist/browser/runtime/node/community/local-community/db-state.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/editing.js +8 -0
- package/dist/browser/runtime/node/community/local-community/editing.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/lifecycle.js +29 -0
- package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/browser/schema/schema-util.d.ts +9 -0
- package/dist/browser/schema.d.ts +352 -8
- package/dist/browser/test/test-util.d.ts +2 -0
- package/dist/browser/types.d.ts +5 -0
- package/dist/browser/util.d.ts +20 -1
- package/dist/browser/util.js +100 -2
- package/dist/browser/util.js.map +1 -1
- package/dist/bundled/bundle-manifest.json +33 -31
- package/dist/bundled/chunks/{helia-for-pkc-BtjQ8rfd.js → helia-for-pkc-C5Oe_ZSx.js} +2 -2
- package/dist/bundled/chunks/{local-community-DJM47U8C.js → local-community-BqxmCg5p.js} +107 -2
- package/dist/bundled/chunks/{local-community-B_Yg8LQH.js → local-community-D4SjlAKS.js} +1 -1
- package/dist/bundled/chunks/{node-lb4SvdBh.js → node-C2DKW30L.js} +110 -22
- package/dist/bundled/chunks/{rpc-local-community-a464veDe.js → rpc-local-community-o0teUvw_.js} +91 -19
- package/dist/bundled/chunks/{schema-mdv9_FG5.js → schema-qhSDu1BU.js} +126 -10
- package/dist/bundled/chunks/{util-y9-A9BnM.js → util-BVGNNIgn.js} +1 -1
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/rpc/src/index.js +5 -5
- package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +1 -0
- package/dist/node/clients/rpc-client/schema.d.ts +1 -0
- package/dist/node/community/rpc-remote-community.js +15 -8
- package/dist/node/community/rpc-remote-community.js.map +1 -1
- package/dist/node/community/schema.d.ts +106 -2
- package/dist/node/community/schema.js +28 -7
- package/dist/node/community/schema.js.map +1 -1
- package/dist/node/errors.d.ts +9 -1
- package/dist/node/errors.js +11 -0
- package/dist/node/errors.js.map +1 -1
- package/dist/node/generated-version.d.ts +1 -1
- package/dist/node/generated-version.js +1 -1
- package/dist/node/index-with-compile-cache.d.ts +88 -2
- package/dist/node/index.d.ts +88 -2
- package/dist/node/pkc/pkc-with-rpc-client.d.ts +5 -3
- package/dist/node/pkc/pkc-with-rpc-client.js +45 -7
- package/dist/node/pkc/pkc-with-rpc-client.js.map +1 -1
- package/dist/node/pkc/pkc.d.ts +6 -3
- package/dist/node/pkc/pkc.js +71 -9
- package/dist/node/pkc/pkc.js.map +1 -1
- package/dist/node/pkc-error.d.ts +1 -1
- package/dist/node/publications/comment/schema.d.ts +1 -1
- package/dist/node/publications/comment/schema.js +5 -1
- package/dist/node/publications/comment/schema.js.map +1 -1
- package/dist/node/publications/community-edit/schema.d.ts +4 -0
- package/dist/node/publications/publication-client-manager.js +10 -2
- package/dist/node/publications/publication-client-manager.js.map +1 -1
- package/dist/node/publications/publication.d.ts +4 -0
- package/dist/node/publications/publication.js +36 -2
- package/dist/node/publications/publication.js.map +1 -1
- package/dist/node/pubsub-messages/schema.d.ts +2 -0
- package/dist/node/rpc/src/index.js +4 -1
- package/dist/node/rpc/src/index.js.map +1 -1
- package/dist/node/rpc/src/lib/pkc-js/index.d.ts +44 -1
- package/dist/node/rpc/src/schema.d.ts +265 -7
- package/dist/node/rpc/src/schema.js +4 -2
- package/dist/node/rpc/src/schema.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/exclude/exclude.d.ts +2 -2
- package/dist/node/runtime/node/community/challenges/exclude/exclude.js +5 -1
- package/dist/node/runtime/node/community/challenges/exclude/exclude.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/index.d.ts +7 -3
- package/dist/node/runtime/node/community/challenges/index.js +29 -6
- package/dist/node/runtime/node/community/challenges/index.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/address-list-validation.d.ts +4 -0
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/address-list-validation.js +27 -0
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/address-list-validation.js.map +1 -0
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/blacklist.js +2 -1
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/blacklist.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/publication-match.js +34 -1
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/publication-match.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/question.js +8 -1
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/question.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/whitelist.js +2 -1
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/whitelist.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/validate-challenge-settings.d.ts +22 -0
- package/dist/node/runtime/node/community/challenges/validate-challenge-settings.js +92 -0
- package/dist/node/runtime/node/community/challenges/validate-challenge-settings.js.map +1 -0
- package/dist/node/runtime/node/community/db-handler.d.ts +1 -0
- package/dist/node/runtime/node/community/local-community/db-state.js +8 -0
- package/dist/node/runtime/node/community/local-community/db-state.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/editing.js +8 -0
- package/dist/node/runtime/node/community/local-community/editing.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/lifecycle.js +29 -0
- package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/node/schema/schema-util.d.ts +9 -0
- package/dist/node/schema.d.ts +352 -8
- package/dist/node/test/test-util.d.ts +2 -0
- package/dist/node/types.d.ts +5 -0
- package/dist/node/util.d.ts +20 -1
- package/dist/node/util.js +100 -2
- package/dist/node/util.js.map +1 -1
- package/package.json +3 -3
package/dist/bundled/chunks/{rpc-local-community-a464veDe.js → rpc-local-community-o0teUvw_.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $ as pubsubTopicToDhtKey, $n as n$
|
|
2
|
+
import { $ as pubsubTopicToDhtKey, $n as n$10, $t as ChallengeFileSchema, A as extractNetworkErrorDetails, An as CommentUpdateSignedPropertyNames, Ar as literal, At as refreshTrackedCommunityAliases, B as isIpfsCid, Bt as pTimeout, Cn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Cr as require_supports_color, Ct as findStartedCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateForChallengeVerificationSignedPropertyNames, Dr as array, E as createAbortError, Er as _enum, Et as listStartedCommunities, Fn as ModQueuePageIpfsSchema, Ft as untrackStartedCommunity, Gn as AuthorCommentIpfsReservedFields, Gt as CreateCommunityEditPublicationOptionsWithRefinementSchema, H as isIpns, I as getPostUpdateTimestampRange, In as PageIpfsSchema, It as untrackUpdatingComment, Jn as CidPathSchema, Kt as CommentModerationChallengeRequestToEncryptSchema, L as hideClassPrivateProps, Ln as CommentEditChallengeRequestToEncryptSchema, Lt as untrackUpdatingCommunity, Mr as object, Mt as trackStartedCommunity, Nn as CreateCommentOptionsWithRefinementSchema, Nr as record, O as derivePublicationFromChallengeRequest, On as CommentUpdateReservedFields, Or as boolean, Ot as listUpdatingCommunities, Pn as GetPageParamSchema, Pr as string, Pt as trackUpdatingCommunity, Q as isStringDomain, Qn as CreateSignerSchema, Qt as ChallengeFileFactorySchema, R as ipnsNameToIpnsOverPubsubTopic, Rt as require_sha256$1, Sr as logger_default, Tn as CommentUpdateChallengeReservedFieldNames, Tt as findUpdatingCommunity, U as isIpnsPath, Un as CreateCommentEditOptionsWithRefinementSchema, Ut as CommunityEditPublicationSignedPropertyNames, V as isIpfsPath, Vn as CommentEditSignedPropertyNames, Vt as CommunityEditPublicationChallengeRequestToEncryptSchema, Wn as AuthorAddressSchema, Wt as CommunityEditPubsubMessagePublicationSchema, X as isRequestPubsubPublicationOfPost, Xn as CommunityAddressSchema, Xt as CommentModerationsTableRowSchema, Yn as CidStringSchema, Yt as CommentModerationSignedPropertyNames, Z as isRequestPubsubPublicationOfReply, Zn as CommunityAuthorChallengeReservedFieldNames, Zt as CreateCommentModerationOptionsWithRefinementSchema, _ as PKCUserOptionBaseSchema, _n as VoteSignedPropertyNames, _r as FailedToFetchCommunityFromGatewaysError, an as CommunityIpfsSchema, ar as e$5, b as areEquivalentCommunityAddresses, bn as CommentIpfsReservedFields, br as PKCError, bt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, c as ChallengeVerificationMessageSignedPropertyNames, cn as CreateRemoteCommunityFunctionArgumentSchema, cr as t$12, dr as t$10, f as DecryptedChallengeSchema, fn as RpcRemoteCommunityUpdateEventResultSchema, fr as t$9, g as PKCParsedOptionsSchema, gr as FailedToFetchCommentUpdateFromGatewaysError, gt as sleepUntilTimeoutOrAbort, h as NameResolverSerializedSchema, hn as VotePubsubMessagePublicationSchema, hr as FailedToFetchCommentIpfsFromGatewaysError, ht as shortifyCid, i as ChallengeMessageSignedPropertyNames, in as CommunityIpfsReservedFields, ir as e$6, j as fetchAndValidateIpnsRecordFromGateway, jr as number, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateSchema, kr as custom, l as DecryptedChallengeAnswerSchema, ln as CreateRpcCommunityFunctionArgumentSchema, lr as n$8, m as NameResolveCacheOptionsSchema, mn as VoteChallengeRequestToEncryptSchema, mr as require_retry$1, mt as shortifyAddress, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityEditOptionsSchema, o as ChallengeRequestMessageSignedPropertyNames, on as CommunitySignedPropertyNames, or as t$11, ot as removeNullUndefinedEmptyObjectsValuesRecursively, p as DecryptedChallengeVerificationSchema, pn as CreateVoteUserOptionsWithRefinementSchema, pr as e$4, qn as ChallengeAnswersSchema, qt as CommentModerationPubsubMessagePublicationSchema, rn as CommunityExportRecordsSchema, rr as t$13, sn as CreateNewLocalCommunityUserOptionsSchema, sr as r$8, tn as CommunityChallengeSettingSchema, tr as n$9, tt as raceAgainstAbort, un as ExportCommunityModLogsOptionsSchema, ur as r$7, ut as resolveWhenPredicateIsTrue, v as PKCUserOptionsSchema, vr as FailedToFetchGenericIpfsFromGatewaysError, vt as throwIfAbortSignalAborted, wn as CommentSignedPropertyNames, wr as require_ms$1, wt as findUpdatingComment, x as calculateIpfsCidV0, xn as CommentIpfsSchema, xr as messages, yn as CommentChallengeRequestToEncryptSchema, yr as FailedToFetchPageIpfsFromGatewaysError, yt as timestamp, z as isAbortError, zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema } from "./schema-qhSDu1BU.js";
|
|
3
3
|
import { t as all } from "./src-CYIMjhjK.js";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
@@ -91779,7 +91779,10 @@ const CreatePKCWsServerOptionsSchema = object({
|
|
|
91779
91779
|
const SetNewSettingsPKCWsServerSchema = object({ pkcOptions: PKCUserOptionBaseSchema.extend({ nameResolvers: NameResolverSerializedSchema.array().optional() }).loose() });
|
|
91780
91780
|
const PKCWsServerSettingsSerializedSchema = object({
|
|
91781
91781
|
pkcOptions: PKCParsedOptionsSchema.loose(),
|
|
91782
|
-
challenges: record(string(), ChallengeFileSchema.omit({
|
|
91782
|
+
challenges: record(string(), ChallengeFileSchema.omit({
|
|
91783
|
+
getChallenge: true,
|
|
91784
|
+
validateChallengeSettings: true
|
|
91785
|
+
}))
|
|
91783
91786
|
});
|
|
91784
91787
|
//#endregion
|
|
91785
91788
|
//#region dist/node/schema/schema-util.js
|
|
@@ -99717,7 +99720,7 @@ var PublicationClientsManager = class extends PKCClientsManager {
|
|
|
99717
99720
|
const community = directCommunityInstance || await this._pkc.createCommunity({
|
|
99718
99721
|
name: this._publication.communityName,
|
|
99719
99722
|
publicKey: this._publication.communityPublicKey
|
|
99720
|
-
});
|
|
99723
|
+
}, { abortSignal: this._publication._getCommunityFetchAbortSignal() });
|
|
99721
99724
|
this._communityForUpdating = {
|
|
99722
99725
|
community,
|
|
99723
99726
|
error: this.handleErrorEventFromCommunity.bind(this),
|
|
@@ -99806,7 +99809,11 @@ var PublicationClientsManager = class extends PKCClientsManager {
|
|
|
99806
99809
|
if (!updatingCommunityInstance.community.raw.communityIpfs) {
|
|
99807
99810
|
const timeoutMs = this._pkc._timeouts["community-ipns"];
|
|
99808
99811
|
try {
|
|
99809
|
-
await waitForUpdateInCommunityInstanceWithErrorAndTimeout(
|
|
99812
|
+
await waitForUpdateInCommunityInstanceWithErrorAndTimeout({
|
|
99813
|
+
community: updatingCommunityInstance.community,
|
|
99814
|
+
timeoutMs,
|
|
99815
|
+
abortSignal: this._publication._getCommunityFetchAbortSignal()
|
|
99816
|
+
});
|
|
99810
99817
|
communityIpfs = updatingCommunityInstance.community.raw.communityIpfs;
|
|
99811
99818
|
} catch (e) {
|
|
99812
99819
|
await this.cleanUpUpdatingCommunityInstance();
|
|
@@ -128112,6 +128119,25 @@ function ChallengeFileFactory$4({ challengeSettings }) {
|
|
|
128112
128119
|
};
|
|
128113
128120
|
}
|
|
128114
128121
|
//#endregion
|
|
128122
|
+
//#region dist/node/runtime/node/community/challenges/pkc-js-challenges/address-list-validation.js
|
|
128123
|
+
const splitCommaSeparated = (value) => value.split(",").map((entry) => entry.trim());
|
|
128124
|
+
function validateAddressListOptions({ challengeSettings }) {
|
|
128125
|
+
const { addresses, urls } = challengeSettings.options ?? {};
|
|
128126
|
+
if (addresses) {
|
|
128127
|
+
for (const [index, address] of splitCommaSeparated(addresses).entries()) if (!address) throw new Error(`addresses entry ${index} is empty, check for a stray or trailing comma`);
|
|
128128
|
+
}
|
|
128129
|
+
if (urls) for (const [index, url] of splitCommaSeparated(urls).entries()) {
|
|
128130
|
+
if (!url) throw new Error(`urls entry ${index} is empty, check for a stray or trailing comma`);
|
|
128131
|
+
let parsed;
|
|
128132
|
+
try {
|
|
128133
|
+
parsed = new URL(url);
|
|
128134
|
+
} catch {
|
|
128135
|
+
throw new Error(`urls entry ${index} ('${url}') is not a valid URL`);
|
|
128136
|
+
}
|
|
128137
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new Error(`urls entry ${index} ('${url}') must use http: or https:, it is fetched over HTTP`);
|
|
128138
|
+
}
|
|
128139
|
+
}
|
|
128140
|
+
//#endregion
|
|
128115
128141
|
//#region dist/node/runtime/node/community/challenges/pkc-js-challenges/blacklist.js
|
|
128116
128142
|
const optionInputs$3 = [
|
|
128117
128143
|
{
|
|
@@ -128194,7 +128220,8 @@ function ChallengeFileFactory$3({ challengeSettings }) {
|
|
|
128194
128220
|
getChallenge: getChallenge$3,
|
|
128195
128221
|
optionInputs: optionInputs$3,
|
|
128196
128222
|
type: type$3,
|
|
128197
|
-
description: description$2
|
|
128223
|
+
description: description$2,
|
|
128224
|
+
validateChallengeSettings: validateAddressListOptions
|
|
128198
128225
|
};
|
|
128199
128226
|
}
|
|
128200
128227
|
//#endregion
|
|
@@ -128280,7 +128307,8 @@ function ChallengeFileFactory$2({ challengeSettings }) {
|
|
|
128280
128307
|
getChallenge: getChallenge$2,
|
|
128281
128308
|
optionInputs: optionInputs$2,
|
|
128282
128309
|
type: type$2,
|
|
128283
|
-
description: description$1
|
|
128310
|
+
description: description$1,
|
|
128311
|
+
validateChallengeSettings: validateAddressListOptions
|
|
128284
128312
|
};
|
|
128285
128313
|
}
|
|
128286
128314
|
//#endregion
|
|
@@ -128323,13 +128351,17 @@ const getChallenge$1 = async ({ challengeSettings, challengeRequestMessage, chal
|
|
|
128323
128351
|
};
|
|
128324
128352
|
return { success: true };
|
|
128325
128353
|
};
|
|
128354
|
+
const validateChallengeSettings$1 = ({ challengeSettings }) => {
|
|
128355
|
+
if (challengeSettings.publicOptions?.includes("answer")) throw new Error("answer cannot be listed in publicOptions: publishing the answer means anyone can pass the challenge");
|
|
128356
|
+
};
|
|
128326
128357
|
function ChallengeFileFactory$1({ challengeSettings }) {
|
|
128327
128358
|
return {
|
|
128328
128359
|
getChallenge: getChallenge$1,
|
|
128329
128360
|
optionInputs: optionInputs$1,
|
|
128330
128361
|
type: type$1,
|
|
128331
128362
|
challenge: challengeSettings?.options?.question,
|
|
128332
|
-
description
|
|
128363
|
+
description,
|
|
128364
|
+
validateChallengeSettings: validateChallengeSettings$1
|
|
128333
128365
|
};
|
|
128334
128366
|
}
|
|
128335
128367
|
//#endregion
|
|
@@ -128430,12 +128462,35 @@ const getChallenge = async ({ challengeSettings, challengeRequestMessage }) => {
|
|
|
128430
128462
|
error
|
|
128431
128463
|
};
|
|
128432
128464
|
};
|
|
128465
|
+
const validateChallengeSettings = ({ challengeSettings }) => {
|
|
128466
|
+
const matchesStr = challengeSettings.options?.matches;
|
|
128467
|
+
if (!matchesStr) return;
|
|
128468
|
+
let parsed;
|
|
128469
|
+
try {
|
|
128470
|
+
parsed = JSON.parse(matchesStr);
|
|
128471
|
+
} catch (e) {
|
|
128472
|
+
throw new Error(`matches is not valid JSON: ${e.message}`);
|
|
128473
|
+
}
|
|
128474
|
+
if (!Array.isArray(parsed)) throw new Error("matches must be a JSON array of {propertyName, regexp} objects");
|
|
128475
|
+
for (const [index, match] of parsed.entries()) {
|
|
128476
|
+
if (typeof match !== "object" || match === null || Array.isArray(match)) throw new Error(`matches[${index}] must be an object with propertyName and regexp`);
|
|
128477
|
+
const { propertyName, regexp } = match;
|
|
128478
|
+
if (typeof propertyName !== "string" || !propertyName) throw new Error(`matches[${index}].propertyName must be a non-empty string`);
|
|
128479
|
+
if (typeof regexp !== "string" || !regexp) throw new Error(`matches[${index}].regexp must be a non-empty string`);
|
|
128480
|
+
try {
|
|
128481
|
+
new RegExp(regexp);
|
|
128482
|
+
} catch (e) {
|
|
128483
|
+
throw new Error(`matches[${index}].regexp ('${regexp}') is not a valid regular expression: ${e.message}`);
|
|
128484
|
+
}
|
|
128485
|
+
}
|
|
128486
|
+
};
|
|
128433
128487
|
function ChallengeFileFactory({ challengeSettings }) {
|
|
128434
128488
|
return {
|
|
128435
128489
|
getChallenge,
|
|
128436
128490
|
optionInputs,
|
|
128437
128491
|
type,
|
|
128438
|
-
description: challengeSettings?.options?.description || defaultDescription
|
|
128492
|
+
description: challengeSettings?.options?.description || defaultDescription,
|
|
128493
|
+
validateChallengeSettings
|
|
128439
128494
|
};
|
|
128440
128495
|
}
|
|
128441
128496
|
//#endregion
|
|
@@ -128970,8 +129025,14 @@ const getChallengeVerification = async ({ challengeRequestMessage, community, ge
|
|
|
128970
129025
|
};
|
|
128971
129026
|
return challengeVerification;
|
|
128972
129027
|
};
|
|
128973
|
-
const
|
|
128974
|
-
|
|
129028
|
+
const derivePublicOptions = (communityChallengeSettings) => {
|
|
129029
|
+
const { publicOptions, options } = communityChallengeSettings;
|
|
129030
|
+
if (!publicOptions?.length || !options) return void 0;
|
|
129031
|
+
const published = {};
|
|
129032
|
+
for (const optionName of publicOptions) if (typeof options[optionName] === "string") published[optionName] = options[optionName];
|
|
129033
|
+
return e$5(published) ? void 0 : published;
|
|
129034
|
+
};
|
|
129035
|
+
const loadChallengeFileFromCommunityChallengeSettings = async ({ communityChallengeSettings, pkc }) => {
|
|
128975
129036
|
let challengeFile = void 0;
|
|
128976
129037
|
if (communityChallengeSettings.path) try {
|
|
128977
129038
|
const importedFile = await import(pathToFileURL(communityChallengeSettings.path).href);
|
|
@@ -128994,6 +129055,14 @@ const getCommunityChallengeFromCommunityChallengeSettings = async ({ communityCh
|
|
|
128994
129055
|
challengeFile = ChallengeFileSchema.parse(ChallengeFileFactory({ challengeSettings: communityChallengeSettings }));
|
|
128995
129056
|
}
|
|
128996
129057
|
if (!challengeFile) throw Error("Failed to load challenge file");
|
|
129058
|
+
return challengeFile;
|
|
129059
|
+
};
|
|
129060
|
+
const getCommunityChallengeFromCommunityChallengeSettings = async ({ communityChallengeSettings, pkc }) => {
|
|
129061
|
+
communityChallengeSettings = CommunityChallengeSettingSchema.parse(communityChallengeSettings);
|
|
129062
|
+
const challengeFile = await loadChallengeFileFromCommunityChallengeSettings({
|
|
129063
|
+
communityChallengeSettings,
|
|
129064
|
+
pkc
|
|
129065
|
+
});
|
|
128997
129066
|
const { challenge, type } = challengeFile;
|
|
128998
129067
|
return { communityChallenge: {
|
|
128999
129068
|
exclude: communityChallengeSettings.exclude,
|
|
@@ -129001,7 +129070,8 @@ const getCommunityChallengeFromCommunityChallengeSettings = async ({ communityCh
|
|
|
129001
129070
|
challenge,
|
|
129002
129071
|
type,
|
|
129003
129072
|
caseInsensitive: challengeFile.caseInsensitive,
|
|
129004
|
-
pendingApproval: communityChallengeSettings.pendingApproval
|
|
129073
|
+
pendingApproval: communityChallengeSettings.pendingApproval,
|
|
129074
|
+
publicOptions: derivePublicOptions(communityChallengeSettings)
|
|
129005
129075
|
} };
|
|
129006
129076
|
};
|
|
129007
129077
|
//#endregion
|
|
@@ -129211,14 +129281,16 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
|
|
|
129211
129281
|
const log = logger_default("pkc-js:rpc-remote-community:stop");
|
|
129212
129282
|
if (this.state === "stopped") return;
|
|
129213
129283
|
if (this._updatingRpcCommunityInstanceWithListeners) await this._cleanupMirroringUpdatingCommunity();
|
|
129214
|
-
else
|
|
129215
|
-
|
|
129216
|
-
|
|
129217
|
-
|
|
129218
|
-
|
|
129284
|
+
else {
|
|
129285
|
+
if (this._updateRpcSubscriptionId) {
|
|
129286
|
+
try {
|
|
129287
|
+
await this._pkc._pkcRpcClient.unsubscribe(this._updateRpcSubscriptionId);
|
|
129288
|
+
} catch (e) {
|
|
129289
|
+
log.error("Failed to unsubscribe from communityUpdate", e);
|
|
129290
|
+
}
|
|
129291
|
+
this._updateRpcSubscriptionId = void 0;
|
|
129292
|
+
log.trace(`Stopped the update of remote community (${this.address}) via RPC`);
|
|
129219
129293
|
}
|
|
129220
|
-
this._updateRpcSubscriptionId = void 0;
|
|
129221
|
-
log.trace(`Stopped the update of remote community (${this.address}) via RPC`);
|
|
129222
129294
|
untrackUpdatingCommunity(this._pkc, this);
|
|
129223
129295
|
}
|
|
129224
129296
|
this._setRpcClientStateWithEmission("stopped");
|
|
@@ -129593,4 +129665,4 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
|
|
|
129593
129665
|
}
|
|
129594
129666
|
};
|
|
129595
129667
|
//#endregion
|
|
129596
|
-
export {
|
|
129668
|
+
export { RepliesPages as $, RpcUnsubscribeParamSchema as $n, getPublicKeyFromPrivateKey as $t, deriveDbPosts as A, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as An, verifyCommentIpfs as At, setNativeFunctions as B, RpcEditCommunityParamSchema as Bn, getAuthorNameFromWire as Bt, BackupAbortError as C, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as Cn, signCommunityEdit as Ct, createKuboRpcClient as D, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as Dn, verifyChallengeRequest as Dt, calculateInlineRepliesBudget as E, parseJsonWithPKCErrorIfFails as En, verifyChallengeMessage as Et, importSignerIntoKuboNode as F, RpcCancelExportParamSchema as Fn, verifyCommunityEdit as Ft, REPLY_REPLIES_SORT_TYPES as G, RpcFetchCidParamSchema as Gn, getCommunityPublicKeyFromWire as Gt, CommentClientsManager as H, RpcExportCommunityModLogsResultSchema as Hn, buildRuntimeCommunityFields as Ht, listCommunitiesSync as I, RpcCidParamSchema as In, verifyVote as It, buildPagesRuntimeFields as J, RpcPublishChallengeAnswersParamSchema as Jn, encode as Jt, TIMEFRAMES_TO_SECONDS as K, RpcFetchCidResultSchema as Kn, normalizeCommunityInputFromCommunity as Kt, monitorCommunitiesDirectory as L, RpcCommentRepliesPageParamSchema as Ln, buildRuntimeAuthor as Lt, getDefaultCommunityDbConfig as M, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as Mn, verifyCommentPubsubMessage as Mt, getDefaultDataPath as N, RpcAnchorPublishPreparationResultSchema as Nn, verifyCommentUpdate as Nt, deleteOldCommunityInWindows as O, parseRpcCommentEventWithPKCErrorIfItFails as On, verifyChallengeVerification as Ot, getThumbnailPropsOfLink as P, RpcAuthorNameParamSchema as Pn, verifyCommunity as Pt, parseRawPages as Q, RpcSuccessResultSchema as Qn, getPKCAddressFromPublicKeySync as Qt, moveCommunityDbToDeletedDirectory as R, RpcCommunityIdentifierParamSchema as Rn, cleanWireAuthor as Rt, encryptEd25519AesGcmPublicKeyBuffer as S, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as Sn, signCommunity as St, calculateExpectedSignatureSize as T, parseDecryptedChallengeWithPKCErrorIfItFails as Tn, verifyChallengeAnswer as Tt, POSTS_SORT_TYPES as U, RpcExportCommunityParamSchema as Un, getCommunityAddressFromRecord as Ut, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as V, RpcExportCommunityModLogsParamSchema as Vn, normalizeCreatePublicationAuthor as Vt, POST_REPLIES_SORT_TYPES as W, RpcExportCommunityResultSchema as Wn, getCommunityNameFromWire$1 as Wt, findCommentInPageInstanceRecursively as X, RpcResolveAuthorNameResultSchema as Xn, getIpfsKeyFromPrivateKey as Xt, extractCommunityRuntimeFieldsFromParsedPages as Y, RpcPublishedAnchorRecordResultSchema as Yn, getBufferedPKCAddressFromPublicKey as Yt, iterateOverPageCidsToFindAllCids as Z, RpcSubscriptionIdResultSchema as Zn, getPKCAddressFromPublicKey as Zt, createSigner as _, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as _n, signComment as _t, loadChallengeFileFromCommunityChallengeSettings as a, parseCommentIpfsSchemaWithPKCErrorIfItFails as an, t$5 as ar, PublicationClientsManager as at, decryptEd25519AesGcmPublicKeyBuffer as b, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as bn, signCommentUpdate as bt, LRUCache as c, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as cn, t$7 as cr, pRetry as ct, KeyvBetterSqlite3 as d, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as dn, STORAGE_KEYS as dr, require_lib$1 as dt, createSchemaRowParser as en, crosspostChainDepthUpTo as er, applyNameResolvedCacheToCrosspost as et, decodeRpcChallengeAnswerPubsubMsg as f, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as fn, require_lodash_merge as fr, cleanUpBeforePublishing as ft, SignerWithPublicKeyAddress as g, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as gn, signChallengeVerification as gt, decodeRpcChallengeVerificationPubsubMsg as h, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as hn, signChallengeRequest as ht, getCommunityChallengeFromCommunityChallengeSettings as i, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as in, r as ir, stripNameResolvedFromCrosspost as it, deriveDbReplies as j, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as jn, verifyCommentModeration as jt, deriveCommentIpfsFromCommentTableRow as k, parseRpcCommentUpdateEventWithPKCErrorIfItFails as kn, verifyCommentEdit as kt, RemoteCommunity as l, parseCommunityAddressWithPKCErrorIfItFails as ln, t$8 as lr, pLimit as lt, decodeRpcChallengeRequestPubsubMsg as m, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as mn, require_undici as mr, signChallengeMessage as mt, RpcRemoteCommunity as n, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as nn, t$2 as nr, collectCrosspostAuthorsToResolve as nt, pkcJsChallenges as o, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as on, n$5 as or, PKCClientsManager as ot, decodeRpcChallengePubsubMsg as p, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as pn, nativeFunctions$1 as pr, signChallengeAnswer as pt, buildPageRuntimeFields as q, RpcPublishAnchorRecordParamSchema as qn, decode as qt, getChallengeVerification as r, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as rn, t$4 as rr, extractCrosspostRuntimeFields as rt, TrackedInstanceRegistry as s, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as sn, n$6 as sr, InflightFetchManager as st, RpcLocalCommunity as t, parseCidStringSchemaWithPKCErrorIfItFails as tn, effectiveMaxCrosspostDepth as tr, cloneCrosspostForRuntime as tt, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as u, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as un, stringify as ur, PKCTypedEmitter as ut, createAnchorIpnsRecord as v, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as vn, signCommentEdit as vt, backupCommunityDb as w, parseDecryptedChallengeVerification as wn, signVote as wt, encryptEd25519AesGcm as x, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as xn, signCommentUpdateForChallengeVerification as xt, decryptEd25519AesGcm as y, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as yn, signCommentModeration as yt, resolveDbPostsCidRefs as z, RpcCommunityPageParamSchema as zn, getAuthorNameFromRuntime as zt };
|
|
@@ -1429,6 +1429,20 @@ const $ZodNever = /*@__PURE__*/ $constructor("$ZodNever", (inst, def) => {
|
|
|
1429
1429
|
return payload;
|
|
1430
1430
|
};
|
|
1431
1431
|
});
|
|
1432
|
+
const $ZodVoid = /*@__PURE__*/ $constructor("$ZodVoid", (inst, def) => {
|
|
1433
|
+
$ZodType.init(inst, def);
|
|
1434
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1435
|
+
const input = payload.value;
|
|
1436
|
+
if (typeof input === "undefined") return payload;
|
|
1437
|
+
payload.issues.push({
|
|
1438
|
+
expected: "void",
|
|
1439
|
+
code: "invalid_type",
|
|
1440
|
+
input,
|
|
1441
|
+
inst
|
|
1442
|
+
});
|
|
1443
|
+
return payload;
|
|
1444
|
+
};
|
|
1445
|
+
});
|
|
1432
1446
|
function handleArrayResult(result, final, index) {
|
|
1433
1447
|
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
1434
1448
|
final.value[index] = result.value;
|
|
@@ -2681,6 +2695,13 @@ function _never(Class, params) {
|
|
|
2681
2695
|
});
|
|
2682
2696
|
}
|
|
2683
2697
|
// @__NO_SIDE_EFFECTS__
|
|
2698
|
+
function _void$1(Class, params) {
|
|
2699
|
+
return new Class({
|
|
2700
|
+
type: "void",
|
|
2701
|
+
...normalizeParams(params)
|
|
2702
|
+
});
|
|
2703
|
+
}
|
|
2704
|
+
// @__NO_SIDE_EFFECTS__
|
|
2684
2705
|
function _lt(value, params) {
|
|
2685
2706
|
return new $ZodCheckLessThan({
|
|
2686
2707
|
check: "less_than",
|
|
@@ -3229,6 +3250,9 @@ const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
|
3229
3250
|
const undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
3230
3251
|
if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
|
|
3231
3252
|
};
|
|
3253
|
+
const voidProcessor = (_schema, ctx, _json, _params) => {
|
|
3254
|
+
if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
|
|
3255
|
+
};
|
|
3232
3256
|
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
3233
3257
|
json.not = {};
|
|
3234
3258
|
};
|
|
@@ -3845,6 +3869,14 @@ const ZodNever = /*@__PURE__*/ $constructor("ZodNever", (inst, def) => {
|
|
|
3845
3869
|
function never(params) {
|
|
3846
3870
|
return /* @__PURE__ */ _never(ZodNever, params);
|
|
3847
3871
|
}
|
|
3872
|
+
const ZodVoid = /*@__PURE__*/ $constructor("ZodVoid", (inst, def) => {
|
|
3873
|
+
$ZodVoid.init(inst, def);
|
|
3874
|
+
ZodType.init(inst, def);
|
|
3875
|
+
inst._zod.processJSONSchema = (ctx, json, params) => voidProcessor(inst, ctx, json, params);
|
|
3876
|
+
});
|
|
3877
|
+
function _void(params) {
|
|
3878
|
+
return /* @__PURE__ */ _void$1(ZodVoid, params);
|
|
3879
|
+
}
|
|
3848
3880
|
const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
|
|
3849
3881
|
$ZodArray.init(inst, def);
|
|
3850
3882
|
ZodType.init(inst, def);
|
|
@@ -5153,6 +5185,9 @@ var messages;
|
|
|
5153
5185
|
messages["ERR_FETCH_OVER_IPNS_OVER_PUBSUB_RETURNED_UNDEFINED"] = "libp2p Fetch over IPNS-Over-Pubsub returned undefined when requested from a peer";
|
|
5154
5186
|
messages["ERR_FAILED_TO_DIAL_ANY_PEERS_PROVIDING_CID"] = "Failed to dial and connect to any peers providing a CID";
|
|
5155
5187
|
messages["ERR_GET_COMMUNITY_TIMED_OUT"] = "pkc.getCommunity({address}) timed out";
|
|
5188
|
+
messages["ERR_GET_COMMUNITY_ABORTED"] = "Aborted while waiting for the community record to load";
|
|
5189
|
+
messages["ERR_COMMUNITY_STOPPED_WHILE_LOADING"] = "The community instance was stopped while its record was being loaded";
|
|
5190
|
+
messages["ERR_GET_COMMENT_ABORTED"] = "Aborted while waiting for the comment record to load";
|
|
5156
5191
|
messages["ERR_TIMEOUT_WAITING_FOR_PUBSUB_TOPIC_PEERS"] = "Timeout waiting for propagation of pubsub topic peers";
|
|
5157
5192
|
messages["ERR_PUBSUB_TOPIC_PEER_WAIT_ABORTED"] = "Aborted while waiting for a peer to subscribe to a pubsub topic";
|
|
5158
5193
|
messages["ERR_IPNS_DIRECT_FETCH_ABORTED"] = "Aborted while fetching an IPNS record directly from subscribers/providers";
|
|
@@ -5517,6 +5552,11 @@ var messages;
|
|
|
5517
5552
|
messages["ERR_CHALLENGE_RESULT_OVERRIDES_RESERVED_COMMENT_UPDATE_FIELD"] = "A challenge result attempted to set commentUpdate.<field> that is in CommentUpdateChallengeReservedFieldNames (community-computed field)";
|
|
5518
5553
|
messages["ERR_CHALLENGE_RESULT_OVERRIDES_NON_COMMUNITY_AUTHOR_KEY"] = "A challenge result attempted to set commentUpdate.author.<field> with a key other than 'community' — challenges may only extend commentUpdate.author.community";
|
|
5519
5554
|
messages["ERR_CHALLENGE_RESULT_OVERRIDES_RESERVED_COMMUNITY_AUTHOR_FIELD"] = "A challenge result attempted to set commentUpdate.author.community.<field> that is in CommunityAuthorChallengeReservedFieldNames (community-computed or mod-settable field)";
|
|
5555
|
+
messages["ERR_CHALLENGE_OPTION_NOT_DECLARED_IN_OPTION_INPUTS"] = "settings.challenges[i].options has a key that no optionInputs entry of the challenge declares, so it is never read";
|
|
5556
|
+
messages["ERR_CHALLENGE_REQUIRED_OPTION_MISSING"] = "settings.challenges[i].options is missing an option whose optionInputs entry is required";
|
|
5557
|
+
messages["ERR_CHALLENGE_PUBLIC_OPTION_NOT_DECLARED_IN_OPTION_INPUTS"] = "settings.challenges[i].publicOptions names an option that no optionInputs entry of the challenge declares";
|
|
5558
|
+
messages["ERR_CHALLENGE_SETTINGS_VALIDATION_FAILED"] = "The challenge's validateChallengeSettings hook rejected settings.challenges[i]";
|
|
5559
|
+
messages["ERR_CHALLENGE_SETTINGS_VALIDATION_FAILED_FOR_CHALLENGES"] = "One or more challenges in settings.challenges failed validation";
|
|
5520
5560
|
})(messages || (messages = {}));
|
|
5521
5561
|
//#endregion
|
|
5522
5562
|
//#region dist/node/pkc-error.js
|
|
@@ -6463,7 +6503,8 @@ const additionalCommentReservedFields = [
|
|
|
6463
6503
|
"publishingState",
|
|
6464
6504
|
"updatingState",
|
|
6465
6505
|
"rowid",
|
|
6466
|
-
"nameResolved"
|
|
6506
|
+
"nameResolved",
|
|
6507
|
+
"abortSignal"
|
|
6467
6508
|
];
|
|
6468
6509
|
const CommentPubsubMessageReservedFields = r$2(n([
|
|
6469
6510
|
...t$3(CommentIpfsSchema.shape),
|
|
@@ -6645,6 +6686,7 @@ const CommunityChallengeSettingSchema = object({
|
|
|
6645
6686
|
path: string().optional(),
|
|
6646
6687
|
name: string().optional(),
|
|
6647
6688
|
options: record(string(), string()).optional(),
|
|
6689
|
+
publicOptions: string().array().optional(),
|
|
6648
6690
|
exclude: ChallengeExcludeSchema.array().nonempty().optional(),
|
|
6649
6691
|
description: string().optional(),
|
|
6650
6692
|
pendingApproval: boolean().optional()
|
|
@@ -6655,7 +6697,7 @@ const GetChallengeArgsSchema = object({
|
|
|
6655
6697
|
challengeIndex: number().int().nonnegative(),
|
|
6656
6698
|
community: custom()
|
|
6657
6699
|
});
|
|
6658
|
-
const ChallengeFileSchema =
|
|
6700
|
+
const ChallengeFileSchema = looseObject({
|
|
6659
6701
|
optionInputs: ChallengeOptionInputSchema.array().optional(),
|
|
6660
6702
|
type: ChallengeFromGetChallengeSchema.shape.type,
|
|
6661
6703
|
challenge: ChallengeFromGetChallengeSchema.shape.challenge.optional(),
|
|
@@ -6664,15 +6706,20 @@ const ChallengeFileSchema = object({
|
|
|
6664
6706
|
getChallenge: _function({
|
|
6665
6707
|
input: [GetChallengeArgsSchema],
|
|
6666
6708
|
output: promise(ResultOfGetChallengeSchema)
|
|
6667
|
-
})
|
|
6668
|
-
|
|
6709
|
+
}),
|
|
6710
|
+
validateChallengeSettings: _function({
|
|
6711
|
+
input: [object({ challengeSettings: CommunityChallengeSettingSchema })],
|
|
6712
|
+
output: _void()
|
|
6713
|
+
}).optional()
|
|
6714
|
+
});
|
|
6669
6715
|
const CommunityChallengeSchema = looseObject({
|
|
6670
6716
|
exclude: ChallengeExcludeSchema.array().nonempty().optional(),
|
|
6671
6717
|
description: ChallengeFileSchema.shape.description,
|
|
6672
6718
|
challenge: ChallengeFileSchema.shape.challenge,
|
|
6673
6719
|
type: ChallengeFileSchema.shape.type,
|
|
6674
6720
|
caseInsensitive: ChallengeFileSchema.shape.caseInsensitive,
|
|
6675
|
-
pendingApproval: boolean().optional()
|
|
6721
|
+
pendingApproval: boolean().optional(),
|
|
6722
|
+
publicOptions: record(string(), string()).optional()
|
|
6676
6723
|
});
|
|
6677
6724
|
const ChallengeFileFactorySchema = _function({
|
|
6678
6725
|
input: [object({ challengeSettings: CommunityChallengeSettingSchema })],
|
|
@@ -6817,7 +6864,8 @@ const CommunityIpfsReservedFields = r$2([
|
|
|
6817
6864
|
"publishingState",
|
|
6818
6865
|
"updatingState",
|
|
6819
6866
|
"started",
|
|
6820
|
-
"exports"
|
|
6867
|
+
"exports",
|
|
6868
|
+
"abortSignal"
|
|
6821
6869
|
], t$3(CommunityIpfsSchema.shape));
|
|
6822
6870
|
//#endregion
|
|
6823
6871
|
//#region dist/node/publications/comment-moderation/schema.js
|
|
@@ -15613,7 +15661,50 @@ async function resolveWhenPredicateIsTrue(options) {
|
|
|
15613
15661
|
listener();
|
|
15614
15662
|
});
|
|
15615
15663
|
}
|
|
15616
|
-
|
|
15664
|
+
function rejectWhenAbortSignalFires(opts) {
|
|
15665
|
+
const { abortSignal, error } = opts;
|
|
15666
|
+
let rejectPromise;
|
|
15667
|
+
const promise = new Promise((_, reject) => {
|
|
15668
|
+
rejectPromise = reject;
|
|
15669
|
+
});
|
|
15670
|
+
promise.catch(() => {});
|
|
15671
|
+
const onAbort = () => rejectPromise?.(error());
|
|
15672
|
+
abortSignal?.addEventListener("abort", onAbort);
|
|
15673
|
+
const cleanup = () => abortSignal?.removeEventListener("abort", onAbort);
|
|
15674
|
+
if (abortSignal?.aborted) onAbort();
|
|
15675
|
+
return {
|
|
15676
|
+
promise,
|
|
15677
|
+
cleanup
|
|
15678
|
+
};
|
|
15679
|
+
}
|
|
15680
|
+
function rejectWhenCommunityStopsOrAborts(opts) {
|
|
15681
|
+
const { community, abortSignal } = opts;
|
|
15682
|
+
let rejectPromise;
|
|
15683
|
+
const promise = new Promise((_, reject) => {
|
|
15684
|
+
rejectPromise = reject;
|
|
15685
|
+
});
|
|
15686
|
+
promise.catch(() => {});
|
|
15687
|
+
const onAbort = () => rejectPromise?.(new PKCError("ERR_GET_COMMUNITY_ABORTED", {
|
|
15688
|
+
communityAddress: community.address,
|
|
15689
|
+
abortReason: abortSignal?.reason
|
|
15690
|
+
}));
|
|
15691
|
+
const onStateChange = (newState) => {
|
|
15692
|
+
if (newState === "stopped") rejectPromise?.(new PKCError("ERR_COMMUNITY_STOPPED_WHILE_LOADING", { communityAddress: community.address }));
|
|
15693
|
+
};
|
|
15694
|
+
community.on("statechange", onStateChange);
|
|
15695
|
+
abortSignal?.addEventListener("abort", onAbort);
|
|
15696
|
+
const cleanup = () => {
|
|
15697
|
+
community.removeListener("statechange", onStateChange);
|
|
15698
|
+
abortSignal?.removeEventListener("abort", onAbort);
|
|
15699
|
+
};
|
|
15700
|
+
if (abortSignal?.aborted) onAbort();
|
|
15701
|
+
return {
|
|
15702
|
+
promise,
|
|
15703
|
+
cleanup
|
|
15704
|
+
};
|
|
15705
|
+
}
|
|
15706
|
+
async function waitForUpdateInCommunityInstanceWithErrorAndTimeout(opts) {
|
|
15707
|
+
const { community, timeoutMs, abortSignal } = opts;
|
|
15617
15708
|
const wasUpdating = community.state === "updating";
|
|
15618
15709
|
const updatingStates = [];
|
|
15619
15710
|
const updatingStateChangeListener = (state) => updatingStates.push(state);
|
|
@@ -15642,10 +15733,33 @@ async function waitForUpdateInCommunityInstanceWithErrorAndTimeout(community, ti
|
|
|
15642
15733
|
}
|
|
15643
15734
|
};
|
|
15644
15735
|
community.on("error", errorListener);
|
|
15736
|
+
let abortError;
|
|
15737
|
+
let abortReject;
|
|
15738
|
+
const abortListener = () => {
|
|
15739
|
+
abortError = new PKCError("ERR_GET_COMMUNITY_ABORTED", {
|
|
15740
|
+
communityAddress: community.address,
|
|
15741
|
+
abortReason: abortSignal?.reason,
|
|
15742
|
+
updatingStates,
|
|
15743
|
+
errors
|
|
15744
|
+
});
|
|
15745
|
+
abortReject?.(abortError);
|
|
15746
|
+
};
|
|
15747
|
+
const abortPromise = new Promise((_, reject) => {
|
|
15748
|
+
abortReject = reject;
|
|
15749
|
+
});
|
|
15750
|
+
abortPromise.catch(() => {});
|
|
15751
|
+
if (abortSignal) if (abortSignal.aborted) abortListener();
|
|
15752
|
+
else abortSignal.addEventListener("abort", abortListener);
|
|
15645
15753
|
try {
|
|
15754
|
+
if (abortError) throw abortError;
|
|
15646
15755
|
if (community.state !== "started") await community.update();
|
|
15756
|
+
if (abortError) throw abortError;
|
|
15647
15757
|
if (criticalError) throw criticalError;
|
|
15648
|
-
await pTimeout(Promise.race([
|
|
15758
|
+
await pTimeout(Promise.race([
|
|
15759
|
+
updatePromise,
|
|
15760
|
+
nonRetriableErrorPromise,
|
|
15761
|
+
abortPromise
|
|
15762
|
+
]), {
|
|
15649
15763
|
milliseconds: timeoutMs,
|
|
15650
15764
|
message: criticalError || errors.at(-1) || new PKCError("ERR_GET_COMMUNITY_TIMED_OUT", {
|
|
15651
15765
|
communityAddress: community.address,
|
|
@@ -15657,6 +15771,7 @@ async function waitForUpdateInCommunityInstanceWithErrorAndTimeout(community, ti
|
|
|
15657
15771
|
});
|
|
15658
15772
|
if (criticalError) throw criticalError;
|
|
15659
15773
|
} catch (e) {
|
|
15774
|
+
if (abortError) throw abortError;
|
|
15660
15775
|
if (criticalError) throw criticalError;
|
|
15661
15776
|
if (errors.length > 0) throw errors.at(-1);
|
|
15662
15777
|
const updatingCommunity = findUpdatingCommunity(community._pkc, {
|
|
@@ -15666,6 +15781,7 @@ async function waitForUpdateInCommunityInstanceWithErrorAndTimeout(community, ti
|
|
|
15666
15781
|
if (updatingCommunity?._clientsManager._ipnsLoadingOperation?.mainError()) throw updatingCommunity._clientsManager._ipnsLoadingOperation.mainError();
|
|
15667
15782
|
throw e;
|
|
15668
15783
|
} finally {
|
|
15784
|
+
abortSignal?.removeEventListener("abort", abortListener);
|
|
15669
15785
|
if (updateListener) community.removeListener("update", updateListener);
|
|
15670
15786
|
community.removeListener("error", errorListener);
|
|
15671
15787
|
community.removeListener("updatingstatechange", updatingStateChangeListener);
|
|
@@ -16078,7 +16194,7 @@ function extractNetworkErrorDetails(err, depth = 0) {
|
|
|
16078
16194
|
}
|
|
16079
16195
|
//#endregion
|
|
16080
16196
|
//#region dist/node/generated-version.js
|
|
16081
|
-
const version = "0.0.
|
|
16197
|
+
const version = "0.0.85";
|
|
16082
16198
|
//#endregion
|
|
16083
16199
|
//#region dist/node/version.js
|
|
16084
16200
|
const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
|
|
@@ -16232,4 +16348,4 @@ const DecryptedChallengeVerificationSchema = object({
|
|
|
16232
16348
|
}).strict();
|
|
16233
16349
|
const ChallengeVerificationMessageSignedPropertyNames = t$3(n$3(ChallengeVerificationMessageSchema.shape, ["signature"]));
|
|
16234
16350
|
//#endregion
|
|
16235
|
-
export { pubsubTopicToDhtKey as $, n
|
|
16351
|
+
export { pubsubTopicToDhtKey as $, n as $n, ChallengeFileSchema as $t, extractNetworkErrorDetails as A, CommentUpdateSignedPropertyNames as An, literal as Ar, refreshTrackedCommunityAliases as At, isIpfsCid as B, CommentEditReservedFields as Bn, pTimeout as Bt, contentContainsMarkdownAudio as C, CommentPubsubMessageWithFlexibleAuthorRefinementSchema as Cn, require_supports_color as Cr, findStartedCommunity as Ct, deepMergeRuntimeFields as D, CommentUpdateForChallengeVerificationSignedPropertyNames as Dn, array as Dr, listUpdatingComments as Dt, createAbortError as E, CommentUpdateForChallengeVerificationSchema as En, _enum as Er, listStartedCommunities as Et, getIpnsRecordInLocalKuboNode as F, ModQueuePageIpfsSchema as Fn, ZodError as Fr, untrackStartedCommunity as Ft, isLinkOfAudio as G, AuthorCommentIpfsReservedFields as Gn, CreateCommunityEditPublicationOptionsWithRefinementSchema as Gt, isIpns as H, CommentEditsTableRowSchema as Hn, CommunityEditPublicationPubsubReservedFields as Ht, getPostUpdateTimestampRange as I, PageIpfsSchema as In, joinValues as Ir, untrackUpdatingComment as It, isLinkOfVideo as J, CidPathSchema as Jn, CommentModerationReservedFields as Jt, isLinkOfImage as K, AuthorReservedFields as Kn, CommentModerationChallengeRequestToEncryptSchema as Kt, hideClassPrivateProps as L, CommentEditChallengeRequestToEncryptSchema as Ln, parsedType as Lr, untrackUpdatingCommunity as Lt, genToArray as M, CommentsTableRowSchema as Mn, object as Mr, trackStartedCommunity as Mt, getEquivalentCommunityAddresses as N, CreateCommentOptionsWithRefinementSchema as Nn, record as Nr, trackUpdatingComment as Nt, derivePublicationFromChallengeRequest as O, CommentUpdateReservedFields as On, boolean as Or, listUpdatingCommunities as Ot, getErrorCodeFromMessage as P, GetPageParamSchema as Pn, string as Pr, trackUpdatingCommunity as Pt, isStringDomain as Q, CreateSignerSchema as Qn, ChallengeFileFactorySchema as Qt, ipnsNameToIpnsOverPubsubTopic as R, CommentEditPubsubMessagePublicationSchema as Rn, stringifyPrimitive as Rr, require_sha256 as Rt, calculateStringSizeSameAsIpfsAddCidV0 as S, CommentPubsubMessageReservedFields as Sn, logger_default as Sr, findCommunityInRegistry as St, contentContainsMarkdownVideos as T, CommentUpdateChallengeReservedFieldNames as Tn, setErrorMap as Tr, findUpdatingCommunity as Tt, isIpnsPath as U, CreateCommentEditOptionsWithRefinementSchema as Un, CommunityEditPublicationSignedPropertyNames as Ut, isIpfsPath as V, CommentEditSignedPropertyNames as Vn, CommunityEditPublicationChallengeRequestToEncryptSchema as Vt, isLinkOfAnimatedImage as W, AuthorAddressSchema as Wn, CommunityEditPubsubMessagePublicationSchema as Wt, isRequestPubsubPublicationOfPost as X, CommunityAddressSchema as Xn, CommentModerationsTableRowSchema as Xt, isLinkValid as Y, CidStringSchema as Yn, CommentModerationSignedPropertyNames as Yt, isRequestPubsubPublicationOfReply as Z, CommunityAuthorChallengeReservedFieldNames as Zn, CreateCommentModerationOptionsWithRefinementSchema as Zt, PKCUserOptionBaseSchema as _, VoteSignedPropertyNames as _n, FailedToFetchCommunityFromGatewaysError as _r, statMfsPathSafely as _t, ChallengeRequestMessageSchema as a, CommunityIpfsSchema as an, e$2 as ar, removeMfsFilesSafely as at, areEquivalentCommunityAddresses as b, CommentIpfsReservedFields as bn, PKCError as br, waitForUpdateInCommunityInstanceWithErrorAndTimeout as bt, ChallengeVerificationMessageSignedPropertyNames as c, CreateRemoteCommunityFunctionArgumentSchema as cn, t$5 as cr, removeUndefinedValuesRecursively as ct, DecryptedChallengeRequestSchema as d, PubsubTopicSchema as dn, t$7 as dr, retryKuboBlockPutPinAndProvidePubsubTopic as dt, CommunityAnchorSchema as en, t$1 as er, pubsubTopicToDhtKeyCid as et, DecryptedChallengeSchema as f, RpcRemoteCommunityUpdateEventResultSchema as fn, t$8 as fr, retryKuboIpfsAdd as ft, PKCParsedOptionsSchema as g, VotePubsubReservedFields as gn, FailedToFetchCommentUpdateFromGatewaysError as gr, sleepUntilTimeoutOrAbort as gt, NameResolverSerializedSchema as h, VotePubsubMessagePublicationSchema as hn, FailedToFetchCommentIpfsFromGatewaysError as hr, shortifyCid as ht, ChallengeMessageSignedPropertyNames as i, CommunityIpfsReservedFields as in, e as ir, removeBlocksFromKuboNode as it, fetchAndValidateIpnsRecordFromGateway as j, CommentUpdateTableRowSchema as jn, number as jr, syncCommunityRegistryEntry as jt, doesDomainAddressHaveCapitalLetter as k, CommentUpdateSchema as kn, custom as kr, refreshTrackedCommentAliases as kt, DecryptedChallengeAnswerSchema as l, CreateRpcCommunityFunctionArgumentSchema as ln, n$7 as lr, replaceXWithY as lt, NameResolveCacheOptionsSchema as m, VoteChallengeRequestToEncryptSchema as mn, require_retry as mr, shortifyAddress as mt, ChallengeAnswerMessageSignedPropertyNames as n, CommunityEditOptionsSchema as nn, t$2 as nr, rejectWhenAbortSignalFires as nt, ChallengeRequestMessageSignedPropertyNames as o, CommunitySignedPropertyNames as on, t$4 as or, removeNullUndefinedEmptyObjectsValuesRecursively as ot, DecryptedChallengeVerificationSchema as p, CreateVoteUserOptionsWithRefinementSchema as pn, e$4 as pr, retryKuboIpfsAddAndProvide as pt, isLinkOfMedia as q, ChallengeAnswersSchema as qn, CommentModerationPubsubMessagePublicationSchema as qt, ChallengeMessageSchema as r, CommunityExportRecordsSchema as rn, t$3 as rr, rejectWhenCommunityStopsOrAborts as rt, ChallengeVerificationMessageSchema as s, CreateNewLocalCommunityUserOptionsSchema as sn, r$2 as sr, removeNullUndefinedValues as st, ChallengeAnswerMessageSchema as t, CommunityChallengeSettingSchema as tn, n$3 as tr, raceAgainstAbort as tt, DecryptedChallengeRequestPublicationSchema as u, ExportCommunityModLogsOptionsSchema as un, r$4 as ur, resolveWhenPredicateIsTrue as ut, PKCUserOptionsSchema as v, VoteTablesRowSchema as vn, FailedToFetchGenericIpfsFromGatewaysError as vr, throwIfAbortSignalAborted as vt, contentContainsMarkdownImages as w, CommentSignedPropertyNames as wn, require_ms as wr, findUpdatingComment as wt, calculateIpfsCidV0 as x, CommentIpfsSchema as xn, messages as xr, writeKuboFilesWithTimeout as xt, version_default as y, CommentChallengeRequestToEncryptSchema as yn, FailedToFetchPageIpfsFromGatewaysError as yr, timestamp as yt, isAbortError as z, CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema as zn, TimeoutError as zt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { br as PKCError, et as pubsubTopicToDhtKeyCid } from "./schema-qhSDu1BU.js";
|
|
2
2
|
import { ipnsSelector } from "ipns/selector";
|
|
3
3
|
import { equals } from "uint8arrays/equals";
|
|
4
4
|
//#region dist/node/helia/util.js
|
package/dist/bundled/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as getShortCid, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as setNativeFunctions, t as PKC } from "./chunks/node-
|
|
1
|
+
import { a as getShortCid, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as setNativeFunctions, t as PKC } from "./chunks/node-C2DKW30L.js";
|
|
2
2
|
export { challenges, createAnchorIpnsRecord, PKC as default, getShortAddress, getShortCid, nativeFunctions, setNativeFunctions };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as parseRpcPublishAnchorRecordParam, c as parseRpcAuthorNameParam, d as parseRpcCommentRepliesPageParam, f as parseRpcCommunityIdentifierParam, g as parseRpcExportCommunityParam, h as parseRpcExportCommunityModLogsParam, l as parseRpcCancelExportParam, m as parseRpcEditCommunityParam, p as parseRpcCommunityPageParam, t as PKC, u as parseRpcCidParam, v as parseRpcPublishChallengeAnswersParam, y as parseRpcUnsubscribeParam } from "../../chunks/node-
|
|
3
|
-
import { An as
|
|
4
|
-
import { t as LocalCommunity } from "../../chunks/local-community-
|
|
1
|
+
import { Ct as findStartedCommunity, L as hideClassPrivateProps, Sr as logger_default, br as PKCError, lt as replaceXWithY, rr as t, tr as n } from "../../chunks/schema-qhSDu1BU.js";
|
|
2
|
+
import { _ as parseRpcPublishAnchorRecordParam, c as parseRpcAuthorNameParam, d as parseRpcCommentRepliesPageParam, f as parseRpcCommunityIdentifierParam, g as parseRpcExportCommunityParam, h as parseRpcExportCommunityModLogsParam, l as parseRpcCancelExportParam, m as parseRpcEditCommunityParam, p as parseRpcCommunityPageParam, t as PKC, u as parseRpcCidParam, v as parseRpcPublishChallengeAnswersParam, y as parseRpcUnsubscribeParam } from "../../chunks/node-C2DKW30L.js";
|
|
3
|
+
import { An as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Cn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, J as buildPagesRuntimeFields, ct as pRetry, dn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, dt as require_lib, jn as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, lt as pLimit, nn as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, on as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, q as buildPageRuntimeFields, rn as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, rr as t$1, rt as extractCrosspostRuntimeFields, un as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, ur as stringify, vn as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails, yn as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-o0teUvw_.js";
|
|
4
|
+
import { t as LocalCommunity } from "../../chunks/local-community-BqxmCg5p.js";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import path from "path";
|
|
7
7
|
import assert from "assert";
|
|
@@ -744,7 +744,7 @@ var PKCWsServer = class extends import_lib.TypedEmitter {
|
|
|
744
744
|
challenges: t$1({
|
|
745
745
|
...PKCJs.PKC.challenges || {},
|
|
746
746
|
...pkc.settings?.challenges || {}
|
|
747
|
-
}, (challengeFactory) => n(challengeFactory({ challengeSettings: {} }), ["getChallenge"]))
|
|
747
|
+
}, (challengeFactory) => n(challengeFactory({ challengeSettings: {} }), ["getChallenge", "validateChallengeSettings"]))
|
|
748
748
|
};
|
|
749
749
|
}
|
|
750
750
|
async settingsSubscribe(params, connectionId) {
|
|
@@ -105,6 +105,7 @@ export declare const parseRpcEditCommunityParam: (params: unknown) => {
|
|
|
105
105
|
path?: string | undefined;
|
|
106
106
|
name?: string | undefined;
|
|
107
107
|
options?: Record<string, string> | undefined;
|
|
108
|
+
publicOptions?: string[] | undefined;
|
|
108
109
|
exclude?: {
|
|
109
110
|
[x: string]: unknown;
|
|
110
111
|
community?: {
|
|
@@ -377,6 +377,7 @@ export declare const RpcEditCommunityParamSchema: z.ZodObject<{
|
|
|
377
377
|
path: z.ZodOptional<z.ZodString>;
|
|
378
378
|
name: z.ZodOptional<z.ZodString>;
|
|
379
379
|
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
380
|
+
publicOptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
380
381
|
exclude: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
381
382
|
community: z.ZodOptional<z.ZodObject<{
|
|
382
383
|
addresses: z.ZodArray<z.ZodString>;
|