@contractspec/example.wealth-snapshot 1.57.0 → 1.59.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/browser/docs/index.js +93 -0
- package/dist/browser/docs/wealth-snapshot.docblock.js +93 -0
- package/dist/browser/entities/index.js +191 -0
- package/dist/browser/events.js +111 -0
- package/dist/browser/example.js +42 -0
- package/dist/browser/handlers/index.js +5 -0
- package/dist/browser/index.js +885 -0
- package/dist/browser/operations/index.js +238 -0
- package/dist/browser/presentations/index.js +11 -0
- package/dist/browser/presentations.js +124 -0
- package/dist/browser/wealth-snapshot.capability.js +40 -0
- package/dist/browser/wealth-snapshot.feature.js +72 -0
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +94 -1
- package/dist/docs/wealth-snapshot.docblock.d.ts +2 -1
- package/dist/docs/wealth-snapshot.docblock.d.ts.map +1 -0
- package/dist/docs/wealth-snapshot.docblock.js +45 -55
- package/dist/entities/index.d.ts +120 -125
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +181 -219
- package/dist/events.d.ts +167 -173
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +103 -172
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +41 -54
- package/dist/handlers/index.d.ts +1 -4
- package/dist/handlers/index.d.ts.map +1 -1
- package/dist/handlers/index.js +5 -8
- package/dist/index.d.ts +12 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +882 -23
- package/dist/node/docs/index.js +93 -0
- package/dist/node/docs/wealth-snapshot.docblock.js +93 -0
- package/dist/node/entities/index.js +191 -0
- package/dist/node/events.js +111 -0
- package/dist/node/example.js +42 -0
- package/dist/node/handlers/index.js +5 -0
- package/dist/node/index.js +885 -0
- package/dist/node/operations/index.js +238 -0
- package/dist/node/presentations/index.js +11 -0
- package/dist/node/presentations.js +124 -0
- package/dist/node/wealth-snapshot.capability.js +40 -0
- package/dist/node/wealth-snapshot.feature.js +72 -0
- package/dist/operations/index.d.ts +392 -398
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/operations/index.js +237 -425
- package/dist/presentations/index.d.ts +1 -4
- package/dist/presentations/index.d.ts.map +1 -1
- package/dist/presentations/index.js +11 -11
- package/dist/presentations.d.ts +5 -10
- package/dist/presentations.d.ts.map +1 -1
- package/dist/presentations.js +120 -127
- package/dist/wealth-snapshot.capability.d.ts +3 -8
- package/dist/wealth-snapshot.capability.d.ts.map +1 -1
- package/dist/wealth-snapshot.capability.js +41 -46
- package/dist/wealth-snapshot.feature.d.ts +1 -6
- package/dist/wealth-snapshot.feature.d.ts.map +1 -1
- package/dist/wealth-snapshot.feature.js +71 -139
- package/package.json +144 -37
- package/dist/docs/wealth-snapshot.docblock.js.map +0 -1
- package/dist/entities/index.js.map +0 -1
- package/dist/events.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/handlers/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/operations/index.js.map +0 -1
- package/dist/presentations/index.js.map +0 -1
- package/dist/presentations.js.map +0 -1
- package/dist/wealth-snapshot.capability.js.map +0 -1
- package/dist/wealth-snapshot.feature.js.map +0 -1
package/dist/entities/index.js
CHANGED
|
@@ -1,230 +1,192 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
description: "Account categories for holdings and debts."
|
|
1
|
+
// @bun
|
|
2
|
+
// src/entities/index.ts
|
|
3
|
+
import {
|
|
4
|
+
defineEntity,
|
|
5
|
+
defineEntityEnum,
|
|
6
|
+
field,
|
|
7
|
+
index
|
|
8
|
+
} from "@contractspec/lib.schema";
|
|
9
|
+
var schema = "lssm_wealth_snapshot";
|
|
10
|
+
var AccountTypeEnum = defineEntityEnum({
|
|
11
|
+
name: "AccountType",
|
|
12
|
+
schema,
|
|
13
|
+
values: ["CHECKING", "SAVINGS", "INVESTMENT", "CREDIT_CARD", "LOAN"],
|
|
14
|
+
description: "Account categories for holdings and debts."
|
|
16
15
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"EQUITY",
|
|
23
|
-
"REAL_ESTATE",
|
|
24
|
-
"CRYPTO",
|
|
25
|
-
"OTHER"
|
|
26
|
-
],
|
|
27
|
-
description: "Asset categories."
|
|
16
|
+
var AssetCategoryEnum = defineEntityEnum({
|
|
17
|
+
name: "AssetCategory",
|
|
18
|
+
schema,
|
|
19
|
+
values: ["CASH", "EQUITY", "REAL_ESTATE", "CRYPTO", "OTHER"],
|
|
20
|
+
description: "Asset categories."
|
|
28
21
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"LOAN",
|
|
35
|
-
"MORTGAGE",
|
|
36
|
-
"TAX",
|
|
37
|
-
"OTHER"
|
|
38
|
-
],
|
|
39
|
-
description: "Liability categories."
|
|
22
|
+
var LiabilityCategoryEnum = defineEntityEnum({
|
|
23
|
+
name: "LiabilityCategory",
|
|
24
|
+
schema,
|
|
25
|
+
values: ["CREDIT_CARD", "LOAN", "MORTGAGE", "TAX", "OTHER"],
|
|
26
|
+
description: "Liability categories."
|
|
40
27
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"ON_TRACK",
|
|
47
|
-
"AT_RISK",
|
|
48
|
-
"OFF_TRACK",
|
|
49
|
-
"COMPLETED"
|
|
50
|
-
],
|
|
51
|
-
description: "Goal health/status."
|
|
28
|
+
var GoalStatusEnum = defineEntityEnum({
|
|
29
|
+
name: "GoalStatus",
|
|
30
|
+
schema,
|
|
31
|
+
values: ["ACTIVE", "ON_TRACK", "AT_RISK", "OFF_TRACK", "COMPLETED"],
|
|
32
|
+
description: "Goal health/status."
|
|
52
33
|
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
ownerId: field.string({
|
|
73
|
-
description: "Owner user id",
|
|
74
|
-
isOptional: true
|
|
75
|
-
}),
|
|
76
|
-
createdAt: field.createdAt(),
|
|
77
|
-
updatedAt: field.updatedAt()
|
|
78
|
-
},
|
|
79
|
-
enums: [AccountTypeEnum],
|
|
80
|
-
indexes: [
|
|
81
|
-
index.on(["orgId"]),
|
|
82
|
-
index.on(["type"]),
|
|
83
|
-
index.on(["ownerId"])
|
|
84
|
-
]
|
|
34
|
+
var AccountEntity = defineEntity({
|
|
35
|
+
name: "Account",
|
|
36
|
+
description: "Financial account representing holdings or debts.",
|
|
37
|
+
schema,
|
|
38
|
+
map: "account",
|
|
39
|
+
fields: {
|
|
40
|
+
id: field.id({ description: "Account ID" }),
|
|
41
|
+
name: field.string({ description: "Account name" }),
|
|
42
|
+
type: field.enum("AccountType", { description: "Account type" }),
|
|
43
|
+
currency: field.string({ description: "Currency code", default: '"USD"' }),
|
|
44
|
+
balance: field.decimal({ description: "Current balance" }),
|
|
45
|
+
institution: field.string({ description: "Institution", isOptional: true }),
|
|
46
|
+
orgId: field.string({ description: "Org/household id" }),
|
|
47
|
+
ownerId: field.string({ description: "Owner user id", isOptional: true }),
|
|
48
|
+
createdAt: field.createdAt(),
|
|
49
|
+
updatedAt: field.updatedAt()
|
|
50
|
+
},
|
|
51
|
+
enums: [AccountTypeEnum],
|
|
52
|
+
indexes: [index.on(["orgId"]), index.on(["type"]), index.on(["ownerId"])]
|
|
85
53
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
account: field.belongsTo("Account", ["accountId"], ["id"], { onDelete: "SetNull" })
|
|
112
|
-
},
|
|
113
|
-
enums: [AssetCategoryEnum],
|
|
114
|
-
indexes: [index.on(["orgId"]), index.on(["category"])]
|
|
54
|
+
var AssetEntity = defineEntity({
|
|
55
|
+
name: "Asset",
|
|
56
|
+
description: "Individual asset position.",
|
|
57
|
+
schema,
|
|
58
|
+
map: "asset",
|
|
59
|
+
fields: {
|
|
60
|
+
id: field.id({ description: "Asset ID" }),
|
|
61
|
+
accountId: field.foreignKey({
|
|
62
|
+
description: "Holding account",
|
|
63
|
+
isOptional: true
|
|
64
|
+
}),
|
|
65
|
+
name: field.string({ description: "Asset name" }),
|
|
66
|
+
category: field.enum("AssetCategory", { description: "Asset category" }),
|
|
67
|
+
value: field.decimal({ description: "Current value" }),
|
|
68
|
+
currency: field.string({ description: "Currency", default: '"USD"' }),
|
|
69
|
+
orgId: field.string({ description: "Org/household id" }),
|
|
70
|
+
metadata: field.json({ description: "Metadata", isOptional: true }),
|
|
71
|
+
updatedAt: field.updatedAt(),
|
|
72
|
+
createdAt: field.createdAt(),
|
|
73
|
+
account: field.belongsTo("Account", ["accountId"], ["id"], {
|
|
74
|
+
onDelete: "SetNull"
|
|
75
|
+
})
|
|
76
|
+
},
|
|
77
|
+
enums: [AssetCategoryEnum],
|
|
78
|
+
indexes: [index.on(["orgId"]), index.on(["category"])]
|
|
115
79
|
});
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
enums: [LiabilityCategoryEnum],
|
|
148
|
-
indexes: [index.on(["orgId"]), index.on(["category"])]
|
|
80
|
+
var LiabilityEntity = defineEntity({
|
|
81
|
+
name: "Liability",
|
|
82
|
+
description: "Debt or obligation.",
|
|
83
|
+
schema,
|
|
84
|
+
map: "liability",
|
|
85
|
+
fields: {
|
|
86
|
+
id: field.id({ description: "Liability ID" }),
|
|
87
|
+
accountId: field.foreignKey({
|
|
88
|
+
description: "Liability account",
|
|
89
|
+
isOptional: true
|
|
90
|
+
}),
|
|
91
|
+
name: field.string({ description: "Liability name" }),
|
|
92
|
+
category: field.enum("LiabilityCategory", {
|
|
93
|
+
description: "Liability category"
|
|
94
|
+
}),
|
|
95
|
+
balance: field.decimal({ description: "Outstanding balance" }),
|
|
96
|
+
currency: field.string({ description: "Currency", default: '"USD"' }),
|
|
97
|
+
interestRate: field.decimal({
|
|
98
|
+
description: "Interest rate (e.g., 0.05 for 5%)",
|
|
99
|
+
isOptional: true
|
|
100
|
+
}),
|
|
101
|
+
orgId: field.string({ description: "Org/household id" }),
|
|
102
|
+
metadata: field.json({ description: "Metadata", isOptional: true }),
|
|
103
|
+
updatedAt: field.updatedAt(),
|
|
104
|
+
createdAt: field.createdAt(),
|
|
105
|
+
account: field.belongsTo("Account", ["accountId"], ["id"], {
|
|
106
|
+
onDelete: "SetNull"
|
|
107
|
+
})
|
|
108
|
+
},
|
|
109
|
+
enums: [LiabilityCategoryEnum],
|
|
110
|
+
indexes: [index.on(["orgId"]), index.on(["category"])]
|
|
149
111
|
});
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
enums: [GoalStatusEnum],
|
|
184
|
-
indexes: [
|
|
185
|
-
index.on(["orgId"]),
|
|
186
|
-
index.on(["status"]),
|
|
187
|
-
index.on(["targetDate"])
|
|
188
|
-
]
|
|
112
|
+
var GoalEntity = defineEntity({
|
|
113
|
+
name: "Goal",
|
|
114
|
+
description: "Financial goal with target amount/date.",
|
|
115
|
+
schema,
|
|
116
|
+
map: "goal",
|
|
117
|
+
fields: {
|
|
118
|
+
id: field.id({ description: "Goal ID" }),
|
|
119
|
+
name: field.string({ description: "Goal name" }),
|
|
120
|
+
targetAmount: field.decimal({ description: "Target amount" }),
|
|
121
|
+
currentAmount: field.decimal({
|
|
122
|
+
description: "Current progress amount",
|
|
123
|
+
default: 0
|
|
124
|
+
}),
|
|
125
|
+
currency: field.string({ description: "Currency", default: '"USD"' }),
|
|
126
|
+
targetDate: field.dateTime({
|
|
127
|
+
description: "Target completion date",
|
|
128
|
+
isOptional: true
|
|
129
|
+
}),
|
|
130
|
+
status: field.enum("GoalStatus", {
|
|
131
|
+
description: "Goal status",
|
|
132
|
+
default: "ACTIVE"
|
|
133
|
+
}),
|
|
134
|
+
orgId: field.string({ description: "Org/household id" }),
|
|
135
|
+
ownerId: field.string({ description: "Owner user id", isOptional: true }),
|
|
136
|
+
createdAt: field.createdAt(),
|
|
137
|
+
updatedAt: field.updatedAt()
|
|
138
|
+
},
|
|
139
|
+
enums: [GoalStatusEnum],
|
|
140
|
+
indexes: [
|
|
141
|
+
index.on(["orgId"]),
|
|
142
|
+
index.on(["status"]),
|
|
143
|
+
index.on(["targetDate"])
|
|
144
|
+
]
|
|
189
145
|
});
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
createdAt: field.createdAt()
|
|
207
|
-
},
|
|
208
|
-
indexes: [index.unique(["orgId", "asOf"], { name: "networth_unique" })]
|
|
146
|
+
var NetWorthSnapshotEntity = defineEntity({
|
|
147
|
+
name: "NetWorthSnapshot",
|
|
148
|
+
description: "Aggregated net worth snapshot for a date.",
|
|
149
|
+
schema,
|
|
150
|
+
map: "networth_snapshot",
|
|
151
|
+
fields: {
|
|
152
|
+
id: field.id({ description: "Snapshot ID" }),
|
|
153
|
+
asOf: field.dateTime({ description: "Snapshot date" }),
|
|
154
|
+
totalAssets: field.decimal({ description: "Total assets" }),
|
|
155
|
+
totalLiabilities: field.decimal({ description: "Total liabilities" }),
|
|
156
|
+
netWorth: field.decimal({ description: "Net worth" }),
|
|
157
|
+
currency: field.string({ description: "Currency", default: '"USD"' }),
|
|
158
|
+
orgId: field.string({ description: "Org/household id" }),
|
|
159
|
+
createdAt: field.createdAt()
|
|
160
|
+
},
|
|
161
|
+
indexes: [index.unique(["orgId", "asOf"], { name: "networth_unique" })]
|
|
209
162
|
});
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
163
|
+
var wealthSnapshotEntities = [
|
|
164
|
+
AccountEntity,
|
|
165
|
+
AssetEntity,
|
|
166
|
+
LiabilityEntity,
|
|
167
|
+
GoalEntity,
|
|
168
|
+
NetWorthSnapshotEntity
|
|
216
169
|
];
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
170
|
+
var wealthSnapshotSchemaContribution = {
|
|
171
|
+
moduleId: "@contractspec/example.wealth-snapshot",
|
|
172
|
+
entities: wealthSnapshotEntities,
|
|
173
|
+
enums: [
|
|
174
|
+
AccountTypeEnum,
|
|
175
|
+
AssetCategoryEnum,
|
|
176
|
+
LiabilityCategoryEnum,
|
|
177
|
+
GoalStatusEnum
|
|
178
|
+
]
|
|
179
|
+
};
|
|
180
|
+
export {
|
|
181
|
+
wealthSnapshotSchemaContribution,
|
|
182
|
+
wealthSnapshotEntities,
|
|
183
|
+
NetWorthSnapshotEntity,
|
|
184
|
+
LiabilityEntity,
|
|
185
|
+
LiabilityCategoryEnum,
|
|
186
|
+
GoalStatusEnum,
|
|
187
|
+
GoalEntity,
|
|
188
|
+
AssetEntity,
|
|
189
|
+
AssetCategoryEnum,
|
|
190
|
+
AccountTypeEnum,
|
|
191
|
+
AccountEntity
|
|
226
192
|
};
|
|
227
|
-
|
|
228
|
-
//#endregion
|
|
229
|
-
export { AccountEntity, AccountTypeEnum, AssetCategoryEnum, AssetEntity, GoalEntity, GoalStatusEnum, LiabilityCategoryEnum, LiabilityEntity, NetWorthSnapshotEntity, wealthSnapshotEntities, wealthSnapshotSchemaContribution };
|
|
230
|
-
//# sourceMappingURL=index.js.map
|