@proveanything/smartlinks 1.10.1 → 1.10.3

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.
@@ -310,32 +310,6 @@ export interface FacetRule {
310
310
  */
311
311
  all: FacetRuleClause[];
312
312
  }
313
- /**
314
- * Facet clause within a RecordScope.
315
- * Values within a single clause are ORed; multiple clauses are ANDed.
316
- */
317
- export interface ScopeFacetClause {
318
- /** Facet key, e.g. "tier", "region" */
319
- key: string;
320
- /** One or more values that satisfy this clause (OR semantics) */
321
- valueKeys: string[];
322
- }
323
- /**
324
- * Structured scope definition for a record.
325
- * Describes the audience/context the record applies to.
326
- * An empty object `{}` means universal (no restrictions).
327
- */
328
- export interface RecordScope {
329
- productId?: string;
330
- variantId?: string;
331
- proofId?: string;
332
- batchId?: string;
333
- /**
334
- * Arbitrary facet clauses.
335
- * Clauses are ANDed together; valueKeys within a clause are ORed.
336
- */
337
- facets?: ScopeFacetClause[];
338
- }
339
313
  /**
340
314
  * Runtime context passed to the match endpoint.
341
315
  * Describes the caller or item being evaluated against record scopes.
@@ -346,8 +320,10 @@ export interface RecordTarget {
346
320
  proofId?: string;
347
321
  batchId?: string;
348
322
  /**
349
- * Facet values the caller possesses, keyed by facet key.
350
- * A scope clause is satisfied if ANY of the clause's valueKeys appears here.
323
+ * Facet assignments for the product (e.g. `{ brand: ['samsung'], type: ['tv'] }`).
324
+ * Used exclusively to match FacetRule records via GIN-indexed containment check.
325
+ * Does NOT filter legacy scope.facets arrays (that system is removed in SDK 1.12).
326
+ * Omit to exclude rule records from results.
351
327
  */
352
328
  facets?: Record<string, string[]>;
353
329
  }
@@ -358,15 +334,18 @@ export interface BulkUpsertItem {
358
334
  /** Required — logical identifier used as the upsert key */
359
335
  ref: string;
360
336
  recordType?: string;
361
- customId?: string;
362
- sourceSystem?: string;
337
+ productId?: string | null;
338
+ variantId?: string | null;
339
+ batchId?: string | null;
340
+ proofId?: string | null;
341
+ customId?: string | null;
342
+ sourceSystem?: string | null;
363
343
  startsAt?: string | null;
364
344
  expiresAt?: string | null;
365
345
  status?: string | null;
366
- scope?: RecordScope;
367
346
  data?: Record<string, unknown> | null;
368
347
  metadata?: Record<string, unknown> | null;
369
- /** Facet rule (rule records only). Mutually exclusive with scope. */
348
+ /** Facet rule (rule records only). Mutually exclusive with anchor IDs. */
370
349
  facetRule?: FacetRule | null;
371
350
  }
372
351
  /**
@@ -409,56 +388,42 @@ export type BulkDeleteInput = {
409
388
  recordType?: string;
410
389
  scope?: never;
411
390
  } | {
412
- scope: Omit<RecordScope, 'facets'>;
391
+ scope: {
392
+ productId?: string;
393
+ variantId?: string;
394
+ batchId?: string;
395
+ proofId?: string;
396
+ };
413
397
  recordType?: string;
414
398
  refs?: never;
415
399
  };
416
400
  /**
417
401
  * Which resolution tier caused a record to be selected in `match()` or `resolveAll()`.
418
- * Precedence (highest first): proof > batch > variant > product > rule > facet > collection > universal.
402
+ * Precedence (highest first): rule > proof > batch > variant > product > facet > collection > universal.
419
403
  */
