@katerai/sdk 0.3.0 → 0.4.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 (120) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +2 -6
  3. package/client.d.mts +6 -3
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +6 -3
  6. package/client.d.ts.map +1 -1
  7. package/client.js +7 -29
  8. package/client.js.map +1 -1
  9. package/client.mjs +7 -29
  10. package/client.mjs.map +1 -1
  11. package/internal/utils/log.d.mts.map +1 -1
  12. package/internal/utils/log.d.ts.map +1 -1
  13. package/internal/utils/log.js +0 -1
  14. package/internal/utils/log.js.map +1 -1
  15. package/internal/utils/log.mjs +0 -1
  16. package/internal/utils/log.mjs.map +1 -1
  17. package/package.json +1 -1
  18. package/resources/healthz.d.mts +16 -0
  19. package/resources/healthz.d.mts.map +1 -0
  20. package/resources/healthz.d.ts +16 -0
  21. package/resources/healthz.d.ts.map +1 -0
  22. package/resources/healthz.js +15 -0
  23. package/resources/healthz.js.map +1 -0
  24. package/resources/healthz.mjs +11 -0
  25. package/resources/healthz.mjs.map +1 -0
  26. package/resources/index.d.mts +2 -0
  27. package/resources/index.d.mts.map +1 -1
  28. package/resources/index.d.ts +2 -0
  29. package/resources/index.d.ts.map +1 -1
  30. package/resources/index.js +5 -1
  31. package/resources/index.js.map +1 -1
  32. package/resources/index.mjs +2 -0
  33. package/resources/index.mjs.map +1 -1
  34. package/resources/readyz.d.mts +16 -0
  35. package/resources/readyz.d.mts.map +1 -0
  36. package/resources/readyz.d.ts +16 -0
  37. package/resources/readyz.d.ts.map +1 -0
  38. package/resources/readyz.js +15 -0
  39. package/resources/readyz.js.map +1 -0
  40. package/resources/readyz.mjs +11 -0
  41. package/resources/readyz.mjs.map +1 -0
  42. package/resources/v1/connections/connections.d.mts +258 -65
  43. package/resources/v1/connections/connections.d.mts.map +1 -1
  44. package/resources/v1/connections/connections.d.ts +258 -65
  45. package/resources/v1/connections/connections.d.ts.map +1 -1
  46. package/resources/v1/connections/connections.js +33 -0
  47. package/resources/v1/connections/connections.js.map +1 -1
  48. package/resources/v1/connections/connections.mjs +34 -1
  49. package/resources/v1/connections/connections.mjs.map +1 -1
  50. package/resources/v1/connections/databases.d.mts +118 -1
  51. package/resources/v1/connections/databases.d.mts.map +1 -1
  52. package/resources/v1/connections/databases.d.ts +118 -1
  53. package/resources/v1/connections/databases.d.ts.map +1 -1
  54. package/resources/v1/connections/databases.js +35 -0
  55. package/resources/v1/connections/databases.js.map +1 -1
  56. package/resources/v1/connections/databases.mjs +35 -0
  57. package/resources/v1/connections/databases.mjs.map +1 -1
  58. package/resources/v1/connections/index.d.mts +2 -2
  59. package/resources/v1/connections/index.d.mts.map +1 -1
  60. package/resources/v1/connections/index.d.ts +2 -2
  61. package/resources/v1/connections/index.d.ts.map +1 -1
  62. package/resources/v1/connections/index.js.map +1 -1
  63. package/resources/v1/connections/index.mjs +1 -1
  64. package/resources/v1/connections/index.mjs.map +1 -1
  65. package/resources/v1/github/github.d.mts +61 -1
  66. package/resources/v1/github/github.d.mts.map +1 -1
  67. package/resources/v1/github/github.d.ts +61 -1
  68. package/resources/v1/github/github.d.ts.map +1 -1
  69. package/resources/v1/github/github.js +22 -0
  70. package/resources/v1/github/github.js.map +1 -1
  71. package/resources/v1/github/github.mjs +22 -0
  72. package/resources/v1/github/github.mjs.map +1 -1
  73. package/resources/v1/github/index.d.mts +2 -1
  74. package/resources/v1/github/index.d.mts.map +1 -1
  75. package/resources/v1/github/index.d.ts +2 -1
  76. package/resources/v1/github/index.d.ts.map +1 -1
  77. package/resources/v1/github/index.js +3 -1
  78. package/resources/v1/github/index.js.map +1 -1
  79. package/resources/v1/github/index.mjs +2 -1
  80. package/resources/v1/github/index.mjs.map +1 -1
  81. package/resources/v1/github/webhooks.d.mts +28 -0
  82. package/resources/v1/github/webhooks.d.mts.map +1 -0
  83. package/resources/v1/github/webhooks.d.ts +28 -0
  84. package/resources/v1/github/webhooks.d.ts.map +1 -0
  85. package/resources/v1/github/webhooks.js +27 -0
  86. package/resources/v1/github/webhooks.js.map +1 -0
  87. package/resources/v1/github/webhooks.mjs +23 -0
  88. package/resources/v1/github/webhooks.mjs.map +1 -0
  89. package/resources/v1/index.d.mts +2 -2
  90. package/resources/v1/index.d.mts.map +1 -1
  91. package/resources/v1/index.d.ts +2 -2
  92. package/resources/v1/index.d.ts.map +1 -1
  93. package/resources/v1/index.js.map +1 -1
  94. package/resources/v1/index.mjs +1 -1
  95. package/resources/v1/index.mjs.map +1 -1
  96. package/resources/v1/v1.d.mts +4 -4
  97. package/resources/v1/v1.d.mts.map +1 -1
  98. package/resources/v1/v1.d.ts +4 -4
  99. package/resources/v1/v1.d.ts.map +1 -1
  100. package/resources/v1/v1.js.map +1 -1
  101. package/resources/v1/v1.mjs +1 -1
  102. package/resources/v1/v1.mjs.map +1 -1
  103. package/src/client.ts +11 -36
  104. package/src/internal/utils/log.ts +0 -1
  105. package/src/resources/healthz.ts +20 -0
  106. package/src/resources/index.ts +2 -0
  107. package/src/resources/readyz.ts +20 -0
  108. package/src/resources/v1/connections/connections.ts +330 -68
  109. package/src/resources/v1/connections/databases.ts +165 -1
  110. package/src/resources/v1/connections/index.ts +9 -1
  111. package/src/resources/v1/github/github.ts +97 -1
  112. package/src/resources/v1/github/index.ts +10 -1
  113. package/src/resources/v1/github/webhooks.ts +60 -0
  114. package/src/resources/v1/index.ts +10 -1
  115. package/src/resources/v1/v1.ts +20 -2
  116. package/src/version.ts +1 -1
  117. package/version.d.mts +1 -1
  118. package/version.d.ts +1 -1
  119. package/version.js +1 -1
  120. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -16,6 +16,8 @@ import * as Errors from './core/error';
