@indexnetwork/protocol 66.0.0-rc.666.1 → 66.0.0-rc.670.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -62,7 +62,7 @@ export interface OpportunityCardsDeps {
62
62
  * @param deps - Database, cache, and presenter.
63
63
  * @param opportunity - The opportunity to present.
64
64
  * @param viewerId - The viewing user.
65
- * @param options - `intentId` focuses viewer context on one intent; `skeleton` skips the presenter; `noCache` skips the stored-card read; `peerContext` is the prior opportunity and chat when the caller already loaded them.
65
+ * @param options - `intentId` focuses viewer context on one intent; `skeleton` skips the presenter, so a card not already stored comes back blank with `presentationPending`; `noCache` skips the stored-card read; `peerContext` is the prior opportunity and chat when the caller already loaded them.
66
66
  * @returns The card, or null when the counterpart's name cannot be resolved.
67
67
  * @throws When the presenter fails.
68
68
  */
@@ -76,7 +76,7 @@ async function loadPeerContext(database, viewerId, opportunities) {
76
76
  * @param deps - Database, cache, and presenter.
77
77
  * @param opportunity - The opportunity to present.
78
78
  * @param viewerId - The viewing user.
79
- * @param options - `intentId` focuses viewer context on one intent; `skeleton` skips the presenter; `noCache` skips the stored-card read; `peerContext` is the prior opportunity and chat when the caller already loaded them.
79
+ * @param options - `intentId` focuses viewer context on one intent; `skeleton` skips the presenter, so a card not already stored comes back blank with `presentationPending`; `noCache` skips the stored-card read; `peerContext` is the prior opportunity and chat when the caller already loaded them.
80
80
  * @returns The card, or null when the counterpart's name cannot be resolved.
81
81
  * @throws When the presenter fails.
82
82
  */
@@ -91,7 +91,7 @@ export async function presentOpportunityCard(deps, opportunity, viewerId, option
91
91
  ?? (await loadPeerContext(database, viewerId, [opportunity])).get(opportunity.id);
92
92
  const cacheable = opportunity.status !== 'negotiating';
93
93
  const cacheKey = buildOpportunityCardCacheKey(opportunity.id, viewerId, options.intentId);
94
- if (cacheable && !options.skeleton && !options.noCache) {
94
+ if (cacheable && !options.noCache) {
95
95
  try {
96
96
  const hit = await deps.cache.get(cacheKey);
97
97
  if (hit && (hit.presentedPrior ?? null) === priorKey(peerContext.priorOpportunity)) {
@@ -231,10 +231,11 @@ export async function listOpportunityCards(deps, input) {
231
231
  if (hit)
232
232
  return hit;
233
233
  try {
234
+ // The stored card was already read above, so a miss here doesn't read it again.
234
235
  const card = await presentOpportunityCard(deps, opp, viewerId, {
235
236
  intentId,
236
237
  skeleton: input.skeleton,
237
- noCache: input.noCache,
238
+ noCache: true,
238
239
  peerContext: peerContexts.get(opp.id),
239
240
  });
240
241
  return card;
@@ -76,7 +76,7 @@ export interface DatabaseNetworkQueries {
76
76
  */
77
77
  getOwnedNetworks(userId: string): Promise<OwnedNetwork[]>;
78
78
  /**
79
- * Get public networks (joinPolicy 'anyone') that the user has not joined.
79
+ * Get featured public networks (joinPolicy 'anyone') that the user has not joined.
80
80
  * Used for discovering communities available to join.
81
81
  *
82
82
  * @param userId - The user ID to check memberships against
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexnetwork/protocol",
3
- "version": "66.0.0-rc.666.1",
3
+ "version": "66.0.0-rc.670.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",