420
- export type MatchedAt = 'proof' | 'batch' | 'variant' | 'product' | 'rule' | 'facet' | 'collection' | 'universal';
404
+ export type MatchedAt = 'rule' | 'proof' | 'batch' | 'variant' | 'product' | 'facet' | 'collection' | 'universal';
421
405
  /**
422
- * An AppRecord augmented with `matchedAt` — present only on records returned
423
- * by the `match` endpoint. Use this to display attribution such as
424
- * "Inherited from product" or "Batch-specific" without inspecting scope fields.
406
+ * Entry in `match()` results the record fields plus resolution metadata.
407
+ * Extends AppRecord so all record fields are directly accessible.
425
408
  */
426
- export interface MatchedRecord extends AppRecord {
427
- /**
428
- * The most specific scope dimension that caused this record to match.
429
- * 'universal' means the record has an empty scope and matches all contexts.
430
- */
431
- matchedAt: MatchedAt;
432
- }
433
- /**
434
- * An entry in `match()` or `resolveAll()` results — the record plus resolution metadata.
435
- */
436
- export interface MatchEntry {
437
- /** The matched record. */
438
- record: AppRecord;
409
+ export interface MatchEntry extends AppRecord {
439
410
  /** Which resolution tier caused this record to be selected. */
440
411
  matchedAt: MatchedAt;
441
412
  /** The rule that fired. Present only when matchedAt === 'rule'. */
442
413
  matchedRule?: FacetRule;
443
- /**
444
- * Number of clauses in the rule that fired.
445
- * Present only when matchedAt === 'rule'.
446
- */
414
+ /** Number of clauses in the rule that fired. Present only when matchedAt === 'rule'. */
447
415
  matchedClauseCount?: number;
448
- /** Numeric specificity score. Higher = more specific. */
449
- specificity: number;
450
416
  }
451
417
  /**
452
418
  * Response from the match endpoint.
453
419
  */
454
420
  export interface MatchResult {
455
421
  /** Matched records ordered by specificity descending (most specific first) */
456
- records: MatchEntry[];
457
- /**
458
- * Only present when strategy is 'best'.
459
- * The single highest-specificity record per recordType.
460
- */
461
- best?: Record<string, MatchEntry>;
422
+ data: MatchEntry[];
423
+ /** Total count of matched records */
424
+ total: number;
425
+ /** Strategy used for this result */
426
+ strategy: 'all' | 'best';
462
427
  }
463
428
  /**
464
429
  * Request body for the upsert endpoint.
@@ -467,15 +432,18 @@ export interface UpsertRecordInput {
467
432
  /** Required — used as the lookup key */
468
433
  ref: string;
469
434
  recordType?: string;
470
- customId?: string;
471
- sourceSystem?: string;
435
+ productId?: string | null;
436
+ variantId?: string | null;
437
+ batchId?: string | null;
438
+ proofId?: string | null;
439
+ customId?: string | null;
440
+ sourceSystem?: string | null;
472
441
  startsAt?: string | null;
473
442
  expiresAt?: string | null;
474
443
  status?: string | null;
475
- scope?: RecordScope;
476
444
  data?: Record<string, unknown> | null;
477
445
  metadata?: Record<string, unknown> | null;
478
- /** Facet rule (rule records only). Mutually exclusive with scope. */
446
+ /** Facet rule (rule records only). Mutually exclusive with anchor IDs. */
479
447
  facetRule?: FacetRule | null;
480
448
  }
481
449
  /**
@@ -518,12 +486,18 @@ export interface AppRecord {
518
486
  visibility: Visibility;
519
487
  recordType: string | null;
520
488
  ref: string | null;
489
+ scopeType: string | null;
490
+ scopeId: string | null;
521
491
  customId: string | null;
492
+ customIdNormalized: string | null;
522
493
  sourceSystem: string | null;
523
494
  status: string | null;
524
- /** @deprecated use scope.productId instead */
495
+ /** Flat anchor IDs. null = wildcard (matches any value). */
525
496
  productId: string | null;
