@pkcprotocol/pkc-js 0.0.82 → 0.0.83

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.
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $n as n$1, B as isIpfsCid, Cr as setErrorMap, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSchema, Dt as refreshTrackedCommentAliases, E as createAbortError, Et as listUpdatingCommunities, Fr as parsedType, H as isIpns, Ir as stringifyPrimitive, It as require_sha256, L as hideClassPrivateProps, Lt as TimeoutError, Pr as joinValues, Pt as untrackUpdatingComment, Q as isStringDomain, Qt as CommunityAnchorSchema, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, St as findUpdatingComment, Tt as listUpdatingComments, Zn as n$2, _t as timestamp, a as ChallengeRequestMessageSchema, ar as r, b as areEquivalentCommunityAddresses, br as logger_default, ct as resolveWhenPredicateIsTrue, fr as require_retry, ft as shortifyAddress, jt as trackUpdatingComment, k as doesDomainAddressHaveCapitalLetter, ln as PubsubTopicSchema, mt as sleepUntilTimeoutOrAbort, nr as e, ot as removeUndefinedValuesRecursively, pr as FailedToFetchCommentIpfsFromGatewaysError, pt as shortifyCid, r as ChallengeMessageSchema, rn as CommunityIpfsSchema, rr as e$1, s as ChallengeVerificationMessageSchema, st as replaceXWithY, t as ChallengeAnswerMessageSchema, tr as t$1, ut as retryKuboIpfsAdd, vr as PKCError, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSchema, wt as listStartedCommunities, xt as findStartedCommunity, y as version_default, yn as CommentIpfsSchema, yr as messages, z as isAbortError } from "./schema-BUUhufdT.js";
3
- import { $ as applyNameResolvedCacheToCrosspost, At as verifyCommentModeration, B as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Bn as RpcExportCommunityModLogsParamSchema, Bt as normalizeCreatePublicationAuthor, Cn as parseDecryptedChallengeVerification, Ct as signVote, Dn as parseRpcCommentEventWithPKCErrorIfItFails, Dt as verifyChallengeVerification, E as createKuboRpcClient, En as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, F as listCommunitiesSync, Fn as RpcCidParamSchema, Ft as verifyVote, Gn as RpcFetchCidResultSchema, Gt as normalizeCommunityInputFromCommunity, Hn as RpcExportCommunityParamSchema, Ht as getCommunityAddressFromRecord, I as monitorCommunitiesDirectory, In as RpcCommentRepliesPageParamSchema, It as buildRuntimeAuthor, J as extractCommunityRuntimeFieldsFromParsedPages, Jn as RpcPublishedAnchorRecordResultSchema, Jt as getBufferedPKCAddressFromPublicKey, Kn as RpcPublishAnchorRecordParamSchema, Kt as decode, Ln as RpcCommunityIdentifierParamSchema, Lt as cleanWireAuthor, M as getDefaultDataPath, Mn as RpcAnchorPublishPreparationResultSchema, Mt as verifyCommentUpdate, Nn as RpcAuthorNameParamSchema, On as parseRpcCommentUpdateEventWithPKCErrorIfItFails, Ot as verifyCommentEdit, Pn as RpcCancelExportParamSchema, Pt as verifyCommunityEdit, Q as RepliesPages, Qn as RpcUnsubscribeParamSchema, Rn as RpcCommunityPageParamSchema, Rt as getAuthorNameFromRuntime, Sn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, St as signCommunityEdit, Tn as parseJsonWithPKCErrorIfFails, Tt as verifyChallengeMessage, Un as RpcExportCommunityResultSchema, Ut as getCommunityNameFromWire, V as CommentClientsManager, Vn as RpcExportCommunityModLogsResultSchema, Vt as buildRuntimeCommunityFields, Wn as RpcFetchCidParamSchema, Wt as getCommunityPublicKeyFromWire, Xn as RpcSubscriptionIdResultSchema, Y as findCommentInPageInstanceRecursively, Yn as RpcResolveAuthorNameResultSchema, Z as parseRawPages, Zn as RpcSuccessResultSchema, Zt as getPKCAddressFromPublicKeySync, _ as createAnchorIpnsRecord$1, _t as signCommentEdit, a as pkcJsChallenges, ar as n$3, at as PKCClientsManager, b as encryptEd25519AesGcm, bn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, c as RemoteCommunity, cn as parseCommunityAddressWithPKCErrorIfItFails, cr as t$5, d as decodeRpcChallengeAnswerPubsubMsg, dn as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, dt as cleanUpBeforePublishing, en as parseCidStringSchemaWithPKCErrorIfItFails, et as cloneCrosspostForRuntime, f as decodeRpcChallengePubsubMsg, fr as nativeFunctions$2, ft as signChallengeAnswer, g as createSigner, gn as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, gt as signComment, hn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, in as parseCommentIpfsSchemaWithPKCErrorIfItFails, ir as t$3, it as PublicationClientsManager, jn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, jt as verifyCommentPubsubMessage, kn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, kt as verifyCommentIpfs, lt as PKCTypedEmitter, m as decodeRpcChallengeVerificationPubsubMsg, mn as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, mt as signChallengeRequest, n as RpcRemoteCommunity, o as TrackedInstanceRegistry, on as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, ot as InflightFetchManager, p as decodeRpcChallengeRequestPubsubMsg, pn as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, pr as require_undici, qn as RpcPublishChallengeAnswersParamSchema, rn as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, rt as stripNameResolvedFromCrosspost, s as LRUCache, sn as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, sr as t$2, t as RpcLocalCommunity, tr as t$4, tt as collectCrosspostAuthorsToResolve, u as KeyvBetterSqlite3, ut as require_lib$1, v as decryptEd25519AesGcm, vt as signCommentModeration, wn as parseDecryptedChallengeWithPKCErrorIfItFails, xn as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, yn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, z as setNativeFunctions$1, zn as RpcEditCommunityParamSchema } from "./rpc-local-community-0XmKyOdO.js";
4
- import { o as getHeliaDebugContext } from "./util-Cct7-RT3.js";
2
+ import { $n as n$1, B as isIpfsCid, Cr as setErrorMap, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSchema, Dt as refreshTrackedCommentAliases, E as createAbortError, Et as listUpdatingCommunities, Fr as parsedType, H as isIpns, Ir as stringifyPrimitive, It as require_sha256, L as hideClassPrivateProps, Lt as TimeoutError, Pr as joinValues, Pt as untrackUpdatingComment, Q as isStringDomain, Qt as CommunityAnchorSchema, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, St as findUpdatingComment, Tt as listUpdatingComments, Zn as n$2, _t as timestamp, a as ChallengeRequestMessageSchema, ar as r, b as areEquivalentCommunityAddresses, br as logger_default, ct as resolveWhenPredicateIsTrue, fr as require_retry, ft as shortifyAddress, jt as trackUpdatingComment, k as doesDomainAddressHaveCapitalLetter, ln as PubsubTopicSchema, mt as sleepUntilTimeoutOrAbort, nr as e, ot as removeUndefinedValuesRecursively, pr as FailedToFetchCommentIpfsFromGatewaysError, pt as shortifyCid, r as ChallengeMessageSchema, rn as CommunityIpfsSchema, rr as e$1, s as ChallengeVerificationMessageSchema, st as replaceXWithY, t as ChallengeAnswerMessageSchema, tr as t$1, ut as retryKuboIpfsAdd, vr as PKCError, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSchema, wt as listStartedCommunities, xt as findStartedCommunity, y as version_default, yn as CommentIpfsSchema, yr as messages, z as isAbortError } from "./schema-mdv9_FG5.js";
3
+ import { $ as applyNameResolvedCacheToCrosspost, At as verifyCommentModeration, B as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Bn as RpcExportCommunityModLogsParamSchema, Bt as normalizeCreatePublicationAuthor, Cn as parseDecryptedChallengeVerification, Ct as signVote, Dn as parseRpcCommentEventWithPKCErrorIfItFails, Dt as verifyChallengeVerification, E as createKuboRpcClient, En as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, F as listCommunitiesSync, Fn as RpcCidParamSchema, Ft as verifyVote, Gn as RpcFetchCidResultSchema, Gt as normalizeCommunityInputFromCommunity, Hn as RpcExportCommunityParamSchema, Ht as getCommunityAddressFromRecord, I as monitorCommunitiesDirectory, In as RpcCommentRepliesPageParamSchema, It as buildRuntimeAuthor, J as extractCommunityRuntimeFieldsFromParsedPages, Jn as RpcPublishedAnchorRecordResultSchema, Jt as getBufferedPKCAddressFromPublicKey, Kn as RpcPublishAnchorRecordParamSchema, Kt as decode, Ln as RpcCommunityIdentifierParamSchema, Lt as cleanWireAuthor, M as getDefaultDataPath, Mn as RpcAnchorPublishPreparationResultSchema, Mt as verifyCommentUpdate, Nn as RpcAuthorNameParamSchema, On as parseRpcCommentUpdateEventWithPKCErrorIfItFails, Ot as verifyCommentEdit, Pn as RpcCancelExportParamSchema, Pt as verifyCommunityEdit, Q as RepliesPages, Qn as RpcUnsubscribeParamSchema, Rn as RpcCommunityPageParamSchema, Rt as getAuthorNameFromRuntime, Sn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, St as signCommunityEdit, Tn as parseJsonWithPKCErrorIfFails, Tt as verifyChallengeMessage, Un as RpcExportCommunityResultSchema, Ut as getCommunityNameFromWire, V as CommentClientsManager, Vn as RpcExportCommunityModLogsResultSchema, Vt as buildRuntimeCommunityFields, Wn as RpcFetchCidParamSchema, Wt as getCommunityPublicKeyFromWire, Xn as RpcSubscriptionIdResultSchema, Y as findCommentInPageInstanceRecursively, Yn as RpcResolveAuthorNameResultSchema, Z as parseRawPages, Zn as RpcSuccessResultSchema, Zt as getPKCAddressFromPublicKeySync, _ as createAnchorIpnsRecord$1, _t as signCommentEdit, a as pkcJsChallenges, ar as n$3, at as PKCClientsManager, b as encryptEd25519AesGcm, bn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, c as RemoteCommunity, cn as parseCommunityAddressWithPKCErrorIfItFails, cr as t$5, d as decodeRpcChallengeAnswerPubsubMsg, dn as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, dt as cleanUpBeforePublishing, en as parseCidStringSchemaWithPKCErrorIfItFails, et as cloneCrosspostForRuntime, f as decodeRpcChallengePubsubMsg, fr as nativeFunctions$2, ft as signChallengeAnswer, g as createSigner, gn as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, gt as signComment, hn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, in as parseCommentIpfsSchemaWithPKCErrorIfItFails, ir as t$3, it as PublicationClientsManager, jn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, jt as verifyCommentPubsubMessage, kn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, kt as verifyCommentIpfs, lt as PKCTypedEmitter, m as decodeRpcChallengeVerificationPubsubMsg, mn as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, mt as signChallengeRequest, n as RpcRemoteCommunity, o as TrackedInstanceRegistry, on as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, ot as InflightFetchManager, p as decodeRpcChallengeRequestPubsubMsg, pn as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, pr as require_undici, qn as RpcPublishChallengeAnswersParamSchema, rn as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, rt as stripNameResolvedFromCrosspost, s as LRUCache, sn as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, sr as t$2, t as RpcLocalCommunity, tr as t$4, tt as collectCrosspostAuthorsToResolve, u as KeyvBetterSqlite3, ut as require_lib$1, v as decryptEd25519AesGcm, vt as signCommentModeration, wn as parseDecryptedChallengeWithPKCErrorIfItFails, xn as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, yn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, z as setNativeFunctions$1, zn as RpcEditCommunityParamSchema } from "./rpc-local-community-a464veDe.js";
4
+ import { o as getHeliaDebugContext } from "./util-y9-A9BnM.js";
5
5
  import path from "path";
