inngest 2.7.2 → 3.0.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 +46 -0
- package/api/api.js +4 -4
- package/api/schema.d.ts +54 -6
- package/api/schema.d.ts.map +1 -1
- package/api/schema.js +17 -7
- package/api/schema.js.map +1 -1
- package/cloudflare.d.ts +6 -3
- package/cloudflare.d.ts.map +1 -1
- package/cloudflare.js +19 -41
- package/cloudflare.js.map +1 -1
- package/components/EventSchemas.d.ts +1 -12
- package/components/EventSchemas.d.ts.map +1 -1
- package/components/EventSchemas.js.map +1 -1
- package/components/Inngest.d.ts +44 -57
- package/components/Inngest.d.ts.map +1 -1
- package/components/Inngest.js +47 -26
- package/components/Inngest.js.map +1 -1
- package/components/InngestCommHandler.d.ts +156 -198
- package/components/InngestCommHandler.d.ts.map +1 -1
- package/components/InngestCommHandler.js +311 -305
- package/components/InngestCommHandler.js.map +1 -1
- package/components/InngestFunction.d.ts +9 -82
- package/components/InngestFunction.d.ts.map +1 -1
- package/components/InngestFunction.js +21 -413
- package/components/InngestFunction.js.map +1 -1
- package/components/InngestMiddleware.d.ts +37 -26
- package/components/InngestMiddleware.d.ts.map +1 -1
- package/components/InngestMiddleware.js +1 -3
- package/components/InngestMiddleware.js.map +1 -1
- package/components/InngestStepTools.d.ts +69 -37
- package/components/InngestStepTools.d.ts.map +1 -1
- package/components/InngestStepTools.js +34 -95
- package/components/InngestStepTools.js.map +1 -1
- package/components/NonRetriableError.d.ts.map +1 -1
- package/components/NonRetriableError.js +1 -0
- package/components/NonRetriableError.js.map +1 -1
- package/components/RetryAfterError.d.ts +38 -0
- package/components/RetryAfterError.d.ts.map +1 -0
- package/components/RetryAfterError.js +42 -0
- package/components/RetryAfterError.js.map +1 -0
- package/components/execution/InngestExecution.d.ts +72 -0
- package/components/execution/InngestExecution.d.ts.map +1 -0
- package/components/execution/InngestExecution.js +23 -0
- package/components/execution/InngestExecution.js.map +1 -0
- package/components/execution/v0.d.ts +114 -0
- package/components/execution/v0.d.ts.map +1 -0
- package/components/execution/v0.js +394 -0
- package/components/execution/v0.js.map +1 -0
- package/components/execution/v1.d.ts +88 -0
- package/components/execution/v1.d.ts.map +1 -0
- package/components/execution/v1.js +673 -0
- package/components/execution/v1.js.map +1 -0
- package/deno/fresh.d.ts +3 -3
- package/deno/fresh.d.ts.map +1 -1
- package/deno/fresh.js +17 -38
- package/deno/fresh.js.map +1 -1
- package/digitalocean.d.ts +5 -5
- package/digitalocean.d.ts.map +1 -1
- package/digitalocean.js +14 -46
- package/digitalocean.js.map +1 -1
- package/edge.d.ts +5 -5
- package/edge.d.ts.map +1 -1
- package/edge.js +16 -38
- package/edge.js.map +1 -1
- package/express.d.ts +7 -3
- package/express.d.ts.map +1 -1
- package/express.js +38 -45
- package/express.js.map +1 -1
- package/fastify.d.ts +8 -3
- package/fastify.d.ts.map +1 -1
- package/fastify.js +37 -47
- package/fastify.js.map +1 -1
- package/h3.d.ts +4 -3
- package/h3.d.ts.map +1 -1
- package/h3.js +18 -45
- package/h3.js.map +1 -1
- package/helpers/ServerTiming.d.ts.map +1 -1
- package/helpers/ServerTiming.js +2 -1
- package/helpers/ServerTiming.js.map +1 -1
- package/helpers/consts.d.ts +23 -9
- package/helpers/consts.d.ts.map +1 -1
- package/helpers/consts.js +31 -13
- package/helpers/consts.js.map +1 -1
- package/helpers/devserver.d.ts +0 -34
- package/helpers/devserver.d.ts.map +1 -1
- package/helpers/devserver.js.map +1 -1
- package/helpers/env.d.ts +14 -6
- package/helpers/env.d.ts.map +1 -1
- package/helpers/env.js +4 -4
- package/helpers/env.js.map +1 -1
- package/helpers/errors.d.ts +37 -2
- package/helpers/errors.d.ts.map +1 -1
- package/helpers/errors.js +66 -15
- package/helpers/errors.js.map +1 -1
- package/helpers/functions.d.ts +52 -5
- package/helpers/functions.d.ts.map +1 -1
- package/helpers/functions.js +121 -22
- package/helpers/functions.js.map +1 -1
- package/helpers/promises.d.ts +45 -0
- package/helpers/promises.d.ts.map +1 -1
- package/helpers/promises.js +69 -1
- package/helpers/promises.js.map +1 -1
- package/helpers/strings.d.ts +6 -1
- package/helpers/strings.d.ts.map +1 -1
- package/helpers/strings.js +7 -2
- package/helpers/strings.js.map +1 -1
- package/helpers/types.d.ts +5 -17
- package/helpers/types.d.ts.map +1 -1
- package/index.d.ts +4 -2
- package/index.d.ts.map +1 -1
- package/index.js +5 -1
- package/index.js.map +1 -1
- package/lambda.d.ts +10 -8
- package/lambda.d.ts.map +1 -1
- package/lambda.js +48 -72
- package/lambda.js.map +1 -1
- package/next.d.ts +11 -5
- package/next.d.ts.map +1 -1
- package/next.js +84 -103
- package/next.js.map +1 -1
- package/nuxt.d.ts +3 -3
- package/nuxt.d.ts.map +1 -1
- package/nuxt.js +5 -6
- package/nuxt.js.map +1 -1
- package/package.json +5 -4
- package/redwood.d.ts +4 -3
- package/redwood.d.ts.map +1 -1
- package/redwood.js +22 -48
- package/redwood.js.map +1 -1
- package/remix.d.ts +7 -5
- package/remix.d.ts.map +1 -1
- package/remix.js +15 -36
- package/remix.js.map +1 -1
- package/types.d.ts +126 -220
- package/types.d.ts.map +1 -1
- package/types.js +24 -45
- package/types.js.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/helpers/scalar.d.ts +0 -8
- package/helpers/scalar.d.ts.map +0 -1
- package/helpers/scalar.js +0 -19
- package/helpers/scalar.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# inngest
|
|
2
2
|
|
|
3
|
+
## 3.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#294](https://github.com/inngest/inngest-js/pull/294) [`f2f4856`](https://github.com/inngest/inngest-js/commit/f2f4856ab97d4191587ea1f41e9fe18b5ef45c95) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Clients and functions now require IDs
|
|
8
|
+
|
|
9
|
+
When instantiating a client using `new Inngest()` or creating a function via `inngest.createFunction()`, it's now required to pass an `id` instead of a `name`.
|
|
10
|
+
|
|
11
|
+
Previously only `name` was required, but this implied that the value was safe to change. Internally, we used this name to _produce_ an ID which was used during deployments and executions.
|
|
12
|
+
|
|
13
|
+
See the [v3 migration guide](https://www.inngest.com/docs/sdk/migration).
|
|
14
|
+
|
|
15
|
+
- [#294](https://github.com/inngest/inngest-js/pull/294) [`f2f4856`](https://github.com/inngest/inngest-js/commit/f2f4856ab97d4191587ea1f41e9fe18b5ef45c95) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Refactored available environment variables and configuration
|
|
16
|
+
|
|
17
|
+
The arrangement of environment variables available has shifted a lot over the course of v2, so in v3 we've streamlined what's available and how they're used.
|
|
18
|
+
|
|
19
|
+
See the [v3 migration guide](https://www.inngest.com/docs/sdk/migration).
|
|
20
|
+
|
|
21
|
+
- [#294](https://github.com/inngest/inngest-js/pull/294) [`f2f4856`](https://github.com/inngest/inngest-js/commit/f2f4856ab97d4191587ea1f41e9fe18b5ef45c95) Thanks [@jpwilliams](https://github.com/jpwilliams)! - In v2, providing a `fns` option when creating a function -- an object of functions -- would wrap those passed functions in `step.run()`, meaning you can run code inside your function without the `step.run()` boilerplate.
|
|
22
|
+
|
|
23
|
+
This wasn't a very well advertised feature and had some drawbacks, so we're instead replacing it with some optional middleware.
|
|
24
|
+
|
|
25
|
+
See the [v3 migration guide](https://www.inngest.com/docs/sdk/migration).
|
|
26
|
+
|
|
27
|
+
- [#294](https://github.com/inngest/inngest-js/pull/294) [`f2f4856`](https://github.com/inngest/inngest-js/commit/f2f4856ab97d4191587ea1f41e9fe18b5ef45c95) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Serving functions could become a bit unwieldy with the format we had, so we've slightly altered how you serve your functions to ensure proper discoverability of options and aid in readability when revisiting the code.
|
|
28
|
+
|
|
29
|
+
See the [v3 migration guide](https://www.inngest.com/docs/sdk/migration).
|
|
30
|
+
|
|
31
|
+
- [#294](https://github.com/inngest/inngest-js/pull/294) [`f2f4856`](https://github.com/inngest/inngest-js/commit/f2f4856ab97d4191587ea1f41e9fe18b5ef45c95) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Shorthand function creation removed
|
|
32
|
+
|
|
33
|
+
`inngest.createFunction()` can no longer take a string as the first or second arguments; an object is now required to aid in the discoverability of options and configuration.
|
|
34
|
+
|
|
35
|
+
See the [v3 migration guide](https://www.inngest.com/docs/sdk/migration).
|
|
36
|
+
|
|
37
|
+
- [#294](https://github.com/inngest/inngest-js/pull/294) [`f2f4856`](https://github.com/inngest/inngest-js/commit/f2f4856ab97d4191587ea1f41e9fe18b5ef45c95) Thanks [@jpwilliams](https://github.com/jpwilliams)! - All steps require IDs
|
|
38
|
+
|
|
39
|
+
When using any step.\* tool, an ID is now required to ensure that determinism across changes to a function is easier to reason about for the user and the underlying engine.
|
|
40
|
+
|
|
41
|
+
The addition of these IDs allows you to deploy hotfixes and logic changes to long-running functions without fear of errors, failures, or panics. Beforehand, any changes to a function resulted in an irrecoverable error if step definitions changed. With this, changes to a function are smartly applied by default.
|
|
42
|
+
|
|
43
|
+
See the [v3 migration guide](https://www.inngest.com/docs/sdk/migration).
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- [#333](https://github.com/inngest/inngest-js/pull/333) [`67bda66`](https://github.com/inngest/inngest-js/commit/67bda668fa53afeeb3708e3f245843e9612ccd22) Thanks [@goodoldneon](https://github.com/goodoldneon)! - (Internal) Fix missing name on `NonRetriableError`, ensuring it's correctly (de)serialized
|
|
48
|
+
|
|
3
49
|
## 2.7.2
|
|
4
50
|
|
|
5
51
|
### Patch Changes
|
package/api/api.js
CHANGED
|
@@ -28,10 +28,10 @@ class InngestApi {
|
|
|
28
28
|
.then(async (resp) => {
|
|
29
29
|
const data = await resp.json();
|
|
30
30
|
if (resp.ok) {
|
|
31
|
-
return (0, types_1.ok)(schema_1.
|
|
31
|
+
return (0, types_1.ok)(schema_1.stepsSchema.parse(data));
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
|
-
return (0, types_1.err)(schema_1.
|
|
34
|
+
return (0, types_1.err)(schema_1.errorSchema.parse(data));
|
|
35
35
|
}
|
|
36
36
|
})
|
|
37
37
|
.catch((error) => {
|
|
@@ -46,10 +46,10 @@ class InngestApi {
|
|
|
46
46
|
.then(async (resp) => {
|
|
47
47
|
const data = await resp.json();
|
|
48
48
|
if (resp.ok) {
|
|
49
|
-
return (0, types_1.ok)(schema_1.
|
|
49
|
+
return (0, types_1.ok)(schema_1.batchSchema.parse(data));
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
|
-
return (0, types_1.err)(schema_1.
|
|
52
|
+
return (0, types_1.err)(schema_1.errorSchema.parse(data));
|
|
53
53
|
}
|
|
54
54
|
})
|
|
55
55
|
.catch((error) => {
|
package/api/schema.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type EventPayload } from "../types";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const errorSchema: z.ZodObject<{
|
|
4
4
|
error: z.ZodString;
|
|
5
5
|
status: z.ZodNumber;
|
|
6
6
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -10,9 +10,57 @@ export declare const ErrorSchema: z.ZodObject<{
|
|
|
10
10
|
status: number;
|
|
11
11
|
error: string;
|
|
12
12
|
}>;
|
|
13
|
-
export type ErrorResponse = z.infer<typeof
|
|
14
|
-
export declare const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
export type ErrorResponse = z.infer<typeof errorSchema>;
|
|
14
|
+
export declare const stepsSchema: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
15
|
+
type: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"data">>>;
|
|
16
|
+
data: z.ZodEffects<z.ZodAny, any, any>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
type: "data";
|
|
19
|
+
data?: any;
|
|
20
|
+
}, {
|
|
21
|
+
type?: "data" | undefined;
|
|
22
|
+
data?: any;
|
|
23
|
+
}>, z.ZodObject<{
|
|
24
|
+
type: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"error">>>;
|
|
25
|
+
error: z.ZodObject<{
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
message: z.ZodString;
|
|
28
|
+
stack: z.ZodOptional<z.ZodString>;
|
|
29
|
+
cause: z.ZodOptional<z.ZodString>;
|
|
30
|
+
status: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
name: string;
|
|
33
|
+
message: string;
|
|
34
|
+
stack?: string | undefined;
|
|
35
|
+
cause?: string | undefined;
|
|
36
|
+
status?: number | undefined;
|
|
37
|
+
}, {
|
|
38
|
+
name: string;
|
|
39
|
+
message: string;
|
|
40
|
+
stack?: string | undefined;
|
|
41
|
+
cause?: string | undefined;
|
|
42
|
+
status?: number | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
type: "error";
|
|
46
|
+
error: {
|
|
47
|
+
name: string;
|
|
48
|
+
message: string;
|
|
49
|
+
stack?: string | undefined;
|
|
50
|
+
cause?: string | undefined;
|
|
51
|
+
status?: number | undefined;
|
|
52
|
+
};
|
|
53
|
+
}, {
|
|
54
|
+
error: {
|
|
55
|
+
name: string;
|
|
56
|
+
message: string;
|
|
57
|
+
stack?: string | undefined;
|
|
58
|
+
cause?: string | undefined;
|
|
59
|
+
status?: number | undefined;
|
|
60
|
+
};
|
|
61
|
+
type?: "error" | undefined;
|
|
62
|
+
}>]>>>;
|
|
63
|
+
export type StepsResponse = z.infer<typeof stepsSchema>;
|
|
64
|
+
export declare const batchSchema: z.ZodArray<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodAny>, EventPayload, Record<string, any>>, "many">;
|
|
65
|
+
export type BatchResponse = z.infer<typeof batchSchema>;
|
|
18
66
|
//# sourceMappingURL=schema.d.ts.map
|
package/api/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/api/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/api/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAEtE,eAAO,MAAM,WAAW;;;;;;;;;EAGtB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAExD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAgBV,CAAC;AAEf,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAExD,eAAO,MAAM,WAAW,yGAEvB,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
package/api/schema.js
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.batchSchema = exports.stepsSchema = exports.errorSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
exports.errorSchema = zod_1.z.object({
|
|
6
7
|
error: zod_1.z.string(),
|
|
7
8
|
status: zod_1.z.number(),
|
|
8
9
|
});
|
|
9
|
-
exports.
|
|
10
|
-
|
|
11
|
-
.object({
|
|
12
|
-
.
|
|
13
|
-
.
|
|
10
|
+
exports.stepsSchema = zod_1.z
|
|
11
|
+
.record(zod_1.z
|
|
12
|
+
.object({
|
|
13
|
+
type: zod_1.z.literal("data").optional().default("data"),
|
|
14
|
+
data: zod_1.z.any().refine((v) => typeof v !== "undefined", {
|
|
15
|
+
message: "Data in steps must be defined",
|
|
16
|
+
}),
|
|
17
|
+
})
|
|
18
|
+
.or(zod_1.z.object({
|
|
19
|
+
type: zod_1.z.literal("error").optional().default("error"),
|
|
20
|
+
error: types_1.failureEventErrorSchema,
|
|
21
|
+
})))
|
|
22
|
+
.default({});
|
|
23
|
+
exports.batchSchema = zod_1.z.array(zod_1.z.record(zod_1.z.any()).transform((v) => v));
|
|
14
24
|
//# sourceMappingURL=schema.js.map
|
package/api/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/api/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/api/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,oCAAsE;AAEzD,QAAA,WAAW,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC;AAGU,QAAA,WAAW,GAAG,OAAC;KACzB,MAAM,CACL,OAAC;KACE,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;IAClD,IAAI,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,WAAW,EAAE;QACpD,OAAO,EAAE,+BAA+B;KACzC,CAAC;CACH,CAAC;KACD,EAAE,CACD,OAAC,CAAC,MAAM,CAAC;IACP,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;IACpD,KAAK,EAAE,+BAAuB;CAC/B,CAAC,CACH,CACJ;KACA,OAAO,CAAC,EAAE,CAAC,CAAC;AAIF,QAAA,WAAW,GAAG,OAAC,CAAC,KAAK,CAChC,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,GAAG,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAiB,CAAC,CACtD,CAAC"}
|
package/cloudflare.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ServeHandlerOptions } from "./components/InngestCommHandler";
|
|
2
2
|
import { type SupportedFrameworkName } from "./types";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const frameworkName: SupportedFrameworkName;
|
|
4
4
|
/**
|
|
5
5
|
* In Cloudflare, serve and register any declared functions with Inngest, making
|
|
6
6
|
* them available to be triggered by events.
|
|
7
7
|
*
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
|
-
export declare const serve:
|
|
10
|
+
export declare const serve: (options: ServeHandlerOptions) => (args_0: {
|
|
11
|
+
request: Request;
|
|
12
|
+
env: Record<string, string | undefined>;
|
|
13
|
+
}) => Promise<Response>;
|
|
11
14
|
//# sourceMappingURL=cloudflare.d.ts.map
|
package/cloudflare.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudflare.d.ts","sourceRoot":"","sources":["../src/cloudflare.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,
|
|
1
|
+
{"version":3,"file":"cloudflare.d.ts","sourceRoot":"","sources":["../src/cloudflare.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,eAAO,MAAM,aAAa,EAAE,sBAA2C,CAAC;AAExE;;;;;GAKG;AACH,eAAO,MAAM,KAAK,YAAa,mBAAmB;aAenC,OAAO;SACX,OAAO,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;uBAmB5C,CAAC"}
|
package/cloudflare.js
CHANGED
|
@@ -1,58 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.serve = exports.
|
|
3
|
+
exports.serve = exports.frameworkName = void 0;
|
|
4
4
|
const InngestCommHandler_1 = require("./components/InngestCommHandler");
|
|
5
|
-
|
|
6
|
-
exports.name = "cloudflare-pages";
|
|
5
|
+
exports.frameworkName = "cloudflare-pages";
|
|
7
6
|
/**
|
|
8
7
|
* In Cloudflare, serve and register any declared functions with Inngest, making
|
|
9
8
|
* them available to be triggered by events.
|
|
10
9
|
*
|
|
11
10
|
* @public
|
|
12
11
|
*/
|
|
13
|
-
const serve = (
|
|
14
|
-
const handler = new InngestCommHandler_1.InngestCommHandler(
|
|
12
|
+
const serve = (options) => {
|
|
13
|
+
const handler = new InngestCommHandler_1.InngestCommHandler(Object.assign(Object.assign({ frameworkName: exports.frameworkName,
|
|
15
14
|
/**
|
|
16
15
|
* Assume that we want to override the `fetch` implementation with the one
|
|
17
16
|
* globally available in the Cloudflare env. Specifying it here will
|
|
18
17
|
* ensure we avoid trying to load a Node-compatible version later.
|
|
19
18
|
*/
|
|
20
|
-
fetch: fetch.bind(globalThis) },
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
deployId: url.searchParams.get(consts_1.queryKeys.DeployId),
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
run: async () => {
|
|
40
|
-
if (req.method === "POST") {
|
|
41
|
-
return {
|
|
42
|
-
fnId: url.searchParams.get(consts_1.queryKeys.FnId),
|
|
43
|
-
stepId: url.searchParams.get(consts_1.queryKeys.StepId),
|
|
44
|
-
data: (await req.json()),
|
|
45
|
-
signature: req.headers.get(consts_1.headerKeys.Signature) || undefined,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
}, ({ body, status, headers }) => {
|
|
51
|
-
return new Response(body, {
|
|
52
|
-
status,
|
|
53
|
-
headers,
|
|
54
|
-
});
|
|
55
|
-
});
|
|
19
|
+
fetch: fetch.bind(globalThis) }, options), { handler: ({ request: req, env, }) => {
|
|
20
|
+
return {
|
|
21
|
+
body: () => req.json(),
|
|
22
|
+
headers: (key) => req.headers.get(key),
|
|
23
|
+
method: () => req.method,
|
|
24
|
+
env: () => env,
|
|
25
|
+
url: () => new URL(req.url, `https://${req.headers.get("host") || ""}`),
|
|
26
|
+
transformResponse: ({ body, status, headers }) => {
|
|
27
|
+
return new Response(body, {
|
|
28
|
+
status,
|
|
29
|
+
headers,
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
} }));
|
|
56
34
|
return handler.createHandler();
|
|
57
35
|
};
|
|
58
36
|
exports.serve = serve;
|
package/cloudflare.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudflare.js","sourceRoot":"","sources":["../src/cloudflare.ts"],"names":[],"mappings":";;;AAAA,wEAGyC;
|
|
1
|
+
{"version":3,"file":"cloudflare.js","sourceRoot":"","sources":["../src/cloudflare.ts"],"names":[],"mappings":";;;AAAA,wEAGyC;AAG5B,QAAA,aAAa,GAA2B,kBAAkB,CAAC;AAExE;;;;;GAKG;AACI,MAAM,KAAK,GAAG,CAAC,OAA4B,EAAE,EAAE;IACpD,MAAM,OAAO,GAAG,IAAI,uCAAkB,+BACpC,aAAa,EAAb,qBAAa;QAEb;;;;WAIG;QACH,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAC1B,OAAO,KACV,OAAO,EAAE,CAAC,EACR,OAAO,EAAE,GAAG,EACZ,GAAG,GAIJ,EAAE,EAAE;YACH,OAAO;gBACL,IAAI,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE;gBACtB,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;gBACtC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM;gBACxB,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG;gBACd,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;gBACvE,iBAAiB,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;oBAC/C,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE;wBACxB,MAAM;wBACN,OAAO;qBACR,CAAC,CAAC;gBACL,CAAC;aACF,CAAC;QACJ,CAAC,IACD,CAAC;IAEH,OAAO,OAAO,CAAC,aAAa,EAAE,CAAC;AACjC,CAAC,CAAC;AAnCW,QAAA,KAAK,SAmChB"}
|
|
@@ -19,17 +19,6 @@ export type StandardEventSchema = {
|
|
|
19
19
|
* @public
|
|
20
20
|
*/
|
|
21
21
|
export type StandardEventSchemas = Record<string, StandardEventSchema>;
|
|
22
|
-
/**
|
|
23
|
-
* A helper type that ensures users cannot declare a literal Zod schema with
|
|
24
|
-
* an empty string as the event name.
|
|
25
|
-
*
|
|
26
|
-
* @public
|
|
27
|
-
*/
|
|
28
|
-
export type ExcludeEmptyZodLiterals<T> = T extends LiteralZodEventSchemas ? {
|
|
29
|
-
[I in keyof T]: T[I] extends z.ZodObject<infer U extends z.ZodRawShape> ? U extends {
|
|
30
|
-
name: z.ZodLiteral<"">;
|
|
31
|
-
} ? "ERROR: Empty event names are now allowed." : T[I] : never;
|
|
32
|
-
} : T;
|
|
33
22
|
/**
|
|
34
23
|
* A literal Zod schema, which is a Zod schema that has a literal string as the
|
|
35
24
|
* event name. This can be used to create correct Zod schemas outside of the
|
|
@@ -232,6 +221,6 @@ export declare class EventSchemas<S extends Record<string, EventPayload>> {
|
|
|
232
221
|
* });
|
|
233
222
|
* ```
|
|
234
223
|
*/
|
|
235
|
-
fromZod<T extends ZodEventSchemas | LiteralZodEventSchemas>(schemas:
|
|
224
|
+
fromZod<T extends ZodEventSchemas | LiteralZodEventSchemas>(schemas: T): EventSchemas<Combine<S, ZodToStandardSchema<T extends ZodEventSchemas ? T : PickLiterals<T extends LiteralZodEventSchemas ? { [I in keyof T as GetName<T[I]>]: InferZodShape<T[I]>; } : T extends ZodEventSchemas ? T : never>>>>;
|
|
236
225
|
}
|
|
237
226
|
//# sourceMappingURL=EventSchemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventSchemas.d.ts","sourceRoot":"","sources":["../../src/components/EventSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAEhC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE3B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,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AS;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,mBAAmB;;;IAWjE;;;;;;;;;;;;;;;;;;OAkBG;IACI,OAAO,CAAC,CAAC,SAAS,eAAe,GAAG,sBAAsB,EAE/D,OAAO,EAAE,CAAC;CAWb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventSchemas.js","sourceRoot":"","sources":["../../src/components/EventSchemas.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"EventSchemas.js","sourceRoot":"","sources":["../../src/components/EventSchemas.ts"],"names":[],"mappings":";;;AA6JA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,YAAY;IACvB;;OAEG;IACI,aAAa;QAClB,OAAO,IAAI,YAAY,EAAiB,CAAC;IAC3C,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACI,UAAU;QACf,OAAO,IAAI,YAAY,EAAiB,CAAC;IAC3C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACI,SAAS;QACd,OAAO,IAAI,YAAY,EAOpB,CAAC;IACN,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACI,OAAO;IACZ,6DAA6D;IAC7D,OAAU;QAEV,OAAO,IAAI,YAAY,EAOpB,CAAC;IACN,CAAC;CACF;AApGD,oCAoGC"}
|
package/components/Inngest.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ExclusiveKeys, type SendEventPayload } from "../helpers/types";
|
|
2
2
|
import { type Logger } from "../middleware/logger";
|
|
3
|
-
import { type ClientOptions, type EventNameFromTrigger, type EventPayload, type FailureEventArgs, type FunctionOptions, type FunctionTrigger, type Handler, type MiddlewareStack, type
|
|
3
|
+
import { type ClientOptions, type EventNameFromTrigger, type EventPayload, type FailureEventArgs, type FunctionOptions, type FunctionTrigger, type Handler, type MiddlewareStack, type SendEventOutput, type TriggerOptions } from "../types";
|
|
4
4
|
import { type EventSchemas } from "./EventSchemas";
|
|
5
5
|
import { InngestFunction } from "./InngestFunction";
|
|
6
6
|
import { InngestMiddleware, type ExtendWithMiddleware } from "./InngestMiddleware";
|
|
@@ -11,6 +11,7 @@ import { InngestMiddleware, type ExtendWithMiddleware } from "./InngestMiddlewar
|
|
|
11
11
|
* @public
|
|
12
12
|
*/
|
|
13
13
|
export type EventsFromOpts<TOpts extends ClientOptions> = TOpts["schemas"] extends EventSchemas<infer U> ? U : Record<string, EventPayload>;
|
|
14
|
+
export type AnyInngest = Inngest<any>;
|
|
14
15
|
/**
|
|
15
16
|
* A client used to interact with the Inngest API by sending or reacting to
|
|
16
17
|
* events.
|
|
@@ -36,23 +37,24 @@ export type EventsFromOpts<TOpts extends ClientOptions> = TOpts["schemas"] exten
|
|
|
36
37
|
export declare class Inngest<TOpts extends ClientOptions = ClientOptions> {
|
|
37
38
|
#private;
|
|
38
39
|
/**
|
|
39
|
-
* The
|
|
40
|
+
* The ID of this instance, most commonly a reference to the application it
|
|
40
41
|
* resides in.
|
|
42
|
+
*
|
|
43
|
+
* The ID of your client should remain the same for its lifetime; if you'd
|
|
44
|
+
* like to change the name of your client as it appears in the Inngest UI,
|
|
45
|
+
* change the `name` property instead.
|
|
41
46
|
*/
|
|
42
|
-
readonly
|
|
47
|
+
readonly id: string;
|
|
43
48
|
/**
|
|
44
49
|
* Inngest event key, used to send events to Inngest Cloud.
|
|
45
50
|
*/
|
|
46
51
|
private eventKey;
|
|
47
|
-
|
|
48
|
-
* Base URL for Inngest Cloud.
|
|
49
|
-
*/
|
|
50
|
-
readonly inngestBaseUrl: URL;
|
|
52
|
+
private readonly baseUrl;
|
|
51
53
|
private readonly inngestApi;
|
|
52
54
|
/**
|
|
53
55
|
* The absolute URL of the Inngest Cloud API.
|
|
54
56
|
*/
|
|
55
|
-
private
|
|
57
|
+
private sendEventUrl;
|
|
56
58
|
private readonly headers;
|
|
57
59
|
private readonly fetch;
|
|
58
60
|
private readonly logger;
|
|
@@ -81,7 +83,7 @@ export declare class Inngest<TOpts extends ClientOptions = ClientOptions> {
|
|
|
81
83
|
* });
|
|
82
84
|
* ```
|
|
83
85
|
*/
|
|
84
|
-
constructor({
|
|
86
|
+
constructor({ id, eventKey, baseUrl, fetch, env, logger, middleware, }: TOpts);
|
|
85
87
|
/**
|
|
86
88
|
* Initialize all passed middleware, running the `register` function on each
|
|
87
89
|
* in sequence and returning the requested hook registrations.
|
|
@@ -126,41 +128,8 @@ export declare class Inngest<TOpts extends ClientOptions = ClientOptions> {
|
|
|
126
128
|
* });
|
|
127
129
|
* ```
|
|
128
130
|
*/
|
|
129
|
-
send<Payload extends SendEventPayload<EventsFromOpts<TOpts>>>(payload: Payload): Promise<
|
|
130
|
-
createFunction<
|
|
131
|
-
/**
|
|
132
|
-
* Pass in an object of functions that will be wrapped in Inngest
|
|
133
|
-
* tooling and passes to your handler. This wrapping ensures that each
|
|
134
|
-
* function is automatically separated and retried.
|
|
135
|
-
*
|
|
136
|
-
* @example
|
|
137
|
-
*
|
|
138
|
-
* Both examples behave the same; it's preference as to which you
|
|
139
|
-
* prefer.
|
|
140
|
-
*
|
|
141
|
-
* ```ts
|
|
142
|
-
* import { userDb } from "./db";
|
|
143
|
-
*
|
|
144
|
-
* // Specify `fns` and be able to use them in your Inngest function
|
|
145
|
-
* inngest.createFunction(
|
|
146
|
-
* { name: "Create user from PR", fns: { ...userDb } },
|
|
147
|
-
* { event: "github/pull_request" },
|
|
148
|
-
* async ({ fns: { createUser } }) => {
|
|
149
|
-
* await createUser("Alice");
|
|
150
|
-
* }
|
|
151
|
-
* );
|
|
152
|
-
*
|
|
153
|
-
* // Or always use `run()` to run inline steps and use them directly
|
|
154
|
-
* inngest.createFunction(
|
|
155
|
-
* { name: "Create user from PR" },
|
|
156
|
-
* { event: "github/pull_request" },
|
|
157
|
-
* async ({ step: { run } }) => {
|
|
158
|
-
* await run("createUser", () => userDb.createUser("Alice"));
|
|
159
|
-
* }
|
|
160
|
-
* );
|
|
161
|
-
* ```
|
|
162
|
-
*/
|
|
163
|
-
fns?: TFns;
|
|
131
|
+
send<Payload extends SendEventPayload<EventsFromOpts<TOpts>>>(payload: Payload): Promise<SendEventOutput<TOpts>>;
|
|
132
|
+
createFunction<TMiddleware extends MiddlewareStack, TTrigger extends TriggerOptions<keyof EventsFromOpts<TOpts> & string>, TTriggerName extends keyof EventsFromOpts<TOpts> & string = EventNameFromTrigger<EventsFromOpts<TOpts>, TTrigger>>(options: ExclusiveKeys<Omit<FunctionOptions<EventsFromOpts<TOpts>, TTriggerName>, "onFailure" | "middleware"> & {
|
|
164
133
|
/**
|
|
165
134
|
* Provide a function to be called if your function fails, meaning
|
|
166
135
|
* that it ran out of retries and was unable to complete successfully.
|
|
@@ -169,16 +138,35 @@ export declare class Inngest<TOpts extends ClientOptions = ClientOptions> {
|
|
|
169
138
|
* after a failure and supports all the same functionality as a
|
|
170
139
|
* regular handler.
|
|
171
140
|
*/
|
|
172
|
-
onFailure?: Handler<TOpts, EventsFromOpts<TOpts>, TTriggerName,
|
|
141
|
+
onFailure?: Handler<TOpts, EventsFromOpts<TOpts>, TTriggerName, ExtendWithMiddleware<[
|
|
173
142
|
typeof builtInMiddleware,
|
|
174
143
|
NonNullable<TOpts["middleware"]>,
|
|
175
144
|
TMiddleware
|
|
176
145
|
], FailureEventArgs<EventsFromOpts<TOpts>[TTriggerName]>>>;
|
|
177
146
|
/**
|
|
178
|
-
*
|
|
147
|
+
* Define a set of middleware that can be registered to hook into
|
|
148
|
+
* various lifecycles of the SDK and affect input and output of
|
|
149
|
+
* Inngest functionality.
|
|
150
|
+
*
|
|
151
|
+
* See {@link https://innge.st/middleware}
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
*
|
|
155
|
+
* ```ts
|
|
156
|
+
* export const inngest = new Inngest({
|
|
157
|
+
* middleware: [
|
|
158
|
+
* new InngestMiddleware({
|
|
159
|
+
* name: "My Middleware",
|
|
160
|
+
* init: () => {
|
|
161
|
+
* // ...
|
|
162
|
+
* }
|
|
163
|
+
* })
|
|
164
|
+
* ]
|
|
165
|
+
* });
|
|
166
|
+
* ```
|
|
179
167
|
*/
|
|
180
168
|
middleware?: TMiddleware;
|
|
181
|
-
}, "batchEvents", "cancelOn" | "rateLimit">, trigger: TTrigger, handler: Handler<TOpts, EventsFromOpts<TOpts>, TTriggerName,
|
|
169
|
+
}, "batchEvents", "cancelOn" | "rateLimit">, trigger: TTrigger, handler: Handler<TOpts, EventsFromOpts<TOpts>, TTriggerName, ExtendWithMiddleware<[
|
|
182
170
|
typeof builtInMiddleware,
|
|
183
171
|
NonNullable<TOpts["middleware"]>,
|
|
184
172
|
TMiddleware
|
|
@@ -195,22 +183,22 @@ export declare class Inngest<TOpts extends ClientOptions = ClientOptions> {
|
|
|
195
183
|
* If this is moved, please ensure that using this package in another project
|
|
196
184
|
* can correctly access comments on mutated input and output.
|
|
197
185
|
*/
|
|
198
|
-
declare const builtInMiddleware: [InngestMiddleware<{
|
|
186
|
+
export declare const builtInMiddleware: [InngestMiddleware<{
|
|
199
187
|
name: string;
|
|
200
188
|
init({ client }: {
|
|
201
|
-
client:
|
|
202
|
-
fn?: InngestFunction
|
|
189
|
+
client: AnyInngest;
|
|
190
|
+
fn?: import("./InngestFunction").AnyInngestFunction | undefined;
|
|
203
191
|
}): {
|
|
204
192
|
onFunctionRun(arg: Readonly<import("type-fest").Simplify<Omit<Readonly<{
|
|
205
|
-
ctx: Record<string, unknown> & Readonly<import("../types").BaseContext<ClientOptions, string
|
|
206
|
-
steps: Readonly<
|
|
193
|
+
ctx: Record<string, unknown> & Readonly<import("../types").BaseContext<ClientOptions, string>>;
|
|
194
|
+
steps: Readonly<{
|
|
195
|
+
id: string;
|
|
207
196
|
data?: any;
|
|
208
197
|
error?: any;
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
fn: InngestFunction<any, any, any, any>;
|
|
198
|
+
}>[];
|
|
199
|
+
fn: import("./InngestFunction").AnyInngestFunction;
|
|
212
200
|
}>, "ctx"> & {
|
|
213
|
-
ctx: Pick<Record<string, unknown> & Readonly<import("../types").BaseContext<ClientOptions, string
|
|
201
|
+
ctx: Pick<Record<string, unknown> & Readonly<import("../types").BaseContext<ClientOptions, string>>, "event" | "runId">;
|
|
214
202
|
}>>): {
|
|
215
203
|
transformInput(): {
|
|
216
204
|
ctx: {
|
|
@@ -230,5 +218,4 @@ declare const builtInMiddleware: [InngestMiddleware<{
|
|
|
230
218
|
};
|
|
231
219
|
};
|
|
232
220
|
}>];
|
|
233
|
-
export {};
|
|
234
221
|
//# sourceMappingURL=Inngest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Inngest.d.ts","sourceRoot":"","sources":["../../src/components/Inngest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Inngest.d.ts","sourceRoot":"","sources":["../../src/components/Inngest.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAA8B,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,eAAe,EAEpB,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,iBAAiB,EAEjB,KAAK,oBAAoB,EAK1B,MAAM,qBAAqB,CAAC;AAO7B;;;;;GAKG;AACH,MAAM,MAAM,cAAc,CAAC,KAAK,SAAS,aAAa,IACpD,KAAK,CAAC,SAAS,CAAC,SAAS,YAAY,CAAC,MAAM,CAAC,CAAC,GAC1C,CAAC,GACD,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