@bagelink/sdk 1.4.22 → 1.4.28

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.d.mts CHANGED
@@ -1,3 +1,355 @@
1
+ declare function getPath(pathsObject: PathsObject | undefined, path: string): PathItemObject | undefined;
2
+ /**
3
+ * A type guard to check if the given value is a `ReferenceObject`.
4
+ * See https://www.typescriptlang.org/docs/handbook/advanced-types.html#type-guards-and-differentiating-types
5
+ *
6
+ * @param obj The value to check.
7
+ */
8
+ declare function isReferenceObject(obj: any): obj is ReferenceObject;
9
+ /**
10
+ * A type guard to check if the given object is a `SchemaObject`.
11
+ * Useful to distinguish from `ReferenceObject` values that can be used
12
+ * in most places where `SchemaObject` is allowed.
13
+ *
14
+ * See https://www.typescriptlang.org/docs/handbook/advanced-types.html#type-guards-and-differentiating-types
15
+ *
16
+ * @param schema The value to check.
17
+ */
18
+ declare function isSchemaObject(schema: SchemaObject | ReferenceObject): schema is SchemaObject;
19
+ declare function dereference<T>(property: ReferenceObject | T): Exclude<T, ReferenceObject>;
20
+
21
+ interface ServerObject {
22
+ url: string;
23
+ description?: string;
24
+ variables?: {
25
+ [v: string]: ServerVariableObject;
26
+ };
27
+ }
28
+ interface ServerVariableObject {
29
+ enum?: string[] | boolean[] | number[];
30
+ default: string | boolean | number;
31
+ description?: string;
32
+ }
33
+ interface OpenAPIObject {
34
+ openapi: string;
35
+ info: InfoObject;
36
+ servers?: ServerObject[];
37
+ paths?: PathsObject;
38
+ components?: ComponentsObject;
39
+ security?: SecurityRequirementObject[];
40
+ tags?: TagObject[];
41
+ externalDocs?: ExternalDocumentationObject;
42
+ /** Webhooks added in v. 3.1.0 */
43
+ webhooks?: PathsObject;
44
+ }
45
+ interface InfoObject {
46
+ title: string;
47
+ description?: string;
48
+ termsOfService?: string;
49
+ contact?: ContactObject;
50
+ license?: LicenseObject;
51
+ version: string;
52
+ }
53
+ interface ContactObject {
54
+ name?: string;
55
+ url?: string;
56
+ email?: string;
57
+ }
58
+ interface LicenseObject {
59
+ name: string;
60
+ identifier?: string;
61
+ url?: string;
62
+ }
63
+ interface ComponentsObject {
64
+ schemas?: {
65
+ [schema: string]: SchemaObject | ReferenceObject;
66
+ };
67
+ responses?: {
68
+ [response: string]: ResponseObject | ReferenceObject;
69
+ };
70
+ parameters?: {
71
+ [parameter: string]: ParameterObject | ReferenceObject;
72
+ };
73
+ examples?: {
74
+ [example: string]: ExampleObject | ReferenceObject;
75
+ };
76
+ requestBodies?: {
77
+ [request: string]: RequestBodyObject | ReferenceObject;
78
+ };
79
+ headers?: {
80
+ [header: string]: HeaderObject | ReferenceObject;
81
+ };
82
+ securitySchemes?: {
83
+ [securityScheme: string]: SecuritySchemeObject | ReferenceObject;
84
+ };
85
+ links?: {
86
+ [link: string]: LinkObject | ReferenceObject;
87
+ };
88
+ callbacks?: {
89
+ [callback: string]: CallbackObject | ReferenceObject;
90
+ };
91
+ }
92
+ /**
93
+ * Rename it to Paths Object to be consistent with the spec
94
+ * See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathsObject
95
+ */
96
+ interface PathsObject {
97
+ [path: string]: PathItemObject;
98
+ }
99
+ interface PathItemObject {
100
+ $ref?: string;
101
+ summary?: string;
102
+ description?: string;
103
+ get?: OperationObject;
104
+ put?: OperationObject;
105
+ post?: OperationObject;
106
+ delete?: OperationObject;
107
+ options?: OperationObject;
108
+ head?: OperationObject;
109
+ patch?: OperationObject;
110
+ trace?: OperationObject;
111
+ servers?: ServerObject[];
112
+ parameters?: (ParameterObject | ReferenceObject)[];
113
+ }
114
+ interface OperationObject {
115
+ tags?: string[];
116
+ summary?: string;
117
+ description?: string;
118
+ externalDocs?: ExternalDocumentationObject;
119
+ operationId?: string;
120
+ parameters?: (ParameterObject | ReferenceObject)[];
121
+ requestBody?: RequestBodyObject | ReferenceObject;
122
+ responses?: ResponsesObject;
123
+ callbacks?: CallbacksObject;
124
+ deprecated?: boolean;
125
+ security?: SecurityRequirementObject[];
126
+ servers?: ServerObject[];
127
+ }
128
+ interface ExternalDocumentationObject {
129
+ description?: string;
130
+ url: string;
131
+ }
132
+ /**
133
+ * The location of a parameter.
134
+ * Possible values are "query", "header", "path" or "cookie".
135
+ * Specification:
136
+ * https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations
137
+ */
138
+ type ParameterLocation = 'query' | 'header' | 'path' | 'cookie';
139
+ /**
140
+ * The style of a parameter.
141
+ * Describes how the parameter value will be serialized.
142
+ * (serialization is not implemented yet)
143
+ * Specification:
144
+ * https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values
145
+ */
146
+ type ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
147
+ interface BaseParameterObject {
148
+ description?: string;
149
+ required?: boolean;
150
+ deprecated?: boolean;
151
+ allowEmptyValue?: boolean;
152
+ style?: ParameterStyle;
153
+ explode?: boolean;
154
+ allowReserved?: boolean;
155
+ schema?: SchemaObject | ReferenceObject;
156
+ examples?: {
157
+ [param: string]: ExampleObject | ReferenceObject;
158
+ };
159
+ example?: any;
160
+ content?: ContentObject;
161
+ }
162
+ interface ParameterObject extends BaseParameterObject {
163
+ name: string;
164
+ in: ParameterLocation;
165
+ }
166
+ interface RequestBodyObject {
167
+ description?: string;
168
+ content: ContentObject;
169
+ required?: boolean;
170
+ }
171
+ interface ContentObject {
172
+ [mediatype: string]: MediaTypeObject;
173
+ }
174
+ interface MediaTypeObject {
175
+ schema?: SchemaObject | ReferenceObject;
176
+ examples?: ExamplesObject;
177
+ example?: any;
178
+ encoding?: EncodingObject;
179
+ }
180
+ interface EncodingObject {
181
+ [property: string]: EncodingPropertyObject;
182
+ }
183
+ interface EncodingPropertyObject {
184
+ contentType?: string;
185
+ headers?: {
186
+ [key: string]: HeaderObject | ReferenceObject;
187
+ };
188
+ style?: string;
189
+ explode?: boolean;
190
+ allowReserved?: boolean;
191
+ }
192
+ interface ResponsesObject {
193
+ [statuscode: string]: ResponseObject | ReferenceObject;
194
+ }
195
+ interface ResponseObject {
196
+ description: string;
197
+ headers?: HeadersObject;
198
+ content?: ContentObject;
199
+ links?: LinksObject;
200
+ }
201
+ interface CallbacksObject {
202
+ [name: string]: CallbackObject | ReferenceObject;
203
+ }
204
+ interface CallbackObject {
205
+ [name: string]: PathItemObject;
206
+ }
207
+ interface HeadersObject {
208
+ [name: string]: HeaderObject | ReferenceObject;
209
+ }
210
+ interface ExampleObject {
211
+ summary?: string;
212
+ description?: string;
213
+ value?: any;
214
+ externalValue?: string;
215
+ }
216
+ interface LinksObject {
217
+ [name: string]: LinkObject | ReferenceObject;
218
+ }
219
+ interface LinkObject {
220
+ operationRef?: string;
221
+ operationId?: string;
222
+ parameters?: LinkParametersObject;
223
+ requestBody?: any | string;
224
+ description?: string;
225
+ server?: ServerObject;
226
+ }
227
+ interface LinkParametersObject {
228
+ [name: string]: any | string;
229
+ }
230
+ interface HeaderObject extends BaseParameterObject {
231
+ $ref?: string;
232
+ }
233
+ interface TagObject {
234
+ name: string;
235
+ description?: string;
236
+ externalDocs?: ExternalDocumentationObject;
237
+ }
238
+ interface ExamplesObject {
239
+ [name: string]: ExampleObject | ReferenceObject;
240
+ }
241
+ interface ReferenceObject {
242
+ $ref: string;
243
+ summary?: string;
244
+ description?: string;
245
+ }
246
+ type SchemaObjectType = 'integer' | 'number' | 'string' | 'boolean' | 'object' | 'null' | 'array' | 'undefined';
247
+ declare const TYPE_FORMATS: readonly ["uuid", "uri", "date-time", "date", "email", "binary", "password", "phone", "uuid4", "int32", "int64", "float", "double", "byte"];
248
+ type TypeFormatT = (typeof TYPE_FORMATS)[number] | (string & {});
249
+ interface SchemaObject {
250
+ discriminator?: DiscriminatorObject;
251
+ readOnly?: boolean;
252
+ writeOnly?: boolean;
253
+ xml?: XmlObject;
254
+ externalDocs?: ExternalDocumentationObject;
255
+ /** @deprecated use examples instead */
256
+ example?: any;
257
+ examples?: any[];
258
+ deprecated?: boolean;
259
+ type?: SchemaObjectType | SchemaObjectType[];
260
+ format?: TypeFormatT;
261
+ allOf?: (SchemaObject | ReferenceObject)[];
262
+ oneOf?: (SchemaObject | ReferenceObject)[];
263
+ anyOf?: (SchemaObject | ReferenceObject)[];
264
+ not?: SchemaObject | ReferenceObject;
265
+ items?: SchemaObject | ReferenceObject;
266
+ properties?: {
267
+ [propertyName: string]: SchemaObject | ReferenceObject;
268
+ };
269
+ additionalProperties?: SchemaObject | ReferenceObject | boolean;
270
+ propertyNames?: SchemaObject | ReferenceObject;
271
+ description?: string;
272
+ default?: any;
273
+ title?: string;
274
+ multipleOf?: number;
275
+ maximum?: number;
276
+ const?: any;
277
+ /** @desc In OpenAPI 3.1: number */
278
+ exclusiveMaximum?: number;
279
+ minimum?: number;
280
+ /** @desc In OpenAPI 3.1: number */
281
+ exclusiveMinimum?: number;
282
+ maxLength?: number;
283
+ minLength?: number;
284
+ pattern?: string;
285
+ maxItems?: number;
286
+ minItems?: number;
287
+ uniqueItems?: boolean;
288
+ maxProperties?: number;
289
+ minProperties?: number;
290
+ required?: string[];
291
+ enum?: any[];
292
+ prefixItems?: (SchemaObject | ReferenceObject)[];
293
+ /**
294
+ * @desc JSON Schema compliant Content-Type, optional when specified as a key of ContentObject
295
+ * @example image/png
296
+ */
297
+ contentMediaType?: string;
298
+ /**
299
+ * @desc Specifies the Content-Encoding for the schema, supports all encodings from RFC4648, and "quoted-printable" from RFC2045
300
+ * @override
301
+ * @see https://datatracker.ietf.org/doc/html/rfc4648
302
+ * @see https://datatracker.ietf.org/doc/html/rfc2045#section-6.7
303
+ * @example base64
304
+ */
305
+ contentEncoding?: string;
306
+ }
307
+ interface SchemasObject {
308
+ [schema: string]: SchemaObject;
309
+ }
310
+ interface DiscriminatorObject {
311
+ propertyName: string;
312
+ mapping?: {
313
+ [key: string]: string;
314
+ };
315
+ }
316
+ interface XmlObject {
317
+ name?: string;
318
+ namespace?: string;
319
+ prefix?: string;
320
+ attribute?: boolean;
321
+ wrapped?: boolean;
322
+ }
323
+ type SecuritySchemeType = 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
324
+ interface SecuritySchemeObject {
325
+ type: SecuritySchemeType;
326
+ description?: string;
327
+ name?: string;
328
+ in?: string;
329
+ scheme?: string;
330
+ bearerFormat?: string;
331
+ flows?: OAuthFlowsObject;
332
+ openIdConnectUrl?: string;
333
+ }
334
+ interface OAuthFlowsObject {
335
+ implicit?: OAuthFlowObject;
336
+ password?: OAuthFlowObject;
337
+ clientCredentials?: OAuthFlowObject;
338
+ authorizationCode?: OAuthFlowObject;
339
+ }
340
+ interface OAuthFlowObject {
341
+ authorizationUrl?: string;
342
+ tokenUrl?: string;
343
+ refreshUrl?: string;
344
+ scopes: ScopesObject;
345
+ }
346
+ interface ScopesObject {
347
+ [scope: string]: any;
348
+ }
349
+ interface SecurityRequirementObject {
350
+ [name: string]: string[];
351
+ }
352
+
1
353
  interface OpenAPIResponse {
2
354
  types: string;
3
355
  code: string;
@@ -8,7 +360,6 @@ declare function formatAPIErrorMessage(err: unknown): string;
8
360
 
9
361
  type Tables = '';
10
362
  type TableToTypeMapping = Record<Tables, any>;
11
-
12
363
  interface User {
13
364
  id: string;
14
365
  first_name?: string;
@@ -108,4 +459,4 @@ declare class Bagel {
108
459
  uploadFile<T>(file: File, options?: UploadOptions): Promise<T>;
109
460
  }
110
461
 
111
- export { Bagel, type TableToTypeMapping, type Tables, type UploadOptions, type User, formatAPIErrorMessage, _default as openAPI };
462
+ export { Bagel, type BaseParameterObject, type CallbackObject, type CallbacksObject, type ComponentsObject, type ContactObject, type ContentObject, type DiscriminatorObject, type EncodingObject, type EncodingPropertyObject, type ExampleObject, type ExamplesObject, type ExternalDocumentationObject, type HeaderObject, type HeadersObject, type InfoObject, type LicenseObject, type LinkObject, type LinkParametersObject, type LinksObject, type MediaTypeObject, type OAuthFlowObject, type OAuthFlowsObject, type OpenAPIObject, type OperationObject, type ParameterLocation, type ParameterObject, type ParameterStyle, type PathItemObject, type PathsObject, type ReferenceObject, type RequestBodyObject, type ResponseObject, type ResponsesObject, type SchemaObject, type SchemaObjectType, type SchemasObject, type ScopesObject, type SecurityRequirementObject, type SecuritySchemeObject, type SecuritySchemeType, type ServerObject, type ServerVariableObject, type TableToTypeMapping, type Tables, type TagObject, type TypeFormatT, type UploadOptions, type User, type XmlObject, dereference, formatAPIErrorMessage, getPath, isReferenceObject, isSchemaObject, _default as openAPI };