@proveanything/smartlinks 1.15.23 → 1.16.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/dist/openapi.yaml CHANGED
@@ -41,6 +41,7 @@ tags:
41
41
  - name: journeys
42
42
  - name: journeysAnalytics
43
43
  - name: location
44
+ - name: lots
44
45
  - name: loyalty
45
46
  - name: nfc
46
47
  - name: order
@@ -4825,6 +4826,208 @@ paths:
4825
4826
  description: Unauthorized
4826
4827
  404:
4827
4828
  description: Not found
4829
+ /admin/collection/{collectionId}/lots/by-number/{lotNumber}:
4830
+ get:
4831
+ tags:
4832
+ - lots
4833
+ summary: Look up a lot by its number (case-insensitive) — used by scan/resolver flows.
4834
+ operationId: lots_getByNumber
4835
+ security:
4836
+ - bearerAuth: []
4837
+ parameters:
4838
+ - name: collectionId
4839
+ in: path
4840
+ required: true
4841
+ schema:
4842
+ type: string
4843
+ - name: lotNumber
4844
+ in: path
4845
+ required: true
4846
+ schema:
4847
+ type: string
4848
+ responses:
4849
+ 200:
4850
+ description: Success
4851
+ content:
4852
+ application/json:
4853
+ schema:
4854
+ $ref: "#/components/schemas/Lot"
4855
+ 400:
4856
+ description: Bad request
4857
+ 401:
4858
+ description: Unauthorized
4859
+ 404:
4860
+ description: Not found
4861
+ /admin/collection/{collectionId}/lots/{lotId}:
4862
+ get:
4863
+ tags:
4864
+ - lots
4865
+ summary: Get the full lot record.
4866
+ operationId: lots_get
4867
+ security:
4868
+ - bearerAuth: []
4869
+ parameters:
4870
+ - name: collectionId
4871
+ in: path
4872
+ required: true
4873
+ schema:
4874
+ type: string
4875
+ - name: lotId
4876
+ in: path
4877
+ required: true
4878
+ schema:
4879
+ type: string
4880
+ responses:
4881
+ 200:
4882
+ description: Success
4883
+ content:
4884
+ application/json:
4885
+ schema:
4886
+ $ref: "#/components/schemas/Lot"
4887
+ 400:
4888
+ description: Bad request
4889
+ 401:
4890
+ description: Unauthorized
4891
+ 404:
4892
+ description: Not found
4893
+ put:
4894
+ tags:
4895
+ - lots
4896
+ summary: Update a lot.
4897
+ operationId: lots_update
4898
+ security:
4899
+ - bearerAuth: []
4900
+ parameters:
4901
+ - name: collectionId
4902
+ in: path
4903
+ required: true
4904
+ schema:
4905
+ type: string
4906
+ - name: lotId
4907
+ in: path
4908
+ required: true
4909
+ schema:
4910
+ type: string
4911
+ responses:
4912
+ 200:
4913
+ description: Success
4914
+ content:
4915
+ application/json:
4916
+ schema:
4917
+ $ref: "#/components/schemas/Lot"
4918
+ 400:
4919
+ description: Bad request
4920
+ 401:
4921
+ description: Unauthorized
4922
+ 404:
4923
+ description: Not found
4924
+ requestBody:
4925
+ required: true
4926
+ content:
4927
+ application/json:
4928
+ schema:
4929
+ $ref: "#/components/schemas/LotUpdateInput"
4930
+ /admin/collection/{collectionId}/lots/{lotId}/products{opts}:
4931
+ get:
4932
+ tags:
4933
+ - lots
4934
+ summary: Paginated member product summaries.
4935
+ operationId: lots_listProducts
4936
+ security:
4937
+ - bearerAuth: []
4938
+ parameters:
4939
+ - name: collectionId
4940
+ in: path
4941
+ required: true
4942
+ schema:
4943
+ type: string
4944
+ - name: lotId
4945
+ in: path
4946
+ required: true
4947
+ schema:
4948
+ type: string
4949
+ - name: opts
4950
+ in: path
4951
+ required: true
4952
+ schema:
4953
+ type: string
4954
+ responses:
4955
+ 200:
4956
+ description: Success
4957
+ content:
4958
+ application/json:
4959
+ schema:
4960
+ $ref: "#/components/schemas/ListLotProductsResponse"
4961
+ 400:
4962
+ description: Bad request
4963
+ 401:
4964
+ description: Unauthorized
4965
+ 404:
4966
+ description: Not found
4967
+ /admin/collection/{collectionId}/lots/{lotId}/resolve:
4968
+ post:
4969
+ tags:
4970
+ - lots
4971
+ summary: Re-resolve members from the current selector; returns the lot + a member diff.
4972
+ operationId: lots_resolve
4973
+ security:
4974
+ - bearerAuth: []
4975
+ parameters:
4976
+ - name: collectionId
4977
+ in: path
4978
+ required: true
4979
+ schema:
4980
+ type: string
4981
+ - name: lotId
4982
+ in: path
4983
+ required: true
4984
+ schema:
4985
+ type: string
4986
+ responses:
4987
+ 200:
4988
+ description: Success
4989
+ content:
4990
+ application/json:
4991
+ schema:
4992
+ $ref: "#/components/schemas/ResolveLotResponse"
4993
+ 400:
4994
+ description: Bad request
4995
+ 401:
4996
+ description: Unauthorized
4997
+ 404:
4998
+ description: Not found
4999
+ /admin/collection/{collectionId}/lots{params}:
5000
+ get:
5001
+ tags:
5002
+ - lots
5003
+ summary: "List lots (summary rows; `payload`/`productIds` omitted)."
5004
+ operationId: lots_list
5005
+ security:
5006
+ - bearerAuth: []
5007
+ parameters:
5008
+ - name: collectionId
5009
+ in: path
5010
+ required: true
5011
+ schema:
5012
+ type: string
5013
+ - name: params
5014
+ in: path
5015
+ required: true
5016
+ schema:
5017
+ type: string
5018
+ responses:
5019
+ 200:
5020
+ description: Success
5021
+ content:
5022
+ application/json:
5023
+ schema:
5024
+ $ref: "#/components/schemas/ListLotsResponse"
5025
+ 400:
5026
+ description: Bad request
5027
+ 401:
5028
+ description: Unauthorized
5029
+ 404:
5030
+ description: Not found
4828
5031
  /admin/collection/{collectionId}/loyaltyScheme:
