@slotchain/sdk 1.4.0 → 1.6.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/index.cjs.js +46 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +91 -2
- package/dist/index.d.ts +91 -2
- package/dist/index.esm.js +46 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/clients/notices-client.ts +52 -0
- package/src/clients/tenant-client.ts +17 -1
- package/src/index.ts +8 -0
- package/src/types/api.ts +68 -1
package/dist/index.cjs.js
CHANGED
|
@@ -198,7 +198,16 @@ var TenantClient = class {
|
|
|
198
198
|
`/api/v1/tenants/${slug}`,
|
|
199
199
|
{ params: { includeServices } }
|
|
200
200
|
);
|
|
201
|
-
|
|
201
|
+
const data = response.data;
|
|
202
|
+
if (data?.data?.services) {
|
|
203
|
+
data.data.services = data.data.services.filter((s) => !s.deleted_at).map((s) => ({
|
|
204
|
+
...s,
|
|
205
|
+
serviceItems: (s.serviceItems ?? []).filter(
|
|
206
|
+
(item) => !item.deleted_at && !item.withdrawn_at
|
|
207
|
+
)
|
|
208
|
+
}));
|
|
209
|
+
}
|
|
210
|
+
return data;
|
|
202
211
|
}
|
|
203
212
|
};
|
|
204
213
|
|
|
@@ -1594,6 +1603,40 @@ var DocumentClient = class {
|
|
|
1594
1603
|
}
|
|
1595
1604
|
};
|
|
1596
1605
|
|
|
1606
|
+
// src/clients/notices-client.ts
|
|
1607
|
+
var NoticesClient = class {
|
|
1608
|
+
constructor(client) {
|
|
1609
|
+
this.base = "/api/v1/notices";
|
|
1610
|
+
this.client = client;
|
|
1611
|
+
}
|
|
1612
|
+
/**
|
|
1613
|
+
* List active notices for a tenant.
|
|
1614
|
+
* Returns only notices where visible_until > activeAt (default: now).
|
|
1615
|
+
*/
|
|
1616
|
+
async list(options) {
|
|
1617
|
+
const response = await this.client.get(this.base, {
|
|
1618
|
+
params: {
|
|
1619
|
+
tenant_id: options.tenantId,
|
|
1620
|
+
active_at: options.activeAt,
|
|
1621
|
+
slot_id: options.slotId,
|
|
1622
|
+
types: options.types?.join(",")
|
|
1623
|
+
}
|
|
1624
|
+
});
|
|
1625
|
+
return response.data;
|
|
1626
|
+
}
|
|
1627
|
+
/**
|
|
1628
|
+
* Get a single notice by its slot_moment id.
|
|
1629
|
+
*/
|
|
1630
|
+
async getById(id, tenantId) {
|
|
1631
|
+
const response = await this.client.get(`${this.base}/${id}`, {
|
|
1632
|
+
params: { tenant_id: tenantId }
|
|
1633
|
+
});
|
|
1634
|
+
const { data } = response.data;
|
|
1635
|
+
if (!data) throw new Error(`Notice ${id} not found`);
|
|
1636
|
+
return data;
|
|
1637
|
+
}
|
|
1638
|
+
};
|
|
1639
|
+
|
|
1597
1640
|
// src/errors.ts
|
|
1598
1641
|
var SlotlyApiError = class _SlotlyApiError extends Error {
|
|
1599
1642
|
constructor(code, message, statusCode, details) {
|
|
@@ -1927,7 +1970,8 @@ var useSlotly = (options) => {
|
|
|
1927
1970
|
notification: new NotificationClient(client),
|
|
1928
1971
|
dataQuality: new DataQualityClient(client),
|
|
1929
1972
|
organization: new OrganizationClient(client),
|
|
1930
|
-
document: new DocumentClient(client)
|
|
1973
|
+
document: new DocumentClient(client),
|
|
1974
|
+
notices: new NoticesClient(client)
|
|
1931
1975
|
};
|
|
1932
1976
|
};
|
|
1933
1977
|
var index_default = useSlotly;
|