@naturali/sdk 0.40.1 → 0.41.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 +123 -0
- package/dist/index.d.cts +569 -1
- package/dist/index.d.mts +569 -1
- package/dist/index.mjs +123 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1832,6 +1832,126 @@ var Traces = class {
|
|
|
1832
1832
|
});
|
|
1833
1833
|
}
|
|
1834
1834
|
};
|
|
1835
|
+
var Webhooks = class {
|
|
1836
|
+
/**
|
|
1837
|
+
* List webhooks
|
|
1838
|
+
*
|
|
1839
|
+
* The endpoints registered in the project, newest first.
|
|
1840
|
+
*/
|
|
1841
|
+
static listWebhooks(options) {
|
|
1842
|
+
return (options.client ?? client).get({
|
|
1843
|
+
url: "/v1/projects/{project_id}/webhooks",
|
|
1844
|
+
...options
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
/**
|
|
1848
|
+
* Create a webhook
|
|
1849
|
+
*
|
|
1850
|
+
* Register an endpoint and subscribe it to one or more event types.
|
|
1851
|
+
* The response carries `secret` — the signing key, in plaintext. **This is the only time it is returned.** Store it where your receiver can read it; if you lose it, rotate rather than re-create, so the endpoint keeps its delivery history.
|
|
1852
|
+
* Returns `501` on a deployment with no credential-sealing key configured, since the secret could not then be stored safely.
|
|
1853
|
+
*
|
|
1854
|
+
*/
|
|
1855
|
+
static createWebhook(options) {
|
|
1856
|
+
return (options.client ?? client).post({
|
|
1857
|
+
url: "/v1/projects/{project_id}/webhooks",
|
|
1858
|
+
...options,
|
|
1859
|
+
headers: {
|
|
1860
|
+
"Content-Type": "application/json",
|
|
1861
|
+
...options.headers
|
|
1862
|
+
}
|
|
1863
|
+
});
|
|
1864
|
+
}
|
|
1865
|
+
/**
|
|
1866
|
+
* Delete a webhook
|
|
1867
|
+
*
|
|
1868
|
+
* Removes the endpoint and its delivery records. To stop deliveries while keeping the audit trail, `PATCH` it to `active: false` instead.
|
|
1869
|
+
*
|
|
1870
|
+
*/
|
|
1871
|
+
static deleteWebhook(options) {
|
|
1872
|
+
return (options.client ?? client).delete({
|
|
1873
|
+
url: "/v1/projects/{project_id}/webhooks/{webhook_id}",
|
|
1874
|
+
...options
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1877
|
+
/**
|
|
1878
|
+
* Get a webhook
|
|
1879
|
+
*/
|
|
1880
|
+
static getWebhook(options) {
|
|
1881
|
+
return (options.client ?? client).get({
|
|
1882
|
+
url: "/v1/projects/{project_id}/webhooks/{webhook_id}",
|
|
1883
|
+
...options
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* Update a webhook
|
|
1888
|
+
*
|
|
1889
|
+
* Change the destination, the subscription, the label, or whether deliveries are attempted at all. At least one field is required.
|
|
1890
|
+
* Setting `active: false` is the reversible half of `DELETE`: deliveries stop, the endpoint and its history stay. It is what to reach for while a receiver is being repaired.
|
|
1891
|
+
*
|
|
1892
|
+
*/
|
|
1893
|
+
static updateWebhook(options) {
|
|
1894
|
+
return (options.client ?? client).patch({
|
|
1895
|
+
url: "/v1/projects/{project_id}/webhooks/{webhook_id}",
|
|
1896
|
+
...options,
|
|
1897
|
+
headers: {
|
|
1898
|
+
"Content-Type": "application/json",
|
|
1899
|
+
...options.headers
|
|
1900
|
+
}
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1903
|
+
/**
|
|
1904
|
+
* Rotate the signing secret
|
|
1905
|
+
*
|
|
1906
|
+
* Issues a new signing secret for the same endpoint and returns it — the second and last time a secret is ever returned. This is the `…:rotate-secret` action; the path segment is `{webhook_id}:rotate-secret`.
|
|
1907
|
+
* The change takes effect on the next delivery, including retries of deliveries already queued, so roll the new secret out to your receiver promptly. There is no overlap window in which both secrets verify.
|
|
1908
|
+
*
|
|
1909
|
+
*/
|
|
1910
|
+
static rotateWebhookSecret(options) {
|
|
1911
|
+
return (options.client ?? client).post({
|
|
1912
|
+
url: "/v1/projects/{project_id}/webhooks/{webhook_id}:rotate-secret",
|
|
1913
|
+
...options
|
|
1914
|
+
});
|
|
1915
|
+
}
|
|
1916
|
+
/**
|
|
1917
|
+
* List webhook deliveries
|
|
1918
|
+
*
|
|
1919
|
+
* Every delivery attempted in the project, newest first — what was sent, where, how many times, and what came back. Filter by endpoint, by lifecycle status, or by event type.
|
|
1920
|
+
* Deliveries are per (event, endpoint): an event matching two subscribed endpoints produces two rows, retried and observed independently.
|
|
1921
|
+
*
|
|
1922
|
+
*/
|
|
1923
|
+
static listWebhookDeliveries(options) {
|
|
1924
|
+
return (options.client ?? client).get({
|
|
1925
|
+
url: "/v1/projects/{project_id}/webhook-deliveries",
|
|
1926
|
+
...options
|
|
1927
|
+
});
|
|
1928
|
+
}
|
|
1929
|
+
/**
|
|
1930
|
+
* Get a webhook delivery
|
|
1931
|
+
*
|
|
1932
|
+
* One delivery, including the exact payload that was signed and sent.
|
|
1933
|
+
*
|
|
1934
|
+
*/
|
|
1935
|
+
static getWebhookDelivery(options) {
|
|
1936
|
+
return (options.client ?? client).get({
|
|
1937
|
+
url: "/v1/projects/{project_id}/webhook-deliveries/{delivery_id}",
|
|
1938
|
+
...options
|
|
1939
|
+
});
|
|
1940
|
+
}
|
|
1941
|
+
/**
|
|
1942
|
+
* Redeliver an event
|
|
1943
|
+
*
|
|
1944
|
+
* Queue the same event at the same endpoint again — the recovery path for a delivery that failed, or one your receiver dropped. This is the `…:redeliver` action; the path segment is `{delivery_id}:redeliver`.
|
|
1945
|
+
* A **new** delivery is created and returned; the original record is left untouched, because its attempt history is the evidence you redelivered on. The event's `id` is carried over unchanged, so a receiver deduping on the event sees the same event twice while one deduping on `X-Naturali-Delivery` sees a distinct delivery.
|
|
1946
|
+
*
|
|
1947
|
+
*/
|
|
1948
|
+
static redeliverWebhookDelivery(options) {
|
|
1949
|
+
return (options.client ?? client).post({
|
|
1950
|
+
url: "/v1/projects/{project_id}/webhook-deliveries/{delivery_id}:redeliver",
|
|
1951
|
+
...options
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1954
|
+
};
|
|
1835
1955
|
//#endregion
|
|
1836
1956
|
//#region src/naturaliClient.ts
|
|
1837
1957
|
/**
|
|
@@ -1894,6 +2014,7 @@ var NaturaliClient = class {
|
|
|
1894
2014
|
tasks;
|
|
1895
2015
|
tools;
|
|
1896
2016
|
traces;
|
|
2017
|
+
webhooks;
|
|
1897
2018
|
/** The underlying HTTP client, for interceptors or one-off requests. */
|
|
1898
2019
|
http;
|
|
1899
2020
|
constructor({ token, headers } = {}) {
|
|
@@ -1919,7 +2040,8 @@ var NaturaliClient = class {
|
|
|
1919
2040
|
this.tasks = bindResource(Tasks, this.http);
|
|
1920
2041
|
this.tools = bindResource(Tools, this.http);
|
|
1921
2042
|
this.traces = bindResource(Traces, this.http);
|
|
2043
|
+
this.webhooks = bindResource(Webhooks, this.http);
|
|
1922
2044
|
}
|
|
1923
2045
|
};
|
|
1924
2046
|
//#endregion
|
|
1925
|
-
export { Agents, ApiKeys, Auth, Boards, Channels, Contacts, Generations, Knowledge, Models, NaturaliClient, Projects, Providers, Sessions, Tasks, Tools, Traces, createClient, createConfig };
|
|
2047
|
+
export { Agents, ApiKeys, Auth, Boards, Channels, Contacts, Generations, Knowledge, Models, NaturaliClient, Projects, Providers, Sessions, Tasks, Tools, Traces, Webhooks, createClient, createConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturali/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "TypeScript SDK for the naturali.ai API, generated from its OpenAPI specs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"tsx": "^4.23.1",
|
|
38
38
|
"typescript": "~6.0.3",
|
|
39
39
|
"vitest": "^4.1.10",
|
|
40
|
-
"@naturali/api": "0.
|
|
40
|
+
"@naturali/api": "0.41.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"generate": "tsx scripts/generate.ts",
|