@liria24/og-image 1.0.0 → 1.0.1

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.
@@ -0,0 +1,30 @@
1
+ //#region src/client.d.ts
2
+ type Presets = 'avatio';
3
+ interface PresetVersions {
4
+ avatio: 'v1';
5
+ }
6
+ interface RequestOgImageOptions<TProps = unknown> {
7
+ /**
8
+ * @default https://og.liria.me
9
+ */
10
+ endpoint?: string;
11
+ /**
12
+ * @default process.env.OG_IMAGE_SECRET
13
+ */
14
+ secret?: string;
15
+ preset: Presets;
16
+ version: PresetVersions[Presets];
17
+ props: TProps;
18
+ }
19
+ interface IssueImageResponse {
20
+ url: string;
21
+ }
22
+ declare const requestOgImage: ({
23
+ preset,
24
+ version,
25
+ props,
26
+ endpoint,
27
+ secret
28
+ }: RequestOgImageOptions) => Promise<IssueImageResponse>;
29
+ //#endregion
30
+ export { IssueImageResponse, RequestOgImageOptions, requestOgImage };
@@ -0,0 +1,14 @@
1
+ import { ofetch } from "ofetch";
2
+ //#region src/client.ts
3
+ const requestOgImage = async ({ preset, version, props, endpoint = "https://og.liria.me", secret = process.env.OG_IMAGE_SECRET || "" }) => ofetch(`/images/${encodeURIComponent(preset)}/${encodeURIComponent(version)}`, {
4
+ baseURL: endpoint,
5
+ method: "POST",
6
+ headers: { "content-type": "application/json" },
7
+ body: {
8
+ secret,
9
+ props
10
+ },
11
+ retry: 3
12
+ });
13
+ //#endregion
14
+ export { requestOgImage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liria24/og-image",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "OG image generation server",
5
5
  "bugs": {
6
6
  "url": "https://github.com/liria24/og-image/issues"
@@ -11,6 +11,9 @@
11
11
  "type": "git",
12
12
  "url": "git+https://github.com/liria24/og-image.git"
13
13
  },
14
+ "files": [
15
+ "dist"
16
+ ],
14
17
  "type": "module",
15
18
  "exports": {
16
19
  ".": {
package/bump.config.ts DELETED
@@ -1,9 +0,0 @@
1
- import { defineConfig } from 'bumpp'
2
-
3
- export default defineConfig({
4
- release: 'prompt',
5
- commit: true,
6
- tag: true,
7
- push: true,
8
- files: ['package.json'],
9
- })