4829
5032
  get:
4830
5033
  tags:
@@ -11549,6 +11752,135 @@ paths:
11549
11752
  description: Unauthorized
11550
11753
  404:
11551
11754
  description: Not found
11755
+ /public/collection/{collectionId}/lots/by-number/{lotNumber}:
11756
+ get:
11757
+ tags:
11758
+ - lots
11759
+ summary: lots.publicGetByNumber
11760
+ operationId: lots_publicGetByNumber
11761
+ security: []
11762
+ parameters:
11763
+ - name: collectionId
11764
+ in: path
11765
+ required: true
11766
+ schema:
11767
+ type: string
11768
+ - name: lotNumber
11769
+ in: path
11770
+ required: true
11771
+ schema:
11772
+ type: string
11773
+ responses:
11774
+ 200:
11775
+ description: Success
11776
+ content:
11777
+ application/json:
11778
+ schema:
11779
+ $ref: "#/components/schemas/Lot"
11780
+ 400:
11781
+ description: Bad request
11782
+ 401:
11783
+ description: Unauthorized
11784
+ 404:
11785
+ description: Not found
11786
+ /public/collection/{collectionId}/lots/{lotId}:
11787
+ get:
11788
+ tags:
11789
+ - lots
11790
+ summary: lots.publicGet
11791
+ operationId: lots_publicGet
11792
+ security: []
11793
+ parameters:
11794
+ - name: collectionId
11795
+ in: path
11796
+ required: true
11797
+ schema:
11798
+ type: string
11799
+ - name: lotId
11800
+ in: path
11801
+ required: true
11802
+ schema:
11803
+ type: string
11804
+ responses:
11805
+ 200:
11806
+ description: Success
11807
+ content:
11808
+ application/json:
11809
+ schema:
11810
+ $ref: "#/components/schemas/Lot"
11811
+ 400:
11812
+ description: Bad request
11813
+ 401:
11814
+ description: Unauthorized
11815
+ 404:
11816
+ description: Not found
11817
+ /public/collection/{collectionId}/lots/{lotId}/products{opts}:
11818
+ get:
11819
+ tags:
11820
+ - lots
11821
+ summary: lots.publicListProducts
11822
+ operationId: lots_publicListProducts
11823
+ security: []
11824
+ parameters:
11825
+ - name: collectionId
11826
+ in: path
11827
+ required: true
11828
+ schema:
11829
+ type: string
11830
+ - name: lotId
11831
+ in: path
11832
+ required: true
11833
+ schema:
11834
+ type: string
11835
+ - name: opts
11836
+ in: path
11837
+ required: true
11838
+ schema:
11839
+ type: string
11840
+ responses:
11841
+ 200:
11842
+ description: Success
11843
+ content:
11844
+ application/json:
11845
+ schema:
11846
+ $ref: "#/components/schemas/ListLotProductsResponse"
11847
+ 400:
11848
+ description: Bad request
11849
+ 401:
11850
+ description: Unauthorized
11851
+ 404:
11852
+ description: Not found
11853
+ /public/collection/{collectionId}/lots{params}:
11854
+ get:
11855
+ tags:
11856
+ - lots
11857
+ summary: lots.publicList
11858
+ operationId: lots_publicList
11859
+ security: []
11860
+ parameters:
11861
+ - name: collectionId
11862
+ in: path
11863
+ required: true
11864
+ schema:
11865
+ type: string
11866
+ - name: params
11867
+ in: path
11868
+ required: true
11869
+ schema:
11870
+ type: string
11871
+ responses:
11872
+ 200:
11873
+ description: Success
11874
+ content:
11875
+ application/json:
11876
+ schema:
11877
+ $ref: "#/components/schemas/ListLotsResponse"
11878
+ 400:
11879
+ description: Bad request
11880
+ 401:
11881
+ description: Unauthorized
11882
+ 404:
11883
+ description: Not found
11552
11884
  /public/collection/{collectionId}/loyaltyScheme:
