@vectoriox/iox-ui 5.49.0 → 5.50.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/fesm2022/vectoriox-iox-ui-generation-core.mjs +124 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +12 -2
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/generation-core/index.d.ts +192 -2
- package/harness-core/index.d.ts +18 -3
- package/package.json +1 -1
- package/src/generation-core/public-api.ts +1 -0
- package/src/generation-core/site-build-run.ts +236 -0
- package/src/harness-core/public-api.ts +1 -0
- package/src/harness-core/structure.ts +23 -0
|
@@ -2815,5 +2815,195 @@ interface PageData {
|
|
|
2815
2815
|
/** One entry per page of the plan, in plan order. */
|
|
2816
2816
|
declare function describePlanData(plan: SitePlan): PageData[];
|
|
2817
2817
|
|
|
2818
|
-
|
|
2819
|
-
|
|
2818
|
+
/**
|
|
2819
|
+
* A site build's WIRE vocabulary (AI plan §3b, W2): what iox-cms's `site-builds` API answers and what every
|
|
2820
|
+
* client of it reads — the run's statuses and steps, what it created, why Undo kept something, the preflight's
|
|
2821
|
+
* refusals, and the one spelling of each document's `buildKey`. ONE definition: iox-cms stores and answers it,
|
|
2822
|
+
* the website wizard (W3) polls it. Pure types, enums and helpers; no transport.
|
|
2823
|
+
*/
|
|
2824
|
+
declare enum SiteBuildKind {
|
|
2825
|
+
Build = "build"
|
|
2826
|
+
}
|
|
2827
|
+
declare enum SiteBuildStatus {
|
|
2828
|
+
Running = "running",
|
|
2829
|
+
Done = "done",
|
|
2830
|
+
Failed = "failed",
|
|
2831
|
+
Undoing = "undoing",
|
|
2832
|
+
Undone = "undone"
|
|
2833
|
+
}
|
|
2834
|
+
/** The statuses a runner advances — and the ones that hold the org's single-run slot. */
|
|
2835
|
+
declare const ACTIVE_BUILD_STATUSES: ReadonlyArray<SiteBuildStatus>;
|
|
2836
|
+
/** The steps of a build, in the order they run. */
|
|
2837
|
+
declare enum BuildStep {
|
|
2838
|
+
Preflight = "preflight",
|
|
2839
|
+
ContentTypes = "content-types",
|
|
2840
|
+
SampleImages = "sample-images",
|
|
2841
|
+
Items = "items",
|
|
2842
|
+
DataSources = "data-sources",
|
|
2843
|
+
Pages = "pages",
|
|
2844
|
+
Globals = "globals",
|
|
2845
|
+
Look = "look"
|
|
2846
|
+
}
|
|
2847
|
+
declare const BUILD_STEPS: ReadonlyArray<BuildStep>;
|
|
2848
|
+
declare enum StepState {
|
|
2849
|
+
Wait = "wait",
|
|
2850
|
+
Run = "run",
|
|
2851
|
+
Done = "done",
|
|
2852
|
+
Failed = "failed"
|
|
2853
|
+
}
|
|
2854
|
+
/** What a build creates, as Undo walks it. */
|
|
2855
|
+
declare enum CreatedKind {
|
|
2856
|
+
ContentType = "content-type",
|
|
2857
|
+
SampleImage = "sample-image",
|
|
2858
|
+
Item = "item",
|
|
2859
|
+
DataSource = "data-source",
|
|
2860
|
+
Page = "page",
|
|
2861
|
+
Global = "global",
|
|
2862
|
+
Look = "look"
|
|
2863
|
+
}
|
|
2864
|
+
/** Why Undo left something in place. */
|
|
2865
|
+
declare enum KeptReason {
|
|
2866
|
+
Edited = "edited",
|
|
2867
|
+
Published = "published",
|
|
2868
|
+
InUse = "in-use"
|
|
2869
|
+
}
|
|
2870
|
+
interface BuildStepError {
|
|
2871
|
+
code: string;
|
|
2872
|
+
detail: string;
|
|
2873
|
+
}
|
|
2874
|
+
interface BuildStepRecord {
|
|
2875
|
+
key: BuildStep;
|
|
2876
|
+
state: StepState;
|
|
2877
|
+
attempts: number;
|
|
2878
|
+
startedAt?: Date | string;
|
|
2879
|
+
finishedAt?: Date | string;
|
|
2880
|
+
error?: BuildStepError;
|
|
2881
|
+
}
|
|
2882
|
+
interface CreatedRecord {
|
|
2883
|
+
kind: CreatedKind;
|
|
2884
|
+
/** The document id — a page / item / content-type `_id`, a data-source alias, a global node id, a storage key. */
|
|
2885
|
+
id: string;
|
|
2886
|
+
buildKey: string;
|
|
2887
|
+
/** sha256 of the document as the build left it. */
|
|
2888
|
+
fingerprint: string;
|
|
2889
|
+
/** An item's content type. */
|
|
2890
|
+
contentType?: string;
|
|
2891
|
+
/** A sample image's public URL — what items and pages reference. */
|
|
2892
|
+
url?: string;
|
|
2893
|
+
}
|
|
2894
|
+
interface UndoKept {
|
|
2895
|
+
kind: CreatedKind;
|
|
2896
|
+
id: string;
|
|
2897
|
+
reason: KeptReason;
|
|
2898
|
+
/** In plain words, for the screen ("About", "Sample project 2"). */
|
|
2899
|
+
label?: string;
|
|
2900
|
+
}
|
|
2901
|
+
interface UndoRecord {
|
|
2902
|
+
at: Date | string;
|
|
2903
|
+
removed: number;
|
|
2904
|
+
kept: UndoKept[];
|
|
2905
|
+
/** The undo steps already done (kinds), so a resumed undo does not redo them. */
|
|
2906
|
+
done: CreatedKind[];
|
|
2907
|
+
finishedAt?: Date | string;
|
|
2908
|
+
/** What stopped the undo — DELETE again carries on from the kind it stopped at. */
|
|
2909
|
+
error?: BuildStepError;
|
|
2910
|
+
}
|
|
2911
|
+
declare enum BuildNoticeCode {
|
|
2912
|
+
/** Storage is not configured: sample items get the empty image box, and the run says so. */
|
|
2913
|
+
NoStorage = "no-storage"
|
|
2914
|
+
}
|
|
2915
|
+
interface BuildNotice {
|
|
2916
|
+
code: string;
|
|
2917
|
+
detail: string;
|
|
2918
|
+
}
|
|
2919
|
+
/** The run as `GET …/site-builds/:id` (and `?latest=1`) answers it. */
|
|
2920
|
+
interface SiteBuildRun {
|
|
2921
|
+
_id: string;
|
|
2922
|
+
organization: string;
|
|
2923
|
+
kind: SiteBuildKind;
|
|
2924
|
+
source: SitePlanSource;
|
|
2925
|
+
plan: SitePlan;
|
|
2926
|
+
year: number;
|
|
2927
|
+
status: SiteBuildStatus;
|
|
2928
|
+
active?: boolean;
|
|
2929
|
+
steps: BuildStepRecord[];
|
|
2930
|
+
created: CreatedRecord[];
|
|
2931
|
+
placeholders: ComposedPlaceholder[];
|
|
2932
|
+
issues: ComposeIssue[];
|
|
2933
|
+
notices?: BuildNotice[];
|
|
2934
|
+
requestedBy: string;
|
|
2935
|
+
startedAt: Date | string;
|
|
2936
|
+
finishedAt?: Date | string;
|
|
2937
|
+
undo?: UndoRecord;
|
|
2938
|
+
}
|
|
2939
|
+
/** `GET …/site-builds/:id/undo`: what an Undo would remove and keep — never guessed in the browser. */
|
|
2940
|
+
interface UndoPreview {
|
|
2941
|
+
removes: Partial<Record<CreatedKind, number>>;
|
|
2942
|
+
kept: UndoKept[];
|
|
2943
|
+
restoresGlobals: string[];
|
|
2944
|
+
revertsLook: boolean;
|
|
2945
|
+
}
|
|
2946
|
+
declare enum PreflightRefusalCode {
|
|
2947
|
+
/** The Site Plan itself is invalid (`validateSitePlan`); `issue` is the validator's code. */
|
|
2948
|
+
InvalidPlan = "invalid-plan",
|
|
2949
|
+
/** A route the plan wants is already a page of this organization. */
|
|
2950
|
+
RouteTaken = "route-taken",
|
|
2951
|
+
/** A content type of that name exists in this instance (content types are instance-wide). */
|
|
2952
|
+
ContentTypeTaken = "content-type-taken",
|
|
2953
|
+
/** The name may not be a content type (a platform collection, or not a valid name). */
|
|
2954
|
+
ContentTypeName = "content-type-name",
|
|
2955
|
+
/** Content types act on the whole instance: only the instance owner may create them (SEC1). */
|
|
2956
|
+
ContentTypesNeedInstanceOwner = "content-types-need-instance-owner",
|
|
2957
|
+
/** The org library holds the alias with a different definition. */
|
|
2958
|
+
DataSourceConflict = "data-source-conflict",
|
|
2959
|
+
/** The studio has pages AND a header/footer: replace or keep them is the caller's choice (D7). */
|
|
2960
|
+
GlobalsNeedDecision = "globals-need-decision",
|
|
2961
|
+
/** A global the plan adds has the id of one the studio keeps. */
|
|
2962
|
+
GlobalTaken = "global-taken"
|
|
2963
|
+
}
|
|
2964
|
+
interface PreflightRefusal {
|
|
2965
|
+
code: PreflightRefusalCode;
|
|
2966
|
+
/** Where, as a dotted path into the plan. */
|
|
2967
|
+
path: string;
|
|
2968
|
+
detail: string;
|
|
2969
|
+
/** For `invalid-plan`: the validator's issue code. */
|
|
2970
|
+
issue?: SitePlanIssueCode;
|
|
2971
|
+
}
|
|
2972
|
+
/**
|
|
2973
|
+
* The stable key each written document carries beside `siteBuildId`: a step that runs twice looks it up first and
|
|
2974
|
+
* skips what exists (so a restart or a Retry continues without duplicates), and a reader finds what the run made
|
|
2975
|
+
* by it — the wizard opens the HOME page by `page(<its key>)`. One builder per kind.
|
|
2976
|
+
*/
|
|
2977
|
+
declare const buildKeys: {
|
|
2978
|
+
readonly contentType: (name: string) => string;
|
|
2979
|
+
readonly item: (contentType: string, n: number) => string;
|
|
2980
|
+
readonly sampleImage: (n: number) => string;
|
|
2981
|
+
readonly dataSource: (alias: string) => string;
|
|
2982
|
+
readonly page: (key: string) => string;
|
|
2983
|
+
readonly global: (nodeId: string) => string;
|
|
2984
|
+
readonly look: () => string;
|
|
2985
|
+
};
|
|
2986
|
+
/** The id of the page a run made for the plan's home page, or null (not made yet, or no home page). */
|
|
2987
|
+
declare function builtHomePageId(run: Pick<SiteBuildRun, 'plan' | 'created'> | null | undefined): string | null;
|
|
2988
|
+
/** The step a run stopped at, or null. */
|
|
2989
|
+
declare function failedBuildStep(run: Pick<SiteBuildRun, 'steps'> | null | undefined): BuildStepRecord | null;
|
|
2990
|
+
/** A run still holding the org's slot (building or undoing) — a page that left it comes back to its progress. */
|
|
2991
|
+
declare function isActiveBuild(run: Pick<SiteBuildRun, 'status'> | null | undefined): boolean;
|
|
2992
|
+
/** What each step of a build of `plan` will make — the progress rows' words, from the plan alone. */
|
|
2993
|
+
interface BuildStepFacts {
|
|
2994
|
+
/** Content types to create: their labels. */
|
|
2995
|
+
contentTypes: string[];
|
|
2996
|
+
/** Sample items, all types together. */
|
|
2997
|
+
items: number;
|
|
2998
|
+
/** Pages (template pages included) and their routes. */
|
|
2999
|
+
pages: number;
|
|
3000
|
+
routes: string[];
|
|
3001
|
+
/** Links in the menu (pages `inNav`). */
|
|
3002
|
+
navLinks: number;
|
|
3003
|
+
/** The look's flavor. */
|
|
3004
|
+
flavorId: string;
|
|
3005
|
+
}
|
|
3006
|
+
declare function buildStepFacts(plan: SitePlan): BuildStepFacts;
|
|
3007
|
+
|
|
3008
|
+
export { ACTIVE_BUILD_STATUSES, BAR_ITEMS_MAX, BAR_ITEMS_MIN, BASELINE_ROLES, BUILD_STEPS, BaselineRole, BindScope, BuildNoticeCode, BuildStep, CardBindTarget, ComposeError, ComposeIssueCode, CreatedKind, DANGLING_LINK_CODES, DEFAULT_PHONE_MENU_BREAKPOINT, ENTRANCE_EASING, ENTRANCE_ORIGIN_LOOK, ENTRANCE_TRIGGER, EntrancePart, FACT_KEYS, GlobalSlot, KeptReason, NAV_PART_LABELS, NAV_SHAPE_COPY, NEUTRAL_STYLE_PROPS, NODE_BASELINES, NavPagesSource, NavRole, NavShape, NavShapeError, PRICING_PATTERN, PUBLISH_BLOCKING_PLACEHOLDERS, PageDataKind, PathIssueCollector, PatternDirective, PatternGlobalPosition, PatternOpens, PatternPlaceholder, PatternRecipe, PhoneMenuBreakpoint, PlaceholderKind, PlanDataSourceMode, PlanDataSourceType, PreflightRefusalCode, RelativeOp, SAMPLE_IMAGE_REF, SITE_FACT_LABELS, SITE_HEADER_PATTERN, SITE_PATTERNS, SITE_PLAN_VERSION, SITE_TEMPLATES, SPEC_SITE_FACTS, SPEC_SITE_LIBRARY, SPEC_SITE_PATTERNS, SPEC_SITE_PLAN_SHAPE, SPEC_SITE_TEMPLATES, STUDIO_TEMPLATE, SiteBuildKind, SiteBuildStatus, SitePlanError, SitePlanIssueCode, SitePlanSourceKind, SiteTemplateError, SiteTemplateId, StepState, addBarItem, altSourceScopes, assertStyleSlots, assertValidSitePlan, barIconForRoute, blocksPublish, buildKeys, buildStepFacts, builtHomePageId, composeNavHeader, composeSection, composeSite, createSerializedNode, describePlanData, entranceAction, entranceInteraction, failedBuildStep, findNavRoot, isActiveBuild, isNonEmptyString, isPlainObject, moveBarItem, navPages, navShapeBreakpoint, navShapeOf, nextSourceOf, nodeBindPaths, parseSampleImageRef, pathAt, patternById, patternNeedsBinding, patternNodes, patternOptionalParts, patternScopes, patternSlots, patternTakesBinding, phoneMenuPages, planFromTemplate, planNavShape, releasedLayoutDefaults, removeBarItem, requiredShapeKeys, routeParams, sampleImageRef, sectionEntrances, setStyleProps, shapeKeys, siteNavPages, staggerDelay, validateSitePlan, walkSerialized };
|
|
3009
|
+
export type { AddBarItemResult, BarItemsEditResult, BuildNotice, BuildStepError, BuildStepFacts, BuildStepRecord, CmsDataSourcePlan, ComposeContext, ComposeIssue, ComposedDataSource, ComposedItem, ComposedNavHeader, ComposedPage, ComposedPlaceholder, ComposedRoute, ComposedSection, ComposedSite, ContentFieldPlan, ContentSeedPlan, ContentTypePlan, CreateNodeOptions, CreatedRecord, DataSourcePlan, EntranceAction, EntranceInteraction, EntranceSpec, FactKey, NavHeaderInput, NavHeaderOptions, NavPage, NavShapeOptions, NavShapeResult, NodeBaseline, PageData, PageDataLine, PagePlan, PageSectionPlan, PathIssue, PatternNode, PlainObject, PreflightRefusal, RelativeDataSourcePlan, SectionEntrances, SectionInput, SectionOptions, SerializedBinding, SerializedNode, SerializedResponsive, ShapeEntry, ShapeIssueCodes, SiteBuildRun, SiteBusiness, SitePageRef, SitePattern, SitePlan, SitePlanIssue, SitePlanSource, SitePlanValidation, SiteTemplate, TemplatePlanInput, UndoKept, UndoPreview, UndoRecord };
|
package/harness-core/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MotionId, MoodId, TintId, DensityId, DesignMotion, DesignChoices, DesignMode, StylePreset, AnimateId, ShapeId } from '@vectoriox/iox-ui/design-core';
|
|
2
|
-
import { FactKey, PathIssue } from '@vectoriox/iox-ui/generation-core';
|
|
2
|
+
import { FactKey, PathIssue, SiteTemplate } from '@vectoriox/iox-ui/generation-core';
|
|
3
3
|
|
|
4
4
|
declare const SPEC_HARNESS_SOURCE: {
|
|
5
5
|
readonly repo: "nextlevelbuilder/ui-ux-pro-max-skill";
|
|
@@ -2513,5 +2513,20 @@ declare function addressesIn(text: string): string[];
|
|
|
2513
2513
|
/** The words without one address (removing its chip): every spelling of it, and the space it leaves. */
|
|
2514
2514
|
declare function withoutAddress(text: string, address: string): string;
|
|
2515
2515
|
|
|
2516
|
-
|
|
2517
|
-
|
|
2516
|
+
/** The structure a kind of business is built from, and the template the wizard can build TODAY. */
|
|
2517
|
+
interface StructureChoice {
|
|
2518
|
+
/** The business type's own structure (Studio · Practice · Place). */
|
|
2519
|
+
structure: StructureId;
|
|
2520
|
+
/** The template that will be built. */
|
|
2521
|
+
template: SiteTemplate;
|
|
2522
|
+
/** The type's structure has no template yet (L0-4), so the Studio template stands in. */
|
|
2523
|
+
fallback: boolean;
|
|
2524
|
+
}
|
|
2525
|
+
/**
|
|
2526
|
+
* Which template the template path (and the plan stage) builds a kind of business from (AI plan rev 3 §3d,
|
|
2527
|
+
* N-D3): its structure's template when that one has shipped, else Studio — said, never silent. No type → Studio.
|
|
2528
|
+
*/
|
|
2529
|
+
declare function structureFor(typeId: string | null | undefined): StructureChoice;
|
|
2530
|
+
|
|
2531
|
+
export { ANIMATE_ADVICE_STEPS, AnalysisIssueCode, AnalysisLocale, AvoidCheck, BUSINESS_TYPES, BUSINESS_TYPE_IDS, BookingNeed, COPY_LENGTH_ORDER, CopyLength, HARNESS_SOURCE, LITTLE_MOVEMENT_AVOID, LITTLE_MOVEMENT_CAP, LintKind, MAX_ANALYSIS_MOODS, NEEDS, NEED_IDS, NeedSource, PresetFit, RANK_WEIGHTS, READ_ANIMATE, READ_WEIGHTS, RankReason, SPEC_ANALYSIS_SHAPE, SPEC_BUSINESS_TYPES, SPEC_HARNESS_EXAMPLES, SPEC_HARNESS_SOURCE, SPEC_NEEDS, SPEC_STRUCTURES, SPEC_USER_AVOIDS, STRUCTURES, StyleReadGround, StyleReadHeadings, StyleReadMotion, StyleReadSourceKind, USER_AVOID_IDS, VoiceFormality, VoicePerson, addressesIn, analysisPromptContext, businessTypeById, calmerChoice, inferNeeds, isLookRule, lintDesign, lookMatches, mapStyleRead, matchBusinessType, matchBusinessTypes, motionAdvice, motionFor, normalizeAddress, oklchHue, presetHasSerifHeadings, presetLook, rankStylePresets, rankWithReferences, structureFor, userAvoidRule, validateSiteAnalysis, withoutAddress };
|
|
2532
|
+
export type { AnalysisContext, AnalysisIssue, AnalysisValidation, AvoidRule, BusinessType, BusinessTypeMatch, CheckRule, FactRead, GoodFit, LintFinding, LintSite, LookCondition, LookDesign, LookRule, MotionBasis, MotionInput, MotionStart, NeedDef, NeedId, PromptContext, PromptContextOptions, PromptSection, RankInput, RankedPreset, SiteAnalysis, SiteNeed, StructureChoice, StructureId, StyleHints, StyleRead, UserAvoidId };
|
package/package.json
CHANGED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { ComposedPlaceholder, ComposeIssue } from './compose-site';
|
|
2
|
+
import { SitePlan, SitePlanSource } from './site-plan.model';
|
|
3
|
+
import { SitePlanIssueCode } from './validate-site-plan';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A site build's WIRE vocabulary (AI plan §3b, W2): what iox-cms's `site-builds` API answers and what every
|
|
7
|
+
* client of it reads — the run's statuses and steps, what it created, why Undo kept something, the preflight's
|
|
8
|
+
* refusals, and the one spelling of each document's `buildKey`. ONE definition: iox-cms stores and answers it,
|
|
9
|
+
* the website wizard (W3) polls it. Pure types, enums and helpers; no transport.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export enum SiteBuildKind {
|
|
13
|
+
Build = 'build',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export enum SiteBuildStatus {
|
|
17
|
+
Running = 'running',
|
|
18
|
+
Done = 'done',
|
|
19
|
+
Failed = 'failed',
|
|
20
|
+
Undoing = 'undoing',
|
|
21
|
+
Undone = 'undone',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** The statuses a runner advances — and the ones that hold the org's single-run slot. */
|
|
25
|
+
export const ACTIVE_BUILD_STATUSES: ReadonlyArray<SiteBuildStatus> = [SiteBuildStatus.Running, SiteBuildStatus.Undoing];
|
|
26
|
+
|
|
27
|
+
/** The steps of a build, in the order they run. */
|
|
28
|
+
export enum BuildStep {
|
|
29
|
+
Preflight = 'preflight',
|
|
30
|
+
ContentTypes = 'content-types',
|
|
31
|
+
SampleImages = 'sample-images',
|
|
32
|
+
Items = 'items',
|
|
33
|
+
DataSources = 'data-sources',
|
|
34
|
+
Pages = 'pages',
|
|
35
|
+
Globals = 'globals',
|
|
36
|
+
Look = 'look',
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const BUILD_STEPS: ReadonlyArray<BuildStep> = Object.values(BuildStep);
|
|
40
|
+
|
|
41
|
+
export enum StepState {
|
|
42
|
+
Wait = 'wait',
|
|
43
|
+
Run = 'run',
|
|
44
|
+
Done = 'done',
|
|
45
|
+
Failed = 'failed',
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** What a build creates, as Undo walks it. */
|
|
49
|
+
export enum CreatedKind {
|
|
50
|
+
ContentType = 'content-type',
|
|
51
|
+
SampleImage = 'sample-image',
|
|
52
|
+
Item = 'item',
|
|
53
|
+
DataSource = 'data-source',
|
|
54
|
+
Page = 'page',
|
|
55
|
+
Global = 'global',
|
|
56
|
+
Look = 'look',
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Why Undo left something in place. */
|
|
60
|
+
export enum KeptReason {
|
|
61
|
+
Edited = 'edited',
|
|
62
|
+
Published = 'published',
|
|
63
|
+
InUse = 'in-use',
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface BuildStepError {
|
|
67
|
+
code: string;
|
|
68
|
+
detail: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface BuildStepRecord {
|
|
72
|
+
key: BuildStep;
|
|
73
|
+
state: StepState;
|
|
74
|
+
attempts: number;
|
|
75
|
+
startedAt?: Date | string;
|
|
76
|
+
finishedAt?: Date | string;
|
|
77
|
+
error?: BuildStepError;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface CreatedRecord {
|
|
81
|
+
kind: CreatedKind;
|
|
82
|
+
/** The document id — a page / item / content-type `_id`, a data-source alias, a global node id, a storage key. */
|
|
83
|
+
id: string;
|
|
84
|
+
buildKey: string;
|
|
85
|
+
/** sha256 of the document as the build left it. */
|
|
86
|
+
fingerprint: string;
|
|
87
|
+
/** An item's content type. */
|
|
88
|
+
contentType?: string;
|
|
89
|
+
/** A sample image's public URL — what items and pages reference. */
|
|
90
|
+
url?: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface UndoKept {
|
|
94
|
+
kind: CreatedKind;
|
|
95
|
+
id: string;
|
|
96
|
+
reason: KeptReason;
|
|
97
|
+
/** In plain words, for the screen ("About", "Sample project 2"). */
|
|
98
|
+
label?: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface UndoRecord {
|
|
102
|
+
at: Date | string;
|
|
103
|
+
removed: number;
|
|
104
|
+
kept: UndoKept[];
|
|
105
|
+
/** The undo steps already done (kinds), so a resumed undo does not redo them. */
|
|
106
|
+
done: CreatedKind[];
|
|
107
|
+
finishedAt?: Date | string;
|
|
108
|
+
/** What stopped the undo — DELETE again carries on from the kind it stopped at. */
|
|
109
|
+
error?: BuildStepError;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export enum BuildNoticeCode {
|
|
113
|
+
/** Storage is not configured: sample items get the empty image box, and the run says so. */
|
|
114
|
+
NoStorage = 'no-storage',
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface BuildNotice {
|
|
118
|
+
code: string;
|
|
119
|
+
detail: string;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** The run as `GET …/site-builds/:id` (and `?latest=1`) answers it. */
|
|
123
|
+
export interface SiteBuildRun {
|
|
124
|
+
_id: string;
|
|
125
|
+
organization: string;
|
|
126
|
+
kind: SiteBuildKind;
|
|
127
|
+
source: SitePlanSource;
|
|
128
|
+
plan: SitePlan;
|
|
129
|
+
year: number;
|
|
130
|
+
status: SiteBuildStatus;
|
|
131
|
+
active?: boolean;
|
|
132
|
+
steps: BuildStepRecord[];
|
|
133
|
+
created: CreatedRecord[];
|
|
134
|
+
placeholders: ComposedPlaceholder[];
|
|
135
|
+
issues: ComposeIssue[];
|
|
136
|
+
notices?: BuildNotice[];
|
|
137
|
+
requestedBy: string;
|
|
138
|
+
startedAt: Date | string;
|
|
139
|
+
finishedAt?: Date | string;
|
|
140
|
+
undo?: UndoRecord;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** `GET …/site-builds/:id/undo`: what an Undo would remove and keep — never guessed in the browser. */
|
|
144
|
+
export interface UndoPreview {
|
|
145
|
+
removes: Partial<Record<CreatedKind, number>>;
|
|
146
|
+
kept: UndoKept[];
|
|
147
|
+
restoresGlobals: string[];
|
|
148
|
+
revertsLook: boolean;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export enum PreflightRefusalCode {
|
|
152
|
+
/** The Site Plan itself is invalid (`validateSitePlan`); `issue` is the validator's code. */
|
|
153
|
+
InvalidPlan = 'invalid-plan',
|
|
154
|
+
/** A route the plan wants is already a page of this organization. */
|
|
155
|
+
RouteTaken = 'route-taken',
|
|
156
|
+
/** A content type of that name exists in this instance (content types are instance-wide). */
|
|
157
|
+
ContentTypeTaken = 'content-type-taken',
|
|
158
|
+
/** The name may not be a content type (a platform collection, or not a valid name). */
|
|
159
|
+
ContentTypeName = 'content-type-name',
|
|
160
|
+
/** Content types act on the whole instance: only the instance owner may create them (SEC1). */
|
|
161
|
+
ContentTypesNeedInstanceOwner = 'content-types-need-instance-owner',
|
|
162
|
+
/** The org library holds the alias with a different definition. */
|
|
163
|
+
DataSourceConflict = 'data-source-conflict',
|
|
164
|
+
/** The studio has pages AND a header/footer: replace or keep them is the caller's choice (D7). */
|
|
165
|
+
GlobalsNeedDecision = 'globals-need-decision',
|
|
166
|
+
/** A global the plan adds has the id of one the studio keeps. */
|
|
167
|
+
GlobalTaken = 'global-taken',
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface PreflightRefusal {
|
|
171
|
+
code: PreflightRefusalCode;
|
|
172
|
+
/** Where, as a dotted path into the plan. */
|
|
173
|
+
path: string;
|
|
174
|
+
detail: string;
|
|
175
|
+
/** For `invalid-plan`: the validator's issue code. */
|
|
176
|
+
issue?: SitePlanIssueCode;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The stable key each written document carries beside `siteBuildId`: a step that runs twice looks it up first and
|
|
181
|
+
* skips what exists (so a restart or a Retry continues without duplicates), and a reader finds what the run made
|
|
182
|
+
* by it — the wizard opens the HOME page by `page(<its key>)`. One builder per kind.
|
|
183
|
+
*/
|
|
184
|
+
export const buildKeys = {
|
|
185
|
+
contentType: (name: string) => `schema:${name}`,
|
|
186
|
+
item: (contentType: string, n: number) => `item:${contentType}:${n}`,
|
|
187
|
+
sampleImage: (n: number) => `sample-image:${n}`,
|
|
188
|
+
dataSource: (alias: string) => `data-source:${alias}`,
|
|
189
|
+
page: (key: string) => `page:${key}`,
|
|
190
|
+
global: (nodeId: string) => `global:${nodeId}`,
|
|
191
|
+
look: () => 'look',
|
|
192
|
+
} as const;
|
|
193
|
+
|
|
194
|
+
/** The id of the page a run made for the plan's home page, or null (not made yet, or no home page). */
|
|
195
|
+
export function builtHomePageId(run: Pick<SiteBuildRun, 'plan' | 'created'> | null | undefined): string | null {
|
|
196
|
+
const home = run?.plan?.pages?.find(p => p.isHome) ?? run?.plan?.pages?.[0];
|
|
197
|
+
if (!home) return null;
|
|
198
|
+
const key = buildKeys.page(home.key);
|
|
199
|
+
return run!.created?.find(c => c.kind === CreatedKind.Page && c.buildKey === key)?.id ?? null;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** The step a run stopped at, or null. */
|
|
203
|
+
export function failedBuildStep(run: Pick<SiteBuildRun, 'steps'> | null | undefined): BuildStepRecord | null {
|
|
204
|
+
return run?.steps?.find(s => s.state === StepState.Failed) ?? null;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** A run still holding the org's slot (building or undoing) — a page that left it comes back to its progress. */
|
|
208
|
+
export function isActiveBuild(run: Pick<SiteBuildRun, 'status'> | null | undefined): boolean {
|
|
209
|
+
return !!run && ACTIVE_BUILD_STATUSES.includes(run.status);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** What each step of a build of `plan` will make — the progress rows' words, from the plan alone. */
|
|
213
|
+
export interface BuildStepFacts {
|
|
214
|
+
/** Content types to create: their labels. */
|
|
215
|
+
contentTypes: string[];
|
|
216
|
+
/** Sample items, all types together. */
|
|
217
|
+
items: number;
|
|
218
|
+
/** Pages (template pages included) and their routes. */
|
|
219
|
+
pages: number;
|
|
220
|
+
routes: string[];
|
|
221
|
+
/** Links in the menu (pages `inNav`). */
|
|
222
|
+
navLinks: number;
|
|
223
|
+
/** The look's flavor. */
|
|
224
|
+
flavorId: string;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export function buildStepFacts(plan: SitePlan): BuildStepFacts {
|
|
228
|
+
return {
|
|
229
|
+
contentTypes: plan.contentTypes.map(t => t.label),
|
|
230
|
+
items: plan.contentTypes.reduce((n, t) => n + (t.seed?.count ?? 0), 0),
|
|
231
|
+
pages: plan.pages.length,
|
|
232
|
+
routes: plan.pages.map(p => p.route),
|
|
233
|
+
navLinks: plan.pages.filter(p => p.inNav).length,
|
|
234
|
+
flavorId: plan.design.flavorId,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SITE_TEMPLATES, SiteTemplate, STUDIO_TEMPLATE } from '@vectoriox/iox-ui/generation-core';
|
|
2
|
+
|
|
3
|
+
import { businessTypeById, STRUCTURES, StructureId } from './business-types';
|
|
4
|
+
|
|
5
|
+
/** The structure a kind of business is built from, and the template the wizard can build TODAY. */
|
|
6
|
+
export interface StructureChoice {
|
|
7
|
+
/** The business type's own structure (Studio · Practice · Place). */
|
|
8
|
+
structure: StructureId;
|
|
9
|
+
/** The template that will be built. */
|
|
10
|
+
template: SiteTemplate;
|
|
11
|
+
/** The type's structure has no template yet (L0-4), so the Studio template stands in. */
|
|
12
|
+
fallback: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Which template the template path (and the plan stage) builds a kind of business from (AI plan rev 3 §3d,
|
|
17
|
+
* N-D3): its structure's template when that one has shipped, else Studio — said, never silent. No type → Studio.
|
|
18
|
+
*/
|
|
19
|
+
export function structureFor(typeId: string | null | undefined): StructureChoice {
|
|
20
|
+
const structure = (businessTypeById(typeId)?.structure ?? 'studio') as StructureId;
|
|
21
|
+
const own = STRUCTURES[structure]?.shipped ? SITE_TEMPLATES[structure] : undefined;
|
|
22
|
+
return { structure, template: own ?? STUDIO_TEMPLATE, fallback: !own };
|
|
23
|
+
}
|