@contentful/experience-design-system-types 2.37.1-dev-build-5fe4d4be.0 → 2.37.1-dev-build-79a5de01.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/dist/package.json +1 -1
- package/dist/src/handoff/index.d.ts +20 -16
- package/dist/src/handoff/index.js +24 -15
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -34,27 +34,31 @@ declare const ImportHandoffSchema: z.ZodMiniObject<{
|
|
|
34
34
|
"cache-hit": "cache-hit";
|
|
35
35
|
}>;
|
|
36
36
|
}, z.core.$strip>>;
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Present once the CLI has shown the scope gate, saved the decisions and generated the definitions; the wizard then
|
|
39
|
+
* starts at the review screen (or goes straight to pushing when nothing was accepted).
|
|
40
|
+
*/
|
|
41
|
+
generation: z.ZodMiniOptional<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
42
|
+
route: z.ZodMiniLiteral<"review">;
|
|
43
|
+
/** The session the generated definitions are in. The review screen opens it, and saving and pushing read it. */
|
|
44
|
+
sessionId: z.ZodMiniString<string>;
|
|
45
|
+
/** How many components the user accepted at the scope gate. */
|
|
46
|
+
acceptedCount: z.ZodMiniNumber<number>;
|
|
47
|
+
/** How many definitions were generated, which can differ from the accepted count. */
|
|
48
|
+
generatedCount: z.ZodMiniNumber<number>;
|
|
48
49
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
50
|
+
* Whether token mapping was worth running (there were design props that are tokens, and tokens to map them from).
|
|
51
|
+
* The step count the wizard shows depends on it.
|
|
51
52
|
*/
|
|
52
|
-
|
|
53
|
-
}, z.core.$strip
|
|
53
|
+
mapTokensEligible: z.ZodMiniBoolean<boolean>;
|
|
54
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
55
|
+
route: z.ZodMiniLiteral<"push">;
|
|
56
|
+
acceptedCount: z.ZodMiniLiteral<0>;
|
|
57
|
+
}, z.core.$strip>], "route">>;
|
|
54
58
|
}, z.core.$strip>;
|
|
55
59
|
export type ImportHandoff = z.infer<typeof ImportHandoffSchema>;
|
|
56
60
|
export type ExtractionHandoff = NonNullable<ImportHandoff['extraction']>;
|
|
57
|
-
export type
|
|
61
|
+
export type GenerationHandoff = NonNullable<ImportHandoff['generation']>;
|
|
58
62
|
export type ParsedHandoff = {
|
|
59
63
|
ok: true;
|
|
60
64
|
handoff: ImportHandoff;
|
|
@@ -25,27 +25,36 @@ const ExtractionSchema = z.object({
|
|
|
25
25
|
/** The only phases the scope gate can start from. */
|
|
26
26
|
compositionPhase: z.enum(['done', 'cache-hit']),
|
|
27
27
|
});
|
|
28
|
-
const
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
const GenerationSchema = z.discriminatedUnion('route', [
|
|
29
|
+
/** At least one component was accepted: the definitions were generated and the wizard opens the review screen. */
|
|
30
|
+
z.object({
|
|
31
|
+
route: z.literal('review'),
|
|
32
|
+
/** The session the generated definitions are in. The review screen opens it, and saving and pushing read it. */
|
|
33
|
+
sessionId: NonEmpty,
|
|
34
|
+
/** How many components the user accepted at the scope gate. */
|
|
35
|
+
acceptedCount: z.number(),
|
|
36
|
+
/** How many definitions were generated, which can differ from the accepted count. */
|
|
37
|
+
generatedCount: z.number(),
|
|
38
|
+
/**
|
|
39
|
+
* Whether token mapping was worth running (there were design props that are tokens, and tokens to map them from).
|
|
40
|
+
* The step count the wizard shows depends on it.
|
|
41
|
+
*/
|
|
42
|
+
mapTokensEligible: z.boolean(),
|
|
43
|
+
}),
|
|
44
|
+
/** Nothing was accepted: nothing is generated and the wizard goes straight to the push flow, as it always did. */
|
|
45
|
+
z.object({ route: z.literal('push'), acceptedCount: z.literal(0) }),
|
|
46
|
+
]);
|
|
41
47
|
const ImportHandoffSchema = z.object({
|
|
42
48
|
/** The user skipped the credentials screen, so nothing is fetched from or pushed to Contentful. */
|
|
43
49
|
credentialsSkipped: z.boolean(),
|
|
44
50
|
tokens: TokensSchema,
|
|
45
51
|
/** Present once the CLI has run the extraction stage; the wizard then starts at the scope gate. */
|
|
46
52
|
extraction: z.optional(ExtractionSchema),
|
|
47
|
-
/**
|
|
48
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Present once the CLI has shown the scope gate, saved the decisions and generated the definitions; the wizard then
|
|
55
|
+
* starts at the review screen (or goes straight to pushing when nothing was accepted).
|
|
56
|
+
*/
|
|
57
|
+
generation: z.optional(GenerationSchema),
|
|
49
58
|
});
|
|
50
59
|
export function serializeHandoff(handoff) {
|
|
51
60
|
return JSON.stringify(handoff);
|