@distilled.cloud/cloudflare 0.17.0 → 0.18.1

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 (43) hide show
  1. package/lib/client/api.d.ts.map +1 -1
  2. package/lib/client/api.js +26 -8
  3. package/lib/client/api.js.map +1 -1
  4. package/lib/credentials.d.ts +5 -5
  5. package/lib/credentials.d.ts.map +1 -1
  6. package/lib/credentials.js.map +1 -1
  7. package/lib/errors.d.ts +17 -1
  8. package/lib/errors.d.ts.map +1 -1
  9. package/lib/errors.js +15 -0
  10. package/lib/errors.js.map +1 -1
  11. package/lib/services/aisearch.d.ts +41 -41
  12. package/lib/services/aisearch.d.ts.map +1 -1
  13. package/lib/services/aisearch.js +41 -41
  14. package/lib/services/aisearch.js.map +1 -1
  15. package/lib/services/email-sending.d.ts +204 -0
  16. package/lib/services/email-sending.d.ts.map +1 -0
  17. package/lib/services/email-sending.js +309 -0
  18. package/lib/services/email-sending.js.map +1 -0
  19. package/lib/services/fraud.d.ts +77 -0
  20. package/lib/services/fraud.d.ts.map +1 -0
  21. package/lib/services/fraud.js +110 -0
  22. package/lib/services/fraud.js.map +1 -0
  23. package/lib/services/google-tag-gateway.d.ts +62 -0
  24. package/lib/services/google-tag-gateway.d.ts.map +1 -0
  25. package/lib/services/google-tag-gateway.js +52 -0
  26. package/lib/services/google-tag-gateway.js.map +1 -0
  27. package/lib/services/queues.d.ts.map +1 -1
  28. package/lib/services/queues.js +5 -1
  29. package/lib/services/queues.js.map +1 -1
  30. package/lib/services/workflows.d.ts +1 -1
  31. package/lib/services/workflows.d.ts.map +1 -1
  32. package/lib/services/workflows.js +1 -1
  33. package/lib/services/workflows.js.map +1 -1
  34. package/package.json +2 -2
  35. package/src/client/api.ts +29 -7
  36. package/src/credentials.ts +13 -13
  37. package/src/errors.ts +19 -0
  38. package/src/services/aisearch.ts +96 -82
  39. package/src/services/email-sending.ts +675 -0
  40. package/src/services/fraud.ts +252 -0
  41. package/src/services/google-tag-gateway.ts +132 -0
  42. package/src/services/queues.ts +5 -1
  43. package/src/services/workflows.ts +2 -2