11553
11885
  get:
11554
11886
  tags:
@@ -23355,6 +23687,174 @@ components:
23355
23687
  required:
23356
23688
  - items
23357
23689
  - count
23690
+ LotPayload:
23691
+ type: object
23692
+ properties:
23693
+ manufacturedAt:
23694
+ type: string
23695
+ expiresAt:
23696
+ type: string
23697
+ location:
23698
+ type: string
23699
+ custom:
23700
+ type: object
23701
+ additionalProperties: true
23702
+ Lot:
23703
+ type: object
23704
+ properties:
23705
+ id:
23706
+ type: string
23707
+ collectionId:
23708
+ type: string
23709
+ lotNumber:
23710
+ type: string
23711
+ name:
23712
+ type: string
23713
+ description:
23714
+ type: string
23715
+ status:
23716
+ $ref: "#/components/schemas/LotStatus"
23717
+ selector:
23718
+ $ref: "#/components/schemas/LotSelector"
23719
+ payload:
23720
+ $ref: "#/components/schemas/LotPayload"
23721
+ destination:
23722
+ type: object
23723
+ additionalProperties: true
23724
+ productCount:
23725
+ type: number
23726
+ productIds:
23727
+ type: array
23728
+ items:
23729
+ type: string
23730
+ resolvedAt:
23731
+ type: string
23732
+ createdBy:
23733
+ type: string
23734
+ updatedBy:
23735
+ type: string
23736
+ createdAt:
23737
+ type: string
23738
+ updatedAt:
23739
+ type: string
23740
+ required:
23741
+ - id
23742
+ - collectionId
23743
+ - lotNumber
23744
+ - status
23745
+ - selector
23746
+ - productCount
23747
+ - createdAt
23748
+ - updatedAt
23749
+ LotCreateInput:
23750
+ type: object
23751
+ properties:
23752
+ lotNumber:
23753
+ type: string
23754
+ name:
23755
+ type: string
23756
+ description:
23757
+ type: string
23758
+ selector:
23759
+ $ref: "#/components/schemas/LotSelector"
23760
+ payload:
23761
+ $ref: "#/components/schemas/LotPayload"
23762
+ destination:
23763
+ type: object
23764
+ additionalProperties: true
23765
+ status:
23766
+ $ref: "#/components/schemas/LotStatus"
23767
+ id:
23768
+ type: string
23769
+ required:
23770
+ - lotNumber
23771
+ ListLotsParams:
23772
+ type: object
23773
+ properties:
23774
+ status:
23775
+ $ref: "#/components/schemas/LotStatus"
23776
+ search:
23777
+ type: string
23778
+ productId:
23779
+ type: string
23780
+ ListLotsResponse:
23781
+ type: object
23782
+ properties:
23783
+ lots:
23784
+ type: array
23785
+ items:
23786
+ $ref: "#/components/schemas/Lot"
23787
+ required:
23788
+ - lots
23789
+ LotMemberDiff:
23790
+ type: object
23791
+ properties:
23792
+ added:
23793
+ type: array
23794
+ items:
23795
+ type: object
23796
+ additionalProperties: true
23797
+ required:
23798
+ - added
23799
+ ResolveLotResponse:
23800
+ type: object
23801
+ properties:
23802
+ lot:
23803
+ type: object
23804
+ additionalProperties: true
23805
+ required:
23806
+ - lot
23807
+ LotProductSummary:
23808
+ type: object
23809
+ properties:
23810
+ id:
23811
+ type: object
23812
+ additionalProperties: true
23813
+ required:
23814
+ - id
23815
+ ListLotProductsResponse:
23816
+ type: object
23817
+ properties:
23818
+ products:
23819
+ type: array
23820
+ items:
23821
+ $ref: "#/components/schemas/LotProductSummary"
23822
+ total:
23823
+ type: number
23824
+ page:
23825
+ type: number
23826
+ limit:
23827
+ type: number
23828
+ required:
23829
+ - products
23830
+ - total
23831
+ - page
23832
+ - limit
23833
+ LotResolutionResult:
23834
+ type: object
23835
+ properties:
23836
+ match:
23837
+ type: string
23838
+ enum:
23839
+ - batch
23840
+ - lot
23841
+ - product
23842
+ - none
23843
+ productId:
23844
+ type: string
23845
+ batchId:
23846
+ type: string
23847
+ lotId:
23848
+ type: string
23849
+ ai10:
23850
+ type: string
23851
+ destination: {}
23852
+ required:
23853
+ - match
23854
+ - productId
23855
+ - batchId
23856
+ - lotId
23857
+ - ai10
23358
23858
  LoyaltyScheme:
