@to11ai/sdk 3.0.0-rc.11 → 3.0.0-rc.12

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.
@@ -176,7 +176,6 @@ export type ProjectEnvironment = {
176
176
  * @deprecated Always `false`. To be removed.
177
177
  */
178
178
  isPointer?: boolean | null;
179
- isProduction: boolean;
180
179
  isSystem: boolean;
181
180
  name: string;
182
181
  projectId: string;
@@ -2157,7 +2156,7 @@ export type ApiKeysGetApiKeyAuditData = {
2157
2156
  };
2158
2157
  query?: {
2159
2158
  cursor?: string | null;
2160
- limit?: string;
2159
+ limit?: number | null;
2161
2160
  eventType?: string | null;
2162
2161
  };
2163
2162
  url: '/v1/api-keys/{id}/audit';
@@ -2220,7 +2219,7 @@ export type ApiKeysGetApiKeyAuditResponses = {
2220
2219
  200: {
2221
2220
  code: number;
2222
2221
  data: {
2223
- events: Array<{
2222
+ items: Array<{
2224
2223
  apiKeyId: string;
2225
2224
  environment: string;
2226
2225
  event: string;
@@ -2231,7 +2230,10 @@ export type ApiKeysGetApiKeyAuditResponses = {
2231
2230
  traceId: string;
2232
2231
  workspaceId: string | null;
2233
2232
  }>;
2234
- nextCursor: string | null;
2233
+ pagination: {
2234
+ limit: number;
2235
+ nextCursor: string | null;
2236
+ };
2235
2237
  } | null;
2236
2238
  error: {
2237
2239
  code: string;
@@ -9834,8 +9836,8 @@ export type ProjectAuditListProjectAuditEventsData = {
9834
9836
  event_type?: string | null;
9835
9837
  since?: string | null;
9836
9838
  until?: string | null;
9837
- limit?: string | null;
9838
9839
  cursor?: string | null;
9840
+ limit?: number | null;
9839
9841
  };
9840
9842
  url: '/v1/projects/{projectId}/audit';
9841
9843
  };
@@ -9922,6 +9924,7 @@ export type ProjectAuditListProjectAuditEventsResponses = {
9922
9924
  scheduledBy: string | null;
9923
9925
  }>;
9924
9926
  pagination: {
9927
+ limit: number;
9925
9928
  nextCursor: string | null;
9926
9929
  };
9927
9930
  } | null;
@@ -10067,8 +10070,8 @@ export type CredentialsDirectoryListProjectCredentialsDirectoryData = {
10067
10070
  catalog_id?: string | null;
10068
10071
  lifecycle_status?: 'active' | 'deleted' | null;
10069
10072
  attached_provider_count?: '0' | '1' | '2+' | null;
10070
- limit?: string | null;
10071
10073
  cursor?: string | null;
10074
+ limit?: number | null;
10072
10075
  };
10073
10076
  url: '/v1/projects/{projectId}/credentials';
10074
10077
  };
@@ -10163,6 +10166,7 @@ export type CredentialsDirectoryListProjectCredentialsDirectoryResponses = {
10163
10166
  projectId: string;
10164
10167
  }>;
10165
10168
  pagination: {
10169
+ limit: number;
10166
10170
  nextCursor: string | null;
10167
10171
  };
10168
10172
  } | null;
@@ -10199,8 +10203,8 @@ export type CredentialAuditGetCredentialAuditData = {
10199
10203
  credentialId: string;
10200
10204
  };
10201
10205
  query?: {
10202
- limit?: string | null;
10203
- before?: string | null;
10206
+ cursor?: string | null;
10207
+ limit?: number | null;
10204
10208
  actorId?: string | null;
10205
10209
  eventType?: string | null;
10206
10210
  };
@@ -10264,7 +10268,7 @@ export type CredentialAuditGetCredentialAuditResponses = {
10264
10268
  200: {
10265
10269
  code: number;
10266
10270
  data: {
10267
- events: Array<{
10271
+ items: Array<{
10268
10272
  actorId: string;
10269
10273
  actorType: string;
10270
10274
  afterState: unknown | null;
@@ -10281,7 +10285,10 @@ export type CredentialAuditGetCredentialAuditResponses = {
10281
10285
  scheduledAt: string | null;
10282
10286
  scheduledBy: string | null;
10283
10287
  }>;
10284
- nextCursor: string | null;
10288
+ pagination: {
10289
+ limit: number;
10290
+ nextCursor: string | null;
10291
+ };
10285
10292
  } | null;
10286
10293
  error: {
10287
10294
  code: string;
@@ -10824,7 +10831,6 @@ export type ProjectEnvironmentsCreateProjectEnvironmentData = {
10824
10831
  description?: string | null | null;
10825
10832
  isDefault?: boolean | null;
10826
10833
  isGatewayFallback?: boolean | null;
10827
- isProduction?: boolean | null;
10828
10834
  name: string;
10829
10835
  slug: string;
10830
10836
  sortOrder?: number | null;
@@ -11038,7 +11044,6 @@ export type ProjectEnvironmentsUpdateProjectEnvironmentData = {
11038
11044
  description?: string | null | null;
11039
11045
  isDefault?: boolean | null;
11040
11046
  isGatewayFallback?: boolean | null;
11041
- isProduction?: boolean | null;
11042
11047
  name?: string | null;
11043
11048
  slug?: string | null;
11044
11049
  sortOrder?: number | null;
@@ -21959,7 +21964,7 @@ export type RuleVersionsListRuleVersionsData = {
21959
21964
  };
21960
21965
  query?: {
21961
21966
  cursor?: string | null;
21962
- limit?: string | null;
21967
+ limit?: number | null;
21963
21968
  };
21964
21969
  url: '/v1/projects/{projectId}/routing/rules/{ruleId}/versions';
21965
21970
  };
@@ -22020,7 +22025,13 @@ export type RuleVersionsListRuleVersionsResponses = {
22020
22025
  */
22021
22026
  200: {
22022
22027
  code: number;
22023
- data: Array<RuleVersion> | null;
22028
+ data: {
22029
+ items: Array<RuleVersion>;
22030
+ pagination: {
22031
+ limit: number;
22032
+ nextCursor: string | null;
22033
+ };
22034
+ } | null;
22024
22035
  error: {
22025
22036
  code: string;
22026
22037
  details?: unknown | null;
@@ -22781,8 +22792,8 @@ export type ScheduledChangesListScheduledChangesData = {
22781
22792
  provider_id?: string | null;
22782
22793
  kind?: 'provider_activation' | 'credential_rotation' | 'credential_delete' | 'credential_restore' | 'config_edit' | null;
22783
22794
  status?: 'pending' | 'pending_approval' | 'approved' | 'rejected' | 'cancelled' | null;
22784
- limit?: string | null;
22785
22795
  cursor?: string | null;
22796
+ limit?: number | null;
22786
22797
  };
22787
22798
  url: '/v1/projects/{projectId}/scheduled-changes';
22788
22799
  };
@@ -22868,6 +22879,7 @@ export type ScheduledChangesListScheduledChangesResponses = {
22868
22879
  status: 'pending' | 'pending_approval' | 'approved' | 'rejected' | 'cancelled';
22869
22880
  }>;
22870
22881
  pagination: {
22882
+ limit: number;
22871
22883
  nextCursor: string | null;
22872
22884
  };
22873
22885
  } | null;
@@ -196,7 +196,6 @@ export declare const zProjectEnvironment: z.ZodObject<{
196
196
  isDefault: z.ZodBoolean;
197
197
  isGatewayFallback: z.ZodBoolean;
198
198
  isPointer: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
199
- isProduction: z.ZodBoolean;
200
199
  isSystem: z.ZodBoolean;
201
200
  name: z.ZodString;
202
201
  projectId: z.ZodString;
@@ -217,7 +216,6 @@ export declare const zArchiveProjectEnvironmentResult: z.ZodObject<{
217
216
  isDefault: z.ZodBoolean;
218
217
  isGatewayFallback: z.ZodBoolean;
219
218
  isPointer: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
220
- isProduction: z.ZodBoolean;
221
219
  isSystem: z.ZodBoolean;
222
220
  name: z.ZodString;
223
221
  projectId: z.ZodString;
@@ -1611,7 +1609,7 @@ export declare const zApiKeysGetApiKeyAuditPath: z.ZodObject<{
1611
1609
  }, z.core.$strip>;
1612
1610
  export declare const zApiKeysGetApiKeyAuditQuery: z.ZodObject<{
1613
1611
  cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1614
- limit: z.ZodOptional<z.ZodString>;
1612
+ limit: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
1615
1613
  eventType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1616
1614
  }, z.core.$strip>;
1617
1615
  /**
@@ -1620,7 +1618,7 @@ export declare const zApiKeysGetApiKeyAuditQuery: z.ZodObject<{
1620
1618
  export declare const zApiKeysGetApiKeyAuditResponse: z.ZodObject<{
1621
1619
  code: z.ZodNumber;
1622
1620
  data: z.ZodNullable<z.ZodObject<{
1623
- events: z.ZodArray<z.ZodObject<{
1621
+ items: z.ZodArray<z.ZodObject<{
1624
1622
  apiKeyId: z.ZodString;
1625
1623
  environment: z.ZodString;
1626
1624
  event: z.ZodString;
@@ -1631,7 +1629,10 @@ export declare const zApiKeysGetApiKeyAuditResponse: z.ZodObject<{
1631
1629
  traceId: z.ZodString;
1632
1630
  workspaceId: z.ZodNullable<z.ZodString>;
1633
1631
  }, z.core.$strip>>;
1634
- nextCursor: z.ZodNullable<z.ZodString>;
1632
+ pagination: z.ZodObject<{
1633
+ limit: z.ZodInt;
1634
+ nextCursor: z.ZodNullable<z.ZodString>;
1635
+ }, z.core.$strip>;
1635
1636
  }, z.core.$strip>>;
1636
1637
  error: z.ZodNullable<z.ZodObject<{
1637
1638
  code: z.ZodString;
@@ -5402,8 +5403,8 @@ export declare const zProjectAuditListProjectAuditEventsQuery: z.ZodObject<{
5402
5403
  event_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5403
5404
  since: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5404
5405
  until: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5405
- limit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5406
5406
  cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5407
+ limit: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
5407
5408
  }, z.core.$strip>;
5408
5409
  /**
5409
5410
  * Success
@@ -5454,6 +5455,7 @@ export declare const zProjectAuditListProjectAuditEventsResponse: z.ZodObject<{
5454
5455
  scheduledBy: z.ZodNullable<z.ZodString>;
5455
5456
  }, z.core.$strip>>;
5456
5457
  pagination: z.ZodObject<{
5458
+ limit: z.ZodInt;
5457
5459
  nextCursor: z.ZodNullable<z.ZodString>;
5458
5460
  }, z.core.$strip>;
5459
5461
  }, z.core.$strip>>;
@@ -5560,8 +5562,8 @@ export declare const zCredentialsDirectoryListProjectCredentialsDirectoryQuery:
5560
5562
  1: "1";
5561
5563
  "2+": "2+";
5562
5564
  }>>>;
5563
- limit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5564
5565
  cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5566
+ limit: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
5565
5567
  }, z.core.$strip>;
5566
5568
  /**
5567
5569
  * Success
@@ -5616,6 +5618,7 @@ export declare const zCredentialsDirectoryListProjectCredentialsDirectoryRespons
5616
5618
  projectId: z.ZodString;
5617
5619
  }, z.core.$strip>>;
5618
5620
  pagination: z.ZodObject<{
5621
+ limit: z.ZodInt;
5619
5622
  nextCursor: z.ZodNullable<z.ZodString>;
5620
5623
  }, z.core.$strip>;
5621
5624
  }, z.core.$strip>>;
@@ -5646,8 +5649,8 @@ export declare const zCredentialAuditGetCredentialAuditPath: z.ZodObject<{
5646
5649
  credentialId: z.ZodString;
5647
5650
  }, z.core.$strip>;
5648
5651
  export declare const zCredentialAuditGetCredentialAuditQuery: z.ZodObject<{
5649
- limit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5650
- before: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5652
+ cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5653
+ limit: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
5651
5654
  actorId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5652
5655
  eventType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5653
5656
  }, z.core.$strip>;
@@ -5657,7 +5660,7 @@ export declare const zCredentialAuditGetCredentialAuditQuery: z.ZodObject<{
5657
5660
  export declare const zCredentialAuditGetCredentialAuditResponse: z.ZodObject<{
5658
5661
  code: z.ZodNumber;
5659
5662
  data: z.ZodNullable<z.ZodObject<{
5660
- events: z.ZodArray<z.ZodObject<{
5663
+ items: z.ZodArray<z.ZodObject<{
5661
5664
  actorId: z.ZodString;
5662
5665
  actorType: z.ZodString;
5663
5666
  afterState: z.ZodNullable<z.ZodUnknown>;
@@ -5674,7 +5677,10 @@ export declare const zCredentialAuditGetCredentialAuditResponse: z.ZodObject<{
5674
5677
  scheduledAt: z.ZodNullable<z.ZodString>;
5675
5678
  scheduledBy: z.ZodNullable<z.ZodString>;
5676
5679
  }, z.core.$strip>>;
5677
- nextCursor: z.ZodNullable<z.ZodString>;
5680
+ pagination: z.ZodObject<{
5681
+ limit: z.ZodInt;
5682
+ nextCursor: z.ZodNullable<z.ZodString>;
5683
+ }, z.core.$strip>;
5678
5684
  }, z.core.$strip>>;
5679
5685
  error: z.ZodNullable<z.ZodObject<{
5680
5686
  code: z.ZodString;
@@ -5904,7 +5910,6 @@ export declare const zProjectEnvironmentsListProjectEnvironmentsResponse: z.ZodO
5904
5910
  isDefault: z.ZodBoolean;
5905
5911
  isGatewayFallback: z.ZodBoolean;
5906
5912
  isPointer: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
5907
- isProduction: z.ZodBoolean;
5908
5913
  isSystem: z.ZodBoolean;
5909
5914
  name: z.ZodString;
5910
5915
  projectId: z.ZodString;
@@ -5946,7 +5951,6 @@ export declare const zProjectEnvironmentsCreateProjectEnvironmentBody: z.ZodObje
5946
5951
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5947
5952
  isDefault: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
5948
5953
  isGatewayFallback: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
5949
- isProduction: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
5950
5954
  name: z.ZodString;
5951
5955
  slug: z.ZodString;
5952
5956
  sortOrder: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -5969,7 +5973,6 @@ export declare const zProjectEnvironmentsCreateProjectEnvironmentResponse: z.Zod
5969
5973
  isDefault: z.ZodBoolean;
5970
5974
  isGatewayFallback: z.ZodBoolean;
5971
5975
  isPointer: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
5972
- isProduction: z.ZodBoolean;
5973
5976
  isSystem: z.ZodBoolean;
5974
5977
  name: z.ZodString;
5975
5978
  projectId: z.ZodString;
@@ -6057,7 +6060,6 @@ export declare const zProjectEnvironmentsUpdateProjectEnvironmentBody: z.ZodObje
6057
6060
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6058
6061
  isDefault: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
6059
6062
  isGatewayFallback: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
6060
- isProduction: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
6061
6063
  name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6062
6064
  slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6063
6065
  sortOrder: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -6081,7 +6083,6 @@ export declare const zProjectEnvironmentsUpdateProjectEnvironmentResponse: z.Zod
6081
6083
  isDefault: z.ZodBoolean;
6082
6084
  isGatewayFallback: z.ZodBoolean;
6083
6085
  isPointer: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
6084
- isProduction: z.ZodBoolean;
6085
6086
  isSystem: z.ZodBoolean;
6086
6087
  name: z.ZodString;
6087
6088
  projectId: z.ZodString;
@@ -6132,7 +6133,6 @@ export declare const zProjectEnvironmentsGetProjectEnvironmentResponse: z.ZodObj
6132
6133
  isDefault: z.ZodBoolean;
6133
6134
  isGatewayFallback: z.ZodBoolean;
6134
6135
  isPointer: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
6135
- isProduction: z.ZodBoolean;
6136
6136
  isSystem: z.ZodBoolean;
6137
6137
  name: z.ZodString;
6138
6138
  projectId: z.ZodString;
@@ -6184,7 +6184,6 @@ export declare const zProjectEnvironmentsArchiveProjectEnvironmentResponse: z.Zo
6184
6184
  isDefault: z.ZodBoolean;
6185
6185
  isGatewayFallback: z.ZodBoolean;
6186
6186
  isPointer: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
6187
- isProduction: z.ZodBoolean;
6188
6187
  isSystem: z.ZodBoolean;
6189
6188
  name: z.ZodString;
6190
6189
  projectId: z.ZodString;
@@ -6236,7 +6235,6 @@ export declare const zProjectEnvironmentsRestoreProjectEnvironmentResponse: z.Zo
6236
6235
  isDefault: z.ZodBoolean;
6237
6236
  isGatewayFallback: z.ZodBoolean;
6238
6237
  isPointer: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
6239
- isProduction: z.ZodBoolean;
6240
6238
  isSystem: z.ZodBoolean;
6241
6239
  name: z.ZodString;
6242
6240
  projectId: z.ZodString;
@@ -12388,48 +12386,77 @@ export declare const zRuleVersionsListRuleVersionsPath: z.ZodObject<{
12388
12386
  }, z.core.$strip>;
12389
12387
  export declare const zRuleVersionsListRuleVersionsQuery: z.ZodObject<{
12390
12388
  cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12391
- limit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12389
+ limit: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
12392
12390
  }, z.core.$strip>;
12393
12391
  /**
12394
12392
  * Success
12395
12393
  */
12396
12394
  export declare const zRuleVersionsListRuleVersionsResponse: z.ZodObject<{
12397
12395
  code: z.ZodNumber;
12398
- data: z.ZodNullable<z.ZodArray<z.ZodObject<{
12399
- createdAt: z.ZodISODateTime;
12400
- createdBy: z.ZodString;
12401
- description: z.ZodNullable<z.ZodString>;
12402
- id: z.ZodString;
12403
- ruleId: z.ZodString;
12404
- snapshotJson: z.ZodObject<{
12405
- chain: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
12406
- endpoint: z.ZodString;
12407
- modelBindings: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
12408
- modelId: z.ZodString;
12409
- provider: z.ZodObject<{
12396
+ data: z.ZodNullable<z.ZodObject<{
12397
+ items: z.ZodArray<z.ZodObject<{
12398
+ createdAt: z.ZodISODateTime;
12399
+ createdBy: z.ZodString;
12400
+ description: z.ZodNullable<z.ZodString>;
12401
+ id: z.ZodString;
12402
+ ruleId: z.ZodString;
12403
+ snapshotJson: z.ZodObject<{
12404
+ chain: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
12405
+ endpoint: z.ZodString;
12406
+ modelBindings: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
12407
+ modelId: z.ZodString;
12408
+ provider: z.ZodObject<{
12409
+ envSlug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12410
+ providerId: z.ZodString;
12411
+ }, z.core.$strip>;
12412
+ weight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
12413
+ }, z.core.$strip>>>>;
12414
+ providerRefs: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
12410
12415
  envSlug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12411
12416
  providerId: z.ZodString;
12412
- }, z.core.$strip>;
12413
- weight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
12414
- }, z.core.$strip>>>>;
12415
- providerRefs: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
12416
- envSlug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12417
- providerId: z.ZodString;
12418
- }, z.core.$strip>>>>;
12419
- retry: z.ZodOptional<z.ZodNullable<z.ZodObject<{
12420
- backoffBaseMs: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
12421
- maxRetries: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
12422
- retryableStatusCodes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodInt>>>;
12423
- }, z.core.$strip>>>;
12424
- steps: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
12425
- name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12426
- position: z.ZodInt;
12427
- strategy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
12417
+ }, z.core.$strip>>>>;
12418
+ retry: z.ZodOptional<z.ZodNullable<z.ZodObject<{
12419
+ backoffBaseMs: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
12420
+ maxRetries: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
12421
+ retryableStatusCodes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodInt>>>;
12422
+ }, z.core.$strip>>>;
12423
+ steps: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
12424
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12425
+ position: z.ZodInt;
12426
+ strategy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
12427
+ single: "single";
12428
+ weighted: "weighted";
12429
+ fallback: "fallback";
12430
+ experiment: "experiment";
12431
+ }>>>;
12432
+ target: z.ZodOptional<z.ZodNullable<z.ZodObject<{
12433
+ modelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12434
+ modelName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12435
+ params: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
12436
+ providerId: z.ZodString;
12437
+ when: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
12438
+ }, z.core.$strip>>>;
12439
+ variants: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
12440
+ name: z.ZodString;
12441
+ params: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
12442
+ target: z.ZodObject<{
12443
+ modelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12444
+ modelName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12445
+ params: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
12446
+ providerId: z.ZodString;
12447
+ when: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
12448
+ }, z.core.$strip>;
12449
+ weight: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
12450
+ when: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
12451
+ }, z.core.$strip>>>>;
12452
+ when: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
12453
+ }, z.core.$strip>>>>;
12454
+ strategy: z.ZodEnum<{
12428
12455
  single: "single";
12429
12456
  weighted: "weighted";
12430
12457
  fallback: "fallback";
12431
12458
  experiment: "experiment";
12432
- }>>>;
12459
+ }>;
12433
12460
  target: z.ZodOptional<z.ZodNullable<z.ZodObject<{
12434
12461
  modelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12435
12462
  modelName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -12450,37 +12477,14 @@ export declare const zRuleVersionsListRuleVersionsResponse: z.ZodObject<{
12450
12477
  weight: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
12451
12478
  when: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
12452
12479
  }, z.core.$strip>>>>;
12453
- when: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
12454
- }, z.core.$strip>>>>;
12455
- strategy: z.ZodEnum<{
12456
- single: "single";
12457
- weighted: "weighted";
12458
- fallback: "fallback";
12459
- experiment: "experiment";
12460
- }>;
12461
- target: z.ZodOptional<z.ZodNullable<z.ZodObject<{
12462
- modelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12463
- modelName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12464
- params: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
12465
- providerId: z.ZodString;
12466
- when: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
12467
- }, z.core.$strip>>>;
12468
- variants: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
12469
- name: z.ZodString;
12470
- params: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
12471
- target: z.ZodObject<{
12472
- modelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12473
- modelName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12474
- params: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
12475
- providerId: z.ZodString;
12476
- when: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
12477
- }, z.core.$strip>;
12478
- weight: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
12479
- when: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
12480
- }, z.core.$strip>>>>;
12480
+ }, z.core.$strip>;
12481
+ version: z.ZodInt;
12482
+ }, z.core.$strip>>;
12483
+ pagination: z.ZodObject<{
12484
+ limit: z.ZodInt;
12485
+ nextCursor: z.ZodNullable<z.ZodString>;
12481
12486
  }, z.core.$strip>;
12482
- version: z.ZodInt;
12483
- }, z.core.$strip>>>;
12487
+ }, z.core.$strip>>;
12484
12488
  error: z.ZodNullable<z.ZodObject<{
12485
12489
  code: z.ZodString;
12486
12490
  details: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
@@ -12997,8 +13001,8 @@ export declare const zScheduledChangesListScheduledChangesQuery: z.ZodObject<{
12997
13001
  pending_approval: "pending_approval";
12998
13002
  cancelled: "cancelled";
12999
13003
  }>>>;
13000
- limit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13001
13004
  cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13005
+ limit: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
13002
13006
  }, z.core.$strip>;
13003
13007
  /**
13004
13008
  * Success
@@ -13049,6 +13053,7 @@ export declare const zScheduledChangesListScheduledChangesResponse: z.ZodObject<
13049
13053
  }>;
13050
13054
  }, z.core.$strip>>;
13051
13055
  pagination: z.ZodObject<{
13056
+ limit: z.ZodInt;
13052
13057
  nextCursor: z.ZodNullable<z.ZodString>;
13053
13058
  }, z.core.$strip>;
13054
13059
  }, z.core.$strip>>;
@@ -48,6 +48,8 @@ var import_pagination = require("../pagination");
48
48
  var import_shape = require("./shape");
49
49
  var import_types = require("./types");
50
50
  var LATEST_PROMPT_LABEL = "latest";
51
+ var versionsPage = import_zod.zPromptsListPromptVersionsResponse.shape.data.unwrap();
52
+ var labelsPage = import_zod.zPromptsListPromptLabelsResponse.shape.data.unwrap();
51
53
  function unwrap(envelope) {
52
54
  if (envelope.data === null || envelope.data === undefined) {
53
55
  throw new Error("API returned success but data is null");
@@ -168,7 +170,10 @@ class PromptResource {
168
170
  query.cursor = cursor;
169
171
  if (limit !== undefined)
170
172
  query.limit = limit;
171
- const envelope = await this.transport.request("GET", `${getProjectPromptPath(projectId, promptId)}/versions`, { query });
173
+ const envelope = await this.transport.request("GET", `${getProjectPromptPath(projectId, promptId)}/versions`, {
174
+ query,
175
+ decode: (data) => versionsPage.parse(data)
176
+ });
172
177
  return unwrap(envelope);
173
178
  }
174
179
  iterateVersions(input) {
@@ -188,7 +193,10 @@ class PromptResource {
188
193
  query.cursor = cursor;
189
194
  if (limit !== undefined)
190
195
  query.limit = limit;
191
- const envelope = await this.transport.request("GET", `${getProjectPromptPath(projectId, promptId)}/labels`, { query });
196
+ const envelope = await this.transport.request("GET", `${getProjectPromptPath(projectId, promptId)}/labels`, {
197
+ query,
198
+ decode: (data) => labelsPage.parse(data)
199
+ });
192
200
  return unwrap(envelope);
193
201
  }
194
202
  iterateLabels(input) {
@@ -1,10 +1,16 @@
1
1
  // src/prompts/resource.ts
2
2
  import { To11aiApiError, To11aiNetworkError } from "../errors";
3
- import { zResolvedPrompt } from "../generated/zod.gen";
3
+ import {
4
+ zPromptsListPromptLabelsResponse,
5
+ zPromptsListPromptVersionsResponse,
6
+ zResolvedPrompt
7
+ } from "../generated/zod.gen";
4
8
  import { iterateCursorItems } from "../pagination";
5
9
  import { shapePrompt } from "./shape";
6
10
  import { ENV_SLUG_REGEX } from "./types";
7
11
  var LATEST_PROMPT_LABEL = "latest";
12
+ var versionsPage = zPromptsListPromptVersionsResponse.shape.data.unwrap();
13
+ var labelsPage = zPromptsListPromptLabelsResponse.shape.data.unwrap();
8
14
  function unwrap(envelope) {
9
15
  if (envelope.data === null || envelope.data === undefined) {
10
16
  throw new Error("API returned success but data is null");
@@ -125,7 +131,10 @@ class PromptResource {
125
131
  query.cursor = cursor;
126
132
  if (limit !== undefined)
127
133
  query.limit = limit;
128
- const envelope = await this.transport.request("GET", `${getProjectPromptPath(projectId, promptId)}/versions`, { query });
134
+ const envelope = await this.transport.request("GET", `${getProjectPromptPath(projectId, promptId)}/versions`, {
135
+ query,
136
+ decode: (data) => versionsPage.parse(data)
137
+ });
129
138
  return unwrap(envelope);
130
139
  }
131
140
  iterateVersions(input) {
@@ -145,7 +154,10 @@ class PromptResource {
145
154
  query.cursor = cursor;
146
155
  if (limit !== undefined)
147
156
  query.limit = limit;
148
- const envelope = await this.transport.request("GET", `${getProjectPromptPath(projectId, promptId)}/labels`, { query });
157
+ const envelope = await this.transport.request("GET", `${getProjectPromptPath(projectId, promptId)}/labels`, {
158
+ query,
159
+ decode: (data) => labelsPage.parse(data)
160
+ });
149
161
  return unwrap(envelope);
150
162
  }
151
163
  iterateLabels(input) {
@@ -1,11 +1,31 @@
1
1
  import type { Transport } from "../transport";
2
- import type { CreateRuleVersionInput, CreateRuleVersionResult, GetRuleVersionInput, GetRuleVersionResult, IterateRuleReleasesInput, ListRuleReleasesInput, ListRuleReleasesResult, ListRuleVersionsInput, ListRuleVersionsResult, RollbackRuleReleaseInput, RollbackRuleReleaseResult, RuleRelease, SetRuleReleaseInput, SetRuleReleaseResult } from "./types";
3
- export type { CreateRuleVersionInput, CreateRuleVersionResult, GetRuleVersionInput, GetRuleVersionResult, IterateRuleReleasesInput, ListRuleReleasesInput, ListRuleReleasesResult, ListRuleVersionsInput, ListRuleVersionsResult, RollbackRuleReleaseInput, RollbackRuleReleaseResult, RuleModelBinding, RuleProviderRef, RuleRelease, RuleReleaseActorType, RuleReleaseApprovalStatus, RuleReleaseChangeKind, RuleReleaseStrategy, RuleReleaseWeight, RuleSnapshot, RuleStrategy, RuleVersion, SetRuleReleaseInput, SetRuleReleaseResult, } from "./types";
2
+ import type { CreateRuleVersionInput, CreateRuleVersionResult, GetRuleVersionInput, GetRuleVersionResult, IterateRuleReleasesInput, IterateRuleVersionsInput, ListRuleReleasesInput, ListRuleReleasesResult, ListRuleVersionsInput, ListRuleVersionsResult, RollbackRuleReleaseInput, RollbackRuleReleaseResult, RuleRelease, RuleVersion, SetRuleReleaseInput, SetRuleReleaseResult } from "./types";
3
+ export type { CreateRuleVersionInput, CreateRuleVersionResult, GetRuleVersionInput, GetRuleVersionResult, IterateRuleReleasesInput, IterateRuleVersionsInput, ListRuleReleasesInput, ListRuleReleasesResult, ListRuleVersionsInput, ListRuleVersionsResult, RollbackRuleReleaseInput, RollbackRuleReleaseResult, RuleModelBinding, RuleProviderRef, RuleRelease, RuleReleaseActorType, RuleReleaseApprovalStatus, RuleReleaseChangeKind, RuleReleaseStrategy, RuleReleaseWeight, RuleSnapshot, RuleStrategy, RuleVersion, SetRuleReleaseInput, SetRuleReleaseResult, } from "./types";
4
4
  export declare class RoutingRuleVersionResource {
5
5
  private readonly transport;
6
6
  constructor(transport: Transport);
7
7
  create(input: CreateRuleVersionInput): Promise<CreateRuleVersionResult>;
8
+ /**
9
+ * One page of a rule's versions, newest first. The result mirrors the wire
10
+ * shape, `{ items, pagination: { nextCursor, limit } }`; pass
11
+ * `pagination.nextCursor` back as `cursor` until it is `null`. Pass only a
12
+ * cursor this list returned: a malformed or unreadable one answers 400
13
+ * `invalid_cursor`.
14
+ */
8
15
  list(input: ListRuleVersionsInput): Promise<ListRuleVersionsResult>;
16
+ /**
17
+ * Every version of a rule, newest first: walks `list()` page by page until
18
+ * `pagination.nextCursor` is `null` and yields one `RuleVersion` at a time.
19
+ * `limit` sets the page size of each request. Throws a `To11aiError` if the
20
+ * server repeats a cursor.
21
+ *
22
+ * ```ts
23
+ * for await (const version of rules.versions.iterate({ projectId, ruleId })) {
24
+ * console.log(version.version);
25
+ * }
26
+ * ```
27
+ */
28
+ iterate(input: IterateRuleVersionsInput): AsyncGenerator<RuleVersion, void, undefined>;
9
29
  get(input: GetRuleVersionInput): Promise<GetRuleVersionResult>;
10
30
  }
11
31
  export declare class RoutingRuleReleaseResource {
@@ -12,13 +12,27 @@ export interface CreateRuleVersionInput {
12
12
  description?: string;
13
13
  }
14
14
  export type CreateRuleVersionResult = RuleVersion;
15
+ /**
16
+ * Input of `versions.list()`. `cursor` is the previous page's
17
+ * `pagination.nextCursor`; `limit` is the page size (the server clamps it
18
+ * into 1..100 and defaults to 50).
19
+ */
15
20
  export interface ListRuleVersionsInput {
16
21
  projectId: string;
17
22
  ruleId: string;
18
- cursor?: number;
23
+ cursor?: string;
19
24
  limit?: number;
20
25
  }
21
- export type ListRuleVersionsResult = RuleVersion[];
26
+ /**
27
+ * Input of `versions.iterate()`: `versions.list()` without `cursor`, which the
28
+ * iterator manages. `limit` is the page size of each request.
29
+ */
30
+ export type IterateRuleVersionsInput = Omit<ListRuleVersionsInput, "cursor">;
31
+ /**
32
+ * One page of a rule's versions, newest first (`version` descending):
33
+ * `{ items, pagination: { nextCursor, limit } }`.
34
+ */
35
+ export type ListRuleVersionsResult = CursorPaginatedResult<RuleVersion>;
22
36
  export interface GetRuleVersionInput {
23
37
  projectId: string;
24
38
  ruleId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@to11ai/sdk",
3
- "version": "3.0.0-rc.11",
3
+ "version": "3.0.0-rc.12",
4
4
  "license": "MPL-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -191,7 +191,6 @@ export type ProjectEnvironment = {
191
191
  * @deprecated Always `false`. To be removed.
192
192
  */
193
193
  isPointer?: boolean | null;
194
- isProduction: boolean;
195
194
  isSystem: boolean;
196
195
  name: string;
197
196
  projectId: string;
@@ -2290,7 +2289,7 @@ export type ApiKeysGetApiKeyAuditData = {
2290
2289
  };
2291
2290
  query?: {
2292
2291
  cursor?: string | null;
2293
- limit?: string;
2292
+ limit?: number | null;
2294
2293
  eventType?: string | null;
2295
2294
  };
2296
2295
  url: '/v1/api-keys/{id}/audit';
@@ -2356,7 +2355,7 @@ export type ApiKeysGetApiKeyAuditResponses = {
2356
2355
  200: {
2357
2356
  code: number;
2358
2357
  data: {
2359
- events: Array<{
2358
+ items: Array<{
2360
2359
  apiKeyId: string;
2361
2360
  environment: string;
2362
2361
  event: string;
@@ -2367,7 +2366,10 @@ export type ApiKeysGetApiKeyAuditResponses = {
2367
2366
  traceId: string;
2368
2367
  workspaceId: string | null;
2369
2368
  }>;
2370
- nextCursor: string | null;
2369
+ pagination: {
2370
+ limit: number;
2371
+ nextCursor: string | null;
2372
+ };
2371
2373
  } | null;
2372
2374
  error: {
2373
2375
  code: string;
@@ -10327,8 +10329,8 @@ export type ProjectAuditListProjectAuditEventsData = {
10327
10329
  event_type?: string | null;
10328
10330
  since?: string | null;
10329
10331
  until?: string | null;
10330
- limit?: string | null;
10331
10332
  cursor?: string | null;
10333
+ limit?: number | null;
10332
10334
  };
10333
10335
  url: '/v1/projects/{projectId}/audit';
10334
10336
  };
@@ -10418,6 +10420,7 @@ export type ProjectAuditListProjectAuditEventsResponses = {
10418
10420
  scheduledBy: string | null;
10419
10421
  }>;
10420
10422
  pagination: {
10423
+ limit: number;
10421
10424
  nextCursor: string | null;
10422
10425
  };
10423
10426
  } | null;
@@ -10570,8 +10573,8 @@ export type CredentialsDirectoryListProjectCredentialsDirectoryData = {
10570
10573
  catalog_id?: string | null;
10571
10574
  lifecycle_status?: 'active' | 'deleted' | null;
10572
10575
  attached_provider_count?: '0' | '1' | '2+' | null;
10573
- limit?: string | null;
10574
10576
  cursor?: string | null;
10577
+ limit?: number | null;
10575
10578
  };
10576
10579
  url: '/v1/projects/{projectId}/credentials';
10577
10580
  };
@@ -10669,6 +10672,7 @@ export type CredentialsDirectoryListProjectCredentialsDirectoryResponses = {
10669
10672
  projectId: string;
10670
10673
  }>;
10671
10674
  pagination: {
10675
+ limit: number;
10672
10676
  nextCursor: string | null;
10673
10677
  };
10674
10678
  } | null;
@@ -10707,8 +10711,8 @@ export type CredentialAuditGetCredentialAuditData = {
10707
10711
  credentialId: string;
10708
10712
  };
10709
10713
  query?: {
10710
- limit?: string | null;
10711
- before?: string | null;
10714
+ cursor?: string | null;
10715
+ limit?: number | null;
10712
10716
  actorId?: string | null;
10713
10717
  eventType?: string | null;
10714
10718
  };
@@ -10775,7 +10779,7 @@ export type CredentialAuditGetCredentialAuditResponses = {
10775
10779
  200: {
10776
10780
  code: number;
10777
10781
  data: {
10778
- events: Array<{
10782
+ items: Array<{
10779
10783
  actorId: string;
10780
10784
  actorType: string;
10781
10785
  afterState: unknown | null;
@@ -10792,7 +10796,10 @@ export type CredentialAuditGetCredentialAuditResponses = {
10792
10796
  scheduledAt: string | null;
10793
10797
  scheduledBy: string | null;
10794
10798
  }>;
10795
- nextCursor: string | null;
10799
+ pagination: {
10800
+ limit: number;
10801
+ nextCursor: string | null;
10802
+ };
10796
10803
  } | null;
10797
10804
  error: {
10798
10805
  code: string;
@@ -11362,7 +11369,6 @@ export type ProjectEnvironmentsCreateProjectEnvironmentData = {
11362
11369
  description?: string | null | null;
11363
11370
  isDefault?: boolean | null;
11364
11371
  isGatewayFallback?: boolean | null;
11365
- isProduction?: boolean | null;
11366
11372
  name: string;
11367
11373
  slug: string;
11368
11374
  sortOrder?: number | null;
@@ -11586,7 +11592,6 @@ export type ProjectEnvironmentsUpdateProjectEnvironmentData = {
11586
11592
  description?: string | null | null;
11587
11593
  isDefault?: boolean | null;
11588
11594
  isGatewayFallback?: boolean | null;
11589
- isProduction?: boolean | null;
11590
11595
  name?: string | null;
11591
11596
  slug?: string | null;
11592
11597
  sortOrder?: number | null;
@@ -22987,7 +22992,7 @@ export type RuleVersionsListRuleVersionsData = {
22987
22992
  };
22988
22993
  query?: {
22989
22994
  cursor?: string | null;
22990
- limit?: string | null;
22995
+ limit?: number | null;
22991
22996
  };
22992
22997
  url: '/v1/projects/{projectId}/routing/rules/{ruleId}/versions';
22993
22998
  };
@@ -23051,7 +23056,13 @@ export type RuleVersionsListRuleVersionsResponses = {
23051
23056
  */
23052
23057
  200: {
23053
23058
  code: number;
23054
- data: Array<RuleVersion> | null;
23059
+ data: {
23060
+ items: Array<RuleVersion>;
23061
+ pagination: {
23062
+ limit: number;
23063
+ nextCursor: string | null;
23064
+ };
23065
+ } | null;
23055
23066
  error: {
23056
23067
  code: string;
23057
23068
  details?: unknown | null;
@@ -23849,8 +23860,8 @@ export type ScheduledChangesListScheduledChangesData = {
23849
23860
  provider_id?: string | null;
23850
23861
  kind?: 'provider_activation' | 'credential_rotation' | 'credential_delete' | 'credential_restore' | 'config_edit' | null;
23851
23862
  status?: 'pending' | 'pending_approval' | 'approved' | 'rejected' | 'cancelled' | null;
23852
- limit?: string | null;
23853
23863
  cursor?: string | null;
23864
+ limit?: number | null;
23854
23865
  };
23855
23866
  url: '/v1/projects/{projectId}/scheduled-changes';
23856
23867
  };
@@ -23939,6 +23950,7 @@ export type ScheduledChangesListScheduledChangesResponses = {
23939
23950
  status: 'pending' | 'pending_approval' | 'approved' | 'rejected' | 'cancelled';
23940
23951
  }>;
23941
23952
  pagination: {
23953
+ limit: number;
23942
23954
  nextCursor: string | null;
23943
23955
  };
23944
23956
  } | null;
@@ -182,7 +182,6 @@ export const zProjectEnvironment = z.object({
182
182
  isDefault: z.boolean(),
183
183
  isGatewayFallback: z.boolean(),
184
184
  isPointer: z.boolean().nullish(),
185
- isProduction: z.boolean(),
186
185
  isSystem: z.boolean(),
187
186
  name: z.string().min(1).max(120),
188
187
  projectId: z.string(),
@@ -1289,7 +1288,7 @@ export const zApiKeysGetApiKeyAuditPath = z.object({
1289
1288
 
1290
1289
  export const zApiKeysGetApiKeyAuditQuery = z.object({
1291
1290
  cursor: z.string().nullish(),
1292
- limit: z.string().optional(),
1291
+ limit: z.int().nullish(),
1293
1292
  eventType: z.string().nullish()
1294
1293
  });
1295
1294
 
@@ -1299,7 +1298,7 @@ export const zApiKeysGetApiKeyAuditQuery = z.object({
1299
1298
  export const zApiKeysGetApiKeyAuditResponse = z.object({
1300
1299
  code: z.number(),
1301
1300
  data: z.object({
1302
- events: z.array(z.object({
1301
+ items: z.array(z.object({
1303
1302
  apiKeyId: z.string(),
1304
1303
  environment: z.string(),
1305
1304
  event: z.string(),
@@ -1310,7 +1309,10 @@ export const zApiKeysGetApiKeyAuditResponse = z.object({
1310
1309
  traceId: z.string(),
1311
1310
  workspaceId: z.string().nullable()
1312
1311
  })),
1313
- nextCursor: z.string().nullable()
1312
+ pagination: z.object({
1313
+ limit: z.int().gte(1).lte(100),
1314
+ nextCursor: z.string().nullable()
1315
+ })
1314
1316
  }).nullable(),
1315
1317
  error: z.object({
1316
1318
  code: z.string(),
@@ -5095,8 +5097,8 @@ export const zProjectAuditListProjectAuditEventsQuery = z.object({
5095
5097
  event_type: z.string().nullish(),
5096
5098
  since: z.string().nullish(),
5097
5099
  until: z.string().nullish(),
5098
- limit: z.string().nullish(),
5099
- cursor: z.string().nullish()
5100
+ cursor: z.string().nullish(),
5101
+ limit: z.int().nullish()
5100
5102
  });
5101
5103
 
5102
5104
  /**
@@ -5148,6 +5150,7 @@ export const zProjectAuditListProjectAuditEventsResponse = z.object({
5148
5150
  scheduledBy: z.string().nullable()
5149
5151
  })),
5150
5152
  pagination: z.object({
5153
+ limit: z.int().gte(1).lte(100),
5151
5154
  nextCursor: z.string().nullable()
5152
5155
  })
5153
5156
  }).nullable(),
@@ -5250,8 +5253,8 @@ export const zCredentialsDirectoryListProjectCredentialsDirectoryQuery = z.objec
5250
5253
  '1',
5251
5254
  '2+'
5252
5255
  ]).nullish(),
5253
- limit: z.string().nullish(),
5254
- cursor: z.string().nullish()
5256
+ cursor: z.string().nullish(),
5257
+ limit: z.int().nullish()
5255
5258
  });
5256
5259
 
5257
5260
  /**
@@ -5301,6 +5304,7 @@ export const zCredentialsDirectoryListProjectCredentialsDirectoryResponse = z.ob
5301
5304
  projectId: z.string()
5302
5305
  })),
5303
5306
  pagination: z.object({
5307
+ limit: z.int().gte(1).lte(100),
5304
5308
  nextCursor: z.string().nullable()
5305
5309
  })
5306
5310
  }).nullable(),
@@ -5333,8 +5337,8 @@ export const zCredentialAuditGetCredentialAuditPath = z.object({
5333
5337
  });
5334
5338
 
5335
5339
  export const zCredentialAuditGetCredentialAuditQuery = z.object({
5336
- limit: z.string().nullish(),
5337
- before: z.string().nullish(),
5340
+ cursor: z.string().nullish(),
5341
+ limit: z.int().nullish(),
5338
5342
  actorId: z.string().nullish(),
5339
5343
  eventType: z.string().nullish()
5340
5344
  });
@@ -5345,7 +5349,7 @@ export const zCredentialAuditGetCredentialAuditQuery = z.object({
5345
5349
  export const zCredentialAuditGetCredentialAuditResponse = z.object({
5346
5350
  code: z.number(),
5347
5351
  data: z.object({
5348
- events: z.array(z.object({
5352
+ items: z.array(z.object({
5349
5353
  actorId: z.string(),
5350
5354
  actorType: z.string(),
5351
5355
  afterState: z.unknown().nullable(),
@@ -5362,7 +5366,10 @@ export const zCredentialAuditGetCredentialAuditResponse = z.object({
5362
5366
  scheduledAt: z.string().nullable(),
5363
5367
  scheduledBy: z.string().nullable()
5364
5368
  })),
5365
- nextCursor: z.string().nullable()
5369
+ pagination: z.object({
5370
+ limit: z.int().gte(1).lte(100),
5371
+ nextCursor: z.string().nullable()
5372
+ })
5366
5373
  }).nullable(),
5367
5374
  error: z.object({
5368
5375
  code: z.string(),
@@ -5616,7 +5623,6 @@ export const zProjectEnvironmentsCreateProjectEnvironmentBody = z.object({
5616
5623
  description: z.string().max(280).nullish(),
5617
5624
  isDefault: z.boolean().nullish(),
5618
5625
  isGatewayFallback: z.boolean().nullish(),
5619
- isProduction: z.boolean().nullish(),
5620
5626
  name: z.string().min(1).max(120),
5621
5627
  slug: z.string().min(1).max(63).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
5622
5628
  sortOrder: z.int().gte(-9007199254740991).lte(9007199254740991).nullish()
@@ -5714,7 +5720,6 @@ export const zProjectEnvironmentsUpdateProjectEnvironmentBody = z.object({
5714
5720
  description: z.string().max(280).nullish(),
5715
5721
  isDefault: z.boolean().nullish(),
5716
5722
  isGatewayFallback: z.boolean().nullish(),
5717
- isProduction: z.boolean().nullish(),
5718
5723
  name: z.string().min(1).max(120).nullish(),
5719
5724
  slug: z.string().min(1).max(63).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).nullish(),
5720
5725
  sortOrder: z.int().gte(-9007199254740991).lte(9007199254740991).nullish()
@@ -11593,7 +11598,7 @@ export const zRuleVersionsListRuleVersionsPath = z.object({
11593
11598
 
11594
11599
  export const zRuleVersionsListRuleVersionsQuery = z.object({
11595
11600
  cursor: z.string().nullish(),
11596
- limit: z.string().nullish()
11601
+ limit: z.int().nullish()
11597
11602
  });
11598
11603
 
11599
11604
  /**
@@ -11601,7 +11606,13 @@ export const zRuleVersionsListRuleVersionsQuery = z.object({
11601
11606
  */
11602
11607
  export const zRuleVersionsListRuleVersionsResponse = z.object({
11603
11608
  code: z.number(),
11604
- data: z.array(zRuleVersion).nullable(),
11609
+ data: z.object({
11610
+ items: z.array(zRuleVersion),
11611
+ pagination: z.object({
11612
+ limit: z.int().gte(1).lte(100),
11613
+ nextCursor: z.string().nullable()
11614
+ })
11615
+ }).nullable(),
11605
11616
  error: z.object({
11606
11617
  code: z.string(),
11607
11618
  details: z.unknown().nullish(),
@@ -11965,8 +11976,8 @@ export const zScheduledChangesListScheduledChangesQuery = z.object({
11965
11976
  'rejected',
11966
11977
  'cancelled'
11967
11978
  ]).nullish(),
11968
- limit: z.string().nullish(),
11969
- cursor: z.string().nullish()
11979
+ cursor: z.string().nullish(),
11980
+ limit: z.int().nullish()
11970
11981
  });
11971
11982
 
11972
11983
  /**
@@ -12015,6 +12026,7 @@ export const zScheduledChangesListScheduledChangesResponse = z.object({
12015
12026
  ])
12016
12027
  })),
12017
12028
  pagination: z.object({
12029
+ limit: z.int().gte(1).lte(100),
12018
12030
  nextCursor: z.string().nullable()
12019
12031
  })
12020
12032
  }).nullable(),
@@ -1,5 +1,9 @@
1
1
  import { To11aiApiError, To11aiNetworkError } from "../errors";
2
- import { zResolvedPrompt } from "../generated/zod.gen";
2
+ import {
3
+ zPromptsListPromptLabelsResponse,
4
+ zPromptsListPromptVersionsResponse,
5
+ zResolvedPrompt,
6
+ } from "../generated/zod.gen";
3
7
  import { iterateCursorItems } from "../pagination";
4
8
  import type { ApiEnvelope, Transport } from "../transport";
5
9
  import type {
@@ -94,6 +98,11 @@ export type {
94
98
  */
95
99
  const LATEST_PROMPT_LABEL = "latest";
96
100
 
101
+ // The cursor pages, validated so a wrong-shaped response raises
102
+ // To11aiResponseValidationError instead of a TypeError while paging.
103
+ const versionsPage = zPromptsListPromptVersionsResponse.shape.data.unwrap();
104
+ const labelsPage = zPromptsListPromptLabelsResponse.shape.data.unwrap();
105
+
97
106
  function unwrap<T>(envelope: ApiEnvelope<T>): T {
98
107
  if (envelope.data === null || envelope.data === undefined) {
99
108
  throw new Error("API returned success but data is null");
@@ -376,7 +385,10 @@ export class PromptResource<F extends RenderFormat | undefined = undefined> {
376
385
  const envelope = await this.transport.request<ListPromptVersionsResult>(
377
386
  "GET",
378
387
  `${getProjectPromptPath(projectId, promptId)}/versions`,
379
- { query },
388
+ {
389
+ query,
390
+ decode: (data) => versionsPage.parse(data) as ListPromptVersionsResult,
391
+ },
380
392
  );
381
393
  return unwrap(envelope);
382
394
  }
@@ -434,7 +446,10 @@ export class PromptResource<F extends RenderFormat | undefined = undefined> {
434
446
  const envelope = await this.transport.request<ListPromptLabelsResult>(
435
447
  "GET",
436
448
  `${getProjectPromptPath(projectId, promptId)}/labels`,
437
- { query },
449
+ {
450
+ query,
451
+ decode: (data) => labelsPage.parse(data) as ListPromptLabelsResult,
452
+ },
438
453
  );
439
454
  return unwrap(envelope);
440
455
  }
@@ -2,6 +2,7 @@ import {
2
2
  zRuleReleasesListRuleReleasesEnvResponse,
3
3
  zRuleReleasesListRuleReleasesResponse,
4
4
  zRuleVersion,
5
+ zRuleVersionsListRuleVersionsResponse,
5
6
  } from "../generated/zod.gen";
6
7
  import { iterateCursorItems } from "../pagination";
7
8
  import type { ApiEnvelope, Transport } from "../transport";
@@ -11,6 +12,7 @@ import type {
11
12
  GetRuleVersionInput,
12
13
  GetRuleVersionResult,
13
14
  IterateRuleReleasesInput,
15
+ IterateRuleVersionsInput,
14
16
  ListRuleReleasesInput,
15
17
  ListRuleReleasesResult,
16
18
  ListRuleVersionsInput,
@@ -18,6 +20,7 @@ import type {
18
20
  RollbackRuleReleaseInput,
19
21
  RollbackRuleReleaseResult,
20
22
  RuleRelease,
23
+ RuleVersion,
21
24
  SetRuleReleaseInput,
22
25
  SetRuleReleaseResult,
23
26
  } from "./types";
@@ -28,6 +31,7 @@ export type {
28
31
  GetRuleVersionInput,
29
32
  GetRuleVersionResult,
30
33
  IterateRuleReleasesInput,
34
+ IterateRuleVersionsInput,
31
35
  ListRuleReleasesInput,
32
36
  ListRuleReleasesResult,
33
37
  ListRuleVersionsInput,
@@ -50,6 +54,7 @@ export type {
50
54
  } from "./types";
51
55
 
52
56
  // The page schemas are the `data` of the generated envelope schemas.
57
+ const versionsPage = zRuleVersionsListRuleVersionsResponse.shape.data.unwrap();
53
58
  const releasesPage = zRuleReleasesListRuleReleasesResponse.shape.data.unwrap();
54
59
  const releasesEnvPage =
55
60
  zRuleReleasesListRuleReleasesEnvResponse.shape.data.unwrap();
@@ -116,6 +121,13 @@ export class RoutingRuleVersionResource {
116
121
  return unwrap(envelope);
117
122
  }
118
123
 
124
+ /**
125
+ * One page of a rule's versions, newest first. The result mirrors the wire
126
+ * shape, `{ items, pagination: { nextCursor, limit } }`; pass
127
+ * `pagination.nextCursor` back as `cursor` until it is `null`. Pass only a
128
+ * cursor this list returned: a malformed or unreadable one answers 400
129
+ * `invalid_cursor`.
130
+ */
119
131
  async list(input: ListRuleVersionsInput): Promise<ListRuleVersionsResult> {
120
132
  const query: Record<string, string | number | undefined> = {};
121
133
  if (input.cursor !== undefined) query.cursor = input.cursor;
@@ -123,11 +135,32 @@ export class RoutingRuleVersionResource {
123
135
  const envelope = await this.transport.request<ListRuleVersionsResult>(
124
136
  "GET",
125
137
  versionsPath(input.projectId, input.ruleId),
126
- { query },
138
+ {
139
+ query,
140
+ decode: (data) => versionsPage.parse(data) as ListRuleVersionsResult,
141
+ },
127
142
  );
128
143
  return unwrap(envelope);
129
144
  }
130
145
 
146
+ /**
147
+ * Every version of a rule, newest first: walks `list()` page by page until
148
+ * `pagination.nextCursor` is `null` and yields one `RuleVersion` at a time.
149
+ * `limit` sets the page size of each request. Throws a `To11aiError` if the
150
+ * server repeats a cursor.
151
+ *
152
+ * ```ts
153
+ * for await (const version of rules.versions.iterate({ projectId, ruleId })) {
154
+ * console.log(version.version);
155
+ * }
156
+ * ```
157
+ */
158
+ iterate(
159
+ input: IterateRuleVersionsInput,
160
+ ): AsyncGenerator<RuleVersion, void, undefined> {
161
+ return iterateCursorItems((cursor) => this.list({ ...input, cursor }));
162
+ }
163
+
131
164
  async get(input: GetRuleVersionInput): Promise<GetRuleVersionResult> {
132
165
  const envelope = await this.transport.request<GetRuleVersionResult>(
133
166
  "GET",
@@ -27,14 +27,29 @@ export interface CreateRuleVersionInput {
27
27
 
28
28
  export type CreateRuleVersionResult = RuleVersion;
29
29
 
30
+ /**
31
+ * Input of `versions.list()`. `cursor` is the previous page's
32
+ * `pagination.nextCursor`; `limit` is the page size (the server clamps it
33
+ * into 1..100 and defaults to 50).
34
+ */
30
35
  export interface ListRuleVersionsInput {
31
36
  projectId: string;
32
37
  ruleId: string;
33
- cursor?: number;
38
+ cursor?: string;
34
39
  limit?: number;
35
40
  }
36
41
 
37
- export type ListRuleVersionsResult = RuleVersion[];
42
+ /**
43
+ * Input of `versions.iterate()`: `versions.list()` without `cursor`, which the
44
+ * iterator manages. `limit` is the page size of each request.
45
+ */
46
+ export type IterateRuleVersionsInput = Omit<ListRuleVersionsInput, "cursor">;
47
+
48
+ /**
49
+ * One page of a rule's versions, newest first (`version` descending):
50
+ * `{ items, pagination: { nextCursor, limit } }`.
51
+ */
52
+ export type ListRuleVersionsResult = CursorPaginatedResult<RuleVersion>;
38
53
 
39
54
  export interface GetRuleVersionInput {
40
55
  projectId: string;