Skip to content

Commit

Permalink
Merge pull request #13 from Codehagen/speakeasy-sdk-regen-1717459507
Browse files Browse the repository at this point in the history
chore: 🐝 Update SDK - Generate
  • Loading branch information
Codehagen committed Jun 6, 2024
2 parents 2999df9 + 034b4c2 commit c004b7f
Show file tree
Hide file tree
Showing 16 changed files with 174 additions and 176 deletions.
11 changes: 6 additions & 5 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ id: 6250b250-1f28-403b-a1c6-452ade2211c7
management:
docChecksum: 277eb484dd0b1cc1e11e50240c91e379
docVersion: 1.0.0
speakeasyVersion: 1.299.4
generationVersion: 2.338.7
releaseVersion: 0.1.15
configChecksum: d43c021c32a504c8f923f633cbb78d9b
speakeasyVersion: 1.300.0
generationVersion: 2.338.14
releaseVersion: 0.1.16
configChecksum: 6550b1a1d05e865dc32f8fa00eaa62e0
repoURL: https://github.com/Codehagen/dingify-sdk.git
installationURL: https://github.com/Codehagen/dingify-sdk
published: true
features:
typescript:
additionalDependencies: 0.1.0
core: 3.9.10
core: 3.9.12
globalSecurity: 2.82.9
globalSecurityCallbacks: 0.1.0
globalSecurityFlattening: 0.1.0
Expand All @@ -34,6 +34,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: false
typescript:
version: 0.1.15
version: 0.1.16
additionalDependencies:
dependencies: {}
devDependencies: {}
Expand Down
6 changes: 3 additions & 3 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
speakeasyVersion: 1.299.4
speakeasyVersion: 1.300.0
sources:
sample-source:
sourceNamespace: sample-source
sourceRevisionDigest: sha256:167e96bf3dbf536d708d58590e75573f2e0e5e1fced7db3e6aef0e24f7203b9e
sourceRevisionDigest: sha256:8ec93a27d72b5be37988df1a21934323640a0b424d346ad469df09447941047e
sourceBlobDigest: sha256:cbed9d93c9141a3cb32d5922de1f7db6c4afbe92ac04620db41dea7ea4abf063
tags:
- latest
Expand All @@ -11,7 +11,7 @@ targets:
my-first-target:
source: sample-source
sourceNamespace: sample-source
sourceRevisionDigest: sha256:167e96bf3dbf536d708d58590e75573f2e0e5e1fced7db3e6aef0e24f7203b9e
sourceRevisionDigest: sha256:8ec93a27d72b5be37988df1a21934323640a0b424d346ad469df09447941047e
sourceBlobDigest: sha256:cbed9d93c9141a3cb32d5922de1f7db6c4afbe92ac04620db41dea7ea4abf063
outLocation: /github/workspace/repo
workflow:
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,14 @@ Based on:
### Generated
- [typescript v0.1.15] .
### Releases
- [NPM v0.1.15] https://www.npmjs.com/package/dingify/v/0.1.15 - .
- [NPM v0.1.15] https://www.npmjs.com/package/dingify/v/0.1.15 - .

