@proveanything/smartlinks 1.15.0 → 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.
- package/dist/api/collection.d.ts +69 -1
- package/dist/api/collection.js +94 -0
- package/dist/api/facets.d.ts +3 -1
- package/dist/api/facets.js +10 -0
- package/dist/docs/API_SUMMARY.md +47 -1
- package/dist/docs/PRODUCT_FACETS_SDK.md +43 -1
- package/dist/http.js +3 -1
- package/dist/index.d.ts +2 -2
- package/dist/openapi.yaml +258 -0
- package/dist/types/collection.d.ts +19 -0
- package/dist/types/facets.d.ts +8 -0
- package/docs/API_SUMMARY.md +47 -1
- package/docs/PRODUCT_FACETS_SDK.md +43 -1
- package/openapi.yaml +258 -0
- package/package.json +1 -1
package/dist/api/collection.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CollectionResponse, CollectionCreateRequest, CollectionUpdateRequest, AppsConfigResponse } from "../types/collection";
|
|
1
|
+
import { CollectionResponse, CollectionCreateRequest, CollectionUpdateRequest, AppsConfigResponse, DomainTarget, HubAvailabilityResponse } from "../types/collection";
|
|
2
2
|
export declare namespace collection {
|
|
3
3
|
/**
|
|
4
4
|
* Retrieves a single Collection by its ID.
|
|
@@ -21,6 +21,74 @@ export declare namespace collection {
|
|
|
21
21
|
* @returns Promise resolving to a CollectionResponse object
|
|
22
22
|
*/
|
|
23
23
|
function getShortId(shortId: string): Promise<CollectionResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Resolve the collection for the current Hub domain (public endpoint).
|
|
26
|
+
*
|
|
27
|
+
* The server derives the requesting domain from the request headers
|
|
28
|
+
* (`X-Source-Domain` / `X-Forwarded-Host` / `Host`), so no identifier is
|
|
29
|
+
* passed — this is the call a Hub frontend makes on load to find out which
|
|
30
|
+
* collection it is serving, whether it's reached via `{brand}.mysmartlinks.app`
|
|
31
|
+
* or a bring-your-own custom domain (e.g. `hub.acme.com`).
|
|
32
|
+
*
|
|
33
|
+
* @returns Promise resolving to the CollectionResponse mapped to the domain
|
|
34
|
+
* @throws ErrorResponse (404) if no collection is mapped to the domain
|
|
35
|
+
*/
|
|
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>;
|
|
49
|
+
/**
|
|
50
|
+
* Check whether a Hub subdomain name is available to claim (admin only).
|
|
51
|
+
* @param collectionId – Identifier of the collection making the request
|
|
52
|
+
* @param name – Proposed subdomain prefix (lowercase letters, numbers, hyphens; max 63 chars)
|
|
53
|
+
* @returns Promise resolving to { available, domain }
|
|
54
|
+
* @throws ErrorResponse (400) if the name fails validation or is reserved
|
|
55
|
+
*/
|
|
56
|
+
function checkHubAvailability(collectionId: string, name: string): Promise<HubAvailabilityResponse>;
|
|
57
|
+
/**
|
|
58
|
+
* Claim or rename the Hub subdomain for a collection (admin only).
|
|
59
|
+
*
|
|
60
|
+
* Maps `{hubName}.mysmartlinks.app` to the collection. If the collection
|
|
61
|
+
* already had a different hub name, the previous subdomain is released
|
|
62
|
+
* automatically.
|
|
63
|
+
*
|
|
64
|
+
* @param collectionId – Identifier of the collection
|
|
65
|
+
* @param hubName – The subdomain prefix to claim (e.g. "acme")
|
|
66
|
+
* @returns Promise resolving to the updated CollectionResponse (with hubName set)
|
|
67
|
+
* @throws ErrorResponse (400) on invalid/reserved name, (409) if already taken by another collection
|
|
68
|
+
*/
|
|
69
|
+
function claimHub(collectionId: string, hubName: string): Promise<CollectionResponse>;
|
|
70
|
+
/**
|
|
71
|
+
* Register a custom domain for a collection and provision its managed
|
|
72
|
+
* certificate (admin only).
|
|
73
|
+
*
|
|
74
|
+
* @param collectionId – Identifier of the collection
|
|
75
|
+
* @param domain – The fully-qualified domain to register (e.g. "hub.acme.com")
|
|
76
|
+
* @param target – Which load balancer / certificate map to use. Defaults to
|
|
77
|
+
* `"smartlinks"` (the id.smartlinks.app load balancer). Pass `"hub"` to
|
|
78
|
+
* register a bring-your-own Hub domain.
|
|
79
|
+
* @returns Promise resolving when registration has been initiated
|
|
80
|
+
* @throws ErrorResponse if the request fails
|
|
81
|
+
*/
|
|
82
|
+
function registerDomain(collectionId: string, domain: string, target?: DomainTarget): Promise<any>;
|
|
83
|
+
/**
|
|
84
|
+
* Get the managed-certificate status for a collection's custom domain (admin only).
|
|
85
|
+
* @param collectionId – Identifier of the collection
|
|
86
|
+
* @param target – Which domain to check: `"smartlinks"` (default, uses `redirectUrl`)
|
|
87
|
+
* or `"hub"` (uses `hubCustomDomain`)
|
|
88
|
+
* @returns Promise resolving to the certificate details
|
|
89
|
+
* @throws ErrorResponse (404) if the relevant domain is not set
|
|
90
|
+
*/
|
|
91
|
+
function getDomainStatus(collectionId: string, target?: DomainTarget): Promise<any>;
|
|
24
92
|
/**
|
|
25
93
|
* Retrieve a specific settings group for a collection.
|
|
26
94
|
* Public reads return the public view of the settings group. If the stored payload contains
|
package/dist/api/collection.js
CHANGED
|
@@ -37,6 +37,100 @@ export var collection;
|
|
|
37
37
|
return request(path);
|
|
38
38
|
}
|
|
39
39
|
collection.getShortId = getShortId;
|
|
40
|
+
/**
|
|
41
|
+
* Resolve the collection for the current Hub domain (public endpoint).
|
|
42
|
+
*
|
|
43
|
+
* The server derives the requesting domain from the request headers
|
|
44
|
+
* (`X-Source-Domain` / `X-Forwarded-Host` / `Host`), so no identifier is
|
|
45
|
+
* passed — this is the call a Hub frontend makes on load to find out which
|
|
46
|
+
* collection it is serving, whether it's reached via `{brand}.mysmartlinks.app`
|
|
47
|
+
* or a bring-your-own custom domain (e.g. `hub.acme.com`).
|
|
48
|
+
*
|
|
49
|
+
* @returns Promise resolving to the CollectionResponse mapped to the domain
|
|
50
|
+
* @throws ErrorResponse (404) if no collection is mapped to the domain
|
|
51
|
+
*/
|
|
52
|
+
async function getByHub() {
|
|
53
|
+
const path = `/public/collection/getByHub`;
|
|
54
|
+
return request(path);
|
|
55
|
+
}
|
|
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;
|
|
73
|
+
/**
|
|
74
|
+
* Check whether a Hub subdomain name is available to claim (admin only).
|
|
75
|
+
* @param collectionId – Identifier of the collection making the request
|
|
76
|
+
* @param name – Proposed subdomain prefix (lowercase letters, numbers, hyphens; max 63 chars)
|
|
77
|
+
* @returns Promise resolving to { available, domain }
|
|
78
|
+
* @throws ErrorResponse (400) if the name fails validation or is reserved
|
|
79
|
+
*/
|
|
80
|
+
async function checkHubAvailability(collectionId, name) {
|
|
81
|
+
const queryParams = new URLSearchParams({ name });
|
|
82
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/hub/available?${queryParams}`;
|
|
83
|
+
return request(path);
|
|
84
|
+
}
|
|
85
|
+
collection.checkHubAvailability = checkHubAvailability;
|
|
86
|
+
/**
|
|
87
|
+
* Claim or rename the Hub subdomain for a collection (admin only).
|
|
88
|
+
*
|
|
89
|
+
* Maps `{hubName}.mysmartlinks.app` to the collection. If the collection
|
|
90
|
+
* already had a different hub name, the previous subdomain is released
|
|
91
|
+
* automatically.
|
|
92
|
+
*
|
|
93
|
+
* @param collectionId – Identifier of the collection
|
|
94
|
+
* @param hubName – The subdomain prefix to claim (e.g. "acme")
|
|
95
|
+
* @returns Promise resolving to the updated CollectionResponse (with hubName set)
|
|
96
|
+
* @throws ErrorResponse (400) on invalid/reserved name, (409) if already taken by another collection
|
|
97
|
+
*/
|
|
98
|
+
async function claimHub(collectionId, hubName) {
|
|
99
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/hub`;
|
|
100
|
+
return post(path, { hubName });
|
|
101
|
+
}
|
|
102
|
+
collection.claimHub = claimHub;
|
|
103
|
+
/**
|
|
104
|
+
* Register a custom domain for a collection and provision its managed
|
|
105
|
+
* certificate (admin only).
|
|
106
|
+
*
|
|
107
|
+
* @param collectionId – Identifier of the collection
|
|
108
|
+
* @param domain – The fully-qualified domain to register (e.g. "hub.acme.com")
|
|
109
|
+
* @param target – Which load balancer / certificate map to use. Defaults to
|
|
110
|
+
* `"smartlinks"` (the id.smartlinks.app load balancer). Pass `"hub"` to
|
|
111
|
+
* register a bring-your-own Hub domain.
|
|
112
|
+
* @returns Promise resolving when registration has been initiated
|
|
113
|
+
* @throws ErrorResponse if the request fails
|
|
114
|
+
*/
|
|
115
|
+
async function registerDomain(collectionId, domain, target = "smartlinks") {
|
|
116
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/domain`;
|
|
117
|
+
return post(path, { domain, target });
|
|
118
|
+
}
|
|
119
|
+
collection.registerDomain = registerDomain;
|
|
120
|
+
/**
|
|
121
|
+
* Get the managed-certificate status for a collection's custom domain (admin only).
|
|
122
|
+
* @param collectionId – Identifier of the collection
|
|
123
|
+
* @param target – Which domain to check: `"smartlinks"` (default, uses `redirectUrl`)
|
|
124
|
+
* or `"hub"` (uses `hubCustomDomain`)
|
|
125
|
+
* @returns Promise resolving to the certificate details
|
|
126
|
+
* @throws ErrorResponse (404) if the relevant domain is not set
|
|
127
|
+
*/
|
|
128
|
+
async function getDomainStatus(collectionId, target = "smartlinks") {
|
|
129
|
+
const queryParams = new URLSearchParams({ target });
|
|
130
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/domain?${queryParams}`;
|
|
131
|
+
return request(path);
|
|
132
|
+
}
|
|
133
|
+
collection.getDomainStatus = getDomainStatus;
|
|
40
134
|
/**
|
|
41
135
|
* Retrieve a specific settings group for a collection.
|
|
42
136
|
* Public reads return the public view of the settings group. If the stored payload contains
|
package/dist/api/facets.d.ts
CHANGED
|
@@ -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
|
}
|
package/dist/api/facets.js
CHANGED
|
@@ -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 = {}));
|
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.15.
|
|
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
|
|
|
@@ -3606,6 +3606,8 @@ interface Collection {
|
|
|
3606
3606
|
} // User roles mapping with user IDs as keys and role names as values
|
|
3607
3607
|
groupTags?: string[] // Array of group tag names
|
|
3608
3608
|
redirectUrl?: string // Whether the collection has a custom domain
|
|
3609
|
+
hubName?: string
|
|
3610
|
+
hubCustomDomain?: string
|
|
3609
3611
|
shortId: string, // The shortId of this collection
|
|
3610
3612
|
dark?: boolean // if dark mode is enabled for this collection
|
|
3611
3613
|
primaryColor?: string
|
|
@@ -3618,6 +3620,14 @@ interface Collection {
|
|
|
3618
3620
|
}
|
|
3619
3621
|
```
|
|
3620
3622
|
|
|
3623
|
+
**HubAvailabilityResponse** (interface)
|
|
3624
|
+
```typescript
|
|
3625
|
+
interface HubAvailabilityResponse {
|
|
3626
|
+
available: boolean
|
|
3627
|
+
domain: string
|
|
3628
|
+
}
|
|
3629
|
+
```
|
|
3630
|
+
|
|
3621
3631
|
**AppConfig** (interface)
|
|
3622
3632
|
```typescript
|
|
3623
3633
|
interface AppConfig {
|
|
@@ -3657,6 +3667,8 @@ interface AppsConfigResponse {
|
|
|
3657
3667
|
|
|
3658
3668
|
**CollectionUpdateRequest** = `Partial<Omit<Collection, 'id' | 'shortId'>>`
|
|
3659
3669
|
|
|
3670
|
+
**DomainTarget** = `"smartlinks" | "hub"`
|
|
3671
|
+
|
|
3660
3672
|
### common
|
|
3661
3673
|
|
|
3662
3674
|
**IdField** = `'userId' | 'contactId'`
|
|
@@ -5027,6 +5039,7 @@ interface FacetDefinition {
|
|
|
5027
5039
|
key: string
|
|
5028
5040
|
name: string
|
|
5029
5041
|
description?: string | null
|
|
5042
|
+
namespace?: string | null
|
|
5030
5043
|
cardinality?: "single" | "multi"
|
|
5031
5044
|
kind?: "system" | "custom"
|
|
5032
5045
|
hierarchical?: boolean
|
|
@@ -5075,6 +5088,7 @@ interface FacetDefinitionWriteInput {
|
|
|
5075
5088
|
key?: string
|
|
5076
5089
|
name: string
|
|
5077
5090
|
description?: string | null
|
|
5091
|
+
namespace?: string | null
|
|
5078
5092
|
cardinality?: "single" | "multi"
|
|
5079
5093
|
kind?: "system" | "custom"
|
|
5080
5094
|
hierarchical?: boolean
|
|
@@ -5132,6 +5146,7 @@ interface FacetQueryRequest {
|
|
|
5132
5146
|
facetKeys?: string[]
|
|
5133
5147
|
includeEmpty?: boolean
|
|
5134
5148
|
includeDeleted?: boolean
|
|
5149
|
+
namespace?: string | null
|
|
5135
5150
|
query?: ProductQueryRequest["query"] & {
|
|
5136
5151
|
facetEquals?: Record<string, JsonValue | JsonValue[]>
|
|
5137
5152
|
}
|
|
@@ -5170,6 +5185,7 @@ interface FacetListParams {
|
|
|
5170
5185
|
includeDeleted?: boolean
|
|
5171
5186
|
kind?: "system" | "custom"
|
|
5172
5187
|
reserved?: boolean
|
|
5188
|
+
namespace?: string
|
|
5173
5189
|
}
|
|
5174
5190
|
```
|
|
5175
5191
|
|
|
@@ -5177,6 +5193,14 @@ interface FacetListParams {
|
|
|
5177
5193
|
```typescript
|
|
5178
5194
|
interface PublicFacetListParams {
|
|
5179
5195
|
includeValues?: boolean
|
|
5196
|
+
namespace?: string
|
|
5197
|
+
}
|
|
5198
|
+
```
|
|
5199
|
+
|
|
5200
|
+
**FacetNamespaceListResponse** (interface)
|
|
5201
|
+
```typescript
|
|
5202
|
+
interface FacetNamespaceListResponse {
|
|
5203
|
+
namespaces: string[]
|
|
5180
5204
|
}
|
|
5181
5205
|
```
|
|
5182
5206
|
|
|
@@ -8604,6 +8628,24 @@ Retrieves all Collections.
|
|
|
8604
8628
|
**getShortId**(shortId: string) → `Promise<CollectionResponse>`
|
|
8605
8629
|
Retrieve a collection by its shortId (public endpoint).
|
|
8606
8630
|
|
|
8631
|
+
**getByHub**() → `Promise<CollectionResponse>`
|
|
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`).
|
|
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
|
+
|
|
8637
|
+
**checkHubAvailability**(collectionId: string, name: string) → `Promise<HubAvailabilityResponse>`
|
|
8638
|
+
Check whether a Hub subdomain name is available to claim (admin only).
|
|
8639
|
+
|
|
8640
|
+
**claimHub**(collectionId: string, hubName: string) → `Promise<CollectionResponse>`
|
|
8641
|
+
Claim or rename the Hub subdomain for a collection (admin only). Maps `{hubName}.mysmartlinks.app` to the collection. If the collection already had a different hub name, the previous subdomain is released automatically.
|
|
8642
|
+
|
|
8643
|
+
**registerDomain**(collectionId: string, domain: string, target: DomainTarget = "smartlinks") → `Promise<any>`
|
|
8644
|
+
Register a custom domain for a collection and provision its managed certificate (admin only). `"smartlinks"` (the id.smartlinks.app load balancer). Pass `"hub"` to register a bring-your-own Hub domain.
|
|
8645
|
+
|
|
8646
|
+
**getDomainStatus**(collectionId: string, target: DomainTarget = "smartlinks") → `Promise<any>`
|
|
8647
|
+
Get the managed-certificate status for a collection's custom domain (admin only). or `"hub"` (uses `hubCustomDomain`)
|
|
8648
|
+
|
|
8607
8649
|
**getSettings**(collectionId: string, settingGroup: string, admin?: boolean) → `Promise<any>`
|
|
8608
8650
|
Retrieve a specific settings group for a collection. Public reads return the public view of the settings group. If the stored payload contains a top-level `admin` object, that block is omitted from public responses and included when `admin === true`.
|
|
8609
8651
|
|
|
@@ -8915,6 +8957,8 @@ Delete a crate for a collection (admin only). This performs a soft delete. ```ty
|
|
|
8915
8957
|
**query**(collectionId: string,
|
|
8916
8958
|
body: FacetQueryRequest) → `Promise<FacetQueryResponse>`
|
|
8917
8959
|
|
|
8960
|
+
**namespaces**(collectionId: string) → `Promise<FacetNamespaceListResponse>`
|
|
8961
|
+
|
|
8918
8962
|
**publicList**(collectionId: string,
|
|
8919
8963
|
params?: PublicFacetListParams) → `Promise<FacetListResponse>`
|
|
8920
8964
|
|
|
@@ -8932,6 +8976,8 @@ Delete a crate for a collection (admin only). This performs a soft delete. ```ty
|
|
|
8932
8976
|
**publicQuery**(collectionId: string,
|
|
8933
8977
|
body: FacetQueryRequest) → `Promise<FacetQueryResponse>`
|
|
8934
8978
|
|
|
8979
|
+
**publicNamespaces**(collectionId: string) → `Promise<FacetNamespaceListResponse>`
|
|
8980
|
+
|
|
8935
8981
|
### form
|
|
8936
8982
|
|
|
8937
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/http.js
CHANGED
|
@@ -91,7 +91,9 @@ const CACHE_TTL_RULES = [
|
|
|
91
91
|
// Sub-resources that change frequently — short TTLs, listed first
|
|
92
92
|
{ pattern: /\/proof\/[^/]*(\?.*)?$/i, ttlMs: 30000 },
|
|
93
93
|
{ pattern: /\/attestation\/[^/]*(\?.*)?$/i, ttlMs: 2 * 60000 },
|
|
94
|
-
// Slow-changing top-level resources — long TTLs, matched only when path ends at the ID
|
|
94
|
+
// Slow-changing top-level resources — long TTLs, matched only when path ends at the ID.
|
|
95
|
+
// getByHub maps a stable Hub domain → collection and matches the /collection rule below,
|
|
96
|
+
// so it inherits the same 1h caching as a collection detail.
|
|
95
97
|
{ pattern: /\/products?\/[^/]*(\?.*)?$/i, ttlMs: 60 * 60000 },
|
|
96
98
|
{ pattern: /\/variant\/[^/]*(\?.*)?$/i, ttlMs: 60 * 60000 },
|
|
97
99
|
{ pattern: /\/collection\/[^/]*(\?.*)?$/i, ttlMs: 60 * 60000 }, // 1 hour
|
package/dist/index.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ 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";
|
|
19
|
-
export type { Collection, CollectionResponse, CollectionCreateRequest, CollectionUpdateRequest, } from "./types/collection";
|
|
18
|
+
export type { FacetBucket, FacetDefinition, FacetDefinitionWriteInput, FacetGetParams, FacetListParams, FacetListResponse, FacetNamespaceListResponse, FacetQueryRequest, FacetQueryResponse, FacetValue, FacetValueDefinition, FacetValueGetParams, FacetValueListParams, FacetValueListResponse, FacetValueResponse, FacetValueWriteInput, PublicFacetListParams, } from "./types/facets";
|
|
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";
|
|
22
22
|
export type { ReverseTagLookupParams, ReverseTagLookupResponse, } from "./types/tags";
|