@naturali/cli 0.40.0 → 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.
Files changed (2) hide show
  1. package/dist/index.mjs +424 -1
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -14,7 +14,7 @@ var __exportAll = (all, no_symbols) => {
14
14
  };
15
15
  //#endregion
16
16
  //#region package.json
17
- var version = "0.40.0";
17
+ var version = "0.41.0";
18
18
  //#endregion
19
19
  //#region ../sdk/src/generated/core/bodySerializer.gen.ts
20
20
  const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
@@ -1850,6 +1850,126 @@ var Traces = class {
1850
1850
  });
1851
1851
  }
1852
1852
  };
1853
+ var Webhooks = class {
1854
+ /**
1855
+ * List webhooks
1856
+ *
1857
+ * The endpoints registered in the project, newest first.
1858
+ */
1859
+ static listWebhooks(options) {
1860
+ return (options.client ?? client).get({
1861
+ url: "/v1/projects/{project_id}/webhooks",
1862
+ ...options
1863
+ });
1864
+ }
1865
+ /**
1866
+ * Create a webhook
1867
+ *
1868
+ * Register an endpoint and subscribe it to one or more event types.
1869
+ * 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.
1870
+ * Returns `501` on a deployment with no credential-sealing key configured, since the secret could not then be stored safely.
1871
+ *
1872
+ */
1873
+ static createWebhook(options) {
1874
+ return (options.client ?? client).post({
1875
+ url: "/v1/projects/{project_id}/webhooks",
1876
+ ...options,
1877
+ headers: {
1878
+ "Content-Type": "application/json",
1879
+ ...options.headers
1880
+ }
1881
+ });
1882
+ }
1883
+ /**
1884
+ * Delete a webhook
1885
+ *
1886
+ * Removes the endpoint and its delivery records. To stop deliveries while keeping the audit trail, `PATCH` it to `active: false` instead.
1887
+ *
1888
+ */
1889
+ static deleteWebhook(options) {
1890
+ return (options.client ?? client).delete({
1891
+ url: "/v1/projects/{project_id}/webhooks/{webhook_id}",
1892
+ ...options
1893
+ });
1894
+ }
1895
+ /**
1896
+ * Get a webhook
1897
+ */
1898
+ static getWebhook(options) {
1899
+ return (options.client ?? client).get({
1900
+ url: "/v1/projects/{project_id}/webhooks/{webhook_id}",
1901
+ ...options
1902
+ });
1903
+ }
1904
+ /**
1905
+ * Update a webhook
1906
+ *
1907
+ * Change the destination, the subscription, the label, or whether deliveries are attempted at all. At least one field is required.
1908
+ * 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.
1909
+ *
1910
+ */
1911
+ static updateWebhook(options) {
1912
+ return (options.client ?? client).patch({
1913
+ url: "/v1/projects/{project_id}/webhooks/{webhook_id}",
1914
+ ...options,
1915
+ headers: {
1916
+ "Content-Type": "application/json",
1917
+ ...options.headers
1918
+ }
1919
+ });
1920
+ }
1921
+ /**
1922
+ * Rotate the signing secret
1923
+ *
1924
+ * 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`.
1925
+ * 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.
1926
+ *
1927
+ */
1928
+ static rotateWebhookSecret(options) {
1929
+ return (options.client ?? client).post({
1930
+ url: "/v1/projects/{project_id}/webhooks/{webhook_id}:rotate-secret",
1931
+ ...options
1932
+ });
1933
+ }
1934
+ /**
1935
+ * List webhook deliveries
1936
+ *
1937
+ * 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.
1938
+ * Deliveries are per (event, endpoint): an event matching two subscribed endpoints produces two rows, retried and observed independently.
1939
+ *
1940
+ */
1941
+ static listWebhookDeliveries(options) {
1942
+ return (options.client ?? client).get({
1943
+ url: "/v1/projects/{project_id}/webhook-deliveries",
1944
+ ...options
1945
+ });
1946
+ }
1947
+ /**
1948
+ * Get a webhook delivery
1949
+ *
1950
+ * One delivery, including the exact payload that was signed and sent.
1951
+ *
1952
+ */
1953
+ static getWebhookDelivery(options) {
1954
+ return (options.client ?? client).get({
1955
+ url: "/v1/projects/{project_id}/webhook-deliveries/{delivery_id}",
1956
+ ...options
1957
+ });
1958
+ }
1959
+ /**
1960
+ * Redeliver an event
1961
+ *
1962
+ * 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`.
1963
+ * 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.
1964
+ *
1965
+ */
1966
+ static redeliverWebhookDelivery(options) {
1967
+ return (options.client ?? client).post({
1968
+ url: "/v1/projects/{project_id}/webhook-deliveries/{delivery_id}:redeliver",
1969
+ ...options
1970
+ });
1971
+ }
1972
+ };
1853
1973
  //#endregion
