@cascade-fyi/sati-sdk 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.13.0] - 2026-03-05
9
+
10
+ ### Added
11
+
12
+ - **`searchAllFeedback()`** - search feedback across all deployed schemas (FeedbackV1 + FeedbackPublicV1), merging results
13
+ - **`listAllFeedbacks()`** - async generator for bulk feedback pagination across all schemas
14
+ - **`feedbackCacheTtlMs` option** - configurable feedback cache TTL on `SATIClientOptions` (default 30s, 0 to disable)
15
+
16
+ ### Changed
17
+
18
+ - Removed `@coral-xyz/anchor` from peer dependencies (not needed by SDK consumers)
19
+ - Extracted shared feedback search logic into `_searchFeedbackForSchema()` internal helper
20
+
8
21
  ## [0.12.0] - 2026-02-21
9
22
 
10
23
  ### Added
@@ -228,6 +241,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
228
241
  - Compressed attestation storage via Light Protocol
229
242
  - Basic querying via Photon RPC
230
243
 
244
+ [0.13.0]: https://github.com/cascade-protocol/sati/compare/@cascade-fyi/sati-sdk@0.12.0...@cascade-fyi/sati-sdk@0.13.0
231
245
  [0.12.0]: https://github.com/cascade-protocol/sati/compare/@cascade-fyi/sati-sdk@0.11.0...@cascade-fyi/sati-sdk@0.12.0
232
246
  [0.11.0]: https://github.com/cascade-protocol/sati/compare/@cascade-fyi/sati-sdk@0.10.1...@cascade-fyi/sati-sdk@0.11.0
233
247
  [0.10.1]: https://github.com/cascade-protocol/sati/compare/@cascade-fyi/sati-sdk@0.10.0...@cascade-fyi/sati-sdk@0.10.1