526
- /** @deprecated use scope.proofId instead */
497
+ /** Flat anchor ID, promoted from scope.variantId in SDK 1.12. */
498
+ variantId: string | null;
499
+ /** Flat anchor ID, promoted from scope.batchId in SDK 1.12. */
500
+ batchId: string | null;
527
501
  proofId: string | null;
528
502
  contactId: string | null;
529
503
  authorId: string | null;
@@ -536,21 +510,17 @@ export interface AppRecord {
536
510
  expiresAt: string | null;
537
511
  deletedAt: string | null;
538
512
  /**
539
- * Structured scope definition. Empty object means universal.
540
- * Platform-canonicalized on write (keys sorted, valueKeys deduplicated).
541
- */
542
- scope: RecordScope;
543
- /**
544
- * Numeric specificity score computed from scope.
545
- * Higher = more specific. 0 = universal scope.
513
+ * Numeric specificity score. Server-computed from anchor IDs and facetRule.
514
+ * Higher = more specific. 0 = universal (no anchors, no rule).
546
515
  */
547
516
  specificity: number;
548
517
  /**
549
518
  * Facet rule for rule records (ref starts with "rule:").
550
- * null on all other record types. Mutually exclusive with scope.
551
- * SDK 1.10.
519
+ * null on all other record types. Mutually exclusive with anchor IDs.
552
520
  */
553
521
  facetRule: FacetRule | null;
522
+ /** Singleton cardinality key. Server-assigned; opaque to clients. SDK 1.11. */
523
+ singletonKey: string | null;
554
524
  data: Record<string, unknown>;
555
525
  owner: Record<string, unknown>;
556
526
  admin: Record<string, unknown>;
@@ -560,28 +530,35 @@ export interface AppRecord {
560
530
  * Input for creating a new record
561
531
  */
562
532
  export interface CreateRecordInput {
563
- recordType: string;
533
+ recordType?: string;
564
534
  visibility?: Visibility;
565
535
  ref?: string;
566
536
  status?: string;
567
- productId?: string;
568
- proofId?: string;
537
+ productId?: string | null;
538
+ variantId?: string | null;
539
+ batchId?: string | null;
540
+ proofId?: string | null;
569
541
  contactId?: string;
570
542
  authorId?: string;
571
543
  authorType?: string;
572
544
  parentType?: string;
573
545
  parentId?: string;
574
- startsAt?: string;
575
- expiresAt?: string;
576
- /** Structured scope. Canonicalized on write; ref derived if not supplied. */
577
- scope?: RecordScope;
578
- customId?: string;
579
- sourceSystem?: string;
546
+ startsAt?: string | null;
547
+ expiresAt?: string | null;
548
+ scopeType?: string | null;
549
+ scopeId?: string | null;
550
+ customId?: string | null;
551
+ sourceSystem?: string | null;
552
+ /**
553
+ * Opt-in singleton cardinality. When set, the server upserts rather than
554
+ * inserting a duplicate. Values: 'collection' | 'product' | 'variant' | 'batch' | 'proof'
555
+ */
556
+ singletonPer?: string;
580
557
  data?: Record<string, unknown>;
581
558
  owner?: Record<string, unknown>;
582
559
  admin?: Record<string, unknown>;
583
560
  metadata?: Record<string, unknown>;
584
- /** Facet rule (rule records only). Mutually exclusive with scope. */
561
+ /** Facet rule (rule records only). Mutually exclusive with anchor IDs. */
585
562
  facetRule?: FacetRule | null;
586
563
  }
587
564
  /**
@@ -595,14 +572,18 @@ export interface UpdateRecordInput {
595
572
  visibility?: Visibility;
596
573
  ref?: string;
597
574
  recordType?: string;
598
- startsAt?: string;
599
- expiresAt?: string;
600
- /** Updating scope recomputes specificity and ref. */
601
- scope?: RecordScope;
602
- customId?: string;
603
- sourceSystem?: string;
575
+ productId?: string | null;
576
+ variantId?: string | null;
577
+ batchId?: string | null;
578
+ proofId?: string | null;
579
+ startsAt?: string | null;
580
+ expiresAt?: string | null;
581
+ scopeType?: string | null;
582
+ scopeId?: string | null;
583
+ customId?: string | null;
584
+ sourceSystem?: string | null;
604
585
  metadata?: Record<string, unknown>;
605
- /** Facet rule (rule records only). Mutually exclusive with scope. Send null to clear. */
586
+ /** Set/clear facet rule. Send null to remove. */
606
587
  facetRule?: FacetRule | null;
607
588
  }
608
589
  /**
@@ -616,9 +597,9 @@ export interface RecordListQueryParams extends ListQueryParams {
616
597
  customId?: string;
617
598
  sourceSystem?: string;
618
599
  proofId?: string;
619
- /** Filter by scope.variantId (JSONB lookup) */
600
+ /** Filter by variantId (indexed flat column) */
620
601
  variantId?: string;
621
- /** Filter by scope.batchId (JSONB lookup) */
602
+ /** Filter by batchId (indexed flat column) */
622
603
  batchId?: string;
623
604
  /** Full-text filter on data.label (case-insensitive substring) */
624
605
  q?: string;
@@ -675,16 +656,28 @@ export interface ResolveAllParams {
675
656
  * Response from the resolve-all endpoint.
676
657
  */
677
658
  export interface ResolveAllResult {
678
- /**
679
- * Every applicable record for the given product context, sorted by precedence
680
- * (most-specific first). Each record appears at most once.
681
- */
682
- records: MatchEntry[];
683
- /**
684
- * true if the result was truncated at the safety cap.
685
- * Default cap: 500 records. Use `limit` to raise it (max 5000).
686
- */
687
- truncated?: boolean;
659
+ /** Every applicable record sorted by precedence (most-specific first). Each appears at most once. */
660
+ records: ResolveAllEntry[];
661
+ /** Total count of returned records. */
662
+ total: number;
663
+ /** The context echoed back from the request (for verification). */
664
+ context: ResolveAllContext;
665
+ /** true if the result was capped at the safety limit. */
666
+ truncated: boolean;
667
+ }
668
+ export interface ResolveAllEntry {
669
+ record: AppRecord;
670
+ matchedAt: MatchedAt;
671
+ specificity: number;
672
+ matchedRule?: FacetRule;
673
+ matchedClauseCount?: number;
674
+ }
675
+ export interface ResolveAllContext {
676
+ productId?: string;
677
+ variantId?: string;
678
+ batchId?: string;
679
+ proofId?: string;
680
+ facets?: Record<string, string[]>;
688
681
  }
689
682
  /**
690
683
  * Request body for the preview-rule endpoint.
@@ -692,17 +685,25 @@ export interface ResolveAllResult {
692
685
  export interface PreviewRuleParams {
693
686
  /** The facet rule to evaluate (same validation as on record create). */
694
687
  facetRule: FacetRule;
695
- /** Max product IDs to return. Default 20, max 200. */
688
+ /** Filter to a specific record type for context. */
689
+ recordType?: string;
690
+ /** Max matching products to return in sample. Default 50, max 200. */
696
691
  limit?: number;
697
692
  }
698
693
  /**
699
694
  * Response from the preview-rule endpoint.
700
695
  */
701
696
  export interface PreviewRuleResult {
702
- /** A sample of product IDs whose facet assignments satisfy the rule. */
703
- sampleProductIds: string[];
704
- /** Total products in the collection matching the rule (may exceed sampleProductIds.length). */
705
- totalMatches: number;
697
+ /** Sample of products whose facet assignments satisfy the rule. */
698
+ matchingProducts: Array<{
699
+ productId: string;
700
+ name?: string;
701
+ facets: Record<string, string[]>;
702
+ }>;
703
+ /** Total products in the collection matching the rule. */
704
+ total: number;
705
+ /** Server-canonicalized rule (sorted keys, deduped values) — for display. */
706
+ rule: FacetRule;
706
707
  }
707
708
  /**
708
709
  * Response from case related endpoint
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.10.1 | Generated: 2026-04-25T15:35:27.893Z
3
+ Version: 1.10.3 | Generated: 2026-04-27T10:04:40.477Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -1901,27 +1901,6 @@ interface FacetRule {
1901
1901
  }
1902
1902
  ```
1903
1903
 
1904
- **ScopeFacetClause** (interface)
1905
- ```typescript
1906
- interface ScopeFacetClause {
1907
- key: string
1908
- valueKeys: string[]
1909
- }
1910
- ```
1911
-
1912
- **RecordScope** (interface)
1913
- ```typescript
1914
- interface RecordScope {
1915
- productId?: string
1916
- variantId?: string
1917
- proofId?: string
1918
- batchId?: string
1919
- * Arbitrary facet clauses.
1920
- * Clauses are ANDed together; valueKeys within a clause are ORed.
1921
- facets?: ScopeFacetClause[]
1922
- }
1923
- ```
1924
-
1925
1904
  **RecordTarget** (interface)
1926
1905
  ```typescript
1927
1906
  interface RecordTarget {
@@ -1929,8 +1908,10 @@ interface RecordTarget {
1929
1908
  variantId?: string
1930
1909
  proofId?: string
1931
1910
  batchId?: string
1932
- * Facet values the caller possesses, keyed by facet key.
1933
- * A scope clause is satisfied if ANY of the clause's valueKeys appears here.
1911
+ * Facet assignments for the product (e.g. `{ brand: ['samsung'], type: ['tv'] }`).
1912
+ * Used exclusively to match FacetRule records via GIN-indexed containment check.
1913
+ * Does NOT filter legacy scope.facets arrays (that system is removed in SDK 1.12).
1914
+ * Omit to exclude rule records from results.
1934
1915
  facets?: Record<string, string[]>
1935
1916
  }
1936
1917
  ```
@@ -1940,12 +1921,15 @@ interface RecordTarget {
1940
1921
  interface BulkUpsertItem {
1941
1922
  ref: string
1942
1923
  recordType?: string
1943
- customId?: string
1944
- sourceSystem?: string
1924
+ productId?: string | null
1925
+ variantId?: string | null
1926
+ batchId?: string | null
1927
+ proofId?: string | null
1928
+ customId?: string | null
1929
+ sourceSystem?: string | null
1945
1930
  startsAt?: string | null
1946
1931
  expiresAt?: string | null
1947
1932
  status?: string | null
1948
- scope?: RecordScope
1949
1933
  data?: Record<string, unknown> | null
1950
1934
  metadata?: Record<string, unknown> | null
1951
1935
  facetRule?: FacetRule | null
@@ -1972,26 +1956,12 @@ interface BulkDeleteResult {
1972
1956
  }
1973
1957
  ```
1974
1958
 
1975
- **MatchEntry** (interface)
1976
- ```typescript
1977
- interface MatchEntry {
1978
- record: AppRecord
1979
- matchedAt: MatchedAt
1980
- matchedRule?: FacetRule
1981
- * Number of clauses in the rule that fired.
1982
- * Present only when matchedAt === 'rule'.
1983
- matchedClauseCount?: number
1984
- specificity: number
1985
- }
1986
- ```
1987
-
1988
1959
  **MatchResult** (interface)
1989
1960
  ```typescript
1990
1961
  interface MatchResult {
1991
- records: MatchEntry[]
1992
- * Only present when strategy is 'best'.
1993
- * The single highest-specificity record per recordType.
1994
- best?: Record<string, MatchEntry>
1962
+ data: MatchEntry[]
1963
+ total: number
1964
+ strategy: 'all' | 'best'
1995
1965
  }
1996
1966
  ```
1997
1967
 
@@ -2000,12 +1970,15 @@ interface MatchResult {
2000
1970
  interface UpsertRecordInput {
2001
1971
  ref: string
2002
1972
  recordType?: string
2003
- customId?: string
2004
- sourceSystem?: string
1973
+ productId?: string | null
1974
+ variantId?: string | null
1975
+ batchId?: string | null
1976
+ proofId?: string | null
1977
+ customId?: string | null
1978
+ sourceSystem?: string | null
2005
1979
  startsAt?: string | null
2006
1980
  expiresAt?: string | null
2007
1981
  status?: string | null
2008
- scope?: RecordScope
2009
1982
  data?: Record<string, unknown> | null
2010
1983
  metadata?: Record<string, unknown> | null
2011
1984
  facetRule?: FacetRule | null
@@ -2037,10 +2010,15 @@ interface AppRecord {
2037
2010
  visibility: Visibility
2038
2011
  recordType: string | null
2039
2012
  ref: string | null
2013
+ scopeType: string | null
2014
+ scopeId: string | null
2040
2015
  customId: string | null
2016
+ customIdNormalized: string | null
2041
2017
  sourceSystem: string | null
2042
2018
  status: string | null
2043
2019
  productId: string | null
2020
+ variantId: string | null
2021
+ batchId: string | null
2044
2022
  proofId: string | null
2045
2023
  contactId: string | null
2046
2024
  authorId: string | null
@@ -2052,16 +2030,13 @@ interface AppRecord {
2052
2030
  startsAt: string | null
2053
2031
  expiresAt: string | null
2054
2032
  deletedAt: string | null // admin only
2055
- * Structured scope definition. Empty object means universal.
2056
- * Platform-canonicalized on write (keys sorted, valueKeys deduplicated).
2057
- scope: RecordScope
2058
- * Numeric specificity score computed from scope.
2059
- * Higher = more specific. 0 = universal scope.
2033
+ * Numeric specificity score. Server-computed from anchor IDs and facetRule.
2034
+ * Higher = more specific. 0 = universal (no anchors, no rule).
2060
2035
  specificity: number
2061
2036
  * Facet rule for rule records (ref starts with "rule:").
2062
- * null on all other record types. Mutually exclusive with scope.
2063
- * SDK 1.10.
2037
+ * null on all other record types. Mutually exclusive with anchor IDs.
2064
2038
  facetRule: FacetRule | null
2039
+ singletonKey: string | null
2065
2040
  data: Record<string, unknown>
2066
2041
  owner: Record<string, unknown>
2067
2042
  admin: Record<string, unknown> // admin only
@@ -2072,25 +2047,31 @@ interface AppRecord {
2072
2047
  **CreateRecordInput** (interface)
2073
2048
  ```typescript
2074
2049
  interface CreateRecordInput {
2075
- recordType: string
2076
- visibility?: Visibility // default 'owner'
2077
- ref?: string // derived from scope if omitted and scope provided
2078
- status?: string // default 'active'
2079
- productId?: string
2080
- proofId?: string
2050
+ recordType?: string
2051
+ visibility?: Visibility
2052
+ ref?: string
2053
+ status?: string
2054
+ productId?: string | null
2055
+ variantId?: string | null
2056
+ batchId?: string | null
2057
+ proofId?: string | null
2081
2058
  contactId?: string
2082
2059
  authorId?: string
2083
2060
  authorType?: string
2084
2061
  parentType?: string
2085
2062
  parentId?: string
2086
- startsAt?: string // ISO 8601
2087
- expiresAt?: string
2088
- scope?: RecordScope
2089
- customId?: string
2090
- sourceSystem?: string
2063
+ startsAt?: string | null
2064
+ expiresAt?: string | null
2065
+ scopeType?: string | null
2066
+ scopeId?: string | null
2067
+ customId?: string | null
2068
+ sourceSystem?: string | null
2069
+ * Opt-in singleton cardinality. When set, the server upserts rather than
2070
+ * inserting a duplicate. Values: 'collection' | 'product' | 'variant' | 'batch' | 'proof'
2071
+ singletonPer?: string
2091
2072
  data?: Record<string, unknown>
2092
2073
  owner?: Record<string, unknown>
2093
- admin?: Record<string, unknown> // admin only
2074
+ admin?: Record<string, unknown>
2094
2075
  metadata?: Record<string, unknown>
2095
2076
  facetRule?: FacetRule | null
2096
2077
  }
@@ -2106,11 +2087,16 @@ interface UpdateRecordInput {
2106
2087
  visibility?: Visibility
2107
2088
  ref?: string
2108
2089
  recordType?: string
2109
- startsAt?: string
2110
- expiresAt?: string
2111
- scope?: RecordScope
2112
- customId?: string
2113
- sourceSystem?: string
2090
+ productId?: string | null
2091
+ variantId?: string | null
2092
+ batchId?: string | null
2093
+ proofId?: string | null
2094
+ startsAt?: string | null
2095
+ expiresAt?: string | null
2096
+ scopeType?: string | null
2097
+ scopeId?: string | null
2098
+ customId?: string | null
2099
+ sourceSystem?: string | null
2114
2100
  metadata?: Record<string, unknown>
2115
2101
  facetRule?: FacetRule | null
2116
2102
  }
@@ -2141,12 +2127,32 @@ interface ResolveAllParams {
2141
2127
  **ResolveAllResult** (interface)
2142
2128
  ```typescript
2143
2129
  interface ResolveAllResult {
2144
- * Every applicable record for the given product context, sorted by precedence
2145
- * (most-specific first). Each record appears at most once.
2146
- records: MatchEntry[]
2147
- * true if the result was truncated at the safety cap.
2148
- * Default cap: 500 records. Use `limit` to raise it (max 5000).
2149
- truncated?: boolean
2130
+ records: ResolveAllEntry[]
2131
+ total: number
2132
+ context: ResolveAllContext
2133
+ truncated: boolean
2134
+ }
2135
+ ```
2136
+
2137
+ **ResolveAllEntry** (interface)
2138
+ ```typescript
2139
+ interface ResolveAllEntry {
2140
+ record: AppRecord
2141
+ matchedAt: MatchedAt
2142
+ specificity: number
2143
+ matchedRule?: FacetRule
2144
+ matchedClauseCount?: number
2145
+ }
2146
+ ```
2147
+
2148
+ **ResolveAllContext** (interface)
2149
+ ```typescript
2150
+ interface ResolveAllContext {
2151
+ productId?: string
2152
+ variantId?: string
2153
+ batchId?: string
2154
+ proofId?: string
2155
+ facets?: Record<string, string[]>
2150
2156
  }
2151
2157
  ```
2152
2158
 
@@ -2154,6 +2160,7 @@ interface ResolveAllResult {
2154
2160
  ```typescript
2155
2161
  interface PreviewRuleParams {
2156
2162
  facetRule: FacetRule
2163
+ recordType?: string
2157
2164
  limit?: number
2158
2165
  }
2159
2166
  ```
@@ -2161,8 +2168,9 @@ interface PreviewRuleParams {
2161
2168
  **PreviewRuleResult** (interface)
2162
2169
  ```typescript
2163
2170
  interface PreviewRuleResult {
2164
- sampleProductIds: string[]
2165
- totalMatches: number
2171
+ matchingProducts: Array<{ productId: string; name?: string; facets: Record<string, string[]> }>
2172
+ total: number
2173
+ rule: FacetRule
2166
2174
  }
2167
2175
  ```
2168
2176