1854
1974
  //#region ../sdk/src/naturaliClient.ts
1855
1975
  /**
@@ -1912,6 +2032,7 @@ var NaturaliClient = class {
1912
2032
  tasks;
1913
2033
  tools;
1914
2034
  traces;
2035
+ webhooks;
1915
2036
  /** The underlying HTTP client, for interceptors or one-off requests. */
1916
2037
  http;
1917
2038
  constructor({ token, headers } = {}) {
@@ -1937,6 +2058,7 @@ var NaturaliClient = class {
1937
2058
  this.tasks = bindResource(Tasks, this.http);
1938
2059
  this.tools = bindResource(Tools, this.http);
1939
2060
  this.traces = bindResource(Traces, this.http);
2061
+ this.webhooks = bindResource(Webhooks, this.http);
1940
2062
  }
1941
2063
  };
1942
2064
  //#endregion
@@ -1958,6 +2080,7 @@ var src_exports = /* @__PURE__ */ __exportAll({
1958
2080
  Tasks: () => Tasks,
1959
2081
  Tools: () => Tools,
1960
2082
  Traces: () => Traces,
2083
+ Webhooks: () => Webhooks,
1961
2084
  createClient: () => createClient,
1962
2085
  createConfig: () => createConfig
1963
2086
  });
@@ -5747,6 +5870,306 @@ const routes = {
5747
5870
  "in": "query"
5748
5871
  }
5749
5872
  ]