23359
23859
  type: object
23360
23860
  properties:
@@ -25050,6 +25550,12 @@ components:
25050
25550
  type: string
25051
25551
  userId:
25052
25552
  type: string
25553
+ batchId:
25554
+ type: string
25555
+ variantId:
25556
+ type: string
25557
+ lotId:
25558
+ type: string
25053
25559
  claimable:
25054
25560
  type: boolean
25055
25561
  virtual:
@@ -25340,6 +25846,29 @@ components:
25340
25846
  type: string
25341
25847
  required:
25342
25848
  - interactionId
25849
+ OwnershipAttributePredicate:
25850
+ type: object
25851
+ properties:
25852
+ path:
25853
+ type: string
25854
+ operator:
25855
+ $ref: "#/components/schemas/OwnershipAttributeOperator"
25856
+ value:
25857
+ type: object
25858
+ additionalProperties: true
25859
+ required:
25860
+ - path
25861
+ - operator
25862
+ OwnershipFacetSelector:
25863
+ type: object
25864
+ properties:
25865
+ key:
25866
+ type: string
25867
+ value:
25868
+ type: string
25869
+ required:
25870
+ - key
25871
+ - value
25343
25872
  SegmentRecord:
25344
25873
  type: object
25345
25874
  properties:
@@ -25445,6 +25974,25 @@ components:
25445
25974
  - limit
25446
25975
  - offset
25447
25976
  - total
25977
+ CustomFieldOperator:
25978
+ type: string
25979
+ enum:
25980
+ - equals
25981
+ - exists
25982
+ - gt
25983
+ - gte
25984
+ - lt
25985
+ - lte
25986
+ - before
25987
+ - after
25988
+ - within_days
25989
+ - older_than_days
25990
+ - "s JSON. Numeric ops (gt/gte/lt/lte) compare as a number. export type OwnershipAttributeOperator = "
25991
+ - " | "
25992
+ - " | "
25993
+ - " | "
25994
+ - " | "
25995
+ - " | "
25448
25996
  Tag:
25449
25997
  type: object
25450
25998
  properties:
