Skip to content

Commit

Permalink
chore: 🐝 Update SDK - Generate (#55)
Browse files Browse the repository at this point in the history
* ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.304.0

* update timeout to 15s

---------

Co-authored-by: speakeasybot <[email protected]>
Co-authored-by: Mike Lueders <[email protected]>
  • Loading branch information
3 people authored Jun 11, 2024
1 parent a960611 commit e0bcfec
Show file tree
Hide file tree
Showing 218 changed files with 2,740 additions and 4,555 deletions.
2 changes: 1 addition & 1 deletion .mocharc.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
timeout: '10000'
timeout: '15000'
13 changes: 7 additions & 6 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
lockVersion: 2.0.0
id: 4f7e8ab5-4c00-496a-9710-e7c707e4ee78
management:
docChecksum: 609002aee5b1500e5e73ec2eb80f268d
docChecksum: 5f3530e1b29cad621760a07269fb6df8
docVersion: "2018-02-08"
speakeasyVersion: 1.299.4
generationVersion: 2.338.7
releaseVersion: 2.2.9
configChecksum: 3986607c3ac0c16bdd19c8879b4e7dc5
speakeasyVersion: 1.304.0
generationVersion: 2.340.3
releaseVersion: 2.2.10
configChecksum: 3653f14e9e309a06c295dd874c8097c9
repoURL: https://github.com/goshippo/shippo-javascript-sdk.git
installationURL: https://github.com/goshippo/shippo-javascript-sdk
published: true
features:
typescript:
additionalDependencies: 0.1.0
constsAndDefaults: 0.1.5
core: 3.9.10
core: 3.9.13
flattening: 2.81.1
globalSecurity: 2.82.9
globalSecurityCallbacks: 0.1.0
Expand Down Expand Up @@ -58,6 +58,7 @@ generatedFiles:
- src/lib/encodings.ts
- src/lib/http.ts
- src/lib/is-plain-object.ts
- src/lib/primitives.ts
- src/lib/retries.ts
- src/lib/schemas.ts
- src/lib/sdks.ts
Expand Down
2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: true
typescript:
version: 2.2.9
version: 2.2.10
additionalDependencies:
dependencies: {}
devDependencies:
Expand Down
12 changes: 6 additions & 6 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
speakeasyVersion: 1.299.4
speakeasyVersion: 1.304.0
sources:
openapi:
sourceNamespace: openapi
sourceRevisionDigest: sha256:809852a1888d2a908db04ce03869b0574aa407b7852244bf26c7de05e9c6ae91
sourceBlobDigest: sha256:cb40025f1badac09cf5837db332862318944783ab4c57e2c37e8cfc698ca7793
sourceRevisionDigest: sha256:b991e2d47c37fec4a13c48145527fce86e7267efa058be2fd52c27895dbaf427
sourceBlobDigest: sha256:412901bee886ccd8a5e455681e12da460dfb0d437c39fba95ffed319d3d855c4
tags:
- latest
- remove-transaction-response-type
- main
targets:
first-target:
source: openapi
sourceNamespace: openapi
sourceRevisionDigest: sha256:809852a1888d2a908db04ce03869b0574aa407b7852244bf26c7de05e9c6ae91
sourceBlobDigest: sha256:cb40025f1badac09cf5837db332862318944783ab4c57e2c37e8cfc698ca7793
sourceRevisionDigest: sha256:b991e2d47c37fec4a13c48145527fce86e7267efa058be2fd52c27895dbaf427
sourceBlobDigest: sha256:412901bee886ccd8a5e455681e12da460dfb0d437c39fba95ffed319d3d855c4
outLocation: /github/workspace/repo
workflow:
workflowVersion: 1.0.0
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,14 @@ Based on:
### Generated
- [typescript v2.2.9] .
### Releases
- [NPM v2.2.9] https://www.npmjs.com/package/shippo/v/2.2.9 - .
- [NPM v2.2.9] https://www.npmjs.com/package/shippo/v/2.2.9 - .

## 2024-06-11 22:06:14
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.304.0 (2.340.3) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v2.2.10] .
### Releases
- [NPM v2.2.10] https://www.npmjs.com/package/shippo/v/2.2.10 - .
2 changes: 1 addition & 1 deletion docs/models/components/rate.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
"name": "shippo",
"version": "2.2.9",
"version": "2.2.10",
"exports": {
".": "./src/index.ts",
"./models/errors": "./src/models/errors/index.ts",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shippo",
"version": "2.2.9",
"version": "2.2.10",
"author": "Shippo",
"license": "MIT",
"main": "./index.js",
Expand Down
6 changes: 3 additions & 3 deletions src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
export const SDK_METADATA = {
language: "typescript",
openapiDocVersion: "2018-02-08",
sdkVersion: "2.2.9",
genVersion: "2.338.7",
userAgent: "speakeasy-sdk/typescript 2.2.9 2.338.7 2018-02-08 shippo",
sdkVersion: "2.2.10",
genVersion: "2.340.3",
userAgent: "speakeasy-sdk/typescript 2.2.10 2.340.3 2018-02-08 shippo",
} as const;
46 changes: 46 additions & 0 deletions src/lib/encodings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,3 +383,49 @@ function mapDefinedEntries<K, V, R>(

return acc;
}

export function queryJoin(...args: string[]): string {
return args.filter(Boolean).join("&");
}

type QueryEncoderOptions = {
explode?: boolean;
charEncoding?: "percent" | "none";
};

type QueryEncoder = (
key: string,
value: unknown,
options?: QueryEncoderOptions,
) => string;

type BulkQueryEncoder = (
values: Record<string, unknown>,
options?: QueryEncoderOptions,
) => string;

export function queryEncoder(f: QueryEncoder): BulkQueryEncoder {
const bulkEncode = function (
values: Record<string, unknown>,
options?: QueryEncoderOptions,
): string {
const opts: QueryEncoderOptions = {
...options,
explode: options?.explode ?? true,
charEncoding: options?.charEncoding ?? "percent",
};

const encoded = Object.entries(values).map(([key, value]) => {
return f(key, value, opts);
});
return queryJoin(...encoded);
};

return bulkEncode;
}

export const encodeJSONQuery = queryEncoder(encodeJSON);
export const encodeFormQuery = queryEncoder(encodeForm);
export const encodeSpaceDelimitedQuery = queryEncoder(encodeSpaceDelimited);
export const encodePipeDelimitedQuery = queryEncoder(encodePipeDelimited);
export const encodeDeepObjectQuery = queryEncoder(encodeDeepObject);
40 changes: 40 additions & 0 deletions src/lib/primitives.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
*/

export type Remap<Inp, Mapping extends { [k in keyof Inp]?: string | null }> = {
[k in keyof Inp as Mapping[k] extends string /* if we have a string mapping for this key then use it */
? Mapping[k]
: Mapping[k] extends null /* if the mapping is to `null` then drop the key */
? never
: k /* otherwise keep the key as-is */]: Inp[k];
};

/**
* Converts or omits an object's keys according to a mapping.
*
* @param inp An object whose keys will be remapped
* @param mappings A mapping of original keys to new keys. If a key is not present in the mapping, it will be left as is. If a key is mapped to `null`, it will be removed in the resulting object.
* @returns A new object with keys remapped or omitted according to the mappings
*/
export function remap<
Inp extends Record<string, unknown>,
const Mapping extends { [k in keyof Inp]?: string | null },
>(inp: Inp, mappings: Mapping): Remap<Inp, Mapping> {
let out: any = {};

if (!Object.keys(mappings).length) {
out = inp;
return out;
}

for (const [k, v] of Object.entries(inp)) {
const j = mappings[k];
if (j === null) {
continue;
}
out[j ?? k] = v;
}

return out;
}
40 changes: 37 additions & 3 deletions src/lib/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
*/

import { ZodError } from "zod";
import * as errors from "../models/errors";
import { output, ZodEffects, ZodError, ZodObject, ZodRawShape, ZodTypeAny } from "zod";
import { SDKValidationError } from "../models/errors/sdkvalidationerror";

/**
* Utility function that executes some code which may throw a ZodError. It
Expand All @@ -15,8 +15,42 @@ export function parse<Inp, Out>(rawValue: Inp, fn: (value: Inp) => Out, errorMes
return fn(rawValue);
} catch (err) {
if (err instanceof ZodError) {
throw new errors.SDKValidationError(errorMessage, err, rawValue);
throw new SDKValidationError(errorMessage, err, rawValue);
}
throw err;
}
}

export function collectExtraKeys<
Shape extends ZodRawShape,
Catchall extends ZodTypeAny,
K extends string
>(
obj: ZodObject<Shape, "strip", Catchall>,
extrasKey: K
): ZodEffects<
typeof obj,
output<ZodObject<Shape, "strict">> & {
[k in K]: Record<string, output<Catchall>>;
}
> {
return obj.transform((val) => {
const extras: Record<string, output<Catchall>> = {};
const { shape } = obj;
for (const [key] of Object.entries(val)) {
if (key in shape) {
continue;
}

const v = val[key];
if (typeof v === "undefined") {
continue;
}

extras[key] = v;
delete val[key];
}

return { ...val, [extrasKey]: extras };
});
}
75 changes: 21 additions & 54 deletions src/models/components/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
*/

import { remap as remap$ } from "../../lib/primitives";
import { AddressValidationResults, AddressValidationResults$ } from "./addressvalidationresults";
import * as z from "zod";

Expand Down Expand Up @@ -187,33 +188,16 @@ export namespace Address$ {
test: z.boolean().optional(),
})
.transform((v) => {
return {
...(v.name === undefined ? null : { name: v.name }),
...(v.company === undefined ? null : { company: v.company }),
...(v.street1 === undefined ? null : { street1: v.street1 }),
...(v.street2 === undefined ? null : { street2: v.street2 }),
...(v.street3 === undefined ? null : { street3: v.street3 }),
...(v.street_no === undefined ? null : { streetNo: v.street_no }),
...(v.city === undefined ? null : { city: v.city }),
...(v.state === undefined ? null : { state: v.state }),
...(v.zip === undefined ? null : { zip: v.zip }),
country: v.country,
...(v.phone === undefined ? null : { phone: v.phone }),
...(v.email === undefined ? null : { email: v.email }),
...(v.is_residential === undefined ? null : { isResidential: v.is_residential }),
...(v.metadata === undefined ? null : { metadata: v.metadata }),
...(v.is_complete === undefined ? null : { isComplete: v.is_complete }),
...(v.latitude === undefined ? null : { latitude: v.latitude }),
...(v.longitude === undefined ? null : { longitude: v.longitude }),
...(v.object_created === undefined ? null : { objectCreated: v.object_created }),
...(v.object_id === undefined ? null : { objectId: v.object_id }),
...(v.object_owner === undefined ? null : { objectOwner: v.object_owner }),
...(v.object_updated === undefined ? null : { objectUpdated: v.object_updated }),
...(v.validation_results === undefined
? null
: { validationResults: v.validation_results }),
...(v.test === undefined ? null : { test: v.test }),
};
return remap$(v, {
street_no: "streetNo",
is_residential: "isResidential",
is_complete: "isComplete",
object_created: "objectCreated",
object_id: "objectId",
object_owner: "objectOwner",
object_updated: "objectUpdated",
validation_results: "validationResults",
});
});