## 2024-06-06 00:05:16
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.300.0 (2.338.14) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v0.1.16] .
### Releases
- [NPM v0.1.16] https://www.npmjs.com/package/dingify/v/0.1.16 - .
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": "dingify",
"version": "0.1.15",
"version": "0.1.16",
"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": "dingify",
"version": "0.1.15",
"version": "0.1.16",
"author": "Speakeasy",
"main": "./index.js",
"sideEffects": false,
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: "1.0.0",
sdkVersion: "0.1.15",
genVersion: "2.338.7",
userAgent: "speakeasy-sdk/typescript 0.1.15 2.338.7 1.0.0 dingify",
sdkVersion: "0.1.16",
genVersion: "2.338.14",
userAgent: "speakeasy-sdk/typescript 0.1.16 2.338.14 1.0.0 dingify",
} as const;
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 };
});
}
72 changes: 23 additions & 49 deletions src/models/components/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,32 +41,19 @@ export type Event = {

/** @internal */
export namespace Event$ {
export const inboundSchema: z.ZodType<Event, z.ZodTypeDef, unknown> = z
.object({
id: z.string(),
name: z.string(),
channelId: z.string(),
userId: z.string(),
icon: z.string(),
notify: z.boolean(),
tags: z.record(z.string()).optional(),
createdAt: z
.string()
.datetime({ offset: true })
.transform((v) => new Date(v)),
})
.transform((v) => {
return {
id: v.id,
name: v.name,
channelId: v.channelId,
userId: v.userId,
icon: v.icon,
notify: v.notify,
...(v.tags === undefined ? null : { tags: v.tags }),
createdAt: v.createdAt,
};
});
export const inboundSchema: z.ZodType<Event, z.ZodTypeDef, unknown> = z.object({
id: z.string(),
name: z.string(),
channelId: z.string(),
userId: z.string(),
icon: z.string(),
notify: z.boolean(),
tags: z.record(z.string()).optional(),
createdAt: z
.string()
.datetime({ offset: true })
.transform((v) => new Date(v)),
});

export type Outbound = {
id: string;
Expand All @@ -79,27 +66,14 @@ export namespace Event$ {
createdAt: string;
};

export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, Event> = z
.object({
id: z.string(),
name: z.string(),
channelId: z.string(),
userId: z.string(),
icon: z.string(),
notify: z.boolean(),
tags: z.record(z.string()).optional(),
createdAt: z.date().transform((v) => v.toISOString()),
})
.transform((v) => {
return {
id: v.id,
name: v.name,
channelId: v.channelId,
userId: v.userId,
icon: v.icon,
notify: v.notify,
...(v.tags === undefined ? null : { tags: v.tags }),
createdAt: v.createdAt,
};
});
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, Event> = z.object({
id: z.string(),
name: z.string(),
channelId: z.string(),
userId: z.string(),
icon: z.string(),
notify: z.boolean(),
tags: z.record(z.string()).optional(),
createdAt: z.date().transform((v) => v.toISOString()),
});
}
54 changes: 16 additions & 38 deletions src/models/components/eventcreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,14 @@ export type EventCreate = {

/** @internal */
export namespace EventCreate$ {
export const inboundSchema: z.ZodType<EventCreate, z.ZodTypeDef, unknown> = z
.object({
name: z.string(),
channel: z.string(),
userId: z.string(),
icon: z.string().optional(),
notify: z.boolean(),
tags: z.record(z.string()).optional(),
})
.transform((v) => {
return {
name: v.name,
channel: v.channel,
userId: v.userId,
...(v.icon === undefined ? null : { icon: v.icon }),
notify: v.notify,
...(v.tags === undefined ? null : { tags: v.tags }),
};
});
export const inboundSchema: z.ZodType<EventCreate, z.ZodTypeDef, unknown> = z.object({
name: z.string(),
channel: z.string(),
userId: z.string(),
icon: z.string().optional(),
notify: z.boolean(),
tags: z.record(z.string()).optional(),
});

export type Outbound = {
name: string;
Expand All @@ -62,23 +51,12 @@ export namespace EventCreate$ {
tags?: { [k: string]: string } | undefined;
};

export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, EventCreate> = z
.object({
name: z.string(),
channel: z.string(),
userId: z.string(),
icon: z.string().optional(),
notify: z.boolean(),
tags: z.record(z.string()).optional(),
})
.transform((v) => {
return {
name: v.name,
channel: v.channel,
userId: v.userId,
...(v.icon === undefined ? null : { icon: v.icon }),
notify: v.notify,
...(v.tags === undefined ? null : { tags: v.tags }),
};
});
export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, EventCreate> = z.object({
name: z.string(),
channel: z.string(),
userId: z.string(),
icon: z.string().optional(),
notify: z.boolean(),
tags: z.record(z.string()).optional(),
});
}
Loading

0 comments on commit c004b7f

Please sign in to comment.