@@ -0,0 +1,252 @@
1
+ /**
2
+ * Cloudflare FRAUD API
3
+ *
4
+ * Generated from Cloudflare TypeScript SDK.
5
+ * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service fraud
6
+ */
7
+
8
+ import * as Schema from "effect/Schema";
9
+ import type * as HttpClient from "effect/unstable/http/HttpClient";
10
+ import * as API from "../client/api.ts";
11
+ import * as T from "../traits.ts";
12
+ import type { Credentials } from "../credentials.ts";
13
+ import { type DefaultErrors } from "../errors.ts";
14
+
15
+ // =============================================================================
16
+ // Fraud
17
+ // =============================================================================
18
+
19
+ export interface GetFraudRequest {
20
+ /** Identifier. */
21
+ zoneId: string;
22
+ }
23
+
24
+ export const GetFraudRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
25
+ zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
26
+ }).pipe(
27
+ T.Http({ method: "GET", path: "/zones/{zone_id}/fraud_detection/settings" }),
28
+ ) as unknown as Schema.Schema<GetFraudRequest>;
29
+
30
+ export interface GetFraudResponse {
31
+ /** Configuration for classifying login authentication outcomes based on the origin response. Requires `user_profiles` to be enabled. - Success and failure criteria are independently updatable — sending */
32
+ authenticationSettings?: {
33
+ failureCriteria?: {
34
+ kind: "status_code";
35
+ statusCodes?: number[] | null;
36
+ } | null;
37
+ successCriteria?: {
38
+ kind: "status_code";
39
+ statusCodes?: number[] | null;
40
+ } | null;
41
+ } | null;
42
+ /** Whether Fraud User Profiles is enabled for the zone. */
43
+ userProfiles?: "enabled" | "disabled" | null;
44
+ /** List of expressions to detect usernames in write HTTP requests. - Maximum of 10 expressions. - Omit or set to null to leave unchanged on update. - Provide an empty array `[]` to clear all expressions */
45
+ usernameExpressions?: string[] | null;
46
+ }
47
+
48
+ export const GetFraudResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
49
+ authenticationSettings: Schema.optional(
50
+ Schema.Union([
51
+ Schema.Struct({
52
+ failureCriteria: Schema.optional(
53
+ Schema.Union([
54
+ Schema.Struct({
55
+ kind: Schema.Literal("status_code"),
56
+ statusCodes: Schema.optional(
57
+ Schema.Union([Schema.Array(Schema.Number), Schema.Null]),
58
+ ),
59
+ }).pipe(
60
+ Schema.encodeKeys({ kind: "kind", statusCodes: "status_codes" }),
61
+ ),
62
+ Schema.Null,
63
+ ]),
64
+ ),
65
+ successCriteria: Schema.optional(
66
+ Schema.Union([
67
+ Schema.Struct({
68
+ kind: Schema.Literal("status_code"),
69
+ statusCodes: Schema.optional(
70
+ Schema.Union([Schema.Array(Schema.Number), Schema.Null]),
71
+ ),
72
+ }).pipe(
73
+ Schema.encodeKeys({ kind: "kind", statusCodes: "status_codes" }),
74
+ ),
75
+ Schema.Null,
76
+ ]),
77
+ ),
78
+ }).pipe(
79
+ Schema.encodeKeys({
80
+ failureCriteria: "failure_criteria",
81
+ successCriteria: "success_criteria",
82
+ }),
83
+ ),
84
+ Schema.Null,
85
+ ]),
86
+ ),
87
+ userProfiles: Schema.optional(
88
+ Schema.Union([Schema.Literals(["enabled", "disabled"]), Schema.Null]),
89
+ ),
90
+ usernameExpressions: Schema.optional(
91
+ Schema.Union([Schema.Array(Schema.String), Schema.Null]),
92
+ ),
93
+ })
94
+ .pipe(
95
+ Schema.encodeKeys({
96
+ authenticationSettings: "authentication_settings",
97
+ userProfiles: "user_profiles",
98
+ usernameExpressions: "username_expressions",
99
+ }),
100
+ )
101
+ .pipe(T.ResponsePath("result")) as unknown as Schema.Schema<GetFraudResponse>;
102
+
103
+ export type GetFraudError = DefaultErrors;
104
+
105
+ export const getFraud: API.OperationMethod<
106
+ GetFraudRequest,
107
+ GetFraudResponse,
108
+ GetFraudError,
109
+ Credentials | HttpClient.HttpClient
110
+ > = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
111
+ input: GetFraudRequest,
112
+ output: GetFraudResponse,
113
+ errors: [],
114
+ }));
115
+
116
+ export interface PutFraudRequest {
117
+ /** Path param: Identifier. */
118
+ zoneId: string;
119
+ /** Body param: Configuration for classifying login authentication outcomes based on the origin response. Requires `user_profiles` to be enabled. - Success and failure criteria are independently updatabl */
120
+ authenticationSettings?: {
121
+ failureCriteria?: { kind: "status_code"; statusCodes?: number[] };
122
+ successCriteria?: { kind: "status_code"; statusCodes?: number[] };
123
+ };
124
+ /** Body param: Whether Fraud User Profiles is enabled for the zone. */
125
+ userProfiles?: "enabled" | "disabled";
126
+ /** Body param: List of expressions to detect usernames in write HTTP requests. - Maximum of 10 expressions. - Omit or set to null to leave unchanged on update. - Provide an empty array `[]` to clear all */
127
+ usernameExpressions?: string[];
128
+ }
129
+
130
+ export const PutFraudRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
131
+ zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
132
+ authenticationSettings: Schema.optional(
133
+ Schema.Struct({
134
+ failureCriteria: Schema.optional(
135
+ Schema.Struct({
136
+ kind: Schema.Literal("status_code"),
137
+ statusCodes: Schema.optional(Schema.Array(Schema.Number)),
138
+ }).pipe(
139
+ Schema.encodeKeys({ kind: "kind", statusCodes: "status_codes" }),
140
+ ),
141
+ ),
142
+ successCriteria: Schema.optional(
143
+ Schema.Struct({
144
+ kind: Schema.Literal("status_code"),
145
+ statusCodes: Schema.optional(Schema.Array(Schema.Number)),
146
+ }).pipe(
147
+ Schema.encodeKeys({ kind: "kind", statusCodes: "status_codes" }),
148
+ ),
149
+ ),
150
+ }).pipe(
151
+ Schema.encodeKeys({
152
+ failureCriteria: "failure_criteria",
153
+ successCriteria: "success_criteria",
154
+ }),
155
+ ),
156
+ ),
157
+ userProfiles: Schema.optional(Schema.Literals(["enabled", "disabled"])),
158
+ usernameExpressions: Schema.optional(Schema.Array(Schema.String)),
159
+ }).pipe(
160
+ Schema.encodeKeys({
161
+ authenticationSettings: "authentication_settings",
162
+ userProfiles: "user_profiles",
163
+ usernameExpressions: "username_expressions",
164
+ }),
165
+ T.Http({ method: "PUT", path: "/zones/{zone_id}/fraud_detection/settings" }),
166
+ ) as unknown as Schema.Schema<PutFraudRequest>;
167
+
168
+ export interface PutFraudResponse {
169
+ /** Configuration for classifying login authentication outcomes based on the origin response. Requires `user_profiles` to be enabled. - Success and failure criteria are independently updatable — sending */
170
+ authenticationSettings?: {
171
+ failureCriteria?: {
172
+ kind: "status_code";
173
+ statusCodes?: number[] | null;
174
+ } | null;
175
+ successCriteria?: {
176
+ kind: "status_code";
177
+ statusCodes?: number[] | null;
178
+ } | null;
179
+ } | null;
180
+ /** Whether Fraud User Profiles is enabled for the zone. */
181
+ userProfiles?: "enabled" | "disabled" | null;
182
+ /** List of expressions to detect usernames in write HTTP requests. - Maximum of 10 expressions. - Omit or set to null to leave unchanged on update. - Provide an empty array `[]` to clear all expressions */
183
+ usernameExpressions?: string[] | null;
184
+ }
185
+
186
+ export const PutFraudResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
187
+ authenticationSettings: Schema.optional(
188
+ Schema.Union([
189
+ Schema.Struct({
190
+ failureCriteria: Schema.optional(
191
+ Schema.Union([
192
+ Schema.Struct({
193
+ kind: Schema.Literal("status_code"),
194
+ statusCodes: Schema.optional(
195
+ Schema.Union([Schema.Array(Schema.Number), Schema.Null]),
196
+ ),
197
+ }).pipe(
198
+ Schema.encodeKeys({ kind: "kind", statusCodes: "status_codes" }),
199
+ ),
200
+ Schema.Null,
201
+ ]),
202
+ ),
203
+ successCriteria: Schema.optional(
204
+ Schema.Union([
205
+ Schema.Struct({
206
+ kind: Schema.Literal("status_code"),
207
+ statusCodes: Schema.optional(
208
+ Schema.Union([Schema.Array(Schema.Number), Schema.Null]),
209
+ ),
210
+ }).pipe(
211
+ Schema.encodeKeys({ kind: "kind", statusCodes: "status_codes" }),
212
+ ),
213
+ Schema.Null,
214
+ ]),
215
+ ),
216
+ }).pipe(
217
+ Schema.encodeKeys({
218
+ failureCriteria: "failure_criteria",
219
+ successCriteria: "success_criteria",
220
+ }),
221
+ ),
222
+ Schema.Null,
223
+ ]),
224
+ ),
225
+ userProfiles: Schema.optional(
226
+ Schema.Union([Schema.Literals(["enabled", "disabled"]), Schema.Null]),
227
+ ),
228
+ usernameExpressions: Schema.optional(
229
+ Schema.Union([Schema.Array(Schema.String), Schema.Null]),
230
+ ),
231
+ })
232
+ .pipe(
233
+ Schema.encodeKeys({
234
+ authenticationSettings: "authentication_settings",
235
+ userProfiles: "user_profiles",
236
+ usernameExpressions: "username_expressions",
237
+ }),
238
+ )
239
+ .pipe(T.ResponsePath("result")) as unknown as Schema.Schema<PutFraudResponse>;
240
+
241
+ export type PutFraudError = DefaultErrors;
242
+
243
+ export const putFraud: API.OperationMethod<
244
+ PutFraudRequest,
245
+ PutFraudResponse,
246
+ PutFraudError,
247
+ Credentials | HttpClient.HttpClient
248
+ > = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
249
+ input: PutFraudRequest,
250
+ output: PutFraudResponse,
251
+ errors: [],
252
+ }));
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Cloudflare GOOGLE-TAG-GATEWAY API
3
+ *
4
+ * Generated from Cloudflare TypeScript SDK.
5
+ * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service google-tag-gateway
6
+ */
7
+
8
+ import * as Schema from "effect/Schema";
9
+ import type * as HttpClient from "effect/unstable/http/HttpClient";
10
+ import * as API from "../client/api.ts";
11
+ import * as T from "../traits.ts";
12
+ import type { Credentials } from "../credentials.ts";
13
+ import { type DefaultErrors } from "../errors.ts";
14
+
15
+ // =============================================================================
16
+ // Config
17
+ // =============================================================================
18
+
19
+ export interface GetConfigRequest {
20
+ /** Identifier. */
21
+ zoneId: string;
22
+ }
23
+
24
+ export const GetConfigRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
25
+ zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
26
+ }).pipe(
27
+ T.Http({
28
+ method: "GET",
29
+ path: "/zones/{zone_id}/settings/google-tag-gateway/config",
30
+ }),
31
+ ) as unknown as Schema.Schema<GetConfigRequest>;
32
+
33
+ export interface GetConfigResponse {
34
+ /** Enables or disables Google Tag Gateway for this zone. */
35
+ enabled: boolean;
36
+ /** Specifies the endpoint path for proxying Google Tag Manager requests. Use an absolute path starting with '/', with no nested paths and alphanumeric characters only (e.g. /metrics). */
37
+ endpoint: string;
38
+ /** Hides the original client IP address from Google when enabled. */
39
+ hideOriginalIp: boolean;
40
+ /** Specify the Google Tag Manager container or measurement ID (e.g. GTM-XXXXXXX or G-XXXXXXXXXX). */
41
+ measurementId: string;
42
+ /** Set up the associated Google Tag on the zone automatically when enabled. */
43
+ setUpTag?: boolean | null;
44
+ }
45
+
46
+ export const GetConfigResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
47
+ enabled: Schema.Boolean,
48
+ endpoint: Schema.String,
49
+ hideOriginalIp: Schema.Boolean,
50
+ measurementId: Schema.String,
51
+ setUpTag: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
52
+ }).pipe(
53
+ T.ResponsePath("result"),
54
+ ) as unknown as Schema.Schema<GetConfigResponse>;
55
+
56
+ export type GetConfigError = DefaultErrors;
57
+
58
+ export const getConfig: API.OperationMethod<
59
+ GetConfigRequest,
60
+ GetConfigResponse,
61
+ GetConfigError,
62
+ Credentials | HttpClient.HttpClient
63
+ > = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
64
+ input: GetConfigRequest,
65
+ output: GetConfigResponse,
66
+ errors: [],
67
+ }));
68
+
69
+ export interface PutConfigRequest {
70
+ /** Path param: Identifier. */
71
+ zoneId: string;
72
+ /** Body param: Enables or disables Google Tag Gateway for this zone. */
73
+ enabled: boolean;
74
+ /** Body param: Specifies the endpoint path for proxying Google Tag Manager requests. Use an absolute path starting with '/', with no nested paths and alphanumeric characters only (e.g. /metrics). */
75
+ endpoint: string;
76
+ /** Body param: Hides the original client IP address from Google when enabled. */
77
+ hideOriginalIp: boolean;
78
+ /** Body param: Specify the Google Tag Manager container or measurement ID (e.g. GTM-XXXXXXX or G-XXXXXXXXXX). */
79
+ measurementId: string;
80
+ /** Body param: Set up the associated Google Tag on the zone automatically when enabled. */
81
+ setUpTag?: boolean | null;
82
+ }
83
+
84
+ export const PutConfigRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
85
+ zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
86
+ enabled: Schema.Boolean,
87
+ endpoint: Schema.String,
88
+ hideOriginalIp: Schema.Boolean,
89
+ measurementId: Schema.String,
90
+ setUpTag: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
91
+ }).pipe(
92
+ T.Http({
93
+ method: "PUT",
94
+ path: "/zones/{zone_id}/settings/google-tag-gateway/config",
95
+ }),
96
+ ) as unknown as Schema.Schema<PutConfigRequest>;
97
+
98
+ export interface PutConfigResponse {
99
+ /** Enables or disables Google Tag Gateway for this zone. */
100
+ enabled: boolean;
101
+ /** Specifies the endpoint path for proxying Google Tag Manager requests. Use an absolute path starting with '/', with no nested paths and alphanumeric characters only (e.g. /metrics). */
102
+ endpoint: string;
103
+ /** Hides the original client IP address from Google when enabled. */
104
+ hideOriginalIp: boolean;
105
+ /** Specify the Google Tag Manager container or measurement ID (e.g. GTM-XXXXXXX or G-XXXXXXXXXX). */
106
+ measurementId: string;
107
+ /** Set up the associated Google Tag on the zone automatically when enabled. */
108
+ setUpTag?: boolean | null;
109
+ }
110
+
111
+ export const PutConfigResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
112
+ enabled: Schema.Boolean,
113
+ endpoint: Schema.String,
114
+ hideOriginalIp: Schema.Boolean,
115
+ measurementId: Schema.String,
116
+ setUpTag: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
117
+ }).pipe(
118
+ T.ResponsePath("result"),
119
+ ) as unknown as Schema.Schema<PutConfigResponse>;
120
+
121
+ export type PutConfigError = DefaultErrors;
122
+
123
+ export const putConfig: API.OperationMethod<
124
+ PutConfigRequest,
125
+ PutConfigResponse,
126
+ PutConfigError,
127
+ Credentials | HttpClient.HttpClient
128
+ > = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
129
+ input: PutConfigRequest,
130
+ output: PutConfigResponse,
131
+ errors: [],
132
+ }));
@@ -26,7 +26,11 @@ export class ConsumerNotFound extends Schema.TaggedErrorClass<ConsumerNotFound>(
26
26
  "ConsumerNotFound",
27
27
  { code: Schema.Number, message: Schema.String },
28
28
  ) {}
29
- T.applyErrorMatchers(ConsumerNotFound, [{ code: 10105 }, { code: 11006 }]);
29
+ T.applyErrorMatchers(ConsumerNotFound, [
30
+ { code: 10013 },
31
+ { code: 10105 },
32
+ { code: 11006 },
33
+ ]);
30
34
 
31
35
  export class InvalidMessageBody extends Schema.TaggedErrorClass<InvalidMessageBody>()(
32
36
  "InvalidMessageBody",
@@ -115,7 +115,7 @@ export interface GetInstanceResponse {
115
115
  limit: number;
116
116
  backoff?: "constant" | "linear" | "exponential" | null;
117
117
  };
118
- timeout: number;
118
+ timeout: unknown;
119
119
  };
120
120
  end: string | null;
121
121
  name: string;
@@ -199,7 +199,7 @@ export const GetInstanceResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
199
199
  ]),
200
200
  ),
201
201
  }),
202
- timeout: Schema.Number,
202
+ timeout: Schema.Unknown,
203
203
  }),
204
204
  end: Schema.Union([Schema.String, Schema.Null]),
205
205
  name: Schema.String,