@@ -0,0 +1,95 @@
1
+ export type LotStatus = 'open' | 'closed' | 'recalled' | 'archived';
2
+ /** How a lot's member products are resolved. */
3
+ export type LotSelector = {
4
+ mode: 'facets';
5
+ rules: Array<{
6
+ key: string;
7
+ values: string[];
8
+ }>;
9
+ } | {
10
+ mode: 'products';
11
+ productIds: string[];
12
+ };
13
+ /** Shared lot data (single source of truth — not copied to batches). */
14
+ export interface LotPayload {
15
+ manufacturedAt?: string | null;
16
+ expiresAt?: string | null;
17
+ location?: string | null;
18
+ custom?: Record<string, any>;
19
+ [key: string]: any;
20
+ }
21
+ export interface Lot {
22
+ id: string;
23
+ collectionId: string;
24
+ /** Human / GS1 AI(10) identifier, ≤20 chars, unique per collection (case-insensitive). */
25
+ lotNumber: string;
26
+ name?: string | null;
27
+ description?: string | null;
28
+ status: LotStatus;
29
+ selector: LotSelector;
30
+ /** Omitted on list summaries. */
31
+ payload?: LotPayload;
32
+ /** Optional lot-level redirect/destination; wins over the product's destination on a lot hit. */
33
+ destination?: Record<string, any> | null;
34
+ productCount: number;
35
+ /** Materialised member product ids. Omitted on list summaries. */
36
+ productIds?: string[];
37
+ resolvedAt?: string | null;
38
+ createdBy?: string | null;
39
+ updatedBy?: string | null;
40
+ createdAt: string;
41
+ updatedAt: string;
42
+ }
43
+ export interface LotCreateInput {
44
+ lotNumber: string;
45
+ name?: string;
46
+ description?: string;
47
+ selector?: LotSelector;
48
+ payload?: LotPayload;
49
+ destination?: Record<string, any> | null;
50
+ status?: LotStatus;
51
+ /** Optional client-supplied id; the server generates one otherwise. */
52
+ id?: string;
53
+ }
54
+ export type LotUpdateInput = Partial<LotCreateInput>;
55
+ export interface ListLotsParams {
56
+ status?: LotStatus;
57
+ search?: string;
58
+ /** Reverse lookup — lots containing this product id. */
59
+ productId?: string;
60
+ }
61
+ export interface ListLotsResponse {
62
+ lots: Lot[];
63
+ }
64
+ /** Member changes returned by resolve/update-with-selector-change. */
65
+ export interface LotMemberDiff {
66
+ added: string[];
67
+ removed: string[];
68
+ }
69
+ export interface ResolveLotResponse {
70
+ lot: Lot;
71
+ diff: LotMemberDiff;
72
+ }
73
+ export interface LotProductSummary {
74
+ id: string;
75
+ name?: string;
76
+ gtin?: string | null;
77
+ }
78
+ export interface ListLotProductsResponse {
79
+ products: LotProductSummary[];
80
+ total: number;
81
+ page: number;
82
+ limit: number;
83
+ }
84
+ /**
85
+ * Typed result of GS1 AI(10) resolution. The server decides batch-vs-lot based on
86
+ * the collection's flags (batch first — unique to one product — then lot).
87
+ */
88
+ export interface LotResolutionResult {
89
+ match: 'batch' | 'lot' | 'product' | 'none';
90
+ productId: string;
91
+ batchId: string | null;
92
+ lotId: string | null;
93
+ ai10: string | null;
94
+ destination?: any;
95
+ }
@@ -0,0 +1,7 @@
1
+ // src/types/lots.ts
2
+ //
3
+ // A Lot is a collection-scoped production grouping that spans one or more products
4
+ // (SKUs). Unlike a batch (a single production run of a single product), a lot is a
5
+ // first-class entity with a selector (how members are matched), a materialised
6
+ // product list, and a shared payload. Lots are never fanned out into batches.
7
+ export {};
@@ -28,6 +28,12 @@ export interface Proof {
28
28
  tokenId: string;
29
29
  /** Unique identifier for the user */
30
30
  userId: string;
31
+ /** Batch (single production run of this product) this item belongs to, if any. */
32
+ batchId?: string | null;
33
+ /** Variant (product definition) this item belongs to, if any. */
34
+ variantId?: string | null;
35
+ /** Lot (cross-product production grouping) this item belongs to, if any. Separate from `batchId`. */
36
+ lotId?: string | null;
31
37
  /** Is this proof available to be claimed */
32
38
  claimable?: boolean;
33
39
  /** Is this proof virtual */