6
6
  import assert from "assert";
7
7
  import fs from "fs";
@@ -6928,7 +6928,7 @@ var PKC$1 = class extends PKCTypedEmitter {
6928
6928
  this.clients.libp2pJsClients = {};
6929
6929
  if (!this.libp2pJsClientsOptions) return;
6930
6930
  if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
6931
- const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-CQY3-UYD.js");
6931
+ const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-BtjQ8rfd.js");
6932
6932
  for (const clientOptions of this.libp2pJsClientsOptions) {
6933
6933
  const heliaNode = await createLibp2pJsClientOrUseExistingOne({
6934
6934
  ...clientOptions,
@@ -7176,7 +7176,7 @@ var PKC$1 = class extends PKCTypedEmitter {
7176
7176
  const log = logger_default("pkc-js:pkc:createLocalCommunity");
7177
7177
  log.trace("Received community options to create a local community instance:", options);
7178
7178
  if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
7179
- const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-AZAEiiht.js");
7179
+ const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-B_Yg8LQH.js");
7180
7180
  const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
7181
7181
  const community = new LocalCommunity(this);
7182
7182
  if (isLocalCommunity) {
@@ -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$9, $t as CommunityChallengeSettingSchema, A as extractNetworkErrorDetails, Ar as object, At as trackStartedCommunity, B as isIpfsCid, Cn as CommentUpdateChallengeReservedFieldNames, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSchema, Dr as custom, E as createAbortError, En as CommentUpdateReservedFields, Er as boolean, Et as listUpdatingCommunities, Fn as CommentEditChallengeRequestToEncryptSchema, Ft as untrackUpdatingCommunity, Gn as ChallengeAnswersSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorAddressSchema, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, It as require_sha256$1, Jn as CommunityAddressSchema, Jt as CommentModerationsTableRowSchema, Kn as CidPathSchema, L as hideClassPrivateProps, Ln as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Mn as GetPageParamSchema, Mr as string, Mt as trackUpdatingCommunity, Nn as ModQueuePageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateSignedPropertyNames, Or as literal, Ot as refreshTrackedCommunityAliases, Pn as PageIpfsSchema, Pt as untrackUpdatingComment, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, Sn as CommentSignedPropertyNames, Sr as require_ms$1, St as findUpdatingComment, Tn as CommentUpdateForChallengeVerificationSignedPropertyNames, Tr as array, U as isIpnsPath, Un as AuthorCommentIpfsReservedFields, Ut as CreateCommunityEditPublicationOptionsWithRefinementSchema, V as isIpfsPath, Vn as CreateCommentEditOptionsWithRefinementSchema, Vt as CommunityEditPublicationSignedPropertyNames, Wt as CommentModerationChallengeRequestToEncryptSchema, X as isRequestPubsubPublicationOfPost, Xn as CreateSignerSchema, Xt as ChallengeFileFactorySchema, Yn as CommunityAuthorChallengeReservedFieldNames, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zn as n$10, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentChallengeRequestToEncryptSchema, _r as FailedToFetchPageIpfsFromGatewaysError, _t as timestamp, an as CreateNewLocalCommunityUserOptionsSchema, ar as r$8, b as areEquivalentCommunityAddresses, br as logger_default, c as ChallengeVerificationMessageSignedPropertyNames, cn as ExportCommunityModLogsOptionsSchema, cr as r$7, ct as resolveWhenPredicateIsTrue, dn as CreateVoteUserOptionsWithRefinementSchema, dr as e$4, en as CommunityEditOptionsSchema, f as DecryptedChallengeSchema, fn as VoteChallengeRequestToEncryptSchema, fr as require_retry$1, ft as shortifyAddress, g as PKCParsedOptionsSchema, gr as FailedToFetchGenericIpfsFromGatewaysError, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hn as VoteSignedPropertyNames, hr as FailedToFetchCommunityFromGatewaysError, i as ChallengeMessageSignedPropertyNames, in as CommunitySignedPropertyNames, ir as t$11, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as CreateCommentOptionsWithRefinementSchema, jr as record, k as doesDomainAddressHaveCapitalLetter, kr as number, l as DecryptedChallengeAnswerSchema, lr as t$10, m as NameResolveCacheOptionsSchema, mr as FailedToFetchCommentUpdateFromGatewaysError, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsReservedFields, nr as e$6, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRemoteCommunityFunctionArgumentSchema, or as t$12, p as DecryptedChallengeVerificationSchema, pn as VotePubsubMessagePublicationSchema, pr as FailedToFetchCommentIpfsFromGatewaysError, pt as shortifyCid, qn as CidStringSchema, qt as CommentModerationSignedPropertyNames, rn as CommunityIpfsSchema, rr as e$5, sn as CreateRpcCommunityFunctionArgumentSchema, sr as n$8, tn as CommunityExportRecordsSchema, tr as t$13, tt as raceAgainstAbort, un as RpcRemoteCommunityUpdateEventResultSchema, ur as t$9, v as PKCUserOptionsSchema, vn as CommentIpfsReservedFields, vr as PKCError, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wr as _enum, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, xr as require_supports_color, xt as findStartedCommunity, yn as CommentIpfsSchema, yr as messages, z as isAbortError, zn as CommentEditSignedPropertyNames, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-BUUhufdT.js";
2
+ import { $ as pubsubTopicToDhtKey, $n as n$9, $t as CommunityChallengeSettingSchema, A as extractNetworkErrorDetails, Ar as object, At as trackStartedCommunity, B as isIpfsCid, Cn as CommentUpdateChallengeReservedFieldNames, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSchema, Dr as custom, E as createAbortError, En as CommentUpdateReservedFields, Er as boolean, Et as listUpdatingCommunities, Fn as CommentEditChallengeRequestToEncryptSchema, Ft as untrackUpdatingCommunity, Gn as ChallengeAnswersSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorAddressSchema, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, It as require_sha256$1, Jn as CommunityAddressSchema, Jt as CommentModerationsTableRowSchema, Kn as CidPathSchema, L as hideClassPrivateProps, Ln as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Mn as GetPageParamSchema, Mr as string, Mt as trackUpdatingCommunity, Nn as ModQueuePageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateSignedPropertyNames, Or as literal, Ot as refreshTrackedCommunityAliases, Pn as PageIpfsSchema, Pt as untrackUpdatingComment, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, Sn as CommentSignedPropertyNames, Sr as require_ms$1, St as findUpdatingComment, Tn as CommentUpdateForChallengeVerificationSignedPropertyNames, Tr as array, U as isIpnsPath, Un as AuthorCommentIpfsReservedFields, Ut as CreateCommunityEditPublicationOptionsWithRefinementSchema, V as isIpfsPath, Vn as CreateCommentEditOptionsWithRefinementSchema, Vt as CommunityEditPublicationSignedPropertyNames, Wt as CommentModerationChallengeRequestToEncryptSchema, X as isRequestPubsubPublicationOfPost, Xn as CreateSignerSchema, Xt as ChallengeFileFactorySchema, Yn as CommunityAuthorChallengeReservedFieldNames, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zn as n$10, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentChallengeRequestToEncryptSchema, _r as FailedToFetchPageIpfsFromGatewaysError, _t as timestamp, an as CreateNewLocalCommunityUserOptionsSchema, ar as r$8, b as areEquivalentCommunityAddresses, br as logger_default, c as ChallengeVerificationMessageSignedPropertyNames, cn as ExportCommunityModLogsOptionsSchema, cr as r$7, ct as resolveWhenPredicateIsTrue, dn as CreateVoteUserOptionsWithRefinementSchema, dr as e$4, en as CommunityEditOptionsSchema, f as DecryptedChallengeSchema, fn as VoteChallengeRequestToEncryptSchema, fr as require_retry$1, ft as shortifyAddress, g as PKCParsedOptionsSchema, gr as FailedToFetchGenericIpfsFromGatewaysError, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hn as VoteSignedPropertyNames, hr as FailedToFetchCommunityFromGatewaysError, i as ChallengeMessageSignedPropertyNames, in as CommunitySignedPropertyNames, ir as t$11, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as CreateCommentOptionsWithRefinementSchema, jr as record, k as doesDomainAddressHaveCapitalLetter, kr as number, l as DecryptedChallengeAnswerSchema, lr as t$10, m as NameResolveCacheOptionsSchema, mr as FailedToFetchCommentUpdateFromGatewaysError, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsReservedFields, nr as e$6, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRemoteCommunityFunctionArgumentSchema, or as t$12, p as DecryptedChallengeVerificationSchema, pn as VotePubsubMessagePublicationSchema, pr as FailedToFetchCommentIpfsFromGatewaysError, pt as shortifyCid, qn as CidStringSchema, qt as CommentModerationSignedPropertyNames, rn as CommunityIpfsSchema, rr as e$5, sn as CreateRpcCommunityFunctionArgumentSchema, sr as n$8, tn as CommunityExportRecordsSchema, tr as t$13, tt as raceAgainstAbort, un as RpcRemoteCommunityUpdateEventResultSchema, ur as t$9, v as PKCUserOptionsSchema, vn as CommentIpfsReservedFields, vr as PKCError, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wr as _enum, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, xr as require_supports_color, xt as findStartedCommunity, yn as CommentIpfsSchema, yr as messages, z as isAbortError, zn as CommentEditSignedPropertyNames, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-mdv9_FG5.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";
@@ -16078,7 +16078,7 @@ function extractNetworkErrorDetails(err, depth = 0) {
16078
16078
  }
16079
16079
  //#endregion
16080
16080
  //#region dist/node/generated-version.js
16081
- const version = "0.0.82";
16081
+ const version = "0.0.83";
16082
16082
  //#endregion
16083
16083
  //#region dist/node/version.js
16084
16084
  const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
@@ -1,4 +1,4 @@
1
- import { et as pubsubTopicToDhtKeyCid, vr as PKCError } from "./schema-BUUhufdT.js";
1
+ import { et as pubsubTopicToDhtKeyCid, vr as PKCError } from "./schema-mdv9_FG5.js";
2
2
  import { ipnsSelector } from "ipns/selector";
3
3
  import { equals } from "uint8arrays/equals";
4
4
  //#region dist/node/helia/util.js
@@ -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-B1J8psGZ.js";
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-lb4SvdBh.js";
2
2
  export { challenges, createAnchorIpnsRecord, PKC as default, getShortAddress, getShortCid, nativeFunctions, setNativeFunctions };
@@ -1,7 +1,7 @@
1
- import { $n as n, L as hideClassPrivateProps, br as logger_default, st as replaceXWithY, tr as t, vr as PKCError, xt as findStartedCommunity } from "../../chunks/schema-BUUhufdT.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-B1J8psGZ.js";
3
- import { An as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, K as buildPageRuntimeFields, Sn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, _n as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails, an as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, ct as pLimit, kn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, ln as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, lr as stringify, nn as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, nr as t$1, nt as extractCrosspostRuntimeFields, q as buildPagesRuntimeFields, st as pRetry, tn as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, un as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, ut as require_lib, vn as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-0XmKyOdO.js";
4
- import { t as LocalCommunity } from "../../chunks/local-community-DRm3r1-Y.js";
1
+ import { $n as n, L as hideClassPrivateProps, br as logger_default, st as replaceXWithY, tr as t, vr as PKCError, xt as findStartedCommunity } from "../../chunks/schema-mdv9_FG5.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-lb4SvdBh.js";
3
+ import { An as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, K as buildPageRuntimeFields, Sn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, _n as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails, an as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, ct as pLimit, kn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, ln as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, lr as stringify, nn as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, nr as t$1, nt as extractCrosspostRuntimeFields, q as buildPagesRuntimeFields, st as pRetry, tn as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, un as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, ut as require_lib, vn as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-a464veDe.js";
4
+ import { t as LocalCommunity } from "../../chunks/local-community-DJM47U8C.js";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import path from "path";
7
7
  import assert from "assert";
@@ -1 +1 @@
1
- export declare const version = "0.0.82";
1
+ export declare const version = "0.0.83";
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by config/generate-version.js — do not edit
2
- export const version = "0.0.82";
2
+ export const version = "0.0.83";
3
3
  //# sourceMappingURL=generated-version.js.map
@@ -14,6 +14,7 @@ export declare class DbHandler {
14
14
  private _dbConfig;
15
15
  private _keyv;
16
16
  private _createdTables;
17
+ private _columnNamesByTable;
17
18
  constructor(community: DbHandler["_community"]);
18
19
  private _parsePrefixedComment;
19
20
  private _parseCommentsTableRow;
@@ -93,6 +94,7 @@ export declare class DbHandler {
93
94
  private _backfillTargetAuthorSignerAddress;
94
95
  private _backfillTargetAuthorDomain;
95
96
  private _getColumnNames;
97
+ private _existingColumns;
96
98
  private _copyTable;
97
99
  private _purgePublicationTablesWithDuplicateSignatures;
98
100
  private _purgeCommentEditsWithInvalidSchemaOrSignature;
@@ -39,6 +39,7 @@ export class DbHandler {
39
39
  this._community = community;
40
40
  this._transactionDepth = 0;
41
41
  this._createdTables = false;
42
+ this._columnNamesByTable = {};
42
43
  hideClassPrivateProps(this);
43
44
  }
44
45
  _parsePrefixedComment(row) {
@@ -90,6 +91,7 @@ export class DbHandler {
90
91
  await this.initDbConfigIfNeeded();
91
92
  const dbFilePath = this._dbConfig.filename;
92
93
  if (!this._db || !this._db.open) {
94
+ this._columnNamesByTable = {}; // a reopened file may have been migrated by another process
93
95
  this._db = new Database(dbFilePath, { ...this._dbConfig, ...dbConfigOptions });
94
96
  if (!this._db.readonly) {
95
97
  this._db.pragma("journal_mode = WAL");
@@ -394,6 +396,7 @@ export class DbHandler {
394
396
  this._db.exec(`DROP TABLE IF EXISTS ${tableName}`);
395
397
  this._db.exec(`DROP TABLE IF EXISTS ${TABLES.COMMENT_UPDATES}`);
396
398
  }
399
+ this._columnNamesByTable = {}; // the loop below rewrites every table's schema
397
400
  const createTableFunctions = [
398
401
  this._createCommentsTable.bind(this),
399
402
  this._createCommentUpdatesTable.bind(this),
@@ -466,6 +469,7 @@ export class DbHandler {
466
469
  const newDbVersion = this.getDbVersion();
467
470
  assert.equal(newDbVersion, env.DB_VERSION);
468
471
  this._createdTables = true;
472
+ this._columnNamesByTable = {}; // every table now carries the latest schema
469
473
  if (needToMigrate)
470
474
  log(`Created/migrated the tables to the latest (${newDbVersion}) version and saved to path`, this._dbConfig.filename);
471
475
  if (backupDbPath)
@@ -583,6 +587,19 @@ export class DbHandler {
583
587
  const results = this._db.pragma(`table_info(${tableName})`);
584
588
  return results.map((col) => col.name);
585
589
  }
590
+ // Query column lists are derived from the zod schemas, which describe the *code's* view of a
591
+ // record. A DB that has not been migrated yet is one or more columns behind that view, and
592
+ // createCommunity() reads the DB (resolveDbPostsCidRefs) before start() gets the chance to
593
+ // migrate it — selecting a column the table does not have throws and the community can never be
594
+ // loaded, let alone migrated (issue #273). Intersecting with the table's real columns keeps such
595
+ // a DB readable; the fields left out are optional on the wire and the migration in start()
596
+ // backfills the schema immediately after.
597
+ _existingColumns(tableName, columns) {
598
+ if (!this._columnNamesByTable[tableName])
599
+ this._columnNamesByTable[tableName] = this._getColumnNames(tableName);
600
+ const existing = this._columnNamesByTable[tableName];
601
+ return columns.filter((column) => existing.includes(column));
602
+ }
586
603
  async _copyTable(srcTable, dstTable, currentDbVersion) {
587
604
  const log = Logger("pkc-js:local-community:db-handler:createTablesIfNeeded:copyTable");
588
605
  const dstTableColumns = this._getColumnNames(dstTable);
@@ -1217,8 +1234,8 @@ export class DbHandler {
1217
1234
  resolveRepliesCidRefsForEntries(entries) {
1218
1235
  // For entries whose replies are in CID-ref format, resolve them by fetching descendants.
1219
1236
  // Collects all root CIDs from all entries, runs a single recursive query, then distributes results.
1220
- const commentUpdateCols = keys(CommentUpdateSchema.shape);
1221
- const commentIpfsCols = [...keys(CommentIpfsSchema.shape), "extraProps"];
1237
+ const commentUpdateCols = this._existingColumns(TABLES.COMMENT_UPDATES, keys(CommentUpdateSchema.shape));
1238
+ const commentIpfsCols = this._existingColumns(TABLES.COMMENTS, [...keys(CommentIpfsSchema.shape), "extraProps"]);
1222
1239
  // Gather all CIDs from CID-ref replies across all entries
1223
1240
  const allCids = [];
1224
1241
  for (const entry of entries) {
@@ -1366,8 +1383,8 @@ export class DbHandler {
1366
1383
  if (cids.length === 0)
1367
1384
  return [];
1368
1385
  const placeholders = cids.map(() => "?").join(",");
1369
- const commentUpdateSelects = opts.commentUpdateCols.map((col) => `cu.${col} AS commentUpdate_${col}`);
1370
- const commentIpfsSelects = opts.commentIpfsCols.map((col) => `c.${col} AS commentIpfs_${col}`);
1386
+ const commentUpdateSelects = this._existingColumns(TABLES.COMMENT_UPDATES, opts.commentUpdateCols).map((col) => `cu.${col} AS commentUpdate_${col}`);
1387
+ const commentIpfsSelects = this._existingColumns(TABLES.COMMENTS, opts.commentIpfsCols).map((col) => `c.${col} AS commentIpfs_${col}`);
1371
1388
  const queryStr = `
1372
1389
  SELECT ${commentIpfsSelects.join(", ")}, ${commentUpdateSelects.join(", ")}
1373
1390
  FROM ${TABLES.COMMENTS} c