16
16
  import * as Uploads from './core/uploads';
17
17
  import * as API from './resources/index';
18
18
  import { APIPromise } from './core/api-promise';
19
+ import { Healthz, HealthzCheckResponse } from './resources/healthz';
20
+ import { Readyz, ReadyzCheckResponse } from './resources/readyz';
19
21
  import { V1 } from './resources/v1/v1';
20
22
  import { type Fetch } from './internal/builtin-types';
21
23
  import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
@@ -208,41 +210,7 @@ export class Kater {
208
210
  }
209
211
 
210
212
  protected validateHeaders({ values, nulls }: NullableHeaders) {
211
- if (this.bearerToken && values.get('authorization')) {
212
- return;
213
- }
214
- if (nulls.has('authorization')) {
215
- return;
216
- }
217
-
218
- if (this.apiKey && values.get('x-api-key')) {
219
- return;
220
- }
221
- if (nulls.has('x-api-key')) {
222
- return;
223
- }
224
-
225
- throw new Error(
226
- 'Could not resolve authentication method. Expected either bearerToken or apiKey to be set. Or for one of the "Authorization" or "X-API-Key" headers to be explicitly omitted',
227
- );
228
- }
229
-
230
- protected async authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined> {
231
- return buildHeaders([await this.propelAuth(opts), await this.apiKeyAuth(opts)]);
232
- }
233
-
234
- protected async propelAuth(opts: FinalRequestOptions): Promise<NullableHeaders | undefined> {
235
- if (this.bearerToken == null) {
236
- return undefined;
237
- }
238
- return buildHeaders([{ Authorization: `Bearer ${this.bearerToken}` }]);
239
- }
240
-
241
- protected async apiKeyAuth(opts: FinalRequestOptions): Promise<NullableHeaders | undefined> {
242
- if (this.apiKey == null) {
243
- return undefined;
244
- }
245
- return buildHeaders([{ 'X-API-Key': this.apiKey }]);
213
+ return;
246
214
  }
