@@ -86,7 +86,6 @@ function extractLatestVersions(definitions) {
86
86
const match = key . match ( keyVersionRegex ) ;
87
87
if ( match ) {
88
88
const fullName = match [ 0 ] ;
89
- const _defaultPrefix = match [ 1 ] ; // This is simply the namespace prefix; every field has this "v1"
90
89
const baseName = match [ 2 ] ; // Field without any version-related prefixes or suffixes
91
90
const versionSuffix = match [ 3 ] ; // Version (optional)
92
91
const formattedKeyName =
@@ -253,7 +252,7 @@ const generateSDKClientFromSwagger = async (swaggerSpec, targetPath) => {
253
252
) ;
254
253
255
254
imports . push (
256
- 'import { GrpcStatus, TurnkeyRequestError, TurnkeySDKClientConfig } from "../__types__/base";' ,
255
+ 'import { GrpcStatus, TStamper, TurnkeyRequestError, TurnkeySDKClientConfig } from "../__types__/base";' ,
257
256
) ;
258
257
259
258
imports . push ( 'import { VERSION } from "../__generated__/version";' ) ;
@@ -266,8 +265,13 @@ const generateSDKClientFromSwagger = async (swaggerSpec, targetPath) => {
266
265
export class TurnkeySDKClientBase {
267
266
config: TurnkeySDKClientConfig;
268
267
268
+ stamper?: TStamper | undefined;
269
+
269
270
constructor(config: TurnkeySDKClientConfig) {
270
271
this.config = config;
272
+ if (config.stamper) {
273
+ this.stamper = config.stamper;
274
+ }
271
275
}
272
276
273
277
async request<TBodyType, TResponseType>(
@@ -279,8 +283,8 @@ export class TurnkeySDKClientBase {
279
283
var headers: Record<string, string> = {
280
284
"X-Client-Version": VERSION
281
285
}
282
- if (this.config. stamper) {
283
- const stamp = await this.config. stamper.stamp(stringifiedBody);
286
+ if (this.stamper) {
287
+ const stamp = await this.stamper.stamp(stringifiedBody);
284
288
headers[stamp.stampHeaderName] = stamp.stampHeaderValue
285
289
}
286
290
@@ -454,12 +458,12 @@ export class TurnkeySDKClientBase {
454
458
// generate a stamping method for each method
455
459
codeBuffer . push (
456
460
`\n\tstamp${ operationNameWithoutNamespace } = async (input: SdkApiTypes.${ inputType } ): Promise<TSignedRequest | undefined> => {
457
- if (!this.config. stamper) {
461
+ if (!this.stamper) {
458
462
return undefined;
459
463
}
460
464
const fullUrl = this.config.apiBaseUrl + "${ endpointPath } ";
461
465
const body = JSON.stringify(input);
462
- const stamp = await this.config. stamper.stamp(body);
466
+ const stamp = await this.stamper.stamp(body);
463
467
return {
464
468
body: body,
465
469
stamp: stamp,
0 commit comments