@contractspec/example.wealth-snapshot 3.7.17 → 3.7.19

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 (37) hide show
  1. package/dist/browser/docs/index.js +5 -49
  2. package/dist/browser/docs/wealth-snapshot.docblock.js +5 -49
  3. package/dist/browser/entities/index.js +1 -191
  4. package/dist/browser/events.js +1 -111
  5. package/dist/browser/example.js +1 -42
  6. package/dist/browser/handlers/index.js +1 -5
  7. package/dist/browser/index.js +5 -851
  8. package/dist/browser/operations/index.js +1 -238
  9. package/dist/browser/presentations/index.js +1 -11
  10. package/dist/browser/presentations.js +1 -127
  11. package/dist/browser/wealth-snapshot.capability.js +1 -43
  12. package/dist/browser/wealth-snapshot.feature.js +1 -79
  13. package/dist/docs/index.js +5 -49
  14. package/dist/docs/wealth-snapshot.docblock.js +5 -49
  15. package/dist/entities/index.js +1 -191
  16. package/dist/events.js +1 -111
  17. package/dist/example.js +1 -42
  18. package/dist/handlers/index.js +1 -5
  19. package/dist/index.js +5 -851
  20. package/dist/node/docs/index.js +5 -49
  21. package/dist/node/docs/wealth-snapshot.docblock.js +5 -49
  22. package/dist/node/entities/index.js +1 -191
  23. package/dist/node/events.js +1 -111
  24. package/dist/node/example.js +1 -42
  25. package/dist/node/handlers/index.js +1 -5
  26. package/dist/node/index.js +5 -851
  27. package/dist/node/operations/index.js +1 -238
  28. package/dist/node/presentations/index.js +1 -11
  29. package/dist/node/presentations.js +1 -127
  30. package/dist/node/wealth-snapshot.capability.js +1 -43
  31. package/dist/node/wealth-snapshot.feature.js +1 -79
  32. package/dist/operations/index.js +1 -238
  33. package/dist/presentations/index.js +1 -11
  34. package/dist/presentations.js +1 -127
  35. package/dist/wealth-snapshot.capability.js +1 -43
  36. package/dist/wealth-snapshot.feature.js +1 -79
  37. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -1,16 +1,5 @@
1
1
  // @bun
