@proveanything/smartlinks 1.15.1 → 1.15.2

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.
@@ -34,6 +34,18 @@ export declare namespace collection {
34
34
  * @throws ErrorResponse (404) if no collection is mapped to the domain
35
35
  */
36
36
  function getByHub(): Promise<CollectionResponse>;
37
+ /**
38
+ * Resolve the collection for an explicit Hub domain (public endpoint).
39
+ *
40
+ * Unlike {@link getByHub}, the domain is passed explicitly rather than derived
41
+ * from request headers — use this for raw/cross-origin calls where the Hub
42
+ * frontend knows its own hostname (e.g. "erbauer.mysmartlinks.app").
43
+ *
44
+ * @param domain – The Hub domain to resolve (custom domain or {brand}.mysmartlinks.app)
45
+ * @returns Promise resolving to the CollectionResponse mapped to the domain
46
+ * @throws ErrorResponse (404) if no collection is mapped to the domain
47
+ */
48
+ function getByDomain(domain: string): Promise<CollectionResponse>;
37
49
  /**
38
50
  * Check whether a Hub subdomain name is available to claim (admin only).
39
51
  * @param collectionId – Identifier of the collection making the request
@@ -54,6 +54,22 @@ export var collection;
54
54
  return request(path);
55
55
  }
56
56
  collection.getByHub = getByHub;
57
+ /**
58
+ * Resolve the collection for an explicit Hub domain (public endpoint).
59
+ *
60
+ * Unlike {@link getByHub}, the domain is passed explicitly rather than derived
61
+ * from request headers — use this for raw/cross-origin calls where the Hub
62
+ * frontend knows its own hostname (e.g. "erbauer.mysmartlinks.app").
63
+ *
64
+ * @param domain – The Hub domain to resolve (custom domain or {brand}.mysmartlinks.app)
65
+ * @returns Promise resolving to the CollectionResponse mapped to the domain
66
+ * @throws ErrorResponse (404) if no collection is mapped to the domain
67
+ */
68
+ async function getByDomain(domain) {
69
+ const path = `/public/collection/by-domain/${encodeURIComponent(domain)}`;
70
+ return request(path);
71
+ }
72
+ collection.getByDomain = getByDomain;
57
73
  /**
58
74
  * Check whether a Hub subdomain name is available to claim (admin only).
59
75
  * @param collectionId – Identifier of the collection making the request
@@ -1,4 +1,4 @@
1
- import type { FacetDefinition, FacetDefinitionWriteInput, FacetGetParams, FacetListParams, FacetListResponse, FacetQueryRequest, FacetQueryResponse, FacetValueGetParams, FacetValueListParams, FacetValueListResponse, FacetValueResponse, FacetValueWriteInput, PublicFacetListParams } from "../types/facets";
1
+ import type { FacetDefinition, FacetDefinitionWriteInput, FacetGetParams, FacetListParams, FacetListResponse, FacetNamespaceListResponse, FacetQueryRequest, FacetQueryResponse, FacetValueGetParams, FacetValueListParams, FacetValueListResponse, FacetValueResponse, FacetValueWriteInput, PublicFacetListParams } from "../types/facets";
2
2
  /**
3
3
  * Facet management and aggregation endpoints.
4
4
  *
@@ -18,9 +18,11 @@ export declare namespace facets {
18
18
  function updateValue(collectionId: string, facetKey: string, valueKey: string, data: FacetValueWriteInput): Promise<FacetValueResponse>;
19
19
  function removeValue(collectionId: string, facetKey: string, valueKey: string): Promise<void>;
20
20
  function query(collectionId: string, body: FacetQueryRequest): Promise<FacetQueryResponse>;
21
+ function namespaces(collectionId: string): Promise<FacetNamespaceListResponse>;
21
22
  function publicList(collectionId: string, params?: PublicFacetListParams): Promise<FacetListResponse>;
22
23
  function publicGet(collectionId: string, facetKey: string, params?: PublicFacetListParams): Promise<FacetDefinition>;
23
24
  function publicListValues(collectionId: string, facetKey: string): Promise<FacetValueListResponse>;
24
25
  function publicGetValue(collectionId: string, facetKey: string, valueKey: string): Promise<FacetValueResponse>;
25
26
  function publicQuery(collectionId: string, body: FacetQueryRequest): Promise<FacetQueryResponse>;
27
+ function publicNamespaces(collectionId: string): Promise<FacetNamespaceListResponse>;
26
28
  }
@@ -78,6 +78,11 @@ export var facets;
78
78
  return post(path, body);
79
79
  }
80
80
  facets.query = query;
81
+ async function namespaces(collectionId) {
82
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/facets/namespaces`;
83
+ return request(path);
84
+ }
85
+ facets.namespaces = namespaces;
81
86
  async function publicList(collectionId, params) {
82
87
  const path = `/public/collection/${encodeURIComponent(collectionId)}/facets${buildQueryString(params)}`;
83
88
  return request(path);
@@ -103,4 +108,9 @@ export var facets;
103
108
  return post(path, body);
104
109
  }
105
110
  facets.publicQuery = publicQuery;
111
+ async function publicNamespaces(collectionId) {
112
+ const path = `/public/collection/${encodeURIComponent(collectionId)}/facets/namespaces`;
113
+ return request(path);
114
+ }
115
+ facets.publicNamespaces = publicNamespaces;
106
116
  })(facets || (facets = {}));
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.15.1 | Generated: 2026-06-13T08:46:42.914Z
3
+ Version: 1.15.2 | Generated: 2026-07-05T07:39:20.416Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -5039,6 +5039,7 @@ interface FacetDefinition {
5039
5039
  key: string
5040
5040
  name: string
5041
5041
  description?: string | null
5042
+ namespace?: string | null
5042
5043
  cardinality?: "single" | "multi"
5043
5044
  kind?: "system" | "custom"
5044
5045
  hierarchical?: boolean
@@ -5087,6 +5088,7 @@ interface FacetDefinitionWriteInput {
5087
5088
  key?: string
5088
5089
  name: string
5089
5090
  description?: string | null
5091
+ namespace?: string | null
5090
5092
  cardinality?: "single" | "multi"
5091
5093
  kind?: "system" | "custom"
5092
5094
  hierarchical?: boolean
@@ -5144,6 +5146,7 @@ interface FacetQueryRequest {
5144
5146
  facetKeys?: string[]
5145
5147
  includeEmpty?: boolean
5146
5148
  includeDeleted?: boolean
5149
+ namespace?: string | null
5147
5150
  query?: ProductQueryRequest["query"] & {
5148
5151
  facetEquals?: Record<string, JsonValue | JsonValue[]>
5149
5152
  }
@@ -5182,6 +5185,7 @@ interface FacetListParams {
5182
5185
  includeDeleted?: boolean
5183
5186
  kind?: "system" | "custom"
5184
5187
  reserved?: boolean
5188
+ namespace?: string
5185
5189
  }
5186
5190
  ```
5187
5191
 
@@ -5189,6 +5193,14 @@ interface FacetListParams {
5189
5193
  ```typescript
5190
5194
  interface PublicFacetListParams {
5191
5195
  includeValues?: boolean
5196
+ namespace?: string
5197
+ }
5198
+ ```
5199
+
5200
+ **FacetNamespaceListResponse** (interface)
5201
+ ```typescript
5202
+ interface FacetNamespaceListResponse {
5203
+ namespaces: string[]
5192
5204
  }
5193
5205
  ```
5194
5206
 
@@ -8619,6 +8631,9 @@ Retrieve a collection by its shortId (public endpoint).
8619
8631
  **getByHub**() → `Promise<CollectionResponse>`
8620
8632
  Resolve the collection for the current Hub domain (public endpoint). The server derives the requesting domain from the request headers (`X-Source-Domain` / `X-Forwarded-Host` / `Host`), so no identifier is passed — this is the call a Hub frontend makes on load to find out which collection it is serving, whether it's reached via `{brand}.mysmartlinks.app` or a bring-your-own custom domain (e.g. `hub.acme.com`).
8621
8633
 
8634
+ **getByDomain**(domain: string) → `Promise<CollectionResponse>`
8635
+ Resolve the collection for an explicit Hub domain (public endpoint). Unlike {@link getByHub}, the domain is passed explicitly rather than derived from request headers — use this for raw/cross-origin calls where the Hub frontend knows its own hostname (e.g. "erbauer.mysmartlinks.app").
8636
+
8622
8637
  **checkHubAvailability**(collectionId: string, name: string) → `Promise<HubAvailabilityResponse>`
8623
8638
  Check whether a Hub subdomain name is available to claim (admin only).
8624
8639
 
@@ -8942,6 +8957,8 @@ Delete a crate for a collection (admin only). This performs a soft delete. ```ty
8942
8957
  **query**(collectionId: string,
8943
8958
  body: FacetQueryRequest) → `Promise<FacetQueryResponse>`
8944
8959
 
8960
+ **namespaces**(collectionId: string) → `Promise<FacetNamespaceListResponse>`
8961
+
8945
8962
  **publicList**(collectionId: string,
8946
8963
  params?: PublicFacetListParams) → `Promise<FacetListResponse>`
8947
8964
 
@@ -8959,6 +8976,8 @@ Delete a crate for a collection (admin only). This performs a soft delete. ```ty
8959
8976
  **publicQuery**(collectionId: string,
8960
8977
  body: FacetQueryRequest) → `Promise<FacetQueryResponse>`
8961
8978
 
8979
+ **publicNamespaces**(collectionId: string) → `Promise<FacetNamespaceListResponse>`
8980
+
8962
8981
  ### form
8963
8982
 
8964
8983
  **get**(collectionId: string, formId: string, admin?: boolean) → `Promise<any>`
@@ -42,6 +42,21 @@ includeValues?: boolean
42
42
  includeDeleted?: boolean
43
43
  kind?: 'system' | 'custom'
44
44
  reserved?: boolean
45
+ namespace?: string
46
+ ```
47
+
48
+ When `namespace` is provided, returns facets matching that namespace plus global facets (`namespace: null`). Omit the param to return all facets.
49
+
50
+ ### List namespaces
51
+
52
+ ```ts
53
+ GET /api/v1/admin/collection/:collectionId/facets/namespaces
54
+ ```
55
+
56
+ Returns all distinct namespaces in use for the collection (excludes globals).
57
+
58
+ ```ts
59
+ { namespaces: string[] }
45
60
  ```
46
61
 
47
62
  ### Create facet definition
@@ -50,6 +65,8 @@ reserved?: boolean
50
65
  POST /api/v1/admin/collection/:collectionId/facets
51
66
  ```
52
67
 
68
+ Pass `namespace` in the body to scope the facet to a domain (e.g. `"dpp"`, `"nutrition"`). Omit it to create a global facet.
69
+
53
70
  ### Get facet definition
54
71
 
55
72
  ```ts
@@ -146,6 +163,8 @@ Supported query filters now:
146
163
  - `tags`
147
164
  - `facetEquals`
148
165
 
166
+ Body also accepts `namespace` (optional) to scope aggregation to a namespace plus global facets.
167
+
149
168
  ## Public endpoints
150
169
 
151
170
  ### List facet definitions
@@ -158,6 +177,21 @@ Optional query params:
158
177
 
159
178
  ```ts
160
179
  includeValues?: boolean
180
+ namespace?: string
181
+ ```
182
+
183
+ When `namespace` is provided, returns facets matching that namespace plus global facets (`namespace: null`). Omit the param to return all facets.
184
+
185
+ ### List namespaces
186
+
187
+ ```ts
188
+ GET /api/v1/public/collection/:collectionId/facets/namespaces
189
+ ```
190
+
191
+ Returns all distinct namespaces in use for the collection (excludes globals).
192
+
193
+ ```ts
194
+ { namespaces: string[] }
161
195
  ```
162
196
 
163
197
  ### Get facet definition
@@ -215,6 +249,7 @@ export interface FacetDefinition {
215
249
  key: string
216
250
  name: string
217
251
  description?: string | null
252
+ namespace?: string | null
218
253
  cardinality: 'single' | 'multi'
219
254
  kind: 'system' | 'custom'
220
255
  hierarchical: boolean
@@ -230,6 +265,7 @@ export interface FacetDefinitionWriteInput {
230
265
  key?: string
231
266
  name: string
232
267
  description?: string | null
268
+ namespace?: string | null
233
269
  cardinality?: 'single' | 'multi'
234
270
  kind?: 'system' | 'custom'
235
271
  hierarchical?: boolean
@@ -305,6 +341,7 @@ export interface FacetQueryRequest {
305
341
  facetKeys?: string[]
306
342
  includeEmpty?: boolean
307
343
  includeDeleted?: boolean
344
+ namespace?: string | null
308
345
  query?: {
309
346
  search?: string
310
347
  status?: string[]
@@ -326,6 +363,10 @@ export interface FacetBucket {
326
363
  count: number
327
364
  }
328
365
 
366
+ export interface FacetNamespaceListResponse {
367
+ namespaces: string[]
368
+ }
369
+
329
370
  export interface FacetQueryResponse {
330
371
  items: Array<{
331
372
  facet: FacetDefinition
@@ -344,4 +385,5 @@ export interface FacetQueryResponse {
344
385
  - treat facet definitions and facet values as collection-scoped resources
345
386
  - use the facet API to manage definitions and values
346
387
  - use product read/write routes to assign facet data onto products
347
- - treat `label` and `category` as reserved system facets when present
388
+ - treat `label` and `category` as reserved system facets when present
389
+ - facets with `namespace: null` are global and appear in all contexts; namespaced facets belong to a specific domain (e.g. `"dpp"`, `"nutrition"`)
package/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@ export type { BroadcastSendRequest } from "./types/broadcasts";
15
15
  export type { AppConfigOptions } from "./api/appConfiguration";
16
16
  export type { AdditionalGtin, ISODateString, JsonPrimitive, JsonValue, ProductCreateRequest, ProductClaimCreateInput, ProductClaimCreateRequestBody, ProductClaimLookupInput, ProductFacetMap, ProductFacetValue, ProductImageUrlInput, ProductKey, ProductQueryRequest, ProductQueryResponse, ProductUpdateRequest, Product, ProductWriteInput, PublicProduct, } from "./types/product";
17
17
  export type { TranslationLookupMode, TranslationContentType, TranslationQuality, TranslationItemStatus, TranslationContextValue, TranslationContext, TranslationLookupRequestBase, TranslationLookupSingleRequest, TranslationLookupBatchRequest, TranslationLookupRequest, TranslationLookupItem, TranslationLookupResponse, ResolvedTranslationItem, ResolvedTranslationResponse, TranslationHashOptions, TranslationResolveOptions, TranslationRecord, TranslationListParams, TranslationListResponse, TranslationUpdateRequest, } from "./types/translations";
18
- export type { FacetBucket, FacetDefinition, FacetDefinitionWriteInput, FacetGetParams, FacetListParams, FacetListResponse, FacetQueryRequest, FacetQueryResponse, FacetValue, FacetValueDefinition, FacetValueGetParams, FacetValueListParams, FacetValueListResponse, FacetValueResponse, FacetValueWriteInput, PublicFacetListParams, } from "./types/facets";
18
+ export type { FacetBucket, FacetDefinition, FacetDefinitionWriteInput, FacetGetParams, FacetListParams, FacetListResponse, FacetNamespaceListResponse, FacetQueryRequest, FacetQueryResponse, FacetValue, FacetValueDefinition, FacetValueGetParams, FacetValueListParams, FacetValueListResponse, FacetValueResponse, FacetValueWriteInput, PublicFacetListParams, } from "./types/facets";
19
19
  export type { Collection, CollectionResponse, CollectionCreateRequest, CollectionUpdateRequest, DomainTarget, HubAvailabilityResponse, } from "./types/collection";
20
20
  export type { Proof, ProofResponse, ProofCreateRequest, ProofUpdateRequest, ProofClaimRequest, } from "./types/proof";
21
21
  export type { QrShortCodeLookupResponse, } from "./types/qr";
package/dist/openapi.yaml CHANGED
@@ -3429,6 +3429,11 @@ paths:
3429
3429
  required: false
3430
3430
  schema:
3431
3431
  type: boolean
3432
+ - name: namespace
3433
+ in: query
3434
+ required: false
3435
+ schema:
3436
+ type: string
3432
3437
  responses:
3433
3438
  200:
3434
3439
  description: Success
@@ -3474,6 +3479,33 @@ paths:
3474
3479
  application/json:
3475
3480
  schema:
3476
3481
  $ref: "#/components/schemas/FacetDefinitionWriteInput"
3482
+ /admin/collection/{collectionId}/facets/namespaces:
3483
+ get:
3484
+ tags:
3485
+ - facets
3486
+ summary: facets.namespaces
3487
+ operationId: facets_namespaces
3488
+ security:
3489
+ - bearerAuth: []
3490
+ parameters:
3491
+ - name: collectionId
3492
+ in: path
3493
+ required: true
3494
+ schema:
3495
+ type: string
3496
+ responses:
3497
+ 200:
3498
+ description: Success
3499
+ content:
3500
+ application/json:
3501
+ schema:
3502
+ $ref: "#/components/schemas/FacetNamespaceListResponse"
3503
+ 400:
3504
+ description: Bad request
3505
+ 401:
3506
+ description: Unauthorized
3507
+ 404:
3508
+ description: Not found
3477
3509
  /admin/collection/{collectionId}/facets/query:
3478
3510
  post:
3479
3511
  tags:
@@ -9316,6 +9348,32 @@ paths:
9316
9348
  application/json:
9317
9349
  schema:
9318
9350
  $ref: "#/components/schemas/RequestUploadTokenOptions"
9351
+ /public/collection/by-domain/{domain}:
9352
+ get:
9353
+ tags:
9354
+ - collection
9355
+ summary: Resolve the collection for an explicit Hub domain (public endpoint).
9356
+ operationId: collection_getByDomain
9357
+ security: []
9358
+ parameters:
9359
+ - name: domain
9360
+ in: path
9361
+ required: true
9362
+ schema:
9363
+ type: string
9364
+ responses:
9365
+ 200:
9366
+ description: Success
9367
+ content:
9368
+ application/json:
9369
+ schema:
9370
+ $ref: "#/components/schemas/CollectionResponse"
9371
+ 400:
9372
+ description: Bad request
9373
+ 401:
9374
+ description: Unauthorized
9375
+ 404:
9376
+ description: Not found
9319
9377
  /public/collection/getByHub:
9320
9378
  get:
9321
9379
  tags:
@@ -10811,6 +10869,11 @@ paths:
10811
10869
  required: false
10812
10870
  schema:
10813
10871
  type: boolean
10872
+ - name: namespace
10873
+ in: query
10874
+ required: false
10875
+ schema:
10876
+ type: string
10814
10877
  responses:
10815
10878
  200:
10816
10879
  description: Success
@@ -10824,6 +10887,32 @@ paths:
10824
10887
  description: Unauthorized
10825
10888
  404:
10826
10889
  description: Not found
10890
+ /public/collection/{collectionId}/facets/namespaces:
10891
+ get:
10892
+ tags:
10893
+ - facets
10894
+ summary: facets.publicNamespaces
10895
+ operationId: facets_publicNamespaces
10896
+ security: []
10897
+ parameters:
10898
+ - name: collectionId
10899
+ in: path
10900
+ required: true
10901
+ schema:
10902
+ type: string
10903
+ responses:
10904
+ 200:
10905
+ description: Success
10906
+ content:
10907
+ application/json:
10908
+ schema:
10909
+ $ref: "#/components/schemas/FacetNamespaceListResponse"
10910
+ 400:
10911
+ description: Bad request
10912
+ 401:
10913
+ description: Unauthorized
10914
+ 404:
10915
+ description: Not found
10827
10916
  /public/collection/{collectionId}/facets/query:
10828
10917
  post:
10829
10918
  tags:
@@ -10879,6 +10968,11 @@ paths:
10879
10968
  required: false
10880
10969
  schema:
10881
10970
  type: boolean
10971
+ - name: namespace
10972
+ in: query
10973
+ required: false
10974
+ schema:
10975
+ type: string
10882
10976
  responses:
10883
10977
  200:
10884
10978
  description: Success
@@ -20697,6 +20791,8 @@ components:
20697
20791
  type: string
20698
20792
  description:
20699
20793
  type: string
20794
+ namespace:
20795
+ type: string
20700
20796
  cardinality:
20701
20797
  type: object
20702
20798
  additionalProperties: true
@@ -20792,6 +20888,8 @@ components:
20792
20888
  type: string
20793
20889
  description:
20794
20890
  type: string
20891
+ namespace:
20892
+ type: string
20795
20893
  cardinality:
20796
20894
  type: object
20797
20895
  additionalProperties: true
@@ -20887,6 +20985,8 @@ components:
20887
20985
  type: boolean
20888
20986
  includeDeleted:
20889
20987
  type: boolean
20988
+ namespace:
20989
+ type: string
20890
20990
  query:
20891
20991
  type: object
20892
20992
  additionalProperties: true
@@ -20954,11 +21054,24 @@ components:
20954
21054
  additionalProperties: true
20955
21055
  reserved:
20956
21056
  type: boolean
21057
+ namespace:
21058
+ type: string
20957
21059
  PublicFacetListParams:
20958
21060
  type: object
20959
21061
  properties:
20960
21062
  includeValues:
20961
21063
  type: boolean
21064
+ namespace:
21065
+ type: string
21066
+ FacetNamespaceListResponse:
21067
+ type: object
21068
+ properties:
21069
+ namespaces:
21070
+ type: array
21071
+ items:
21072
+ type: string
21073
+ required:
21074
+ - namespaces
20962
21075
  FacetGetParams:
20963
21076
  type: object
20964
21077
  properties:
@@ -6,6 +6,7 @@ export interface FacetDefinition {
6
6
  key: string;
7
7
  name: string;
8
8
  description?: string | null;
9
+ namespace?: string | null;
9
10
  cardinality?: "single" | "multi";
10
11
  kind?: "system" | "custom";
11
12
  hierarchical?: boolean;
@@ -46,6 +47,7 @@ export interface FacetDefinitionWriteInput {
46
47
  key?: string;
47
48
  name: string;
48
49
  description?: string | null;
50
+ namespace?: string | null;
49
51
  cardinality?: "single" | "multi";
50
52
  kind?: "system" | "custom";
51
53
  hierarchical?: boolean;
@@ -83,6 +85,7 @@ export interface FacetQueryRequest {
83
85
  facetKeys?: string[];
84
86
  includeEmpty?: boolean;
85
87
  includeDeleted?: boolean;
88
+ namespace?: string | null;
86
89
  query?: ProductQueryRequest["query"] & {
87
90
  facetEquals?: Record<string, JsonValue | JsonValue[]>;
88
91
  };
@@ -109,9 +112,14 @@ export interface FacetListParams {
109
112
  includeDeleted?: boolean;
110
113
  kind?: "system" | "custom";
111
114
  reserved?: boolean;
115
+ namespace?: string;
112
116
  }
113
117
  export interface PublicFacetListParams {
114
118
  includeValues?: boolean;
119
+ namespace?: string;
120
+ }
121
+ export interface FacetNamespaceListResponse {
122
+ namespaces: string[];
115
123
  }
116
124
  export interface FacetGetParams {
117
125
  includeValues?: boolean;
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.15.1 | Generated: 2026-06-13T08:46:42.914Z
3
+ Version: 1.15.2 | Generated: 2026-07-05T07:39:20.416Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -5039,6 +5039,7 @@ interface FacetDefinition {
5039
5039
  key: string
5040
5040
  name: string
5041
5041
  description?: string | null
5042
+ namespace?: string | null
5042
5043
  cardinality?: "single" | "multi"
5043
5044
  kind?: "system" | "custom"
5044
5045
  hierarchical?: boolean
@@ -5087,6 +5088,7 @@ interface FacetDefinitionWriteInput {
5087
5088
  key?: string
5088
5089
  name: string
5089
5090
  description?: string | null
5091
+ namespace?: string | null
5090
5092
  cardinality?: "single" | "multi"
5091
5093
  kind?: "system" | "custom"
5092
5094
  hierarchical?: boolean
@@ -5144,6 +5146,7 @@ interface FacetQueryRequest {
5144
5146
  facetKeys?: string[]
5145
5147
  includeEmpty?: boolean
5146
5148
  includeDeleted?: boolean
5149
+ namespace?: string | null
5147
5150
  query?: ProductQueryRequest["query"] & {
5148
5151
  facetEquals?: Record<string, JsonValue | JsonValue[]>
5149
5152
  }
@@ -5182,6 +5185,7 @@ interface FacetListParams {
5182
5185
  includeDeleted?: boolean
5183
5186
  kind?: "system" | "custom"
5184
5187
  reserved?: boolean
5188
+ namespace?: string
5185
5189
  }
5186
5190
  ```
5187
5191
 
@@ -5189,6 +5193,14 @@ interface FacetListParams {
5189
5193
  ```typescript
5190
5194
  interface PublicFacetListParams {
5191
5195
  includeValues?: boolean
5196
+ namespace?: string
5197
+ }
5198
+ ```
5199
+
5200
+ **FacetNamespaceListResponse** (interface)
5201
+ ```typescript
5202
+ interface FacetNamespaceListResponse {
5203
+ namespaces: string[]
5192
5204
  }
5193
5205
  ```
5194
5206
 
@@ -8619,6 +8631,9 @@ Retrieve a collection by its shortId (public endpoint).
8619
8631
  **getByHub**() → `Promise<CollectionResponse>`
8620
8632
  Resolve the collection for the current Hub domain (public endpoint). The server derives the requesting domain from the request headers (`X-Source-Domain` / `X-Forwarded-Host` / `Host`), so no identifier is passed — this is the call a Hub frontend makes on load to find out which collection it is serving, whether it's reached via `{brand}.mysmartlinks.app` or a bring-your-own custom domain (e.g. `hub.acme.com`).
8621
8633
 
8634
+ **getByDomain**(domain: string) → `Promise<CollectionResponse>`
8635
+ Resolve the collection for an explicit Hub domain (public endpoint). Unlike {@link getByHub}, the domain is passed explicitly rather than derived from request headers — use this for raw/cross-origin calls where the Hub frontend knows its own hostname (e.g. "erbauer.mysmartlinks.app").
8636
+
8622
8637
  **checkHubAvailability**(collectionId: string, name: string) → `Promise<HubAvailabilityResponse>`
8623
8638
  Check whether a Hub subdomain name is available to claim (admin only).
8624
8639
 
@@ -8942,6 +8957,8 @@ Delete a crate for a collection (admin only). This performs a soft delete. ```ty
8942
8957
  **query**(collectionId: string,
8943
8958
  body: FacetQueryRequest) → `Promise<FacetQueryResponse>`
8944
8959
 
8960
+ **namespaces**(collectionId: string) → `Promise<FacetNamespaceListResponse>`
8961
+
8945
8962
  **publicList**(collectionId: string,
8946
8963
  params?: PublicFacetListParams) → `Promise<FacetListResponse>`
8947
8964
 
@@ -8959,6 +8976,8 @@ Delete a crate for a collection (admin only). This performs a soft delete. ```ty
8959
8976
  **publicQuery**(collectionId: string,
8960
8977
  body: FacetQueryRequest) → `Promise<FacetQueryResponse>`
8961
8978
 
8979
+ **publicNamespaces**(collectionId: string) → `Promise<FacetNamespaceListResponse>`
8980
+
8962
8981
  ### form
8963
8982
 
8964
8983
  **get**(collectionId: string, formId: string, admin?: boolean) → `Promise<any>`
@@ -42,6 +42,21 @@ includeValues?: boolean
42
42
  includeDeleted?: boolean
43
43
  kind?: 'system' | 'custom'
44
44
  reserved?: boolean
45
+ namespace?: string
46
+ ```
47
+
48
+ When `namespace` is provided, returns facets matching that namespace plus global facets (`namespace: null`). Omit the param to return all facets.
49
+
50
+ ### List namespaces
51
+
52
+ ```ts
53
+ GET /api/v1/admin/collection/:collectionId/facets/namespaces
54
+ ```
55
+
56
+ Returns all distinct namespaces in use for the collection (excludes globals).
57
+
58
+ ```ts
59
+ { namespaces: string[] }
45
60
  ```
46
61
 
47
62
  ### Create facet definition
@@ -50,6 +65,8 @@ reserved?: boolean
50
65
  POST /api/v1/admin/collection/:collectionId/facets
51
66
  ```
52
67
 
68
+ Pass `namespace` in the body to scope the facet to a domain (e.g. `"dpp"`, `"nutrition"`). Omit it to create a global facet.
69
+
53
70
  ### Get facet definition
54
71
 
55
72
  ```ts
@@ -146,6 +163,8 @@ Supported query filters now:
146
163
  - `tags`
147
164
  - `facetEquals`
148
165
 
166
+ Body also accepts `namespace` (optional) to scope aggregation to a namespace plus global facets.
167
+
149
168
  ## Public endpoints
150
169
 
151
170
  ### List facet definitions
@@ -158,6 +177,21 @@ Optional query params:
158
177
 
159
178
  ```ts
160
179
  includeValues?: boolean
180
+ namespace?: string
181
+ ```
182
+
183
+ When `namespace` is provided, returns facets matching that namespace plus global facets (`namespace: null`). Omit the param to return all facets.
184
+
185
+ ### List namespaces
186
+
187
+ ```ts
188
+ GET /api/v1/public/collection/:collectionId/facets/namespaces
189
+ ```
190
+
191
+ Returns all distinct namespaces in use for the collection (excludes globals).
192
+
193
+ ```ts
194
+ { namespaces: string[] }
161
195
  ```
162
196
 
163
197
  ### Get facet definition
@@ -215,6 +249,7 @@ export interface FacetDefinition {
215
249
  key: string
216
250
  name: string
217
251
  description?: string | null
252
+ namespace?: string | null
218
253
  cardinality: 'single' | 'multi'
219
254
  kind: 'system' | 'custom'
220
255
  hierarchical: boolean
@@ -230,6 +265,7 @@ export interface FacetDefinitionWriteInput {
230
265
  key?: string
231
266
  name: string
232
267
  description?: string | null
268
+ namespace?: string | null
233
269
  cardinality?: 'single' | 'multi'
234
270
  kind?: 'system' | 'custom'
235
271
  hierarchical?: boolean
@@ -305,6 +341,7 @@ export interface FacetQueryRequest {
305
341
  facetKeys?: string[]
306
342
  includeEmpty?: boolean
307
343
  includeDeleted?: boolean
344
+ namespace?: string | null
308
345
  query?: {
309
346
  search?: string
310
347
  status?: string[]
@@ -326,6 +363,10 @@ export interface FacetBucket {
326
363
  count: number
327
364
  }
328
365
 
366
+ export interface FacetNamespaceListResponse {
367
+ namespaces: string[]
368
+ }
369
+
329
370
  export interface FacetQueryResponse {
330
371
  items: Array<{
331
372
  facet: FacetDefinition
@@ -344,4 +385,5 @@ export interface FacetQueryResponse {
344
385
  - treat facet definitions and facet values as collection-scoped resources
345
386
  - use the facet API to manage definitions and values
346
387
  - use product read/write routes to assign facet data onto products
347
- - treat `label` and `category` as reserved system facets when present
388
+ - treat `label` and `category` as reserved system facets when present
389
+ - facets with `namespace: null` are global and appear in all contexts; namespaced facets belong to a specific domain (e.g. `"dpp"`, `"nutrition"`)
package/openapi.yaml CHANGED
@@ -3429,6 +3429,11 @@ paths:
3429
3429
  required: false
3430
3430
  schema:
3431
3431
  type: boolean
3432
+ - name: namespace
3433
+ in: query
3434
+ required: false
3435
+ schema:
3436
+ type: string
3432
3437
  responses:
3433
3438
  200:
3434
3439
  description: Success
@@ -3474,6 +3479,33 @@ paths:
3474
3479
  application/json:
3475
3480
  schema:
3476
3481
  $ref: "#/components/schemas/FacetDefinitionWriteInput"
3482
+ /admin/collection/{collectionId}/facets/namespaces:
3483
+ get:
3484
+ tags:
3485
+ - facets
3486
+ summary: facets.namespaces
3487
+ operationId: facets_namespaces
3488
+ security:
3489
+ - bearerAuth: []
3490
+ parameters:
3491
+ - name: collectionId
3492
+ in: path
3493
+ required: true
3494
+ schema:
3495
+ type: string
3496
+ responses:
3497
+ 200:
3498
+ description: Success
3499
+ content:
3500
+ application/json:
3501
+ schema:
3502
+ $ref: "#/components/schemas/FacetNamespaceListResponse"
3503
+ 400:
3504
+ description: Bad request
3505
+ 401:
3506
+ description: Unauthorized
3507
+ 404:
3508
+ description: Not found
3477
3509
  /admin/collection/{collectionId}/facets/query:
3478
3510
  post:
3479
3511
  tags:
@@ -9316,6 +9348,32 @@ paths:
9316
9348
  application/json:
9317
9349
  schema:
9318
9350
  $ref: "#/components/schemas/RequestUploadTokenOptions"
9351
+ /public/collection/by-domain/{domain}:
9352
+ get:
9353
+ tags:
9354
+ - collection
9355
+ summary: Resolve the collection for an explicit Hub domain (public endpoint).
9356
+ operationId: collection_getByDomain
9357
+ security: []
9358
+ parameters:
9359
+ - name: domain
9360
+ in: path
9361
+ required: true
9362
+ schema:
9363
+ type: string
9364
+ responses:
9365
+ 200:
9366
+ description: Success
9367
+ content:
9368
+ application/json:
9369
+ schema:
9370
+ $ref: "#/components/schemas/CollectionResponse"
9371
+ 400:
9372
+ description: Bad request
9373
+ 401:
9374
+ description: Unauthorized
9375
+ 404:
9376
+ description: Not found
9319
9377
  /public/collection/getByHub:
9320
9378
  get:
9321
9379
  tags:
@@ -10811,6 +10869,11 @@ paths:
10811
10869
  required: false
10812
10870
  schema:
10813
10871
  type: boolean
10872
+ - name: namespace
10873
+ in: query
10874
+ required: false
10875
+ schema:
10876
+ type: string
10814
10877
  responses:
10815
10878
  200:
10816
10879
  description: Success
@@ -10824,6 +10887,32 @@ paths:
10824
10887
  description: Unauthorized
10825
10888
  404:
10826
10889
  description: Not found
10890
+ /public/collection/{collectionId}/facets/namespaces:
10891
+ get:
10892
+ tags:
10893
+ - facets
10894
+ summary: facets.publicNamespaces
10895
+ operationId: facets_publicNamespaces
10896
+ security: []
10897
+ parameters:
10898
+ - name: collectionId
10899
+ in: path
10900
+ required: true
10901
+ schema:
10902
+ type: string
10903
+ responses:
10904
+ 200:
10905
+ description: Success
10906
+ content:
10907
+ application/json:
10908
+ schema:
10909
+ $ref: "#/components/schemas/FacetNamespaceListResponse"
10910
+ 400:
10911
+ description: Bad request
10912
+ 401:
10913
+ description: Unauthorized
10914
+ 404:
10915
+ description: Not found
10827
10916
  /public/collection/{collectionId}/facets/query:
10828
10917
  post:
10829
10918
  tags:
@@ -10879,6 +10968,11 @@ paths:
10879
10968
  required: false
10880
10969
  schema:
10881
10970
  type: boolean
10971
+ - name: namespace
10972
+ in: query
10973
+ required: false
10974
+ schema:
10975
+ type: string
10882
10976
  responses:
10883
10977
  200:
10884
10978
  description: Success
@@ -20697,6 +20791,8 @@ components:
20697
20791
  type: string
20698
20792
  description:
20699
20793
  type: string
20794
+ namespace:
20795
+ type: string
20700
20796
  cardinality:
20701
20797
  type: object
20702
20798
  additionalProperties: true
@@ -20792,6 +20888,8 @@ components:
20792
20888
  type: string
20793
20889
  description:
20794
20890
  type: string
20891
+ namespace:
20892
+ type: string
20795
20893
  cardinality:
20796
20894
  type: object
20797
20895
  additionalProperties: true
@@ -20887,6 +20985,8 @@ components:
20887
20985
  type: boolean
20888
20986
  includeDeleted:
20889
20987
  type: boolean
20988
+ namespace:
20989
+ type: string
20890
20990
  query:
20891
20991
  type: object
20892
20992
  additionalProperties: true
@@ -20954,11 +21054,24 @@ components:
20954
21054
  additionalProperties: true
20955
21055
  reserved:
20956
21056
  type: boolean
21057
+ namespace:
21058
+ type: string
20957
21059
  PublicFacetListParams:
20958
21060
  type: object
20959
21061
  properties:
20960
21062
  includeValues:
20961
21063
  type: boolean
21064
+ namespace:
21065
+ type: string
21066
+ FacetNamespaceListResponse:
21067
+ type: object
21068
+ properties:
21069
+ namespaces:
21070
+ type: array
21071
+ items:
21072
+ type: string
21073
+ required:
21074
+ - namespaces
20962
21075
  FacetGetParams:
20963
21076
  type: object
20964
21077
  properties:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.15.1",
3
+ "version": "1.15.2",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",