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