@memberjunction/graphql-dataprovider 5.32.0 → 5.34.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/README.md CHANGED
@@ -176,6 +176,28 @@ async function getMultipleDatasets() {
176
176
  return results;
177
177
  }
178
178
 
179
+ // Iterate through a large entity using keyset (seek) pagination
180
+ // O(log N) per page, regardless of depth — ideal for background jobs and bulk processing
181
+ async function iterateAllTaxReturns() {
182
+ let lastSeenKey: CompositeKey | undefined; // undefined => first page
183
+ while (true) {
184
+ const result = await dataProvider.RunView({
185
+ EntityName: 'Tax Returns',
186
+ ExtraFilter: 'AddressLine1 IS NOT NULL',
187
+ AfterKey: lastSeenKey,
188
+ MaxRows: 500,
189
+ ResultType: 'entity_object',
190
+ });
191
+ if (!result.Success || result.Results.length === 0) break;
192
+ for (const r of result.Results) { /* process */ }
193
+ if (result.Results.length < 500) break;
194
+ lastSeenKey = CompositeKey.FromID(result.Results[result.Results.length - 1].ID);
195
+ }
196
+ }
197
+ // AfterKey is forwarded through the GraphQL wire via CompositeKeyInputType.
198
+ // See guides/KEYSET_PAGINATION_GUIDE.md for the full pattern, constraints,
199
+ // and reference implementations.
200
+
179
201
  // Execute a report
180
202
  async function getSalesReport(reportId: string) {
181
203
  const params = {