@dcoder-x/plugin-shared 0.1.9 → 0.1.10
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.
|
@@ -154,7 +154,16 @@ class RouteExtractor {
|
|
|
154
154
|
},
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
// Deduplicate: same path + filePath can appear if multiple router files
|
|
158
|
+
// re-export or nest the same routes (e.g. AppProviders wrapping routerConfig).
|
|
159
|
+
const seen = new Set();
|
|
160
|
+
return results.filter((r) => {
|
|
161
|
+
const key = `${r.path}::${r.filePath}`;
|
|
162
|
+
if (seen.has(key))
|
|
163
|
+
return false;
|
|
164
|
+
seen.add(key);
|
|
165
|
+
return true;
|
|
166
|
+
});
|
|
158
167
|
}
|
|
159
168
|
buildImportMap(ast, fromFile) {
|
|
160
169
|
const map = new Map();
|
|
@@ -24,6 +24,13 @@ export interface SiteComponentRegistryUpload {
|
|
|
24
24
|
effects?: any[];
|
|
25
25
|
contextUsages?: any[];
|
|
26
26
|
}>;
|
|
27
|
+
flows?: Array<{
|
|
28
|
+
name: string;
|
|
29
|
+
start_component: string;
|
|
30
|
+
end_component: string;
|
|
31
|
+
steps: string[];
|
|
32
|
+
user_intent: string;
|
|
33
|
+
}>;
|
|
27
34
|
};
|
|
28
35
|
}
|
|
29
36
|
export declare function mapArtifactsToSiteRegistry(artifacts: PolicyArtifacts, domain: string): SiteComponentRegistryUpload;
|
|
@@ -20,15 +20,28 @@ function mapArtifactsToSiteRegistry(artifacts, domain) {
|
|
|
20
20
|
file: c.filePath,
|
|
21
21
|
stateVariables: c.stateVariables || [],
|
|
22
22
|
interactions: c.interactions || [],
|
|
23
|
-
// Best-effort placeholders: preserve array shape expected by backend.
|
|
24
23
|
conditionalRenders: [],
|
|
25
|
-
effects: (c.interactions || []).map((
|
|
24
|
+
effects: (c.interactions || []).map(() => ({
|
|
26
25
|
dependencies: [],
|
|
27
26
|
asyncCalls: [],
|
|
28
27
|
runsOnMount: false,
|
|
29
28
|
})),
|
|
30
29
|
contextUsages: [],
|
|
31
30
|
}));
|
|
31
|
+
const flows = (artifacts.policy.flows || []).map((f) => {
|
|
32
|
+
// Map internal PolicyFlow -> spec FlowEntry shape.
|
|
33
|
+
// steps[] in PolicyFlow are route paths; use first/last as start/end component.
|
|
34
|
+
const stepTargets = f.steps.map((s) => s.target);
|
|
35
|
+
const startComponent = f.steps[0]?.target ?? f.page;
|
|
36
|
+
const endComponent = f.steps[f.steps.length - 1]?.target ?? f.page;
|
|
37
|
+
return {
|
|
38
|
+
name: f.flowId,
|
|
39
|
+
start_component: startComponent,
|
|
40
|
+
end_component: endComponent,
|
|
41
|
+
steps: stepTargets,
|
|
42
|
+
user_intent: f.intentPatterns?.[0] ?? '',
|
|
43
|
+
};
|
|
44
|
+
});
|
|
32
45
|
return {
|
|
33
46
|
domain,
|
|
34
47
|
components: {
|
|
@@ -36,6 +49,7 @@ function mapArtifactsToSiteRegistry(artifacts, domain) {
|
|
|
36
49
|
generatedAt,
|
|
37
50
|
selectors,
|
|
38
51
|
components,
|
|
52
|
+
...(flows.length > 0 ? { flows } : {}),
|
|
39
53
|
},
|
|
40
54
|
};
|
|
41
55
|
}
|