export type Outbound = {
Expand Down Expand Up @@ -275,32 +259,15 @@ export namespace Address$ {
test: z.boolean().optional(),
})
.transform((v) => {
return {
...(v.name === undefined ? null : { name: v.name }),
...(v.company === undefined ? null : { company: v.company }),
...(v.street1 === undefined ? null : { street1: v.street1 }),
...(v.street2 === undefined ? null : { street2: v.street2 }),
...(v.street3 === undefined ? null : { street3: v.street3 }),
...(v.streetNo === undefined ? null : { street_no: v.streetNo }),
...(v.city === undefined ? null : { city: v.city }),
...(v.state === undefined ? null : { state: v.state }),
...(v.zip === undefined ? null : { zip: v.zip }),
country: v.country,
...(v.phone === undefined ? null : { phone: v.phone }),
...(v.email === undefined ? null : { email: v.email }),
...(v.isResidential === undefined ? null : { is_residential: v.isResidential }),
...(v.metadata === undefined ? null : { metadata: v.metadata }),
...(v.isComplete === undefined ? null : { is_complete: v.isComplete }),
...(v.latitude === undefined ? null : { latitude: v.latitude }),
...(v.longitude === undefined ? null : { longitude: v.longitude }),
...(v.objectCreated === undefined ? null : { object_created: v.objectCreated }),
...(v.objectId === undefined ? null : { object_id: v.objectId }),
...(v.objectOwner === undefined ? null : { object_owner: v.objectOwner }),
...(v.objectUpdated === undefined ? null : { object_updated: v.objectUpdated }),
...(v.validationResults === undefined
? null
: { validation_results: v.validationResults }),
...(v.test === undefined ? null : { test: v.test }),
};
return remap$(v, {
streetNo: "street_no",
isResidential: "is_residential",
isComplete: "is_complete",
objectCreated: "object_created",
objectId: "object_id",
objectOwner: "object_owner",
objectUpdated: "object_updated",
validationResults: "validation_results",
});
});
}
Loading

0 comments on commit e0bcfec

Please sign in to comment.