@contractspec/example.wealth-snapshot 3.7.17 → 3.7.18
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/browser/docs/index.js +5 -49
- package/dist/browser/docs/wealth-snapshot.docblock.js +5 -49
- package/dist/browser/entities/index.js +1 -191
- package/dist/browser/events.js +1 -111
- package/dist/browser/example.js +1 -42
- package/dist/browser/handlers/index.js +1 -5
- package/dist/browser/index.js +5 -851
- package/dist/browser/operations/index.js +1 -238
- package/dist/browser/presentations/index.js +1 -11
- package/dist/browser/presentations.js +1 -127
- package/dist/browser/wealth-snapshot.capability.js +1 -43
- package/dist/browser/wealth-snapshot.feature.js +1 -79
- package/dist/docs/index.js +5 -49
- package/dist/docs/wealth-snapshot.docblock.js +5 -49
- package/dist/entities/index.js +1 -191
- package/dist/events.js +1 -111
- package/dist/example.js +1 -42
- package/dist/handlers/index.js +1 -5
- package/dist/index.js +5 -851
- package/dist/node/docs/index.js +5 -49
- package/dist/node/docs/wealth-snapshot.docblock.js +5 -49
- package/dist/node/entities/index.js +1 -191
- package/dist/node/events.js +1 -111
- package/dist/node/example.js +1 -42
- package/dist/node/handlers/index.js +1 -5
- package/dist/node/index.js +5 -851
- package/dist/node/operations/index.js +1 -238
- package/dist/node/presentations/index.js +1 -11
- package/dist/node/presentations.js +1 -127
- package/dist/node/wealth-snapshot.capability.js +1 -43
- package/dist/node/wealth-snapshot.feature.js +1 -79
- package/dist/operations/index.js +1 -238
- package/dist/presentations/index.js +1 -11
- package/dist/presentations.js +1 -127
- package/dist/wealth-snapshot.capability.js +1 -43
- package/dist/wealth-snapshot.feature.js +1 -79
- package/package.json +8 -8
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
3
|
-
var wealthSnapshotDocBlocks = [
|
|
4
|
-
{
|
|
5
|
-
id: "docs.examples.wealth-snapshot",
|
|
6
|
-
title: "Wealth Snapshot",
|
|
7
|
-
summary: "Simple wealth overview with accounts, assets, liabilities, goals, and net-worth snapshots.",
|
|
8
|
-
kind: "reference",
|
|
9
|
-
visibility: "public",
|
|
10
|
-
route: "/docs/examples/wealth-snapshot",
|
|
11
|
-
tags: ["finance", "net-worth", "goals"],
|
|
12
|
-
body: `## Features
|
|
1
|
+
import{registerDocBlocks as m}from"@contractspec/lib.contracts-spec/docs";var f=[{id:"docs.examples.wealth-snapshot",title:"Wealth Snapshot",summary:"Simple wealth overview with accounts, assets, liabilities, goals, and net-worth snapshots.",kind:"reference",visibility:"public",route:"/docs/examples/wealth-snapshot",tags:["finance","net-worth","goals"],body:`## Features
|
|
13
2
|
|
|
14
3
|
- Accounts with balances/currencies.
|
|
15
4
|
- Assets & liabilities categorized for net worth.
|
|
@@ -23,17 +12,7 @@ var wealthSnapshotDocBlocks = [
|
|
|
23
12
|
|
|
24
13
|
## Presentations
|
|
25
14
|
- Dashboard, accounts list, assets list, liabilities list, goals list (React + Markdown targets).
|
|
26
|
-
`
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: "docs.examples.wealth-snapshot.goal",
|
|
30
|
-
title: "Wealth Snapshot — Goal",
|
|
31
|
-
summary: "Why this personal/household finance template exists.",
|
|
32
|
-
kind: "goal",
|
|
33
|
-
visibility: "public",
|
|
34
|
-
route: "/docs/examples/wealth-snapshot/goal",
|
|
35
|
-
tags: ["finance", "goal"],
|
|
36
|
-
body: `## Why it matters
|
|
15
|
+
`},{id:"docs.examples.wealth-snapshot.goal",title:"Wealth Snapshot — Goal",summary:"Why this personal/household finance template exists.",kind:"goal",visibility:"public",route:"/docs/examples/wealth-snapshot/goal",tags:["finance","goal"],body:`## Why it matters
|
|
37
16
|
- Provides a regenerable net-worth and goals view without bespoke finance code.
|
|
38
17
|
- Keeps accounts/assets/liabilities/goals consistent across surfaces with PII care.
|
|
39
18
|
|
|
@@ -43,17 +22,7 @@ var wealthSnapshotDocBlocks = [
|
|
|
43
22
|
|
|
44
23
|
## Success criteria
|
|
45
24
|
- Spec changes to assets/liabilities/goals regenerate UI/API/events cleanly.
|
|
46
|
-
- PII and sensitive values are marked and redacted where needed.`
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
id: "docs.examples.wealth-snapshot.usage",
|
|
50
|
-
title: "Wealth Snapshot — Usage",
|
|
51
|
-
summary: "How to seed, extend, and regenerate wealth tracking safely.",
|
|
52
|
-
kind: "usage",
|
|
53
|
-
visibility: "public",
|
|
54
|
-
route: "/docs/examples/wealth-snapshot/usage",
|
|
55
|
-
tags: ["finance", "usage"],
|
|
56
|
-
body: `## Setup
|
|
25
|
+
- PII and sensitive values are marked and redacted where needed.`},{id:"docs.examples.wealth-snapshot.usage",title:"Wealth Snapshot — Usage",summary:"How to seed, extend, and regenerate wealth tracking safely.",kind:"usage",visibility:"public",route:"/docs/examples/wealth-snapshot/usage",tags:["finance","usage"],body:`## Setup
|
|
57
26
|
1) Seed (if provided) or add accounts/assets/liabilities/goals via UI.
|
|
58
27
|
2) Configure Notifications for goal reminders/threshold alerts; Audit for changes.
|
|
59
28
|
|
|
@@ -65,17 +34,7 @@ var wealthSnapshotDocBlocks = [
|
|
|
65
34
|
## Guardrails
|
|
66
35
|
- Emit events for asset/liability/goal changes; log in Audit Trail.
|
|
67
36
|
- Redact sensitive identifiers in presentations.
|
|
68
|
-
- Keep calculations (net worth) transparent and driven by spec fields.`
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
id: "docs.examples.wealth-snapshot.constraints",
|
|
72
|
-
title: "Wealth Snapshot — Constraints & Safety",
|
|
73
|
-
summary: "Internal guardrails for finance data, PII, and regeneration semantics.",
|
|
74
|
-
kind: "reference",
|
|
75
|
-
visibility: "internal",
|
|
76
|
-
route: "/docs/examples/wealth-snapshot/constraints",
|
|
77
|
-
tags: ["finance", "constraints", "internal"],
|
|
78
|
-
body: `## Constraints
|
|
37
|
+
- Keep calculations (net worth) transparent and driven by spec fields.`},{id:"docs.examples.wealth-snapshot.constraints",title:"Wealth Snapshot — Constraints & Safety",summary:"Internal guardrails for finance data, PII, and regeneration semantics.",kind:"reference",visibility:"internal",route:"/docs/examples/wealth-snapshot/constraints",tags:["finance","constraints","internal"],body:`## Constraints
|
|
79
38
|
- Net worth and goal calculations must stay spec-driven; avoid hidden math.
|
|
80
39
|
- Events to emit: asset.created/updated, liability.created/updated, goal.created/updated, snapshot.recorded.
|
|
81
40
|
- Regeneration should not alter currency/unit semantics without explicit spec change.
|
|
@@ -87,7 +46,4 @@ var wealthSnapshotDocBlocks = [
|
|
|
87
46
|
## Verification
|
|
88
47
|
- Add fixtures for currency/unit changes and snapshot calculations.
|
|
89
48
|
- Ensure Audit Trail covers all financial mutations; Notifications optional for goals/thresholds.
|
|
90
|
-
- Use Feature Flags for new indicators/alert rules; default safe/off.`
|
|
91
|
-
}
|
|
92
|
-
];
|
|
93
|
-
registerDocBlocks(wealthSnapshotDocBlocks);
|
|
49
|
+
- Use Feature Flags for new indicators/alert rules; default safe/off.`}];m(f);
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
3
|
-
var wealthSnapshotDocBlocks = [
|
|
4
|
-
{
|
|
5
|
-
id: "docs.examples.wealth-snapshot",
|
|
6
|
-
title: "Wealth Snapshot",
|
|
7
|
-
summary: "Simple wealth overview with accounts, assets, liabilities, goals, and net-worth snapshots.",
|
|
8
|
-
kind: "reference",
|
|
9
|
-
visibility: "public",
|
|
10
|
-
route: "/docs/examples/wealth-snapshot",
|
|
11
|
-
tags: ["finance", "net-worth", "goals"],
|
|
12
|
-
body: `## Features
|
|
1
|
+
import{registerDocBlocks as f}from"@contractspec/lib.contracts-spec/docs";var j=[{id:"docs.examples.wealth-snapshot",title:"Wealth Snapshot",summary:"Simple wealth overview with accounts, assets, liabilities, goals, and net-worth snapshots.",kind:"reference",visibility:"public",route:"/docs/examples/wealth-snapshot",tags:["finance","net-worth","goals"],body:`## Features
|
|
13
2
|
|
|
14
3
|
- Accounts with balances/currencies.
|
|
15
4
|
- Assets & liabilities categorized for net worth.
|
|
@@ -23,17 +12,7 @@ var wealthSnapshotDocBlocks = [
|
|
|
23
12
|
|
|
24
13
|
## Presentations
|
|
25
14
|
- Dashboard, accounts list, assets list, liabilities list, goals list (React + Markdown targets).
|
|
26
|
-
`
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: "docs.examples.wealth-snapshot.goal",
|
|
30
|
-
title: "Wealth Snapshot — Goal",
|
|
31
|
-
summary: "Why this personal/household finance template exists.",
|
|
32
|
-
kind: "goal",
|
|
33
|
-
visibility: "public",
|
|
34
|
-
route: "/docs/examples/wealth-snapshot/goal",
|
|
35
|
-
tags: ["finance", "goal"],
|
|
36
|
-
body: `## Why it matters
|
|
15
|
+
`},{id:"docs.examples.wealth-snapshot.goal",title:"Wealth Snapshot — Goal",summary:"Why this personal/household finance template exists.",kind:"goal",visibility:"public",route:"/docs/examples/wealth-snapshot/goal",tags:["finance","goal"],body:`## Why it matters
|
|
37
16
|
- Provides a regenerable net-worth and goals view without bespoke finance code.
|
|
38
17
|
- Keeps accounts/assets/liabilities/goals consistent across surfaces with PII care.
|
|
39
18
|
|
|
@@ -43,17 +22,7 @@ var wealthSnapshotDocBlocks = [
|
|
|
43
22
|
|
|
44
23
|
## Success criteria
|
|
45
24
|
- Spec changes to assets/liabilities/goals regenerate UI/API/events cleanly.
|
|
46
|
-
- PII and sensitive values are marked and redacted where needed.`
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
id: "docs.examples.wealth-snapshot.usage",
|
|
50
|
-
title: "Wealth Snapshot — Usage",
|
|
51
|
-
summary: "How to seed, extend, and regenerate wealth tracking safely.",
|
|
52
|
-
kind: "usage",
|
|
53
|
-
visibility: "public",
|
|
54
|
-
route: "/docs/examples/wealth-snapshot/usage",
|
|
55
|
-
tags: ["finance", "usage"],
|
|
56
|
-
body: `## Setup
|
|
25
|
+
- PII and sensitive values are marked and redacted where needed.`},{id:"docs.examples.wealth-snapshot.usage",title:"Wealth Snapshot — Usage",summary:"How to seed, extend, and regenerate wealth tracking safely.",kind:"usage",visibility:"public",route:"/docs/examples/wealth-snapshot/usage",tags:["finance","usage"],body:`## Setup
|
|
57
26
|
1) Seed (if provided) or add accounts/assets/liabilities/goals via UI.
|
|
58
27
|
2) Configure Notifications for goal reminders/threshold alerts; Audit for changes.
|
|
59
28
|
|
|
@@ -65,17 +34,7 @@ var wealthSnapshotDocBlocks = [
|
|
|
65
34
|
## Guardrails
|
|
66
35
|
- Emit events for asset/liability/goal changes; log in Audit Trail.
|
|
67
36
|
- Redact sensitive identifiers in presentations.
|
|
68
|
-
- Keep calculations (net worth) transparent and driven by spec fields.`
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
id: "docs.examples.wealth-snapshot.constraints",
|
|
72
|
-
title: "Wealth Snapshot — Constraints & Safety",
|
|
73
|
-
summary: "Internal guardrails for finance data, PII, and regeneration semantics.",
|
|
74
|
-
kind: "reference",
|
|
75
|
-
visibility: "internal",
|
|
76
|
-
route: "/docs/examples/wealth-snapshot/constraints",
|
|
77
|
-
tags: ["finance", "constraints", "internal"],
|
|
78
|
-
body: `## Constraints
|
|
37
|
+
- Keep calculations (net worth) transparent and driven by spec fields.`},{id:"docs.examples.wealth-snapshot.constraints",title:"Wealth Snapshot — Constraints & Safety",summary:"Internal guardrails for finance data, PII, and regeneration semantics.",kind:"reference",visibility:"internal",route:"/docs/examples/wealth-snapshot/constraints",tags:["finance","constraints","internal"],body:`## Constraints
|
|
79
38
|
- Net worth and goal calculations must stay spec-driven; avoid hidden math.
|
|
80
39
|
- Events to emit: asset.created/updated, liability.created/updated, goal.created/updated, snapshot.recorded.
|
|
81
40
|
- Regeneration should not alter currency/unit semantics without explicit spec change.
|
|
@@ -87,7 +46,4 @@ var wealthSnapshotDocBlocks = [
|
|
|
87
46
|
## Verification
|
|
88
47
|
- Add fixtures for currency/unit changes and snapshot calculations.
|
|
89
48
|
- Ensure Audit Trail covers all financial mutations; Notifications optional for goals/thresholds.
|
|
90
|
-
- Use Feature Flags for new indicators/alert rules; default safe/off.`
|
|
91
|
-
}
|
|
92
|
-
];
|
|
93
|
-
registerDocBlocks(wealthSnapshotDocBlocks);
|
|
49
|
+
- Use Feature Flags for new indicators/alert rules; default safe/off.`}];f(j);
|
|
@@ -1,191 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
defineEntity,
|
|
4
|
-
defineEntityEnum,
|
|
5
|
-
field,
|
|
6
|
-
index
|
|
7
|
-
} from "@contractspec/lib.schema";
|
|
8
|
-
var schema = "lssm_wealth_snapshot";
|
|
9
|
-
var AccountTypeEnum = defineEntityEnum({
|
|
10
|
-
name: "AccountType",
|
|
11
|
-
schema,
|
|
12
|
-
values: ["CHECKING", "SAVINGS", "INVESTMENT", "CREDIT_CARD", "LOAN"],
|
|
13
|
-
description: "Account categories for holdings and debts."
|
|
14
|
-
});
|
|
15
|
-
var AssetCategoryEnum = defineEntityEnum({
|
|
16
|
-
name: "AssetCategory",
|
|
17
|
-
schema,
|
|
18
|
-
values: ["CASH", "EQUITY", "REAL_ESTATE", "CRYPTO", "OTHER"],
|
|
19
|
-
description: "Asset categories."
|
|
20
|
-
});
|
|
21
|
-
var LiabilityCategoryEnum = defineEntityEnum({
|
|
22
|
-
name: "LiabilityCategory",
|
|
23
|
-
schema,
|
|
24
|
-
values: ["CREDIT_CARD", "LOAN", "MORTGAGE", "TAX", "OTHER"],
|
|
25
|
-
description: "Liability categories."
|
|
26
|
-
});
|
|
27
|
-
var GoalStatusEnum = defineEntityEnum({
|
|
28
|
-
name: "GoalStatus",
|
|
29
|
-
schema,
|
|
30
|
-
values: ["ACTIVE", "ON_TRACK", "AT_RISK", "OFF_TRACK", "COMPLETED"],
|
|
31
|
-
description: "Goal health/status."
|
|
32
|
-
});
|
|
33
|
-
var AccountEntity = defineEntity({
|
|
34
|
-
name: "Account",
|
|
35
|
-
description: "Financial account representing holdings or debts.",
|
|
36
|
-
schema,
|
|
37
|
-
map: "account",
|
|
38
|
-
fields: {
|
|
39
|
-
id: field.id({ description: "Account ID" }),
|
|
40
|
-
name: field.string({ description: "Account name" }),
|
|
41
|
-
type: field.enum("AccountType", { description: "Account type" }),
|
|
42
|
-
currency: field.string({ description: "Currency code", default: '"USD"' }),
|
|
43
|
-
balance: field.decimal({ description: "Current balance" }),
|
|
44
|
-
institution: field.string({ description: "Institution", isOptional: true }),
|
|
45
|
-
orgId: field.string({ description: "Org/household id" }),
|
|
46
|
-
ownerId: field.string({ description: "Owner user id", isOptional: true }),
|
|
47
|
-
createdAt: field.createdAt(),
|
|
48
|
-
updatedAt: field.updatedAt()
|
|
49
|
-
},
|
|
50
|
-
enums: [AccountTypeEnum],
|
|
51
|
-
indexes: [index.on(["orgId"]), index.on(["type"]), index.on(["ownerId"])]
|
|
52
|
-
});
|
|
53
|
-
var AssetEntity = defineEntity({
|
|
54
|
-
name: "Asset",
|
|
55
|
-
description: "Individual asset position.",
|
|
56
|
-
schema,
|
|
57
|
-
map: "asset",
|
|
58
|
-
fields: {
|
|
59
|
-
id: field.id({ description: "Asset ID" }),
|
|
60
|
-
accountId: field.foreignKey({
|
|
61
|
-
description: "Holding account",
|
|
62
|
-
isOptional: true
|
|
63
|
-
}),
|
|
64
|
-
name: field.string({ description: "Asset name" }),
|
|
65
|
-
category: field.enum("AssetCategory", { description: "Asset category" }),
|
|
66
|
-
value: field.decimal({ description: "Current value" }),
|
|
67
|
-
currency: field.string({ description: "Currency", default: '"USD"' }),
|
|
68
|
-
orgId: field.string({ description: "Org/household id" }),
|
|
69
|
-
metadata: field.json({ description: "Metadata", isOptional: true }),
|
|
70
|
-
updatedAt: field.updatedAt(),
|
|
71
|
-
createdAt: field.createdAt(),
|
|
72
|
-
account: field.belongsTo("Account", ["accountId"], ["id"], {
|
|
73
|
-
onDelete: "SetNull"
|
|
74
|
-
})
|
|
75
|
-
},
|
|
76
|
-
enums: [AssetCategoryEnum],
|
|
77
|
-
indexes: [index.on(["orgId"]), index.on(["category"])]
|
|
78
|
-
});
|
|
79
|
-
var LiabilityEntity = defineEntity({
|
|
80
|
-
name: "Liability",
|
|
81
|
-
description: "Debt or obligation.",
|
|
82
|
-
schema,
|
|
83
|
-
map: "liability",
|
|
84
|
-
fields: {
|
|
85
|
-
id: field.id({ description: "Liability ID" }),
|
|
86
|
-
accountId: field.foreignKey({
|
|
87
|
-
description: "Liability account",
|
|
88
|
-
isOptional: true
|
|
89
|
-
}),
|
|
90
|
-
name: field.string({ description: "Liability name" }),
|
|
91
|
-
category: field.enum("LiabilityCategory", {
|
|
92
|
-
description: "Liability category"
|
|
93
|
-
}),
|
|
94
|
-
balance: field.decimal({ description: "Outstanding balance" }),
|
|
95
|
-
currency: field.string({ description: "Currency", default: '"USD"' }),
|
|
96
|
-
interestRate: field.decimal({
|
|
97
|
-
description: "Interest rate (e.g., 0.05 for 5%)",
|
|
98
|
-
isOptional: true
|
|
99
|
-
}),
|
|
100
|
-
orgId: field.string({ description: "Org/household id" }),
|
|
101
|
-
metadata: field.json({ description: "Metadata", isOptional: true }),
|
|
102
|
-
updatedAt: field.updatedAt(),
|
|
103
|
-
createdAt: field.createdAt(),
|
|
104
|
-
account: field.belongsTo("Account", ["accountId"], ["id"], {
|
|
105
|
-
onDelete: "SetNull"
|
|
106
|
-
})
|
|
107
|
-
},
|
|
108
|
-
enums: [LiabilityCategoryEnum],
|
|
109
|
-
indexes: [index.on(["orgId"]), index.on(["category"])]
|
|
110
|
-
});
|
|
111
|
-
var GoalEntity = defineEntity({
|
|
112
|
-
name: "Goal",
|
|
113
|
-
description: "Financial goal with target amount/date.",
|
|
114
|
-
schema,
|
|
115
|
-
map: "goal",
|
|
116
|
-
fields: {
|
|
117
|
-
id: field.id({ description: "Goal ID" }),
|
|
118
|
-
name: field.string({ description: "Goal name" }),
|
|
119
|
-
targetAmount: field.decimal({ description: "Target amount" }),
|
|
120
|
-
currentAmount: field.decimal({
|
|
121
|
-
description: "Current progress amount",
|
|
122
|
-
default: 0
|
|
123
|
-
}),
|
|
124
|
-
currency: field.string({ description: "Currency", default: '"USD"' }),
|
|
125
|
-
targetDate: field.dateTime({
|
|
126
|
-
description: "Target completion date",
|
|
127
|
-
isOptional: true
|
|
128
|
-
}),
|
|
129
|
-
status: field.enum("GoalStatus", {
|
|
130
|
-
description: "Goal status",
|
|
131
|
-
default: "ACTIVE"
|
|
132
|
-
}),
|
|
133
|
-
orgId: field.string({ description: "Org/household id" }),
|
|
134
|
-
ownerId: field.string({ description: "Owner user id", isOptional: true }),
|
|
135
|
-
createdAt: field.createdAt(),
|
|
136
|
-
updatedAt: field.updatedAt()
|
|
137
|
-
},
|
|
138
|
-
enums: [GoalStatusEnum],
|
|
139
|
-
indexes: [
|
|
140
|
-
index.on(["orgId"]),
|
|
141
|
-
index.on(["status"]),
|
|
142
|
-
index.on(["targetDate"])
|
|
143
|
-
]
|
|
144
|
-
});
|
|
145
|
-
var NetWorthSnapshotEntity = defineEntity({
|
|
146
|
-
name: "NetWorthSnapshot",
|
|
147
|
-
description: "Aggregated net worth snapshot for a date.",
|
|
148
|
-
schema,
|
|
149
|
-
map: "networth_snapshot",
|
|
150
|
-
fields: {
|
|
151
|
-
id: field.id({ description: "Snapshot ID" }),
|
|
152
|
-
asOf: field.dateTime({ description: "Snapshot date" }),
|
|
153
|
-
totalAssets: field.decimal({ description: "Total assets" }),
|
|
154
|
-
totalLiabilities: field.decimal({ description: "Total liabilities" }),
|
|
155
|
-
netWorth: field.decimal({ description: "Net worth" }),
|
|
156
|
-
currency: field.string({ description: "Currency", default: '"USD"' }),
|
|
157
|
-
orgId: field.string({ description: "Org/household id" }),
|
|
158
|
-
createdAt: field.createdAt()
|
|
159
|
-
},
|
|
160
|
-
indexes: [index.unique(["orgId", "asOf"], { name: "networth_unique" })]
|
|
161
|
-
});
|
|
162
|
-
var wealthSnapshotEntities = [
|
|
163
|
-
AccountEntity,
|
|
164
|
-
AssetEntity,
|
|
165
|
-
LiabilityEntity,
|
|
166
|
-
GoalEntity,
|
|
167
|
-
NetWorthSnapshotEntity
|
|
168
|
-
];
|
|
169
|
-
var wealthSnapshotSchemaContribution = {
|
|
170
|
-
moduleId: "@contractspec/example.wealth-snapshot",
|
|
171
|
-
entities: wealthSnapshotEntities,
|
|
172
|
-
enums: [
|
|
173
|
-
AccountTypeEnum,
|
|
174
|
-
AssetCategoryEnum,
|
|
175
|
-
LiabilityCategoryEnum,
|
|
176
|
-
GoalStatusEnum
|
|
177
|
-
]
|
|
178
|
-
};
|
|
179
|
-
export {
|
|
180
|
-
wealthSnapshotSchemaContribution,
|
|
181
|
-
wealthSnapshotEntities,
|
|
182
|
-
NetWorthSnapshotEntity,
|
|
183
|
-
LiabilityEntity,
|
|
184
|
-
LiabilityCategoryEnum,
|
|
185
|
-
GoalStatusEnum,
|
|
186
|
-
GoalEntity,
|
|
187
|
-
AssetEntity,
|
|
188
|
-
AssetCategoryEnum,
|
|
189
|
-
AccountTypeEnum,
|
|
190
|
-
AccountEntity
|
|
191
|
-
};
|
|
1
|
+
import{defineEntity as n,defineEntityEnum as o,field as t,index as e}from"@contractspec/lib.schema";var i="lssm_wealth_snapshot",a=o({name:"AccountType",schema:i,values:["CHECKING","SAVINGS","INVESTMENT","CREDIT_CARD","LOAN"],description:"Account categories for holdings and debts."}),s=o({name:"AssetCategory",schema:i,values:["CASH","EQUITY","REAL_ESTATE","CRYPTO","OTHER"],description:"Asset categories."}),r=o({name:"LiabilityCategory",schema:i,values:["CREDIT_CARD","LOAN","MORTGAGE","TAX","OTHER"],description:"Liability categories."}),d=o({name:"GoalStatus",schema:i,values:["ACTIVE","ON_TRACK","AT_RISK","OFF_TRACK","COMPLETED"],description:"Goal health/status."}),c=n({name:"Account",description:"Financial account representing holdings or debts.",schema:i,map:"account",fields:{id:t.id({description:"Account ID"}),name:t.string({description:"Account name"}),type:t.enum("AccountType",{description:"Account type"}),currency:t.string({description:"Currency code",default:'"USD"'}),balance:t.decimal({description:"Current balance"}),institution:t.string({description:"Institution",isOptional:!0}),orgId:t.string({description:"Org/household id"}),ownerId:t.string({description:"Owner user id",isOptional:!0}),createdAt:t.createdAt(),updatedAt:t.updatedAt()},enums:[a],indexes:[e.on(["orgId"]),e.on(["type"]),e.on(["ownerId"])]}),u=n({name:"Asset",description:"Individual asset position.",schema:i,map:"asset",fields:{id:t.id({description:"Asset ID"}),accountId:t.foreignKey({description:"Holding account",isOptional:!0}),name:t.string({description:"Asset name"}),category:t.enum("AssetCategory",{description:"Asset category"}),value:t.decimal({description:"Current value"}),currency:t.string({description:"Currency",default:'"USD"'}),orgId:t.string({description:"Org/household id"}),metadata:t.json({description:"Metadata",isOptional:!0}),updatedAt:t.updatedAt(),createdAt:t.createdAt(),account:t.belongsTo("Account",["accountId"],["id"],{onDelete:"SetNull"})},enums:[s],indexes:[e.on(["orgId"]),e.on(["category"])]}),p=n({name:"Liability",description:"Debt or obligation.",schema:i,map:"liability",fields:{id:t.id({description:"Liability ID"}),accountId:t.foreignKey({description:"Liability account",isOptional:!0}),name:t.string({description:"Liability name"}),category:t.enum("LiabilityCategory",{description:"Liability category"}),balance:t.decimal({description:"Outstanding balance"}),currency:t.string({description:"Currency",default:'"USD"'}),interestRate:t.decimal({description:"Interest rate (e.g., 0.05 for 5%)",isOptional:!0}),orgId:t.string({description:"Org/household id"}),metadata:t.json({description:"Metadata",isOptional:!0}),updatedAt:t.updatedAt(),createdAt:t.createdAt(),account:t.belongsTo("Account",["accountId"],["id"],{onDelete:"SetNull"})},enums:[r],indexes:[e.on(["orgId"]),e.on(["category"])]}),l=n({name:"Goal",description:"Financial goal with target amount/date.",schema:i,map:"goal",fields:{id:t.id({description:"Goal ID"}),name:t.string({description:"Goal name"}),targetAmount:t.decimal({description:"Target amount"}),currentAmount:t.decimal({description:"Current progress amount",default:0}),currency:t.string({description:"Currency",default:'"USD"'}),targetDate:t.dateTime({description:"Target completion date",isOptional:!0}),status:t.enum("GoalStatus",{description:"Goal status",default:"ACTIVE"}),orgId:t.string({description:"Org/household id"}),ownerId:t.string({description:"Owner user id",isOptional:!0}),createdAt:t.createdAt(),updatedAt:t.updatedAt()},enums:[d],indexes:[e.on(["orgId"]),e.on(["status"]),e.on(["targetDate"])]}),g=n({name:"NetWorthSnapshot",description:"Aggregated net worth snapshot for a date.",schema:i,map:"networth_snapshot",fields:{id:t.id({description:"Snapshot ID"}),asOf:t.dateTime({description:"Snapshot date"}),totalAssets:t.decimal({description:"Total assets"}),totalLiabilities:t.decimal({description:"Total liabilities"}),netWorth:t.decimal({description:"Net worth"}),currency:t.string({description:"Currency",default:'"USD"'}),orgId:t.string({description:"Org/household id"}),createdAt:t.createdAt()},indexes:[e.unique(["orgId","asOf"],{name:"networth_unique"})]}),m=[c,u,p,l,g],y={moduleId:"@contractspec/example.wealth-snapshot",entities:m,enums:[a,s,r,d]};export{y as wealthSnapshotSchemaContribution,m as wealthSnapshotEntities,g as NetWorthSnapshotEntity,p as LiabilityEntity,r as LiabilityCategoryEnum,d as GoalStatusEnum,l as GoalEntity,u as AssetEntity,s as AssetCategoryEnum,a as AccountTypeEnum,c as AccountEntity};
|
package/dist/browser/events.js
CHANGED
|
@@ -1,111 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineEvent, StabilityEnum } from "@contractspec/lib.contracts-spec";
|
|
3
|
-
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
4
|
-
var AssetEventPayload = defineSchemaModel({
|
|
5
|
-
name: "AssetEventPayload",
|
|
6
|
-
description: "Payload for asset events",
|
|
7
|
-
fields: {
|
|
8
|
-
assetId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
9
|
-
category: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
10
|
-
value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
11
|
-
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
12
|
-
orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
13
|
-
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
var LiabilityEventPayload = defineSchemaModel({
|
|
17
|
-
name: "LiabilityEventPayload",
|
|
18
|
-
description: "Payload for liability events",
|
|
19
|
-
fields: {
|
|
20
|
-
liabilityId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
21
|
-
category: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
22
|
-
balance: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
23
|
-
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
24
|
-
orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
25
|
-
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
var GoalEventPayload = defineSchemaModel({
|
|
29
|
-
name: "GoalEventPayload",
|
|
30
|
-
description: "Payload for goal events",
|
|
31
|
-
fields: {
|
|
32
|
-
goalId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
33
|
-
status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
34
|
-
currentAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
35
|
-
targetAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
36
|
-
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
37
|
-
orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
38
|
-
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
var AssetAddedEvent = defineEvent({
|
|
42
|
-
meta: {
|
|
43
|
-
key: "wealth.asset.added",
|
|
44
|
-
version: "1.0.0",
|
|
45
|
-
description: "An asset was added or updated.",
|
|
46
|
-
stability: StabilityEnum.Experimental,
|
|
47
|
-
owners: [],
|
|
48
|
-
tags: []
|
|
49
|
-
},
|
|
50
|
-
payload: AssetEventPayload
|
|
51
|
-
});
|
|
52
|
-
var LiabilityAddedEvent = defineEvent({
|
|
53
|
-
meta: {
|
|
54
|
-
key: "wealth.liability.added",
|
|
55
|
-
version: "1.0.0",
|
|
56
|
-
description: "A liability was added or updated.",
|
|
57
|
-
stability: StabilityEnum.Experimental,
|
|
58
|
-
owners: [],
|
|
59
|
-
tags: []
|
|
60
|
-
},
|
|
61
|
-
payload: LiabilityEventPayload
|
|
62
|
-
});
|
|
63
|
-
var GoalUpdatedEvent = defineEvent({
|
|
64
|
-
meta: {
|
|
65
|
-
key: "wealth.goal.updated",
|
|
66
|
-
version: "1.0.0",
|
|
67
|
-
description: "A goal was updated.",
|
|
68
|
-
stability: StabilityEnum.Experimental,
|
|
69
|
-
owners: [],
|
|
70
|
-
tags: []
|
|
71
|
-
},
|
|
72
|
-
payload: GoalEventPayload
|
|
73
|
-
});
|
|
74
|
-
var NetWorthSnapshotCreatedEvent = defineEvent({
|
|
75
|
-
meta: {
|
|
76
|
-
key: "wealth.networth.snapshot_created",
|
|
77
|
-
version: "1.0.0",
|
|
78
|
-
description: "A net worth snapshot was generated.",
|
|
79
|
-
stability: StabilityEnum.Experimental,
|
|
80
|
-
owners: [],
|
|
81
|
-
tags: []
|
|
82
|
-
},
|
|
83
|
-
payload: defineSchemaModel({
|
|
84
|
-
name: "NetWorthSnapshotEventPayload",
|
|
85
|
-
description: "Net worth snapshot payload",
|
|
86
|
-
fields: {
|
|
87
|
-
netWorth: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
88
|
-
totalAssets: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
89
|
-
totalLiabilities: {
|
|
90
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
91
|
-
isOptional: false
|
|
92
|
-
},
|
|
93
|
-
currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
94
|
-
orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
95
|
-
asOf: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
96
|
-
}
|
|
97
|
-
})
|
|
98
|
-
});
|
|
99
|
-
var WealthSnapshotEvents = {
|
|
100
|
-
AssetAddedEvent,
|
|
101
|
-
LiabilityAddedEvent,
|
|
102
|
-
GoalUpdatedEvent,
|
|
103
|
-
NetWorthSnapshotCreatedEvent
|
|
104
|
-
};
|
|
105
|
-
export {
|
|
106
|
-
WealthSnapshotEvents,
|
|
107
|
-
NetWorthSnapshotCreatedEvent,
|
|
108
|
-
LiabilityAddedEvent,
|
|
109
|
-
GoalUpdatedEvent,
|
|
110
|
-
AssetAddedEvent
|
|
111
|
-
};
|
|
1
|
+
import{defineEvent as j,StabilityEnum as k}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as q,ScalarTypeEnum as g}from"@contractspec/lib.schema";var w=q({name:"AssetEventPayload",description:"Payload for asset events",fields:{assetId:{type:g.String_unsecure(),isOptional:!1},category:{type:g.String_unsecure(),isOptional:!1},value:{type:g.Float_unsecure(),isOptional:!1},currency:{type:g.String_unsecure(),isOptional:!1},orgId:{type:g.String_unsecure(),isOptional:!1},timestamp:{type:g.DateTime(),isOptional:!1}}}),x=q({name:"LiabilityEventPayload",description:"Payload for liability events",fields:{liabilityId:{type:g.String_unsecure(),isOptional:!1},category:{type:g.String_unsecure(),isOptional:!1},balance:{type:g.Float_unsecure(),isOptional:!1},currency:{type:g.String_unsecure(),isOptional:!1},orgId:{type:g.String_unsecure(),isOptional:!1},timestamp:{type:g.DateTime(),isOptional:!1}}}),z=q({name:"GoalEventPayload",description:"Payload for goal events",fields:{goalId:{type:g.String_unsecure(),isOptional:!1},status:{type:g.String_unsecure(),isOptional:!1},currentAmount:{type:g.Float_unsecure(),isOptional:!1},targetAmount:{type:g.Float_unsecure(),isOptional:!1},currency:{type:g.String_unsecure(),isOptional:!1},orgId:{type:g.String_unsecure(),isOptional:!1},timestamp:{type:g.DateTime(),isOptional:!1}}}),B=j({meta:{key:"wealth.asset.added",version:"1.0.0",description:"An asset was added or updated.",stability:k.Experimental,owners:[],tags:[]},payload:w}),D=j({meta:{key:"wealth.liability.added",version:"1.0.0",description:"A liability was added or updated.",stability:k.Experimental,owners:[],tags:[]},payload:x}),F=j({meta:{key:"wealth.goal.updated",version:"1.0.0",description:"A goal was updated.",stability:k.Experimental,owners:[],tags:[]},payload:z}),H=j({meta:{key:"wealth.networth.snapshot_created",version:"1.0.0",description:"A net worth snapshot was generated.",stability:k.Experimental,owners:[],tags:[]},payload:q({name:"NetWorthSnapshotEventPayload",description:"Net worth snapshot payload",fields:{netWorth:{type:g.Float_unsecure(),isOptional:!1},totalAssets:{type:g.Float_unsecure(),isOptional:!1},totalLiabilities:{type:g.Float_unsecure(),isOptional:!1},currency:{type:g.String_unsecure(),isOptional:!1},orgId:{type:g.String_unsecure(),isOptional:!1},asOf:{type:g.DateTime(),isOptional:!1}}})}),K={AssetAddedEvent:B,LiabilityAddedEvent:D,GoalUpdatedEvent:F,NetWorthSnapshotCreatedEvent:H};export{K as WealthSnapshotEvents,H as NetWorthSnapshotCreatedEvent,D as LiabilityAddedEvent,F as GoalUpdatedEvent,B as AssetAddedEvent};
|
package/dist/browser/example.js
CHANGED
|
@@ -1,42 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineExample } from "@contractspec/lib.contracts-spec";
|
|
3
|
-
var example = defineExample({
|
|
4
|
-
meta: {
|
|
5
|
-
key: "wealth-snapshot",
|
|
6
|
-
version: "1.0.0",
|
|
7
|
-
title: "Wealth Snapshot",
|
|
8
|
-
description: "Simple wealth overview with accounts, assets, liabilities, goals, and net-worth snapshots.",
|
|
9
|
-
kind: "template",
|
|
10
|
-
visibility: "public",
|
|
11
|
-
stability: "experimental",
|
|
12
|
-
owners: ["@platform.core"],
|
|
13
|
-
tags: ["finance", "net-worth", "goals"]
|
|
14
|
-
},
|
|
15
|
-
docs: {
|
|
16
|
-
rootDocId: "docs.examples.wealth-snapshot",
|
|
17
|
-
goalDocId: "docs.examples.wealth-snapshot.goal",
|
|
18
|
-
usageDocId: "docs.examples.wealth-snapshot.usage",
|
|
19
|
-
constraintsDocId: "docs.examples.wealth-snapshot.constraints"
|
|
20
|
-
},
|
|
21
|
-
entrypoints: {
|
|
22
|
-
packageName: "@contractspec/example.wealth-snapshot",
|
|
23
|
-
feature: "./feature",
|
|
24
|
-
contracts: "./contracts",
|
|
25
|
-
presentations: "./presentations",
|
|
26
|
-
handlers: "./handlers",
|
|
27
|
-
docs: "./docs"
|
|
28
|
-
},
|
|
29
|
-
surfaces: {
|
|
30
|
-
templates: true,
|
|
31
|
-
sandbox: {
|
|
32
|
-
enabled: true,
|
|
33
|
-
modes: ["playground", "specs", "builder", "markdown", "evolution"]
|
|
34
|
-
},
|
|
35
|
-
studio: { enabled: true, installable: true },
|
|
36
|
-
mcp: { enabled: true }
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
var example_default = example;
|
|
40
|
-
export {
|
|
41
|
-
example_default as default
|
|
42
|
-
};
|
|
1
|
+
import{defineExample as g}from"@contractspec/lib.contracts-spec";var h=g({meta:{key:"wealth-snapshot",version:"1.0.0",title:"Wealth Snapshot",description:"Simple wealth overview with accounts, assets, liabilities, goals, and net-worth snapshots.",kind:"template",visibility:"public",stability:"experimental",owners:["@platform.core"],tags:["finance","net-worth","goals"]},docs:{rootDocId:"docs.examples.wealth-snapshot",goalDocId:"docs.examples.wealth-snapshot.goal",usageDocId:"docs.examples.wealth-snapshot.usage",constraintsDocId:"docs.examples.wealth-snapshot.constraints"},entrypoints:{packageName:"@contractspec/example.wealth-snapshot",feature:"./feature",contracts:"./contracts",presentations:"./presentations",handlers:"./handlers",docs:"./docs"},surfaces:{templates:!0,sandbox:{enabled:!0,modes:["playground","specs","builder","markdown","evolution"]},studio:{enabled:!0,installable:!0},mcp:{enabled:!0}}}),q=h;export{q as default};
|