2
- // src/docs/wealth-snapshot.docblock.ts
3
- import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
4
- var wealthSnapshotDocBlocks = [
5
- {
6
- id: "docs.examples.wealth-snapshot",
7
- title: "Wealth Snapshot",
8
- summary: "Simple wealth overview with accounts, assets, liabilities, goals, and net-worth snapshots.",
9
- kind: "reference",
10
- visibility: "public",
11
- route: "/docs/examples/wealth-snapshot",
12
- tags: ["finance", "net-worth", "goals"],
13
- body: `## Features
2
+ import{registerDocBlocks as R}from"@contractspec/lib.contracts-spec/docs";var K=[{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
14
3
 
15
4
  - Accounts with balances/currencies.
16
5
  - Assets & liabilities categorized for net worth.
@@ -24,17 +13,7 @@ var wealthSnapshotDocBlocks = [
24
13
 
25
14
  ## Presentations
26
15
  - Dashboard, accounts list, assets list, liabilities list, goals list (React + Markdown targets).
27
- `
28
- },
29
- {
30
- id: "docs.examples.wealth-snapshot.goal",
31
- title: "Wealth Snapshot \u2014 Goal",
32
- summary: "Why this personal/household finance template exists.",
33
- kind: "goal",
34
- visibility: "public",
35
- route: "/docs/examples/wealth-snapshot/goal",
36
- tags: ["finance", "goal"],
37
- body: `## Why it matters
16
+ `},{id:"docs.examples.wealth-snapshot.goal",title:"Wealth Snapshot \u2014 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
38
17
  - Provides a regenerable net-worth and goals view without bespoke finance code.
39
18
  - Keeps accounts/assets/liabilities/goals consistent across surfaces with PII care.
40
19
 
@@ -44,17 +23,7 @@ var wealthSnapshotDocBlocks = [
44
23
 
45
24
  ## Success criteria
46
25
  - Spec changes to assets/liabilities/goals regenerate UI/API/events cleanly.
47
- - PII and sensitive values are marked and redacted where needed.`
48
- },
49
- {
50
- id: "docs.examples.wealth-snapshot.usage",
51
- title: "Wealth Snapshot \u2014 Usage",
52
- summary: "How to seed, extend, and regenerate wealth tracking safely.",
53
- kind: "usage",
54
- visibility: "public",
55
- route: "/docs/examples/wealth-snapshot/usage",
56
- tags: ["finance", "usage"],
57
- body: `## Setup
26
+ - PII and sensitive values are marked and redacted where needed.`},{id:"docs.examples.wealth-snapshot.usage",title:"Wealth Snapshot \u2014 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
58
27
  1) Seed (if provided) or add accounts/assets/liabilities/goals via UI.
59
28
  2) Configure Notifications for goal reminders/threshold alerts; Audit for changes.
60
29
 
@@ -66,17 +35,7 @@ var wealthSnapshotDocBlocks = [
66
35
  ## Guardrails
67
36
  - Emit events for asset/liability/goal changes; log in Audit Trail.
68
37
  - Redact sensitive identifiers in presentations.
69
- - Keep calculations (net worth) transparent and driven by spec fields.`
70
- },
71
- {
72
- id: "docs.examples.wealth-snapshot.constraints",
73
- title: "Wealth Snapshot \u2014 Constraints & Safety",
74
- summary: "Internal guardrails for finance data, PII, and regeneration semantics.",
75
- kind: "reference",
76
- visibility: "internal",
77
- route: "/docs/examples/wealth-snapshot/constraints",
78
- tags: ["finance", "constraints", "internal"],
79
- body: `## Constraints
38
+ - Keep calculations (net worth) transparent and driven by spec fields.`},{id:"docs.examples.wealth-snapshot.constraints",title:"Wealth Snapshot \u2014 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
80
39
  - Net worth and goal calculations must stay spec-driven; avoid hidden math.
81
40
  - Events to emit: asset.created/updated, liability.created/updated, goal.created/updated, snapshot.recorded.
82
41
  - Regeneration should not alter currency/unit semantics without explicit spec change.
@@ -88,809 +47,4 @@ var wealthSnapshotDocBlocks = [
88
47
  ## Verification
89
48
  - Add fixtures for currency/unit changes and snapshot calculations.
90
49
  - Ensure Audit Trail covers all financial mutations; Notifications optional for goals/thresholds.
91
- - Use Feature Flags for new indicators/alert rules; default safe/off.`
92
- }
93
- ];
94
- registerDocBlocks(wealthSnapshotDocBlocks);
95
- // src/entities/index.ts
96
- import {
97
- defineEntity,
98
- defineEntityEnum,
99
- field,
100
- index
101
- } from "@contractspec/lib.schema";
102
- var schema = "lssm_wealth_snapshot";
103
- var AccountTypeEnum = defineEntityEnum({
104
- name: "AccountType",
105
- schema,
106
- values: ["CHECKING", "SAVINGS", "INVESTMENT", "CREDIT_CARD", "LOAN"],
107
- description: "Account categories for holdings and debts."
108
- });
109
- var AssetCategoryEnum = defineEntityEnum({
110
- name: "AssetCategory",
111
- schema,
112
- values: ["CASH", "EQUITY", "REAL_ESTATE", "CRYPTO", "OTHER"],
113
- description: "Asset categories."
114
- });
115
- var LiabilityCategoryEnum = defineEntityEnum({
116
- name: "LiabilityCategory",
117
- schema,
118
- values: ["CREDIT_CARD", "LOAN", "MORTGAGE", "TAX", "OTHER"],
119
- description: "Liability categories."
120
- });
121
- var GoalStatusEnum = defineEntityEnum({
122
- name: "GoalStatus",
123
- schema,
124
- values: ["ACTIVE", "ON_TRACK", "AT_RISK", "OFF_TRACK", "COMPLETED"],
125
- description: "Goal health/status."
126
- });
127
- var AccountEntity = defineEntity({
128
- name: "Account",
129
- description: "Financial account representing holdings or debts.",
130
- schema,
131
- map: "account",
132
- fields: {
133
- id: field.id({ description: "Account ID" }),
134
- name: field.string({ description: "Account name" }),
135
- type: field.enum("AccountType", { description: "Account type" }),
136
- currency: field.string({ description: "Currency code", default: '"USD"' }),
137
- balance: field.decimal({ description: "Current balance" }),
138
- institution: field.string({ description: "Institution", isOptional: true }),
139
- orgId: field.string({ description: "Org/household id" }),
140
- ownerId: field.string({ description: "Owner user id", isOptional: true }),
141
- createdAt: field.createdAt(),
142
- updatedAt: field.updatedAt()
143
- },
144
- enums: [AccountTypeEnum],
145
- indexes: [index.on(["orgId"]), index.on(["type"]), index.on(["ownerId"])]
146
- });
147
- var AssetEntity = defineEntity({
148
- name: "Asset",
149
- description: "Individual asset position.",
150
- schema,
151
- map: "asset",
152
- fields: {
153
- id: field.id({ description: "Asset ID" }),
154
- accountId: field.foreignKey({
155
- description: "Holding account",
156
- isOptional: true
157
- }),
158
- name: field.string({ description: "Asset name" }),
159
- category: field.enum("AssetCategory", { description: "Asset category" }),
160
- value: field.decimal({ description: "Current value" }),
161
- currency: field.string({ description: "Currency", default: '"USD"' }),
162
- orgId: field.string({ description: "Org/household id" }),
163
- metadata: field.json({ description: "Metadata", isOptional: true }),
164
- updatedAt: field.updatedAt(),
165
- createdAt: field.createdAt(),
166
- account: field.belongsTo("Account", ["accountId"], ["id"], {
167
- onDelete: "SetNull"
168
- })
169
- },
170
- enums: [AssetCategoryEnum],
171
- indexes: [index.on(["orgId"]), index.on(["category"])]
172
- });
173
- var LiabilityEntity = defineEntity({
174
- name: "Liability",
175
- description: "Debt or obligation.",
176
- schema,
177
- map: "liability",
178
- fields: {
179
- id: field.id({ description: "Liability ID" }),
180
- accountId: field.foreignKey({
181
- description: "Liability account",
182
- isOptional: true
183
- }),
184
- name: field.string({ description: "Liability name" }),
185
- category: field.enum("LiabilityCategory", {
186
- description: "Liability category"
187
- }),
188
- balance: field.decimal({ description: "Outstanding balance" }),
189
- currency: field.string({ description: "Currency", default: '"USD"' }),
190
- interestRate: field.decimal({
191
- description: "Interest rate (e.g., 0.05 for 5%)",
192
- isOptional: true
193
- }),
194
- orgId: field.string({ description: "Org/household id" }),
195
- metadata: field.json({ description: "Metadata", isOptional: true }),
196
- updatedAt: field.updatedAt(),
197
- createdAt: field.createdAt(),
198
- account: field.belongsTo("Account", ["accountId"], ["id"], {
199
- onDelete: "SetNull"
200
- })
201
- },
202
- enums: [LiabilityCategoryEnum],
203
- indexes: [index.on(["orgId"]), index.on(["category"])]
204
- });
205
- var GoalEntity = defineEntity({
206
- name: "Goal",
207
- description: "Financial goal with target amount/date.",
208
- schema,
209
- map: "goal",
210
- fields: {
211
- id: field.id({ description: "Goal ID" }),
212
- name: field.string({ description: "Goal name" }),
213
- targetAmount: field.decimal({ description: "Target amount" }),
214
- currentAmount: field.decimal({
215
- description: "Current progress amount",
216
- default: 0
217
- }),
218
- currency: field.string({ description: "Currency", default: '"USD"' }),
219
- targetDate: field.dateTime({
220
- description: "Target completion date",
221
- isOptional: true
222
- }),
223
- status: field.enum("GoalStatus", {
224
- description: "Goal status",
225
- default: "ACTIVE"
226
- }),
227
- orgId: field.string({ description: "Org/household id" }),
228
- ownerId: field.string({ description: "Owner user id", isOptional: true }),
229
- createdAt: field.createdAt(),
230
- updatedAt: field.updatedAt()
231
- },
232
- enums: [GoalStatusEnum],
233
- indexes: [
234
- index.on(["orgId"]),
235
- index.on(["status"]),
236
- index.on(["targetDate"])
237
- ]
238
- });
239
- var NetWorthSnapshotEntity = defineEntity({
240
- name: "NetWorthSnapshot",
241
- description: "Aggregated net worth snapshot for a date.",
242
- schema,
243
- map: "networth_snapshot",
244
- fields: {
245
- id: field.id({ description: "Snapshot ID" }),
246
- asOf: field.dateTime({ description: "Snapshot date" }),
247
- totalAssets: field.decimal({ description: "Total assets" }),
248
- totalLiabilities: field.decimal({ description: "Total liabilities" }),
249
- netWorth: field.decimal({ description: "Net worth" }),
250
- currency: field.string({ description: "Currency", default: '"USD"' }),
251
- orgId: field.string({ description: "Org/household id" }),
252
- createdAt: field.createdAt()
253
- },
254
- indexes: [index.unique(["orgId", "asOf"], { name: "networth_unique" })]
255
- });
256
- var wealthSnapshotEntities = [
257
- AccountEntity,
258
- AssetEntity,
259
- LiabilityEntity,
260
- GoalEntity,
261
- NetWorthSnapshotEntity
262
- ];
263
- var wealthSnapshotSchemaContribution = {
264
- moduleId: "@contractspec/example.wealth-snapshot",
265
- entities: wealthSnapshotEntities,
266
- enums: [
267
- AccountTypeEnum,
268
- AssetCategoryEnum,
269
- LiabilityCategoryEnum,
270
- GoalStatusEnum
271
- ]
272
- };
273
-
274
- // src/events.ts
275
- import { defineEvent, StabilityEnum } from "@contractspec/lib.contracts-spec";
276
- import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
277
- var AssetEventPayload = defineSchemaModel({
278
- name: "AssetEventPayload",
279
- description: "Payload for asset events",
280
- fields: {
281
- assetId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
282
- category: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
283
- value: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
284
- currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
285
- orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
286
- timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
287
- }
288
- });
289
- var LiabilityEventPayload = defineSchemaModel({
290
- name: "LiabilityEventPayload",
291
- description: "Payload for liability events",
292
- fields: {
293
- liabilityId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
294
- category: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
295
- balance: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
296
- currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
297
- orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
298
- timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
299
- }
300
- });
301
- var GoalEventPayload = defineSchemaModel({
302
- name: "GoalEventPayload",
303
- description: "Payload for goal events",
304
- fields: {
305
- goalId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
306
- status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
307
- currentAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
308
- targetAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
309
- currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
310
- orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
311
- timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
312
- }
313
- });
314
- var AssetAddedEvent = defineEvent({
315
- meta: {
316
- key: "wealth.asset.added",
317
- version: "1.0.0",
318
- description: "An asset was added or updated.",
319
- stability: StabilityEnum.Experimental,
320
- owners: [],
321
- tags: []
322
- },
323
- payload: AssetEventPayload
324
- });
325
- var LiabilityAddedEvent = defineEvent({
326
- meta: {
327
- key: "wealth.liability.added",
328
- version: "1.0.0",
329
- description: "A liability was added or updated.",
330
- stability: StabilityEnum.Experimental,
331
- owners: [],
332
- tags: []
333
- },
334
- payload: LiabilityEventPayload
335
- });
336
- var GoalUpdatedEvent = defineEvent({
337
- meta: {
338
- key: "wealth.goal.updated",
339
- version: "1.0.0",
340
- description: "A goal was updated.",
341
- stability: StabilityEnum.Experimental,
342
- owners: [],
343
- tags: []
344
- },
345
- payload: GoalEventPayload
346
- });
347
- var NetWorthSnapshotCreatedEvent = defineEvent({
348
- meta: {
349
- key: "wealth.networth.snapshot_created",
350
- version: "1.0.0",
351
- description: "A net worth snapshot was generated.",
352
- stability: StabilityEnum.Experimental,
353
- owners: [],
354
- tags: []
355
- },
356
- payload: defineSchemaModel({
357
- name: "NetWorthSnapshotEventPayload",
358
- description: "Net worth snapshot payload",
359
- fields: {
360
- netWorth: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
361
- totalAssets: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
362
- totalLiabilities: {
363
- type: ScalarTypeEnum.Float_unsecure(),
364
- isOptional: false
365
- },
366
- currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
367
- orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
368
- asOf: { type: ScalarTypeEnum.DateTime(), isOptional: false }
369
- }
370
- })
371
- });
372
- var WealthSnapshotEvents = {
373
- AssetAddedEvent,
374
- LiabilityAddedEvent,
375
- GoalUpdatedEvent,
376
- NetWorthSnapshotCreatedEvent
377
- };
378
-
379
- // src/example.ts
380
- import { defineExample } from "@contractspec/lib.contracts-spec";
381
- var example = defineExample({
382
- meta: {
383
- key: "wealth-snapshot",
384
- version: "1.0.0",
385
- title: "Wealth Snapshot",
386
- description: "Simple wealth overview with accounts, assets, liabilities, goals, and net-worth snapshots.",
387
- kind: "template",
388
- visibility: "public",
389
- stability: "experimental",
390
- owners: ["@platform.core"],
391
- tags: ["finance", "net-worth", "goals"]
392
- },
393
- docs: {
394
- rootDocId: "docs.examples.wealth-snapshot",
395
- goalDocId: "docs.examples.wealth-snapshot.goal",
396
- usageDocId: "docs.examples.wealth-snapshot.usage",
397
- constraintsDocId: "docs.examples.wealth-snapshot.constraints"
398
- },
399
- entrypoints: {
400
- packageName: "@contractspec/example.wealth-snapshot",
401
- feature: "./feature",
402
- contracts: "./contracts",
403
- presentations: "./presentations",
404
- handlers: "./handlers",
405
- docs: "./docs"
406
- },
407
- surfaces: {
408
- templates: true,
409
- sandbox: {
410
- enabled: true,
411
- modes: ["playground", "specs", "builder", "markdown", "evolution"]
412
- },
413
- studio: { enabled: true, installable: true },
414
- mcp: { enabled: true }
415
- }
416
- });
417
- var example_default = example;
418
-
419
- // src/handlers/index.ts
420
- function registerWealthSnapshotHandlers() {}
421
-
422
- // src/operations/index.ts
423
- import { defineCommand, defineQuery } from "@contractspec/lib.contracts-spec";
424
- import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
425
- var OWNERS = ["examples.wealth-snapshot"];
426
- var AccountModel = defineSchemaModel2({
427
- name: "Account",
428
- description: "Account model",
429
- fields: {
430
- id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
431
- name: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
432
- type: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
433
- currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
434
- balance: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false }
435
- }
436
- });
437
- var AssetModel = defineSchemaModel2({
438
- name: "Asset",
439
- description: "Asset model",
440
- fields: {
441
- id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
442
- name: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
443
- category: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
444
- value: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
445
- currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
446
- }
447
- });
448
- var LiabilityModel = defineSchemaModel2({
449
- name: "Liability",
450
- description: "Liability model",
451
- fields: {
452
- id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
453
- name: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
454
- category: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
455
- balance: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
456
- currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
457
- }
458
- });
459
- var GoalModel = defineSchemaModel2({
460
- name: "Goal",
461
- description: "Goal model",
462
- fields: {
463
- id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
464
- name: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
465
- targetAmount: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
466
- currentAmount: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
467
- currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
468
- status: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
469
- }
470
- });
471
- var NetWorthSnapshotModel = defineSchemaModel2({
472
- name: "NetWorthSnapshot",
473
- description: "Net worth snapshot model",
474
- fields: {
475
- asOf: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
476
- totalAssets: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
477
- totalLiabilities: {
478
- type: ScalarTypeEnum2.Float_unsecure(),
479
- isOptional: false
480
- },
481
- netWorth: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
482
- currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
483
- }
484
- });
485
- var CreateAccountInput = defineSchemaModel2({
486
- name: "CreateAccountInput",
487
- description: "Create account input",
488
- fields: {
489
- name: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
490
- type: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
491
- currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
492
- balance: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: true },
493
- orgId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
494
- }
495
- });
496
- var AddAssetInput = defineSchemaModel2({
497
- name: "AddAssetInput",
498
- description: "Add asset input",
499
- fields: {
500
- accountId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
501
- name: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
502
- category: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
503
- value: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
504
- currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
505
- orgId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
506
- }
507
- });
508
- var AddLiabilityInput = defineSchemaModel2({
509
- name: "AddLiabilityInput",
510
- description: "Add liability input",
511
- fields: {
512
- accountId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
513
- name: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
514
- category: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
515
- balance: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
516
- currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
517
- orgId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
518
- }
519
- });
520
- var UpdateGoalInput = defineSchemaModel2({
521
- name: "UpdateGoalInput",
522
- description: "Update goal progress",
523
- fields: {
524
- goalId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
525
- currentAmount: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
526
- status: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true }
527
- }
528
- });
529
- var CreateGoalInput = defineSchemaModel2({
530
- name: "CreateGoalInput",
531
- description: "Create goal input",
532
- fields: {
533
- name: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
534
- targetAmount: { type: ScalarTypeEnum2.Float_unsecure(), isOptional: false },
535
- currency: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
536
- targetDate: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
537
- orgId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
538
- }
539
- });
540
- var NetWorthQueryInput = defineSchemaModel2({
541
- name: "NetWorthQueryInput",
542
- description: "Filter for net worth snapshots",
543
- fields: {
544
- orgId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
545
- from: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
546
- to: { type: ScalarTypeEnum2.DateTime(), isOptional: true }
547
- }
548
- });
549
- var CreateAccountContract = defineCommand({
550
- meta: {
551
- key: "wealth.account.create",
552
- version: "1.0.0",
553
- stability: "stable",
554
- owners: [...OWNERS],
555
- tags: ["wealth", "account", "create"],
556
- description: "Create a financial account.",
557
- goal: "Track account balances.",
558
- context: "Onboarding/import."
559
- },
560
- io: { input: CreateAccountInput, output: AccountModel },
561
- policy: { auth: "user" }
562
- });
563
- var AddAssetContract = defineCommand({
564
- meta: {
565
- key: "wealth.asset.add",
566
- version: "1.0.0",
567
- stability: "stable",
568
- owners: [...OWNERS],
569
- tags: ["wealth", "asset", "add"],
570
- description: "Add an asset position.",
571
- goal: "Track holdings.",
572
- context: "Asset onboarding/update."
573
- },
574
- io: { input: AddAssetInput, output: AssetModel },
575
- policy: { auth: "user" }
576
- });
577
- var AddLiabilityContract = defineCommand({
578
- meta: {
579
- key: "wealth.liability.add",
580
- version: "1.0.0",
581
- stability: "stable",
582
- owners: [...OWNERS],
583
- tags: ["wealth", "liability", "add"],
584
- description: "Add a liability.",
585
- goal: "Track debts.",
586
- context: "Debt onboarding/update."
587
- },
588
- io: { input: AddLiabilityInput, output: LiabilityModel },
589
- policy: { auth: "user" }
590
- });
591
- var CreateGoalContract = defineCommand({
592
- meta: {
593
- key: "wealth.goal.create",
594
- version: "1.0.0",
595
- stability: "stable",
596
- owners: [...OWNERS],
597
- tags: ["wealth", "goal", "create"],
598
- description: "Create a financial goal.",
599
- goal: "Track progress toward goals.",
600
- context: "Planning."
601
- },
602
- io: { input: CreateGoalInput, output: GoalModel },
603
- policy: { auth: "user" }
604
- });
605
- var UpdateGoalContract = defineCommand({
606
- meta: {
607
- key: "wealth.goal.update",
608
- version: "1.0.0",
609
- stability: "stable",
610
- owners: [...OWNERS],
611
- tags: ["wealth", "goal", "update"],
612
- description: "Update goal progress.",
613
- goal: "Keep progress current.",
614
- context: "Periodic update."
615
- },
616
- io: { input: UpdateGoalInput, output: GoalModel },
617
- policy: { auth: "user" }
618
- });
619
- var GetNetWorthContract = defineQuery({
620
- meta: {
621
- key: "wealth.networth.get",
622
- version: "1.0.0",
623
- stability: "stable",
624
- owners: [...OWNERS],
625
- tags: ["wealth", "networth"],
626
- description: "Get net worth snapshots for a period.",
627
- goal: "Render charts and indicators.",
628
- context: "Dashboard."
629
- },
630
- io: {
631
- input: NetWorthQueryInput,
632
- output: defineSchemaModel2({
633
- name: "NetWorthQueryOutput",
634
- description: "Snapshots + latest indicators",
635
- fields: {
636
- snapshots: {
637
- type: NetWorthSnapshotModel,
638
- isArray: true,
639
- isOptional: false
640
- },
641
- latest: { type: NetWorthSnapshotModel, isOptional: true }
642
- }
643
- })
644
- },
645
- policy: { auth: "user" }
646
- });
647
-
648
- // src/presentations.ts
649
- import {
650
- definePresentation,
651
- StabilityEnum as StabilityEnum2
652
- } from "@contractspec/lib.contracts-spec";
653
- var WealthDashboardPresentation = definePresentation({
654
- meta: {
655
- key: "wealth-snapshot.dashboard",
656
- version: "1.0.0",
657
- title: "Wealth Dashboard",
658
- description: "Wealth snapshot dashboard with net worth overview",
659
- domain: "finance",
660
- owners: ["@wealth-snapshot"],
661
- tags: ["finance", "wealth", "dashboard"],
662
- stability: StabilityEnum2.Experimental,
663
- goal: "Overview of wealth",
664
- context: "Dashboard"
665
- },
666
- source: {
667
- type: "component",
668
- framework: "react",
669
- componentKey: "WealthDashboard"
670
- },
671
- targets: ["react", "markdown"],
672
- policy: {
673
- flags: ["wealth.dashboard.enabled"]
674
- }
675
- });
676
- var AccountsListPresentation = definePresentation({
677
- meta: {
678
- key: "wealth-snapshot.accounts.list",
679
- version: "1.0.0",
680
- title: "Accounts List",
681
- description: "List of financial accounts",
682
- domain: "finance",
683
- owners: ["@wealth-snapshot"],
684
- tags: ["finance", "accounts", "list"],
685
- stability: StabilityEnum2.Experimental,
686
- goal: "List accounts",
687
- context: "Overview"
688
- },
689
- source: {
690
- type: "component",
691
- framework: "react",
692
- componentKey: "AccountsList"
693
- },
694
- targets: ["react", "markdown"],
695
- policy: {
696
- flags: ["wealth.accounts.enabled"]
697
- }
698
- });
699
- var AssetsListPresentation = definePresentation({
700
- meta: {
701
- key: "wealth-snapshot.assets.list",
702
- version: "1.0.0",
703
- title: "Assets List",
704
- description: "List of assets with valuations",
705
- domain: "finance",
706
- owners: ["@wealth-snapshot"],
707
- tags: ["finance", "assets", "list"],
708
- stability: StabilityEnum2.Experimental,
709
- goal: "List assets",
710
- context: "Overview"
711
- },
712
- source: {
713
- type: "component",
714
- framework: "react",
715
- componentKey: "AssetsList"
716
- },
717
- targets: ["react", "markdown"],
718
- policy: {
719
- flags: ["wealth.assets.enabled"]
720
- }
721
- });
722
- var LiabilitiesListPresentation = definePresentation({
723
- meta: {
724
- key: "wealth-snapshot.liabilities.list",
725
- version: "1.0.0",
726
- title: "Liabilities List",
727
- description: "List of liabilities and debts",
728
- domain: "finance",
729
- owners: ["@wealth-snapshot"],
730
- tags: ["finance", "liabilities", "list"],
731
- stability: StabilityEnum2.Experimental,
732
- goal: "List liabilities",
733
- context: "Overview"
734
- },
735
- source: {
736
- type: "component",
737
- framework: "react",
738
- componentKey: "LiabilitiesList"
739
- },
740
- targets: ["react", "markdown"],
741
- policy: {
742
- flags: ["wealth.liabilities.enabled"]
743
- }
744
- });
745
- var GoalsListPresentation = definePresentation({
746
- meta: {
747
- key: "wealth-snapshot.goals.list",
748
- version: "1.0.0",
749
- title: "Goals List",
750
- description: "List of financial goals with progress",
751
- domain: "finance",
752
- owners: ["@wealth-snapshot"],
753
- tags: ["finance", "goals", "list"],
754
- stability: StabilityEnum2.Experimental,
755
- goal: "List goals",
756
- context: "Overview"
757
- },
758
- source: {
759
- type: "component",
760
- framework: "react",
761
- componentKey: "GoalsList"
762
- },
763
- targets: ["react", "markdown"],
764
- policy: {
765
- flags: ["wealth.goals.enabled"]
766
- }
767
- });
768
-
769
- // src/wealth-snapshot.feature.ts
770
- import { defineFeature } from "@contractspec/lib.contracts-spec";
771
- var WealthSnapshotFeature = defineFeature({
772
- meta: {
773
- key: "wealth-snapshot",
774
- version: "1.0.0",
775
- title: "Wealth Snapshot",
776
- description: "Mini-app for accounts, assets, liabilities, goals, and net worth.",
777
- domain: "finance",
778
- owners: ["@wealth-snapshot"],
779
- tags: ["finance", "net-worth", "goals"],
780
- stability: "experimental"
781
- },
782
- operations: [
783
- { key: "wealth.account.create", version: "1.0.0" },
784
- { key: "wealth.asset.add", version: "1.0.0" },
785
- { key: "wealth.liability.add", version: "1.0.0" },
786
- { key: "wealth.goal.create", version: "1.0.0" },
787
- { key: "wealth.goal.update", version: "1.0.0" },
788
- { key: "wealth.networth.get", version: "1.0.0" }
789
- ],
790
- events: [
791
- { key: "wealth.asset.added", version: "1.0.0" },
792
- { key: "wealth.liability.added", version: "1.0.0" },
793
- { key: "wealth.goal.updated", version: "1.0.0" },
794
- { key: "wealth.networth.snapshot_created", version: "1.0.0" }
795
- ],
796
- presentations: [
797
- { key: "wealth-snapshot.dashboard", version: "1.0.0" },
798
- { key: "wealth-snapshot.accounts.list", version: "1.0.0" },
799
- { key: "wealth-snapshot.assets.list", version: "1.0.0" },
800
- { key: "wealth-snapshot.liabilities.list", version: "1.0.0" },
801
- { key: "wealth-snapshot.goals.list", version: "1.0.0" }
802
- ],
803
- presentationsTargets: [
804
- {
805
- key: "wealth-snapshot.dashboard",
806
- version: "1.0.0",
807
- targets: ["react", "markdown"]
808
- },
809
- {
810
- key: "wealth-snapshot.assets.list",
811
- version: "1.0.0",
812
- targets: ["react", "markdown"]
813
- },
814
- {
815
- key: "wealth-snapshot.liabilities.list",
816
- version: "1.0.0",
817
- targets: ["react", "markdown"]
818
- },
819
- {
820
- key: "wealth-snapshot.goals.list",
821
- version: "1.0.0",
822
- targets: ["react", "markdown"]
823
- }
824
- ],
825
- capabilities: {
826
- requires: [
827
- { key: "identity", version: "1.0.0" },
828
- { key: "audit-trail", version: "1.0.0" },
829
- { key: "notifications", version: "1.0.0" }
830
- ],
831
- provides: [
832
- { key: "accounts", version: "1.0.0" },
833
- { key: "net-worth", version: "1.0.0" },
834
- { key: "goals", version: "1.0.0" }
835
- ]
836
- },
837
- telemetry: [{ key: "wealth-snapshot.telemetry", version: "1.0.0" }],
838
- docs: [
839
- "docs.examples.wealth-snapshot",
840
- "docs.examples.wealth-snapshot.goal",
841
- "docs.examples.wealth-snapshot.usage",
842
- "docs.examples.wealth-snapshot.constraints"
843
- ]
844
- });
845
- // src/index.ts
846
- import { identityRbacSchemaContribution } from "@contractspec/lib.identity-rbac";
847
- import { auditTrailSchemaContribution } from "@contractspec/module.audit-trail";
848
- import { notificationsSchemaContribution } from "@contractspec/module.notifications";
849
- var schemaComposition = {
850
- modules: [
851
- identityRbacSchemaContribution,
852
- auditTrailSchemaContribution,
853
- notificationsSchemaContribution,
854
- wealthSnapshotSchemaContribution
855
- ],
856
- provider: "postgresql",
857
- outputPath: "./prisma/schema/generated.prisma"
858
- };
859
- export {
860
- wealthSnapshotSchemaContribution,
861
- wealthSnapshotEntities,
862
- schemaComposition,
863
- registerWealthSnapshotHandlers,
864
- example_default as example,
865
- WealthSnapshotFeature,
866
- WealthSnapshotEvents,
867
- WealthDashboardPresentation,
868
- UpdateGoalContract,
869
- NetWorthSnapshotModel,
870
- NetWorthSnapshotEntity,
871
- NetWorthSnapshotCreatedEvent,
872
- LiabilityModel,
873
- LiabilityEntity,
874
- LiabilityCategoryEnum,
875
- LiabilityAddedEvent,
876
- LiabilitiesListPresentation,
877
- GoalsListPresentation,
878
- GoalUpdatedEvent,
879
- GoalStatusEnum,
880
- GoalModel,
881
- GoalEntity,
882
- GetNetWorthContract,
883
- CreateGoalContract,
884
- CreateAccountContract,
885
- AssetsListPresentation,
886
- AssetModel,
887
- AssetEntity,
888
- AssetCategoryEnum,
889
- AssetAddedEvent,
890
- AddLiabilityContract,
891
- AddAssetContract,
892
- AccountsListPresentation,
893
- AccountTypeEnum,
894
- AccountModel,
895
- AccountEntity
896
- };
50
+ - Use Feature Flags for new indicators/alert rules; default safe/off.`}];R(K);import{defineEntity as g,defineEntityEnum as O,field as i,index as d}from"@contractspec/lib.schema";var r="lssm_wealth_snapshot",x=O({name:"AccountType",schema:r,values:["CHECKING","SAVINGS","INVESTMENT","CREDIT_CARD","LOAN"],description:"Account categories for holdings and debts."}),u=O({name:"AssetCategory",schema:r,values:["CASH","EQUITY","REAL_ESTATE","CRYPTO","OTHER"],description:"Asset categories."}),w=O({name:"LiabilityCategory",schema:r,values:["CREDIT_CARD","LOAN","MORTGAGE","TAX","OTHER"],description:"Liability categories."}),L=O({name:"GoalStatus",schema:r,values:["ACTIVE","ON_TRACK","AT_RISK","OFF_TRACK","COMPLETED"],description:"Goal health/status."}),b=g({name:"Account",description:"Financial account representing holdings or debts.",schema:r,map:"account",fields:{id:i.id({description:"Account ID"}),name:i.string({description:"Account name"}),type:i.enum("AccountType",{description:"Account type"}),currency:i.string({description:"Currency code",default:'"USD"'}),balance:i.decimal({description:"Current balance"}),institution:i.string({description:"Institution",isOptional:!0}),orgId:i.string({description:"Org/household id"}),ownerId:i.string({description:"Owner user id",isOptional:!0}),createdAt:i.createdAt(),updatedAt:i.updatedAt()},enums:[x],indexes:[d.on(["orgId"]),d.on(["type"]),d.on(["ownerId"])]}),H=g({name:"Asset",description:"Individual asset position.",schema:r,map:"asset",fields:{id:i.id({description:"Asset ID"}),accountId:i.foreignKey({description:"Holding account",isOptional:!0}),name:i.string({description:"Asset name"}),category:i.enum("AssetCategory",{description:"Asset category"}),value:i.decimal({description:"Current value"}),currency:i.string({description:"Currency",default:'"USD"'}),orgId:i.string({description:"Org/household id"}),metadata:i.json({description:"Metadata",isOptional:!0}),updatedAt:i.updatedAt(),createdAt:i.createdAt(),account:i.belongsTo("Account",["accountId"],["id"],{onDelete:"SetNull"})},enums:[u],indexes:[d.on(["orgId"]),d.on(["category"])]}),U=g({name:"Liability",description:"Debt or obligation.",schema:r,map:"liability",fields:{id:i.id({description:"Liability ID"}),accountId:i.foreignKey({description:"Liability account",isOptional:!0}),name:i.string({description:"Liability name"}),category:i.enum("LiabilityCategory",{description:"Liability category"}),balance:i.decimal({description:"Outstanding balance"}),currency:i.string({description:"Currency",default:'"USD"'}),interestRate:i.decimal({description:"Interest rate (e.g., 0.05 for 5%)",isOptional:!0}),orgId:i.string({description:"Org/household id"}),metadata:i.json({description:"Metadata",isOptional:!0}),updatedAt:i.updatedAt(),createdAt:i.createdAt(),account:i.belongsTo("Account",["accountId"],["id"],{onDelete:"SetNull"})},enums:[w],indexes:[d.on(["orgId"]),d.on(["category"])]}),V=g({name:"Goal",description:"Financial goal with target amount/date.",schema:r,map:"goal",fields:{id:i.id({description:"Goal ID"}),name:i.string({description:"Goal name"}),targetAmount:i.decimal({description:"Target amount"}),currentAmount:i.decimal({description:"Current progress amount",default:0}),currency:i.string({description:"Currency",default:'"USD"'}),targetDate:i.dateTime({description:"Target completion date",isOptional:!0}),status:i.enum("GoalStatus",{description:"Goal status",default:"ACTIVE"}),orgId:i.string({description:"Org/household id"}),ownerId:i.string({description:"Owner user id",isOptional:!0}),createdAt:i.createdAt(),updatedAt:i.updatedAt()},enums:[L],indexes:[d.on(["orgId"]),d.on(["status"]),d.on(["targetDate"])]}),F=g({name:"NetWorthSnapshot",description:"Aggregated net worth snapshot for a date.",schema:r,map:"networth_snapshot",fields:{id:i.id({description:"Snapshot ID"}),asOf:i.dateTime({description:"Snapshot date"}),totalAssets:i.decimal({description:"Total assets"}),totalLiabilities:i.decimal({description:"Total liabilities"}),netWorth:i.decimal({description:"Net worth"}),currency:i.string({description:"Currency",default:'"USD"'}),orgId:i.string({description:"Org/household id"}),createdAt:i.createdAt()},indexes:[d.unique(["orgId","asOf"],{name:"networth_unique"})]}),j=[b,H,U,V,F],_={moduleId:"@contractspec/example.wealth-snapshot",entities:j,enums:[x,u,w,L]};import{defineEvent as C,StabilityEnum as c}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as D,ScalarTypeEnum as s}from"@contractspec/lib.schema";var q=D({name:"AssetEventPayload",description:"Payload for asset events",fields:{assetId:{type:s.String_unsecure(),isOptional:!1},category:{type:s.String_unsecure(),isOptional:!1},value:{type:s.Float_unsecure(),isOptional:!1},currency:{type:s.String_unsecure(),isOptional:!1},orgId:{type:s.String_unsecure(),isOptional:!1},timestamp:{type:s.DateTime(),isOptional:!1}}}),N=D({name:"LiabilityEventPayload",description:"Payload for liability events",fields:{liabilityId:{type:s.String_unsecure(),isOptional:!1},category:{type:s.String_unsecure(),isOptional:!1},balance:{type:s.Float_unsecure(),isOptional:!1},currency:{type:s.String_unsecure(),isOptional:!1},orgId:{type:s.String_unsecure(),isOptional:!1},timestamp:{type:s.DateTime(),isOptional:!1}}}),Y=D({name:"GoalEventPayload",description:"Payload for goal events",fields:{goalId:{type:s.String_unsecure(),isOptional:!1},status:{type:s.String_unsecure(),isOptional:!1},currentAmount:{type:s.Float_unsecure(),isOptional:!1},targetAmount:{type:s.Float_unsecure(),isOptional:!1},currency:{type:s.String_unsecure(),isOptional:!1},orgId:{type:s.String_unsecure(),isOptional:!1},timestamp:{type:s.DateTime(),isOptional:!1}}}),X=C({meta:{key:"wealth.asset.added",version:"1.0.0",description:"An asset was added or updated.",stability:c.Experimental,owners:[],tags:[]},payload:q}),z=C({meta:{key:"wealth.liability.added",version:"1.0.0",description:"A liability was added or updated.",stability:c.Experimental,owners:[],tags:[]},payload:N}),J=C({meta:{key:"wealth.goal.updated",version:"1.0.0",description:"A goal was updated.",stability:c.Experimental,owners:[],tags:[]},payload:Y}),Z=C({meta:{key:"wealth.networth.snapshot_created",version:"1.0.0",description:"A net worth snapshot was generated.",stability:c.Experimental,owners:[],tags:[]},payload:D({name:"NetWorthSnapshotEventPayload",description:"Net worth snapshot payload",fields:{netWorth:{type:s.Float_unsecure(),isOptional:!1},totalAssets:{type:s.Float_unsecure(),isOptional:!1},totalLiabilities:{type:s.Float_unsecure(),isOptional:!1},currency:{type:s.String_unsecure(),isOptional:!1},orgId:{type:s.String_unsecure(),isOptional:!1},asOf:{type:s.DateTime(),isOptional:!1}}})}),nt={AssetAddedEvent:X,LiabilityAddedEvent:z,GoalUpdatedEvent:J,NetWorthSnapshotCreatedEvent:Z};import{defineExample as $}from"@contractspec/lib.contracts-spec";var p=$({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=p;function It(){}import{defineCommand as e,defineQuery as k}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as o,ScalarTypeEnum as t}from"@contractspec/lib.schema";var n=["examples.wealth-snapshot"],B=o({name:"Account",description:"Account model",fields:{id:{type:t.String_unsecure(),isOptional:!1},name:{type:t.String_unsecure(),isOptional:!1},type:{type:t.String_unsecure(),isOptional:!1},currency:{type:t.String_unsecure(),isOptional:!1},balance:{type:t.Float_unsecure(),isOptional:!1}}}),v=o({name:"Asset",description:"Asset model",fields:{id:{type:t.String_unsecure(),isOptional:!1},name:{type:t.String_unsecure(),isOptional:!1},category:{type:t.String_unsecure(),isOptional:!1},value:{type:t.Float_unsecure(),isOptional:!1},currency:{type:t.String_unsecure(),isOptional:!1}}}),P=o({name:"Liability",description:"Liability model",fields:{id:{type:t.String_unsecure(),isOptional:!1},name:{type:t.String_unsecure(),isOptional:!1},category:{type:t.String_unsecure(),isOptional:!1},balance:{type:t.Float_unsecure(),isOptional:!1},currency:{type:t.String_unsecure(),isOptional:!1}}}),G=o({name:"Goal",description:"Goal model",fields:{id:{type:t.String_unsecure(),isOptional:!1},name:{type:t.String_unsecure(),isOptional:!1},targetAmount:{type:t.Float_unsecure(),isOptional:!1},currentAmount:{type:t.Float_unsecure(),isOptional:!1},currency:{type:t.String_unsecure(),isOptional:!1},status:{type:t.String_unsecure(),isOptional:!1}}}),h=o({name:"NetWorthSnapshot",description:"Net worth snapshot model",fields:{asOf:{type:t.DateTime(),isOptional:!1},totalAssets:{type:t.Float_unsecure(),isOptional:!1},totalLiabilities:{type:t.Float_unsecure(),isOptional:!1},netWorth:{type:t.Float_unsecure(),isOptional:!1},currency:{type:t.String_unsecure(),isOptional:!1}}}),W=o({name:"CreateAccountInput",description:"Create account input",fields:{name:{type:t.String_unsecure(),isOptional:!1},type:{type:t.String_unsecure(),isOptional:!1},currency:{type:t.String_unsecure(),isOptional:!0},balance:{type:t.Float_unsecure(),isOptional:!0},orgId:{type:t.String_unsecure(),isOptional:!1}}}),f=o({name:"AddAssetInput",description:"Add asset input",fields:{accountId:{type:t.String_unsecure(),isOptional:!0},name:{type:t.String_unsecure(),isOptional:!1},category:{type:t.String_unsecure(),isOptional:!1},value:{type:t.Float_unsecure(),isOptional:!1},currency:{type:t.String_unsecure(),isOptional:!0},orgId:{type:t.String_unsecure(),isOptional:!1}}}),M=o({name:"AddLiabilityInput",description:"Add liability input",fields:{accountId:{type:t.String_unsecure(),isOptional:!0},name:{type:t.String_unsecure(),isOptional:!1},category:{type:t.String_unsecure(),isOptional:!1},balance:{type:t.Float_unsecure(),isOptional:!1},currency:{type:t.String_unsecure(),isOptional:!0},orgId:{type:t.String_unsecure(),isOptional:!1}}}),a=o({name:"UpdateGoalInput",description:"Update goal progress",fields:{goalId:{type:t.String_unsecure(),isOptional:!1},currentAmount:{type:t.Float_unsecure(),isOptional:!1},status:{type:t.String_unsecure(),isOptional:!0}}}),l=o({name:"CreateGoalInput",description:"Create goal input",fields:{name:{type:t.String_unsecure(),isOptional:!1},targetAmount:{type:t.Float_unsecure(),isOptional:!1},currency:{type:t.String_unsecure(),isOptional:!0},targetDate:{type:t.DateTime(),isOptional:!0},orgId:{type:t.String_unsecure(),isOptional:!1}}}),y=o({name:"NetWorthQueryInput",description:"Filter for net worth snapshots",fields:{orgId:{type:t.String_unsecure(),isOptional:!1},from:{type:t.DateTime(),isOptional:!0},to:{type:t.DateTime(),isOptional:!0}}}),Dt=e({meta:{key:"wealth.account.create",version:"1.0.0",stability:"stable",owners:[...n],tags:["wealth","account","create"],description:"Create a financial account.",goal:"Track account balances.",context:"Onboarding/import."},io:{input:W,output:B},policy:{auth:"user"}}),xt=e({meta:{key:"wealth.asset.add",version:"1.0.0",stability:"stable",owners:[...n],tags:["wealth","asset","add"],description:"Add an asset position.",goal:"Track holdings.",context:"Asset onboarding/update."},io:{input:f,output:v},policy:{auth:"user"}}),ut=e({meta:{key:"wealth.liability.add",version:"1.0.0",stability:"stable",owners:[...n],tags:["wealth","liability","add"],description:"Add a liability.",goal:"Track debts.",context:"Debt onboarding/update."},io:{input:M,output:P},policy:{auth:"user"}}),wt=e({meta:{key:"wealth.goal.create",version:"1.0.0",stability:"stable",owners:[...n],tags:["wealth","goal","create"],description:"Create a financial goal.",goal:"Track progress toward goals.",context:"Planning."},io:{input:l,output:G},policy:{auth:"user"}}),Lt=e({meta:{key:"wealth.goal.update",version:"1.0.0",stability:"stable",owners:[...n],tags:["wealth","goal","update"],description:"Update goal progress.",goal:"Keep progress current.",context:"Periodic update."},io:{input:a,output:G},policy:{auth:"user"}}),_t=k({meta:{key:"wealth.networth.get",version:"1.0.0",stability:"stable",owners:[...n],tags:["wealth","networth"],description:"Get net worth snapshots for a period.",goal:"Render charts and indicators.",context:"Dashboard."},io:{input:y,output:o({name:"NetWorthQueryOutput",description:"Snapshots + latest indicators",fields:{snapshots:{type:h,isArray:!0,isOptional:!1},latest:{type:h,isOptional:!0}}})},policy:{auth:"user"}});import{definePresentation as A,StabilityEnum as I}from"@contractspec/lib.contracts-spec";var Rt=A({meta:{key:"wealth-snapshot.dashboard",version:"1.0.0",title:"Wealth Dashboard",description:"Wealth snapshot dashboard with net worth overview",domain:"finance",owners:["@wealth-snapshot"],tags:["finance","wealth","dashboard"],stability:I.Experimental,goal:"Overview of wealth",context:"Dashboard"},source:{type:"component",framework:"react",componentKey:"WealthDashboard"},targets:["react","markdown"],policy:{flags:["wealth.dashboard.enabled"]}}),Kt=A({meta:{key:"wealth-snapshot.accounts.list",version:"1.0.0",title:"Accounts List",description:"List of financial accounts",domain:"finance",owners:["@wealth-snapshot"],tags:["finance","accounts","list"],stability:I.Experimental,goal:"List accounts",context:"Overview"},source:{type:"component",framework:"react",componentKey:"AccountsList"},targets:["react","markdown"],policy:{flags:["wealth.accounts.enabled"]}}),bt=A({meta:{key:"wealth-snapshot.assets.list",version:"1.0.0",title:"Assets List",description:"List of assets with valuations",domain:"finance",owners:["@wealth-snapshot"],tags:["finance","assets","list"],stability:I.Experimental,goal:"List assets",context:"Overview"},source:{type:"component",framework:"react",componentKey:"AssetsList"},targets:["react","markdown"],policy:{flags:["wealth.assets.enabled"]}}),Ht=A({meta:{key:"wealth-snapshot.liabilities.list",version:"1.0.0",title:"Liabilities List",description:"List of liabilities and debts",domain:"finance",owners:["@wealth-snapshot"],tags:["finance","liabilities","list"],stability:I.Experimental,goal:"List liabilities",context:"Overview"},source:{type:"component",framework:"react",componentKey:"LiabilitiesList"},targets:["react","markdown"],policy:{flags:["wealth.liabilities.enabled"]}}),Ut=A({meta:{key:"wealth-snapshot.goals.list",version:"1.0.0",title:"Goals List",description:"List of financial goals with progress",domain:"finance",owners:["@wealth-snapshot"],tags:["finance","goals","list"],stability:I.Experimental,goal:"List goals",context:"Overview"},source:{type:"component",framework:"react",componentKey:"GoalsList"},targets:["react","markdown"],policy:{flags:["wealth.goals.enabled"]}});import{defineFeature as T}from"@contractspec/lib.contracts-spec";var jt=T({meta:{key:"wealth-snapshot",version:"1.0.0",title:"Wealth Snapshot",description:"Mini-app for accounts, assets, liabilities, goals, and net worth.",domain:"finance",owners:["@wealth-snapshot"],tags:["finance","net-worth","goals"],stability:"experimental"},operations:[{key:"wealth.account.create",version:"1.0.0"},{key:"wealth.asset.add",version:"1.0.0"},{key:"wealth.liability.add",version:"1.0.0"},{key:"wealth.goal.create",version:"1.0.0"},{key:"wealth.goal.update",version:"1.0.0"},{key:"wealth.networth.get",version:"1.0.0"}],events:[{key:"wealth.asset.added",version:"1.0.0"},{key:"wealth.liability.added",version:"1.0.0"},{key:"wealth.goal.updated",version:"1.0.0"},{key:"wealth.networth.snapshot_created",version:"1.0.0"}],presentations:[{key:"wealth-snapshot.dashboard",version:"1.0.0"},{key:"wealth-snapshot.accounts.list",version:"1.0.0"},{key:"wealth-snapshot.assets.list",version:"1.0.0"},{key:"wealth-snapshot.liabilities.list",version:"1.0.0"},{key:"wealth-snapshot.goals.list",version:"1.0.0"}],presentationsTargets:[{key:"wealth-snapshot.dashboard",version:"1.0.0",targets:["react","markdown"]},{key:"wealth-snapshot.assets.list",version:"1.0.0",targets:["react","markdown"]},{key:"wealth-snapshot.liabilities.list",version:"1.0.0",targets:["react","markdown"]},{key:"wealth-snapshot.goals.list",version:"1.0.0",targets:["react","markdown"]}],capabilities:{requires:[{key:"identity",version:"1.0.0"},{key:"audit-trail",version:"1.0.0"},{key:"notifications",version:"1.0.0"}],provides:[{key:"accounts",version:"1.0.0"},{key:"net-worth",version:"1.0.0"},{key:"goals",version:"1.0.0"}]},telemetry:[{key:"wealth-snapshot.telemetry",version:"1.0.0"}],docs:["docs.examples.wealth-snapshot","docs.examples.wealth-snapshot.goal","docs.examples.wealth-snapshot.usage","docs.examples.wealth-snapshot.constraints"]});import{identityRbacSchemaContribution as m}from"@contractspec/lib.identity-rbac";import{auditTrailSchemaContribution as E}from"@contractspec/module.audit-trail";import{notificationsSchemaContribution as S}from"@contractspec/module.notifications";var Zt={modules:[m,E,S,_],provider:"postgresql",outputPath:"./prisma/schema/generated.prisma"};export{_ as wealthSnapshotSchemaContribution,j as wealthSnapshotEntities,Zt as schemaComposition,It as registerWealthSnapshotHandlers,Q as example,jt as WealthSnapshotFeature,nt as WealthSnapshotEvents,Rt as WealthDashboardPresentation,Lt as UpdateGoalContract,h as NetWorthSnapshotModel,F as NetWorthSnapshotEntity,Z as NetWorthSnapshotCreatedEvent,P as LiabilityModel,U as LiabilityEntity,w as LiabilityCategoryEnum,z as LiabilityAddedEvent,Ht as LiabilitiesListPresentation,Ut as GoalsListPresentation,J as GoalUpdatedEvent,L as GoalStatusEnum,G as GoalModel,V as GoalEntity,_t as GetNetWorthContract,wt as CreateGoalContract,Dt as CreateAccountContract,bt as AssetsListPresentation,v as AssetModel,H as AssetEntity,u as AssetCategoryEnum,X as AssetAddedEvent,ut as AddLiabilityContract,xt as AddAssetContract,Kt as AccountsListPresentation,x as AccountTypeEnum,B as AccountModel,b as AccountEntity};