@lssm/example.service-business-os 0.0.0-canary-20251217083314 → 1.41.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/client/client.contracts.js +1 -33
- package/dist/client/client.schema.js +1 -78
- package/dist/client/index.js +1 -4
- package/dist/contracts/index.js +1 -17
- package/dist/docs/index.js +1 -1
- package/dist/docs/service-business-os.docblock.js +5 -62
- package/dist/entities/index.js +1 -289
- package/dist/events.js +1 -178
- package/dist/example.js +1 -45
- package/dist/handlers/index.js +1 -5
- package/dist/index.js +1 -17
- package/dist/invoice/index.js +1 -4
- package/dist/invoice/invoice.contracts.js +1 -33
- package/dist/invoice/invoice.schema.js +1 -78
- package/dist/job/index.js +1 -4
- package/dist/job/job.contracts.js +1 -119
- package/dist/job/job.schema.js +1 -99
- package/dist/payment/index.js +1 -4
- package/dist/payment/payment.contracts.js +1 -33
- package/dist/payment/payment.schema.js +1 -74
- package/dist/presentations/index.js +1 -17
- package/dist/presentations.js +1 -148
- package/dist/quote/index.js +1 -4
- package/dist/quote/quote.contracts.js +1 -57
- package/dist/quote/quote.schema.js +1 -115
- package/dist/service.feature.js +1 -162
- package/package.json +36 -37
- package/dist/client/client.contracts.d.ts +0 -64
- package/dist/client/client.schema.d.ts +0 -67
- package/dist/client/index.d.ts +0 -3
- package/dist/contracts/index.d.ts +0 -11
- package/dist/docs/index.d.ts +0 -1
- package/dist/docs/service-business-os.docblock.d.ts +0 -1
- package/dist/entities/index.d.ts +0 -167
- package/dist/events.d.ts +0 -336
- package/dist/example.d.ts +0 -36
- package/dist/handlers/index.d.ts +0 -12
- package/dist/index.d.ts +0 -11
- package/dist/invoice/index.d.ts +0 -3
- package/dist/invoice/invoice.contracts.d.ts +0 -64
- package/dist/invoice/invoice.schema.d.ts +0 -67
- package/dist/job/index.d.ts +0 -3
- package/dist/job/job.contracts.d.ts +0 -237
- package/dist/job/job.schema.d.ts +0 -84
- package/dist/libs/contracts/dist/capabilities/openbanking.js +0 -88
- package/dist/libs/contracts/dist/client/index.js +0 -5
- package/dist/libs/contracts/dist/client/react/feature-render.js +0 -2
- package/dist/libs/contracts/dist/client/react/form-render.js +0 -4
- package/dist/libs/contracts/dist/client/react/index.js +0 -4
- package/dist/libs/contracts/dist/contract-registry/index.js +0 -1
- package/dist/libs/contracts/dist/contract-registry/schemas.js +0 -60
- package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/index.js +0 -29
- package/dist/libs/contracts/dist/docs/presentations.js +0 -71
- package/dist/libs/contracts/dist/docs/registry.js +0 -44
- package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -80
- package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -57
- package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -357
- package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
- package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
- package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
- package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -79
- package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -84
- package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
- package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
- package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
- package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -69
- package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
- package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -62
- package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -155
- package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
- package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -101
- package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
- package/dist/libs/contracts/dist/events.js +0 -10
- package/dist/libs/contracts/dist/experiments/evaluator.js +0 -1
- package/dist/libs/contracts/dist/index.js +0 -71
- package/dist/libs/contracts/dist/install.js +0 -2
- package/dist/libs/contracts/dist/integrations/contracts.js +0 -377
- package/dist/libs/contracts/dist/integrations/index.js +0 -18
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
- package/dist/libs/contracts/dist/integrations/openbanking/models.js +0 -242
- package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +0 -13
- package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +0 -52
- package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +0 -75
- package/dist/libs/contracts/dist/integrations/providers/gmail.js +0 -87
- package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +0 -66
- package/dist/libs/contracts/dist/integrations/providers/index.js +0 -11
- package/dist/libs/contracts/dist/integrations/providers/mistral.js +0 -68
- package/dist/libs/contracts/dist/integrations/providers/postmark.js +0 -68
- package/dist/libs/contracts/dist/integrations/providers/powens.js +0 -116
- package/dist/libs/contracts/dist/integrations/providers/qdrant.js +0 -73
- package/dist/libs/contracts/dist/integrations/providers/registry.js +0 -10
- package/dist/libs/contracts/dist/integrations/providers/stripe.js +0 -83
- package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +0 -61
- package/dist/libs/contracts/dist/jsonschema.js +0 -1
- package/dist/libs/contracts/dist/knowledge/contracts.js +0 -306
- package/dist/libs/contracts/dist/knowledge/index.js +0 -7
- package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +0 -34
- package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
- package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
- package/dist/libs/contracts/dist/knowledge/spaces/index.js +0 -6
- package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +0 -34
- package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +0 -37
- package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
- package/dist/libs/contracts/dist/llm/exporters.js +0 -19
- package/dist/libs/contracts/dist/llm/index.js +0 -2
- package/dist/libs/contracts/dist/llm/prompts.js +0 -1
- package/dist/libs/contracts/dist/onboarding-base.js +0 -196
- package/dist/libs/contracts/dist/openapi.js +0 -1
- package/dist/libs/contracts/dist/ownership.js +0 -21
- package/dist/libs/contracts/dist/presentations.js +0 -1
- package/dist/libs/contracts/dist/presentations.v2.js +0 -11
- package/dist/libs/contracts/dist/prompt.js +0 -1
- package/dist/libs/contracts/dist/promptRegistry.js +0 -1
- package/dist/libs/contracts/dist/regenerator/index.js +0 -1
- package/dist/libs/contracts/dist/regenerator/service.js +0 -6
- package/dist/libs/contracts/dist/registry.js +0 -2
- package/dist/libs/contracts/dist/resources.js +0 -1
- package/dist/libs/contracts/dist/schema/dist/EnumType.js +0 -2
- package/dist/libs/contracts/dist/schema/dist/FieldType.js +0 -49
- package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +0 -34
- package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
- package/dist/libs/contracts/dist/schema/dist/entity/index.js +0 -2
- package/dist/libs/contracts/dist/schema/dist/entity/types.js +0 -1
- package/dist/libs/contracts/dist/schema/dist/index.js +0 -6
- package/dist/libs/contracts/dist/server/graphql-pothos.js +0 -6
- package/dist/libs/contracts/dist/server/index.js +0 -8
- package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +0 -4
- package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +0 -2
- package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +0 -1
- package/dist/libs/contracts/dist/server/mcp/registerResources.js +0 -2
- package/dist/libs/contracts/dist/server/mcp/registerTools.js +0 -1
- package/dist/libs/contracts/dist/server/provider-mcp.js +0 -1
- package/dist/libs/contracts/dist/server/rest-elysia.js +0 -1
- package/dist/libs/contracts/dist/server/rest-express.js +0 -1
- package/dist/libs/contracts/dist/server/rest-generic.js +0 -1
- package/dist/libs/contracts/dist/server/rest-next-app.js +0 -1
- package/dist/libs/contracts/dist/server/rest-next-pages.js +0 -1
- package/dist/libs/contracts/dist/spec.js +0 -34
- package/dist/libs/contracts/dist/telemetry/index.js +0 -1
- package/dist/libs/contracts/dist/telemetry/tracker.js +0 -1
- package/dist/libs/contracts/dist/tests/index.js +0 -1
- package/dist/libs/contracts/dist/tests/runner.js +0 -2
- package/dist/libs/contracts/dist/workflow/index.js +0 -1
- package/dist/libs/contracts/dist/workflow/runner.js +0 -1
- package/dist/libs/schema/dist/EnumType.js +0 -2
- package/dist/libs/schema/dist/FieldType.js +0 -49
- package/dist/libs/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/libs/schema/dist/SchemaModel.js +0 -39
- package/dist/libs/schema/dist/entity/defineEntity.js +0 -236
- package/dist/libs/schema/dist/entity/index.js +0 -2
- package/dist/libs/schema/dist/entity/types.js +0 -1
- package/dist/libs/schema/dist/index.js +0 -6
- package/dist/payment/index.d.ts +0 -3
- package/dist/payment/payment.contracts.d.ts +0 -60
- package/dist/payment/payment.schema.d.ts +0 -63
- package/dist/presentations/index.d.ts +0 -8
- package/dist/presentations.d.ts +0 -12
- package/dist/quote/index.d.ts +0 -3
- package/dist/quote/quote.contracts.d.ts +0 -134
- package/dist/quote/quote.schema.d.ts +0 -100
- package/dist/service.feature.d.ts +0 -6
|
@@ -1,33 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../libs/contracts/dist/index.js";
|
|
3
|
-
import { ClientModel, CreateClientInputModel } from "./client.schema.js";
|
|
4
|
-
|
|
5
|
-
//#region src/client/client.contracts.ts
|
|
6
|
-
const OWNERS = ["@examples.service-business-os"];
|
|
7
|
-
/**
|
|
8
|
-
* Create a new client.
|
|
9
|
-
*/
|
|
10
|
-
const CreateClientContract = defineCommand({
|
|
11
|
-
meta: {
|
|
12
|
-
name: "service.client.create",
|
|
13
|
-
version: 1,
|
|
14
|
-
stability: "stable",
|
|
15
|
-
owners: [...OWNERS],
|
|
16
|
-
tags: [
|
|
17
|
-
"service-business-os",
|
|
18
|
-
"client",
|
|
19
|
-
"create"
|
|
20
|
-
],
|
|
21
|
-
description: "Create a new client.",
|
|
22
|
-
goal: "Onboard clients.",
|
|
23
|
-
context: "CRM."
|
|
24
|
-
},
|
|
25
|
-
io: {
|
|
26
|
-
input: CreateClientInputModel,
|
|
27
|
-
output: ClientModel
|
|
28
|
-
},
|
|
29
|
-
policy: { auth: "user" }
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
export { CreateClientContract };
|
|
1
|
+
import{ClientModel as e,CreateClientInputModel as t}from"./client.schema.js";import{defineCommand as n}from"@lssm/lib.contracts";const r=n({meta:{name:`service.client.create`,version:1,stability:`stable`,owners:[...[`@examples.service-business-os`]],tags:[`service-business-os`,`client`,`create`],description:`Create a new client.`,goal:`Onboard clients.`,context:`CRM.`},io:{input:t,output:e},policy:{auth:`user`}});export{r as CreateClientContract};
|
|
@@ -1,78 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { defineSchemaModel } from "../libs/schema/dist/SchemaModel.js";
|
|
3
|
-
import "../libs/schema/dist/index.js";
|
|
4
|
-
|
|
5
|
-
//#region src/client/client.schema.ts
|
|
6
|
-
/**
|
|
7
|
-
* Client profile.
|
|
8
|
-
*/
|
|
9
|
-
const ClientModel = defineSchemaModel({
|
|
10
|
-
name: "Client",
|
|
11
|
-
description: "Client profile",
|
|
12
|
-
fields: {
|
|
13
|
-
id: {
|
|
14
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
15
|
-
isOptional: false
|
|
16
|
-
},
|
|
17
|
-
name: {
|
|
18
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
19
|
-
isOptional: false
|
|
20
|
-
},
|
|
21
|
-
contactEmail: {
|
|
22
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
23
|
-
isOptional: true
|
|
24
|
-
},
|
|
25
|
-
phone: {
|
|
26
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
27
|
-
isOptional: true
|
|
28
|
-
},
|
|
29
|
-
orgId: {
|
|
30
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
31
|
-
isOptional: false
|
|
32
|
-
},
|
|
33
|
-
ownerId: {
|
|
34
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
35
|
-
isOptional: false
|
|
36
|
-
},
|
|
37
|
-
createdAt: {
|
|
38
|
-
type: ScalarTypeEnum.DateTime(),
|
|
39
|
-
isOptional: false
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
/**
|
|
44
|
-
* Input for creating a client.
|
|
45
|
-
*/
|
|
46
|
-
const CreateClientInputModel = defineSchemaModel({
|
|
47
|
-
name: "CreateClientInput",
|
|
48
|
-
description: "Input for creating a client",
|
|
49
|
-
fields: {
|
|
50
|
-
name: {
|
|
51
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
52
|
-
isOptional: false
|
|
53
|
-
},
|
|
54
|
-
contactEmail: {
|
|
55
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
56
|
-
isOptional: true
|
|
57
|
-
},
|
|
58
|
-
phone: {
|
|
59
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
60
|
-
isOptional: true
|
|
61
|
-
},
|
|
62
|
-
orgId: {
|
|
63
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
64
|
-
isOptional: false
|
|
65
|
-
},
|
|
66
|
-
ownerId: {
|
|
67
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
68
|
-
isOptional: false
|
|
69
|
-
},
|
|
70
|
-
metadata: {
|
|
71
|
-
type: ScalarTypeEnum.JSON(),
|
|
72
|
-
isOptional: true
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
//#endregion
|
|
78
|
-
export { ClientModel, CreateClientInputModel };
|
|
1
|
+
import{ScalarTypeEnum as e,defineSchemaModel as t}from"@lssm/lib.schema";const n=t({name:`Client`,description:`Client profile`,fields:{id:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},contactEmail:{type:e.String_unsecure(),isOptional:!0},phone:{type:e.String_unsecure(),isOptional:!0},orgId:{type:e.String_unsecure(),isOptional:!1},ownerId:{type:e.String_unsecure(),isOptional:!1},createdAt:{type:e.DateTime(),isOptional:!1}}}),r=t({name:`CreateClientInput`,description:`Input for creating a client`,fields:{name:{type:e.String_unsecure(),isOptional:!1},contactEmail:{type:e.String_unsecure(),isOptional:!0},phone:{type:e.String_unsecure(),isOptional:!0},orgId:{type:e.String_unsecure(),isOptional:!1},ownerId:{type:e.String_unsecure(),isOptional:!1},metadata:{type:e.JSON(),isOptional:!0}}});export{n as ClientModel,r as CreateClientInputModel};
|
package/dist/client/index.js
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CreateClientContract } from "./client.contracts.js";
|
|
3
|
-
|
|
4
|
-
export { ClientModel, CreateClientContract, CreateClientInputModel };
|
|
1
|
+
import{ClientModel as e,CreateClientInputModel as t}from"./client.schema.js";import{CreateClientContract as n}from"./client.contracts.js";export{e as ClientModel,n as CreateClientContract,t as CreateClientInputModel};
|
package/dist/contracts/index.js
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CreateClientContract } from "../client/client.contracts.js";
|
|
3
|
-
import "../client/index.js";
|
|
4
|
-
import { AcceptQuoteInputModel, CreateQuoteInputModel, QuoteModel } from "../quote/quote.schema.js";
|
|
5
|
-
import { AcceptQuoteContract, CreateQuoteContract } from "../quote/quote.contracts.js";
|
|
6
|
-
import "../quote/index.js";
|
|
7
|
-
import { CompleteJobInputModel, JobModel, ScheduleJobInputModel } from "../job/job.schema.js";
|
|
8
|
-
import { CompleteJobContract, ScheduleJobContract } from "../job/job.contracts.js";
|
|
9
|
-
import "../job/index.js";
|
|
10
|
-
import { InvoiceModel, IssueInvoiceInputModel } from "../invoice/invoice.schema.js";
|
|
11
|
-
import { IssueInvoiceContract } from "../invoice/invoice.contracts.js";
|
|
12
|
-
import "../invoice/index.js";
|
|
13
|
-
import { PaymentModel, RecordPaymentInputModel } from "../payment/payment.schema.js";
|
|
14
|
-
import { RecordPaymentContract } from "../payment/payment.contracts.js";
|
|
15
|
-
import "../payment/index.js";
|
|
16
|
-
|
|
17
|
-
export { AcceptQuoteContract, AcceptQuoteInputModel, ClientModel, CompleteJobContract, CompleteJobInputModel, CreateClientContract, CreateClientInputModel, CreateQuoteContract, CreateQuoteInputModel, InvoiceModel, IssueInvoiceContract, IssueInvoiceInputModel, JobModel, PaymentModel, QuoteModel, RecordPaymentContract, RecordPaymentInputModel, ScheduleJobContract, ScheduleJobInputModel };
|
|
1
|
+
import{ClientModel as e,CreateClientInputModel as t}from"../client/client.schema.js";import{CreateClientContract as n}from"../client/client.contracts.js";import"../client/index.js";import{AcceptQuoteInputModel as r,CreateQuoteInputModel as i,QuoteModel as a}from"../quote/quote.schema.js";import{AcceptQuoteContract as o,CreateQuoteContract as s}from"../quote/quote.contracts.js";import"../quote/index.js";import{CompleteJobInputModel as c,JobModel as l,ScheduleJobInputModel as u}from"../job/job.schema.js";import{CompleteJobContract as d,ScheduleJobContract as f}from"../job/job.contracts.js";import"../job/index.js";import{InvoiceModel as p,IssueInvoiceInputModel as m}from"../invoice/invoice.schema.js";import{IssueInvoiceContract as h}from"../invoice/invoice.contracts.js";import"../invoice/index.js";import{PaymentModel as g,RecordPaymentInputModel as _}from"../payment/payment.schema.js";import{RecordPaymentContract as v}from"../payment/payment.contracts.js";import"../payment/index.js";export{o as AcceptQuoteContract,r as AcceptQuoteInputModel,e as ClientModel,d as CompleteJobContract,c as CompleteJobInputModel,n as CreateClientContract,t as CreateClientInputModel,s as CreateQuoteContract,i as CreateQuoteInputModel,p as InvoiceModel,h as IssueInvoiceContract,m as IssueInvoiceInputModel,l as JobModel,g as PaymentModel,a as QuoteModel,v as RecordPaymentContract,_ as RecordPaymentInputModel,f as ScheduleJobContract,u as ScheduleJobInputModel};
|
package/dist/docs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"./service-business-os.docblock.js";
|
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "../libs/contracts/dist/docs/index.js";
|
|
3
|
-
|
|
4
|
-
//#region src/docs/service-business-os.docblock.ts
|
|
5
|
-
registerDocBlocks([
|
|
6
|
-
{
|
|
7
|
-
id: "docs.examples.service-business-os",
|
|
8
|
-
title: "Service Business OS",
|
|
9
|
-
summary: "Field/service business flow from client intake to quote, job scheduling, invoicing, and payments with notifications and audit trail.",
|
|
10
|
-
kind: "reference",
|
|
11
|
-
visibility: "public",
|
|
12
|
-
route: "/docs/examples/service-business-os",
|
|
13
|
-
tags: [
|
|
14
|
-
"services",
|
|
15
|
-
"quotes",
|
|
16
|
-
"jobs",
|
|
17
|
-
"invoices",
|
|
18
|
-
"payments"
|
|
19
|
-
],
|
|
20
|
-
body: `## Flows
|
|
1
|
+
import{registerDocBlocks as e}from"@lssm/lib.contracts/docs";e([{id:`docs.examples.service-business-os`,title:`Service Business OS`,summary:`Field/service business flow from client intake to quote, job scheduling, invoicing, and payments with notifications and audit trail.`,kind:`reference`,visibility:`public`,route:`/docs/examples/service-business-os`,tags:[`services`,`quotes`,`jobs`,`invoices`,`payments`],body:`## Flows
|
|
21
2
|
|
|
22
3
|
1) **Client intake** → create client, capture contact + owner.
|
|
23
4
|
2) **Quote** → draft, send, accept/reject (events + notifications).
|
|
@@ -34,17 +15,7 @@ registerDocBlocks([
|
|
|
34
15
|
|
|
35
16
|
## Presentations
|
|
36
17
|
- Dashboard, client list, quote list/detail, job board, invoice list, payment list (React + Markdown targets).
|
|
37
|
-
`
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
id: "docs.examples.service-business-os.goal",
|
|
41
|
-
title: "Service Business OS — Goal",
|
|
42
|
-
summary: "Why this field-service OS exists and outcomes it targets.",
|
|
43
|
-
kind: "goal",
|
|
44
|
-
visibility: "public",
|
|
45
|
-
route: "/docs/examples/service-business-os/goal",
|
|
46
|
-
tags: ["services", "goal"],
|
|
47
|
-
body: `## Why it matters
|
|
18
|
+
`},{id:`docs.examples.service-business-os.goal`,title:`Service Business OS — Goal`,summary:`Why this field-service OS exists and outcomes it targets.`,kind:`goal`,visibility:`public`,route:`/docs/examples/service-business-os/goal`,tags:[`services`,`goal`],body:`## Why it matters
|
|
48
19
|
- Provides a regenerable, end-to-end service lifecycle (client → quote → job → invoice → payment).
|
|
49
20
|
- Keeps pricing, scheduling, invoicing, and payments consistent across surfaces.
|
|
50
21
|
|
|
@@ -54,17 +25,7 @@ registerDocBlocks([
|
|
|
54
25
|
|
|
55
26
|
## Success criteria
|
|
56
27
|
- Spec changes regenerate UI/API/events cleanly across lifecycle steps.
|
|
57
|
-
- Audit/Notifications/Jobs remain wired for every mutation.`
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
id: "docs.examples.service-business-os.usage",
|
|
61
|
-
title: "Service Business OS — Usage",
|
|
62
|
-
summary: "How to operate, extend, and regenerate the service OS safely.",
|
|
63
|
-
kind: "usage",
|
|
64
|
-
visibility: "public",
|
|
65
|
-
route: "/docs/examples/service-business-os/usage",
|
|
66
|
-
tags: ["services", "usage"],
|
|
67
|
-
body: `## Setup
|
|
28
|
+
- Audit/Notifications/Jobs remain wired for every mutation.`},{id:`docs.examples.service-business-os.usage`,title:`Service Business OS — Usage`,summary:`How to operate, extend, and regenerate the service OS safely.`,kind:`usage`,visibility:`public`,route:`/docs/examples/service-business-os/usage`,tags:[`services`,`usage`],body:`## Setup
|
|
68
29
|
1) Seed (if provided) or create client → quote → job → invoice → payment via UI.
|
|
69
30
|
2) Configure Files for attachments and Notifications for quote/job/invoice events.
|
|
70
31
|
|
|
@@ -76,21 +37,7 @@ registerDocBlocks([
|
|
|
76
37
|
## Guardrails
|
|
77
38
|
- Emit events for quote accepted/rejected, job scheduled/completed, invoice overdue, payment recorded.
|
|
78
39
|
- Keep pricing/tax rules explicit in spec; avoid implicit handler math.
|
|
79
|
-
- Use Audit Trail for lifecycle mutations; schedule reminders via Jobs.`
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
id: "docs.examples.service-business-os.constraints",
|
|
83
|
-
title: "Service Business OS — Constraints & Safety",
|
|
84
|
-
summary: "Internal guardrails for quotes/jobs/invoices/payments and regeneration safety.",
|
|
85
|
-
kind: "reference",
|
|
86
|
-
visibility: "internal",
|
|
87
|
-
route: "/docs/examples/service-business-os/constraints",
|
|
88
|
-
tags: [
|
|
89
|
-
"services",
|
|
90
|
-
"constraints",
|
|
91
|
-
"internal"
|
|
92
|
-
],
|
|
93
|
-
body: `## Constraints
|
|
40
|
+
- Use Audit Trail for lifecycle mutations; schedule reminders via Jobs.`},{id:`docs.examples.service-business-os.constraints`,title:`Service Business OS — Constraints & Safety`,summary:`Internal guardrails for quotes/jobs/invoices/payments and regeneration safety.`,kind:`reference`,visibility:`internal`,route:`/docs/examples/service-business-os/constraints`,tags:[`services`,`constraints`,`internal`],body:`## Constraints
|
|
94
41
|
- Commission/tax/payment rules must be explicit in spec; no hidden handler math.
|
|
95
42
|
- Events to emit: quote.sent/accepted/rejected, job.scheduled/completed, invoice.issued/overdue, payment.recorded.
|
|
96
43
|
- Regeneration must not alter payment semantics without reviewed spec changes.
|
|
@@ -102,8 +49,4 @@ registerDocBlocks([
|
|
|
102
49
|
## Verification
|
|
103
50
|
- Add fixtures for quote/job/invoice state transitions.
|
|
104
51
|
- Ensure Notifications/Audit/Jobs wiring persists after regeneration.
|
|
105
|
-
- Use Feature Flags to trial new payment rules/reminder cadences; default safe/off.`
|
|
106
|
-
}
|
|
107
|
-
]);
|
|
108
|
-
|
|
109
|
-
//#endregion
|
|
52
|
+
- Use Feature Flags to trial new payment rules/reminder cadences; default safe/off.`}]);
|
package/dist/entities/index.js
CHANGED
|
@@ -1,289 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../libs/schema/dist/index.js";
|
|
3
|
-
|
|
4
|
-
//#region src/entities/index.ts
|
|
5
|
-
const schema = "lssm_service_os";
|
|
6
|
-
const QuoteStatusEnum = defineEntityEnum({
|
|
7
|
-
name: "QuoteStatus",
|
|
8
|
-
schema,
|
|
9
|
-
values: [
|
|
10
|
-
"DRAFT",
|
|
11
|
-
"SENT",
|
|
12
|
-
"ACCEPTED",
|
|
13
|
-
"REJECTED",
|
|
14
|
-
"EXPIRED"
|
|
15
|
-
],
|
|
16
|
-
description: "Lifecycle for quotes/proposals."
|
|
17
|
-
});
|
|
18
|
-
const JobStatusEnum = defineEntityEnum({
|
|
19
|
-
name: "JobStatus",
|
|
20
|
-
schema,
|
|
21
|
-
values: [
|
|
22
|
-
"SCHEDULED",
|
|
23
|
-
"IN_PROGRESS",
|
|
24
|
-
"COMPLETED",
|
|
25
|
-
"CANCELLED"
|
|
26
|
-
],
|
|
27
|
-
description: "Lifecycle for service jobs/interventions."
|
|
28
|
-
});
|
|
29
|
-
const InvoiceStatusEnum = defineEntityEnum({
|
|
30
|
-
name: "InvoiceStatus",
|
|
31
|
-
schema,
|
|
32
|
-
values: [
|
|
33
|
-
"DRAFT",
|
|
34
|
-
"SENT",
|
|
35
|
-
"PAID",
|
|
36
|
-
"OVERDUE",
|
|
37
|
-
"CANCELLED"
|
|
38
|
-
],
|
|
39
|
-
description: "Lifecycle for invoices."
|
|
40
|
-
});
|
|
41
|
-
const PaymentMethodEnum = defineEntityEnum({
|
|
42
|
-
name: "PaymentMethod",
|
|
43
|
-
schema,
|
|
44
|
-
values: [
|
|
45
|
-
"CARD",
|
|
46
|
-
"BANK_TRANSFER",
|
|
47
|
-
"CASH",
|
|
48
|
-
"CHECK"
|
|
49
|
-
],
|
|
50
|
-
description: "Payment method used."
|
|
51
|
-
});
|
|
52
|
-
const ClientEntity = defineEntity({
|
|
53
|
-
name: "Client",
|
|
54
|
-
description: "Customer organization or individual.",
|
|
55
|
-
schema,
|
|
56
|
-
map: "client",
|
|
57
|
-
fields: {
|
|
58
|
-
id: field.id({ description: "Unique client identifier" }),
|
|
59
|
-
name: field.string({ description: "Client display name" }),
|
|
60
|
-
contactEmail: field.string({
|
|
61
|
-
description: "Primary contact email",
|
|
62
|
-
isOptional: true
|
|
63
|
-
}),
|
|
64
|
-
phone: field.string({
|
|
65
|
-
description: "Primary phone",
|
|
66
|
-
isOptional: true
|
|
67
|
-
}),
|
|
68
|
-
address: field.json({
|
|
69
|
-
description: "Mailing address",
|
|
70
|
-
isOptional: true
|
|
71
|
-
}),
|
|
72
|
-
industry: field.string({
|
|
73
|
-
description: "Industry/vertical",
|
|
74
|
-
isOptional: true
|
|
75
|
-
}),
|
|
76
|
-
orgId: field.string({ description: "Owning organization" }),
|
|
77
|
-
ownerId: field.string({ description: "Account owner" }),
|
|
78
|
-
metadata: field.json({
|
|
79
|
-
description: "Additional metadata",
|
|
80
|
-
isOptional: true
|
|
81
|
-
}),
|
|
82
|
-
createdAt: field.createdAt(),
|
|
83
|
-
updatedAt: field.updatedAt(),
|
|
84
|
-
quotes: field.hasMany("Quote"),
|
|
85
|
-
jobs: field.hasMany("Job")
|
|
86
|
-
},
|
|
87
|
-
indexes: [
|
|
88
|
-
index.on(["orgId"]),
|
|
89
|
-
index.on(["ownerId"]),
|
|
90
|
-
index.on(["name"])
|
|
91
|
-
]
|
|
92
|
-
});
|
|
93
|
-
const QuoteEntity = defineEntity({
|
|
94
|
-
name: "Quote",
|
|
95
|
-
description: "Proposal/quote for a job.",
|
|
96
|
-
schema,
|
|
97
|
-
map: "quote",
|
|
98
|
-
fields: {
|
|
99
|
-
id: field.id({ description: "Unique quote identifier" }),
|
|
100
|
-
clientId: field.foreignKey({ description: "Client receiving quote" }),
|
|
101
|
-
title: field.string({ description: "Quote title" }),
|
|
102
|
-
description: field.string({
|
|
103
|
-
description: "Work summary",
|
|
104
|
-
isOptional: true
|
|
105
|
-
}),
|
|
106
|
-
amount: field.float({ description: "Total quoted amount" }),
|
|
107
|
-
currency: field.string({
|
|
108
|
-
description: "Currency code",
|
|
109
|
-
default: "\"USD\""
|
|
110
|
-
}),
|
|
111
|
-
status: field.enum("QuoteStatus", {
|
|
112
|
-
description: "Quote status",
|
|
113
|
-
default: "DRAFT"
|
|
114
|
-
}),
|
|
115
|
-
validUntil: field.dateTime({
|
|
116
|
-
description: "Expiration date",
|
|
117
|
-
isOptional: true
|
|
118
|
-
}),
|
|
119
|
-
terms: field.string({
|
|
120
|
-
description: "Payment/engagement terms",
|
|
121
|
-
isOptional: true
|
|
122
|
-
}),
|
|
123
|
-
orgId: field.string({ description: "Owning organization" }),
|
|
124
|
-
ownerId: field.string({ description: "Account owner" }),
|
|
125
|
-
createdAt: field.createdAt(),
|
|
126
|
-
updatedAt: field.updatedAt(),
|
|
127
|
-
client: field.belongsTo("Client", ["clientId"], ["id"], { onDelete: "Cascade" }),
|
|
128
|
-
jobs: field.hasMany("Job")
|
|
129
|
-
},
|
|
130
|
-
enums: [QuoteStatusEnum],
|
|
131
|
-
indexes: [
|
|
132
|
-
index.on(["orgId", "status"]),
|
|
133
|
-
index.on(["clientId"]),
|
|
134
|
-
index.on(["validUntil"])
|
|
135
|
-
]
|
|
136
|
-
});
|
|
137
|
-
const JobEntity = defineEntity({
|
|
138
|
-
name: "Job",
|
|
139
|
-
description: "Service job/intervention derived from an accepted quote.",
|
|
140
|
-
schema,
|
|
141
|
-
map: "job",
|
|
142
|
-
fields: {
|
|
143
|
-
id: field.id({ description: "Unique job identifier" }),
|
|
144
|
-
quoteId: field.foreignKey({ description: "Source quote" }),
|
|
145
|
-
clientId: field.foreignKey({ description: "Client receiving service" }),
|
|
146
|
-
title: field.string({ description: "Job title" }),
|
|
147
|
-
status: field.enum("JobStatus", {
|
|
148
|
-
description: "Job status",
|
|
149
|
-
default: "SCHEDULED"
|
|
150
|
-
}),
|
|
151
|
-
scheduledAt: field.dateTime({
|
|
152
|
-
description: "Scheduled start date/time",
|
|
153
|
-
isOptional: true
|
|
154
|
-
}),
|
|
155
|
-
completedAt: field.dateTime({
|
|
156
|
-
description: "Completion timestamp",
|
|
157
|
-
isOptional: true
|
|
158
|
-
}),
|
|
159
|
-
assignedTo: field.string({
|
|
160
|
-
description: "Assignee/technician user ID",
|
|
161
|
-
isOptional: true
|
|
162
|
-
}),
|
|
163
|
-
location: field.json({
|
|
164
|
-
description: "Location details",
|
|
165
|
-
isOptional: true
|
|
166
|
-
}),
|
|
167
|
-
notes: field.string({
|
|
168
|
-
description: "Internal notes",
|
|
169
|
-
isOptional: true
|
|
170
|
-
}),
|
|
171
|
-
orgId: field.string({ description: "Owning organization" }),
|
|
172
|
-
createdAt: field.createdAt(),
|
|
173
|
-
updatedAt: field.updatedAt(),
|
|
174
|
-
quote: field.belongsTo("Quote", ["quoteId"], ["id"], { onDelete: "SetNull" }),
|
|
175
|
-
client: field.belongsTo("Client", ["clientId"], ["id"], { onDelete: "Cascade" }),
|
|
176
|
-
invoices: field.hasMany("Invoice")
|
|
177
|
-
},
|
|
178
|
-
enums: [JobStatusEnum],
|
|
179
|
-
indexes: [
|
|
180
|
-
index.on(["orgId", "status"]),
|
|
181
|
-
index.on(["clientId"]),
|
|
182
|
-
index.on(["assignedTo", "status"]),
|
|
183
|
-
index.on(["scheduledAt"])
|
|
184
|
-
]
|
|
185
|
-
});
|
|
186
|
-
const InvoiceEntity = defineEntity({
|
|
187
|
-
name: "Invoice",
|
|
188
|
-
description: "Invoice issued for a completed job.",
|
|
189
|
-
schema,
|
|
190
|
-
map: "invoice",
|
|
191
|
-
fields: {
|
|
192
|
-
id: field.id({ description: "Unique invoice identifier" }),
|
|
193
|
-
jobId: field.foreignKey({ description: "Related job" }),
|
|
194
|
-
invoiceNumber: field.string({
|
|
195
|
-
description: "Invoice number",
|
|
196
|
-
isUnique: true
|
|
197
|
-
}),
|
|
198
|
-
amount: field.decimal({ description: "Invoice amount" }),
|
|
199
|
-
currency: field.string({
|
|
200
|
-
description: "Currency code",
|
|
201
|
-
default: "\"USD\""
|
|
202
|
-
}),
|
|
203
|
-
status: field.enum("InvoiceStatus", {
|
|
204
|
-
description: "Invoice status",
|
|
205
|
-
default: "DRAFT"
|
|
206
|
-
}),
|
|
207
|
-
dueDate: field.dateTime({
|
|
208
|
-
description: "Due date",
|
|
209
|
-
isOptional: true
|
|
210
|
-
}),
|
|
211
|
-
issuedAt: field.dateTime({
|
|
212
|
-
description: "Issued timestamp",
|
|
213
|
-
isOptional: true
|
|
214
|
-
}),
|
|
215
|
-
paidAt: field.dateTime({
|
|
216
|
-
description: "Paid timestamp",
|
|
217
|
-
isOptional: true
|
|
218
|
-
}),
|
|
219
|
-
orgId: field.string({ description: "Owning organization" }),
|
|
220
|
-
notes: field.string({
|
|
221
|
-
description: "Invoice notes",
|
|
222
|
-
isOptional: true
|
|
223
|
-
}),
|
|
224
|
-
metadata: field.json({
|
|
225
|
-
description: "Metadata",
|
|
226
|
-
isOptional: true
|
|
227
|
-
}),
|
|
228
|
-
createdAt: field.createdAt(),
|
|
229
|
-
updatedAt: field.updatedAt(),
|
|
230
|
-
job: field.belongsTo("Job", ["jobId"], ["id"], { onDelete: "Cascade" }),
|
|
231
|
-
payments: field.hasMany("Payment")
|
|
232
|
-
},
|
|
233
|
-
enums: [InvoiceStatusEnum],
|
|
234
|
-
indexes: [
|
|
235
|
-
index.on(["invoiceNumber"]),
|
|
236
|
-
index.on(["orgId", "status"]),
|
|
237
|
-
index.on(["dueDate"])
|
|
238
|
-
]
|
|
239
|
-
});
|
|
240
|
-
const PaymentEntity = defineEntity({
|
|
241
|
-
name: "Payment",
|
|
242
|
-
description: "Payment received for an invoice.",
|
|
243
|
-
schema,
|
|
244
|
-
map: "payment",
|
|
245
|
-
fields: {
|
|
246
|
-
id: field.id({ description: "Unique payment identifier" }),
|
|
247
|
-
invoiceId: field.foreignKey({ description: "Invoice being paid" }),
|
|
248
|
-
amount: field.decimal({ description: "Payment amount" }),
|
|
249
|
-
currency: field.string({
|
|
250
|
-
description: "Currency code",
|
|
251
|
-
default: "\"USD\""
|
|
252
|
-
}),
|
|
253
|
-
method: field.enum("PaymentMethod", { description: "Payment method" }),
|
|
254
|
-
reference: field.string({
|
|
255
|
-
description: "Payment reference/transaction ID",
|
|
256
|
-
isOptional: true
|
|
257
|
-
}),
|
|
258
|
-
receivedAt: field.dateTime({ description: "When payment was received" }),
|
|
259
|
-
orgId: field.string({ description: "Owning organization" }),
|
|
260
|
-
createdAt: field.createdAt(),
|
|
261
|
-
invoice: field.belongsTo("Invoice", ["invoiceId"], ["id"], { onDelete: "Cascade" })
|
|
262
|
-
},
|
|
263
|
-
enums: [PaymentMethodEnum],
|
|
264
|
-
indexes: [
|
|
265
|
-
index.on(["invoiceId"]),
|
|
266
|
-
index.on(["orgId"]),
|
|
267
|
-
index.on(["receivedAt"])
|
|
268
|
-
]
|
|
269
|
-
});
|
|
270
|
-
const serviceBusinessEntities = [
|
|
271
|
-
ClientEntity,
|
|
272
|
-
QuoteEntity,
|
|
273
|
-
JobEntity,
|
|
274
|
-
InvoiceEntity,
|
|
275
|
-
PaymentEntity
|
|
276
|
-
];
|
|
277
|
-
const serviceBusinessSchemaContribution = {
|
|
278
|
-
moduleId: "@lssm/example.service-business-os",
|
|
279
|
-
entities: serviceBusinessEntities,
|
|
280
|
-
enums: [
|
|
281
|
-
QuoteStatusEnum,
|
|
282
|
-
JobStatusEnum,
|
|
283
|
-
InvoiceStatusEnum,
|
|
284
|
-
PaymentMethodEnum
|
|
285
|
-
]
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
//#endregion
|
|
289
|
-
export { ClientEntity, InvoiceEntity, InvoiceStatusEnum, JobEntity, JobStatusEnum, PaymentEntity, PaymentMethodEnum, QuoteEntity, QuoteStatusEnum, serviceBusinessEntities, serviceBusinessSchemaContribution };
|
|
1
|
+
import{defineEntity as e,defineEntityEnum as t,field as n,index as r}from"@lssm/lib.schema";const i=`lssm_service_os`,a=t({name:`QuoteStatus`,schema:i,values:[`DRAFT`,`SENT`,`ACCEPTED`,`REJECTED`,`EXPIRED`],description:`Lifecycle for quotes/proposals.`}),o=t({name:`JobStatus`,schema:i,values:[`SCHEDULED`,`IN_PROGRESS`,`COMPLETED`,`CANCELLED`],description:`Lifecycle for service jobs/interventions.`}),s=t({name:`InvoiceStatus`,schema:i,values:[`DRAFT`,`SENT`,`PAID`,`OVERDUE`,`CANCELLED`],description:`Lifecycle for invoices.`}),c=t({name:`PaymentMethod`,schema:i,values:[`CARD`,`BANK_TRANSFER`,`CASH`,`CHECK`],description:`Payment method used.`}),l=e({name:`Client`,description:`Customer organization or individual.`,schema:i,map:`client`,fields:{id:n.id({description:`Unique client identifier`}),name:n.string({description:`Client display name`}),contactEmail:n.string({description:`Primary contact email`,isOptional:!0}),phone:n.string({description:`Primary phone`,isOptional:!0}),address:n.json({description:`Mailing address`,isOptional:!0}),industry:n.string({description:`Industry/vertical`,isOptional:!0}),orgId:n.string({description:`Owning organization`}),ownerId:n.string({description:`Account owner`}),metadata:n.json({description:`Additional metadata`,isOptional:!0}),createdAt:n.createdAt(),updatedAt:n.updatedAt(),quotes:n.hasMany(`Quote`),jobs:n.hasMany(`Job`)},indexes:[r.on([`orgId`]),r.on([`ownerId`]),r.on([`name`])]}),u=e({name:`Quote`,description:`Proposal/quote for a job.`,schema:i,map:`quote`,fields:{id:n.id({description:`Unique quote identifier`}),clientId:n.foreignKey({description:`Client receiving quote`}),title:n.string({description:`Quote title`}),description:n.string({description:`Work summary`,isOptional:!0}),amount:n.float({description:`Total quoted amount`}),currency:n.string({description:`Currency code`,default:`"USD"`}),status:n.enum(`QuoteStatus`,{description:`Quote status`,default:`DRAFT`}),validUntil:n.dateTime({description:`Expiration date`,isOptional:!0}),terms:n.string({description:`Payment/engagement terms`,isOptional:!0}),orgId:n.string({description:`Owning organization`}),ownerId:n.string({description:`Account owner`}),createdAt:n.createdAt(),updatedAt:n.updatedAt(),client:n.belongsTo(`Client`,[`clientId`],[`id`],{onDelete:`Cascade`}),jobs:n.hasMany(`Job`)},enums:[a],indexes:[r.on([`orgId`,`status`]),r.on([`clientId`]),r.on([`validUntil`])]}),d=e({name:`Job`,description:`Service job/intervention derived from an accepted quote.`,schema:i,map:`job`,fields:{id:n.id({description:`Unique job identifier`}),quoteId:n.foreignKey({description:`Source quote`}),clientId:n.foreignKey({description:`Client receiving service`}),title:n.string({description:`Job title`}),status:n.enum(`JobStatus`,{description:`Job status`,default:`SCHEDULED`}),scheduledAt:n.dateTime({description:`Scheduled start date/time`,isOptional:!0}),completedAt:n.dateTime({description:`Completion timestamp`,isOptional:!0}),assignedTo:n.string({description:`Assignee/technician user ID`,isOptional:!0}),location:n.json({description:`Location details`,isOptional:!0}),notes:n.string({description:`Internal notes`,isOptional:!0}),orgId:n.string({description:`Owning organization`}),createdAt:n.createdAt(),updatedAt:n.updatedAt(),quote:n.belongsTo(`Quote`,[`quoteId`],[`id`],{onDelete:`SetNull`}),client:n.belongsTo(`Client`,[`clientId`],[`id`],{onDelete:`Cascade`}),invoices:n.hasMany(`Invoice`)},enums:[o],indexes:[r.on([`orgId`,`status`]),r.on([`clientId`]),r.on([`assignedTo`,`status`]),r.on([`scheduledAt`])]}),f=e({name:`Invoice`,description:`Invoice issued for a completed job.`,schema:i,map:`invoice`,fields:{id:n.id({description:`Unique invoice identifier`}),jobId:n.foreignKey({description:`Related job`}),invoiceNumber:n.string({description:`Invoice number`,isUnique:!0}),amount:n.decimal({description:`Invoice amount`}),currency:n.string({description:`Currency code`,default:`"USD"`}),status:n.enum(`InvoiceStatus`,{description:`Invoice status`,default:`DRAFT`}),dueDate:n.dateTime({description:`Due date`,isOptional:!0}),issuedAt:n.dateTime({description:`Issued timestamp`,isOptional:!0}),paidAt:n.dateTime({description:`Paid timestamp`,isOptional:!0}),orgId:n.string({description:`Owning organization`}),notes:n.string({description:`Invoice notes`,isOptional:!0}),metadata:n.json({description:`Metadata`,isOptional:!0}),createdAt:n.createdAt(),updatedAt:n.updatedAt(),job:n.belongsTo(`Job`,[`jobId`],[`id`],{onDelete:`Cascade`}),payments:n.hasMany(`Payment`)},enums:[s],indexes:[r.on([`invoiceNumber`]),r.on([`orgId`,`status`]),r.on([`dueDate`])]}),p=e({name:`Payment`,description:`Payment received for an invoice.`,schema:i,map:`payment`,fields:{id:n.id({description:`Unique payment identifier`}),invoiceId:n.foreignKey({description:`Invoice being paid`}),amount:n.decimal({description:`Payment amount`}),currency:n.string({description:`Currency code`,default:`"USD"`}),method:n.enum(`PaymentMethod`,{description:`Payment method`}),reference:n.string({description:`Payment reference/transaction ID`,isOptional:!0}),receivedAt:n.dateTime({description:`When payment was received`}),orgId:n.string({description:`Owning organization`}),createdAt:n.createdAt(),invoice:n.belongsTo(`Invoice`,[`invoiceId`],[`id`],{onDelete:`Cascade`})},enums:[c],indexes:[r.on([`invoiceId`]),r.on([`orgId`]),r.on([`receivedAt`])]}),m=[l,u,d,f,p],h={moduleId:`@lssm/example.service-business-os`,entities:m,enums:[a,o,s,c]};export{l as ClientEntity,f as InvoiceEntity,s as InvoiceStatusEnum,d as JobEntity,o as JobStatusEnum,p as PaymentEntity,c as PaymentMethodEnum,u as QuoteEntity,a as QuoteStatusEnum,m as serviceBusinessEntities,h as serviceBusinessSchemaContribution};
|