5873
+ },
5874
+ "list-webhooks": {
5875
+ serviceClass: "Webhooks",
5876
+ operationId: "listWebhooks",
5877
+ description: "The endpoints registered in the project, newest first.",
5878
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/webhooks",
5879
+ httpMethod: "get",
5880
+ pathParams: ["project_id"],
5881
+ queryParams: ["limit", "cursor"],
5882
+ flags: [
5883
+ {
5884
+ "name": "project_id",
5885
+ "description": "Project public ID (proj_ prefix).",
5886
+ "required": true,
5887
+ "type": "string",
5888
+ "in": "path"
5889
+ },
5890
+ {
5891
+ "name": "limit",
5892
+ "description": "Maximum items per page.",
5893
+ "required": false,
5894
+ "type": "integer",
5895
+ "in": "query"
5896
+ },
5897
+ {
5898
+ "name": "cursor",
5899
+ "description": "Opaque pagination cursor from a previous response's next_cursor.",
5900
+ "required": false,
5901
+ "type": "string",
5902
+ "in": "query"
5903
+ }
5904
+ ]
5905
+ },
5906
+ "create-webhook": {
5907
+ serviceClass: "Webhooks",
5908
+ operationId: "createWebhook",
5909
+ description: "Register an endpoint and subscribe it to one or more event types. 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. Returns `501` on a deployment with no credential-sealing key configured, since the secret could not then be stored safely.",
5910
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/webhooks",
5911
+ httpMethod: "post",
5912
+ pathParams: ["project_id"],
5913
+ queryParams: [],
5914
+ flags: [
5915
+ {
5916
+ "name": "project_id",
5917
+ "description": "Project public ID (proj_ prefix).",
5918
+ "required": true,
5919
+ "type": "string",
5920
+ "in": "path"
5921
+ },
5922
+ {
5923
+ "name": "url",
5924
+ "description": "An `https://` endpoint (`http://` is accepted for localhost, so a tunnel works in development).\n",
5925
+ "required": true,
5926
+ "type": "string",
5927
+ "in": "body"
5928
+ },
5929
+ {
5930
+ "name": "events",
5931
+ "description": "Which events this endpoint receives. Each entry is an exact type (`task.created`), a resource wildcard (`task.*`), or `*` for everything. A bare resource name (`task`) matches nothing and is rejected.\n",
5932
+ "required": true,
5933
+ "type": "array",
5934
+ "in": "body"
5935
+ },
5936
+ {
5937
+ "name": "description",
5938
+ "description": "",
5939
+ "required": false,
5940
+ "type": "string",
5941
+ "in": "body"
5942
+ },
5943
+ {
5944
+ "name": "active",
5945
+ "description": "",
5946
+ "required": false,
5947
+ "type": "boolean",
5948
+ "in": "body"
5949
+ }
5950
+ ]
5951
+ },
5952
+ "get-webhook": {
5953
+ serviceClass: "Webhooks",
5954
+ operationId: "getWebhook",
5955
+ description: "Get a webhook",
5956
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/webhooks",
5957
+ httpMethod: "get",
5958
+ pathParams: ["project_id", "webhook_id"],
5959
+ queryParams: [],
5960
+ flags: [{
5961
+ "name": "project_id",
5962
+ "description": "Project public ID (proj_ prefix).",
5963
+ "required": true,
5964
+ "type": "string",
5965
+ "in": "path"
5966
+ }, {
5967
+ "name": "webhook_id",
5968
+ "description": "Webhook public ID (whk_ prefix).",
5969
+ "required": true,
5970
+ "type": "string",
5971
+ "in": "path"
5972
+ }]
5973
+ },
5974
+ "update-webhook": {
5975
+ serviceClass: "Webhooks",
5976
+ operationId: "updateWebhook",
5977
+ description: "Change the destination, the subscription, the label, or whether deliveries are attempted at all. At least one field is required. 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.",
5978
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/webhooks",
5979
+ httpMethod: "patch",
5980
+ pathParams: ["project_id", "webhook_id"],
5981
+ queryParams: [],
5982
+ flags: [
5983
+ {
5984
+ "name": "project_id",
5985
+ "description": "Project public ID (proj_ prefix).",
5986
+ "required": true,
5987
+ "type": "string",
5988
+ "in": "path"
5989
+ },
5990
+ {
5991
+ "name": "webhook_id",
5992
+ "description": "Webhook public ID (whk_ prefix).",
5993
+ "required": true,
5994
+ "type": "string",
5995
+ "in": "path"
5996
+ },
5997
+ {
5998
+ "name": "url",
5999
+ "description": "",
6000
+ "required": false,
6001
+ "type": "string",
6002
+ "in": "body"
6003
+ },
6004
+ {
6005
+ "name": "events",
6006
+ "description": "Which events this endpoint receives. Each entry is an exact type (`task.created`), a resource wildcard (`task.*`), or `*` for everything. A bare resource name (`task`) matches nothing and is rejected.\n",
6007
+ "required": false,
6008
+ "type": "array",
6009
+ "in": "body"
6010
+ },
6011
+ {
6012
+ "name": "description",
6013
+ "description": "",
6014
+ "required": false,
6015
+ "type": "string",
6016
+ "in": "body"
6017
+ },
6018
+ {
6019
+ "name": "active",
6020
+ "description": "",
6021
+ "required": false,
6022
+ "type": "boolean",
6023
+ "in": "body"
6024
+ }
6025
+ ]
6026
+ },
6027
+ "delete-webhook": {
6028
+ serviceClass: "Webhooks",
6029
+ operationId: "deleteWebhook",
6030
+ description: "Removes the endpoint and its delivery records. To stop deliveries while keeping the audit trail, `PATCH` it to `active: false` instead.",
6031
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/webhooks",
6032
+ httpMethod: "delete",
6033
+ pathParams: ["project_id", "webhook_id"],
6034
+ queryParams: [],
6035
+ flags: [{
6036
+ "name": "project_id",
6037
+ "description": "Project public ID (proj_ prefix).",
6038
+ "required": true,
6039
+ "type": "string",
6040
+ "in": "path"
6041
+ }, {
6042
+ "name": "webhook_id",
6043
+ "description": "Webhook public ID (whk_ prefix).",
6044
+ "required": true,
6045
+ "type": "string",
6046
+ "in": "path"
6047
+ }]
6048
+ },
6049
+ "rotate-webhook-secret": {
6050
+ serviceClass: "Webhooks",
6051
+ operationId: "rotateWebhookSecret",
6052
+ description: "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`. 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.",
6053
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/webhooks",
6054
+ httpMethod: "post",
6055
+ pathParams: ["project_id", "webhook_id"],
6056
+ queryParams: [],
6057
+ flags: [{
6058
+ "name": "project_id",
6059
+ "description": "Project public ID (proj_ prefix).",
6060
+ "required": true,
6061
+ "type": "string",
6062
+ "in": "path"
6063
+ }, {
6064
+ "name": "webhook_id",
6065
+ "description": "Webhook public ID (whk_ prefix).",
6066
+ "required": true,
6067
+ "type": "string",
6068
+ "in": "path"
6069
+ }]
6070
+ },
6071
+ "list-webhook-deliveries": {
6072
+ serviceClass: "Webhooks",
6073
+ operationId: "listWebhookDeliveries",
6074
+ description: "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. Deliveries are per (event, endpoint): an event matching two subscribed endpoints produces two rows, retried and observed independently.",
6075
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/webhooks",
6076
+ httpMethod: "get",
6077
+ pathParams: ["project_id"],
6078
+ queryParams: [
6079
+ "limit",
6080
+ "cursor",
6081
+ "webhook_id",
6082
+ "status",
6083
+ "event_type"
6084
+ ],
6085
+ flags: [
6086
+ {
6087
+ "name": "project_id",
6088
+ "description": "Project public ID (proj_ prefix).",
6089
+ "required": true,
6090
+ "type": "string",
6091
+ "in": "path"
6092
+ },
6093
+ {
6094
+ "name": "limit",
6095
+ "description": "Maximum items per page.",
6096
+ "required": false,
6097
+ "type": "integer",
6098
+ "in": "query"
6099
+ },
6100
+ {
6101
+ "name": "cursor",
6102
+ "description": "Opaque pagination cursor from a previous response's next_cursor.",
6103
+ "required": false,
6104
+ "type": "string",
6105
+ "in": "query"
6106
+ },
6107
+ {
6108
+ "name": "webhook_id",
6109
+ "description": "Only deliveries addressed to this endpoint.",
6110
+ "required": false,
6111
+ "type": "string",
6112
+ "in": "query"
6113
+ },
6114
+ {
6115
+ "name": "status",
6116
+ "description": "Only deliveries in this state.",
6117
+ "required": false,
6118
+ "type": "string",
6119
+ "in": "query"
6120
+ },
6121
+ {
6122
+ "name": "event_type",
6123
+ "description": "Only deliveries of this event type.",
6124
+ "required": false,
6125
+ "type": "string",
6126
+ "in": "query"
6127
+ }
6128
+ ]
6129
+ },
6130
+ "get-webhook-delivery": {
6131
+ serviceClass: "Webhooks",
6132
+ operationId: "getWebhookDelivery",
6133
+ description: "One delivery, including the exact payload that was signed and sent.",
6134
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/webhooks",
6135
+ httpMethod: "get",
6136
+ pathParams: ["project_id", "delivery_id"],
6137
+ queryParams: [],
6138
+ flags: [{
6139
+ "name": "project_id",
6140
+ "description": "Project public ID (proj_ prefix).",
6141
+ "required": true,
6142
+ "type": "string",
6143
+ "in": "path"
6144
+ }, {
6145
+ "name": "delivery_id",
6146
+ "description": "Delivery public ID (whd_ prefix).",
6147
+ "required": true,
6148
+ "type": "string",
6149
+ "in": "path"
6150
+ }]
6151
+ },
6152
+ "redeliver-webhook-delivery": {
6153
+ serviceClass: "Webhooks",
6154
+ operationId: "redeliverWebhookDelivery",
6155
+ description: "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`. 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.",
6156
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/webhooks",
6157
+ httpMethod: "post",
6158
+ pathParams: ["project_id", "delivery_id"],
6159
+ queryParams: [],
6160
+ flags: [{
6161
+ "name": "project_id",
6162
+ "description": "Project public ID (proj_ prefix).",
6163
+ "required": true,
6164
+ "type": "string",
6165
+ "in": "path"
6166
+ }, {
6167
+ "name": "delivery_id",
6168
+ "description": "Delivery public ID (whd_ prefix).",
6169
+ "required": true,
6170
+ "type": "string",
6171
+ "in": "path"
6172
+ }]
5750
6173
  }
5751
6174
  };
5752
6175
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/cli",
3
- "version": "0.40.0",
3
+ "version": "0.41.0",
4
4
  "description": "Command-line interface for the naturali.ai API, generated from its OpenAPI specs",
5
5
  "type": "module",
6
6
  "bin": {
@@ -30,7 +30,7 @@
30
30
  "tsx": "^4.23.1",
31
31
  "typescript": "~6.0.3",
32
32
  "vitest": "^4.1.10",
33
- "@naturali/sdk": "0.40.0"
33
+ "@naturali/sdk": "0.41.0"
34
34
  },
35
35
  "scripts": {
36
36
  "generate": "tsx scripts/generate.ts",