@frogbotai/piece-qrcode 0.21.0 → 0.23.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.
- package/README.md +19 -0
- package/dist/index.d.ts +36 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -18
- package/dist/index.js.map +1 -1
- package/package.json +7 -5
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# `@frogbotai/piece-qrcode`
|
|
2
|
+
|
|
3
|
+
Create QR code PNG images from text and save them to FrogBot files.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { createQrCode } from '@frogbotai/piece-qrcode';
|
|
9
|
+
|
|
10
|
+
export const qrCode = createQrCode();
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Actions
|
|
14
|
+
|
|
15
|
+
| Upstream action slug | Previous wrapper export | Native action | Notes |
|
|
16
|
+
| -------------------- | ----------------------- | -------------- | ---------------------------------------------------- |
|
|
17
|
+
| `text_to_qrcode` | `textToQrcode` | `createQrCode` | Returns saved file metadata instead of only its URL. |
|
|
18
|
+
|
|
19
|
+
The upstream piece has no triggers.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,37 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { type PieceRunArgs } from 'frogbot/pieces';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
|
+
text: z.ZodString;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export declare const createQrCode: import("frogbot/pieces").PieceFactory<{
|
|
7
|
+
readonly slug: "qrcode";
|
|
8
|
+
readonly label: "QR Code";
|
|
9
|
+
readonly admin: {
|
|
10
|
+
readonly description: "Create QR code images from text";
|
|
11
|
+
readonly group: "Core";
|
|
12
|
+
};
|
|
13
|
+
readonly actions: readonly [{
|
|
14
|
+
slug: string;
|
|
15
|
+
description: string;
|
|
16
|
+
input: z.ZodObject<{
|
|
17
|
+
text: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
output: z.ZodObject<{
|
|
20
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
21
|
+
name: z.ZodLiteral<"qr-code.png">;
|
|
22
|
+
mimeType: z.ZodLiteral<"image/png">;
|
|
23
|
+
size: z.ZodNumber;
|
|
24
|
+
url: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
idempotent: boolean;
|
|
27
|
+
run({ input, req }: PieceRunArgs<z.output<typeof inputSchema>, object, undefined>): Promise<{
|
|
28
|
+
id: string | number;
|
|
29
|
+
name: string;
|
|
30
|
+
mimeType: string;
|
|
31
|
+
size: number;
|
|
32
|
+
url: string | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
}];
|
|
35
|
+
}>;
|
|
36
|
+
export {};
|
|
8
37
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,WAAW;;iBAEf,CAAC;AAiDH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;4BAjCG,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,WAAW,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC;;;;;;;;EAyCvF,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,55 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { definePiece } from 'frogbot/pieces';
|
|
2
|
+
import { toBuffer } from 'qrcode';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
const inputSchema = z.object({
|
|
5
|
+
text: z.string().min(1).meta({ label: 'Content' }),
|
|
6
|
+
});
|
|
7
|
+
const outputSchema = z.object({
|
|
8
|
+
id: z.union([z.string().min(1), z.number()]),
|
|
9
|
+
name: z.literal('qr-code.png'),
|
|
10
|
+
mimeType: z.literal('image/png'),
|
|
11
|
+
size: z.number().int().positive(),
|
|
12
|
+
url: z.string().min(1).optional(),
|
|
13
|
+
});
|
|
14
|
+
const createQrCodeAction = {
|
|
15
|
+
slug: 'createQrCode',
|
|
16
|
+
description: 'Create a QR code image from text.',
|
|
17
|
+
input: inputSchema,
|
|
18
|
+
output: outputSchema,
|
|
19
|
+
idempotent: false,
|
|
20
|
+
async run({ input, req }) {
|
|
21
|
+
const collection = req.frogbot.config.files?.slug;
|
|
22
|
+
if (!collection) {
|
|
23
|
+
throw new Error('[frogbot] QR Code requires the files collection.');
|
|
24
|
+
}
|
|
25
|
+
req.signal?.throwIfAborted();
|
|
26
|
+
const data = await toBuffer(input.text);
|
|
27
|
+
const name = 'qr-code.png';
|
|
28
|
+
const mimeType = 'image/png';
|
|
29
|
+
req.signal?.throwIfAborted();
|
|
30
|
+
const file = await req.frogbot.create({
|
|
31
|
+
collection,
|
|
32
|
+
data: {},
|
|
33
|
+
file: { data, name, mimetype: mimeType, size: data.length },
|
|
34
|
+
req,
|
|
35
|
+
overrideAccess: false,
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
id: file.id,
|
|
39
|
+
name,
|
|
40
|
+
mimeType,
|
|
41
|
+
size: data.length,
|
|
42
|
+
url: typeof file.url === 'string' ? file.url : undefined,
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
export const createQrCode = definePiece({
|
|
47
|
+
slug: 'qrcode',
|
|
48
|
+
label: 'QR Code',
|
|
49
|
+
admin: {
|
|
50
|
+
description: 'Create QR code images from text',
|
|
51
|
+
group: 'Core',
|
|
52
|
+
},
|
|
53
|
+
actions: [createQrCodeAction],
|
|
54
|
+
});
|
|
19
55
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;CACnD,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;IAC9B,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IAChC,IAAI,E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K,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS;SACzD,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC;IACtC,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE;QACL,WAAW,EAAE,iCAAiC;QAC9C,KAAK,EAAE,MAAM;KACd;IACD,OAAO,EAAE,CAAC,kBAAkB,CAAC;CAC9B,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frogbotai/piece-qrcode",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.23.0",
|
|
4
|
+
"description": "qrcode tools for FrogBot.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Colby Gilbert",
|
|
7
7
|
"type": "module",
|
|
@@ -19,14 +19,16 @@
|
|
|
19
19
|
],
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"
|
|
22
|
+
"qrcode": "1.5.4",
|
|
23
|
+
"zod": "^4.3.6"
|
|
23
24
|
},
|
|
24
25
|
"peerDependencies": {
|
|
25
|
-
"frogbot": "0.
|
|
26
|
+
"frogbot": "0.23.0"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
29
|
+
"@types/qrcode": "1.5.5",
|
|
28
30
|
"typescript": "5.6.2",
|
|
29
|
-
"frogbot": "0.
|
|
31
|
+
"frogbot": "0.23.0"
|
|
30
32
|
},
|
|
31
33
|
"publishConfig": {
|
|
32
34
|
"access": "public"
|