package/dist/index.cjs CHANGED
@@ -5530,7 +5530,7 @@ var Sati = class {
5530
5530
  sendAndConfirm;
5531
5531
  lightClient;
5532
5532
  _deployedConfig;
5533
- _feedbackCache = new FeedbackCache();
5533
+ _feedbackCache;
5534
5534
  _onWarning;
5535
5535
  txConfig;
5536
5536
  /** Network configuration */
@@ -5548,6 +5548,7 @@ var Sati = class {
5548
5548
  this.lightClient = createSATILightClient(options.photonRpcUrl ?? PHOTON_URLS[options.network]);
5549
5549
  this._deployedConfig = loadDeployedConfig(options.network);
5550
5550
  this._onWarning = options.onWarning;
5551
+ this._feedbackCache = new FeedbackCache(options.feedbackCacheTtlMs);
5551
5552
  this.txConfig = {
5552
5553
  priorityFeeMicroLamports: options.transactionConfig?.priorityFeeMicroLamports ?? (options.network === "mainnet" ? 5e4 : 0),
5553
5554
  computeUnitLimit: options.transactionConfig?.computeUnitLimit ?? 4e5,
@@ -6929,6 +6930,81 @@ var Sati = class {
6929
6930
  async searchFeedback(options) {
6930
6931
  const schema = this._deployedConfig?.schemas.feedbackPublic ?? this._deployedConfig?.schemas.feedback;
6931
6932
  if (!schema) throw new Error(`No feedback schema deployed for network "${this.network}"`);
6933
+ const feedbacks = await this._searchFeedbackForSchema(schema, options);
6934
+ if (options?.includeTxHash) {
6935
+ const photon = this.getLightClient().getRpc();
6936
+ await Promise.all(feedbacks.map(async (fb) => {
6937
+ try {
6938
+ fb.txSignature = (await photon.getCompressionSignaturesForAddress(fb.compressedAddress, { limit: 1 })).items[0]?.signature;
6939
+ } catch (error) {
6940
+ this._warn({
6941
+ code: "SIGNATURE_LOOKUP_FAILED",
6942
+ message: "Failed to fetch tx signature",
6943
+ context: fb.compressedAddress,
6944
+ cause: error
6945
+ });
6946
+ }
6947
+ }));
6948
+ }
6949
+ return feedbacks;
6950
+ }
6951
+ /**
6952
+ * Search feedback across ALL deployed feedback schemas (FeedbackV1 + FeedbackPublicV1).
6953
+ *
6954
+ * Unlike `searchFeedback` which queries a single schema, this method merges
6955
+ * results from both the dual-signature (blind) and counterparty-signed schemas.
6956
+ *
6957
+ * @example
6958
+ * ```typescript
6959
+ * const allFeedback = await sati.searchAllFeedback({
6960
+ * agentMint: address("Agent..."),
6961
+ * });
6962
+ * ```
6963
+ */
6964
+ async searchAllFeedback(options) {
6965
+ const schemas = [this._deployedConfig?.schemas.feedbackPublic, this._deployedConfig?.schemas.feedback].filter((s) => s != null);
6966
+ if (schemas.length === 0) throw new Error(`No feedback schemas deployed for network "${this.network}"`);
6967
+ const allFeedbacks = [];
6968
+ for (const schema of schemas) try {
6969
+ const feedbacks = await this._searchFeedbackForSchema(schema, options);
6970
+ allFeedbacks.push(...feedbacks);
6971
+ } catch {}
6972
+ return allFeedbacks;
6973
+ }
6974
+ /**
6975
+ * Auto-paginating iterator for bulk feedback ingestion.
6976
+ *
6977
+ * Yields pages of raw feedback attestations. Handles cursor-based
6978
+ * pagination automatically. For indexers and scoring providers.
6979
+ *
6980
+ * @example
6981
+ * ```typescript
6982
+ * for await (const page of sati.listAllFeedbacks({ agentMint: address("Agent...") })) {
6983
+ * for (const item of page.items) {
6984
+ * console.log(item.data.counterparty, item.data.outcome);
6985
+ * }
6986
+ * }
6987
+ * ```
6988
+ */
6989
+ async *listAllFeedbacks(filter) {
6990
+ const schemas = [this._deployedConfig?.schemas.feedbackPublic, this._deployedConfig?.schemas.feedback].filter((s) => s != null);
6991
+ if (schemas.length === 0) throw new Error(`No feedback schemas deployed for network "${this.network}"`);
6992
+ for (const schema of schemas) {
6993
+ let cursor;
6994
+ do {
6995
+ const page = await this.listFeedbacks({
6996
+ ...filter,
6997
+ sasSchema: schema,
6998
+ cursor,
6999
+ limit: filter?.limit ?? 1e3
7000
+ });
7001
+ if (page.items.length > 0) yield page;
7002
+ cursor = page.cursor ?? void 0;
7003
+ } while (cursor);
7004
+ }
7005
+ }
7006
+ /** @internal Search feedback for a specific schema (shared logic). */
7007
+ async _searchFeedbackForSchema(schema, options) {
6932
7008
  const filter = { sasSchema: schema };
6933
7009
  if (options?.agentMint) filter.agentMint = options.agentMint;
6934
7010
  if (options?.counterparty) filter.counterparty = options.counterparty;
@@ -6968,21 +7044,6 @@ var Sati = class {
6968
7044
  createdAt
6969
7045
  });
6970
7046
  }
6971
- if (options?.includeTxHash) {
6972
- const photon = this.getLightClient().getRpc();
6973
- await Promise.all(feedbacks.map(async (fb) => {
6974
- try {
6975
- fb.txSignature = (await photon.getCompressionSignaturesForAddress(fb.compressedAddress, { limit: 1 })).items[0]?.signature;
6976
- } catch (error) {
6977
- this._warn({
6978
- code: "SIGNATURE_LOOKUP_FAILED",
6979
- message: "Failed to fetch tx signature",
6980
- context: fb.compressedAddress,
6981
- cause: error
6982
- });
6983
- }
6984
- }));
6985
- }
6986
7047
  return feedbacks;
6987
7048
  }
6988
7049
  /**
package/dist/index.d.cts CHANGED
@@ -3016,6 +3016,8 @@ interface SATIClientOptions {
3016
3016
  onWarning?: (warning: SatiWarning) => void;
3017
3017
  /** Transaction sending configuration */
3018
3018
  transactionConfig?: TransactionConfig;
3019
+ /** Feedback cache TTL in milliseconds (default: 30000). Set to 0 to disable caching. */
3020
+ feedbackCacheTtlMs?: number;
3019
3021
  }
3020
3022
  /**
3021
3023
  * SAS configuration with credential and schema addresses
@@ -4538,6 +4540,38 @@ declare class Sati {
4538
4540
  * ```
4539
4541
  */
4540
4542
  searchFeedback(options?: FeedbackSearchOptions): Promise<ParsedFeedback[]>;
4543
+ /**
4544
+ * Search feedback across ALL deployed feedback schemas (FeedbackV1 + FeedbackPublicV1).
4545
+ *
4546
+ * Unlike `searchFeedback` which queries a single schema, this method merges
4547
+ * results from both the dual-signature (blind) and counterparty-signed schemas.
4548
+ *
4549
+ * @example
4550
+ * ```typescript
4551
+ * const allFeedback = await sati.searchAllFeedback({
4552
+ * agentMint: address("Agent..."),
4553
+ * });
4554
+ * ```
4555
+ */
4556
+ searchAllFeedback(options?: FeedbackSearchOptions): Promise<ParsedFeedback[]>;
4557
+ /**
4558
+ * Auto-paginating iterator for bulk feedback ingestion.
4559
+ *
4560
+ * Yields pages of raw feedback attestations. Handles cursor-based
4561
+ * pagination automatically. For indexers and scoring providers.
4562
+ *
4563
+ * @example
4564
+ * ```typescript
4565
+ * for await (const page of sati.listAllFeedbacks({ agentMint: address("Agent...") })) {
4566
+ * for (const item of page.items) {
4567
+ * console.log(item.data.counterparty, item.data.outcome);
4568
+ * }
4569
+ * }
4570
+ * ```
4571
+ */
4572
+ listAllFeedbacks(filter?: Partial<Omit<AttestationFilter, "sasSchema">>): AsyncGenerator<PaginatedAttestations<ParsedFeedbackAttestation>>;
4573
+ /** @internal Search feedback for a specific schema (shared logic). */
4574
+ private _searchFeedbackForSchema;
4541
4575
  /**
4542
4576
  * Get reputation summary for an agent.
4543
4577
  *