247
215
 
248
216
  /**
@@ -682,7 +650,6 @@ export class Kater {
682
650
  ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
683
651
  ...getPlatformHeaders(),
684
652
  },
685
- await this.authHeaders(options),
686
653
  this._options.defaultHeaders,
687
654
  bodyHeaders,
688
655
  options.headers,
@@ -750,12 +717,20 @@ export class Kater {
750
717
  static toFile = Uploads.toFile;
751
718
 
752
719
  v1: API.V1 = new API.V1(this);
720
+ healthz: API.Healthz = new API.Healthz(this);
721
+ readyz: API.Readyz = new API.Readyz(this);
753
722
  }
754
723
 
755
724
  Kater.V1 = V1;
725
+ Kater.Healthz = Healthz;
726
+ Kater.Readyz = Readyz;
756
727
 
757
728
  export declare namespace Kater {
758
729
  export type RequestOptions = Opts.RequestOptions;
759
730
 
760
731
  export { V1 as V1 };
732
+
733
+ export { Healthz as Healthz, type HealthzCheckResponse as HealthzCheckResponse };
734
+
735
+ export { Readyz as Readyz, type ReadyzCheckResponse as ReadyzCheckResponse };
761
736
  }
@@ -107,7 +107,6 @@ export const formatRequestDetails = (details: {
107
107
  name,
108
108
  (
109
109
  name.toLowerCase() === 'authorization' ||
110
- name.toLowerCase() === 'x-api-key' ||
111
110
  name.toLowerCase() === 'cookie' ||
112
111
  name.toLowerCase() === 'set-cookie'
113
112
  ) ?
@@ -0,0 +1,20 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+
7
+ export class Healthz extends APIResource {
8
+ /**
9
+ * Returns 200 if the service is alive. Used by Kubernetes liveness probe.
10
+ */
11
+ check(options?: RequestOptions): APIPromise<HealthzCheckResponse> {
12
+ return this._client.get('/healthz', options);
13
+ }
14
+ }
15
+
16
+ export type HealthzCheckResponse = { [key: string]: string };
17
+
18
+ export declare namespace Healthz {
19
+ export { type HealthzCheckResponse as HealthzCheckResponse };
20
+ }
@@ -1,3 +1,5 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ export { Healthz, type HealthzCheckResponse } from './healthz';
4
+ export { Readyz, type ReadyzCheckResponse } from './readyz';
3
5
  export { V1 } from './v1/v1';
@@ -0,0 +1,20 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+
7
+ export class Readyz extends APIResource {
8
+ /**
9
+ * Returns 200 if the service is ready to accept traffic.
10
+ */
11
+ check(options?: RequestOptions): APIPromise<ReadyzCheckResponse> {
12
+ return this._client.get('/readyz', options);
13
+ }
14
+ }
15
+
16
+ export type ReadyzCheckResponse = { [key: string]: unknown };
17
+
18
+ export declare namespace Readyz {
19
+ export { type ReadyzCheckResponse as ReadyzCheckResponse };
20
+ }