@quixomatic/rpf 0.3.0 → 0.3.1
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 +11 -0
- package/assets/forge-app/app/assets/{_forge-shiki-langs-BtmKnsX8.js → _forge-shiki-langs-DaJjT17w.js} +1 -1
- package/assets/forge-app/app/assets/{appendItems-D8y87kIw.js → appendItems-CWJJlOE7.js} +1 -1
- package/assets/forge-app/app/assets/{core-pm_tYnN8.js → core-Dl2d1S-D.js} +1 -1
- package/assets/forge-app/app/assets/{diff-view-KCzB8C4U.js → diff-view-Chujmqzi.js} +1 -1
- package/assets/forge-app/app/assets/{file-panel-BKKQ3JJL.js → file-panel-le_M5nHe.js} +1 -1
- package/assets/forge-app/app/assets/{highlights-dvwIMyOh.js → highlights-BxaWC1ve.js} +1 -1
- package/assets/forge-app/app/assets/{index-DgB2FK2g.js → index-UP3KtgHV.js} +6 -6
- package/assets/forge-app/app/assets/{loader-DUZOP7q_.js → loader-BMv9OYvr.js} +1 -1
- package/assets/forge-app/app/assets/{shiki-BghTRNDM.js → shiki-CoRI3zWj.js} +2 -2
- package/assets/forge-app/app/assets/{stream-tokenizer-BzA0VElt.js → stream-tokenizer-BMtK_3oz.js} +1 -1
- package/assets/forge-app/app/assets/{terminal-view-BdvNEDWd.js → terminal-view-D3CiLjfu.js} +1 -1
- package/assets/forge-app/app/assets/{themes-D3CUotbU.js → themes-CLX9vH7e.js} +2 -2
- package/assets/forge-app/app/assets/{useNextRenderData-BaDffqa5.js → useNextRenderData-dgMkjxGZ.js} +1 -1
- package/assets/forge-app/app/index.html +1 -1
- package/assets/forge-app/server.mjs +440 -125
- package/dist/cli.mjs +2 -2
- package/package.json +1 -1
|
@@ -27078,7 +27078,7 @@ async function parsePartialJson(jsonText) {
|
|
|
27078
27078
|
*
|
|
27079
27079
|
* @returns An output specification for generating text.
|
|
27080
27080
|
*/
|
|
27081
|
-
var text = () => ({
|
|
27081
|
+
var text$1 = () => ({
|
|
27082
27082
|
name: "text",
|
|
27083
27083
|
responseFormat: Promise.resolve({ type: "text" }),
|
|
27084
27084
|
async parseCompleteOutput({ text }) {
|
|
@@ -28000,7 +28000,7 @@ async function generateTextInternal({ model: modelArg, tools, toolChoice, instru
|
|
|
28000
28000
|
});
|
|
28001
28001
|
let resolvedOutput;
|
|
28002
28002
|
if (lastStep.finishReason === "stop" || lastStep.finishReason !== "tool-calls" && lastStep.text.length > 0) {
|
|
28003
|
-
const outputSpecification = output ?? text();
|
|
28003
|
+
const outputSpecification = output ?? text$1();
|
|
28004
28004
|
const textForOutput = (await outputSpecification.responseFormat)?.type === "json" ? currentModelResponse.structuredOutputText ?? lastStep.text : lastStep.text;
|
|
28005
28005
|
resolvedOutput = await outputSpecification.parseCompleteOutput({ text: textForOutput }, {
|
|
28006
28006
|
response: lastStep.response,
|
|
@@ -31341,7 +31341,7 @@ var DefaultStreamTextResult = class {
|
|
|
31341
31341
|
isRunning = false;
|
|
31342
31342
|
}
|
|
31343
31343
|
});
|
|
31344
|
-
this.baseStream = stream.pipeThrough(createOutputTransformStream(output ?? text(), retention.replay || output != null)).pipeThrough(eventProcessor);
|
|
31344
|
+
this.baseStream = stream.pipeThrough(createOutputTransformStream(output ?? text$1(), retention.replay || output != null)).pipeThrough(eventProcessor);
|
|
31345
31345
|
const { maxRetries } = prepareRetries({
|
|
31346
31346
|
maxRetries: maxRetriesArg,
|
|
31347
31347
|
abortSignal
|
|
@@ -32461,7 +32461,7 @@ var DefaultStreamTextResult = class {
|
|
|
32461
32461
|
return this.outputPromise;
|
|
32462
32462
|
}
|
|
32463
32463
|
parseOutput(step) {
|
|
32464
|
-
return (this.outputSpecification ?? text()).parseCompleteOutput({ text: step.text }, {
|
|
32464
|
+
return (this.outputSpecification ?? text$1()).parseCompleteOutput({ text: step.text }, {
|
|
32465
32465
|
response: step.response,
|
|
32466
32466
|
usage: step.usage,
|
|
32467
32467
|
finishReason: step.finishReason
|
|
@@ -79512,6 +79512,219 @@ function readNotices(appDir) {
|
|
|
79512
79512
|
if (!existsSync(file)) throw new Error("This build has no THIRD_PARTY_NOTICES.txt (run the forge-app build)");
|
|
79513
79513
|
return parseNotices(readFileSync(file, "utf8"));
|
|
79514
79514
|
}
|
|
79515
|
+
// ../forge-app/src/server/create-shapes.ts
|
|
79516
|
+
/**
|
|
79517
|
+
* The one place the new-project wizard's instance data gets a stable shape, whichever engine answered (rpf's
|
|
79518
|
+
* forge-create, which passes the Forge API's records through, or the scripted mock-create). The client renders these
|
|
79519
|
+
* records directly, so a field that is an object on the instance but a string in the client's mind crashes React
|
|
79520
|
+
* (minified error #31). That happened with `GET /portals`: the real route returns `app` as `{ id, scope, name }`
|
|
79521
|
+
* (registry/catalog.ts listPortals → appOf) and has no `reactPortal` field.
|
|
79522
|
+
*
|
|
79523
|
+
* What the client can rely on after this:
|
|
79524
|
+
* - `app` is always the scope string ('' when unknown), with `appId` and `appName` beside it;
|
|
79525
|
+
* - portals carry `reactPortal`: true when React Portal itself owns the portal (scope x_312987_portal);
|
|
79526
|
+
* - lists are arrays, and the fields the wizard renders are strings, numbers or booleans.
|
|
79527
|
+
*/
|
|
79528
|
+
/** React Portal's own application scope: records in it are React Portal's, and an upgrade may change them. */
|
|
79529
|
+
var REACT_PORTAL_SCOPE = "x_312987_portal";
|
|
79530
|
+
/** A value as a string, for fields the client renders as text (objects and null become ''). */
|
|
79531
|
+
function text(v) {
|
|
79532
|
+
return typeof v === "string" ? v : typeof v === "number" || typeof v === "boolean" ? String(v) : "";
|
|
79533
|
+
}
|
|
79534
|
+
/** A value as a list (anything else becomes []). */
|
|
79535
|
+
function list(v) {
|
|
79536
|
+
return Array.isArray(v) ? v.filter((x) => x && typeof x === "object") : [];
|
|
79537
|
+
}
|
|
79538
|
+
/**
|
|
79539
|
+
* An owning-application value as flat fields. The Forge API sends `{ id, scope, name }` (scope.ts appOf), or null for
|
|
79540
|
+
* a record without a scope; the old mock sent the scope string. Both come out the same.
|
|
79541
|
+
* @param v the `app` value from the instance
|
|
79542
|
+
*/
|
|
79543
|
+
function appFields(v) {
|
|
79544
|
+
if (typeof v === "string") return {
|
|
79545
|
+
app: v,
|
|
79546
|
+
appId: "",
|
|
79547
|
+
appName: ""
|
|
79548
|
+
};
|
|
79549
|
+
if (v && typeof v === "object") {
|
|
79550
|
+
const a = v;
|
|
79551
|
+
return {
|
|
79552
|
+
app: text(a.scope),
|
|
79553
|
+
appId: text(a.id),
|
|
79554
|
+
appName: text(a.name) || text(a.scope)
|
|
79555
|
+
};
|
|
79556
|
+
}
|
|
79557
|
+
return {
|
|
79558
|
+
app: "",
|
|
79559
|
+
appId: "",
|
|
79560
|
+
appName: ""
|
|
79561
|
+
};
|
|
79562
|
+
}
|
|
79563
|
+
/**
|
|
79564
|
+
* A portal from `GET /portals` (or a portal record from `GET /portal`) with a flat app and `reactPortal`.
|
|
79565
|
+
* @param p the portal record
|
|
79566
|
+
*/
|
|
79567
|
+
function normalizePortal(p) {
|
|
79568
|
+
const a = appFields(p.app);
|
|
79569
|
+
return {
|
|
79570
|
+
...p,
|
|
79571
|
+
...a,
|
|
79572
|
+
slug: text(p.slug),
|
|
79573
|
+
name: text(p.name) || text(p.slug),
|
|
79574
|
+
active: !!p.active,
|
|
79575
|
+
isTemplate: !!p.isTemplate,
|
|
79576
|
+
isDefaultTemplate: !!p.isDefaultTemplate,
|
|
79577
|
+
pageCount: typeof p.pageCount === "number" ? p.pageCount : 0,
|
|
79578
|
+
reactPortal: a.app === REACT_PORTAL_SCOPE
|
|
79579
|
+
};
|
|
79580
|
+
}
|
|
79581
|
+
/** `GET /portals` → the wizard's portal list. */
|
|
79582
|
+
function normalizePortals(v) {
|
|
79583
|
+
return list(v).map(normalizePortal);
|
|
79584
|
+
}
|
|
79585
|
+
/**
|
|
79586
|
+
* `GET /portal?ref=` → its portal record flattened like the list's (pages, menus and the rest kept as they are).
|
|
79587
|
+
* @param v the route's answer: { portal, pages, panels, variants, portalPlacements, layouts, menus }
|
|
79588
|
+
*/
|
|
79589
|
+
function normalizePortalDetail(v) {
|
|
79590
|
+
const d = v && typeof v === "object" ? v : {};
|
|
79591
|
+
return {
|
|
79592
|
+
...d,
|
|
79593
|
+
portal: d.portal && typeof d.portal === "object" ? normalizePortal(d.portal) : null,
|
|
79594
|
+
pages: list(d.pages)
|
|
79595
|
+
};
|
|
79596
|
+
}
|
|
79597
|
+
/**
|
|
79598
|
+
* `GET /themes` → the active themes, app flattened. The real route lists every theme (inactive too) with `app` as an
|
|
79599
|
+
* object and `tokens` as `{ light, dark }` or a flat token map.
|
|
79600
|
+
*/
|
|
79601
|
+
function normalizeThemes(v) {
|
|
79602
|
+
return list(v).filter((t) => t.active !== false).map((t) => {
|
|
79603
|
+
const tokens = t.tokens && typeof t.tokens === "object" ? t.tokens : {};
|
|
79604
|
+
return {
|
|
79605
|
+
...t,
|
|
79606
|
+
...appFields(t.app),
|
|
79607
|
+
key: text(t.key),
|
|
79608
|
+
name: text(t.name) || text(t.key),
|
|
79609
|
+
tokens: tokens.light || tokens.dark ? tokens : { light: tokens }
|
|
79610
|
+
};
|
|
79611
|
+
});
|
|
79612
|
+
}
|
|
79613
|
+
/** `GET /components?kind=layout` → layouts the wizard can offer (they need a unique id). */
|
|
79614
|
+
function normalizeLayouts(v) {
|
|
79615
|
+
return list(v).filter((l) => text(l.uniqueId)).map((l) => ({
|
|
79616
|
+
...l,
|
|
79617
|
+
uniqueId: text(l.uniqueId),
|
|
79618
|
+
name: text(l.name) || text(l.uniqueId)
|
|
79619
|
+
}));
|
|
79620
|
+
}
|
|
79621
|
+
/**
|
|
79622
|
+
* `GET /apps?list=authoring` rows. `reactPortal` is the server's (by sys_id); a row without it falls back to the scope.
|
|
79623
|
+
* @param v the apps list
|
|
79624
|
+
*/
|
|
79625
|
+
function normalizeApps(v) {
|
|
79626
|
+
return list(v).map((a) => ({
|
|
79627
|
+
...a,
|
|
79628
|
+
id: text(a.id),
|
|
79629
|
+
scope: text(a.scope),
|
|
79630
|
+
name: text(a.name) || text(a.scope),
|
|
79631
|
+
version: text(a.version),
|
|
79632
|
+
reactPortal: typeof a.reactPortal === "boolean" ? a.reactPortal : text(a.scope) === REACT_PORTAL_SCOPE,
|
|
79633
|
+
current: !!a.current
|
|
79634
|
+
}));
|
|
79635
|
+
}
|
|
79636
|
+
/** The preflight answer (status facts + the authoring apps), with its apps normalized. */
|
|
79637
|
+
function normalizePreflight(v) {
|
|
79638
|
+
const p = v && typeof v === "object" ? v : {};
|
|
79639
|
+
const caps = p.capabilities && typeof p.capabilities === "object" ? p.capabilities : {};
|
|
79640
|
+
return {
|
|
79641
|
+
...p,
|
|
79642
|
+
user: text(p.user),
|
|
79643
|
+
reactPortal: text(p.reactPortal),
|
|
79644
|
+
warning: text(p.warning),
|
|
79645
|
+
capabilities: Object.fromEntries(Object.entries(caps).map(([k, on]) => [k, !!on])),
|
|
79646
|
+
canCreateSets: !!p.canCreateSets,
|
|
79647
|
+
apps: normalizeApps(p.apps)
|
|
79648
|
+
};
|
|
79649
|
+
}
|
|
79650
|
+
/** `GET /update-sets?app=` → its in-progress sets (the route answers `{ app, sets }`; an engine may unwrap it). */
|
|
79651
|
+
function normalizeUpdateSets(v) {
|
|
79652
|
+
return list(Array.isArray(v) ? v : v && typeof v === "object" ? v.sets : []).map((s) => ({
|
|
79653
|
+
...s,
|
|
79654
|
+
id: text(s.id),
|
|
79655
|
+
name: text(s.name) || text(s.id),
|
|
79656
|
+
isDefault: !!s.isDefault,
|
|
79657
|
+
remembered: !!s.remembered,
|
|
79658
|
+
current: !!s.current
|
|
79659
|
+
}));
|
|
79660
|
+
}
|
|
79661
|
+
/** `GET /portals/slug-available?slug=` → { slug, available, reason?, takenBy?: { name, active }, suggestion? }. */
|
|
79662
|
+
function normalizeSlug(v) {
|
|
79663
|
+
const s = v && typeof v === "object" ? v : {};
|
|
79664
|
+
const out = {
|
|
79665
|
+
...s,
|
|
79666
|
+
available: !!s.available
|
|
79667
|
+
};
|
|
79668
|
+
if (s.takenBy && typeof s.takenBy === "object") out.takenBy = {
|
|
79669
|
+
...s.takenBy,
|
|
79670
|
+
name: text(s.takenBy.name),
|
|
79671
|
+
active: !!s.takenBy.active
|
|
79672
|
+
};
|
|
79673
|
+
if (s.suggestion !== void 0) out.suggestion = text(s.suggestion) || void 0;
|
|
79674
|
+
return out;
|
|
79675
|
+
}
|
|
79676
|
+
/**
|
|
79677
|
+
* The dry run's answer with the parts the Review step renders made safe: the app flat-but-nested as the client reads
|
|
79678
|
+
* it (`plan.app.name`, `plan.app.scope`), counts as [table, n] pairs, and warnings and local steps as strings.
|
|
79679
|
+
*/
|
|
79680
|
+
function normalizePlan(v) {
|
|
79681
|
+
const r = v && typeof v === "object" ? v : {};
|
|
79682
|
+
const app = r.app && typeof r.app === "object" ? r.app : { scope: text(r.app) };
|
|
79683
|
+
const plan = r.plan && typeof r.plan === "object" ? r.plan : {};
|
|
79684
|
+
return {
|
|
79685
|
+
...r,
|
|
79686
|
+
app: {
|
|
79687
|
+
...app,
|
|
79688
|
+
id: text(app.id),
|
|
79689
|
+
scope: text(app.scope),
|
|
79690
|
+
name: text(app.name) || text(app.scope),
|
|
79691
|
+
reactPortal: !!app.reactPortal || text(app.scope) === "x_312987_portal"
|
|
79692
|
+
},
|
|
79693
|
+
plan: {
|
|
79694
|
+
...plan,
|
|
79695
|
+
summary: text(plan.summary),
|
|
79696
|
+
hash: text(plan.hash),
|
|
79697
|
+
warnings: (Array.isArray(plan.warnings) ? plan.warnings : []).map(text).filter(Boolean)
|
|
79698
|
+
},
|
|
79699
|
+
counts: (Array.isArray(r.counts) ? r.counts : []).filter((c) => Array.isArray(c) && typeof c[0] === "string" && typeof c[1] === "number"),
|
|
79700
|
+
local: (Array.isArray(r.local) ? r.local : []).map(text).filter(Boolean),
|
|
79701
|
+
contrast: (Array.isArray(r.contrast) ? r.contrast : []).map(text).filter(Boolean)
|
|
79702
|
+
};
|
|
79703
|
+
}
|
|
79704
|
+
/** Engines already wrapped, so CreateManager.api() hands out one wrapper per engine. */
|
|
79705
|
+
var wrapped = /* @__PURE__ */ new WeakMap();
|
|
79706
|
+
/**
|
|
79707
|
+
* The create API with every read the wizard renders normalized. Writes (create, pull) pass through: their results
|
|
79708
|
+
* reach the client only as the job's log lines and `studioUrl`.
|
|
79709
|
+
* @param api the engine (forge-create or mock-create)
|
|
79710
|
+
*/
|
|
79711
|
+
function withStableShapes(api) {
|
|
79712
|
+
const hit = wrapped.get(api);
|
|
79713
|
+
if (hit) return hit;
|
|
79714
|
+
const out = {
|
|
79715
|
+
...api,
|
|
79716
|
+
preflight: async (profile) => normalizePreflight(await api.preflight(profile)),
|
|
79717
|
+
updateSets: async (profile, appId) => normalizeUpdateSets(await api.updateSets(profile, appId)),
|
|
79718
|
+
portals: async (profile) => normalizePortals(await api.portals(profile)),
|
|
79719
|
+
portal: async (profile, ref) => normalizePortalDetail(await api.portal(profile, ref)),
|
|
79720
|
+
themes: async (profile) => normalizeThemes(await api.themes(profile)),
|
|
79721
|
+
layouts: async (profile) => normalizeLayouts(await api.layouts(profile)),
|
|
79722
|
+
slugAvailable: async (profile, slug) => normalizeSlug(await api.slugAvailable(profile, slug)),
|
|
79723
|
+
plan: async (profile, answers, o) => normalizePlan(await api.plan(profile, answers, o))
|
|
79724
|
+
};
|
|
79725
|
+
wrapped.set(api, out);
|
|
79726
|
+
return out;
|
|
79727
|
+
}
|
|
79515
79728
|
// ../forge-app/src/server/create.ts
|
|
79516
79729
|
/**
|
|
79517
79730
|
* Turns a refusal from the create API into "<code>: <message>", so the wizard can show the fix for the code.
|
|
@@ -79533,10 +79746,13 @@ var CreateManager = class {
|
|
|
79533
79746
|
constructor(ctx) {
|
|
79534
79747
|
this.ctx = ctx;
|
|
79535
79748
|
}
|
|
79536
|
-
/**
|
|
79749
|
+
/**
|
|
79750
|
+
* The injected create API with its reads normalized (create-shapes.ts), or a readable error in builds without it.
|
|
79751
|
+
* Every wizard route goes through here, so both engines reach the client in one shape.
|
|
79752
|
+
*/
|
|
79537
79753
|
api() {
|
|
79538
79754
|
if (!this.ctx.core.create) throw Object.assign(/* @__PURE__ */ new Error("This rpf build creates projects with rpf init"), { code: "unavailable" });
|
|
79539
|
-
return this.ctx.core.create;
|
|
79755
|
+
return withStableShapes(this.ctx.core.create);
|
|
79540
79756
|
}
|
|
79541
79757
|
/** Appends a progress line and tells the dialog. */
|
|
79542
79758
|
log(job, line) {
|
|
@@ -82281,136 +82497,175 @@ function mockWorkspaceEngine() {
|
|
|
82281
82497
|
/**
|
|
82282
82498
|
* A scripted stand-in for the new-project wizard's instance side (`ForgeCore.create`), for building and testing the
|
|
82283
82499
|
* wizard with no instance (source runs with FORGE_DEV_MOCK=1 and FORGE_DEV_MOCK_CREATE=1, and the tests). It answers
|
|
82284
|
-
* with
|
|
82285
|
-
*
|
|
82500
|
+
* with exactly what rpf's forge-create hands over: the real Forge API's records passed through (`/status`, `/apps`,
|
|
82501
|
+
* `/update-sets`, `/portals`, `/portal`, `/themes`, `/components?kind=layout`, `/portals/slug-available`, and
|
|
82502
|
+
* `/write/create_portal`'s dry-run plan), checked against a live instance. In particular `app` is the instance's
|
|
82503
|
+
* `{ id, scope, name }` object and portals carry no `reactPortal` flag: the wizard's server normalizes both
|
|
82504
|
+
* (create-shapes.ts), and the mock must not hide a shape the real engine sends. "Creating" writes a small workspace
|
|
82505
|
+
* folder, so the new project opens like a pulled one.
|
|
82286
82506
|
*
|
|
82287
82507
|
* Scripted cases: the profile `off` is refused as Forge-off, `noaccess` without design access; a portal name
|
|
82288
82508
|
* containing "fail pull" makes the first pull fail (the draft exists, Retry pull works).
|
|
82289
82509
|
*/
|
|
82290
82510
|
var delay = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
82511
|
+
/** `GET /apps?list=authoring` rows (forge/authoring.ts authoringApps). */
|
|
82291
82512
|
var APPS = [
|
|
82292
82513
|
{
|
|
82293
82514
|
id: "a1",
|
|
82294
82515
|
scope: "x_acme_crm",
|
|
82295
82516
|
name: "Acme CRM",
|
|
82296
82517
|
version: "2.4.0",
|
|
82297
|
-
|
|
82518
|
+
reactPortal: false,
|
|
82519
|
+
current: true,
|
|
82520
|
+
canAuthor: true
|
|
82298
82521
|
},
|
|
82299
82522
|
{
|
|
82300
82523
|
id: "a2",
|
|
82301
82524
|
scope: "x_acme_hr",
|
|
82302
82525
|
name: "HR Service Delivery",
|
|
82303
|
-
version: "1.1.0"
|
|
82526
|
+
version: "1.1.0",
|
|
82527
|
+
reactPortal: false,
|
|
82528
|
+
current: false,
|
|
82529
|
+
canAuthor: true
|
|
82304
82530
|
},
|
|
82305
82531
|
{
|
|
82306
82532
|
id: "a3",
|
|
82307
82533
|
scope: "x_312987_portal",
|
|
82308
82534
|
name: "React Portal",
|
|
82309
82535
|
version: "1.69.0",
|
|
82310
|
-
reactPortal: true
|
|
82536
|
+
reactPortal: true,
|
|
82537
|
+
current: false,
|
|
82538
|
+
canAuthor: true
|
|
82311
82539
|
}
|
|
82312
82540
|
];
|
|
82541
|
+
/** The `{ id, scope, name }` a record's owning application comes as (security/scope.ts appOf). */
|
|
82542
|
+
function appRef(id) {
|
|
82543
|
+
const a = APPS.find((x) => x.id === id);
|
|
82544
|
+
return {
|
|
82545
|
+
id: a.id,
|
|
82546
|
+
scope: a.scope,
|
|
82547
|
+
name: a.name
|
|
82548
|
+
};
|
|
82549
|
+
}
|
|
82550
|
+
/** A `GET /update-sets` row (forge/authoring.ts UpdateSetRow). */
|
|
82551
|
+
function setRow(id, name, isDefault, createdBy, remembered = false) {
|
|
82552
|
+
return {
|
|
82553
|
+
id,
|
|
82554
|
+
name,
|
|
82555
|
+
isDefault,
|
|
82556
|
+
createdBy,
|
|
82557
|
+
createdOn: "2026-11-02 14:20:11",
|
|
82558
|
+
current: false,
|
|
82559
|
+
remembered
|
|
82560
|
+
};
|
|
82561
|
+
}
|
|
82313
82562
|
var SETS = {
|
|
82314
|
-
a1: [
|
|
82315
|
-
|
|
82316
|
-
|
|
82317
|
-
isDefault: false,
|
|
82318
|
-
remembered: true,
|
|
82319
|
-
createdBy: "dana.reyes"
|
|
82320
|
-
}, {
|
|
82321
|
-
id: "s2",
|
|
82322
|
-
name: "Default",
|
|
82323
|
-
isDefault: true,
|
|
82324
|
-
createdBy: "system"
|
|
82325
|
-
}],
|
|
82326
|
-
a2: [{
|
|
82327
|
-
id: "s3",
|
|
82328
|
-
name: "Default",
|
|
82329
|
-
isDefault: true,
|
|
82330
|
-
createdBy: "system"
|
|
82331
|
-
}],
|
|
82332
|
-
a3: [{
|
|
82333
|
-
id: "s4",
|
|
82334
|
-
name: "Default",
|
|
82335
|
-
isDefault: true,
|
|
82336
|
-
createdBy: "system"
|
|
82337
|
-
}]
|
|
82563
|
+
a1: [setRow("s1", "Acme portal (React Portal)", false, "dana.reyes", true), setRow("s2", "Default", true, "system")],
|
|
82564
|
+
a2: [setRow("s3", "Default", true, "system")],
|
|
82565
|
+
a3: [setRow("s4", "Default", true, "system")]
|
|
82338
82566
|
};
|
|
82567
|
+
/** A `GET /portals` row (registry/catalog.ts listPortals): `app` is an object, and there is no `reactPortal`. */
|
|
82568
|
+
function portalRow(id, slug, name, appId, o) {
|
|
82569
|
+
return {
|
|
82570
|
+
id,
|
|
82571
|
+
slug,
|
|
82572
|
+
name,
|
|
82573
|
+
description: "",
|
|
82574
|
+
app: appRef(appId),
|
|
82575
|
+
active: o.active,
|
|
82576
|
+
isDefault: false,
|
|
82577
|
+
isTemplate: !!o.isTemplate,
|
|
82578
|
+
isDefaultTemplate: !!o.isDefaultTemplate,
|
|
82579
|
+
origin: null,
|
|
82580
|
+
pageCount: o.pageCount,
|
|
82581
|
+
themeInfo: {
|
|
82582
|
+
key: "starter",
|
|
82583
|
+
name: "Starter"
|
|
82584
|
+
},
|
|
82585
|
+
brand: {
|
|
82586
|
+
icon: "layout-dashboard",
|
|
82587
|
+
logo: ""
|
|
82588
|
+
},
|
|
82589
|
+
composition: {
|
|
82590
|
+
pages: o.pageCount,
|
|
82591
|
+
placements: o.pageCount * 3,
|
|
82592
|
+
panels: 1,
|
|
82593
|
+
menuItems: 5,
|
|
82594
|
+
variants: 0,
|
|
82595
|
+
components: 6
|
|
82596
|
+
},
|
|
82597
|
+
updatedOn: "2026-11-20 09:12:44",
|
|
82598
|
+
theme: "t1",
|
|
82599
|
+
defaultLayout: "l1",
|
|
82600
|
+
release: null
|
|
82601
|
+
};
|
|
82602
|
+
}
|
|
82339
82603
|
var PORTALS = [
|
|
82340
|
-
{
|
|
82341
|
-
|
|
82342
|
-
slug: "starter",
|
|
82343
|
-
name: "Starter",
|
|
82604
|
+
portalRow("p1", "starter", "Starter", "a3", {
|
|
82605
|
+
active: true,
|
|
82344
82606
|
isTemplate: true,
|
|
82345
82607
|
isDefaultTemplate: true,
|
|
82608
|
+
pageCount: 6
|
|
82609
|
+
}),
|
|
82610
|
+
portalRow("p2", "intranet", "Intranet", "a3", {
|
|
82346
82611
|
active: true,
|
|
82347
|
-
pageCount: 6,
|
|
82348
|
-
app: "x_312987_portal"
|
|
82349
|
-
},
|
|
82350
|
-
{
|
|
82351
|
-
id: "p2",
|
|
82352
|
-
slug: "intranet",
|
|
82353
|
-
name: "Intranet",
|
|
82354
82612
|
isTemplate: true,
|
|
82613
|
+
pageCount: 11
|
|
82614
|
+
}),
|
|
82615
|
+
portalRow("p3", "acme", "Acme Sales", "a1", {
|
|
82355
82616
|
active: true,
|
|
82356
|
-
pageCount:
|
|
82357
|
-
|
|
82358
|
-
|
|
82359
|
-
{
|
|
82360
|
-
id: "p3",
|
|
82361
|
-
slug: "acme",
|
|
82362
|
-
name: "Acme Sales",
|
|
82363
|
-
active: true,
|
|
82364
|
-
pageCount: 14,
|
|
82365
|
-
app: "x_acme_crm"
|
|
82366
|
-
},
|
|
82367
|
-
{
|
|
82368
|
-
id: "p4",
|
|
82369
|
-
slug: "sp",
|
|
82370
|
-
name: "Service Portal",
|
|
82617
|
+
pageCount: 14
|
|
82618
|
+
}),
|
|
82619
|
+
portalRow("p4", "sp", "Service Portal", "a3", {
|
|
82371
82620
|
active: true,
|
|
82372
|
-
pageCount: 9
|
|
82373
|
-
|
|
82374
|
-
|
|
82375
|
-
},
|
|
82376
|
-
{
|
|
82377
|
-
id: "p5",
|
|
82378
|
-
slug: "hr",
|
|
82379
|
-
name: "HR Portal",
|
|
82621
|
+
pageCount: 9
|
|
82622
|
+
}),
|
|
82623
|
+
portalRow("p5", "hr", "HR Portal", "a2", {
|
|
82380
82624
|
active: false,
|
|
82381
|
-
pageCount: 4
|
|
82382
|
-
|
|
82383
|
-
}
|
|
82625
|
+
pageCount: 4
|
|
82626
|
+
})
|
|
82384
82627
|
];
|
|
82385
|
-
|
|
82386
|
-
|
|
82387
|
-
|
|
82388
|
-
|
|
82389
|
-
|
|
82390
|
-
|
|
82391
|
-
},
|
|
82392
|
-
{
|
|
82393
|
-
key: "slate",
|
|
82394
|
-
name: "Slate",
|
|
82395
|
-
active: true,
|
|
82396
|
-
tokens: { light: { primary: "#475569" } }
|
|
82397
|
-
},
|
|
82398
|
-
{
|
|
82399
|
-
key: "emerald",
|
|
82400
|
-
name: "Emerald",
|
|
82628
|
+
/** A `GET /themes` row (registry/catalog.ts listThemes), as forge-create keeps it (the active ones). */
|
|
82629
|
+
function themeRow(id, key, name, primary) {
|
|
82630
|
+
return {
|
|
82631
|
+
id,
|
|
82632
|
+
key,
|
|
82633
|
+
name,
|
|
82401
82634
|
active: true,
|
|
82402
|
-
|
|
82403
|
-
|
|
82635
|
+
revision: 1,
|
|
82636
|
+
app: appRef("a3"),
|
|
82637
|
+
build: null,
|
|
82638
|
+
description: "",
|
|
82639
|
+
source: "preset",
|
|
82640
|
+
presetGroup: "Core",
|
|
82641
|
+
order: 100,
|
|
82642
|
+
tokens: {
|
|
82643
|
+
light: { primary },
|
|
82644
|
+
dark: { primary }
|
|
82645
|
+
},
|
|
82646
|
+
usedBy: [],
|
|
82647
|
+
updatedOn: "2026-11-20 09:12:44"
|
|
82648
|
+
};
|
|
82649
|
+
}
|
|
82650
|
+
var THEMES = [
|
|
82651
|
+
themeRow("t1", "starter", "Starter", "#2563eb"),
|
|
82652
|
+
themeRow("t2", "slate", "Slate", "#475569"),
|
|
82653
|
+
themeRow("t3", "emerald", "Emerald", "oklch(0.6 0.15 160)")
|
|
82404
82654
|
];
|
|
82405
|
-
|
|
82406
|
-
|
|
82407
|
-
|
|
82408
|
-
|
|
82409
|
-
|
|
82410
|
-
|
|
82411
|
-
|
|
82412
|
-
|
|
82413
|
-
|
|
82655
|
+
/** A `GET /components?kind=layout` row (forge/services.ts searchComponents). */
|
|
82656
|
+
function layoutRow(id, uniqueId, name) {
|
|
82657
|
+
return {
|
|
82658
|
+
id,
|
|
82659
|
+
uniqueId,
|
|
82660
|
+
name,
|
|
82661
|
+
kind: "layout",
|
|
82662
|
+
description: "",
|
|
82663
|
+
placeable: false,
|
|
82664
|
+
optionKeys: [],
|
|
82665
|
+
buildState: "built"
|
|
82666
|
+
};
|
|
82667
|
+
}
|
|
82668
|
+
var LAYOUTS = [layoutRow("l1", "rp/app-shell", "App shell"), layoutRow("l2", "rp/top-nav", "Top navigation")];
|
|
82414
82669
|
/** A slug from a name, as forge-core's slugFromName does it. */
|
|
82415
82670
|
function slugFromName(name) {
|
|
82416
82671
|
let s = String(name || "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").substring(0, 40).replace(/-+$/, "");
|
|
@@ -82503,18 +82758,43 @@ function mockCreateEngine(o = {}) {
|
|
|
82503
82758
|
portals: async () => PORTALS,
|
|
82504
82759
|
portal: async (_p, ref) => {
|
|
82505
82760
|
const p = PORTALS.find((x) => x.id === ref || x.slug === ref);
|
|
82506
|
-
|
|
82761
|
+
if (!p) throw Object.assign(/* @__PURE__ */ new Error(`No portal "${ref}"`), { code: "not_found" });
|
|
82507
82762
|
return {
|
|
82508
82763
|
portal: {
|
|
82509
|
-
|
|
82510
|
-
|
|
82764
|
+
id: p.id,
|
|
82765
|
+
slug: p.slug,
|
|
82766
|
+
name: p.name,
|
|
82767
|
+
active: p.active,
|
|
82768
|
+
isDefault: false,
|
|
82769
|
+
isTemplate: p.isTemplate,
|
|
82770
|
+
description: "",
|
|
82771
|
+
roles: [],
|
|
82772
|
+
theme: p.theme,
|
|
82773
|
+
defaultLayout: p.defaultLayout,
|
|
82774
|
+
homePage: `${p.id}-pg0`,
|
|
82775
|
+
navigation: [],
|
|
82776
|
+
settings: {},
|
|
82777
|
+
app: p.app
|
|
82511
82778
|
},
|
|
82512
|
-
|
|
82513
|
-
|
|
82514
|
-
|
|
82779
|
+
pages: Array.from({ length: p.pageCount }, (_, i) => ({
|
|
82780
|
+
id: `${p.id}-pg${i}`,
|
|
82781
|
+
name: i === 0 ? "Home" : `Page ${i}`,
|
|
82515
82782
|
title: i === 0 ? "Home" : `Page ${i}`,
|
|
82516
|
-
|
|
82517
|
-
|
|
82783
|
+
route: i === 0 ? "home" : `page-${i}`,
|
|
82784
|
+
order: i * 100,
|
|
82785
|
+
active: true,
|
|
82786
|
+
portalId: p.id
|
|
82787
|
+
})),
|
|
82788
|
+
panels: [],
|
|
82789
|
+
variants: [],
|
|
82790
|
+
portalPlacements: {},
|
|
82791
|
+
layouts: LAYOUTS.map((l) => ({
|
|
82792
|
+
id: l.id,
|
|
82793
|
+
uniqueId: l.uniqueId,
|
|
82794
|
+
name: l.name,
|
|
82795
|
+
regions: []
|
|
82796
|
+
})),
|
|
82797
|
+
menus: []
|
|
82518
82798
|
};
|
|
82519
82799
|
},
|
|
82520
82800
|
themes: async () => THEMES,
|
|
@@ -82522,13 +82802,19 @@ function mockCreateEngine(o = {}) {
|
|
|
82522
82802
|
slugAvailable: async (_p, slug) => {
|
|
82523
82803
|
const taken = PORTALS.find((p) => p.slug === slug);
|
|
82524
82804
|
return taken ? {
|
|
82805
|
+
slug,
|
|
82525
82806
|
available: false,
|
|
82807
|
+
reason: "taken",
|
|
82526
82808
|
takenBy: {
|
|
82809
|
+
id: taken.id,
|
|
82527
82810
|
name: taken.name,
|
|
82528
82811
|
active: taken.active
|
|
82529
82812
|
},
|
|
82530
82813
|
suggestion: `${slug}-2`
|
|
82531
|
-
} : {
|
|
82814
|
+
} : {
|
|
82815
|
+
slug,
|
|
82816
|
+
available: true
|
|
82817
|
+
};
|
|
82532
82818
|
},
|
|
82533
82819
|
brandTheme: async (th) => {
|
|
82534
82820
|
if (!/^#[0-9a-f]{6}$/i.test(String(th.color || ""))) throw new Error("Use a hex color such as #2563eb");
|
|
@@ -82554,6 +82840,7 @@ function mockCreateEngine(o = {}) {
|
|
|
82554
82840
|
if (!app) throw Object.assign(/* @__PURE__ */ new Error(`${a.app} is not an application you can author in`), { code: "bad_answers" });
|
|
82555
82841
|
const slug = a.slug || slugFromName(a.name);
|
|
82556
82842
|
const isNew = typeof a.updateSet === "object";
|
|
82843
|
+
if (isNew && app.reactPortal) throw Object.assign(/* @__PURE__ */ new Error(`${app.name} is React Portal itself: pick another application`), { code: "wrong_scope" });
|
|
82557
82844
|
const set = isNew ? {
|
|
82558
82845
|
id: "",
|
|
82559
82846
|
name: a.updateSet.create,
|
|
@@ -82588,8 +82875,8 @@ function mockCreateEngine(o = {}) {
|
|
|
82588
82875
|
];
|
|
82589
82876
|
const counts = {};
|
|
82590
82877
|
for (const c of creates) counts[c.table.replace(/^x_312987_portal_/, "")] = (counts[c.table.replace(/^x_312987_portal_/, "")] || 0) + 1;
|
|
82591
|
-
const warnings = [`Created in update set "${set.name}"
|
|
82592
|
-
if (app.reactPortal) warnings.push("React Portal owns this portal:
|
|
82878
|
+
const warnings = [`Created in ${app.name}, ${isNew ? "the new " : ""}update set "${set.name}". Your application picker is switched for this request only and restored at its end.`];
|
|
82879
|
+
if (app.reactPortal) warnings.push("React Portal itself owns this portal: its records belong to React Portal (reconcile your edits after upgrades)");
|
|
82593
82880
|
const local = [`pull ${slug} into ${opt.folder}`];
|
|
82594
82881
|
if (opt.extras.prettierrc) local.push("write .prettierrc.json");
|
|
82595
82882
|
if (opt.extras.gitignore) local.push("write .gitignore");
|
|
@@ -82606,14 +82893,33 @@ function mockCreateEngine(o = {}) {
|
|
|
82606
82893
|
},
|
|
82607
82894
|
updateSet: set,
|
|
82608
82895
|
plan: {
|
|
82609
|
-
|
|
82896
|
+
op: "create_portal",
|
|
82897
|
+
summary: `Create portal ${slug} ("${a.name}") as an inactive draft in ${app.name}`,
|
|
82610
82898
|
creates,
|
|
82611
82899
|
updates: [],
|
|
82900
|
+
deactivates: [],
|
|
82612
82901
|
warnings,
|
|
82613
|
-
hash: `7c19e0a4b2d3f581${slug.length.toString(16)}`.slice(0, 16)
|
|
82902
|
+
hash: `7c19e0a4b2d3f581${slug.length.toString(16)}`.slice(0, 16),
|
|
82903
|
+
target: {
|
|
82904
|
+
app: appRef(app.id),
|
|
82905
|
+
updateSet: {
|
|
82906
|
+
id: set.id || "s-preview",
|
|
82907
|
+
name: set.name
|
|
82908
|
+
}
|
|
82909
|
+
}
|
|
82614
82910
|
},
|
|
82615
82911
|
counts: Object.entries(counts),
|
|
82616
|
-
updateSetPlan: isNew ? {
|
|
82912
|
+
updateSetPlan: isNew ? {
|
|
82913
|
+
op: "create_update_set",
|
|
82914
|
+
summary: `Create the update set "${set.name}" in ${app.name}`,
|
|
82915
|
+
creates: [{
|
|
82916
|
+
table: "sys_update_set",
|
|
82917
|
+
display: set.name
|
|
82918
|
+
}],
|
|
82919
|
+
updates: [],
|
|
82920
|
+
deactivates: [],
|
|
82921
|
+
warnings: []
|
|
82922
|
+
} : null,
|
|
82617
82923
|
contrast: [],
|
|
82618
82924
|
local
|
|
82619
82925
|
};
|
|
@@ -82636,6 +82942,18 @@ function mockCreateEngine(o = {}) {
|
|
|
82636
82942
|
};
|
|
82637
82943
|
step(`Creating ${slug} on mock.service-now.com`);
|
|
82638
82944
|
await delay(stepMs * 2);
|
|
82945
|
+
const created = {
|
|
82946
|
+
id: `p-${slug}`,
|
|
82947
|
+
slug,
|
|
82948
|
+
name: a.name,
|
|
82949
|
+
active: false,
|
|
82950
|
+
homePage: `p-${slug}-pg0`,
|
|
82951
|
+
session: "x_acme_crm → x_acme_crm; restored",
|
|
82952
|
+
target: {
|
|
82953
|
+
app: appRef(app.id),
|
|
82954
|
+
updateSet: set
|
|
82955
|
+
}
|
|
82956
|
+
};
|
|
82639
82957
|
step(`Pulling ${slug} into ${opt.folder}`);
|
|
82640
82958
|
await delay(stepMs);
|
|
82641
82959
|
const key = `${opt.folder}`;
|
|
@@ -82643,9 +82961,9 @@ function mockCreateEngine(o = {}) {
|
|
|
82643
82961
|
failedOnce.add(key);
|
|
82644
82962
|
return {
|
|
82645
82963
|
slug,
|
|
82646
|
-
created
|
|
82964
|
+
created,
|
|
82647
82965
|
updateSet: set,
|
|
82648
|
-
studioUrl: `https://mock.service-now.com/studio/
|
|
82966
|
+
studioUrl: `https://mock.service-now.com/x/312987/portal/studio/params/view/pages/id/p-${slug}`,
|
|
82649
82967
|
folder: opt.folder,
|
|
82650
82968
|
pull: null,
|
|
82651
82969
|
files: [],
|
|
@@ -82657,9 +82975,9 @@ function mockCreateEngine(o = {}) {
|
|
|
82657
82975
|
for (const f of files) step(`wrote ${f}`);
|
|
82658
82976
|
return {
|
|
82659
82977
|
slug,
|
|
82660
|
-
created
|
|
82978
|
+
created,
|
|
82661
82979
|
updateSet: set,
|
|
82662
|
-
studioUrl: `https://mock.service-now.com/studio/
|
|
82980
|
+
studioUrl: `https://mock.service-now.com/x/312987/portal/studio/params/view/pages/id/p-${slug}`,
|
|
82663
82981
|
folder: opt.folder,
|
|
82664
82982
|
pull: {
|
|
82665
82983
|
mode: "fresh",
|
|
@@ -82671,19 +82989,16 @@ function mockCreateEngine(o = {}) {
|
|
|
82671
82989
|
pull: async (profile, opt, step) => {
|
|
82672
82990
|
gate(profile);
|
|
82673
82991
|
if (!opt.retry && !isEmpty(opt.folder)) throw Object.assign(/* @__PURE__ */ new Error(`${opt.folder} is not empty: pick an empty or new folder`), { code: "folder_not_empty" });
|
|
82674
|
-
const portal = PORTALS.find((p) => p.slug === opt.portal || p.id === opt.portal)
|
|
82675
|
-
|
|
82676
|
-
|
|
82677
|
-
|
|
82678
|
-
};
|
|
82679
|
-
const app = APPS.find((x) => x.scope === portal.app) || APPS[0];
|
|
82680
|
-
step(`Pulling ${portal.slug} into ${opt.folder}`);
|
|
82992
|
+
const portal = PORTALS.find((p) => p.slug === opt.portal || p.id === opt.portal);
|
|
82993
|
+
const slug = portal ? portal.slug : opt.portal;
|
|
82994
|
+
const app = APPS.find((x) => x.id === portal?.app.id) || APPS[0];
|
|
82995
|
+
step(`Pulling ${slug} into ${opt.folder}`);
|
|
82681
82996
|
await delay(stepMs * 2);
|
|
82682
82997
|
const set = (SETS[app.id] || []).find((s) => s.id === opt.updateSet || s.name === opt.updateSet) || {
|
|
82683
82998
|
id: opt.updateSet,
|
|
82684
82999
|
name: opt.updateSet
|
|
82685
83000
|
};
|
|
82686
|
-
const files = writeWorkspace(opt.folder,
|
|
83001
|
+
const files = writeWorkspace(opt.folder, slug, portal ? portal.name : slug, app, set, opt.extras);
|
|
82687
83002
|
for (const f of files) step(`wrote ${f}`);
|
|
82688
83003
|
return {
|
|
82689
83004
|
folder: opt.folder,
|