inngest 2.5.2-pr-202.8 → 2.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,88 @@
1
1
  # inngest
2
2
 
3
+ ## 2.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#202](https://github.com/inngest/inngest-js/pull/202) [`21053ed`](https://github.com/inngest/inngest-js/commit/21053edeb5a11f2eaa0242d56d36b0aee6ae994f) Thanks [@djfarrelly](https://github.com/djfarrelly)! - Add support for Fastify, either via a custom `.route()` or using a Fastify plugin
8
+
9
+ ```ts
10
+ import Fastify from "fastify";
11
+ import inngestFastify, { serve } from "inngest/fastify";
12
+ import { functions, inngest } from "./inngest";
13
+
14
+ const fastify = Fastify({
15
+ logger: true,
16
+ });
17
+
18
+ // The lead maintainer of Fastify recommends using this as a plugin:
19
+ fastify.register(inngestFastify, {
20
+ client: inngest,
21
+ functions,
22
+ options: {},
23
+ });
24
+
25
+ // We do also export `serve()` if you want to use it directly, though.
26
+ fastify.route({
27
+ method: ["GET", "POST", "PUT"],
28
+ handler: serve(inngest, functions),
29
+ url: "/api/inngest",
30
+ });
31
+
32
+ fastify.listen({ port: 3000 }, function (err, address) {
33
+ if (err) {
34
+ fastify.log.error(err);
35
+ process.exit(1);
36
+ }
37
+ });
38
+ ```
39
+
40
+ - [#298](https://github.com/inngest/inngest-js/pull/298) [`4984aa8`](https://github.com/inngest/inngest-js/commit/4984aa85b97fd7b3d38d4fdcb5559c0ecb4307a3) Thanks [@z.object({](https://github.com/z.object({), [@z.object({](https://github.com/z.object({)! - Add the ability to provide Zod schemas using `z.object()` instead of requiring a record format
41
+
42
+ ```ts
43
+ // Previously we supported this
44
+ new EventSchemas().fromZod({
45
+ "test.event": {
46
+ data: z.object({ a: z.string() }),
47
+ b: z.number() }),
48
+ },
49
+ });
50
+
51
+ // Now we ALSO support this
52
+ new EventSchemas().fromZod([
53
+ z.object({
54
+ name: z.literal("test.event"),
55
+ data: z.object({ a: z.string() }),
56
+ b: z.number() }),
57
+ }),
58
+ ]);
59
+ ```
60
+
61
+ This should help if you wish to declare your events piece-by-piece instead of in a single object.
62
+
63
+ ```ts
64
+ const firstEvent = z.object({
65
+ name: z.literal("app/user.created"),
66
+ data: z.object({ id: z.string() }),
67
+ });
68
+
69
+ const secondEvent = z.object({
70
+ name: z.literal("shop/product.deleted"),
71
+ data: z.object({ id: z.string() }),
72
+ });
73
+
74
+ new EventSchemas().fromZod([firstEvent, secondEvent]);
75
+ ```
76
+
77
+ You can use the exported `LiteralZodEventSchema` type to provide some autocomplete when writing your events, too.
78
+
79
+ ```ts
80
+ const ShopProductOrdered = z.object({
81
+ name: z.literal("shop/product.ordered"),
82
+ data: z.object({ productId: z.string() }),
83
+ }) satisfies LiteralZodEventSchema;
84
+ ```
85
+
3
86
  ## 2.5.2
4
87
 
5
88
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inngest",
3
- "version": "2.5.2-pr-202.8",
3
+ "version": "2.6.0",
4
4
  "description": "Official SDK for Inngest.com",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const version = "2.5.2-pr-202.8";
1
+ export declare const version = "2.6.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,mBAAmB,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,UAAU,CAAC"}
package/version.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // Generated by genversion.
5
- exports.version = "2.5.2-pr-202.8";
5
+ exports.version = "2.6.0";
6
6
  //# sourceMappingURL=version.js.map
package/version.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,gBAAgB,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,OAAO,CAAC"}