@synap-core/workspace-templates 0.76.1 → 0.78.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/index.js +265 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/builder.yaml +4 -0
- package/src/content-os.relations.template.test.ts +83 -0
- package/src/content-os.yaml +66 -0
- package/src/lifecycle-declarations.test.ts +2 -0
- package/src/operations.estimate.template.test.ts +125 -0
- package/src/operations.yaml +138 -0
- package/src/templates.ts +265 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synap-core/workspace-templates",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.78.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Canonical workspace definitions — YAML source + typed exports for browser, backend, CLI, and marketplace",
|
|
6
6
|
"license": "PolyForm-Noncommercial-1.0.0",
|
package/src/builder.yaml
CHANGED
|
@@ -1619,6 +1619,7 @@ profiles:
|
|
|
1619
1619
|
label: App
|
|
1620
1620
|
valueType: entity_id
|
|
1621
1621
|
targetProfileSlug: devplane_app
|
|
1622
|
+
relation: belongs_to
|
|
1622
1623
|
inputType: entity_select
|
|
1623
1624
|
description: The app this design is for (one devplane_app, filed into the design's project). The Design app lists an app's designs by it; target-surface stays the screen's name.
|
|
1624
1625
|
- slug: design-scope
|
|
@@ -1663,6 +1664,7 @@ profiles:
|
|
|
1663
1664
|
label: Screenshot
|
|
1664
1665
|
valueType: entity_id
|
|
1665
1666
|
targetProfileSlug: file
|
|
1667
|
+
relation: references
|
|
1666
1668
|
inputType: entity_select
|
|
1667
1669
|
description: A render of the design, for review at a glance.
|
|
1668
1670
|
- slug: motion
|
|
@@ -1764,6 +1766,7 @@ profiles:
|
|
|
1764
1766
|
label: Screenshot
|
|
1765
1767
|
valueType: entity_id
|
|
1766
1768
|
targetProfileSlug: file
|
|
1769
|
+
relation: references
|
|
1767
1770
|
inputType: entity_select
|
|
1768
1771
|
description: A render of its main story, for review at a glance.
|
|
1769
1772
|
- slug: props-summary
|
|
@@ -1785,6 +1788,7 @@ profiles:
|
|
|
1785
1788
|
label: App
|
|
1786
1789
|
valueType: entity_id
|
|
1787
1790
|
targetProfileSlug: devplane_app
|
|
1791
|
+
relation: belongs_to
|
|
1788
1792
|
inputType: entity_select
|
|
1789
1793
|
description: The app (devplane_app) whose Storybook it comes from.
|
|
1790
1794
|
- slug: source-hash
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every entity-id property of Content OS declares the relation it creates (REL1,
|
|
3
|
+
* 4 Dec 2026; backend#1498: a template property's `relation` makes writing it a
|
|
4
|
+
* link, and the space health read flags `relation-as-property` for one that does
|
|
5
|
+
* not). Read from the YAML SOURCE.
|
|
6
|
+
*
|
|
7
|
+
* The six left without a relation are NAMED here, each because no existing
|
|
8
|
+
* relation type fits (extend, never twin: a new type is the founder's call) or
|
|
9
|
+
* because two properties of one kind would need the same type (one property per
|
|
10
|
+
* relation per kind). Adding a relation to one removes it from this list: the
|
|
11
|
+
* test fails until it does, so the list can only shrink.
|
|
12
|
+
*/
|
|
13
|
+
import { describe, expect, it } from "vitest";
|
|
14
|
+
import { readFileSync } from "node:fs";
|
|
15
|
+
import { dirname, join } from "node:path";
|
|
16
|
+
import { fileURLToPath } from "node:url";
|
|
17
|
+
import { load } from "js-yaml";
|
|
18
|
+
import type { WorkspaceYaml } from "./types.js";
|
|
19
|
+
|
|
20
|
+
const dir = dirname(fileURLToPath(import.meta.url));
|
|
21
|
+
const read = (f: string) => load(readFileSync(join(dir, f), "utf8")) as WorkspaceYaml;
|
|
22
|
+
const contentOs = read("content-os.yaml");
|
|
23
|
+
const builder = read("builder.yaml");
|
|
24
|
+
|
|
25
|
+
const entityIdProps = (t: WorkspaceYaml) =>
|
|
26
|
+
t.profiles.flatMap((p) =>
|
|
27
|
+
p.properties
|
|
28
|
+
.filter((pr) => pr.valueType === "entity_id")
|
|
29
|
+
.map((pr) => ({ at: `${p.slug}.${pr.slug}`, relation: (pr as { relation?: string }).relation }))
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const QUESTIONS = [
|
|
33
|
+
"post.post-account", // post -> platform: no `published_on` type
|
|
34
|
+
"post.post-copy-of", // post -> post: `derived_from` is taken by post.derived-from (one per kind)
|
|
35
|
+
"pillar.pillar-pain-ref", // pillar -> pain-point: no `addresses` type
|
|
36
|
+
"offer.offer-positioning", // offer -> positioning: no type
|
|
37
|
+
"content-composition.project-zip", // composition -> file twice (zip, mp4): needs two types
|
|
38
|
+
"content-composition.render-mp4",
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
describe("Content OS: a property that holds an entity id creates a link", () => {
|
|
42
|
+
const props = entityIdProps(contentOs);
|
|
43
|
+
|
|
44
|
+
it("finds the properties it guards (non-vacuity)", () => {
|
|
45
|
+
expect(props.length).toBeGreaterThanOrEqual(28);
|
|
46
|
+
expect(props.filter((p) => p.relation).length).toBeGreaterThanOrEqual(22);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("leaves only the named questions without a relation", () => {
|
|
50
|
+
expect(props.filter((p) => !p.relation).map((p) => p.at).sort()).toEqual([...QUESTIONS].sort());
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("each relation names an edge the template declares or a dependency's type", () => {
|
|
54
|
+
const own = new Set((contentOs.entityLinks ?? []).map((l) => l.type));
|
|
55
|
+
for (const p of props.filter((x) => x.relation))
|
|
56
|
+
expect(
|
|
57
|
+
own.has(p.relation!) || ["targets", "affects", "uses", "derived_from", "references"].includes(p.relation!),
|
|
58
|
+
p.at
|
|
59
|
+
).toBe(true);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("the edge each property creates is declared as a link between its kinds", () => {
|
|
63
|
+
const links = new Set((contentOs.entityLinks ?? []).map((l) => `${l.sourceProfileSlug}>${l.targetProfileSlug}:${l.type}`));
|
|
64
|
+
for (const at of [
|
|
65
|
+
"newsletter>campaign:part_of_campaign",
|
|
66
|
+
"newsletter>pillar:belongs_to_pillar",
|
|
67
|
+
"newsletter>sponsor:sponsored_by",
|
|
68
|
+
"series>pillar:belongs_to_pillar",
|
|
69
|
+
"idea>journey-stage:at_journey_stage",
|
|
70
|
+
])
|
|
71
|
+
expect(links.has(at), at).toBe(true);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
describe("Builder: the design's app and screenshot create links", () => {
|
|
76
|
+
it("ui-design and ui-component declare belongs_to (app) and references (screenshot)", () => {
|
|
77
|
+
const by = Object.fromEntries(entityIdProps(builder).map((p) => [p.at, p.relation]));
|
|
78
|
+
expect(by["ui-design.design-app"]).toBe("belongs_to");
|
|
79
|
+
expect(by["ui-design.screenshot"]).toBe("references");
|
|
80
|
+
expect(by["ui-component.design-app"]).toBe("belongs_to");
|
|
81
|
+
expect(by["ui-component.screenshot"]).toBe("references");
|
|
82
|
+
});
|
|
83
|
+
});
|
package/src/content-os.yaml
CHANGED
|
@@ -343,6 +343,7 @@ profiles:
|
|
|
343
343
|
label: Sponsor
|
|
344
344
|
valueType: entity_id
|
|
345
345
|
targetProfileSlug: sponsor
|
|
346
|
+
relation: sponsored_by
|
|
346
347
|
inputType: entity_select
|
|
347
348
|
# ── The journey layer — BOTH axes optional, and independent ────────────
|
|
348
349
|
# `post-stage` is the AUDIENCE axis (unordered: where is the reader), and
|
|
@@ -355,6 +356,7 @@ profiles:
|
|
|
355
356
|
label: Journey Stage
|
|
356
357
|
valueType: entity_id
|
|
357
358
|
targetProfileSlug: journey-stage
|
|
359
|
+
relation: at_journey_stage
|
|
358
360
|
inputType: entity_select
|
|
359
361
|
- slug: post-series
|
|
360
362
|
label: Series
|
|
@@ -382,6 +384,7 @@ profiles:
|
|
|
382
384
|
label: Offer
|
|
383
385
|
valueType: entity_id
|
|
384
386
|
targetProfileSlug: offer
|
|
387
|
+
relation: teaches_toward
|
|
385
388
|
inputType: entity_select
|
|
386
389
|
- slug: publish-date
|
|
387
390
|
label: Publish Date
|
|
@@ -423,6 +426,7 @@ profiles:
|
|
|
423
426
|
label: Repurposed From
|
|
424
427
|
valueType: entity_id
|
|
425
428
|
targetProfileSlug: post
|
|
429
|
+
relation: derived_from
|
|
426
430
|
inputType: entity_select
|
|
427
431
|
# The person's own words, verbatim (B7). Stored by capture before it was
|
|
428
432
|
# declared; declared so it can be queried and validated.
|
|
@@ -607,6 +611,7 @@ profiles:
|
|
|
607
611
|
label: Journey Stage
|
|
608
612
|
valueType: entity_id
|
|
609
613
|
targetProfileSlug: journey-stage
|
|
614
|
+
relation: at_journey_stage
|
|
610
615
|
inputType: entity_select
|
|
611
616
|
# Where it came from (`source:dump`, `source:interview`, …), as on `post-tags`.
|
|
612
617
|
- slug: idea-tags
|
|
@@ -667,6 +672,7 @@ profiles:
|
|
|
667
672
|
label: Audience
|
|
668
673
|
valueType: entity_id
|
|
669
674
|
targetProfileSlug: audience
|
|
675
|
+
relation: targets
|
|
670
676
|
inputType: entity_select
|
|
671
677
|
- slug: pillar-pain-ref
|
|
672
678
|
label: Pain Addressed
|
|
@@ -755,6 +761,7 @@ profiles:
|
|
|
755
761
|
label: Audience
|
|
756
762
|
valueType: entity_id
|
|
757
763
|
targetProfileSlug: audience
|
|
764
|
+
relation: targets
|
|
758
765
|
inputType: entity_select
|
|
759
766
|
- slug: belief-installed
|
|
760
767
|
label: Now Believes
|
|
@@ -821,6 +828,7 @@ profiles:
|
|
|
821
828
|
label: Pillar
|
|
822
829
|
valueType: entity_id
|
|
823
830
|
targetProfileSlug: pillar
|
|
831
|
+
relation: belongs_to_pillar
|
|
824
832
|
inputType: entity_select
|
|
825
833
|
|
|
826
834
|
# `platform` is the ONE pod-wide publishing-account *vocabulary*. `scope: shared`
|
|
@@ -1023,16 +1031,19 @@ profiles:
|
|
|
1023
1031
|
label: Sponsor
|
|
1024
1032
|
valueType: entity_id
|
|
1025
1033
|
targetProfileSlug: sponsor
|
|
1034
|
+
relation: sponsored_by
|
|
1026
1035
|
inputType: entity_select
|
|
1027
1036
|
- slug: newsletter-campaign
|
|
1028
1037
|
label: Campaign
|
|
1029
1038
|
valueType: entity_id
|
|
1030
1039
|
targetProfileSlug: campaign
|
|
1040
|
+
relation: part_of_campaign
|
|
1031
1041
|
inputType: entity_select
|
|
1032
1042
|
- slug: newsletter-pillar
|
|
1033
1043
|
label: Primary Pillar
|
|
1034
1044
|
valueType: entity_id
|
|
1035
1045
|
targetProfileSlug: pillar
|
|
1046
|
+
relation: belongs_to_pillar
|
|
1036
1047
|
inputType: entity_select
|
|
1037
1048
|
- slug: newsletter-tags
|
|
1038
1049
|
label: Tags
|
|
@@ -1225,6 +1236,7 @@ profiles:
|
|
|
1225
1236
|
label: Audience
|
|
1226
1237
|
valueType: entity_id
|
|
1227
1238
|
targetProfileSlug: audience
|
|
1239
|
+
relation: affects
|
|
1228
1240
|
inputType: entity_select
|
|
1229
1241
|
- slug: evidence
|
|
1230
1242
|
label: Evidence
|
|
@@ -1318,6 +1330,7 @@ profiles:
|
|
|
1318
1330
|
label: Audience
|
|
1319
1331
|
valueType: entity_id
|
|
1320
1332
|
targetProfileSlug: audience
|
|
1333
|
+
relation: targets
|
|
1321
1334
|
inputType: entity_select
|
|
1322
1335
|
- slug: offer-positioning
|
|
1323
1336
|
label: Positioning
|
|
@@ -1503,6 +1516,7 @@ profiles:
|
|
|
1503
1516
|
label: Template
|
|
1504
1517
|
valueType: entity_id
|
|
1505
1518
|
targetProfileSlug: brand-template
|
|
1519
|
+
relation: uses
|
|
1506
1520
|
inputType: entity_select
|
|
1507
1521
|
description: The reusable brand-template shell this started from.
|
|
1508
1522
|
- slug: recipe-ref
|
|
@@ -1659,6 +1673,7 @@ profiles:
|
|
|
1659
1673
|
label: Cut from take
|
|
1660
1674
|
valueType: entity_id
|
|
1661
1675
|
targetProfileSlug: content-asset
|
|
1676
|
+
relation: derived_from
|
|
1662
1677
|
inputType: entity_select
|
|
1663
1678
|
- slug: source-start
|
|
1664
1679
|
label: Starts at (s)
|
|
@@ -1718,6 +1733,7 @@ profiles:
|
|
|
1718
1733
|
label: Output
|
|
1719
1734
|
valueType: entity_id
|
|
1720
1735
|
targetProfileSlug: file
|
|
1736
|
+
relation: references
|
|
1721
1737
|
inputType: entity_select
|
|
1722
1738
|
- slug: output-url
|
|
1723
1739
|
label: Output URL
|
|
@@ -2035,6 +2051,56 @@ profileEntityBentoTemplates:
|
|
|
2035
2051
|
|
|
2036
2052
|
# Editorial graph: connect posts to campaign / pillar / sponsor
|
|
2037
2053
|
entityLinks:
|
|
2054
|
+
# REL1 (4 Dec 2026): the edges the properties above create (each property
|
|
2055
|
+
# declares its relation; the pair is declared here so the graph knows it).
|
|
2056
|
+
- sourceProfileSlug: idea
|
|
2057
|
+
targetProfileSlug: journey-stage
|
|
2058
|
+
type: at_journey_stage
|
|
2059
|
+
label: Journey Stage
|
|
2060
|
+
- sourceProfileSlug: pillar
|
|
2061
|
+
targetProfileSlug: audience
|
|
2062
|
+
type: targets
|
|
2063
|
+
label: Audience
|
|
2064
|
+
- sourceProfileSlug: journey-stage
|
|
2065
|
+
targetProfileSlug: audience
|
|
2066
|
+
type: targets
|
|
2067
|
+
label: Audience
|
|
2068
|
+
- sourceProfileSlug: series
|
|
2069
|
+
targetProfileSlug: pillar
|
|
2070
|
+
type: belongs_to_pillar
|
|
2071
|
+
label: Pillar
|
|
2072
|
+
- sourceProfileSlug: newsletter
|
|
2073
|
+
targetProfileSlug: sponsor
|
|
2074
|
+
type: sponsored_by
|
|
2075
|
+
label: Sponsor
|
|
2076
|
+
- sourceProfileSlug: newsletter
|
|
2077
|
+
targetProfileSlug: campaign
|
|
2078
|
+
type: part_of_campaign
|
|
2079
|
+
label: Campaign
|
|
2080
|
+
- sourceProfileSlug: newsletter
|
|
2081
|
+
targetProfileSlug: pillar
|
|
2082
|
+
type: belongs_to_pillar
|
|
2083
|
+
label: Pillar
|
|
2084
|
+
- sourceProfileSlug: offer
|
|
2085
|
+
targetProfileSlug: audience
|
|
2086
|
+
type: targets
|
|
2087
|
+
label: Audience
|
|
2088
|
+
- sourceProfileSlug: content-composition
|
|
2089
|
+
targetProfileSlug: brand-template
|
|
2090
|
+
type: uses
|
|
2091
|
+
label: Template
|
|
2092
|
+
- sourceProfileSlug: content-asset
|
|
2093
|
+
targetProfileSlug: content-asset
|
|
2094
|
+
type: derived_from
|
|
2095
|
+
label: Taken from
|
|
2096
|
+
- sourceProfileSlug: pain-point
|
|
2097
|
+
targetProfileSlug: audience
|
|
2098
|
+
type: affects
|
|
2099
|
+
label: Audience
|
|
2100
|
+
- sourceProfileSlug: render-job
|
|
2101
|
+
targetProfileSlug: file
|
|
2102
|
+
type: references
|
|
2103
|
+
label: Output file
|
|
2038
2104
|
- sourceProfileSlug: post
|
|
2039
2105
|
targetProfileSlug: campaign
|
|
2040
2106
|
type: part_of_campaign
|
|
@@ -342,6 +342,8 @@ describe("lifecycle declarations — coverage (derived from the playbooks)", ()
|
|
|
342
342
|
"operations:deliverable.cancelled",
|
|
343
343
|
"operations:engagement.cancelled",
|
|
344
344
|
"operations:engagement.on-hold",
|
|
345
|
+
"operations:estimate.accepted",
|
|
346
|
+
"operations:estimate.declined",
|
|
345
347
|
"social:post.Archived",
|
|
346
348
|
"social:post.Idea",
|
|
347
349
|
"social:post.Scheduled",
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operations: the `estimate` kind (decision e480340b) and the rule that makes
|
|
3
|
+
* its references reach a kind on the pod. Read from the YAML SOURCE.
|
|
4
|
+
*
|
|
5
|
+
* Why the reference rule is its own test: `synap catalog validate` accepts a
|
|
6
|
+
* target from a DEPENDENCY's vocabulary, but the pod does not. Both provisioning
|
|
7
|
+
* doors resolve a kind this template does not declare with
|
|
8
|
+
* `getBySlugForWorkspace(slug, workspaceId)` and no user, which admits only a
|
|
9
|
+
* system kind, a kind homed in this space, or a shared kind granted to it; the
|
|
10
|
+
* grant is written by declaring the shared kind here (backend
|
|
11
|
+
* `resolve-property-target-profiles.ts`, `kindVisibleWhere`). An unresolved
|
|
12
|
+
* target leaves the picker unconstrained and an unresolved link is skipped,
|
|
13
|
+
* both silently. So every target here must be a system kind or a kind this
|
|
14
|
+
* template declares. Not covered: whether the PICKER lists entities homed in
|
|
15
|
+
* another space (a runtime read, not the template).
|
|
16
|
+
*/
|
|
17
|
+
import { describe, expect, it } from "vitest";
|
|
18
|
+
import { readFileSync } from "node:fs";
|
|
19
|
+
import { dirname, join } from "node:path";
|
|
20
|
+
import { fileURLToPath } from "node:url";
|
|
21
|
+
import { load } from "js-yaml";
|
|
22
|
+
import type { WorkspaceYaml } from "./types.js";
|
|
23
|
+
import { SYSTEM_PROFILES } from "./validate.js";
|
|
24
|
+
|
|
25
|
+
const dir = dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
const read = (f: string) =>
|
|
27
|
+
load(readFileSync(join(dir, `${f}.yaml`), "utf8")) as WorkspaceYaml;
|
|
28
|
+
const ops = read("operations");
|
|
29
|
+
const declared = new Set(ops.profiles.map((p) => p.slug));
|
|
30
|
+
const reachable = (slug: string) =>
|
|
31
|
+
SYSTEM_PROFILES.has(slug) || declared.has(slug);
|
|
32
|
+
const estimate = ops.profiles.find((p) => p.slug === "estimate");
|
|
33
|
+
|
|
34
|
+
describe("Operations: every kind a reference names resolves from this space", () => {
|
|
35
|
+
const targets = [
|
|
36
|
+
...ops.profiles.flatMap((p) =>
|
|
37
|
+
p.properties
|
|
38
|
+
.filter((pr) => pr.valueType === "entity_id" && pr.targetProfileSlug)
|
|
39
|
+
.map((pr) => ({
|
|
40
|
+
at: `${p.slug}.${pr.slug}`,
|
|
41
|
+
slug: pr.targetProfileSlug!,
|
|
42
|
+
}))
|
|
43
|
+
),
|
|
44
|
+
...(ops.entityLinks ?? []).flatMap((l) => [
|
|
45
|
+
{ at: `entityLinks ${l.type} source`, slug: l.sourceProfileSlug },
|
|
46
|
+
{ at: `entityLinks ${l.type} target`, slug: l.targetProfileSlug },
|
|
47
|
+
]),
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
it("finds the references it guards (non-vacuity)", () => {
|
|
51
|
+
expect(targets.length).toBeGreaterThanOrEqual(15);
|
|
52
|
+
expect(targets.map((t) => t.at)).toContain("estimate.estimate-template");
|
|
53
|
+
// The rule can still see a miss: Finance's invoice is neither system nor declared here.
|
|
54
|
+
expect(reachable("invoice")).toBe(false);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("each is a system kind or a kind this template declares", () => {
|
|
58
|
+
expect(targets.filter((t) => !reachable(t.slug))).toEqual([]);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("a shared kind restated with no body is required from a template that holds the body", () => {
|
|
62
|
+
const refs = ops.profiles.filter(
|
|
63
|
+
(p) =>
|
|
64
|
+
(p.scope ?? "").toLowerCase() === "shared" && p.properties.length === 0
|
|
65
|
+
);
|
|
66
|
+
expect(refs.map((p) => p.slug).sort()).toEqual([
|
|
67
|
+
"brand-template",
|
|
68
|
+
"client",
|
|
69
|
+
]);
|
|
70
|
+
const required = (ops.dependencies ?? [])
|
|
71
|
+
.filter((d) => d.kind === "workspace" && d.relation === "require")
|
|
72
|
+
.map((d) => read(d.slug));
|
|
73
|
+
for (const ref of refs)
|
|
74
|
+
expect(
|
|
75
|
+
required.some((t) =>
|
|
76
|
+
t.profiles.some((p) => p.slug === ref.slug && p.properties.length > 0)
|
|
77
|
+
),
|
|
78
|
+
ref.slug
|
|
79
|
+
).toBe(true);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe("Operations: the estimate kind", () => {
|
|
84
|
+
it("declares its lifecycle once, accepting and declining by a person only", () => {
|
|
85
|
+
expect(estimate?.lifecycle?.property).toBe("estimate-status");
|
|
86
|
+
expect(
|
|
87
|
+
estimate?.lifecycle?.options.map((o) => [
|
|
88
|
+
o.key,
|
|
89
|
+
o.category,
|
|
90
|
+
o.humanOnly === true,
|
|
91
|
+
])
|
|
92
|
+
).toEqual([
|
|
93
|
+
["draft", "open", false],
|
|
94
|
+
["sent", "active", false],
|
|
95
|
+
["accepted", "done", true],
|
|
96
|
+
["declined", "lost", true],
|
|
97
|
+
["expired", "lost", false],
|
|
98
|
+
["superseded", "lost", false],
|
|
99
|
+
]);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("links its deal through the estimate-deal property, and declares its other edges", () => {
|
|
103
|
+
const deal = estimate?.properties.find((p) => p.slug === "estimate-deal");
|
|
104
|
+
expect(deal?.relation).toBe("estimate_for_deal");
|
|
105
|
+
const links = new Set(
|
|
106
|
+
(ops.entityLinks ?? []).map(
|
|
107
|
+
(l) => `${l.sourceProfileSlug}>${l.targetProfileSlug}:${l.type}`
|
|
108
|
+
)
|
|
109
|
+
);
|
|
110
|
+
for (const at of [
|
|
111
|
+
"estimate>deal:estimate_for_deal",
|
|
112
|
+
"estimate>contract:estimate_becomes_contract",
|
|
113
|
+
"estimate>estimate:revises",
|
|
114
|
+
])
|
|
115
|
+
expect(links.has(at), at).toBe(true);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it("stores its lines as a list, amounts in minor units", () => {
|
|
119
|
+
const lines = estimate?.properties.find((p) => p.slug === "estimate-lines");
|
|
120
|
+
expect(lines?.valueType).toBe("array");
|
|
121
|
+
expect(
|
|
122
|
+
(lines as { description?: string } | undefined)?.description
|
|
123
|
+
).toMatch(/minor units/);
|
|
124
|
+
});
|
|
125
|
+
});
|
package/src/operations.yaml
CHANGED
|
@@ -78,6 +78,19 @@ dependencies:
|
|
|
78
78
|
kind: workspace
|
|
79
79
|
relation: require
|
|
80
80
|
reason: "Provides the pod-wide `client` role this space onboards and serves (Clients board, Onboard a client) and its automations query."
|
|
81
|
+
# An estimate names the brand-template it is generated from
|
|
82
|
+
# (`estimate-template`). `brand-template` is Brand Library's `scope: shared`
|
|
83
|
+
# kind, home Content OS on a live pod: a template property resolves a kind it
|
|
84
|
+
# does not declare only when the kind is system, homed here, or shared AND
|
|
85
|
+
# granted to this space (`resolve-property-target-profiles.ts`). Operations
|
|
86
|
+
# re-declares it below to get that grant, as content-os does; requiring
|
|
87
|
+
# brand-library installs its FULL body first, so the reference never takes
|
|
88
|
+
# the pod-wide seat with an empty one (lead decision, estimate session
|
|
89
|
+
# f4d1244f, 4 Dec 2026).
|
|
90
|
+
- slug: brand-library
|
|
91
|
+
kind: workspace
|
|
92
|
+
relation: require
|
|
93
|
+
reason: "Provides the shared brand-template kind an estimate is generated from."
|
|
81
94
|
|
|
82
95
|
profiles:
|
|
83
96
|
# The pod-wide `client` role, REFERENCED (foundation's SSOT body; crm.yaml
|
|
@@ -252,6 +265,103 @@ profiles:
|
|
|
252
265
|
valueType: string
|
|
253
266
|
inputType: textarea
|
|
254
267
|
|
|
268
|
+
# A priced quote for a client, made before any contract (decision e480340b:
|
|
269
|
+
# its own kind, not a contract type or child; it links deal, contract and
|
|
270
|
+
# invoice). One deal has several estimates; a change after `sent` is a new
|
|
271
|
+
# estimate (version 2) that `revises` the old one, which becomes
|
|
272
|
+
# `superseded`. Amounts are integers in MINOR units (cents), the first kind
|
|
273
|
+
# to do so: moving an estimate to a contract needs a conversion. Synap never
|
|
274
|
+
# issues the invoice (decision 0b40ddbd): an estimate links its invoices with
|
|
275
|
+
# the pod-wide `relates_to` for now (see entityLinks below).
|
|
276
|
+
- slug: estimate
|
|
277
|
+
displayName: Estimate
|
|
278
|
+
icon: calculator
|
|
279
|
+
description: "A priced quote for a client, sent before any contract — its lines, currency, VAT, version and the date it is valid until."
|
|
280
|
+
# The ONE lifecycle (work model L1). Accepting and declining are the
|
|
281
|
+
# client's answer, recorded by a person; `expired` will be set by an
|
|
282
|
+
# automation and `superseded` when the next version is made (later slices).
|
|
283
|
+
lifecycle:
|
|
284
|
+
property: estimate-status
|
|
285
|
+
options:
|
|
286
|
+
- { key: draft, category: open }
|
|
287
|
+
- { key: sent, category: active }
|
|
288
|
+
- { key: accepted, category: done, humanOnly: true }
|
|
289
|
+
- { key: declined, category: lost, humanOnly: true }
|
|
290
|
+
- { key: expired, category: lost }
|
|
291
|
+
- { key: superseded, category: lost }
|
|
292
|
+
properties:
|
|
293
|
+
- slug: estimate-status
|
|
294
|
+
label: Status
|
|
295
|
+
valueType: string
|
|
296
|
+
inputType: select
|
|
297
|
+
enumValues: [draft, sent, accepted, declined, expired, superseded]
|
|
298
|
+
constraints: { defaultValue: draft }
|
|
299
|
+
# Written by hand: nothing numbers estimates yet.
|
|
300
|
+
- slug: estimate-number
|
|
301
|
+
label: Number
|
|
302
|
+
valueType: string
|
|
303
|
+
inputType: text
|
|
304
|
+
- slug: estimate-version
|
|
305
|
+
label: Version
|
|
306
|
+
valueType: number
|
|
307
|
+
inputType: number
|
|
308
|
+
constraints: { defaultValue: 1 }
|
|
309
|
+
- slug: issued-date
|
|
310
|
+
label: Issued
|
|
311
|
+
valueType: date
|
|
312
|
+
inputType: date
|
|
313
|
+
- slug: valid-until
|
|
314
|
+
label: Valid until
|
|
315
|
+
valueType: date
|
|
316
|
+
inputType: date
|
|
317
|
+
# ISO 4217 code.
|
|
318
|
+
- slug: estimate-currency
|
|
319
|
+
label: Currency
|
|
320
|
+
valueType: string
|
|
321
|
+
inputType: text
|
|
322
|
+
constraints: { defaultValue: EUR }
|
|
323
|
+
# Basis points: 2000 = 20 %.
|
|
324
|
+
- slug: estimate-vat-bp
|
|
325
|
+
label: VAT (basis points)
|
|
326
|
+
valueType: number
|
|
327
|
+
inputType: number
|
|
328
|
+
constraints: { defaultValue: 2000 }
|
|
329
|
+
- slug: estimate-lines
|
|
330
|
+
label: Lines
|
|
331
|
+
description: "The priced lines: a list of { label, quantity, unit_price }, unit_price an integer in minor units (cents)."
|
|
332
|
+
valueType: array
|
|
333
|
+
inputType: json
|
|
334
|
+
# Whoever wears the `client` role, a company or a person (the
|
|
335
|
+
# engagement-client precedent).
|
|
336
|
+
- slug: estimate-client
|
|
337
|
+
label: Client
|
|
338
|
+
valueType: entity_id
|
|
339
|
+
targetProfileSlug: client
|
|
340
|
+
inputType: entity_select
|
|
341
|
+
# Many estimates to at most one deal. `deal` is a system kind, so it
|
|
342
|
+
# resolves from this space.
|
|
343
|
+
- slug: estimate-deal
|
|
344
|
+
label: Deal
|
|
345
|
+
valueType: entity_id
|
|
346
|
+
targetProfileSlug: deal
|
|
347
|
+
relation: estimate_for_deal
|
|
348
|
+
inputType: entity_select
|
|
349
|
+
# The pinned template the estimate's body is generated from.
|
|
350
|
+
- slug: estimate-template
|
|
351
|
+
label: Template
|
|
352
|
+
valueType: entity_id
|
|
353
|
+
targetProfileSlug: brand-template
|
|
354
|
+
inputType: entity_select
|
|
355
|
+
|
|
356
|
+
# Brand Library's shared kind, REFERENCED (not owned, not twinned): this
|
|
357
|
+
# declaration writes Operations' grant so `estimate-template` resolves. No
|
|
358
|
+
# properties and no lifecycle are restated: brand-library (required above)
|
|
359
|
+
# holds the body.
|
|
360
|
+
- slug: brand-template
|
|
361
|
+
displayName: Brand Template
|
|
362
|
+
scope: shared
|
|
363
|
+
properties: []
|
|
364
|
+
|
|
255
365
|
# The durable OUTPUT of the daily briefing automation. A recap that only ever
|
|
256
366
|
# exists as a chat message is not knowledge — it cannot be queried, ranked, or
|
|
257
367
|
# linked. This kind is what turns the digest into structure: one dated row per
|
|
@@ -326,6 +436,25 @@ entityLinks:
|
|
|
326
436
|
targetProfileSlug: engagement
|
|
327
437
|
type: contract_for_engagement
|
|
328
438
|
label: Engagement
|
|
439
|
+
# The estimate's edges (decision e480340b). `estimate_for_deal` is written by
|
|
440
|
+
# the `estimate-deal` property. Cardinalities are the intent, not enforced:
|
|
441
|
+
# an estimate becomes at most one contract; version 2 `revises` version 1.
|
|
442
|
+
# The typed `invoice_for_estimate` is DEFERRED: `invoice` is Finance's
|
|
443
|
+
# workspace-scoped kind and resolves from no other space (declaring it here
|
|
444
|
+
# would promote it to shared), so an estimate links its invoices with the
|
|
445
|
+
# pod-wide `relates_to` until the invoice and its Pennylane or Qonto link land.
|
|
446
|
+
- sourceProfileSlug: estimate
|
|
447
|
+
targetProfileSlug: deal
|
|
448
|
+
type: estimate_for_deal
|
|
449
|
+
label: Deal
|
|
450
|
+
- sourceProfileSlug: estimate
|
|
451
|
+
targetProfileSlug: contract
|
|
452
|
+
type: estimate_becomes_contract
|
|
453
|
+
label: Contract
|
|
454
|
+
- sourceProfileSlug: estimate
|
|
455
|
+
targetProfileSlug: estimate
|
|
456
|
+
type: revises
|
|
457
|
+
label: Revises
|
|
329
458
|
|
|
330
459
|
# CURATED views — the delivery motion, not one per profile
|
|
331
460
|
views:
|
|
@@ -364,6 +493,11 @@ views:
|
|
|
364
493
|
description: "Contracts by status — the flow board of Get a contract signed."
|
|
365
494
|
config:
|
|
366
495
|
groupByField: contract-status
|
|
496
|
+
- name: Estimates
|
|
497
|
+
slug: estimates
|
|
498
|
+
type: table
|
|
499
|
+
scopeProfileSlug: estimate
|
|
500
|
+
description: "Estimates with their status, client, deal and validity."
|
|
367
501
|
- name: Client Briefings
|
|
368
502
|
slug: client-briefings
|
|
369
503
|
type: list
|
|
@@ -425,6 +559,10 @@ layout:
|
|
|
425
559
|
viewName: Contracts
|
|
426
560
|
label: Contracts
|
|
427
561
|
icon: file-signature
|
|
562
|
+
- kind: view
|
|
563
|
+
viewName: Estimates
|
|
564
|
+
label: Estimates
|
|
565
|
+
icon: calculator
|
|
428
566
|
|
|
429
567
|
# Bento dashboard
|
|
430
568
|
bento:
|