@xnetjs/data 0.0.2 → 0.0.3
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/README.md +112 -0
- package/dist/account-BZHETMC4.js +12 -0
- package/dist/auth/index.d.ts +413 -0
- package/dist/auth/index.js +102 -0
- package/dist/budget-WR2Q4YH3.js +12 -0
- package/dist/canvas-HFMMVQLD.js +10 -0
- package/dist/channel-DXDYJ3ZH.js +12 -0
- package/dist/chat-message-QUUQGXEW.js +10 -0
- package/dist/chunk-2DSDH2ZH.js +52 -0
- package/dist/chunk-337E3ZOB.js +54 -0
- package/dist/chunk-37267RSF.js +41 -0
- package/dist/chunk-3JKW6TDE.js +66 -0
- package/dist/chunk-3RB2FMMO.js +148 -0
- package/dist/{chunk-BQBPA5HS.js → chunk-4U4KBCDN.js} +16 -2
- package/dist/chunk-4UQTURCD.js +722 -0
- package/dist/chunk-54Y7QRZN.js +109 -0
- package/dist/chunk-5FHJE7RC.js +46 -0
- package/dist/chunk-64AM6JPM.js +40 -0
- package/dist/chunk-6CN53PON.js +143 -0
- package/dist/chunk-6GB7PBCR.js +40 -0
- package/dist/chunk-6OPZJ7MG.js +78 -0
- package/dist/{chunk-IDMBCRUC.js → chunk-77UDLVQY.js} +1 -1
- package/dist/chunk-7GMJOAPF.js +52 -0
- package/dist/chunk-7PDRDSFH.js +69 -0
- package/dist/chunk-C5IRSEEZ.js +69 -0
- package/dist/chunk-CHZUSBSB.js +45 -0
- package/dist/chunk-DOZJXPQ6.js +232 -0
- package/dist/chunk-DTPSTMUD.js +105 -0
- package/dist/chunk-E6S557NC.js +402 -0
- package/dist/chunk-EIQX7INF.js +45 -0
- package/dist/chunk-ENTHVNOC.js +57 -0
- package/dist/chunk-EZA5UT4Y.js +5543 -0
- package/dist/chunk-GR3NDMBY.js +76 -0
- package/dist/chunk-GWYVY2K4.js +63 -0
- package/dist/chunk-IJ675GJR.js +42 -0
- package/dist/chunk-IP4BEVVD.js +57 -0
- package/dist/chunk-J4IVJA5M.js +102 -0
- package/dist/chunk-J6EDPPH4.js +84 -0
- package/dist/{chunk-SZC345Z2.js → chunk-JESSJ5CZ.js} +1015 -1110
- package/dist/chunk-JO6Y4E5V.js +73 -0
- package/dist/chunk-KPVBKKZS.js +47 -0
- package/dist/chunk-KTJLFJEQ.js +43 -0
- package/dist/chunk-L66WXPTW.js +32 -0
- package/dist/chunk-LGD72FVD.js +48 -0
- package/dist/chunk-O64EK5FK.js +887 -0
- package/dist/chunk-PMUQACPY.js +33 -0
- package/dist/chunk-PSUJEKVV.js +1722 -0
- package/dist/chunk-QVZXXJSP.js +6122 -0
- package/dist/chunk-QWFTRZQT.js +142 -0
- package/dist/chunk-RSSZXCLL.js +51 -0
- package/dist/chunk-S4B5OPZU.js +415 -0
- package/dist/{chunk-VYR5GPJP.js → chunk-SPFKSTPT.js} +9 -3
- package/dist/chunk-U6CBYDVZ.js +50 -0
- package/dist/chunk-UDUPQKRB.js +49 -0
- package/dist/chunk-V6HZ3LF3.js +380 -0
- package/dist/chunk-WMSCEBFH.js +64 -0
- package/dist/chunk-WUR3WWQM.js +65 -0
- package/dist/chunk-XHEA5UER.js +75 -0
- package/dist/chunk-XTUGZSYQ.js +75 -0
- package/dist/chunk-XWA3CJQ6.js +45 -0
- package/dist/chunk-YEQ6LLUY.js +49 -0
- package/dist/chunk-YWN27MLD.js +47 -0
- package/dist/chunk-YXZGYLKV.js +65 -0
- package/dist/chunk-ZICIXDEE.js +54 -0
- package/dist/chunk-ZMCO3O2Z.js +70 -0
- package/dist/clone-DpbVKLUu.d.ts +2205 -0
- package/dist/comment-Y2Y3QYYI.js +10 -0
- package/dist/crm-AAJXYIJY.js +68 -0
- package/dist/dashboard-3DC6B4BJ.js +10 -0
- package/dist/database/index.d.ts +882 -0
- package/dist/database/index.js +523 -0
- package/dist/database-DRGL5UYS.js +10 -0
- package/dist/database-field-F47FY3XX.js +10 -0
- package/dist/database-row-77OXW2NF.js +10 -0
- package/dist/database-select-option-6S3TTA7A.js +10 -0
- package/dist/database-view-YW7DQG5X.js +10 -0
- package/dist/experiment-TJOAL3OH.js +10 -0
- package/dist/external-item-D654PKLI.js +14 -0
- package/dist/external-reference-K5SUJIQN.js +8 -0
- package/dist/feed-L23XTNDI.js +12 -0
- package/dist/feed-item-GSO242J6.js +12 -0
- package/dist/folder-ONKSWHUT.js +21 -0
- package/dist/game-BF7DP5JU.js +50 -0
- package/dist/grant-NNKMWXPX.js +8 -0
- package/dist/grant-expiration-cleaner-DBiNTWbD.d.ts +249 -0
- package/dist/import-batch-JMESZ4VI.js +12 -0
- package/dist/inbox-state-AN6FPCIY.js +12 -0
- package/dist/index.d.ts +224 -4548
- package/dist/index.js +2206 -4754
- package/dist/map-AUV65YS3.js +10 -0
- package/dist/media-asset-4I5YPR4R.js +8 -0
- package/dist/memory-NV6EVJBE.js +12 -0
- package/dist/metric-X7W55DLC.js +10 -0
- package/dist/milestone-JJGOGK4R.js +12 -0
- package/dist/moderation-QSUVBCNS.js +30 -0
- package/dist/observation-UZSXXGBC.js +10 -0
- package/dist/page-NI7XODS6.js +10 -0
- package/dist/posting-FZOYVGH2.js +12 -0
- package/dist/profile-42A43GES.js +8 -0
- package/dist/project-G2CTLDXY.js +10 -0
- package/dist/query-ast-CWo6_30h.d.ts +226 -0
- package/dist/reaction-VAQBVDUD.js +10 -0
- package/dist/registry-CQoN_p8U.d.ts +99 -0
- package/dist/saved-view-AOQHGHNM.js +10 -0
- package/dist/schema/index.d.ts +6182 -0
- package/dist/schema/index.js +631 -0
- package/dist/schema-extension-5BUXRDPB.js +18 -0
- package/dist/space-PZ737CIS.js +42 -0
- package/dist/space-membership-N35NRX6F.js +14 -0
- package/dist/store/index.d.ts +391 -0
- package/dist/store/index.js +135 -0
- package/dist/store-CvgiydME.d.ts +338 -0
- package/dist/sync/awareness.d.ts +69 -0
- package/dist/sync/awareness.js +20 -0
- package/dist/system-Q5I6STDC.js +38 -0
- package/dist/tag-C677GKQW.js +16 -0
- package/dist/task-WQLMPN5U.js +16 -0
- package/dist/task-view-T5S32V4L.js +10 -0
- package/dist/transaction-U3ITRGJP.js +12 -0
- package/dist/transcription-F3T23LLO.js +12 -0
- package/dist/types-Def-5Nka.d.ts +1525 -0
- package/dist/updates.d.ts +44 -0
- package/dist/updates.js +16 -0
- package/dist/user-widget-4SJJFPG5.js +8 -0
- package/dist/view-types-DSde-uT_.d.ts +316 -0
- package/package.json +32 -9
- package/dist/canvas-HSIKIQFK.js +0 -7
- package/dist/chunk-2L5ZUGG5.js +0 -53
- package/dist/chunk-4MTS5KAQ.js +0 -22
- package/dist/chunk-GZHARFKC.js +0 -25
- package/dist/chunk-WKIKJTI2.js +0 -45
- package/dist/comment-277JD7DV.js +0 -7
- package/dist/database-W3KEHLI3.js +0 -7
- package/dist/database-row-3O2QSNZN.js +0 -7
- package/dist/grant-QVZ454YC.js +0 -7
- package/dist/page-O4WTOIEO.js +0 -7
- package/dist/task-SEKAYJH7.js +0 -7
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import {
|
|
2
|
+
spaceCascadeAuthorization
|
|
3
|
+
} from "./chunk-6OPZJ7MG.js";
|
|
4
|
+
import {
|
|
5
|
+
checkbox,
|
|
6
|
+
date,
|
|
7
|
+
defineSchema,
|
|
8
|
+
email,
|
|
9
|
+
number,
|
|
10
|
+
person,
|
|
11
|
+
phone,
|
|
12
|
+
relation,
|
|
13
|
+
select,
|
|
14
|
+
text,
|
|
15
|
+
url
|
|
16
|
+
} from "./chunk-O64EK5FK.js";
|
|
17
|
+
|
|
18
|
+
// src/schema/schemas/crm.ts
|
|
19
|
+
var CRM_NAMESPACE = "xnet://xnet.fyi/";
|
|
20
|
+
var ORGANIZATION_SCHEMA_IRI = "xnet://xnet.fyi/Organization@1.0.0";
|
|
21
|
+
var CONTACT_SCHEMA_IRI = "xnet://xnet.fyi/Contact@1.0.0";
|
|
22
|
+
var RELATIONSHIP_SCHEMA_IRI = "xnet://xnet.fyi/Relationship@1.0.0";
|
|
23
|
+
var PIPELINE_SCHEMA_IRI = "xnet://xnet.fyi/Pipeline@1.0.0";
|
|
24
|
+
var STAGE_SCHEMA_IRI = "xnet://xnet.fyi/Stage@1.0.0";
|
|
25
|
+
var DEAL_SCHEMA_IRI = "xnet://xnet.fyi/Deal@1.0.0";
|
|
26
|
+
var DEAL_CONTACT_ROLE_SCHEMA_IRI = "xnet://xnet.fyi/DealContactRole@1.0.0";
|
|
27
|
+
var ACTIVITY_SCHEMA_IRI = "xnet://xnet.fyi/Activity@1.0.0";
|
|
28
|
+
var PRODUCT_SCHEMA_IRI = "xnet://xnet.fyi/Product@1.0.0";
|
|
29
|
+
var LINE_ITEM_SCHEMA_IRI = "xnet://xnet.fyi/LineItem@1.0.0";
|
|
30
|
+
var SPACE_TARGET = "xnet://xnet.fyi/Space@1.0.0";
|
|
31
|
+
var TAG_TARGET = "xnet://xnet.fyi/Tag@1.0.0";
|
|
32
|
+
var FOLDER_TARGET = "xnet://xnet.fyi/Folder@1.0.0";
|
|
33
|
+
var TRANSACTION_TARGET = "xnet://xnet.fyi/Transaction@1.0.0";
|
|
34
|
+
var SOCIAL_ACTOR_TARGET = "xnet://xnet.social/SocialActor@1.0.0";
|
|
35
|
+
var VISIBILITY_OPTIONS = [
|
|
36
|
+
{ id: "inherit", name: "Inherit", color: "gray" },
|
|
37
|
+
{ id: "private", name: "Private", color: "gray" },
|
|
38
|
+
{ id: "unlisted", name: "Unlisted", color: "yellow" },
|
|
39
|
+
{ id: "public", name: "Public", color: "green" }
|
|
40
|
+
];
|
|
41
|
+
var visibility = () => select({ options: VISIBILITY_OPTIONS, default: "inherit" });
|
|
42
|
+
var space = () => relation({ target: SPACE_TARGET });
|
|
43
|
+
var folder = () => relation({ target: FOLDER_TARGET });
|
|
44
|
+
var ORGANIZATION_SIZES = [
|
|
45
|
+
{ id: "solo", name: "1" },
|
|
46
|
+
{ id: "small", name: "2\u201310" },
|
|
47
|
+
{ id: "medium", name: "11\u201350" },
|
|
48
|
+
{ id: "large", name: "51\u2013250" },
|
|
49
|
+
{ id: "xlarge", name: "251\u20131000" },
|
|
50
|
+
{ id: "enterprise", name: "1000+" }
|
|
51
|
+
];
|
|
52
|
+
var OrganizationSchema = defineSchema({
|
|
53
|
+
name: "Organization",
|
|
54
|
+
namespace: CRM_NAMESPACE,
|
|
55
|
+
properties: {
|
|
56
|
+
/** Company / account name. */
|
|
57
|
+
name: text({ required: true, maxLength: 300 }),
|
|
58
|
+
/** Primary email domain (the natural dedup key for B2B). */
|
|
59
|
+
domain: text({ maxLength: 255 }),
|
|
60
|
+
website: url({}),
|
|
61
|
+
industry: text({ maxLength: 120 }),
|
|
62
|
+
size: select({ options: ORGANIZATION_SIZES }),
|
|
63
|
+
/** Annual revenue, in `currency`. */
|
|
64
|
+
annualRevenue: number({ min: 0 }),
|
|
65
|
+
currency: text({ maxLength: 3 }),
|
|
66
|
+
phone: phone({}),
|
|
67
|
+
street: text({ maxLength: 300 }),
|
|
68
|
+
city: text({ maxLength: 120 }),
|
|
69
|
+
region: text({ maxLength: 120 }),
|
|
70
|
+
postalCode: text({ maxLength: 40 }),
|
|
71
|
+
country: text({ maxLength: 120 }),
|
|
72
|
+
/** Parent company — self-reference for account hierarchies. */
|
|
73
|
+
parent: relation({ target: ORGANIZATION_SCHEMA_IRI }),
|
|
74
|
+
/** Account owner (the rep). */
|
|
75
|
+
owner: person({}),
|
|
76
|
+
/** Optional link to an imported `@xnetjs/social` actor (org kind). */
|
|
77
|
+
actor: relation({ target: SOCIAL_ACTOR_TARGET }),
|
|
78
|
+
tags: relation({ target: TAG_TARGET, multiple: true }),
|
|
79
|
+
/** Erasure-by-design: set when PII is anonymized (GDPR Art. 17). */
|
|
80
|
+
piiErasedAt: date({}),
|
|
81
|
+
folder: folder(),
|
|
82
|
+
space: space(),
|
|
83
|
+
visibility: visibility()
|
|
84
|
+
},
|
|
85
|
+
document: "yjs",
|
|
86
|
+
// Collaborative account notes
|
|
87
|
+
authorization: spaceCascadeAuthorization()
|
|
88
|
+
});
|
|
89
|
+
var CONTACT_LIFECYCLE = [
|
|
90
|
+
{ id: "subscriber", name: "Subscriber", color: "gray" },
|
|
91
|
+
{ id: "lead", name: "Lead", color: "yellow" },
|
|
92
|
+
{ id: "mql", name: "Marketing Qualified", color: "blue" },
|
|
93
|
+
{ id: "sql", name: "Sales Qualified", color: "purple" },
|
|
94
|
+
{ id: "opportunity", name: "Opportunity", color: "orange" },
|
|
95
|
+
{ id: "customer", name: "Customer", color: "green" },
|
|
96
|
+
{ id: "evangelist", name: "Evangelist", color: "green" },
|
|
97
|
+
{ id: "churned", name: "Churned", color: "red" }
|
|
98
|
+
];
|
|
99
|
+
var ContactSchema = defineSchema({
|
|
100
|
+
name: "Contact",
|
|
101
|
+
namespace: CRM_NAMESPACE,
|
|
102
|
+
properties: {
|
|
103
|
+
/** Display name — the one always-required field. */
|
|
104
|
+
displayName: text({ required: true, maxLength: 200 }),
|
|
105
|
+
firstName: text({ maxLength: 100 }),
|
|
106
|
+
lastName: text({ maxLength: 100 }),
|
|
107
|
+
/** Primary email (the natural dedup key for people). */
|
|
108
|
+
email: email({}),
|
|
109
|
+
/** Primary phone. */
|
|
110
|
+
phone: phone({}),
|
|
111
|
+
title: text({ maxLength: 200 }),
|
|
112
|
+
/** Employer / account. */
|
|
113
|
+
org: relation({ target: ORGANIZATION_SCHEMA_IRI }),
|
|
114
|
+
/** The rep who owns this relationship. */
|
|
115
|
+
owner: person({}),
|
|
116
|
+
/**
|
|
117
|
+
* OPTIONAL: the contact's *own* xNet identity (a DID). When set, the
|
|
118
|
+
* contact can control their own half of the record — the user-owned,
|
|
119
|
+
* bilateral-consent differentiator (exploration 0188).
|
|
120
|
+
*/
|
|
121
|
+
did: person({}),
|
|
122
|
+
/** Optional link to a `@xnetjs/social` actor for import/dedup. */
|
|
123
|
+
actor: relation({ target: SOCIAL_ACTOR_TARGET }),
|
|
124
|
+
lifecycle: select({ options: CONTACT_LIFECYCLE, default: "lead" }),
|
|
125
|
+
/** When this contact was last interacted with (drives keep-in-touch). */
|
|
126
|
+
lastTouchAt: date({}),
|
|
127
|
+
/** Next time to reach out — derived from `lastTouchAt` + `touchEveryDays`. */
|
|
128
|
+
nextTouchAt: date({}),
|
|
129
|
+
/** Keep-in-touch cadence, in days (0/empty = no cadence). */
|
|
130
|
+
touchEveryDays: number({ integer: true, min: 0 }),
|
|
131
|
+
/** Personal-CRM context: how the relationship started. */
|
|
132
|
+
howWeMet: text({ maxLength: 2e3 }),
|
|
133
|
+
/** The contact who introduced you (the introducer edge). */
|
|
134
|
+
introducedBy: relation({ target: CONTACT_SCHEMA_IRI }),
|
|
135
|
+
tags: relation({ target: TAG_TARGET, multiple: true }),
|
|
136
|
+
piiErasedAt: date({}),
|
|
137
|
+
folder: folder(),
|
|
138
|
+
space: space(),
|
|
139
|
+
visibility: visibility()
|
|
140
|
+
},
|
|
141
|
+
document: "yjs",
|
|
142
|
+
// Running notes / journal on the person
|
|
143
|
+
authorization: spaceCascadeAuthorization()
|
|
144
|
+
});
|
|
145
|
+
var RELATIONSHIP_KINDS = [
|
|
146
|
+
{ id: "spouse", name: "Spouse" },
|
|
147
|
+
{ id: "partner", name: "Partner" },
|
|
148
|
+
{ id: "parent", name: "Parent" },
|
|
149
|
+
{ id: "child", name: "Child" },
|
|
150
|
+
{ id: "sibling", name: "Sibling" },
|
|
151
|
+
{ id: "friend", name: "Friend" },
|
|
152
|
+
{ id: "colleague", name: "Colleague" },
|
|
153
|
+
{ id: "manager", name: "Manager" },
|
|
154
|
+
{ id: "reports-to", name: "Reports to" },
|
|
155
|
+
{ id: "introduced-by", name: "Introduced by" },
|
|
156
|
+
{ id: "knows", name: "Knows" }
|
|
157
|
+
];
|
|
158
|
+
var RelationshipSchema = defineSchema({
|
|
159
|
+
name: "Relationship",
|
|
160
|
+
namespace: CRM_NAMESPACE,
|
|
161
|
+
properties: {
|
|
162
|
+
from: relation({ target: CONTACT_SCHEMA_IRI, required: true }),
|
|
163
|
+
to: relation({ target: CONTACT_SCHEMA_IRI, required: true }),
|
|
164
|
+
kind: select({ options: RELATIONSHIP_KINDS, default: "knows" }),
|
|
165
|
+
note: text({ maxLength: 1e3 }),
|
|
166
|
+
space: space(),
|
|
167
|
+
visibility: visibility()
|
|
168
|
+
},
|
|
169
|
+
authorization: spaceCascadeAuthorization()
|
|
170
|
+
});
|
|
171
|
+
var PipelineSchema = defineSchema({
|
|
172
|
+
name: "Pipeline",
|
|
173
|
+
namespace: CRM_NAMESPACE,
|
|
174
|
+
properties: {
|
|
175
|
+
name: text({ required: true, maxLength: 200 }),
|
|
176
|
+
description: text({ maxLength: 1e3 }),
|
|
177
|
+
sortKey: text({ maxLength: 500 }),
|
|
178
|
+
/** Exactly one pipeline should be the default for new deals. */
|
|
179
|
+
isDefault: checkbox({ default: false }),
|
|
180
|
+
space: space(),
|
|
181
|
+
visibility: visibility()
|
|
182
|
+
},
|
|
183
|
+
authorization: spaceCascadeAuthorization()
|
|
184
|
+
});
|
|
185
|
+
var StageSchema = defineSchema({
|
|
186
|
+
name: "Stage",
|
|
187
|
+
namespace: CRM_NAMESPACE,
|
|
188
|
+
properties: {
|
|
189
|
+
name: text({ required: true, maxLength: 120 }),
|
|
190
|
+
pipeline: relation({ target: PIPELINE_SCHEMA_IRI, required: true }),
|
|
191
|
+
/** Column order within the pipeline. */
|
|
192
|
+
sortKey: text({ maxLength: 500 }),
|
|
193
|
+
/** Default win probability for deals in this stage, 0–1. */
|
|
194
|
+
probability: number({ min: 0, max: 1 }),
|
|
195
|
+
/** Terminal flags — `isClosed` + `isWon` is the standard termination pair. */
|
|
196
|
+
isClosed: checkbox({ default: false }),
|
|
197
|
+
isWon: checkbox({ default: false }),
|
|
198
|
+
color: text({ maxLength: 32 }),
|
|
199
|
+
space: space(),
|
|
200
|
+
visibility: visibility()
|
|
201
|
+
},
|
|
202
|
+
authorization: spaceCascadeAuthorization()
|
|
203
|
+
});
|
|
204
|
+
var FORECAST_CATEGORIES = [
|
|
205
|
+
{ id: "pipeline", name: "Pipeline", color: "gray" },
|
|
206
|
+
{ id: "best-case", name: "Best Case", color: "blue" },
|
|
207
|
+
{ id: "commit", name: "Commit", color: "green" },
|
|
208
|
+
{ id: "closed", name: "Closed", color: "purple" }
|
|
209
|
+
];
|
|
210
|
+
var DEAL_SOURCES = [
|
|
211
|
+
{ id: "inbound", name: "Inbound" },
|
|
212
|
+
{ id: "outbound", name: "Outbound" },
|
|
213
|
+
{ id: "referral", name: "Referral" },
|
|
214
|
+
{ id: "partner", name: "Partner" },
|
|
215
|
+
{ id: "event", name: "Event" },
|
|
216
|
+
{ id: "other", name: "Other" }
|
|
217
|
+
];
|
|
218
|
+
var DealSchema = defineSchema({
|
|
219
|
+
name: "Deal",
|
|
220
|
+
namespace: CRM_NAMESPACE,
|
|
221
|
+
properties: {
|
|
222
|
+
title: text({ required: true, maxLength: 300 }),
|
|
223
|
+
/** Account (company) the deal is with. */
|
|
224
|
+
org: relation({ target: ORGANIZATION_SCHEMA_IRI }),
|
|
225
|
+
/** Primary contact (full stakeholder set lives in DealContactRole). */
|
|
226
|
+
primaryContact: relation({ target: CONTACT_SCHEMA_IRI }),
|
|
227
|
+
pipeline: relation({ target: PIPELINE_SCHEMA_IRI }),
|
|
228
|
+
stage: relation({ target: STAGE_SCHEMA_IRI }),
|
|
229
|
+
amount: number({ min: 0 }),
|
|
230
|
+
currency: text({ maxLength: 3 }),
|
|
231
|
+
/** Optional override of the stage's default probability, 0–1. */
|
|
232
|
+
probability: number({ min: 0, max: 1 }),
|
|
233
|
+
closeDate: date({}),
|
|
234
|
+
forecastCategory: select({ options: FORECAST_CATEGORIES, default: "pipeline" }),
|
|
235
|
+
source: select({ options: DEAL_SOURCES }),
|
|
236
|
+
owner: person({}),
|
|
237
|
+
collaborators: person({ multiple: true }),
|
|
238
|
+
wonAt: date({}),
|
|
239
|
+
lostAt: date({}),
|
|
240
|
+
lostReason: text({ maxLength: 500 }),
|
|
241
|
+
/**
|
|
242
|
+
* Ledger transactions that realize this deal's revenue (quote-to-cash
|
|
243
|
+
* bridge, exploration 0190). A won deal can link the booked income so
|
|
244
|
+
* pipeline and books reconcile.
|
|
245
|
+
*/
|
|
246
|
+
transactions: relation({ target: TRANSACTION_TARGET, multiple: true }),
|
|
247
|
+
tags: relation({ target: TAG_TARGET, multiple: true }),
|
|
248
|
+
folder: folder(),
|
|
249
|
+
space: space(),
|
|
250
|
+
visibility: visibility()
|
|
251
|
+
},
|
|
252
|
+
document: "yjs",
|
|
253
|
+
// Deal notes
|
|
254
|
+
authorization: spaceCascadeAuthorization()
|
|
255
|
+
});
|
|
256
|
+
var DEAL_CONTACT_ROLES = [
|
|
257
|
+
{ id: "decision-maker", name: "Decision Maker" },
|
|
258
|
+
{ id: "economic-buyer", name: "Economic Buyer" },
|
|
259
|
+
{ id: "champion", name: "Champion" },
|
|
260
|
+
{ id: "influencer", name: "Influencer" },
|
|
261
|
+
{ id: "technical-buyer", name: "Technical Buyer" },
|
|
262
|
+
{ id: "user", name: "User" },
|
|
263
|
+
{ id: "evaluator", name: "Evaluator" },
|
|
264
|
+
{ id: "other", name: "Other" }
|
|
265
|
+
];
|
|
266
|
+
var DealContactRoleSchema = defineSchema({
|
|
267
|
+
name: "DealContactRole",
|
|
268
|
+
namespace: CRM_NAMESPACE,
|
|
269
|
+
properties: {
|
|
270
|
+
deal: relation({ target: DEAL_SCHEMA_IRI, required: true }),
|
|
271
|
+
contact: relation({ target: CONTACT_SCHEMA_IRI, required: true }),
|
|
272
|
+
role: select({ options: DEAL_CONTACT_ROLES, default: "other" }),
|
|
273
|
+
isPrimary: checkbox({ default: false }),
|
|
274
|
+
space: space(),
|
|
275
|
+
visibility: visibility()
|
|
276
|
+
},
|
|
277
|
+
authorization: spaceCascadeAuthorization()
|
|
278
|
+
});
|
|
279
|
+
var ACTIVITY_KINDS = [
|
|
280
|
+
{ id: "note", name: "Note" },
|
|
281
|
+
{ id: "call", name: "Call" },
|
|
282
|
+
{ id: "email", name: "Email" },
|
|
283
|
+
{ id: "meeting", name: "Meeting" },
|
|
284
|
+
{ id: "task", name: "Task" }
|
|
285
|
+
];
|
|
286
|
+
var ActivitySchema = defineSchema({
|
|
287
|
+
name: "Activity",
|
|
288
|
+
namespace: CRM_NAMESPACE,
|
|
289
|
+
properties: {
|
|
290
|
+
kind: select({ options: ACTIVITY_KINDS, default: "note" }),
|
|
291
|
+
/** The *who* — Salesforce `WhoId`. */
|
|
292
|
+
contact: relation({ target: CONTACT_SCHEMA_IRI }),
|
|
293
|
+
/** The *what* — Salesforce `WhatId`. Untyped relation so it can point at a
|
|
294
|
+
* Deal, Organization, or Contact (polymorphic). */
|
|
295
|
+
about: relation({}),
|
|
296
|
+
/** One-line summary shown in the timeline. */
|
|
297
|
+
summary: text({ maxLength: 500 }),
|
|
298
|
+
/** Full body — kept separate from the contact FK so erasure can null PII
|
|
299
|
+
* while preserving the activity's existence for audit/aggregates. */
|
|
300
|
+
body: text({ maxLength: 2e4 }),
|
|
301
|
+
direction: select({
|
|
302
|
+
options: [
|
|
303
|
+
{ id: "inbound", name: "Inbound" },
|
|
304
|
+
{ id: "outbound", name: "Outbound" }
|
|
305
|
+
]
|
|
306
|
+
}),
|
|
307
|
+
occurredAt: date({ includeTime: true }),
|
|
308
|
+
durationSec: number({ integer: true, min: 0 }),
|
|
309
|
+
outcome: text({ maxLength: 300 }),
|
|
310
|
+
/** For task-kind activities: future due date + completion. */
|
|
311
|
+
dueAt: date({}),
|
|
312
|
+
completed: checkbox({ default: false }),
|
|
313
|
+
owner: person({}),
|
|
314
|
+
space: space(),
|
|
315
|
+
visibility: visibility()
|
|
316
|
+
},
|
|
317
|
+
authorization: spaceCascadeAuthorization()
|
|
318
|
+
});
|
|
319
|
+
var PRODUCT_KINDS = [
|
|
320
|
+
{ id: "good", name: "Good" },
|
|
321
|
+
{ id: "service", name: "Service" },
|
|
322
|
+
{ id: "subscription", name: "Subscription" }
|
|
323
|
+
];
|
|
324
|
+
var ProductSchema = defineSchema({
|
|
325
|
+
name: "Product",
|
|
326
|
+
namespace: CRM_NAMESPACE,
|
|
327
|
+
properties: {
|
|
328
|
+
name: text({ required: true, maxLength: 300 }),
|
|
329
|
+
/** Stock-keeping unit / product code. */
|
|
330
|
+
sku: text({ maxLength: 120 }),
|
|
331
|
+
description: text({ maxLength: 2e3 }),
|
|
332
|
+
kind: select({ options: PRODUCT_KINDS, default: "service" }),
|
|
333
|
+
unitPrice: number({ min: 0 }),
|
|
334
|
+
currency: text({ maxLength: 3 }),
|
|
335
|
+
active: checkbox({ default: true }),
|
|
336
|
+
space: space(),
|
|
337
|
+
visibility: visibility()
|
|
338
|
+
},
|
|
339
|
+
authorization: spaceCascadeAuthorization()
|
|
340
|
+
});
|
|
341
|
+
var LineItemSchema = defineSchema({
|
|
342
|
+
name: "LineItem",
|
|
343
|
+
namespace: CRM_NAMESPACE,
|
|
344
|
+
properties: {
|
|
345
|
+
deal: relation({ target: DEAL_SCHEMA_IRI, required: true }),
|
|
346
|
+
product: relation({ target: PRODUCT_SCHEMA_IRI }),
|
|
347
|
+
description: text({ maxLength: 500 }),
|
|
348
|
+
quantity: number({ min: 0 }),
|
|
349
|
+
/** Overrides the product's `unitPrice` when set. */
|
|
350
|
+
unitPrice: number({ min: 0 }),
|
|
351
|
+
/** Discount fraction, 0–1. */
|
|
352
|
+
discount: number({ min: 0, max: 1 }),
|
|
353
|
+
space: space(),
|
|
354
|
+
visibility: visibility()
|
|
355
|
+
},
|
|
356
|
+
authorization: spaceCascadeAuthorization()
|
|
357
|
+
});
|
|
358
|
+
var crmSchemas = [
|
|
359
|
+
OrganizationSchema,
|
|
360
|
+
ContactSchema,
|
|
361
|
+
RelationshipSchema,
|
|
362
|
+
PipelineSchema,
|
|
363
|
+
StageSchema,
|
|
364
|
+
DealSchema,
|
|
365
|
+
DealContactRoleSchema,
|
|
366
|
+
ActivitySchema,
|
|
367
|
+
ProductSchema,
|
|
368
|
+
LineItemSchema
|
|
369
|
+
];
|
|
370
|
+
|
|
371
|
+
export {
|
|
372
|
+
CRM_NAMESPACE,
|
|
373
|
+
ORGANIZATION_SCHEMA_IRI,
|
|
374
|
+
CONTACT_SCHEMA_IRI,
|
|
375
|
+
RELATIONSHIP_SCHEMA_IRI,
|
|
376
|
+
PIPELINE_SCHEMA_IRI,
|
|
377
|
+
STAGE_SCHEMA_IRI,
|
|
378
|
+
DEAL_SCHEMA_IRI,
|
|
379
|
+
DEAL_CONTACT_ROLE_SCHEMA_IRI,
|
|
380
|
+
ACTIVITY_SCHEMA_IRI,
|
|
381
|
+
PRODUCT_SCHEMA_IRI,
|
|
382
|
+
LINE_ITEM_SCHEMA_IRI,
|
|
383
|
+
ORGANIZATION_SIZES,
|
|
384
|
+
OrganizationSchema,
|
|
385
|
+
CONTACT_LIFECYCLE,
|
|
386
|
+
ContactSchema,
|
|
387
|
+
RELATIONSHIP_KINDS,
|
|
388
|
+
RelationshipSchema,
|
|
389
|
+
PipelineSchema,
|
|
390
|
+
StageSchema,
|
|
391
|
+
FORECAST_CATEGORIES,
|
|
392
|
+
DEAL_SOURCES,
|
|
393
|
+
DealSchema,
|
|
394
|
+
DEAL_CONTACT_ROLES,
|
|
395
|
+
DealContactRoleSchema,
|
|
396
|
+
ACTIVITY_KINDS,
|
|
397
|
+
ActivitySchema,
|
|
398
|
+
PRODUCT_KINDS,
|
|
399
|
+
ProductSchema,
|
|
400
|
+
LineItemSchema,
|
|
401
|
+
crmSchemas
|
|
402
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
spaceCascadeAuthorization
|
|
3
|
+
} from "./chunk-6OPZJ7MG.js";
|
|
4
|
+
import {
|
|
5
|
+
defineSchema,
|
|
6
|
+
money,
|
|
7
|
+
relation,
|
|
8
|
+
select,
|
|
9
|
+
text
|
|
10
|
+
} from "./chunk-O64EK5FK.js";
|
|
11
|
+
|
|
12
|
+
// src/schema/schemas/posting.ts
|
|
13
|
+
var POSTING_SCHEMA_IRI = "xnet://xnet.fyi/Posting@1.0.0";
|
|
14
|
+
var PostingSchema = defineSchema({
|
|
15
|
+
name: "Posting",
|
|
16
|
+
namespace: "xnet://xnet.fyi/",
|
|
17
|
+
properties: {
|
|
18
|
+
/** The owning journal entry. */
|
|
19
|
+
transaction: relation({ target: "xnet://xnet.fyi/Transaction@1.0.0", required: true }),
|
|
20
|
+
/** The account this leg debits/credits. */
|
|
21
|
+
account: relation({ target: "xnet://xnet.fyi/Account@1.0.0", required: true }),
|
|
22
|
+
/** Signed minor units + currency (debit positive / credit negative). */
|
|
23
|
+
amount: money({ required: true }),
|
|
24
|
+
/** Optional per-leg note (e.g. for split transactions). */
|
|
25
|
+
memo: text({ maxLength: 500 }),
|
|
26
|
+
/** Mirrors the transaction's Space so access cascades identically. */
|
|
27
|
+
space: relation({ target: "xnet://xnet.fyi/Space@1.0.0" }),
|
|
28
|
+
/** Per-node visibility; defaults to `private` (financial data, 0187). */
|
|
29
|
+
visibility: select({
|
|
30
|
+
options: [
|
|
31
|
+
{ id: "inherit", name: "Inherit", color: "gray" },
|
|
32
|
+
{ id: "private", name: "Private", color: "gray" },
|
|
33
|
+
{ id: "unlisted", name: "Unlisted", color: "yellow" },
|
|
34
|
+
{ id: "public", name: "Public", color: "green" }
|
|
35
|
+
],
|
|
36
|
+
default: "private"
|
|
37
|
+
})
|
|
38
|
+
},
|
|
39
|
+
authorization: spaceCascadeAuthorization()
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
POSTING_SCHEMA_IRI,
|
|
44
|
+
PostingSchema
|
|
45
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
spaceCascadeAuthorization
|
|
3
|
+
} from "./chunk-6OPZJ7MG.js";
|
|
4
|
+
import {
|
|
5
|
+
date,
|
|
6
|
+
defineSchema,
|
|
7
|
+
number,
|
|
8
|
+
relation,
|
|
9
|
+
select,
|
|
10
|
+
text
|
|
11
|
+
} from "./chunk-O64EK5FK.js";
|
|
12
|
+
|
|
13
|
+
// src/schema/schemas/import-batch.ts
|
|
14
|
+
var IMPORT_BATCH_SCHEMA_IRI = "xnet://xnet.fyi/ImportBatch@1.0.0";
|
|
15
|
+
var ImportBatchSchema = defineSchema({
|
|
16
|
+
name: "ImportBatch",
|
|
17
|
+
namespace: "xnet://xnet.fyi/",
|
|
18
|
+
properties: {
|
|
19
|
+
/** Where the rows came from. */
|
|
20
|
+
source: select({
|
|
21
|
+
options: [
|
|
22
|
+
{ id: "csv", name: "CSV" },
|
|
23
|
+
{ id: "ofx", name: "OFX / QFX" },
|
|
24
|
+
{ id: "qif", name: "QIF" },
|
|
25
|
+
{ id: "bank", name: "Bank sync" },
|
|
26
|
+
{ id: "manual", name: "Manual" }
|
|
27
|
+
],
|
|
28
|
+
default: "csv"
|
|
29
|
+
}),
|
|
30
|
+
/** Original file name, if any. */
|
|
31
|
+
filename: text({ maxLength: 500 }),
|
|
32
|
+
/** When the import ran (Unix ms). */
|
|
33
|
+
importedAt: date({ required: true }),
|
|
34
|
+
/** The account the statement was imported into. */
|
|
35
|
+
account: relation({ target: "xnet://xnet.fyi/Account@1.0.0" }),
|
|
36
|
+
/** Number of transactions created in this batch. */
|
|
37
|
+
count: number({ integer: true, min: 0 }),
|
|
38
|
+
/** Canonical SECURITY home; empty = personal/private book (0179/0181). */
|
|
39
|
+
space: relation({ target: "xnet://xnet.fyi/Space@1.0.0" }),
|
|
40
|
+
/** Per-node visibility; defaults to `private` (financial data, 0187). */
|
|
41
|
+
visibility: select({
|
|
42
|
+
options: [
|
|
43
|
+
{ id: "inherit", name: "Inherit", color: "gray" },
|
|
44
|
+
{ id: "private", name: "Private", color: "gray" },
|
|
45
|
+
{ id: "unlisted", name: "Unlisted", color: "yellow" },
|
|
46
|
+
{ id: "public", name: "Public", color: "green" }
|
|
47
|
+
],
|
|
48
|
+
default: "private"
|
|
49
|
+
})
|
|
50
|
+
},
|
|
51
|
+
authorization: spaceCascadeAuthorization()
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
IMPORT_BATCH_SCHEMA_IRI,
|
|
56
|
+
ImportBatchSchema
|
|
57
|
+
};
|