@mj-biz-apps/sales-core-entities-server 5.1.0 → 5.2.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/LICENSE +183 -183
- package/dist/DealEntityServer.js +2 -2
- package/dist/SequenceService.js +5 -5
- package/package.json +2 -2
- package/dist/LiveOrdersSeam.d.ts +0 -68
- package/dist/LiveOrdersSeam.d.ts.map +0 -1
- package/dist/LiveOrdersSeam.js +0 -80
- package/dist/LiveOrdersSeam.js.map +0 -1
- package/dist/SaveDealOperation.d.ts +0 -45
- package/dist/SaveDealOperation.d.ts.map +0 -1
- package/dist/SaveDealOperation.js +0 -268
- package/dist/SaveDealOperation.js.map +0 -1
- package/dist/activities/activity-vocabulary.d.ts +0 -103
- package/dist/activities/activity-vocabulary.d.ts.map +0 -1
- package/dist/activities/activity-vocabulary.js +0 -79
- package/dist/activities/activity-vocabulary.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,183 +1,183 @@
|
|
|
1
|
-
Business Source License 1.1
|
|
2
|
-
|
|
3
|
-
License text copyright (c) 2024 MariaDB plc, All Rights Reserved.
|
|
4
|
-
"Business Source License" is a trademark of MariaDB plc.
|
|
5
|
-
|
|
6
|
-
-----------------------------------------------------------------------------
|
|
7
|
-
|
|
8
|
-
Parameters
|
|
9
|
-
|
|
10
|
-
Licensor: Blue Cypress, Inc.
|
|
11
|
-
|
|
12
|
-
Licensed Work: MemberJunction.
|
|
13
|
-
The Licensed Work is (c) 2023-2026 Blue Cypress, Inc.
|
|
14
|
-
|
|
15
|
-
Additional Use Grant: Subject to the terms of this License, Licensor grants
|
|
16
|
-
you the following additional rights to make Production
|
|
17
|
-
Use of the Licensed Work.
|
|
18
|
-
|
|
19
|
-
1. Internal Use
|
|
20
|
-
|
|
21
|
-
You may make production use of the Licensed Work for
|
|
22
|
-
your own internal business or organizational operations.
|
|
23
|
-
|
|
24
|
-
2. Nonprofit Use
|
|
25
|
-
|
|
26
|
-
If you are a Nonprofit, you may make production use of
|
|
27
|
-
the Licensed Work for the operations and activities of
|
|
28
|
-
your Organizational Family.
|
|
29
|
-
|
|
30
|
-
3. MemberJunction Certified Program Use
|
|
31
|
-
|
|
32
|
-
If you are authorized by Licensor under the
|
|
33
|
-
MemberJunction Certified Program to provide professional
|
|
34
|
-
services using the Licensed Work, you may make
|
|
35
|
-
production use of the Licensed Work in providing such
|
|
36
|
-
professional services to a client, provided that:
|
|
37
|
-
|
|
38
|
-
(a) the Licensed Work is deployed in, and the applicable
|
|
39
|
-
production use occurs within, an environment owned,
|
|
40
|
-
leased, licensed, subscribed to, or otherwise controlled
|
|
41
|
-
by that client; and
|
|
42
|
-
|
|
43
|
-
(b) the production use is for that client's own internal
|
|
44
|
-
business or organizational operations or is otherwise
|
|
45
|
-
independently permitted to that client under this
|
|
46
|
-
Additional Use Grant.
|
|
47
|
-
|
|
48
|
-
4. Definitions Applicable to the Additional Use Grant
|
|
49
|
-
|
|
50
|
-
"Affiliate" means, with respect to a specified Person,
|
|
51
|
-
any other Person that directly or indirectly Controls,
|
|
52
|
-
is Controlled by, or is under common Control with such
|
|
53
|
-
specified Person.
|
|
54
|
-
|
|
55
|
-
"Control" (including the terms "Controls," "Controlled
|
|
56
|
-
by," and "under common Control with") means the direct
|
|
57
|
-
or indirect possession of the power to direct or cause
|
|
58
|
-
the direction of the management and policies of a
|
|
59
|
-
Person, whether through ownership of voting interests,
|
|
60
|
-
by contract, or otherwise.
|
|
61
|
-
|
|
62
|
-
"Organizational Family" means, with respect to a Person,
|
|
63
|
-
(a) such Person and its Affiliates, and (b) any
|
|
64
|
-
nonprofit organization, governmental entity, chapter,
|
|
65
|
-
division, local affiliate, regional affiliate, state
|
|
66
|
-
affiliate, national affiliate, or other entity that is
|
|
67
|
-
formally affiliated with such Person through governing
|
|
68
|
-
documents, a charter, bylaws, a membership agreement, or
|
|
69
|
-
another written organizational instrument, and is
|
|
70
|
-
recognized under such documents as part of the same
|
|
71
|
-
organizational structure.
|
|
72
|
-
|
|
73
|
-
"Nonprofit" means a Person recognized by the Internal
|
|
74
|
-
Revenue Service as exempt from federal income taxation
|
|
75
|
-
under Section 501(c)(3), 501(c)(4), 501(c)(5), or
|
|
76
|
-
501(c)(6) of the Internal Revenue Code, or a foreign
|
|
77
|
-
organization recognized under substantially equivalent
|
|
78
|
-
laws.
|
|
79
|
-
|
|
80
|
-
A Person claiming eligibility as a Nonprofit shall, upon
|
|
81
|
-
Licensor's reasonable request, provide documentation
|
|
82
|
-
reasonably sufficient to demonstrate that it qualifies
|
|
83
|
-
as a Nonprofit. If such Person materially misrepresents,
|
|
84
|
-
or is unable to demonstrate, its qualification as a
|
|
85
|
-
Nonprofit, the rights granted to such Person under
|
|
86
|
-
Section 2 of this Additional Use Grant shall terminate.
|
|
87
|
-
|
|
88
|
-
"MemberJunction Certified Program" means Licensor's
|
|
89
|
-
then-current program for certifying and authorizing a
|
|
90
|
-
Person to provide professional services using the
|
|
91
|
-
Licensed Work.
|
|
92
|
-
|
|
93
|
-
"Person" means any individual, corporation, limited
|
|
94
|
-
liability company, partnership, association, nonprofit
|
|
95
|
-
organization, governmental entity, or other legal or
|
|
96
|
-
organizational entity.
|
|
97
|
-
|
|
98
|
-
Change Date: Four (4) years from the date the Licensed Work is first
|
|
99
|
-
made available.
|
|
100
|
-
|
|
101
|
-
Change License: MIT License.
|
|
102
|
-
|
|
103
|
-
For information about alternative licensing arrangements for the Licensed
|
|
104
|
-
Work, please contact Blue Cypress, Inc.
|
|
105
|
-
|
|
106
|
-
-----------------------------------------------------------------------------
|
|
107
|
-
|
|
108
|
-
Terms
|
|
109
|
-
|
|
110
|
-
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
111
|
-
works, redistribute, and make non-production use of the Licensed Work. The
|
|
112
|
-
Licensor may make an Additional Use Grant, above, permitting limited
|
|
113
|
-
production use.
|
|
114
|
-
|
|
115
|
-
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
116
|
-
available distribution of a specific version of the Licensed Work under this
|
|
117
|
-
License, whichever comes first, the Licensor hereby grants you rights under
|
|
118
|
-
the terms of the Change License, and the rights granted in the paragraph
|
|
119
|
-
above terminate.
|
|
120
|
-
|
|
121
|
-
If your use of the Licensed Work does not comply with the requirements
|
|
122
|
-
currently in effect as described in this License, you must purchase a
|
|
123
|
-
commercial license from the Licensor, its affiliated entities, or authorized
|
|
124
|
-
resellers, or you must refrain from using the Licensed Work.
|
|
125
|
-
|
|
126
|
-
All copies of the original and modified Licensed Work, and derivative works
|
|
127
|
-
of the Licensed Work, are subject to this License. This License applies
|
|
128
|
-
separately for each version of the Licensed Work and the Change Date may vary
|
|
129
|
-
for each version of the Licensed Work released by Licensor.
|
|
130
|
-
|
|
131
|
-
You must conspicuously display this License on each original or modified copy
|
|
132
|
-
of the Licensed Work. If you receive the Licensed Work in original or
|
|
133
|
-
modified form from a third party, the terms and conditions set forth in this
|
|
134
|
-
License apply to your use of that work.
|
|
135
|
-
|
|
136
|
-
Any use of the Licensed Work in violation of this License will automatically
|
|
137
|
-
terminate your rights under this License for the current and all other
|
|
138
|
-
versions of the Licensed Work.
|
|
139
|
-
|
|
140
|
-
This License does not grant you any right in any trademark or logo of
|
|
141
|
-
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
142
|
-
Licensor as expressly required by this License).
|
|
143
|
-
|
|
144
|
-
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
145
|
-
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
146
|
-
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
147
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
148
|
-
TITLE.
|
|
149
|
-
|
|
150
|
-
MariaDB hereby grants you permission to use this License's text to license
|
|
151
|
-
your works, and to refer to it using the trademark "Business Source License",
|
|
152
|
-
as long as you comply with the Covenants of Licensor below.
|
|
153
|
-
|
|
154
|
-
-----------------------------------------------------------------------------
|
|
155
|
-
|
|
156
|
-
Covenants of Licensor
|
|
157
|
-
|
|
158
|
-
In consideration of the right to use this License's text and the "Business
|
|
159
|
-
Source License" name and trademark, Licensor covenants to MariaDB, and to all
|
|
160
|
-
other recipients of the licensed work to be provided by Licensor:
|
|
161
|
-
|
|
162
|
-
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
163
|
-
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
164
|
-
where "compatible" means that software provided under the Change License
|
|
165
|
-
can be included in a program with software provided under GPL Version 2.0
|
|
166
|
-
or a later version. Licensor may specify additional Change Licenses without
|
|
167
|
-
limitation.
|
|
168
|
-
|
|
169
|
-
2. To either: (a) specify an additional grant of rights to use that does not
|
|
170
|
-
impose any additional restriction on the right granted in this License, as
|
|
171
|
-
the Additional Use Grant; or (b) insert the text "None".
|
|
172
|
-
|
|
173
|
-
3. To specify a Change Date.
|
|
174
|
-
|
|
175
|
-
4. Not to modify this License in any other way.
|
|
176
|
-
|
|
177
|
-
-----------------------------------------------------------------------------
|
|
178
|
-
|
|
179
|
-
Notice
|
|
180
|
-
|
|
181
|
-
The Business Source License (this document, or the "License") is not an Open
|
|
182
|
-
Source license. However, the Licensed Work will eventually be made available
|
|
183
|
-
under an Open Source License, as stated in this License.
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
License text copyright (c) 2024 MariaDB plc, All Rights Reserved.
|
|
4
|
+
"Business Source License" is a trademark of MariaDB plc.
|
|
5
|
+
|
|
6
|
+
-----------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
Parameters
|
|
9
|
+
|
|
10
|
+
Licensor: Blue Cypress, Inc.
|
|
11
|
+
|
|
12
|
+
Licensed Work: MemberJunction.
|
|
13
|
+
The Licensed Work is (c) 2023-2026 Blue Cypress, Inc.
|
|
14
|
+
|
|
15
|
+
Additional Use Grant: Subject to the terms of this License, Licensor grants
|
|
16
|
+
you the following additional rights to make Production
|
|
17
|
+
Use of the Licensed Work.
|
|
18
|
+
|
|
19
|
+
1. Internal Use
|
|
20
|
+
|
|
21
|
+
You may make production use of the Licensed Work for
|
|
22
|
+
your own internal business or organizational operations.
|
|
23
|
+
|
|
24
|
+
2. Nonprofit Use
|
|
25
|
+
|
|
26
|
+
If you are a Nonprofit, you may make production use of
|
|
27
|
+
the Licensed Work for the operations and activities of
|
|
28
|
+
your Organizational Family.
|
|
29
|
+
|
|
30
|
+
3. MemberJunction Certified Program Use
|
|
31
|
+
|
|
32
|
+
If you are authorized by Licensor under the
|
|
33
|
+
MemberJunction Certified Program to provide professional
|
|
34
|
+
services using the Licensed Work, you may make
|
|
35
|
+
production use of the Licensed Work in providing such
|
|
36
|
+
professional services to a client, provided that:
|
|
37
|
+
|
|
38
|
+
(a) the Licensed Work is deployed in, and the applicable
|
|
39
|
+
production use occurs within, an environment owned,
|
|
40
|
+
leased, licensed, subscribed to, or otherwise controlled
|
|
41
|
+
by that client; and
|
|
42
|
+
|
|
43
|
+
(b) the production use is for that client's own internal
|
|
44
|
+
business or organizational operations or is otherwise
|
|
45
|
+
independently permitted to that client under this
|
|
46
|
+
Additional Use Grant.
|
|
47
|
+
|
|
48
|
+
4. Definitions Applicable to the Additional Use Grant
|
|
49
|
+
|
|
50
|
+
"Affiliate" means, with respect to a specified Person,
|
|
51
|
+
any other Person that directly or indirectly Controls,
|
|
52
|
+
is Controlled by, or is under common Control with such
|
|
53
|
+
specified Person.
|
|
54
|
+
|
|
55
|
+
"Control" (including the terms "Controls," "Controlled
|
|
56
|
+
by," and "under common Control with") means the direct
|
|
57
|
+
or indirect possession of the power to direct or cause
|
|
58
|
+
the direction of the management and policies of a
|
|
59
|
+
Person, whether through ownership of voting interests,
|
|
60
|
+
by contract, or otherwise.
|
|
61
|
+
|
|
62
|
+
"Organizational Family" means, with respect to a Person,
|
|
63
|
+
(a) such Person and its Affiliates, and (b) any
|
|
64
|
+
nonprofit organization, governmental entity, chapter,
|
|
65
|
+
division, local affiliate, regional affiliate, state
|
|
66
|
+
affiliate, national affiliate, or other entity that is
|
|
67
|
+
formally affiliated with such Person through governing
|
|
68
|
+
documents, a charter, bylaws, a membership agreement, or
|
|
69
|
+
another written organizational instrument, and is
|
|
70
|
+
recognized under such documents as part of the same
|
|
71
|
+
organizational structure.
|
|
72
|
+
|
|
73
|
+
"Nonprofit" means a Person recognized by the Internal
|
|
74
|
+
Revenue Service as exempt from federal income taxation
|
|
75
|
+
under Section 501(c)(3), 501(c)(4), 501(c)(5), or
|
|
76
|
+
501(c)(6) of the Internal Revenue Code, or a foreign
|
|
77
|
+
organization recognized under substantially equivalent
|
|
78
|
+
laws.
|
|
79
|
+
|
|
80
|
+
A Person claiming eligibility as a Nonprofit shall, upon
|
|
81
|
+
Licensor's reasonable request, provide documentation
|
|
82
|
+
reasonably sufficient to demonstrate that it qualifies
|
|
83
|
+
as a Nonprofit. If such Person materially misrepresents,
|
|
84
|
+
or is unable to demonstrate, its qualification as a
|
|
85
|
+
Nonprofit, the rights granted to such Person under
|
|
86
|
+
Section 2 of this Additional Use Grant shall terminate.
|
|
87
|
+
|
|
88
|
+
"MemberJunction Certified Program" means Licensor's
|
|
89
|
+
then-current program for certifying and authorizing a
|
|
90
|
+
Person to provide professional services using the
|
|
91
|
+
Licensed Work.
|
|
92
|
+
|
|
93
|
+
"Person" means any individual, corporation, limited
|
|
94
|
+
liability company, partnership, association, nonprofit
|
|
95
|
+
organization, governmental entity, or other legal or
|
|
96
|
+
organizational entity.
|
|
97
|
+
|
|
98
|
+
Change Date: Four (4) years from the date the Licensed Work is first
|
|
99
|
+
made available.
|
|
100
|
+
|
|
101
|
+
Change License: MIT License.
|
|
102
|
+
|
|
103
|
+
For information about alternative licensing arrangements for the Licensed
|
|
104
|
+
Work, please contact Blue Cypress, Inc.
|
|
105
|
+
|
|
106
|
+
-----------------------------------------------------------------------------
|
|
107
|
+
|
|
108
|
+
Terms
|
|
109
|
+
|
|
110
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
111
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
112
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
113
|
+
production use.
|
|
114
|
+
|
|
115
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
116
|
+
available distribution of a specific version of the Licensed Work under this
|
|
117
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
118
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
119
|
+
above terminate.
|
|
120
|
+
|
|
121
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
122
|
+
currently in effect as described in this License, you must purchase a
|
|
123
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
124
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
125
|
+
|
|
126
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
127
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
128
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
129
|
+
for each version of the Licensed Work released by Licensor.
|
|
130
|
+
|
|
131
|
+
You must conspicuously display this License on each original or modified copy
|
|
132
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
133
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
134
|
+
License apply to your use of that work.
|
|
135
|
+
|
|
136
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
137
|
+
terminate your rights under this License for the current and all other
|
|
138
|
+
versions of the Licensed Work.
|
|
139
|
+
|
|
140
|
+
This License does not grant you any right in any trademark or logo of
|
|
141
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
142
|
+
Licensor as expressly required by this License).
|
|
143
|
+
|
|
144
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
145
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
146
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
147
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
148
|
+
TITLE.
|
|
149
|
+
|
|
150
|
+
MariaDB hereby grants you permission to use this License's text to license
|
|
151
|
+
your works, and to refer to it using the trademark "Business Source License",
|
|
152
|
+
as long as you comply with the Covenants of Licensor below.
|
|
153
|
+
|
|
154
|
+
-----------------------------------------------------------------------------
|
|
155
|
+
|
|
156
|
+
Covenants of Licensor
|
|
157
|
+
|
|
158
|
+
In consideration of the right to use this License's text and the "Business
|
|
159
|
+
Source License" name and trademark, Licensor covenants to MariaDB, and to all
|
|
160
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
161
|
+
|
|
162
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
163
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
164
|
+
where "compatible" means that software provided under the Change License
|
|
165
|
+
can be included in a program with software provided under GPL Version 2.0
|
|
166
|
+
or a later version. Licensor may specify additional Change Licenses without
|
|
167
|
+
limitation.
|
|
168
|
+
|
|
169
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
170
|
+
impose any additional restriction on the right granted in this License, as
|
|
171
|
+
the Additional Use Grant; or (b) insert the text "None".
|
|
172
|
+
|
|
173
|
+
3. To specify a Change Date.
|
|
174
|
+
|
|
175
|
+
4. Not to modify this License in any other way.
|
|
176
|
+
|
|
177
|
+
-----------------------------------------------------------------------------
|
|
178
|
+
|
|
179
|
+
Notice
|
|
180
|
+
|
|
181
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
182
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
183
|
+
under an Open Source License, as stated in this License.
|
package/dist/DealEntityServer.js
CHANGED
|
@@ -1245,8 +1245,8 @@ let DealEntityServer = class DealEntityServer extends DealEntity {
|
|
|
1245
1245
|
}
|
|
1246
1246
|
const now = new Date();
|
|
1247
1247
|
const sql = this.ProviderToUse;
|
|
1248
|
-
await sql.ExecuteSQL(`UPDATE ${SALES_SCHEMA}.Deal
|
|
1249
|
-
SET Amount = @amount, AmountIsComputed = 1, AmountComputedAt = @at, AmountSourceHash = @hash
|
|
1248
|
+
await sql.ExecuteSQL(`UPDATE ${SALES_SCHEMA}.Deal
|
|
1249
|
+
SET Amount = @amount, AmountIsComputed = 1, AmountComputedAt = @at, AmountSourceHash = @hash
|
|
1250
1250
|
WHERE ID = @id`, { amount: total, at: now, hash, id: this.ID }, { isMutation: true, description: 'DealEntityServer: refresh Deal.Amount from OrderHeader.TotalGross' }, this.ContextCurrentUser);
|
|
1251
1251
|
// The in-memory record follows, so a caller reading the entity back after `Save()` sees the
|
|
1252
1252
|
// cache it just wrote rather than the value it came in with.
|
package/dist/SequenceService.js
CHANGED
|
@@ -19,11 +19,11 @@ export const SALES_SCHEMA = '__mj_BizAppsSales';
|
|
|
19
19
|
*/
|
|
20
20
|
export async function getNextDealNumber(contextUser, provider) {
|
|
21
21
|
const sqlProvider = getSqlServerProvider(provider);
|
|
22
|
-
const sql = `
|
|
23
|
-
DECLARE @dealNumber NVARCHAR(50);
|
|
24
|
-
EXEC ${SALES_SCHEMA}.spAssignNextDealNumber
|
|
25
|
-
@DealNumber = @dealNumber OUTPUT;
|
|
26
|
-
SELECT @dealNumber AS DealNumber;
|
|
22
|
+
const sql = `
|
|
23
|
+
DECLARE @dealNumber NVARCHAR(50);
|
|
24
|
+
EXEC ${SALES_SCHEMA}.spAssignNextDealNumber
|
|
25
|
+
@DealNumber = @dealNumber OUTPUT;
|
|
26
|
+
SELECT @dealNumber AS DealNumber;
|
|
27
27
|
`;
|
|
28
28
|
// ExecuteSQL binds an OBJECT of parameters BY NAME. An array is treated as positional (p0), which
|
|
29
29
|
// would not match a named @-param — accounting's service records learning this the hard way, and the
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mj-biz-apps/sales-core-entities-server",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.2.0",
|
|
5
5
|
"description": "Server-side entity subclasses for BizApps Sales — the close lock (L-17), the OwnerEmployeeID denormalized stamp, and deal lifecycle hooks.",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@mj-biz-apps/common-entities": "^5.34.0",
|
|
23
23
|
"@mj-biz-apps/orders-entities": "^5.1.0",
|
|
24
|
-
"@mj-biz-apps/sales-entities": "5.
|
|
24
|
+
"@mj-biz-apps/sales-entities": "5.2.0",
|
|
25
25
|
"@mj-biz-apps/tasks-core": "^1.2.3",
|
|
26
26
|
"@mj-biz-apps/tasks-entities": "^1.2.3"
|
|
27
27
|
},
|
package/dist/LiveOrdersSeam.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview What is left of the orders handoff: a wrapper that forwards the CONTRACT route.
|
|
3
|
-
*
|
|
4
|
-
* ── THIS CLASS NO LONGER TOUCHES ORDERS, AND THAT IS THE POINT ─────────────────────────────────
|
|
5
|
-
*
|
|
6
|
-
* It used to create the order a won deal earned, through orders' own entity graph. Close-won does not
|
|
7
|
-
* create an order any more — the order is embedded on the deal from creation — so `CreateOrder` and
|
|
8
|
-
* `PreviewOrderMoney` described a route that no longer exists. Both are gone, along with the money
|
|
9
|
-
* boundary essay that justified them.
|
|
10
|
-
*
|
|
11
|
-
* ── ONE OF THEM WAS A LIVE HAZARD, NOT JUST DEAD WEIGHT ────────────────────────────────────────
|
|
12
|
-
*
|
|
13
|
-
* Both passed `DiscountPct` straight through to `OrderLine`, and the seam input documented no units.
|
|
14
|
-
* Orders stores a FRACTION (0.25 for a quarter off); the caller that used to feed this sent a rep-
|
|
15
|
-
* entered PERCENTAGE (25). With the caller deleted the conversion went with it, leaving two exported,
|
|
16
|
-
* typechecked methods that would write a 25% discount as 2500% — except `CK_OrderLine_DiscountPct`
|
|
17
|
-
* caps it, so the realistic outcome was a 50% discount recorded for a half-percent one, saved
|
|
18
|
-
* cleanly, with nothing to notice.
|
|
19
|
-
*
|
|
20
|
-
* That is precisely what `scripts/assert-discount-conversion.mjs` exists to prevent, and it was
|
|
21
|
-
* sitting on a published interface with no test on it since the CW and D check bundles were retired.
|
|
22
|
-
* Deleting the methods removes the hazard outright rather than documenting it.
|
|
23
|
-
*
|
|
24
|
-
* ── WHY THE CLASS SURVIVES AT ALL ──────────────────────────────────────────────────────────────
|
|
25
|
-
*
|
|
26
|
-
* `CreateContractFromDeal` and `RenewContractTerm` below are pure delegation to the contracts seam it
|
|
27
|
-
* is handed. So this is now a pass-through, and `CloseDealOperation.resolveSeam` could return that
|
|
28
|
-
* contracts seam directly instead of wrapping it — at which point this whole file goes. That edit is
|
|
29
|
-
* in `CloseDealOperation.ts`, which another session is merging, so it is left stated rather than made.
|
|
30
|
-
*
|
|
31
|
-
* `OrdersIsInstalled()` is the one thing here still doing work: the close reads it to decide whether
|
|
32
|
-
* an orders-dependent route is available at all.
|
|
33
|
-
*
|
|
34
|
-
* @module @mj-biz-apps/sales-core-entities-server
|
|
35
|
-
*/
|
|
36
|
-
import { RunView, type IMetadataProvider, type UserInfo } from '@memberjunction/core';
|
|
37
|
-
import { type IDownstreamSeam, type ContractsCreateFromDealSeamInput, type ContractsRenewTermSeamInput, type ContractsSeamResult } from '@mj-biz-apps/sales-entities';
|
|
38
|
-
/** Orders' entity names, in one place so a rename is one edit rather than a hunt. */
|
|
39
|
-
declare const E_ORDER_HEADER = "MJ_BizApps_Orders: Order Headers";
|
|
40
|
-
declare const E_ORDER_LINE = "MJ_BizApps_Orders: Order Lines";
|
|
41
|
-
/**
|
|
42
|
-
* True when orders is actually installed here.
|
|
43
|
-
*
|
|
44
|
-
* Checked against METADATA rather than by catching an error, for the same reason the product picker
|
|
45
|
-
* does: `RunView`/`GetEntityObject` against an unregistered entity does not fail cleanly — it logs and
|
|
46
|
-
* leaves the caller guessing. Sales is designed to run standalone, so orders being absent is a
|
|
47
|
-
* supported state, not a fault.
|
|
48
|
-
*/
|
|
49
|
-
export declare function OrdersIsInstalled(): boolean;
|
|
50
|
-
export declare class LiveOrdersSeam implements IDownstreamSeam {
|
|
51
|
-
private readonly user;
|
|
52
|
-
private readonly provider;
|
|
53
|
-
/**
|
|
54
|
-
* The contract half is delegated to whatever the composer supplied — the live contracts seam when
|
|
55
|
-
* contracts is installed, the stub when it is not. This class owns ORDERS and nothing else; it used
|
|
56
|
-
* to hold a private stub, which quietly made it the authority on a downstream it knows nothing
|
|
57
|
-
* about. See `CompositeDownstreamSeam`.
|
|
58
|
-
*/
|
|
59
|
-
private readonly contracts;
|
|
60
|
-
constructor(user: UserInfo, provider: IMetadataProvider, contracts?: Pick<IDownstreamSeam, 'CreateContractFromDeal' | 'RenewContractTerm'>);
|
|
61
|
-
CreateContractFromDeal(input: ContractsCreateFromDealSeamInput): Promise<ContractsSeamResult>;
|
|
62
|
-
RenewContractTerm(input: ContractsRenewTermSeamInput): Promise<ContractsSeamResult>;
|
|
63
|
-
}
|
|
64
|
-
/** Anti-tree-shaking anchor, in the house style. */
|
|
65
|
-
export declare function LoadLiveOrdersSeam(): void;
|
|
66
|
-
/** Kept for the seam test, which reads back what orders actually wrote. */
|
|
67
|
-
export { E_ORDER_HEADER, E_ORDER_LINE, RunView };
|
|
68
|
-
//# sourceMappingURL=LiveOrdersSeam.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LiveOrdersSeam.d.ts","sourceRoot":"","sources":["../src/LiveOrdersSeam.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAGH,OAAO,EAEP,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACH,KAAK,eAAe,EAEpB,KAAK,gCAAgC,EACrC,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,EAE3B,MAAM,6BAA6B,CAAC;AAErC,qFAAqF;AACrF,QAAA,MAAM,cAAc,qCAAqC,CAAC;AAC1D,QAAA,MAAM,YAAY,mCAAmC,CAAC;AA0BtD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAG3C;AAED,qBAAa,cAAe,YAAW,eAAe;IAW9C,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAV7B;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwE;gBAG7E,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,iBAAiB,EAC5C,SAAS,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,wBAAwB,GAAG,mBAAmB,CAAC;IAO9E,sBAAsB,CAAC,KAAK,EAAE,gCAAgC,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI7F,iBAAiB,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAG7F;AAED,oDAAoD;AACpD,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED,2EAA2E;AAC3E,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/LiveOrdersSeam.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview What is left of the orders handoff: a wrapper that forwards the CONTRACT route.
|
|
3
|
-
*
|
|
4
|
-
* ── THIS CLASS NO LONGER TOUCHES ORDERS, AND THAT IS THE POINT ─────────────────────────────────
|
|
5
|
-
*
|
|
6
|
-
* It used to create the order a won deal earned, through orders' own entity graph. Close-won does not
|
|
7
|
-
* create an order any more — the order is embedded on the deal from creation — so `CreateOrder` and
|
|
8
|
-
* `PreviewOrderMoney` described a route that no longer exists. Both are gone, along with the money
|
|
9
|
-
* boundary essay that justified them.
|
|
10
|
-
*
|
|
11
|
-
* ── ONE OF THEM WAS A LIVE HAZARD, NOT JUST DEAD WEIGHT ────────────────────────────────────────
|
|
12
|
-
*
|
|
13
|
-
* Both passed `DiscountPct` straight through to `OrderLine`, and the seam input documented no units.
|
|
14
|
-
* Orders stores a FRACTION (0.25 for a quarter off); the caller that used to feed this sent a rep-
|
|
15
|
-
* entered PERCENTAGE (25). With the caller deleted the conversion went with it, leaving two exported,
|
|
16
|
-
* typechecked methods that would write a 25% discount as 2500% — except `CK_OrderLine_DiscountPct`
|
|
17
|
-
* caps it, so the realistic outcome was a 50% discount recorded for a half-percent one, saved
|
|
18
|
-
* cleanly, with nothing to notice.
|
|
19
|
-
*
|
|
20
|
-
* That is precisely what `scripts/assert-discount-conversion.mjs` exists to prevent, and it was
|
|
21
|
-
* sitting on a published interface with no test on it since the CW and D check bundles were retired.
|
|
22
|
-
* Deleting the methods removes the hazard outright rather than documenting it.
|
|
23
|
-
*
|
|
24
|
-
* ── WHY THE CLASS SURVIVES AT ALL ──────────────────────────────────────────────────────────────
|
|
25
|
-
*
|
|
26
|
-
* `CreateContractFromDeal` and `RenewContractTerm` below are pure delegation to the contracts seam it
|
|
27
|
-
* is handed. So this is now a pass-through, and `CloseDealOperation.resolveSeam` could return that
|
|
28
|
-
* contracts seam directly instead of wrapping it — at which point this whole file goes. That edit is
|
|
29
|
-
* in `CloseDealOperation.ts`, which another session is merging, so it is left stated rather than made.
|
|
30
|
-
*
|
|
31
|
-
* `OrdersIsInstalled()` is the one thing here still doing work: the close reads it to decide whether
|
|
32
|
-
* an orders-dependent route is available at all.
|
|
33
|
-
*
|
|
34
|
-
* @module @mj-biz-apps/sales-core-entities-server
|
|
35
|
-
*/
|
|
36
|
-
import { Metadata, RunView, } from '@memberjunction/core';
|
|
37
|
-
import { StubDownstreamSeam, } from '@mj-biz-apps/sales-entities';
|
|
38
|
-
/** Orders' entity names, in one place so a rename is one edit rather than a hunt. */
|
|
39
|
-
const E_ORDER_HEADER = 'MJ_BizApps_Orders: Order Headers';
|
|
40
|
-
const E_ORDER_LINE = 'MJ_BizApps_Orders: Order Lines';
|
|
41
|
-
/**
|
|
42
|
-
* The operation that prices a draft — orders' CLASS REGISTRATION key, not its display name.
|
|
43
|
-
*
|
|
44
|
-
* Metadata calls it "Price Order"; the ClassFactory key is `Orders.PriceOrder`. Invoking by key keeps
|
|
45
|
-
* this a SOFT dependency: sales names a string, never imports orders' TypeScript, so a deployment
|
|
46
|
-
* without orders still compiles and runs.
|
|
47
|
-
*/
|
|
48
|
-
const OP_PRICE_ORDER = 'Orders.PriceOrder';
|
|
49
|
-
/**
|
|
50
|
-
* True when orders is actually installed here.
|
|
51
|
-
*
|
|
52
|
-
* Checked against METADATA rather than by catching an error, for the same reason the product picker
|
|
53
|
-
* does: `RunView`/`GetEntityObject` against an unregistered entity does not fail cleanly — it logs and
|
|
54
|
-
* leaves the caller guessing. Sales is designed to run standalone, so orders being absent is a
|
|
55
|
-
* supported state, not a fault.
|
|
56
|
-
*/
|
|
57
|
-
export function OrdersIsInstalled() {
|
|
58
|
-
const md = new Metadata();
|
|
59
|
-
return md.Entities.some((e) => e.Name === E_ORDER_HEADER) && md.Entities.some((e) => e.Name === E_ORDER_LINE);
|
|
60
|
-
}
|
|
61
|
-
export class LiveOrdersSeam {
|
|
62
|
-
constructor(user, provider, contracts) {
|
|
63
|
-
this.user = user;
|
|
64
|
-
this.provider = provider;
|
|
65
|
-
this.contracts = contracts ?? new StubDownstreamSeam();
|
|
66
|
-
}
|
|
67
|
-
CreateContractFromDeal(input) {
|
|
68
|
-
return this.contracts.CreateContractFromDeal(input);
|
|
69
|
-
}
|
|
70
|
-
RenewContractTerm(input) {
|
|
71
|
-
return this.contracts.RenewContractTerm(input);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
/** Anti-tree-shaking anchor, in the house style. */
|
|
75
|
-
export function LoadLiveOrdersSeam() {
|
|
76
|
-
/* keeps the import alive */
|
|
77
|
-
}
|
|
78
|
-
/** Kept for the seam test, which reads back what orders actually wrote. */
|
|
79
|
-
export { E_ORDER_HEADER, E_ORDER_LINE, RunView };
|
|
80
|
-
//# sourceMappingURL=LiveOrdersSeam.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LiveOrdersSeam.js","sourceRoot":"","sources":["../src/LiveOrdersSeam.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAEH,QAAQ,EACR,OAAO,GAIV,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAMH,kBAAkB,GACrB,MAAM,6BAA6B,CAAC;AAErC,qFAAqF;AACrF,MAAM,cAAc,GAAG,kCAAkC,CAAC;AAC1D,MAAM,YAAY,GAAG,gCAAgC,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAiB3C;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB;IAC7B,MAAM,EAAE,GAAG,IAAI,QAAQ,EAAE,CAAC;IAC1B,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,cAAc,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC;AAClH,CAAC;AAED,MAAM,OAAO,cAAc;IAUvB,YACqB,IAAc,EACd,QAA2B,EAC5C,SAAiF;QAFhE,SAAI,GAAJ,IAAI,CAAU;QACd,aAAQ,GAAR,QAAQ,CAAmB;QAG5C,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,IAAI,kBAAkB,EAAE,CAAC;IAC3D,CAAC;IAIM,sBAAsB,CAAC,KAAuC;QACjE,OAAO,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;IACxD,CAAC;IAEM,iBAAiB,CAAC,KAAkC;QACvD,OAAO,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;CACJ;AAED,oDAAoD;AACpD,MAAM,UAAU,kBAAkB;IAC9B,4BAA4B;AAChC,CAAC;AAED,2EAA2E;AAC3E,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview `Sales.SaveDeal` — the server half of browser-side deal entry.
|
|
3
|
-
*
|
|
4
|
-
* The client mutates a `DealDraft`, serializes it with `ToSaveInput()`, and calls this. This file
|
|
5
|
-
* rehydrates that payload into a real `DealEntityServer` tree and saves it, which puts the write on the
|
|
6
|
-
* SAME path an Action or an agent would take — so every rule enforced in the entity subclass applies
|
|
7
|
-
* here too, for free.
|
|
8
|
-
*
|
|
9
|
-
* WHY REHYDRATION RATHER THAN A BULK WRITE. It would be faster to build the SQL directly. It would also
|
|
10
|
-
* be a second implementation of "what it means to save a deal", and the second one is the one that
|
|
11
|
-
* eventually disagrees with the first. Going through the entity objects means validation, the owner
|
|
12
|
-
* stamp, and later the close lock all happen without this file knowing they exist.
|
|
13
|
-
*
|
|
14
|
-
* PRICES NOTHING. Every figure it accepts is either an INPUT to the pricing engine
|
|
15
|
-
* (`RequestedDiscountPct`, `OverrideUnitPrice`) or a transcription of a signed document
|
|
16
|
-
* (`AnnualGrossFees`, `DiscountAmount`, `Total`). The four `Resolved*` columns are not writable through
|
|
17
|
-
* this operation at all — they come only from an `Orders.PreviewOrder` response, and accepting them
|
|
18
|
-
* here would be the hole through which locally computed money enters the app.
|
|
19
|
-
*
|
|
20
|
-
* @module @mj-biz-apps/sales-core-entities-server
|
|
21
|
-
*/
|
|
22
|
-
import { IMetadataProvider, UserInfo } from '@memberjunction/core';
|
|
23
|
-
import { SalesSaveDealOperation as SalesSaveDealOperationBase, type SalesSaveDealInput, type SalesSaveDealOutput } from '@mj-biz-apps/sales-entities';
|
|
24
|
-
export declare class SaveDealOperation extends SalesSaveDealOperationBase {
|
|
25
|
-
protected InternalExecute(input: SalesSaveDealInput, provider: IMetadataProvider, user: UserInfo): Promise<SalesSaveDealOutput>;
|
|
26
|
-
/** The pipeline owns the selling company. NOT NULL on Pipeline, so a successful read always has one. */
|
|
27
|
-
private resolvePipelineCompany;
|
|
28
|
-
/**
|
|
29
|
-
* Reconciles the submitted lines against what is stored.
|
|
30
|
-
*
|
|
31
|
-
* The array is the COMPLETE DESIRED SET: a stored line whose ID is absent from it is removed. That
|
|
32
|
-
* is what lets a workspace holding the whole tree just send its current state, with no delta
|
|
33
|
-
* bookkeeping in the browser — and `RemoveLine` queues the deletion so it happens inside the same
|
|
34
|
-
* transaction as the inserts.
|
|
35
|
-
*/
|
|
36
|
-
private applyLines;
|
|
37
|
-
/** Identical semantics to {@link applyLines}. */
|
|
38
|
-
private applySchedule;
|
|
39
|
-
/**
|
|
40
|
-
* Rewrites a collection in place to match `ordered`. In place because the getters expose the live
|
|
41
|
-
* arrays the entity's `Save()` walks; replacing them would leave `Save()` writing the old order.
|
|
42
|
-
*/
|
|
43
|
-
private reorder;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=SaveDealOperation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SaveDealOperation.d.ts","sourceRoot":"","sources":["../src/SaveDealOperation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAGH,iBAAiB,EAGjB,QAAQ,EACX,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACH,sBAAsB,IAAI,0BAA0B,EAIpD,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EAG3B,MAAM,6BAA6B,CAAC;AA6ErC,qBACa,iBAAkB,SAAQ,0BAA0B;cAC7C,eAAe,CAC3B,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,QAAQ,GACf,OAAO,CAAC,mBAAmB,CAAC;IAiG/B,wGAAwG;YAC1F,sBAAsB;IAuBpC;;;;;;;OAOG;YACW,UAAU;IAgCxB,iDAAiD;YACnC,aAAa;IAgC3B;;;OAGG;IACH,OAAO,CAAC,OAAO;CAIlB"}
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* @fileoverview `Sales.SaveDeal` — the server half of browser-side deal entry.
|
|
9
|
-
*
|
|
10
|
-
* The client mutates a `DealDraft`, serializes it with `ToSaveInput()`, and calls this. This file
|
|
11
|
-
* rehydrates that payload into a real `DealEntityServer` tree and saves it, which puts the write on the
|
|
12
|
-
* SAME path an Action or an agent would take — so every rule enforced in the entity subclass applies
|
|
13
|
-
* here too, for free.
|
|
14
|
-
*
|
|
15
|
-
* WHY REHYDRATION RATHER THAN A BULK WRITE. It would be faster to build the SQL directly. It would also
|
|
16
|
-
* be a second implementation of "what it means to save a deal", and the second one is the one that
|
|
17
|
-
* eventually disagrees with the first. Going through the entity objects means validation, the owner
|
|
18
|
-
* stamp, and later the close lock all happen without this file knowing they exist.
|
|
19
|
-
*
|
|
20
|
-
* PRICES NOTHING. Every figure it accepts is either an INPUT to the pricing engine
|
|
21
|
-
* (`RequestedDiscountPct`, `OverrideUnitPrice`) or a transcription of a signed document
|
|
22
|
-
* (`AnnualGrossFees`, `DiscountAmount`, `Total`). The four `Resolved*` columns are not writable through
|
|
23
|
-
* this operation at all — they come only from an `Orders.PreviewOrder` response, and accepting them
|
|
24
|
-
* here would be the hole through which locally computed money enters the app.
|
|
25
|
-
*
|
|
26
|
-
* @module @mj-biz-apps/sales-core-entities-server
|
|
27
|
-
*/
|
|
28
|
-
import { BaseRemotableOperation, LogError, } from '@memberjunction/core';
|
|
29
|
-
import { RegisterClass } from '@memberjunction/global';
|
|
30
|
-
import { SalesSaveDealOperation as SalesSaveDealOperationBase, } from '@mj-biz-apps/sales-entities';
|
|
31
|
-
const DEAL_ENTITY = 'MJ_BizApps_Sales: Deals';
|
|
32
|
-
const PIPELINE_ENTITY = 'MJ_BizApps_Sales: Pipelines';
|
|
33
|
-
/** Header fields copied straight through. Listed rather than spread so an unexpected key cannot ride in. */
|
|
34
|
-
const HEADER_FIELDS = [
|
|
35
|
-
'Name',
|
|
36
|
-
'PipelineID',
|
|
37
|
-
'PipelineStageID',
|
|
38
|
-
'DealTypeID',
|
|
39
|
-
'DealStatusTypeID',
|
|
40
|
-
'AccountID',
|
|
41
|
-
'PrimaryContactID',
|
|
42
|
-
'BillingContactID',
|
|
43
|
-
'Amount',
|
|
44
|
-
'CurrencyID',
|
|
45
|
-
'TermMonths',
|
|
46
|
-
'EstimatedProjectWeeks',
|
|
47
|
-
'ExecutionDate',
|
|
48
|
-
'StartDate',
|
|
49
|
-
'ExpectedCloseDate',
|
|
50
|
-
'Probability',
|
|
51
|
-
'ForecastCategoryTypeID',
|
|
52
|
-
'LeadSourceTypeID',
|
|
53
|
-
'AutoRenew',
|
|
54
|
-
'AnnualIncreasePctOverride',
|
|
55
|
-
'CancellationNoticeDaysOverride',
|
|
56
|
-
'PaymentMethod',
|
|
57
|
-
'ContractVariances',
|
|
58
|
-
'Description',
|
|
59
|
-
'NextStep',
|
|
60
|
-
'NextStepDate',
|
|
61
|
-
];
|
|
62
|
-
/** Line fields copied straight through. Note the absence of every `Resolved*` column — see the header. */
|
|
63
|
-
const LINE_FIELDS = [
|
|
64
|
-
'ProductID',
|
|
65
|
-
'ProductName',
|
|
66
|
-
'DealLineTypeID',
|
|
67
|
-
'Quantity',
|
|
68
|
-
'RequestedDiscountPct',
|
|
69
|
-
'OverrideUnitPrice',
|
|
70
|
-
'AnnualGrossFees',
|
|
71
|
-
'DiscountAmount',
|
|
72
|
-
'Total',
|
|
73
|
-
'TermMonths',
|
|
74
|
-
'ServicePeriodStart',
|
|
75
|
-
'ServicePeriodEnd',
|
|
76
|
-
'Description',
|
|
77
|
-
];
|
|
78
|
-
const SCHEDULE_FIELDS = ['PaymentDate', 'Amount', 'Description'];
|
|
79
|
-
function issue(Section, Message, Field = null) {
|
|
80
|
-
return { Section, Field, ClientKey: null, Severity: 'error', Message };
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Assigns a subset of fields from a plain payload onto an entity.
|
|
84
|
-
*
|
|
85
|
-
* `undefined` is SKIPPED and `null` is APPLIED, and the difference matters: omitting a key means "leave
|
|
86
|
-
* this alone" while sending null means "clear it". Collapsing the two would make a partial update wipe
|
|
87
|
-
* every field the caller did not mention.
|
|
88
|
-
*/
|
|
89
|
-
function assignFields(target, source, fields) {
|
|
90
|
-
const bag = source;
|
|
91
|
-
const entity = target;
|
|
92
|
-
for (const field of fields) {
|
|
93
|
-
if (bag[field] !== undefined) {
|
|
94
|
-
entity[field] = bag[field];
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
let SaveDealOperation = class SaveDealOperation extends SalesSaveDealOperationBase {
|
|
99
|
-
async InternalExecute(input, provider, user) {
|
|
100
|
-
const empty = {
|
|
101
|
-
Success: false,
|
|
102
|
-
Created: false,
|
|
103
|
-
Issues: [],
|
|
104
|
-
Lines: [],
|
|
105
|
-
PaymentSchedule: [],
|
|
106
|
-
};
|
|
107
|
-
if (!input?.Name?.trim()) {
|
|
108
|
-
return { ...empty, Issues: [issue('party', 'A deal needs a name.', 'Name')] };
|
|
109
|
-
}
|
|
110
|
-
if (!input.PipelineID) {
|
|
111
|
-
return { ...empty, Issues: [issue('party', 'A deal needs a pipeline.', 'PipelineID')] };
|
|
112
|
-
}
|
|
113
|
-
try {
|
|
114
|
-
const deal = await provider.GetEntityObject(DEAL_ENTITY, user);
|
|
115
|
-
const created = !input.ID;
|
|
116
|
-
if (created) {
|
|
117
|
-
deal.NewRecord();
|
|
118
|
-
}
|
|
119
|
-
else if (!(await deal.Load(input.ID))) {
|
|
120
|
-
return { ...empty, Issues: [issue('party', `Deal ${input.ID} was not found.`, 'ID')] };
|
|
121
|
-
}
|
|
122
|
-
assignFields(deal, input, HEADER_FIELDS);
|
|
123
|
-
// CompanyID must equal the pipeline's company — a CHECK cannot reach across the FK to
|
|
124
|
-
// compare them, so it is resolved here rather than trusted from the client. An explicitly
|
|
125
|
-
// supplied value is ignored in favour of the pipeline's, because the pipeline is the only
|
|
126
|
-
// source that can be right.
|
|
127
|
-
const companyID = await this.resolvePipelineCompany(input.PipelineID, provider, user);
|
|
128
|
-
if (!companyID) {
|
|
129
|
-
return {
|
|
130
|
-
...empty,
|
|
131
|
-
Issues: [issue('party', 'That pipeline could not be read, so the selling company is unknown.', 'PipelineID')],
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
deal.CompanyID = companyID;
|
|
135
|
-
// Children are attached BEFORE Save(), because Save() is the transaction: the header and
|
|
136
|
-
// every child land together or not at all.
|
|
137
|
-
if (input.Lines !== undefined) {
|
|
138
|
-
await this.applyLines(deal, input.Lines, provider, user);
|
|
139
|
-
}
|
|
140
|
-
if (input.PaymentSchedule !== undefined) {
|
|
141
|
-
await this.applySchedule(deal, input.PaymentSchedule, provider, user);
|
|
142
|
-
}
|
|
143
|
-
if (!(await deal.Save())) {
|
|
144
|
-
return {
|
|
145
|
-
...empty,
|
|
146
|
-
Issues: [
|
|
147
|
-
issue('party', `The deal could not be saved: ${deal.LatestResult?.CompleteMessage ?? 'unknown error'}`),
|
|
148
|
-
],
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
// The owner is expressed as INTENT and materialized as a DealTeamMember row, from which the
|
|
152
|
-
// denormalized Deal.OwnerEmployeeID stamp is derived. It runs after the save because the
|
|
153
|
-
// team row needs a persisted DealID.
|
|
154
|
-
if (input.OwnerEmployeeID) {
|
|
155
|
-
await deal.SetOwner(input.OwnerEmployeeID, user);
|
|
156
|
-
if (!(await deal.Save())) {
|
|
157
|
-
return {
|
|
158
|
-
...empty,
|
|
159
|
-
DealID: deal.ID,
|
|
160
|
-
Created: created,
|
|
161
|
-
Issues: [issue('party', 'The deal saved, but the owner stamp could not be written.', 'OwnerEmployeeID')],
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return {
|
|
166
|
-
Success: true,
|
|
167
|
-
DealID: deal.ID,
|
|
168
|
-
DealNumber: deal.DealNumber ?? null,
|
|
169
|
-
Created: created,
|
|
170
|
-
Issues: [],
|
|
171
|
-
Lines: deal.Lines.map((line, i) => ({
|
|
172
|
-
ClientKey: input.Lines?.[i]?.ClientKey ?? null,
|
|
173
|
-
ID: line.ID,
|
|
174
|
-
DisplayOrder: line.DisplayOrder,
|
|
175
|
-
})),
|
|
176
|
-
PaymentSchedule: deal.PaymentSchedule.map((row, i) => ({
|
|
177
|
-
ClientKey: input.PaymentSchedule?.[i]?.ClientKey ?? null,
|
|
178
|
-
ID: row.ID,
|
|
179
|
-
DisplayOrder: row.DisplayOrder,
|
|
180
|
-
})),
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
catch (err) {
|
|
184
|
-
LogError(`Sales.SaveDeal failed: ${err}`);
|
|
185
|
-
return { ...empty, Issues: [issue('party', `The deal could not be saved: ${err}`)] };
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
/** The pipeline owns the selling company. NOT NULL on Pipeline, so a successful read always has one. */
|
|
189
|
-
async resolvePipelineCompany(pipelineID, provider, user) {
|
|
190
|
-
const view = provider;
|
|
191
|
-
const result = await view.RunView({
|
|
192
|
-
EntityName: PIPELINE_ENTITY,
|
|
193
|
-
ExtraFilter: `ID = '${pipelineID}'`,
|
|
194
|
-
ResultType: 'simple',
|
|
195
|
-
Fields: ['CompanyID'],
|
|
196
|
-
}, user);
|
|
197
|
-
if (!result.Success) {
|
|
198
|
-
LogError(`Sales.SaveDeal: pipeline lookup failed: ${result.ErrorMessage}`);
|
|
199
|
-
return null;
|
|
200
|
-
}
|
|
201
|
-
const row = (result.Results ?? [])[0];
|
|
202
|
-
return row?.CompanyID ?? null;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Reconciles the submitted lines against what is stored.
|
|
206
|
-
*
|
|
207
|
-
* The array is the COMPLETE DESIRED SET: a stored line whose ID is absent from it is removed. That
|
|
208
|
-
* is what lets a workspace holding the whole tree just send its current state, with no delta
|
|
209
|
-
* bookkeeping in the browser — and `RemoveLine` queues the deletion so it happens inside the same
|
|
210
|
-
* transaction as the inserts.
|
|
211
|
-
*/
|
|
212
|
-
async applyLines(deal, lines, provider, user) {
|
|
213
|
-
await deal.LoadLines(user);
|
|
214
|
-
const keep = new Set(lines.map((l) => l.ID).filter((id) => !!id));
|
|
215
|
-
for (let i = deal.Lines.length - 1; i >= 0; i--) {
|
|
216
|
-
if (!keep.has(deal.Lines[i].ID)) {
|
|
217
|
-
deal.RemoveLine(i);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
const byID = new Map(deal.Lines.map((l) => [l.ID, l]));
|
|
221
|
-
const ordered = [];
|
|
222
|
-
for (const incoming of lines) {
|
|
223
|
-
let entity = incoming.ID ? byID.get(incoming.ID) : undefined;
|
|
224
|
-
if (!entity) {
|
|
225
|
-
entity = await deal.CreateLine(user);
|
|
226
|
-
}
|
|
227
|
-
assignFields(entity, incoming, LINE_FIELDS);
|
|
228
|
-
ordered.push(entity);
|
|
229
|
-
}
|
|
230
|
-
// Rebuild the collection in the caller's order — the array's order is what DisplayOrder is
|
|
231
|
-
// derived from on save, so submitted order is the authority on how lines read.
|
|
232
|
-
this.reorder(deal.Lines, ordered);
|
|
233
|
-
}
|
|
234
|
-
/** Identical semantics to {@link applyLines}. */
|
|
235
|
-
async applySchedule(deal, rows, provider, user) {
|
|
236
|
-
await deal.LoadPaymentSchedule(user);
|
|
237
|
-
const keep = new Set(rows.map((r) => r.ID).filter((id) => !!id));
|
|
238
|
-
for (let i = deal.PaymentSchedule.length - 1; i >= 0; i--) {
|
|
239
|
-
if (!keep.has(deal.PaymentSchedule[i].ID)) {
|
|
240
|
-
deal.RemoveScheduleRow(i);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
const byID = new Map(deal.PaymentSchedule.map((r) => [r.ID, r]));
|
|
244
|
-
const ordered = [];
|
|
245
|
-
for (const incoming of rows) {
|
|
246
|
-
let entity = incoming.ID ? byID.get(incoming.ID) : undefined;
|
|
247
|
-
if (!entity) {
|
|
248
|
-
entity = await deal.CreateScheduleRow(user);
|
|
249
|
-
}
|
|
250
|
-
assignFields(entity, incoming, SCHEDULE_FIELDS);
|
|
251
|
-
ordered.push(entity);
|
|
252
|
-
}
|
|
253
|
-
this.reorder(deal.PaymentSchedule, ordered);
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Rewrites a collection in place to match `ordered`. In place because the getters expose the live
|
|
257
|
-
* arrays the entity's `Save()` walks; replacing them would leave `Save()` writing the old order.
|
|
258
|
-
*/
|
|
259
|
-
reorder(live, ordered) {
|
|
260
|
-
live.length = 0;
|
|
261
|
-
live.push(...ordered);
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
SaveDealOperation = __decorate([
|
|
265
|
-
RegisterClass(BaseRemotableOperation, 'Sales.SaveDeal')
|
|
266
|
-
], SaveDealOperation);
|
|
267
|
-
export { SaveDealOperation };
|
|
268
|
-
//# sourceMappingURL=SaveDealOperation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SaveDealOperation.js","sourceRoot":"","sources":["../src/SaveDealOperation.ts"],"names":[],"mappings":";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AAO,CAAI,IAAS,EAAE,OAAY;QACtC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;IAC1B,CAAC;CACJ,CAAA;AA/MY,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,EAAE,gBAAgB,CAAC;GAC3C,iBAAiB,CA+M7B"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview The activity vocabulary, and the one convention decision the whole feature turns on.
|
|
3
|
-
*
|
|
4
|
-
* Every union in this file is a CHECK constraint in `__mj_BizAppsCommon`, read off the live schema
|
|
5
|
-
* rather than guessed. They are declared as union types, not enums, so the values cross a package
|
|
6
|
-
* boundary as plain strings — and so a value the database would refuse cannot be constructed here.
|
|
7
|
-
*
|
|
8
|
-
* @module @mj-biz-apps/sales-core-entities-server
|
|
9
|
-
*/
|
|
10
|
-
/** `CK_Activity_Direction`. */
|
|
11
|
-
export type ActivityDirection = 'Inbound' | 'Outbound' | 'Internal';
|
|
12
|
-
/** `CK_Activity_Status`. */
|
|
13
|
-
export type ActivityStatus = 'Logged' | 'Scheduled' | 'Completed' | 'Cancelled' | 'Failed';
|
|
14
|
-
/** `CK_Activity_Source`. Sales writes `Manual` by hand and `Integration` from the ingest. */
|
|
15
|
-
export type ActivitySource = 'Manual' | 'System' | 'Integration';
|
|
16
|
-
/** `CK_Activity_Visibility`. */
|
|
17
|
-
export type ActivityVisibility = 'Internal' | 'Private';
|
|
18
|
-
/** `CK_Activity_Outcome`. Nullable — most activities have no outcome to state. */
|
|
19
|
-
export type ActivityOutcome = 'Connected' | 'LeftVoicemail' | 'NoAnswer' | 'NoShow' | 'Bounced' | 'Interested' | 'NotInterested';
|
|
20
|
-
/** `CK_ActivityLink_Role`. */
|
|
21
|
-
export type ActivityLinkRole = 'Regarding' | 'Participant' | 'From' | 'To' | 'Cc' | 'Bcc' | 'Organizer' | 'Attendee' | 'LoggedFor';
|
|
22
|
-
/** `CK_ActivityLink_IdentityKind` — the unresolved half of a link. */
|
|
23
|
-
export type ActivityIdentityKind = 'Email' | 'Phone' | 'ExternalUser';
|
|
24
|
-
/**
|
|
25
|
-
* The seeded `ActivityType.Code` values.
|
|
26
|
-
*
|
|
27
|
-
* RESOLVED BY CODE, NEVER BY NAME. `Code` and `Name` happen to be identical strings in today's seed
|
|
28
|
-
* (Call, Chat, Email, Meeting, Note, SMS), which is exactly why this must be explicit: a lookup written
|
|
29
|
-
* against `Name` would pass every test today and break silently the first time somebody renames the
|
|
30
|
-
* display label of a row whose code never changed. The vocabulary gate exists for this class of
|
|
31
|
-
* mistake.
|
|
32
|
-
*/
|
|
33
|
-
export type ActivityTypeCode = 'Call' | 'Chat' | 'Email' | 'Meeting' | 'Note' | 'SMS';
|
|
34
|
-
/** Entity names. These strings are the whole dependency surface on the other two apps. */
|
|
35
|
-
export declare const E_ACTIVITY = "MJ_BizApps_Common: Activities";
|
|
36
|
-
export declare const E_ACTIVITY_LINK = "MJ_BizApps_Common: Activity Links";
|
|
37
|
-
export declare const E_ACTIVITY_TYPE = "MJ_BizApps_Common: Activity Types";
|
|
38
|
-
export declare const E_ACTIVITY_SYNC_CONNECTION = "MJ_BizApps_Common: Activity Sync Connections";
|
|
39
|
-
export declare const E_ACTIVITY_SYNC_RULE = "MJ_BizApps_Common: Activity Sync Rules";
|
|
40
|
-
export declare const E_CONTACT_METHOD = "MJ_BizApps_Common: Contact Methods";
|
|
41
|
-
export declare const E_DEAL = "MJ_BizApps_Sales: Deals";
|
|
42
|
-
export declare const E_DEAL_STATUS_TYPE = "MJ_BizApps_Sales: Deal Status Types";
|
|
43
|
-
/**
|
|
44
|
-
* ─────────────────────────────────────────────────────────────────────────────────────────────────
|
|
45
|
-
* THE LINK CONVENTION. Decided here, once, because nothing in the schema decides it.
|
|
46
|
-
* ─────────────────────────────────────────────────────────────────────────────────────────────────
|
|
47
|
-
*
|
|
48
|
-
* `SalesAccount.ID` IS `Organization.ID` and `SalesContact.ID` IS `Person.ID` — verified as real
|
|
49
|
-
* foreign keys, `FK_SalesAccount_Organization` and `FK_SalesContact_Person`, both on the `ID` column.
|
|
50
|
-
* Shared-primary-key IsA. So an `ActivityLink` to `Organizations/<id>` and one to
|
|
51
|
-
* `Sales Accounts/<id>` name **the same human or company under two different `EntityID`s**, and
|
|
52
|
-
* nothing anywhere normalizes between them.
|
|
53
|
-
*
|
|
54
|
-
* Left unpicked, that does not produce an error. It produces two half-timelines: the ingest writes
|
|
55
|
-
* one convention, a person logging a call by hand writes the other, and each view shows the half it
|
|
56
|
-
* happens to query. That is the failure this constant exists to prevent.
|
|
57
|
-
*
|
|
58
|
-
* ── THE PARTIES ARE LINKED UNDER COMMON'S ENTITIES ──
|
|
59
|
-
*
|
|
60
|
-
* Three reasons, in the order that decided it:
|
|
61
|
-
*
|
|
62
|
-
* 1. **The ingest resolves to common natively, and the alternative can fail.** A participant is
|
|
63
|
-
* identified by matching an email address against `ContactMethod`, whose columns are `PersonID`
|
|
64
|
-
* and `OrganizationID` — common's parents. Translating those to the sales children would be a
|
|
65
|
-
* second lookup that can come back EMPTY: a Person with no `SalesContact` row is an ordinary
|
|
66
|
-
* thing (any employee, any contact belonging to another app). Under a sales-child convention
|
|
67
|
-
* that link would have to be dropped or a stub created, and the common migration explicitly
|
|
68
|
-
* forbids auto-creating stub People. Under this convention it is simply written.
|
|
69
|
-
*
|
|
70
|
-
* 2. **The row is common's.** `Activity` lives in `__mj_BizAppsCommon`. An activity involving a
|
|
71
|
-
* person is a fact about the person, not about their sales-contact role — and when a second app
|
|
72
|
-
* extends `Person`, its activities point at the same rows and that human has one timeline
|
|
73
|
-
* instead of one per app.
|
|
74
|
-
*
|
|
75
|
-
* 3. **It survives KI-1.** `AllowMultipleSubtypes` is still false on `Person` and `Organization`,
|
|
76
|
-
* so the sales children are the only children today. A convention anchored on them would need
|
|
77
|
-
* rewriting the day that changes; one anchored on the parents would not.
|
|
78
|
-
*
|
|
79
|
-
* ── WHAT SALES KEEPS ──
|
|
80
|
-
*
|
|
81
|
-
* The DEAL is still linked as a sales record — `MJ_BizApps_Sales: Deals`, role `Regarding`. That is
|
|
82
|
-
* the anchor every read starts from. So the split is clean rather than arbitrary: **sales owns the
|
|
83
|
-
* deal link, common owns the party links.**
|
|
84
|
-
*
|
|
85
|
-
* ── AND THE COST IS ZERO, WHICH IS WHY THIS IS NOT A TRADE-OFF ──
|
|
86
|
-
*
|
|
87
|
-
* The one argument for the sales children was that `Deal.AccountID` and `Deal.PrimaryContactID`
|
|
88
|
-
* already hold those IDs, so no translation is needed on the manual path. But because the PK is
|
|
89
|
-
* SHARED, those very same values ARE the Organization and Person IDs. `Deal.AccountID` can be used
|
|
90
|
-
* verbatim as a `RecordID` under `E_ORGANIZATION`. Nothing is converted in either direction.
|
|
91
|
-
*/
|
|
92
|
-
export declare const E_PERSON = "MJ_BizApps_Common: People";
|
|
93
|
-
export declare const E_ORGANIZATION = "MJ_BizApps_Common: Organizations";
|
|
94
|
-
/**
|
|
95
|
-
* The source-system name stamped on every ingested row, and half of the dedupe key.
|
|
96
|
-
*
|
|
97
|
-
* `UQ_Activity_External` is unique on `(SourceSystem, ExternalID)` and filtered to
|
|
98
|
-
* `WHERE ExternalID IS NOT NULL`, with `CK_Activity_External` requiring both or neither. So this
|
|
99
|
-
* string is not a label — it is a namespace, and changing it would orphan every row already ingested
|
|
100
|
-
* and re-import the lot.
|
|
101
|
-
*/
|
|
102
|
-
export declare const SOURCE_SYSTEM_M365 = "Microsoft365";
|
|
103
|
-
//# sourceMappingURL=activity-vocabulary.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"activity-vocabulary.d.ts","sourceRoot":"","sources":["../../src/activities/activity-vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,+BAA+B;AAC/B,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAEpE,4BAA4B;AAC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G;AACH,eAAO,MAAM,kBAAkB,iBAAiB,CAAC"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview The activity vocabulary, and the one convention decision the whole feature turns on.
|
|
3
|
-
*
|
|
4
|
-
* Every union in this file is a CHECK constraint in `__mj_BizAppsCommon`, read off the live schema
|
|
5
|
-
* rather than guessed. They are declared as union types, not enums, so the values cross a package
|
|
6
|
-
* boundary as plain strings — and so a value the database would refuse cannot be constructed here.
|
|
7
|
-
*
|
|
8
|
-
* @module @mj-biz-apps/sales-core-entities-server
|
|
9
|
-
*/
|
|
10
|
-
/** Entity names. These strings are the whole dependency surface on the other two apps. */
|
|
11
|
-
export const E_ACTIVITY = 'MJ_BizApps_Common: Activities';
|
|
12
|
-
export const E_ACTIVITY_LINK = 'MJ_BizApps_Common: Activity Links';
|
|
13
|
-
export const E_ACTIVITY_TYPE = 'MJ_BizApps_Common: Activity Types';
|
|
14
|
-
export const E_ACTIVITY_SYNC_CONNECTION = 'MJ_BizApps_Common: Activity Sync Connections';
|
|
15
|
-
export const E_ACTIVITY_SYNC_RULE = 'MJ_BizApps_Common: Activity Sync Rules';
|
|
16
|
-
export const E_CONTACT_METHOD = 'MJ_BizApps_Common: Contact Methods';
|
|
17
|
-
export const E_DEAL = 'MJ_BizApps_Sales: Deals';
|
|
18
|
-
export const E_DEAL_STATUS_TYPE = 'MJ_BizApps_Sales: Deal Status Types';
|
|
19
|
-
/**
|
|
20
|
-
* ─────────────────────────────────────────────────────────────────────────────────────────────────
|
|
21
|
-
* THE LINK CONVENTION. Decided here, once, because nothing in the schema decides it.
|
|
22
|
-
* ─────────────────────────────────────────────────────────────────────────────────────────────────
|
|
23
|
-
*
|
|
24
|
-
* `SalesAccount.ID` IS `Organization.ID` and `SalesContact.ID` IS `Person.ID` — verified as real
|
|
25
|
-
* foreign keys, `FK_SalesAccount_Organization` and `FK_SalesContact_Person`, both on the `ID` column.
|
|
26
|
-
* Shared-primary-key IsA. So an `ActivityLink` to `Organizations/<id>` and one to
|
|
27
|
-
* `Sales Accounts/<id>` name **the same human or company under two different `EntityID`s**, and
|
|
28
|
-
* nothing anywhere normalizes between them.
|
|
29
|
-
*
|
|
30
|
-
* Left unpicked, that does not produce an error. It produces two half-timelines: the ingest writes
|
|
31
|
-
* one convention, a person logging a call by hand writes the other, and each view shows the half it
|
|
32
|
-
* happens to query. That is the failure this constant exists to prevent.
|
|
33
|
-
*
|
|
34
|
-
* ── THE PARTIES ARE LINKED UNDER COMMON'S ENTITIES ──
|
|
35
|
-
*
|
|
36
|
-
* Three reasons, in the order that decided it:
|
|
37
|
-
*
|
|
38
|
-
* 1. **The ingest resolves to common natively, and the alternative can fail.** A participant is
|
|
39
|
-
* identified by matching an email address against `ContactMethod`, whose columns are `PersonID`
|
|
40
|
-
* and `OrganizationID` — common's parents. Translating those to the sales children would be a
|
|
41
|
-
* second lookup that can come back EMPTY: a Person with no `SalesContact` row is an ordinary
|
|
42
|
-
* thing (any employee, any contact belonging to another app). Under a sales-child convention
|
|
43
|
-
* that link would have to be dropped or a stub created, and the common migration explicitly
|
|
44
|
-
* forbids auto-creating stub People. Under this convention it is simply written.
|
|
45
|
-
*
|
|
46
|
-
* 2. **The row is common's.** `Activity` lives in `__mj_BizAppsCommon`. An activity involving a
|
|
47
|
-
* person is a fact about the person, not about their sales-contact role — and when a second app
|
|
48
|
-
* extends `Person`, its activities point at the same rows and that human has one timeline
|
|
49
|
-
* instead of one per app.
|
|
50
|
-
*
|
|
51
|
-
* 3. **It survives KI-1.** `AllowMultipleSubtypes` is still false on `Person` and `Organization`,
|
|
52
|
-
* so the sales children are the only children today. A convention anchored on them would need
|
|
53
|
-
* rewriting the day that changes; one anchored on the parents would not.
|
|
54
|
-
*
|
|
55
|
-
* ── WHAT SALES KEEPS ──
|
|
56
|
-
*
|
|
57
|
-
* The DEAL is still linked as a sales record — `MJ_BizApps_Sales: Deals`, role `Regarding`. That is
|
|
58
|
-
* the anchor every read starts from. So the split is clean rather than arbitrary: **sales owns the
|
|
59
|
-
* deal link, common owns the party links.**
|
|
60
|
-
*
|
|
61
|
-
* ── AND THE COST IS ZERO, WHICH IS WHY THIS IS NOT A TRADE-OFF ──
|
|
62
|
-
*
|
|
63
|
-
* The one argument for the sales children was that `Deal.AccountID` and `Deal.PrimaryContactID`
|
|
64
|
-
* already hold those IDs, so no translation is needed on the manual path. But because the PK is
|
|
65
|
-
* SHARED, those very same values ARE the Organization and Person IDs. `Deal.AccountID` can be used
|
|
66
|
-
* verbatim as a `RecordID` under `E_ORGANIZATION`. Nothing is converted in either direction.
|
|
67
|
-
*/
|
|
68
|
-
export const E_PERSON = 'MJ_BizApps_Common: People';
|
|
69
|
-
export const E_ORGANIZATION = 'MJ_BizApps_Common: Organizations';
|
|
70
|
-
/**
|
|
71
|
-
* The source-system name stamped on every ingested row, and half of the dedupe key.
|
|
72
|
-
*
|
|
73
|
-
* `UQ_Activity_External` is unique on `(SourceSystem, ExternalID)` and filtered to
|
|
74
|
-
* `WHERE ExternalID IS NOT NULL`, with `CK_Activity_External` requiring both or neither. So this
|
|
75
|
-
* string is not a label — it is a namespace, and changing it would orphan every row already ingested
|
|
76
|
-
* and re-import the lot.
|
|
77
|
-
*/
|
|
78
|
-
export const SOURCE_SYSTEM_M365 = 'Microsoft365';
|
|
79
|
-
//# sourceMappingURL=activity-vocabulary.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"activity-vocabulary.js","sourceRoot":"","sources":["../../src/activities/activity-vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkDH,0FAA0F;AAC1F,MAAM,CAAC,MAAM,UAAU,GAAG,+BAA+B,CAAC;AAC1D,MAAM,CAAC,MAAM,eAAe,GAAG,mCAAmC,CAAC;AACnE,MAAM,CAAC,MAAM,eAAe,GAAG,mCAAmC,CAAC;AACnE,MAAM,CAAC,MAAM,0BAA0B,GAAG,8CAA8C,CAAC;AACzF,MAAM,CAAC,MAAM,oBAAoB,GAAG,wCAAwC,CAAC;AAC7E,MAAM,CAAC,MAAM,gBAAgB,GAAG,oCAAoC,CAAC;AACrE,MAAM,CAAC,MAAM,MAAM,GAAG,yBAAyB,CAAC;AAChD,MAAM,CAAC,MAAM,kBAAkB,GAAG,qCAAqC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,2BAA2B,CAAC;AACpD,MAAM,CAAC,MAAM,cAAc,GAAG,kCAAkC,CAAC;AAEjE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC"}
|